commit
a068006111
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="libs/commons-codec-1.15.jar"/>
|
||||
<classpathentry kind="lib" path="libs/commons-collections4-4.4.jar"/>
|
||||
<classpathentry kind="lib" path="libs/commons-compress-1.21.jar"/>
|
||||
<classpathentry kind="lib" path="libs/commons-io-2.11.0.jar"/>
|
||||
<classpathentry kind="lib" path="libs/commons-math3-3.6.1.jar"/>
|
||||
<classpathentry kind="lib" path="libs/poi-5.2.1.jar"/>
|
||||
<classpathentry kind="lib" path="libs/poi-ooxml-5.2.1.jar"/>
|
||||
<classpathentry kind="lib" path="libs/poi-ooxml-lite-5.2.1.jar"/>
|
||||
<classpathentry kind="lib" path="libs/swingx-core-1.6.2.jar"/>
|
||||
<classpathentry kind="lib" path="libs/xml-apis-1.4.01.jar"/>
|
||||
<classpathentry kind="lib" path="libs/xmlbeans-5.0.3.jar"/>
|
||||
<classpathentry kind="lib" path="json-20151123.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
@ -0,0 +1 @@
|
||||
/bin/
|
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>com.connor.ahboxinwei.plm</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,15 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=11
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
|
||||
org.eclipse.jdt.core.compiler.release=enabled
|
||||
org.eclipse.jdt.core.compiler.source=11
|
@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.ui.text.custom_code_templates=
|
@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
|
@ -0,0 +1,103 @@
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: boxinwei
|
||||
Bundle-SymbolicName: com.connor.ahboxinwei.plm;singleton:=true
|
||||
Bundle-Version: 1.0.0
|
||||
Bundle-Localization: plugin
|
||||
Automatic-Module-Name: com.conor.ferrorTech.metal
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Import-Package: com.teamcenter.rac.aif,
|
||||
com.teamcenter.rac.aif.kernel,
|
||||
com.teamcenter.rac.aifrcp,
|
||||
com.teamcenter.rac.classification.common.table,
|
||||
com.teamcenter.rac.classification.icm,
|
||||
com.teamcenter.rac.kernel,
|
||||
com.teamcenter.rac.util,
|
||||
com.teamcenter.services.rac.core,
|
||||
com.teamcenter.services.rac.core._2006_03,
|
||||
com.teamcenter.services.rac.core._2008_06,
|
||||
com.teamcenter.services.rac.core._2013_05,
|
||||
com.teamcenter.soa.exceptions,
|
||||
org.apache.commons.lang,
|
||||
org.eclipse.core.commands,
|
||||
org.eclipse.core.databinding
|
||||
Require-Bundle: org.eclipse.ui,
|
||||
org.eclipse.core.runtime,
|
||||
com.teamcenter.rac.aifrcp,
|
||||
com.teamcenter.rac.common,
|
||||
com.teamcenter.rac.ui.commands,
|
||||
com.teamcenter.rac.external,
|
||||
com.teamcenter.rac.kernel,
|
||||
com.teamcenter.rac.tcapps,
|
||||
com.teamcenter.rac.util,
|
||||
TcSoaCadRac,
|
||||
TcSoaCommon,
|
||||
TcSoaCoreRac,
|
||||
TcSoaCoreTypes,
|
||||
TcSoaCoreLoose,
|
||||
com.teamcenter.rac.classification.icm,
|
||||
com.teamcenter.rac.tcapps,
|
||||
com.teamcenter.rac.workflow.processdesigner;bundle-version="14000.3.0",
|
||||
TcSoaWorkflowRac;bundle-version="14000.3.0"
|
||||
Export-Package: .,
|
||||
com.connor.ferrorTech.metal,
|
||||
com.connor.ferrorTech.metal.NPIproject.NPIprojectCreate,
|
||||
com.connor.ferrorTech.metal.NPIproject.NPIprojectCreate.daheReadExcel,
|
||||
com.connor.ferrorTech.metal.NPIproject.NPIprojectCreate.entity,
|
||||
com.connor.ferrorTech.metal.NPIproject.customerDrawingsCreate,
|
||||
com.connor.ferrorTech.metal.NPIproject.customerDrawingsUpload,
|
||||
com.connor.ferrorTech.metal.batchDownload,
|
||||
com.connor.ferrorTech.metal.bomProcess,
|
||||
com.connor.ferrorTech.metal.changeManagement.createECO,
|
||||
com.connor.ferrorTech.metal.changeManagement.createECR,
|
||||
com.connor.ferrorTech.metal.constant,
|
||||
com.connor.ferrorTech.metal.createTechnicalDocuments,
|
||||
com.connor.ferrorTech.metal.createTechnicalDocuments.AinternalDrawing,
|
||||
com.connor.ferrorTech.metal.createTechnicalDocuments.BprocessControl,
|
||||
com.connor.ferrorTech.metal.createTechnicalDocuments.CredlineDrawing,
|
||||
com.connor.ferrorTech.metal.createTechnicalDocuments.DrawMaterialDrawing,
|
||||
com.connor.ferrorTech.metal.createTechnicalDocuments.EsubPartsDrawing,
|
||||
com.connor.ferrorTech.metal.createTechnicalDocuments.FsetupSheet,
|
||||
com.connor.ferrorTech.metal.createTechnicalDocuments.GreworkInstruction,
|
||||
com.connor.ferrorTech.metal.createTechnicalDocuments.HncFile,
|
||||
com.connor.ferrorTech.metal.createTechnicalDocuments.IprocessDrawing,
|
||||
com.connor.ferrorTech.metal.createTechnicalDocuments.JpreMillDrawing,
|
||||
com.connor.ferrorTech.metal.createTechnicalDocuments.JrjitFixtureDrawing,
|
||||
com.connor.ferrorTech.metal.createTechnicalDocuments.KtoolingList,
|
||||
com.connor.ferrorTech.metal.createTechnicalDocuments.LstandardInstruction,
|
||||
com.connor.ferrorTech.metal.createTechnicalDocuments.OuploadDocuments,
|
||||
com.connor.ferrorTech.metal.createTechnicalDocuments.PapprovalofTecDocuments,
|
||||
com.connor.ferrorTech.metal.exception,
|
||||
com.connor.ferrorTech.metal.importMaterial,
|
||||
com.connor.ferrorTech.metal.material.finishedProducts,
|
||||
com.connor.ferrorTech.metal.material.material,
|
||||
com.connor.ferrorTech.metal.material.semiFinishedProducts,
|
||||
com.connor.ferrorTech.metal.processManagement.classificationCraft,
|
||||
com.connor.ferrorTech.metal.processManagement.classificationProcesses,
|
||||
com.connor.ferrorTech.metal.processManagement.createCraft,
|
||||
com.connor.ferrorTech.metal.processManagement.createProcesses,
|
||||
com.connor.ferrorTech.metal.processManagement.entity,
|
||||
com.connor.ferrorTech.metal.quotationManagement.createClientFile,
|
||||
com.connor.ferrorTech.metal.quotationManagement.createQuotationDrawings,
|
||||
com.connor.ferrorTech.metal.quotationManagement.createQuotationProject,
|
||||
com.connor.ferrorTech.metal.quotationManagement.createTechnicalQuotation,
|
||||
com.connor.ferrorTech.metal.quotationManagement.externalQuotationCreate,
|
||||
com.connor.ferrorTech.metal.quotationManagement.uploadQuotationDrawings,
|
||||
com.connor.ferrorTech.metal.share,
|
||||
com.connor.ferrorTech.metal.util
|
||||
Bundle-Vendor: boxinwei
|
||||
Bundle-ClassPath: .,
|
||||
libs/commons-codec-1.15.jar,
|
||||
libs/commons-collections4-4.4.jar,
|
||||
libs/commons-compress-1.21.jar,
|
||||
libs/commons-io-2.11.0.jar,
|
||||
libs/commons-math3-3.6.1.jar,
|
||||
libs/poi-5.2.1.jar,
|
||||
libs/poi-ooxml-5.2.1.jar,
|
||||
libs/poi-ooxml-lite-5.2.1.jar,
|
||||
libs/swingx-core-1.6.2.jar,
|
||||
libs/xml-apis-1.4.01.jar,
|
||||
libs/xmlbeans-5.0.3.jar,
|
||||
json-20151123.jar
|
||||
Bundle-ActivationPolicy: lazy
|
||||
|
@ -0,0 +1,21 @@
|
||||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
build.properties,\
|
||||
plugin.xml,\
|
||||
libs/commons-codec-1.15.jar,\
|
||||
libs/commons-collections4-4.4.jar,\
|
||||
libs/commons-compress-1.21.jar,\
|
||||
libs/commons-io-2.11.0.jar,\
|
||||
libs/commons-math3-3.6.1.jar,\
|
||||
libs/poi-5.2.1.jar,\
|
||||
libs/poi-ooxml-5.2.1.jar,\
|
||||
libs/poi-ooxml-lite-5.2.1.jar,\
|
||||
libs/swingx-core-1.6.2.jar,\
|
||||
libs/xml-apis-1.4.01.jar,\
|
||||
libs/xmlbeans-5.0.3.jar,\
|
||||
plugin_zh_CN.properties,\
|
||||
plugin.properties,\
|
||||
json-20151123.jar
|
||||
jars.compile.order = .
|
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,62 @@
|
||||
vf.1=Share File Auto Distribution
|
||||
vf.2=File Management
|
||||
vf.3=Import Bill Of Materials
|
||||
|
||||
plugin.0=PLM Menu
|
||||
|
||||
quo.0=Quote Management
|
||||
quo.1=Create customer profiles
|
||||
quo.2=Create quotation projects
|
||||
quo.3=Create quotation drawings
|
||||
quo.4=Upload quotation drawings
|
||||
quo.5=Create technical quotations
|
||||
quo.6=Create external quotations
|
||||
|
||||
npi.0=NPI Project
|
||||
npi.1=Create NPI project
|
||||
npi.2=Create NPI No Quotation Project
|
||||
npi.3=Create customer drawings
|
||||
npi.4=Upload customer drawings
|
||||
|
||||
mar.0=Create Material Master
|
||||
mar.1=Finished products
|
||||
mar.2=Semi-finished products
|
||||
mar.3=Raw Material
|
||||
|
||||
gy.0=Process Management
|
||||
gy.1=Process Routing Library
|
||||
gy.2=Operation Library
|
||||
gy.3=Create Routing
|
||||
gy.4=Create Operation
|
||||
|
||||
cg.0=Change Management
|
||||
cg.1=Create ECR
|
||||
cg.2=Create ECO
|
||||
|
||||
tech.0=Create Engineering document
|
||||
tech.1=Create Internal Drawing
|
||||
tech.2=Create Process Control
|
||||
tech.3=Create Redline Drawing
|
||||
tech.4=Create RawMaterial Drawing
|
||||
tech.5=Create Sub-Parts Drawing
|
||||
tech.6=Create Setup Sheet
|
||||
tech.7=Create Rework Work Instruction
|
||||
tech.8=Create CNC file
|
||||
tech.9=Create Process Drawing
|
||||
tech.10=Create Pre-Mill Drawing
|
||||
tech.11=Create Jig & Fixture Drawing
|
||||
tech.12=Create Tooling List
|
||||
tech.13=Create Standard Work Instruction
|
||||
tech.14=Create In-Process Inspection Plan
|
||||
tech.15=Upload Documents
|
||||
tech.16=Batch Approval Of Tec-Documents
|
||||
|
||||
BOMgy.0=BOM process batch approval
|
||||
|
||||
batchDownload.0=Batch Download Files
|
||||
|
||||
plugin.1=Design Management
|
||||
toBom.1=DBOM To EBOM
|
||||
|
||||
|
||||
|
@ -0,0 +1,296 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
|
||||
<extension
|
||||
id="startTest"
|
||||
name="start hello teamcenter"
|
||||
point="org.eclipse.ui.startup">
|
||||
<startup class="com.connor.ferrorTech.metal.share.start"/>
|
||||
</extension>
|
||||
|
||||
<extension point="org.eclipse.ui.commands">
|
||||
<category name="Double Category" id="com.connor.ferrorTech.metal.commands.category">
|
||||
</category>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="%quo.1" id="com.connor.ferrorTech.metal.quotationManagher.createClientFile">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="%quo.2" id="com.connor.ferrorTech.metal.quotationManagher.createQuotationProject">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="%quo.3" id="com.connor.ferrorTech.metal.quotationManagher.createQuotationDrawings">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="%quo.4" id="com.connor.ferrorTech.metal.quotationManagher.uploadQuotationDrawings">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="%quo.5" id="com.connor.ferrorTech.metal.quotationManagher.createTechnicalQuotation">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="%quo.6" id="com.connor.ferrorTech.metal.quotationManagher.CreateExternalQuotation">
|
||||
</command>
|
||||
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="%npi.1" id="com.connor.ferrorTech.metal.NPIproject.createNPIproject">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="%npi.2" id="com.connor.ferrorTech.metal.NPIproject.createNPIprojectByQuotation">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="%npi.3" id="com.connor.ferrorTech.metal.NPIproject.createCustomerDrawing">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="%npi.4" id="com.connor.ferrorTech.metal.NPIproject.uploadCustomerDrawing">
|
||||
</command>
|
||||
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="%mar.1" id="com.connor.ferrorTech.metal.material.finishedProducts">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="%mar.2" id="com.connor.ferrorTech.metal.material.semiFinishedProducts">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="%mar.3" id="com.connor.ferrorTech.metal.material.material">
|
||||
</command>
|
||||
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="%gy.1" id="com.connor.ferrorTech.metal.processManagement.callCraft">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="%gy.2" id="com.connor.ferrorTech.metal.processManagement.callProcesses">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="%gy.3" id="com.connor.ferrorTech.metal.processManagement.createCraft">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="%gy.4" id="com.connor.ferrorTech.metal.processManagement.createProcesses">
|
||||
</command>
|
||||
|
||||
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="%cg.1" id="com.connor.ferrorTech.metal.changeManagement.createECR">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="%cg.2" id="com.connor.ferrorTech.metal.changeManagement.createECO">
|
||||
</command>
|
||||
|
||||
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="%tech.1" id="com.connor.ferrorTech.metal.createTechnicalDocuments.internalDrawing">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="%tech.2" id="com.connor.ferrorTech.metal.createTechnicalDocuments.processControl">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="%tech.3" id="com.connor.ferrorTech.metal.createTechnicalDocuments.redlineDrawing">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="%tech.4" id="com.connor.ferrorTech.metal.createTechnicalDocuments.rawMaterialDrawing">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="%tech.5" id="com.connor.ferrorTech.metal.createTechnicalDocuments.subPartsDrawing">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="%tech.6" id="com.connor.ferrorTech.metal.createTechnicalDocuments.setupSheet">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="%tech.7" id="com.connor.ferrorTech.metal.createTechnicalDocuments.reworkWorkInstruction">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="%tech.8" id="com.connor.ferrorTech.metal.createTechnicalDocuments.nCFile">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="%tech.9" id="com.connor.ferrorTech.metal.createTechnicalDocuments.processDrawing">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="%tech.10" id="com.connor.ferrorTech.metal.createTechnicalDocuments.preMillDrawing">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="%tech.11" id="com.connor.ferrorTech.metal.createTechnicalDocuments.jitFixtureDrawing">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="%tech.12" id="com.connor.ferrorTech.metal.createTechnicalDocuments.toolingList">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="%tech.13" id="com.connor.ferrorTech.metal.createTechnicalDocuments.standardWorkInstruction">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="%tech.14" id="com.connor.ferrorTech.metal.createTechnicalDocuments.inspectionPlan">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="%tech.15" id="com.connor.ferrorTech.metal.createTechnicalDocuments.uploadDocuments">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="%tech.16" id="com.connor.ferrorTech.metal.createTechnicalDocuments.batchApproval">
|
||||
</command>
|
||||
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="%BOMgy.0" id="com.connor.ferrorTech.metal.approvalOfBom">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="%batchDownload.0" id="com.connor.ferrorTech.metal.downloadFiles">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="%vf.3" id="com.connor.ferrorTech.metal.importMaterial">
|
||||
</command>
|
||||
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="%toBom.1" id="com.connor.ah.bxw.DBOMtoEBOM">
|
||||
</command>
|
||||
</extension>
|
||||
|
||||
<extension point="org.eclipse.ui.handlers">
|
||||
<handler class="com.connor.ferrorTech.metal.quotationManagement.createClientFile.CreateClientFileHandler" commandId="com.connor.ferrorTech.metal.quotationManagher.createClientFile">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.quotationManagement.createQuotationProject.CreateQuotationProjectHandler" commandId="com.connor.ferrorTech.metal.quotationManagher.createQuotationProject">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.quotationManagement.createQuotationDrawings.CreateQuotationDrawingsHandler" commandId="com.connor.ferrorTech.metal.quotationManagher.createQuotationDrawings">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.quotationManagement.uploadQuotationDrawings.UploadHandler" commandId="com.connor.ferrorTech.metal.quotationManagher.uploadQuotationDrawings">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.quotationManagement.createTechnicalQuotation.CreateTechnicalHandler" commandId="com.connor.ferrorTech.metal.quotationManagher.createTechnicalQuotation">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.quotationManagement.externalQuotationCreate.CreateExternalQuotationHandler" commandId="com.connor.ferrorTech.metal.quotationManagher.CreateExternalQuotation">
|
||||
</handler>
|
||||
|
||||
<handler class="com.connor.ferrorTech.metal.NPIproject.NPIprojectCreate.CreateNPIprojectHandler" commandId="com.connor.ferrorTech.metal.NPIproject.createNPIproject">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.NPIproject.NPIprojectCreateOnQuotation.CreateNPIprojectOnQuotationHandler" commandId="com.connor.ferrorTech.metal.NPIproject.createNPIprojectByQuotation">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.NPIproject.customerDrawingsCreate.CreateClientDrawingHandler" commandId="com.connor.ferrorTech.metal.NPIproject.createCustomerDrawing">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.NPIproject.customerDrawingsUpload.UploadClientDrawingHandler" commandId="com.connor.ferrorTech.metal.NPIproject.uploadCustomerDrawing">
|
||||
</handler>
|
||||
|
||||
<handler class="com.connor.ferrorTech.metal.material.finishedProducts.FinishedProductsCreateHandler" commandId="com.connor.ferrorTech.metal.material.finishedProducts">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.material.semiFinishedProducts.SemiFinishedProductsCreateHandler" commandId="com.connor.ferrorTech.metal.material.semiFinishedProducts">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.material.material.MaterialCreateHandler" commandId="com.connor.ferrorTech.metal.material.material">
|
||||
</handler>
|
||||
|
||||
<handler class="com.connor.ferrorTech.metal.processManagement.classificationCraft.ClassificationCraftHandler" commandId="com.connor.ferrorTech.metal.processManagement.callCraft">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.processManagement.classificationProcesses.ClassificationProcessesHandler" commandId="com.connor.ferrorTech.metal.processManagement.callProcesses">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.processManagement.createCraft.CreateCraftHandler" commandId="com.connor.ferrorTech.metal.processManagement.createCraft">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.processManagement.createProcesses.CreateProcessesHandler" commandId="com.connor.ferrorTech.metal.processManagement.createProcesses">
|
||||
</handler>
|
||||
|
||||
<handler class="com.connor.ferrorTech.metal.changeManagement.createECR.ChangeApplyFormCreateHandler" commandId="com.connor.ferrorTech.metal.changeManagement.createECR">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.changeManagement.createECO.ChangeNoticeFormCreateHandler" commandId="com.connor.ferrorTech.metal.changeManagement.createECO">
|
||||
</handler>
|
||||
|
||||
|
||||
<handler class="com.connor.ferrorTech.metal.createTechnicalDocuments.AinternalDrawing.CreateInternalDrawingHandler" commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.internalDrawing">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.createTechnicalDocuments.BprocessControl.CreateProcessControlHandler" commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.processControl">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.createTechnicalDocuments.CredlineDrawing.CreateRedlineDrawingHandler" commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.redlineDrawing">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.createTechnicalDocuments.DrawMaterialDrawing.CreateRawMaterialDrawingHandler" commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.rawMaterialDrawing">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.createTechnicalDocuments.EsubPartsDrawing.CreateSubPartsDrawingHandler" commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.subPartsDrawing">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.createTechnicalDocuments.FsetupSheet.CreateSetupSheetHandler" commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.setupSheet">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.createTechnicalDocuments.GreworkInstruction.CreateReworkInstructionHandler" commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.reworkWorkInstruction">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.createTechnicalDocuments.HncFile.CreateNcFileHandler" commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.nCFile">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.createTechnicalDocuments.IprocessDrawing.CreateProcessDrawingHandler" commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.processDrawing">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.createTechnicalDocuments.JpreMillDrawing.CreatePreMillDrawingHandler" commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.preMillDrawing">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.createTechnicalDocuments.JrjitFixtureDrawing.CreateJitFixtureHandler" commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.jitFixtureDrawing">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.createTechnicalDocuments.KtoolingList.CreateToolingListHandler" commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.toolingList">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.createTechnicalDocuments.LstandardInstruction.CreateStandardInstructionHandler" commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.standardWorkInstruction">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.createTechnicalDocuments.LTinspectionPlan.InspectionPlanHandler" commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.inspectionPlan">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.createTechnicalDocuments.OuploadDocuments.UploadDocumentsHandler" commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.uploadDocuments">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.createTechnicalDocuments.PapprovalofTecDocuments.ApprovalofDocumentsHandler" commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.batchApproval">
|
||||
</handler>
|
||||
|
||||
|
||||
<handler class="com.connor.ferrorTech.metal.bomProcess.ApprovalOfBomProcessHandler" commandId="com.connor.ferrorTech.metal.approvalOfBom">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.batchDownload.BatchDownloadHandler" commandId="com.connor.ferrorTech.metal.downloadFiles">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.importMaterial.ImportMaterialHandler" commandId="com.connor.ferrorTech.metal.importMaterial">
|
||||
</handler>
|
||||
|
||||
<handler class="com.connor.ferrorTech.metal.materialManage.DbomTransitionToEbomHandler" commandId="com.connor.ah.bxw.DBOMtoEBOM">
|
||||
</handler>
|
||||
</extension>
|
||||
|
||||
<extension point="org.eclipse.ui.menus">
|
||||
<menuContribution locationURI="menu:org.eclipse.ui.main.menu?after=additions">
|
||||
<menu label="%plugin.0" mnemonic="M" id="com.connor.ferrorTech.metal.menus.plmMenu.metal">
|
||||
<menu label="%quo.0" mnemonic="M" id="com.connor.ferrorTech.metal.menus.metal.quoteManager">
|
||||
<command commandId="com.connor.ferrorTech.metal.quotationManagher.createClientFile" id="com.connor.ferrorTech.metal.menus.quotation.client" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.quotationManagher.createQuotationProject" id="com.connor.ferrorTech.metal.menus.quotation.project" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.quotationManagher.createQuotationDrawings" id="com.connor.ferrorTech.metal.menus.quotation.drawings" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.quotationManagher.uploadQuotationDrawings" id="com.connor.ferrorTech.metal.menus.quotation.upload" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.quotationManagher.createTechnicalQuotation" id="com.connor.ferrorTech.metal.menus.quotation.technical" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.quotationManagher.CreateExternalQuotation" id="com.connor.ferrorTech.metal.menus.quotation.external" mnemonic="S">
|
||||
</command>
|
||||
</menu>
|
||||
<menu label="%npi.0" mnemonic="M" id="com.connor.ferrorTech.metal.menus.metal.npiProject">
|
||||
<command commandId="com.connor.ferrorTech.metal.NPIproject.createNPIproject" id="com.connor.ferrorTech.metal.menus.npiProject.createNpi" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.NPIproject.createNPIprojectByQuotation" id="com.connor.ferrorTech.metal.menus.npiProject.createNpiByQuotation" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.NPIproject.createCustomerDrawing" id="com.connor.ferrorTech.metal.menus.npiProject.createCustomerDrawing" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.NPIproject.uploadCustomerDrawing" id="com.connor.ferrorTech.metal.menus.npiProject.uploadCustomerDrawing" mnemonic="S">
|
||||
</command>
|
||||
</menu>
|
||||
<menu label="%mar.0" mnemonic="M" id="com.connor.ferrorTech.metal.menus.metal.createMaterial">
|
||||
<command commandId="com.connor.ferrorTech.metal.material.finishedProducts" id="com.connor.ferrorTech.metal.menus.npiProject.finishedProducts" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.material.semiFinishedProducts" id="com.connor.ferrorTech.metal.menus.npiProject.semiFinishedProducts" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.material.material" id="com.connor.ferrorTech.metal.menus.npiProject.material" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.importMaterial" id="com.connor.ferrorTech.metal.menus.importMaterial" mnemonic="S">
|
||||
</command>
|
||||
</menu>
|
||||
<menu label="%gy.0" mnemonic="M" id="com.connor.ferrorTech.metal.menus.metal.processManagement">
|
||||
<command commandId="com.connor.ferrorTech.metal.processManagement.callCraft" id="com.connor.ferrorTech.metal.menus.processManagement.callCraft" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.processManagement.callProcesses" id="com.connor.ferrorTech.metal.menus.processManagement.callProcesses" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.processManagement.createCraft" id="com.connor.ferrorTech.metal.menus.processManagement.createCraft" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.processManagement.createProcesses" id="com.connor.ferrorTech.metal.menus.processManagement.createProcesses" mnemonic="S">
|
||||
</command>
|
||||
</menu>
|
||||
<menu label="%cg.0" mnemonic="M" id="com.connor.ferrorTech.metal.menus.metal.changeManagement">
|
||||
<command commandId="com.connor.ferrorTech.metal.changeManagement.createECR" id="com.connor.ferrorTech.metal.menus.metal.changeManagement.createECR" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.changeManagement.createECO" id="com.connor.ferrorTech.metal.menus.metal.changeManagement.createECO" mnemonic="S">
|
||||
</command>
|
||||
</menu>
|
||||
<menu label="%tech.0" mnemonic="M" id="com.connor.ferrorTech.metal.menus.metal.createTechnicalDocuments">
|
||||
<command commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.internalDrawing" id="com.connor.ferrorTech.metal.menus.createTechnicalDocuments.internalDrawing" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.processControl" id="com.connor.ferrorTech.metal.menus.createTechnicalDocuments.processControl" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.redlineDrawing" id="com.connor.ferrorTech.metal.menus.createTechnicalDocuments.redlineDrawing" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.rawMaterialDrawing" id="com.connor.ferrorTech.metal.menus.createTechnicalDocuments.rawMaterialDrawing" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.subPartsDrawing" id="com.connor.ferrorTech.metal.menus.createTechnicalDocuments.subPartsDrawing" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.setupSheet" id="com.connor.ferrorTech.metal.menus.createTechnicalDocuments.setupSheet" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.reworkWorkInstruction" id="com.connor.ferrorTech.metal.menus.createTechnicalDocuments.reworkWorkInstruction" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.nCFile" id="com.connor.ferrorTech.metal.menus.createTechnicalDocuments.nCFile" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.processDrawing" id="com.connor.ferrorTech.metal.menus.createTechnicalDocuments.processDrawing" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.preMillDrawing" id="com.connor.ferrorTech.metal.menus.createTechnicalDocuments.preMillDrawing" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.jitFixtureDrawing" id="com.connor.ferrorTech.metal.menus.createTechnicalDocuments.jitFixtureDrawing" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.toolingList" id="com.connor.ferrorTech.metal.menus.createTechnicalDocuments.toolingList" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.standardWorkInstruction" id="com.connor.ferrorTech.metal.menus.createTechnicalDocuments.standardWorkInstruction" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.inspectionPlan" id="com.connor.ferrorTech.metal.menus.createTechnicalDocuments.inspectionPlan" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.uploadDocuments" id="com.connor.ferrorTech.metal.menus.createTechnicalDocuments.uploadDocuments" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.batchApproval" id="com.connor.ferrorTech.metal.menus.createTechnicalDocuments.batchApproval" mnemonic="S">
|
||||
</command>
|
||||
</menu>
|
||||
<command commandId="com.connor.ferrorTech.metal.approvalOfBom" id="com.connor.ferrorTech.metal.menus.approvalOfBom" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.downloadFiles" id="com.connor.ferrorTech.metal.menus.downloadFiles" mnemonic="S">
|
||||
</command>
|
||||
</menu>
|
||||
|
||||
<menu label="%plugin.1" mnemonic="M" id="com.connor.menus.plmMenu.bxw">
|
||||
<command commandId="com.connor.ah.bxw.DBOMtoEBOM" id="com.connor.menus.plmMenu.bxw.DBOMtoEBOM" mnemonic="S">
|
||||
</command>
|
||||
</menu>
|
||||
</menuContribution>
|
||||
|
||||
|
||||
</extension>
|
||||
|
||||
</plugin>
|
@ -0,0 +1,66 @@
|
||||
vf.1=\u5171\u4eab\u6587\u4ef6\u81ea\u52a8\u5206\u53d1
|
||||
vf.2=\u6587\u4ef6\u7ba1\u7406
|
||||
vf.3=Import Bill Of Materials
|
||||
|
||||
plugin.0=PLM Menu
|
||||
|
||||
quo.0=\u62A5\u4EF7\u7BA1\u7406
|
||||
quo.1=\u521B\u5EFA\u5BA2\u6237\u6863\u6848
|
||||
quo.2=\u521B\u5EFA\u62A5\u4EF7\u9879\u76EE
|
||||
quo.3=\u521B\u5EFA\u62A5\u4EF7\u56FE\u7EB8
|
||||
quo.4=\u4E0A\u4F20\u62A5\u4EF7\u56FE\u7EB8
|
||||
quo.5=\u521B\u5EFA\u6280\u672F\u62A5\u4EF7\u5355
|
||||
quo.6=\u521B\u5EFA\u5BF9\u5916\u62A5\u4EF7\u5355
|
||||
|
||||
npi.0=NPI\u9879\u76EE
|
||||
npi.1=\u521B\u5EFANPI
|
||||
npi.2=\u9009\u4E2D\u6587\u4EF6\u5939\u521B\u5EFANPI
|
||||
npi.3=\u521B\u5EFA\u5BA2\u6237\u56FE\u7EB8
|
||||
npi.4=\u4E0A\u4F20\u5BA2\u6237\u56FE\u7EB8
|
||||
|
||||
mar.0=\u521B\u5EFA\u7269\u6599
|
||||
mar.1=\u4EA7\u6210\u54C1
|
||||
mar.2=\u534A\u6210\u54C1
|
||||
mar.3=\u6750\u6599
|
||||
|
||||
gy.0=\u5DE5\u827A\u7BA1\u7406
|
||||
gy.1=Process Routing Library
|
||||
gy.2=Operation Library
|
||||
gy.3=Create Routing
|
||||
gy.4=Create Operation
|
||||
|
||||
cg.0=\u53D8\u66F4\u7BA1\u7406
|
||||
cg.1=Create ECR
|
||||
cg.2=Create ECO
|
||||
|
||||
tech.0=\u521B\u5EFA\u6280\u672F\u6587\u4EF6
|
||||
tech.1=Create Internal Drawing
|
||||
tech.2=Create Process Control
|
||||
tech.3=Create Redline Drawing
|
||||
tech.4=Create RawMaterial Drawing
|
||||
tech.5=Create Sub-Parts Drawing
|
||||
tech.6=Create Setup Sheet
|
||||
tech.7=Create Rework Work Instruction
|
||||
tech.8=Create CNC file
|
||||
tech.9=Create Process Drawing
|
||||
tech.10=Create Pre-Mill Drawing
|
||||
tech.11=Create Jig & Fixture Drawing
|
||||
tech.12=Create Tooling List
|
||||
tech.13=Create Standard Work Instruction
|
||||
tech.14=Create In-Process Inspection Plan
|
||||
tech.15=Upload Documents
|
||||
tech.16=Batch Approval Of Tec-Documents
|
||||
|
||||
|
||||
BOMgy.0=BOM\u5DE5\u827A\u6279\u91CF\u5BA1\u6279
|
||||
|
||||
batchDownload.0=Batch Download Files
|
||||
|
||||
plugin.1=\u8BBE\u8BA1\u7BA1\u7406
|
||||
toBom.1=DBOM\u8F6CEBOM
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,271 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
|
||||
<extension
|
||||
id="startTest"
|
||||
name="start hello teamcenter"
|
||||
point="org.eclipse.ui.startup">
|
||||
<startup class="com.connor.ferrorTech.metal.share.start"/>
|
||||
</extension>
|
||||
|
||||
<extension point="org.eclipse.ui.commands">
|
||||
<category name="Double Category" id="com.connor.ferrorTech.metal.commands.category">
|
||||
</category>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="创建客户档案 " id="com.connor.ferrorTech.metal.quotationManagher.createClientFile">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="创建报价项目" id="com.connor.ferrorTech.metal.quotationManagher.createQuotationProject">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="创建报价图纸" id="com.connor.ferrorTech.metal.quotationManagher.createQuotationDrawings">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="上传报价图纸" id="com.connor.ferrorTech.metal.quotationManagher.uploadQuotationDrawings">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="创建技术报价单" id="com.connor.ferrorTech.metal.quotationManagher.createTechnicalQuotation">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="创建对外报价单" id="com.connor.ferrorTech.metal.quotationManagher.CreateExternalQuotation">
|
||||
</command>
|
||||
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="创建NPI项目" id="com.connor.ferrorTech.metal.NPIproject.createNPIproject">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="创建客户图纸" id="com.connor.ferrorTech.metal.NPIproject.createCustomerDrawing">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="上传客户图纸" id="com.connor.ferrorTech.metal.NPIproject.uploadCustomerDrawing">
|
||||
</command>
|
||||
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="产成品" id="com.connor.ferrorTech.metal.material.finishedProducts">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="半成品" id="com.connor.ferrorTech.metal.material.semiFinishedProducts">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="材料" id="com.connor.ferrorTech.metal.material.material">
|
||||
</command>
|
||||
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="分类库调用工艺" id="com.connor.ferrorTech.metal.processManagement.callCraft">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="分类库调用工序" id="com.connor.ferrorTech.metal.processManagement.callProcesses">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="创建工艺" id="com.connor.ferrorTech.metal.processManagement.createCraft">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="创建工序" id="com.connor.ferrorTech.metal.processManagement.createProcesses">
|
||||
</command>
|
||||
|
||||
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="Create ECR" id="com.connor.ferrorTech.metal.changeManagement.createECR">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="Create ECO" id="com.connor.ferrorTech.metal.changeManagement.createECO">
|
||||
</command>
|
||||
|
||||
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="Create Internal Drawing" id="com.connor.ferrorTech.metal.createTechnicalDocuments.internalDrawing">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="Create Process Control" id="com.connor.ferrorTech.metal.createTechnicalDocuments.processControl">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="Create Redline Drawing" id="com.connor.ferrorTech.metal.createTechnicalDocuments.redlineDrawing">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="Create RawMaterial Drawing" id="com.connor.ferrorTech.metal.createTechnicalDocuments.rawMaterialDrawing">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="Create Sub-Parts Drawing" id="com.connor.ferrorTech.metal.createTechnicalDocuments.subPartsDrawing">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="Create Setup Sheet" id="com.connor.ferrorTech.metal.createTechnicalDocuments.setupSheet">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="Create Rework Work Instruction" id="com.connor.ferrorTech.metal.createTechnicalDocuments.reworkWorkInstruction">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="Create NC File" id="com.connor.ferrorTech.metal.createTechnicalDocuments.nCFile">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="Create Process Drawing" id="com.connor.ferrorTech.metal.createTechnicalDocuments.processDrawing">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="Create Pre-Mill Drawing" id="com.connor.ferrorTech.metal.createTechnicalDocuments.preMillDrawing">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="Create Jit-Fixture Drawing" id="com.connor.ferrorTech.metal.createTechnicalDocuments.jitFixtureDrawing">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="Create Tooling List" id="com.connor.ferrorTech.metal.createTechnicalDocuments.toolingList">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="Create Standard Work Instruction" id="com.connor.ferrorTech.metal.createTechnicalDocuments.standardWorkInstruction">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="Upload Documents" id="com.connor.ferrorTech.metal.createTechnicalDocuments.uploadDocuments">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="Batch Approval Of Tec-Documents" id="com.connor.ferrorTech.metal.createTechnicalDocuments.batchApproval">
|
||||
</command>
|
||||
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="BOM工艺批量审批" id="com.connor.ferrorTech.metal.approvalOfBom">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="Batch Download Files" id="com.connor.ferrorTech.metal.downloadFiles">
|
||||
</command>
|
||||
<command categoryId="com.connor.ferrorTech.metal.commands.category" name="%vf.3" id="com.connor.ferrorTech.metal.importMaterial">
|
||||
</command>
|
||||
</extension>
|
||||
|
||||
<extension point="org.eclipse.ui.handlers">
|
||||
<handler class="com.connor.ferrorTech.metal.quotationManagement.createClientFile.CreateClientFileHandler" commandId="com.connor.ferrorTech.metal.quotationManagher.createClientFile">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.quotationManagement.createQuotationProject.CreateQuotationProjectHandler" commandId="com.connor.ferrorTech.metal.quotationManagher.createQuotationProject">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.quotationManagement.createQuotationDrawings.CreateQuotationDrawingsHandler" commandId="com.connor.ferrorTech.metal.quotationManagher.createQuotationDrawings">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.quotationManagement.uploadQuotationDrawings.UploadHandler" commandId="com.connor.ferrorTech.metal.quotationManagher.uploadQuotationDrawings">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.quotationManagement.createTechnicalQuotation.CreateTechnicalHandler" commandId="com.connor.ferrorTech.metal.quotationManagher.createTechnicalQuotation">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.quotationManagement.externalQuotationCreate.CreateExternalQuotationHandler" commandId="com.connor.ferrorTech.metal.quotationManagher.CreateExternalQuotation">
|
||||
</handler>
|
||||
|
||||
<handler class="com.connor.ferrorTech.metal.NPIproject.NPIprojectCreate.CreateNPIprojectHandler" commandId="com.connor.ferrorTech.metal.NPIproject.createNPIproject">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.NPIproject.customerDrawingsCreate.CreateClientDrawingHandler" commandId="com.connor.ferrorTech.metal.NPIproject.createCustomerDrawing">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.NPIproject.customerDrawingsUpload.UploadClientDrawingHandler" commandId="com.connor.ferrorTech.metal.NPIproject.uploadCustomerDrawing">
|
||||
</handler>
|
||||
|
||||
<handler class="com.connor.ferrorTech.metal.material.finishedProducts.FinishedProductsCreateHandler" commandId="com.connor.ferrorTech.metal.material.finishedProducts">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.material.semiFinishedProducts.SemiFinishedProductsCreateHandler" commandId="com.connor.ferrorTech.metal.material.semiFinishedProducts">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.material.material.MaterialCreateHandler" commandId="com.connor.ferrorTech.metal.material.material">
|
||||
</handler>
|
||||
|
||||
<handler class="com.connor.ferrorTech.metal.processManagement.classificationCraft.ClassificationCraftHandler" commandId="com.connor.ferrorTech.metal.processManagement.callCraft">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.processManagement.classificationProcesses.ClassificationProcessesHandler" commandId="com.connor.ferrorTech.metal.processManagement.callProcesses">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.processManagement.createCraft.CreateCraftHandler" commandId="com.connor.ferrorTech.metal.processManagement.createCraft">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.processManagement.createProcesses.CreateProcessesHandler" commandId="com.connor.ferrorTech.metal.processManagement.createProcesses">
|
||||
</handler>
|
||||
|
||||
<handler class="com.connor.ferrorTech.metal.changeManagement.createECR.ChangeApplyFormCreateHandler" commandId="com.connor.ferrorTech.metal.changeManagement.createECR">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.changeManagement.createECO.ChangeNoticeFormCreateHandler" commandId="com.connor.ferrorTech.metal.changeManagement.createECO">
|
||||
</handler>
|
||||
|
||||
|
||||
<handler class="com.connor.ferrorTech.metal.createTechnicalDocuments.AinternalDrawing.CreateInternalDrawingHandler" commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.internalDrawing">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.createTechnicalDocuments.BprocessControl.CreateProcessControlHandler" commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.processControl">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.createTechnicalDocuments.CredlineDrawing.CreateRedlineDrawingHandler" commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.redlineDrawing">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.createTechnicalDocuments.DrawMaterialDrawing.CreateRawMaterialDrawingHandler" commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.rawMaterialDrawing">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.createTechnicalDocuments.EsubPartsDrawing.CreateSubPartsDrawingHandler" commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.subPartsDrawing">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.createTechnicalDocuments.FsetupSheet.CreateSetupSheetHandler" commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.setupSheet">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.createTechnicalDocuments.GreworkInstruction.CreateReworkInstructionHandler" commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.reworkWorkInstruction">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.createTechnicalDocuments.HncFile.CreateNcFileHandler" commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.nCFile">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.createTechnicalDocuments.IprocessDrawing.CreateProcessDrawingHandler" commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.processDrawing">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.createTechnicalDocuments.JpreMillDrawing.CreatePreMillDrawingHandler" commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.preMillDrawing">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.createTechnicalDocuments.JrjitFixtureDrawing.CreateJitFixtureHandler" commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.jitFixtureDrawing">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.createTechnicalDocuments.KtoolingList.CreateToolingListHandler" commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.toolingList">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.createTechnicalDocuments.LstandardInstruction.CreateStandardInstructionHandler" commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.standardWorkInstruction">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.createTechnicalDocuments.OuploadDocuments.UploadDocumentsHandler" commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.uploadDocuments">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.createTechnicalDocuments.PapprovalofTecDocuments.ApprovalofDocumentsHandler" commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.batchApproval">
|
||||
</handler>
|
||||
|
||||
|
||||
<handler class="com.connor.ferrorTech.metal.bomProcess.ApprovalOfBomProcessHandler" commandId="com.connor.ferrorTech.metal.approvalOfBom">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.batchDownload.BatchDownloadHandler" commandId="com.connor.ferrorTech.metal.downloadFiles">
|
||||
</handler>
|
||||
<handler class="com.connor.ferrorTech.metal.importMaterial.ImportMaterialHandler" commandId="com.connor.ferrorTech.metal.importMaterial">
|
||||
</handler>
|
||||
</extension>
|
||||
|
||||
<extension point="org.eclipse.ui.menus">
|
||||
<menuContribution locationURI="menu:org.eclipse.ui.main.menu?after=additions">
|
||||
<menu label="大和金属PLM" mnemonic="M" id="com.connor.ferrorTech.metal.menus.plmMenu.metal">
|
||||
<menu label="报价管理" mnemonic="M" id="com.connor.ferrorTech.metal.menus.metal.quoteManager">
|
||||
<command commandId="com.connor.ferrorTech.metal.quotationManagher.createClientFile" id="com.connor.ferrorTech.metal.menus.quotation.client" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.quotationManagher.createQuotationProject" id="com.connor.ferrorTech.metal.menus.quotation.project" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.quotationManagher.createQuotationDrawings" id="com.connor.ferrorTech.metal.menus.quotation.drawings" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.quotationManagher.uploadQuotationDrawings" id="com.connor.ferrorTech.metal.menus.quotation.upload" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.quotationManagher.createTechnicalQuotation" id="com.connor.ferrorTech.metal.menus.quotation.technical" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.quotationManagher.CreateExternalQuotation" id="com.connor.ferrorTech.metal.menus.quotation.external" mnemonic="S">
|
||||
</command>
|
||||
</menu>
|
||||
<menu label="NPI项目" mnemonic="M" id="com.connor.ferrorTech.metal.menus.metal.npiProject">
|
||||
<command commandId="com.connor.ferrorTech.metal.NPIproject.createNPIproject" id="com.connor.ferrorTech.metal.menus.npiProject.createNpi" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.NPIproject.createCustomerDrawing" id="com.connor.ferrorTech.metal.menus.npiProject.createCustomerDrawing" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.NPIproject.uploadCustomerDrawing" id="com.connor.ferrorTech.metal.menus.npiProject.uploadCustomerDrawing" mnemonic="S">
|
||||
</command>
|
||||
</menu>
|
||||
<menu label="创建物料" mnemonic="M" id="com.connor.ferrorTech.metal.menus.metal.createMaterial">
|
||||
<command commandId="com.connor.ferrorTech.metal.material.finishedProducts" id="com.connor.ferrorTech.metal.menus.npiProject.finishedProducts" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.material.semiFinishedProducts" id="com.connor.ferrorTech.metal.menus.npiProject.semiFinishedProducts" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.material.material" id="com.connor.ferrorTech.metal.menus.npiProject.material" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.importMaterial" id="com.connor.ferrorTech.metal.menus.importMaterial" mnemonic="S">
|
||||
</command>
|
||||
</menu>
|
||||
<menu label="工艺管理" mnemonic="M" id="com.connor.ferrorTech.metal.menus.metal.processManagement">
|
||||
<command commandId="com.connor.ferrorTech.metal.processManagement.callCraft" id="com.connor.ferrorTech.metal.menus.processManagement.callCraft" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.processManagement.callProcesses" id="com.connor.ferrorTech.metal.menus.processManagement.callProcesses" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.processManagement.createCraft" id="com.connor.ferrorTech.metal.menus.processManagement.createCraft" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.processManagement.createProcesses" id="com.connor.ferrorTech.metal.menus.processManagement.createProcesses" mnemonic="S">
|
||||
</command>
|
||||
</menu>
|
||||
<menu label="变更管理" mnemonic="M" id="com.connor.ferrorTech.metal.menus.metal.changeManagement">
|
||||
<command commandId="com.connor.ferrorTech.metal.changeManagement.createECR" id="com.connor.ferrorTech.metal.menus.metal.changeManagement.createECR" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.changeManagement.createECO" id="com.connor.ferrorTech.metal.menus.metal.changeManagement.createECO" mnemonic="S">
|
||||
</command>
|
||||
</menu>
|
||||
<menu label="创建技术文件" mnemonic="M" id="com.connor.ferrorTech.metal.menus.metal.createTechnicalDocuments">
|
||||
<command commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.internalDrawing" id="com.connor.ferrorTech.metal.menus.createTechnicalDocuments.internalDrawing" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.processControl" id="com.connor.ferrorTech.metal.menus.createTechnicalDocuments.processControl" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.redlineDrawing" id="com.connor.ferrorTech.metal.menus.createTechnicalDocuments.redlineDrawing" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.rawMaterialDrawing" id="com.connor.ferrorTech.metal.menus.createTechnicalDocuments.rawMaterialDrawing" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.subPartsDrawing" id="com.connor.ferrorTech.metal.menus.createTechnicalDocuments.subPartsDrawing" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.setupSheet" id="com.connor.ferrorTech.metal.menus.createTechnicalDocuments.setupSheet" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.reworkWorkInstruction" id="com.connor.ferrorTech.metal.menus.createTechnicalDocuments.reworkWorkInstruction" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.nCFile" id="com.connor.ferrorTech.metal.menus.createTechnicalDocuments.nCFile" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.processDrawing" id="com.connor.ferrorTech.metal.menus.createTechnicalDocuments.processDrawing" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.preMillDrawing" id="com.connor.ferrorTech.metal.menus.createTechnicalDocuments.preMillDrawing" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.jitFixtureDrawing" id="com.connor.ferrorTech.metal.menus.createTechnicalDocuments.jitFixtureDrawing" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.toolingList" id="com.connor.ferrorTech.metal.menus.createTechnicalDocuments.toolingList" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.standardWorkInstruction" id="com.connor.ferrorTech.metal.menus.createTechnicalDocuments.standardWorkInstruction" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.uploadDocuments" id="com.connor.ferrorTech.metal.menus.createTechnicalDocuments.uploadDocuments" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.createTechnicalDocuments.batchApproval" id="com.connor.ferrorTech.metal.menus.createTechnicalDocuments.batchApproval" mnemonic="S">
|
||||
</command>
|
||||
</menu>
|
||||
<command commandId="com.connor.ferrorTech.metal.approvalOfBom" id="com.connor.ferrorTech.metal.menus.approvalOfBom" mnemonic="S">
|
||||
</command>
|
||||
<command commandId="com.connor.ferrorTech.metal.downloadFiles" id="com.connor.ferrorTech.metal.menus.downloadFiles" mnemonic="S">
|
||||
</command>
|
||||
</menu>
|
||||
</menuContribution>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
@ -0,0 +1,90 @@
|
||||
package com.connor.ferrorTech.metal.NPIproject.NPIprojectCreate;
|
||||
|
||||
import java.awt.Frame;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
import org.jdesktop.swingx.JXDatePicker;
|
||||
|
||||
import com.connor.ferrorTech.metal.util.SwingUtil;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aif.common.actions.AbstractAIFAction;
|
||||
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponentFolder;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||
import com.teamcenter.rac.kernel.TCPreferenceService;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
import com.teamcenter.rac.util.MessageBox;
|
||||
|
||||
public class CreateNPIprojectAction extends AbstractAIFAction {
|
||||
|
||||
private AbstractAIFApplication application;
|
||||
private JLabel[] inputLabels;
|
||||
private JComponent[] inputFields;
|
||||
|
||||
private String[] columnNames;
|
||||
private Object[][] data;
|
||||
|
||||
public CreateNPIprojectAction(AbstractAIFApplication application, Frame frame, String param) {
|
||||
super(application, frame, param);
|
||||
this.application = application;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
boolean flag = false;
|
||||
|
||||
InterfaceAIFComponent selectComponent = application.getTargetContext().getComponent();
|
||||
if (selectComponent != null && selectComponent instanceof TCComponentFolder) {
|
||||
TCComponentFolder targetRev = (TCComponentFolder) selectComponent;
|
||||
System.out.println("选中对象版本类型为: " + targetRev.getType());
|
||||
if (targetRev.getType().equals("Folder")) {
|
||||
flag = true;
|
||||
} else {
|
||||
MessageBox.post("Please select the Folder", "Error", MessageBox.ERROR);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
MessageBox.post("Please select Item Revision", "Error", MessageBox.ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if(flag) {
|
||||
inputLabels = new JLabel[]{
|
||||
new JLabel("NPI Project Name"), new JLabel("Order date"), new JLabel("Special requirements")};
|
||||
|
||||
|
||||
inputFields = new JComponent[]{
|
||||
new JTextField(14), createDatePicker(), new JTextField(14)
|
||||
};
|
||||
|
||||
// 表格列标题
|
||||
columnNames = new String[]{"Serial", "Customer PN", "Product Name", "Rev", "Date of Issuance", "Num", "BOM Deadline", "Drawings Deadline", "Tec BOM Deadline", "Tec Drawings Deadline","Remarks"};
|
||||
|
||||
// 表格数据
|
||||
data = new Object[][]{};
|
||||
CreateNPIprojectDialog dialog;
|
||||
dialog = new CreateNPIprojectDialog(this.application,inputLabels,inputFields,null,columnNames,data,false);
|
||||
new Thread(dialog).start();
|
||||
}
|
||||
}
|
||||
|
||||
private JXDatePicker createDatePicker() {
|
||||
// 创建 JXDatePicker
|
||||
JXDatePicker datePicker = new JXDatePicker();
|
||||
// 设置日期格式
|
||||
datePicker.setFormats(new java.text.SimpleDateFormat("yyyy-MM-dd"));
|
||||
return datePicker;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.connor.ferrorTech.metal.NPIproject.NPIprojectCreate;
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
|
||||
public class CreateNPIprojectHandler extends AbstractHandler {
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
|
||||
AbstractAIFApplication application = AIFUtility.getCurrentApplication();
|
||||
CreateNPIprojectAction action = new CreateNPIprojectAction(application, null, null);
|
||||
|
||||
new Thread(action).start();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,326 @@
|
||||
package com.connor.ferrorTech.metal.NPIproject.NPIprojectCreate;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.connor.ferrorTech.metal.NPIproject.NPIprojectCreate.entity.CountFolder;
|
||||
import com.connor.ferrorTech.metal.NPIproject.NPIprojectCreate.entity.FormData;
|
||||
import com.connor.ferrorTech.metal.NPIproject.NPIprojectCreate.entity.RowData;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aif.AbstractAIFOperation;
|
||||
import com.teamcenter.rac.common.create.BOCreateDefinitionFactory;
|
||||
import com.teamcenter.rac.common.create.CreateInstanceInput;
|
||||
import com.teamcenter.rac.common.create.IBOCreateDefinition;
|
||||
import com.teamcenter.rac.common.create.SOAGenericCreateHelper;
|
||||
import com.teamcenter.rac.kernel.TCComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponentFolder;
|
||||
import com.teamcenter.rac.kernel.TCComponentFolderType;
|
||||
import com.teamcenter.rac.kernel.TCComponentItem;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemType;
|
||||
import com.teamcenter.rac.kernel.TCException;
|
||||
import com.teamcenter.rac.kernel.TCPreferenceService;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
import com.teamcenter.rac.util.MessageBox;
|
||||
import com.teamcenter.services.rac.core.DataManagementService;
|
||||
import com.teamcenter.services.rac.core._2008_06.DataManagement.CreateIn;
|
||||
import com.teamcenter.services.rac.core._2008_06.DataManagement.CreateResponse;
|
||||
|
||||
public class CreateNPIprojectOperation extends AbstractAIFOperation {
|
||||
private final String PREFERENCES_FILE_FOLDER = "VF5NPI";
|
||||
private final String PREFERENCES_FILE_FOLDER_CHILD = "VF5NPIChildFolder";
|
||||
private final String FOLDER_TYPE_NORMAL = "Folder";
|
||||
private final String FOLDER_TYPE_NPI = "VF5NPI";
|
||||
private final String ITEM_TYPE_TASK_BOOK = "VF5ctrws";
|
||||
|
||||
private AbstractAIFApplication application;
|
||||
private TCSession tcSession;
|
||||
|
||||
public FormData formData;
|
||||
public List<RowData> tableData;
|
||||
|
||||
private TCComponentFolderType folderType;
|
||||
private TCComponentFolderType npiType;
|
||||
private TCComponentItemType taskType;
|
||||
|
||||
private TCComponentFolder originFolder;
|
||||
|
||||
private TCComponentFolder tagFolder;
|
||||
|
||||
public CreateNPIprojectOperation(AbstractAIFApplication application, TCComponentFolder targetFolder, FormData lists,
|
||||
List<RowData> tableData) {
|
||||
this.application = application;
|
||||
this.formData = lists;
|
||||
this.tableData = tableData;
|
||||
this.tcSession = (TCSession) application.getSession();
|
||||
this.tagFolder = targetFolder;
|
||||
|
||||
try {
|
||||
folderType = (TCComponentFolderType) tcSession.getTypeComponent(FOLDER_TYPE_NORMAL);
|
||||
npiType = (TCComponentFolderType) tcSession.getTypeComponent(FOLDER_TYPE_NPI);
|
||||
// tableRowType = (TCComponentItemType) this.tcSession.getTypeComponent("VF5ctrwsrow");
|
||||
taskType = (TCComponentItemType) this.tcSession.getTypeComponent(ITEM_TYPE_TASK_BOOK);
|
||||
|
||||
TCPreferenceService getFolderUID = tcSession.getPreferenceService();
|
||||
String value = getFolderUID.getStringValue(PREFERENCES_FILE_FOLDER);
|
||||
if(value == null || value.isEmpty()) {
|
||||
MessageBox.post("Preferred VF5NPI not configured", "Error", MessageBox.ERROR);
|
||||
}
|
||||
System.out.println("文件夹UID: " + value);
|
||||
originFolder = (TCComponentFolder) tcSession.stringToComponent(value);
|
||||
} catch (TCException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executeOperation() throws Exception {
|
||||
|
||||
System.out.println(formData.toString());
|
||||
|
||||
// tableData.stream().forEach(e -> {
|
||||
// System.out.println(e.toString());
|
||||
// });
|
||||
|
||||
String[] filePath = DateTimeFormatter.ofPattern("yyyy-MM").format(LocalDateTime.now()).split("-");
|
||||
CountFolder existFolder = isExistFolder(originFolder, filePath, 0);
|
||||
TCComponentFolder targetFolder = createFolder(existFolder.getFolder(), filePath, existFolder.getCount());
|
||||
|
||||
boolean existNpiFolder = isExistNpiFolder(targetFolder, formData.getProjectName());
|
||||
if (!existNpiFolder) {
|
||||
MessageBox.post("NPI Already Exists", "Error", MessageBox.ERROR);
|
||||
return;
|
||||
}
|
||||
TCComponentFolder npiFolder = creatNpiChildFolder(targetFolder);
|
||||
tagFolder.add("contents", npiFolder);
|
||||
TCComponentItemRevision taskBookRev = setNpiFolderProp(npiFolder);
|
||||
if (taskBookRev == null) {
|
||||
System.out.println("NPI Folder is empty!");
|
||||
} else {
|
||||
System.out.println("succeed to set property!");
|
||||
}
|
||||
|
||||
TCComponent taskBookMaster = taskBookRev.getRelatedComponent("IMAN_master_form_rev");
|
||||
|
||||
String[] propName = { "vf5khth", "vf5cpmc", "vf5khtzbb", "vf5qfrq", "vf5sl", "vf5clqdnq", "vf5ctnq",
|
||||
"vf5clqdnq2", "vf5ctnq2", "vf5beizhu" };
|
||||
String rowType = "VF5ctrwsrow";
|
||||
String tableType = "vf5cpxxTable";
|
||||
System.out.println("begin set table value");
|
||||
assignmentTable(tableData, taskBookMaster, propName, rowType, tableType);
|
||||
System.out.println("after set table value");
|
||||
}
|
||||
|
||||
private boolean isExistNpiFolder(TCComponentFolder targetFolder, String checkName) throws TCException {
|
||||
// TODO Auto-generated method stub
|
||||
TCComponent[] childFolder = targetFolder.getTCProperty("contents").getReferenceValueArray();
|
||||
if (childFolder != null && childFolder.length > 0) {
|
||||
for (int i = 0; i < childFolder.length; i++) {
|
||||
if (childFolder[i].getStringProperty("object_name").equals(checkName)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void assignmentTable(List<RowData> data, TCComponent item, String[] propNames, String boName, String prop) {
|
||||
try {
|
||||
List<TCComponent> c = new ArrayList<TCComponent>();
|
||||
DataManagementService service = DataManagementService.getService(tcSession);
|
||||
CreateIn[] newIn = new CreateIn[data.size()];
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
for (int i = 0; i < data.size(); ++i) {
|
||||
RowData rowData = data.get(i);
|
||||
CreateIn in = new CreateIn();
|
||||
Map<String, Calendar> dataPropMap = new HashMap<>();
|
||||
Map<String, String> stringPropMap = new HashMap<>();
|
||||
int count = 0;
|
||||
stringPropMap.put(propNames[count++], rowData.getDrawingNumber());
|
||||
stringPropMap.put(propNames[count++], rowData.getProductName());
|
||||
stringPropMap.put(propNames[count++], rowData.getVersion());
|
||||
transferCalendar(simpleDateFormat, rowData.getIssueDate(), dataPropMap, propNames, count);
|
||||
count++;
|
||||
stringPropMap.put(propNames[count++], rowData.getNumber());
|
||||
transferCalendar(simpleDateFormat, rowData.getMaterialDeliveryTime(), dataPropMap, propNames, count);
|
||||
count++;
|
||||
transferCalendar(simpleDateFormat, rowData.getDrawingDeliveryTime(), dataPropMap, propNames, count);
|
||||
count++;
|
||||
transferCalendar(simpleDateFormat, rowData.getMaterialReplyDate(), dataPropMap, propNames, count);
|
||||
count++;
|
||||
transferCalendar(simpleDateFormat, rowData.getDrawingReplyDate(), dataPropMap, propNames, count);
|
||||
count++;
|
||||
stringPropMap.put(propNames[count++], rowData.getNotes());
|
||||
|
||||
in.data.boName = boName;
|
||||
in.data.dateProps = dataPropMap;
|
||||
in.data.stringProps = stringPropMap;
|
||||
newIn[i] = in;
|
||||
}
|
||||
System.out.println("要创建的数量" + newIn.length);
|
||||
CreateResponse response = service.createObjects(newIn);
|
||||
System.out.println("创建数量:" + response.serviceData.sizeOfCreatedObjects());
|
||||
System.out.println("错误数量:" + response.serviceData.sizeOfPartialErrors());
|
||||
for (int i = 0; i < response.serviceData.sizeOfPartialErrors(); i++) {
|
||||
for (int j = 0; j < response.serviceData.getPartialError(i).getErrorValues().length; j++) {
|
||||
System.out
|
||||
.println("错误:" + response.serviceData.getPartialError(i).getErrorValues()[j].getMessage());
|
||||
}
|
||||
}
|
||||
if (response.serviceData.sizeOfCreatedObjects() > 0) {
|
||||
int length = response.serviceData.sizeOfCreatedObjects();
|
||||
for (int i = 0; i < length; ++i) {
|
||||
c.add(response.output[i].objects[0]);
|
||||
}
|
||||
}
|
||||
item.getTCProperty(prop).setReferenceValueArray((TCComponent[]) c.toArray(new TCComponent[c.size()]));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void transferCalendar(SimpleDateFormat simpleDateFormat, String time, Map<String, Calendar> dataPropMap,
|
||||
String[] propNames, int count) {
|
||||
try {
|
||||
if (time != null && time.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Date date = simpleDateFormat.parse(time);
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
|
||||
calendar.setTime(date);
|
||||
|
||||
dataPropMap.put(propNames[count], calendar);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public CountFolder isExistFolder(TCComponentFolder parentFolder, String[] filePath, int targetFileCount)
|
||||
throws TCException {
|
||||
TCComponent[] folderArrays = parentFolder.getTCProperty("contents").getReferenceValueArray();
|
||||
for (TCComponent tcComponent : folderArrays) {
|
||||
if (tcComponent.getType().equals("Folder")
|
||||
&& tcComponent.getStringProperty("object_name").equals(filePath[targetFileCount])) {
|
||||
parentFolder = (TCComponentFolder) tcComponent;
|
||||
return isExistFolder(parentFolder, filePath, targetFileCount + 1);
|
||||
}
|
||||
}
|
||||
return new CountFolder(parentFolder, targetFileCount);
|
||||
}
|
||||
|
||||
public TCComponentFolder createFolder(TCComponentFolder parentFolder, String[] filePath, int targetFileCount)
|
||||
throws TCException {
|
||||
System.out.println("targetFolder: " + parentFolder.getStringProperty("object_name"));
|
||||
for (int i = targetFileCount; i < filePath.length; i++) {
|
||||
TCComponentFolder folder = folderType.create(filePath[i], "", "Folder");
|
||||
parentFolder.add("contents", folder);
|
||||
parentFolder = folder;
|
||||
}
|
||||
return parentFolder;
|
||||
}
|
||||
|
||||
public TCComponentFolder creatNpiChildFolder(TCComponentFolder targetFolder) {
|
||||
if (targetFolder != null) {
|
||||
TCPreferenceService folderStyle = tcSession.getPreferenceService();
|
||||
try {
|
||||
System.out.println("创建NPI文件夹之前");
|
||||
TCComponentFolder npiFolder = soaCreateFolder(formData.getProjectName(), FOLDER_TYPE_NPI);
|
||||
System.out.println("npiFolder = " + npiFolder.toString());
|
||||
targetFolder.add("contents", npiFolder);
|
||||
targetFolder = npiFolder;
|
||||
} catch (TCException e) {
|
||||
// TODO Auto-generated catch block
|
||||
System.out.println("create npiFolder error !");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
String[] npiChildPath = folderStyle.getStringValues(PREFERENCES_FILE_FOLDER_CHILD);
|
||||
for (String childPath : npiChildPath) {
|
||||
TCComponentFolder tempFolder = targetFolder;
|
||||
String[] folderName = childPath.split("/");
|
||||
for (String childFolderName : folderName) {
|
||||
try {
|
||||
TCComponentFolder childFolder = folderType.create(childFolderName, "", FOLDER_TYPE_NORMAL);
|
||||
tempFolder.add("contents", childFolder);
|
||||
tempFolder = childFolder;
|
||||
} catch (TCException e) {
|
||||
System.out.println("create inner folder error !");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return targetFolder;
|
||||
} else {
|
||||
System.out.println("creatNpiChildFolder method() : targetFolder is null");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public TCComponentItemRevision setNpiFolderProp(TCComponentFolder npiFolder) {
|
||||
if (npiFolder != null) {
|
||||
try {
|
||||
System.out.println("设置出图任务书属性");
|
||||
String orderDate = formData.getOrderDate();
|
||||
if (orderDate != null && orderDate.length() > 2) {
|
||||
npiFolder.setDateProperty("vf5ddrq", new SimpleDateFormat("yyyy-MM-dd").parse(orderDate));
|
||||
}
|
||||
npiFolder.setStringProperty("vf5tsyq", checkNull(formData.getSpecialRequirements()));
|
||||
|
||||
TCComponentItem taskBookItem = taskType.create(taskType.getNewID(), null, ITEM_TYPE_TASK_BOOK,
|
||||
formData.getProjectName(), "", null);
|
||||
TCComponentItemRevision taskBookRev = taskBookItem.getLatestItemRevision();
|
||||
npiFolder.add("contents", taskBookItem);
|
||||
return taskBookRev;
|
||||
} catch (TCException e) {
|
||||
// TODO Auto-generated catch block
|
||||
System.out.println("fail to add tagRev !");
|
||||
e.printStackTrace();
|
||||
} catch (ParseException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
System.out.println("method setNpiFolderProp() npiFoder is null");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String checkNull(String propValue) {
|
||||
return propValue != null ? propValue : "";
|
||||
}
|
||||
|
||||
public TCComponentFolder soaCreateFolder(String name, String type) {
|
||||
System.out.println("创建文件夹" + name);
|
||||
TCComponentFolder folder = null;
|
||||
try {
|
||||
IBOCreateDefinition ibocreatedefinition = BOCreateDefinitionFactory.getInstance()
|
||||
.getCreateDefinition(tcSession, type);
|
||||
CreateInstanceInput cii = new CreateInstanceInput(ibocreatedefinition);
|
||||
List list = new ArrayList();
|
||||
list.add(cii);
|
||||
List list1 = SOAGenericCreateHelper.create(tcSession, ibocreatedefinition, list);
|
||||
if (list1 != null && list1.size() > 0) {
|
||||
TCComponent tccomponent = (TCComponent) list1.get(0);
|
||||
folder = (TCComponentFolder) tccomponent;
|
||||
folder.setProperty("object_name", name);
|
||||
}
|
||||
} catch (TCException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return folder;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,159 @@
|
||||
package com.connor.ferrorTech.metal.NPIproject.NPIprojectCreate.daheReadExcel;
|
||||
|
||||
public class ExcelRowData {
|
||||
|
||||
private String customerPN;
|
||||
private String rev;
|
||||
private String description;
|
||||
private String customer;
|
||||
private String dateOfIssuance;
|
||||
private String bomDeadline;
|
||||
private String drawingsDeadline;
|
||||
private String techBomDeadline;
|
||||
private String techDrawingsDeadline;
|
||||
private String finalBomDeadline;
|
||||
private String finalDrawingsDeadline;
|
||||
private String productionPIC;
|
||||
private String remarks;
|
||||
|
||||
public ExcelRowData(String... params) {
|
||||
int count =0;
|
||||
this.customerPN = params[count++];
|
||||
this.rev = params[count++];
|
||||
this.description = params[count++];
|
||||
this.customer = params[count++];
|
||||
this.dateOfIssuance = params[count++];
|
||||
this.bomDeadline = params[count++];
|
||||
this.drawingsDeadline = params[count++];
|
||||
this.techBomDeadline = params[count++];
|
||||
this.techDrawingsDeadline = params[count++];
|
||||
this.finalBomDeadline = params[count++];
|
||||
this.finalDrawingsDeadline = params[count++];
|
||||
this.productionPIC = params[count++];
|
||||
this.remarks = params[count];
|
||||
}
|
||||
|
||||
|
||||
public String getCustomerPN() {
|
||||
return customerPN;
|
||||
}
|
||||
|
||||
public void setCustomerPN(String customerPN) {
|
||||
this.customerPN = customerPN;
|
||||
}
|
||||
|
||||
public String getRev() {
|
||||
return rev;
|
||||
}
|
||||
|
||||
public void setRev(String rev) {
|
||||
this.rev = rev;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getCustomer() {
|
||||
return customer;
|
||||
}
|
||||
|
||||
public void setCustomer(String customer) {
|
||||
this.customer = customer;
|
||||
}
|
||||
|
||||
public String getDateOfIssuance() {
|
||||
return dateOfIssuance;
|
||||
}
|
||||
|
||||
public void setDateOfIssuance(String dateOfIssuance) {
|
||||
this.dateOfIssuance = dateOfIssuance;
|
||||
}
|
||||
|
||||
public String getBomDeadline() {
|
||||
return bomDeadline;
|
||||
}
|
||||
|
||||
public void setBomDeadline(String bomDeadline) {
|
||||
this.bomDeadline = bomDeadline;
|
||||
}
|
||||
|
||||
public String getDrawingsDeadline() {
|
||||
return drawingsDeadline;
|
||||
}
|
||||
|
||||
public void setDrawingsDeadline(String drawingsDeadline) {
|
||||
this.drawingsDeadline = drawingsDeadline;
|
||||
}
|
||||
|
||||
public String getTechBomDeadline() {
|
||||
return techBomDeadline;
|
||||
}
|
||||
|
||||
public void setTechBomDeadline(String techBomDeadline) {
|
||||
this.techBomDeadline = techBomDeadline;
|
||||
}
|
||||
|
||||
public String getTechDrawingsDeadline() {
|
||||
return techDrawingsDeadline;
|
||||
}
|
||||
|
||||
public void setTechDrawingsDeadline(String techDrawingsDeadline) {
|
||||
this.techDrawingsDeadline = techDrawingsDeadline;
|
||||
}
|
||||
|
||||
public String getFinalBomDeadline() {
|
||||
return finalBomDeadline;
|
||||
}
|
||||
|
||||
public void setFinalBomDeadline(String finalBomDeadline) {
|
||||
this.finalBomDeadline = finalBomDeadline;
|
||||
}
|
||||
|
||||
public String getFinalDrawingsDeadline() {
|
||||
return finalDrawingsDeadline;
|
||||
}
|
||||
|
||||
public void setFinalDrawingsDeadline(String finalDrawingsDeadline) {
|
||||
this.finalDrawingsDeadline = finalDrawingsDeadline;
|
||||
}
|
||||
|
||||
public String getProductionPIC() {
|
||||
return productionPIC;
|
||||
}
|
||||
|
||||
public void setProductionPIC(String productionPIC) {
|
||||
this.productionPIC = productionPIC;
|
||||
}
|
||||
|
||||
public String getRemarks() {
|
||||
return remarks;
|
||||
}
|
||||
|
||||
public void setRemarks(String remarks) {
|
||||
this.remarks = remarks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DataObject{" +
|
||||
"customerPN='" + customerPN + '\'' +
|
||||
", rev='" + rev + '\'' +
|
||||
", description='" + description + '\'' +
|
||||
", customer='" + customer + '\'' +
|
||||
", dateOfIssuance='" + dateOfIssuance + '\'' +
|
||||
", bomDeadline='" + bomDeadline + '\'' +
|
||||
", drawingsDeadline='" + drawingsDeadline + '\'' +
|
||||
", techBomDeadline='" + techBomDeadline + '\'' +
|
||||
", techDrawingsDeadline='" + techDrawingsDeadline + '\'' +
|
||||
", finalBomDeadline='" + finalBomDeadline + '\'' +
|
||||
", finalDrawingsDeadline='" + finalDrawingsDeadline + '\'' +
|
||||
", productionPIC='" + productionPIC + '\'' +
|
||||
", remarks='" + remarks + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package com.connor.ferrorTech.metal.NPIproject.NPIprojectCreate.entity;
|
||||
|
||||
import com.teamcenter.rac.kernel.TCComponentFolder;
|
||||
|
||||
public class CountFolder {
|
||||
|
||||
private TCComponentFolder folder;
|
||||
private int count;
|
||||
|
||||
public CountFolder(TCComponentFolder folder, int count) {
|
||||
super();
|
||||
this.folder = folder;
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
public TCComponentFolder getFolder() {
|
||||
return folder;
|
||||
}
|
||||
|
||||
public void setFolder(TCComponentFolder folder) {
|
||||
this.folder = folder;
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public void setCount(int count) {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CountFolder [folder=" + folder + ", count=" + count + "]";
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package com.connor.ferrorTech.metal.NPIproject.NPIprojectCreate.entity;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.EventObject;
|
||||
|
||||
import javax.swing.AbstractCellEditor;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.event.CellEditorListener;
|
||||
import javax.swing.table.TableCellEditor;
|
||||
|
||||
import org.jdesktop.swingx.JXDatePicker;
|
||||
|
||||
public class DatePickerEditor extends AbstractCellEditor implements TableCellEditor{
|
||||
|
||||
private JXDatePicker datePicker;
|
||||
|
||||
public DatePickerEditor() {
|
||||
datePicker = new JXDatePicker();
|
||||
// ÉèÖÃÈÕÆÚ¸ñʽ
|
||||
datePicker.setFormats(new SimpleDateFormat("yyyy-MM-dd"));
|
||||
datePicker.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
fireEditingStopped();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
|
||||
if (value instanceof Date) {
|
||||
System.out.println("value : "+value);
|
||||
datePicker.setDate((Date) value);
|
||||
} else {
|
||||
datePicker.setDate(null);
|
||||
}
|
||||
return datePicker;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getCellEditorValue() {
|
||||
return datePicker.getDate();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package com.connor.ferrorTech.metal.NPIproject.NPIprojectCreate.entity;
|
||||
|
||||
public class FormData {
|
||||
|
||||
private String projectName;
|
||||
private String orderDate;
|
||||
private String specialRequirements;
|
||||
|
||||
public FormData(String... params) {
|
||||
int count = 0;
|
||||
this.projectName = params[count++];
|
||||
this.orderDate = params[count++];
|
||||
this.specialRequirements = params[count++];
|
||||
}
|
||||
|
||||
public String getProjectName() {
|
||||
return projectName;
|
||||
}
|
||||
|
||||
public void setProjectName(String projectName) {
|
||||
this.projectName = projectName;
|
||||
}
|
||||
|
||||
public String getOrderDate() {
|
||||
return orderDate;
|
||||
}
|
||||
|
||||
public void setOrderDate(String orderDate) {
|
||||
this.orderDate = orderDate;
|
||||
}
|
||||
|
||||
public String getSpecialRequirements() {
|
||||
return specialRequirements;
|
||||
}
|
||||
|
||||
public void setSpecialRequirements(String specialRequirements) {
|
||||
this.specialRequirements = specialRequirements;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "FormData [projectName=" + projectName + ", orderDate=" + orderDate + ", specialRequirements="
|
||||
+ specialRequirements + "]";
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,102 @@
|
||||
package com.connor.ferrorTech.metal.NPIproject.NPIprojectCreate.entity;
|
||||
|
||||
public class RowData {
|
||||
|
||||
private String DrawingNumber;
|
||||
private String ProductName;
|
||||
private String Version;
|
||||
private String IssueDate;
|
||||
private String Number;
|
||||
private String MaterialDeliveryTime;
|
||||
private String DrawingDeliveryTime;
|
||||
private String MaterialReplyDate;
|
||||
private String DrawingReplyDate;
|
||||
private String Notes;
|
||||
|
||||
public RowData(String... params) {
|
||||
int count = 0 ;
|
||||
DrawingNumber = params[count++];
|
||||
ProductName = params[count++];
|
||||
Version = params[count++];
|
||||
IssueDate = params[count++];
|
||||
Number = params[count++];
|
||||
MaterialDeliveryTime = params[count++];
|
||||
DrawingDeliveryTime = params[count++];
|
||||
MaterialReplyDate = params[count++];
|
||||
DrawingReplyDate = params[count++];
|
||||
Notes = params[count++];
|
||||
}
|
||||
|
||||
|
||||
public String getDrawingNumber() {
|
||||
return DrawingNumber;
|
||||
}
|
||||
public void setDrawingNumber(String drawingNumber) {
|
||||
DrawingNumber = drawingNumber;
|
||||
}
|
||||
public String getProductName() {
|
||||
return ProductName;
|
||||
}
|
||||
public void setProductName(String productName) {
|
||||
ProductName = productName;
|
||||
}
|
||||
public String getVersion() {
|
||||
return Version;
|
||||
}
|
||||
public void setVersion(String version) {
|
||||
Version = version;
|
||||
}
|
||||
public String getIssueDate() {
|
||||
return IssueDate;
|
||||
}
|
||||
public void setIssueDate(String issueDate) {
|
||||
IssueDate = issueDate;
|
||||
}
|
||||
public String getNumber() {
|
||||
return Number;
|
||||
}
|
||||
public void setNumber(String number) {
|
||||
Number = number;
|
||||
}
|
||||
public String getMaterialDeliveryTime() {
|
||||
return MaterialDeliveryTime;
|
||||
}
|
||||
public void setMaterialDeliveryTime(String materialDeliveryTime) {
|
||||
MaterialDeliveryTime = materialDeliveryTime;
|
||||
}
|
||||
public String getDrawingDeliveryTime() {
|
||||
return DrawingDeliveryTime;
|
||||
}
|
||||
public void setDrawingDeliveryTime(String drawingDeliveryTime) {
|
||||
DrawingDeliveryTime = drawingDeliveryTime;
|
||||
}
|
||||
public String getMaterialReplyDate() {
|
||||
return MaterialReplyDate;
|
||||
}
|
||||
public void setMaterialReplyDate(String materialReplyDate) {
|
||||
MaterialReplyDate = materialReplyDate;
|
||||
}
|
||||
public String getDrawingReplyDate() {
|
||||
return DrawingReplyDate;
|
||||
}
|
||||
public void setDrawingReplyDate(String drawingReplyDate) {
|
||||
DrawingReplyDate = drawingReplyDate;
|
||||
}
|
||||
public String getNotes() {
|
||||
return Notes;
|
||||
}
|
||||
public void setNotes(String notes) {
|
||||
Notes = notes;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DrawingTaskBook [DrawingNumber=" + DrawingNumber + ", ProductName=" + ProductName + ", Version="
|
||||
+ Version + ", IssueDate=" + IssueDate + ", Number=" + Number + ", MaterialDeliveryTime="
|
||||
+ MaterialDeliveryTime + ", DrawingDeliveryTime=" + DrawingDeliveryTime + ", MaterialReplyDate="
|
||||
+ MaterialReplyDate + ", DrawingReplyDate=" + DrawingReplyDate + ", Notes=" + Notes + "]";
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
npiProjectDialog.0=Create Npi Projects
|
||||
npiProjectDialog.1=NPI Project Name
|
||||
npiProjectDialog.2=Whether test product
|
||||
npiProjectDialog.3=Inquiry number
|
||||
npiProjectDialog.4=Emergency status
|
||||
npiProjectDialog.5=Customer name
|
||||
npiProjectDialog.6=PLM customer name
|
||||
npiProjectDialog.7=Order date
|
||||
npiProjectDialog.8=Sales person in charge
|
||||
npiProjectDialog.9=Special requirements
|
||||
|
||||
npiProjectDialog.10=Serial
|
||||
npiProjectDialog.11=Customer PN
|
||||
npiProjectDialog.12=Product Name
|
||||
npiProjectDialog.13=Rev
|
||||
npiProjectDialog.14=Date of Issuance
|
||||
npiProjectDialog.15=Num
|
||||
npiProjectDialog.16=BOM Deadline
|
||||
npiProjectDialog.17=Drawings Deadline
|
||||
npiProjectDialog.18=Tec BOM Deadline
|
||||
npiProjectDialog.19=Tec Drawings Deadline
|
||||
npiProjectDialog.20=Remarks
|
@ -0,0 +1,23 @@
|
||||
package com.connor.ferrorTech.metal.NPIproject.NPIprojectCreateOnQuotation;
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
|
||||
public class CreateNPIprojectOnQuotationHandler extends AbstractHandler {
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
|
||||
AbstractAIFApplication application = AIFUtility.getCurrentApplication();
|
||||
CreateNPIprojectOnQuotationAction action = new CreateNPIprojectOnQuotationAction(application, null, null);
|
||||
|
||||
new Thread(action).start();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,206 @@
|
||||
package com.connor.ferrorTech.metal.NPIproject.customerDrawingsCreate;
|
||||
|
||||
import java.awt.Frame;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.connor.ferrorTech.metal.constant.ConstantPool;
|
||||
import com.connor.ferrorTech.metal.exception.CustomException;
|
||||
import com.connor.ferrorTech.metal.util.TcUtil;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aif.common.actions.AbstractAIFAction;
|
||||
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
||||
import com.teamcenter.rac.common.create.BOCreateDefinitionFactory;
|
||||
import com.teamcenter.rac.common.create.CreateInstanceInput;
|
||||
import com.teamcenter.rac.common.create.IBOCreateDefinition;
|
||||
import com.teamcenter.rac.common.create.SOAGenericCreateHelper;
|
||||
import com.teamcenter.rac.kernel.TCComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponentContextList;
|
||||
import com.teamcenter.rac.kernel.TCComponentFolder;
|
||||
import com.teamcenter.rac.kernel.TCComponentFolderType;
|
||||
import com.teamcenter.rac.kernel.TCComponentForm;
|
||||
import com.teamcenter.rac.kernel.TCComponentItem;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemType;
|
||||
import com.teamcenter.rac.kernel.TCException;
|
||||
import com.teamcenter.rac.kernel.TCPreferenceService;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
import com.teamcenter.rac.util.MessageBox;
|
||||
|
||||
public class CreateClientDrawingAction implements Runnable {
|
||||
|
||||
private AbstractAIFApplication application;
|
||||
private TCSession tcSession;
|
||||
|
||||
private TCComponentFolderType folderType;
|
||||
private TCComponentFolderType productType;
|
||||
private TCComponentItemType itemType;
|
||||
|
||||
public CreateClientDrawingAction(AbstractAIFApplication application) {
|
||||
this.application = application;
|
||||
this.tcSession = (TCSession) application.getSession();
|
||||
try {
|
||||
this.folderType = (TCComponentFolderType) tcSession.getTypeComponent("Folder");
|
||||
this.productType = (TCComponentFolderType) tcSession.getTypeComponent("VF5xmwjj");
|
||||
this.itemType = (TCComponentItemType) tcSession.getTypeComponent("VF5khtz");
|
||||
} catch (TCException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
// TODO 选中NPI项目文件夹
|
||||
InterfaceAIFComponent selectComponent = application.getTargetContext().getComponent();
|
||||
TCComponentForm formItem = null; // 表单对象
|
||||
try {
|
||||
// 获取出土任务书下的表单对象
|
||||
formItem = getFormItem(selectComponent);
|
||||
} catch (TCException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
String[] preferenceValues = getPreference("VF5PROJECTCHILDFOLDER");
|
||||
if (formItem != null) {
|
||||
if (preferenceValues != null) {
|
||||
TCComponentFolder npiFolder = (TCComponentFolder) selectComponent;
|
||||
try {
|
||||
TCComponent[] rowData = (TCComponent[]) formItem.getTCProperty("vf5cpxxTable")
|
||||
.getReferenceValueArray();
|
||||
createProductFolder(npiFolder, rowData, preferenceValues);
|
||||
} catch (TCException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
MessageBox.post("Fail To Get Preference VF5PROJECTCHILDFOLDER", "Error", MessageBox.ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
System.out.println("Fail To Get Form Item !");
|
||||
}
|
||||
|
||||
public TCComponentFolder createProductChildFolder(TCComponentFolder parentFolder, String filePath) {
|
||||
// TODO Auto-generated method stub
|
||||
if (parentFolder != null) {
|
||||
String[] fileName = filePath.split("/");
|
||||
for (int i = 0; i < fileName.length; i++) {
|
||||
try {
|
||||
TCComponentFolder newChildFolder = folderType.create(fileName[i], "", "Folder");
|
||||
parentFolder.add("contents", newChildFolder);
|
||||
parentFolder = newChildFolder;
|
||||
} catch (TCException e) {
|
||||
// TODO Auto-generated catch block
|
||||
MessageBox.post("create Folder " + fileName[i] + " error!", "error", MessageBox.ERROR);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return parentFolder;
|
||||
} else {
|
||||
throw new CustomException("productFolder is not exist");
|
||||
}
|
||||
}
|
||||
|
||||
public void createProductFolder(TCComponentFolder npiFolder, TCComponent[] itemRows, String[] filePaths)
|
||||
throws TCException {
|
||||
// TODO Auto-generated method stub
|
||||
if (filePaths != null && filePaths.length > 0 && npiFolder != null) {
|
||||
|
||||
TCComponentFolder customerFolder = null;
|
||||
TCComponent[] components = npiFolder.getRelatedComponents("contents");
|
||||
System.out.println("\u5BA2\u6237\u56FE\u7EB8");
|
||||
System.out.println("客户图纸");
|
||||
for (int i = 0; i < components.length; i++) {
|
||||
String customerFolderName = components[i].getProperty("object_name");
|
||||
if (customerFolderName.equals("\u5BA2\u6237\u56FE\u7EB8") || customerFolderName.equals("客户图纸")) {
|
||||
customerFolder = (TCComponentFolder) components[i];
|
||||
}
|
||||
}
|
||||
|
||||
if (customerFolder != null) {
|
||||
String rowName = "";
|
||||
String rowRev = "";
|
||||
String rowNo = "";
|
||||
for (TCComponent rowItem : itemRows) {
|
||||
rowName = rowItem.getStringProperty("vf5cpmc");
|
||||
rowRev = rowItem.getStringProperty("vf5khtzbb");
|
||||
rowNo = rowItem.getStringProperty("vf5khth");
|
||||
TCComponentFolder project = soaCreateFolder(rowNo, "VF5xmwjj");
|
||||
for (String path : filePaths) {
|
||||
createProductChildFolder(project, path);
|
||||
}
|
||||
System.out.println("rowName = " + rowName + " | rowRev = " + rowRev
|
||||
+ " | rowNo = " + rowNo);
|
||||
TCComponentItem khtz = (TCComponentItem) TcUtil.createComponent(application,
|
||||
new String[] { itemType.getNewID(), rowRev, rowName }, "VF5khtz", "Item");
|
||||
khtz.getLatestItemRevision().setStringProperty("vf5khth", rowNo);
|
||||
|
||||
customerFolder.add("contents", khtz);
|
||||
project.add("contents", khtz);
|
||||
npiFolder.add("contents", project);
|
||||
}
|
||||
MessageBox.post("Created Successfully !", "Info", MessageBox.INFORMATION);
|
||||
} else {
|
||||
throw new CustomException("xjxxdRevForm or customerFolder is null");
|
||||
}
|
||||
|
||||
} else {
|
||||
throw new CustomException("npiFolder is not exist or Preference error !");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public TCComponentForm getFormItem(InterfaceAIFComponent selectComponent) throws Exception {
|
||||
if (selectComponent != null) {
|
||||
System.out.println("type: " + selectComponent.getType());
|
||||
if (selectComponent.getType().equals("VF5NPI")) {
|
||||
TCComponentFolder tarFolder = (TCComponentFolder) selectComponent;
|
||||
TCComponent[] valueArray = tarFolder.getTCProperty("contents").getReferenceValueArray();
|
||||
for (TCComponent tcComponent : valueArray) {
|
||||
if (tcComponent.getStringProperty("object_type").equals("VF5ctrws")) {
|
||||
TCComponentItem tempItem = (TCComponentItem) tcComponent;
|
||||
return (TCComponentForm) tempItem.getLatestItemRevision()
|
||||
.getRelatedComponent("IMAN_master_form_rev");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
MessageBox.post(ConstantPool.EN_MESSAGE_Folder_TYPE_ERROR, "Error", MessageBox.ERROR);
|
||||
}
|
||||
} else {
|
||||
MessageBox.post(ConstantPool.EN_MESSAGE_Folder_ERROR, "Error", MessageBox.ERROR);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public TCComponentFolder soaCreateFolder(String name, String type) {
|
||||
System.out.println("创建文件夹 : " + name);
|
||||
TCComponentFolder folder = null;
|
||||
try {
|
||||
IBOCreateDefinition ibocreatedefinition = BOCreateDefinitionFactory.getInstance()
|
||||
.getCreateDefinition(tcSession, type);
|
||||
CreateInstanceInput cii = new CreateInstanceInput(ibocreatedefinition);
|
||||
List list = new ArrayList();
|
||||
list.add(cii);
|
||||
List list1 = SOAGenericCreateHelper.create(tcSession, ibocreatedefinition, list);
|
||||
if (list1 != null && list1.size() > 0) {
|
||||
TCComponent tccomponent = (TCComponent) list1.get(0);
|
||||
folder = (TCComponentFolder) tccomponent;
|
||||
folder.setProperty("object_name", name);
|
||||
}
|
||||
} catch (TCException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return folder;
|
||||
}
|
||||
|
||||
public String[] getPreference(String prefenenceName) {
|
||||
TCPreferenceService preferenceService = this.tcSession.getPreferenceService();
|
||||
String[] stringValues = preferenceService.getStringValues(prefenenceName);
|
||||
return stringValues;
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.connor.ferrorTech.metal.NPIproject.customerDrawingsCreate;
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
|
||||
public class CreateClientDrawingHandler extends AbstractHandler {
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
|
||||
AbstractAIFApplication application = AIFUtility.getCurrentApplication();
|
||||
CreateClientDrawingAction action = new CreateClientDrawingAction(application);
|
||||
|
||||
new Thread(action).start();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.connor.ferrorTech.metal.NPIproject.customerDrawingsUpload;
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
|
||||
public class UploadClientDrawingHandler extends AbstractHandler {
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
|
||||
AbstractAIFApplication application = AIFUtility.getCurrentApplication();
|
||||
UploadClientDrawingDialog action = new UploadClientDrawingDialog(application);
|
||||
|
||||
new Thread(action).start();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.connor.ferrorTech.metal;
|
||||
|
||||
import com.connor.ferrorTech.metal.quotationManagement.uploadQuotationDrawings.UploadDialog;
|
||||
|
||||
public class Test {
|
||||
|
||||
public static void main(String[] args) {
|
||||
// TODO Auto-generated method stub
|
||||
UploadDialog uploadDialog = new UploadDialog(null);
|
||||
uploadDialog.initUi();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.connor.ferrorTech.metal.batchDownload;
|
||||
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
|
||||
import com.connor.ferrorTech.metal.quotationManagement.uploadQuotationDrawings.UploadDialog;
|
||||
import com.connor.ferrorTech.metal.util.TcUtil;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
|
||||
public class BatchDownloadHandler extends AbstractHandler {
|
||||
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
AbstractAIFApplication application = AIFUtility.getCurrentApplication();
|
||||
boolean judgeSingleSelectComponent = TcUtil.judgeSingleSelectComponent(application, new String[]{"VF5NPI","VF5xmwjj","Folder"}, "Folder");
|
||||
if(judgeSingleSelectComponent) {
|
||||
BatchDownloadDialog dialog = new BatchDownloadDialog(application);
|
||||
new Thread(dialog).start();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,172 @@
|
||||
package com.connor.ferrorTech.metal.bomProcess;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
|
||||
import com.connor.ferrorTech.metal.util.TcUtil;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
import com.teamcenter.rac.kernel.TCComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponentFolder;
|
||||
import com.teamcenter.rac.kernel.TCComponentItem;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||
import com.teamcenter.rac.kernel.TCComponentProcessType;
|
||||
import com.teamcenter.rac.kernel.TCComponentTaskTemplate;
|
||||
import com.teamcenter.rac.kernel.TCComponentTaskTemplateType;
|
||||
import com.teamcenter.rac.kernel.TCException;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
import com.teamcenter.rac.util.MessageBox;
|
||||
import com.teamcenter.rac.workflow.commands.newprocess.NewProcessCommand;
|
||||
|
||||
public class ApprovalOfBomProcessHandler extends AbstractHandler {
|
||||
|
||||
private TCComponentFolder[] targetFolders;
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
AbstractAIFApplication application = AIFUtility.getCurrentApplication();
|
||||
TCSession tcSession = (TCSession) application.getSession();
|
||||
String errorName = "";
|
||||
try {
|
||||
errorName = judgeFolder(application);
|
||||
|
||||
if (errorName != null && !errorName.isEmpty()) {
|
||||
MessageBox.post(errorName + " Is Not Target Folder !", "error", MessageBox.ERROR);
|
||||
} else {
|
||||
List<TCComponent> list = getFilesWithCcp(targetFolders);
|
||||
TCComponent[] publicItems = filterTComponent(list);
|
||||
|
||||
// String preferenceValue = TcUtil.getPreferenceValue(tcSession, "VF5BOM_PROCESS_RELEASE");
|
||||
// if (preferenceValue != null && !preferenceValue.isEmpty() && publicItems != null
|
||||
// && publicItems.length > 0) {
|
||||
|
||||
if (publicItems != null && publicItems.length > 0) {
|
||||
// CreateProcess(tcSession, publicItems, preferenceValue);
|
||||
// MessageBox.post("Public Successful !", "Info", MessageBox.INFORMATION);
|
||||
|
||||
// new NewProcessCommand(AIFUtility.getActiveDesktop(), application, publicItems);
|
||||
NewProcessCommand cmd = new NewProcessCommand(AIFUtility.getActiveDesktop(), application,
|
||||
publicItems);
|
||||
cmd.executeModeless();
|
||||
} else {
|
||||
MessageBox.post("Preference configuration error or failure to find VF5ccp, VF5gy objects", "error",
|
||||
MessageBox.ERROR);
|
||||
}
|
||||
}
|
||||
} catch (TCException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public TCComponent[] filterTComponent(List<TCComponent> list) {
|
||||
List<TCComponentItemRevision> newList = new ArrayList<>();
|
||||
if (list != null && list.size() > 0) {
|
||||
try {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
TCComponentItem item = (TCComponentItem) list.get(i);
|
||||
TCComponentItemRevision latestItemRevision = item.getLatestItemRevision();
|
||||
TCComponent[] releaseList = latestItemRevision.getRelatedComponents("release_status_list");
|
||||
if (releaseList != null && releaseList.length > 0) {
|
||||
continue;
|
||||
} else {
|
||||
newList.add(latestItemRevision);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return newList.toArray(new TCComponent[newList.size()]);
|
||||
}
|
||||
|
||||
public void CreateProcess(TCSession session, TCComponent[] targets, String processName) throws TCException {
|
||||
try {
|
||||
System.out.println("number : " + targets.length);
|
||||
|
||||
TCComponentProcessType processType = (TCComponentProcessType) session.getTypeComponent("Job");
|
||||
TCComponentTaskTemplateType taskTemplateType = (TCComponentTaskTemplateType) session
|
||||
.getTypeComponent("EPMTaskTemplate");
|
||||
TCComponentTaskTemplate taskTemplate = taskTemplateType.find(processName, 0);
|
||||
int[] number = new int[targets.length];
|
||||
for (int i = 0; i < targets.length; i++) {
|
||||
number[i] = 1;
|
||||
}
|
||||
if (taskTemplate != null) {
|
||||
String name = targets[0].getProperty("object_string");
|
||||
processType.create(processName + ":" + name, "", taskTemplate, targets, number);
|
||||
}
|
||||
} catch (TCException e) {
|
||||
e.printStackTrace();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
public String judgeFolder(AbstractAIFApplication application) throws TCException {
|
||||
InterfaceAIFComponent[] targetComponents = application.getTargetComponents();
|
||||
|
||||
if (targetComponents != null && targetComponents.length > 0) {
|
||||
targetFolders = new TCComponentFolder[targetComponents.length];
|
||||
for (int i = 0; i < targetComponents.length; i++) {
|
||||
if (!targetComponents[i].getType().equals("VF5xmwjj")) {
|
||||
return ((TCComponentFolder) targetComponents[i]).getStringProperty("object_name");
|
||||
} else {
|
||||
targetFolders[i] = (TCComponentFolder) targetComponents[i];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
MessageBox.post("Please Select Folder !", "Error", MessageBox.ERROR);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<TCComponent> getFilesWithCcp(TCComponentFolder[] targetFolders) {
|
||||
List<TCComponent> result = new ArrayList<>();
|
||||
try {
|
||||
for (TCComponentFolder targetFolder : targetFolders) {
|
||||
traverseDirectory(targetFolder, result);
|
||||
}
|
||||
} catch (TCException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归遍历目录及其子目录
|
||||
*
|
||||
* @param directory 目录文件对象
|
||||
* @param result 存储符合条件的文件列表
|
||||
* @throws TCException
|
||||
*/
|
||||
private void traverseDirectory(TCComponentFolder targetFolder, List<TCComponent> result) throws TCException {
|
||||
TCComponent[] childItems = targetFolder.getTCProperty("contents").getReferenceValueArray();
|
||||
|
||||
if (childItems != null && childItems.length > 0) {
|
||||
for (TCComponent childItem : childItems) {
|
||||
if (childItem.getType().equals("Folder")) {
|
||||
traverseDirectory((TCComponentFolder) childItem, result);
|
||||
} else if (childItem.getType().equals("VF5ccp")) {
|
||||
result.add(childItem);
|
||||
// 这里可能会有问题,测试没问题,待有问题检查这里
|
||||
TCComponent[] gyGx = childItem.getRelatedComponents("VF5gygx");
|
||||
for (TCComponent tcComponent : childItems) {
|
||||
if (tcComponent.getStringProperty("object_type").equals("VF5gy")) {
|
||||
result.add(tcComponent);
|
||||
}
|
||||
}
|
||||
} else if (childItem.getType().equals("VF5gy")) {
|
||||
result.add(childItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,448 @@
|
||||
package com.connor.ferrorTech.metal.changeManagement.createECO;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
|
||||
import com.connor.ferrorTech.metal.changeManagement.createECR.CustomTableCellRenderer;
|
||||
import com.connor.ferrorTech.metal.constant.ConstantPool;
|
||||
import com.connor.ferrorTech.metal.exception.CustomException;
|
||||
import com.connor.ferrorTech.metal.util.TcUtil;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponentFolder;
|
||||
import com.teamcenter.rac.kernel.TCComponentItem;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||
import com.teamcenter.rac.kernel.TCComponentType;
|
||||
import com.teamcenter.rac.kernel.TCException;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
import com.teamcenter.rac.util.MessageBox;
|
||||
|
||||
import java.awt.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class ChangeNoticeFormCreateDialog extends JFrame implements Runnable {
|
||||
|
||||
private final String title;
|
||||
private AbstractAIFApplication application;
|
||||
private InterfaceAIFComponent targetComponent;
|
||||
|
||||
private final JLabel[] jLabels;
|
||||
private final JComponent[] jComponents;
|
||||
private JButton confirmButton;
|
||||
private JButton cancelButton;
|
||||
private JButton addButton;
|
||||
private JButton removeButton;
|
||||
|
||||
private JTable leftTable;
|
||||
private JTable rightTable;
|
||||
private String[][] leftData;
|
||||
private String[][] rightData;
|
||||
|
||||
public ChangeNoticeFormCreateDialog(AbstractAIFApplication application, String title, Object... args) {
|
||||
int count = 0;
|
||||
this.title = title;
|
||||
this.application = application;
|
||||
jLabels = (JLabel[]) args[count++];
|
||||
jComponents = (JComponent[]) args[count++];
|
||||
leftData = (String[][]) args[count];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
targetComponent = application.getTargetComponent();
|
||||
initUI();
|
||||
}
|
||||
|
||||
public void initUI() {
|
||||
this.setTitle(title);
|
||||
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
this.setSize(780, 450); // 设置窗口大小
|
||||
this.setLayout(new BorderLayout()); // 设置布局
|
||||
|
||||
initializationButton();
|
||||
|
||||
try {
|
||||
JPanel topPanel = createTopPanel();
|
||||
JPanel centerPanel = createCenterPanel();
|
||||
|
||||
JPanel southPanel = createSouthPanel();
|
||||
this.add(topPanel, BorderLayout.NORTH);
|
||||
this.add(centerPanel, BorderLayout.CENTER);
|
||||
this.add(southPanel, BorderLayout.SOUTH);
|
||||
|
||||
this.setLocationRelativeTo(null);
|
||||
this.setVisible(true);
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void initializationButton() {
|
||||
confirmButton = new JButton(ConstantPool.EN_BUTTON_CONFIRM);
|
||||
confirmButton.setPreferredSize(new Dimension(95, 25));
|
||||
confirmButton.addActionListener(e -> {
|
||||
String name = ((JTextField) jComponents[0]).getText();
|
||||
String reason = ((JTextField) jComponents[1]).getText();
|
||||
if (name.length() >= 40) {
|
||||
JOptionPane.showMessageDialog(null, "The length of the name cannot exceed 40 characters", "Error",
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
} else {
|
||||
this.dispose();
|
||||
if (name != null && name.isEmpty()) {
|
||||
name = "MECO";
|
||||
}
|
||||
doTask(name, reason);
|
||||
}
|
||||
});
|
||||
|
||||
cancelButton = new JButton(ConstantPool.EN_BUTTON_CANCEL);
|
||||
cancelButton.setPreferredSize(new Dimension(95, 25));
|
||||
cancelButton.addActionListener(e -> {
|
||||
this.dispose();
|
||||
});
|
||||
|
||||
addButton = new JButton("Add>>");
|
||||
addButton.setPreferredSize(new Dimension(110, 25));
|
||||
addButton.addActionListener(e -> {
|
||||
moveRight();
|
||||
});
|
||||
|
||||
removeButton = new JButton("<<Remove");
|
||||
removeButton.setPreferredSize(new Dimension(110, 25));
|
||||
removeButton.addActionListener(e -> {
|
||||
moveLeft();
|
||||
});
|
||||
}
|
||||
|
||||
public JPanel createTopPanel() throws Exception {
|
||||
JPanel topPanel = new JPanel(new GridBagLayout());
|
||||
topPanel.setBorder(BorderFactory.createEmptyBorder(20, 5, 5, 5));
|
||||
Font serif = new Font("Serif", Font.BOLD, 13);
|
||||
|
||||
GridBagConstraints gbc = new GridBagConstraints();
|
||||
gbc.gridy = 0;
|
||||
gbc.insets = new Insets(5, 20, 5, 20);
|
||||
int count = 0;
|
||||
for (int i = 0; i < jLabels.length; i++) {
|
||||
gbc.gridx = count++;
|
||||
jLabels[i].setFont(serif);
|
||||
topPanel.add(jLabels[i], gbc);
|
||||
gbc.gridx = count++;
|
||||
jComponents[i].setFont(serif);
|
||||
if (targetComponent.getProperty("object_type").equals("VF5bgpsd") && i == 1) {
|
||||
TCComponentItem tcItem = (TCComponentItem) targetComponent;
|
||||
String reason = tcItem.getLatestItemRevision().getRelatedComponent("IMAN_master_form_rev")
|
||||
.getProperty("vf5bgyy");
|
||||
((JTextField) jComponents[i]).setText(reason);
|
||||
}
|
||||
topPanel.add(jComponents[i], gbc);
|
||||
}
|
||||
return topPanel;
|
||||
}
|
||||
|
||||
private JPanel createSouthPanel() {
|
||||
JPanel southPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 10));
|
||||
southPanel.setBorder(BorderFactory.createEmptyBorder(-10, 5, 10, 80));
|
||||
southPanel.add(confirmButton);
|
||||
southPanel.add(cancelButton);
|
||||
return southPanel;
|
||||
}
|
||||
|
||||
public JPanel createCenterPanel() {
|
||||
JPanel centerPanel = new JPanel(new BorderLayout());
|
||||
centerPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
|
||||
centerPanel.add(createLeftPanel(), BorderLayout.WEST);
|
||||
centerPanel.add(createCenterButton(), BorderLayout.CENTER);
|
||||
centerPanel.add(createRightPanel(), BorderLayout.EAST);
|
||||
return centerPanel;
|
||||
}
|
||||
|
||||
public JPanel createLeftPanel() {
|
||||
JPanel centerPanel = new JPanel(new BorderLayout());
|
||||
centerPanel.setPreferredSize(new Dimension(this.getWidth() / 2 - 80, this.getHeight()));
|
||||
centerPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 5));
|
||||
|
||||
DefaultTableModel tableModel = new DefaultTableModel(leftData, new Object[] { "Column" }) {
|
||||
@Override
|
||||
public boolean isCellEditable(int row, int column) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRowCount() {
|
||||
return leftData.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColumnCount() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValueAt(int rowIndex, int columnIndex) {
|
||||
return leftData[rowIndex][1];
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
leftTable = new JTable(tableModel);
|
||||
|
||||
leftTable.setTableHeader(null);
|
||||
leftTable.setShowGrid(false);
|
||||
leftTable.setRowHeight(22);
|
||||
leftTable.setIntercellSpacing(new Dimension(0, 0));
|
||||
|
||||
leftTable.setDefaultRenderer(Object.class, new CustomTableCellRenderer());
|
||||
|
||||
centerPanel.add(new JScrollPane(leftTable), BorderLayout.CENTER);
|
||||
return centerPanel;
|
||||
}
|
||||
|
||||
public JPanel createCenterButton() {
|
||||
JPanel jPanel = new JPanel(new GridBagLayout());
|
||||
jPanel.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 5));
|
||||
GridBagConstraints gbc = new GridBagConstraints();
|
||||
gbc.gridx = 0;
|
||||
gbc.gridy = 0;
|
||||
gbc.anchor = GridBagConstraints.LINE_START;
|
||||
gbc.insets = new Insets(-30, 5, 30, 5);// 边距
|
||||
jPanel.add(addButton, gbc);
|
||||
gbc.insets = new Insets(0, 5, 10, 5);// 边距
|
||||
gbc.gridy = 1;
|
||||
jPanel.add(removeButton, gbc);
|
||||
return jPanel;
|
||||
}
|
||||
|
||||
public JPanel createRightPanel() {
|
||||
JPanel centerPanel = new JPanel(new BorderLayout());
|
||||
centerPanel.setPreferredSize(new Dimension(this.getWidth() / 2 - 80, this.getHeight()));
|
||||
centerPanel.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 10));
|
||||
|
||||
rightData = new String[][] {};
|
||||
|
||||
DefaultTableModel tableModel = new DefaultTableModel(rightData, new Object[] { "Column" }) {
|
||||
@Override
|
||||
public boolean isCellEditable(int row, int column) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRowCount() {
|
||||
return rightData.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColumnCount() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValueAt(int rowIndex, int columnIndex) {
|
||||
|
||||
return rightData[rowIndex][1];
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
rightTable = new JTable(tableModel);
|
||||
rightTable.setTableHeader(null);
|
||||
rightTable.setShowGrid(false);
|
||||
rightTable.setRowHeight(22);
|
||||
rightTable.setIntercellSpacing(new Dimension(0, 0));
|
||||
|
||||
rightTable.setDefaultRenderer(Object.class, new CustomTableCellRenderer());
|
||||
|
||||
centerPanel.add(new JScrollPane(rightTable), BorderLayout.CENTER);
|
||||
return centerPanel;
|
||||
}
|
||||
|
||||
public void moveRight() {
|
||||
int[] selectedRows = leftTable.getSelectedRows();
|
||||
if (selectedRows.length == 0) {
|
||||
JOptionPane.showMessageDialog(this, "Please select a row to move.", "No Selection",
|
||||
JOptionPane.WARNING_MESSAGE);
|
||||
return;
|
||||
}
|
||||
|
||||
String[][] newRightData = new String[rightData.length + selectedRows.length][];
|
||||
System.arraycopy(rightData, 0, newRightData, 0, rightData.length);
|
||||
|
||||
for (int i = 0; i < selectedRows.length; i++) {
|
||||
newRightData[rightData.length + i] = leftData[selectedRows[i]];
|
||||
}
|
||||
|
||||
DefaultTableModel rightTableModel = (DefaultTableModel) rightTable.getModel();
|
||||
rightTableModel.setDataVector(newRightData, new Object[] { "Column" });
|
||||
rightData = newRightData;
|
||||
|
||||
String[][] newLeftData = new String[leftData.length - selectedRows.length][];
|
||||
int newIndex = 0;
|
||||
for (int i = 0; i < leftData.length; i++) {
|
||||
boolean isSelected = false;
|
||||
for (int selectedRow : selectedRows) {
|
||||
if (i == selectedRow) {
|
||||
isSelected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isSelected) {
|
||||
newLeftData[newIndex++] = leftData[i];
|
||||
}
|
||||
}
|
||||
|
||||
DefaultTableModel leftTableModel = (DefaultTableModel) leftTable.getModel();
|
||||
leftTableModel.setDataVector(newLeftData, new Object[] { "Column" });
|
||||
leftData = newLeftData;
|
||||
}
|
||||
|
||||
public void moveLeft() {
|
||||
int[] selectedRows = rightTable.getSelectedRows();
|
||||
if (selectedRows.length == 0) {
|
||||
JOptionPane.showMessageDialog(this, "Please select a row to move.", "No Selection",
|
||||
JOptionPane.WARNING_MESSAGE);
|
||||
return;
|
||||
}
|
||||
|
||||
String[][] newLeftData = new String[leftData.length + selectedRows.length][];
|
||||
System.arraycopy(leftData, 0, newLeftData, 0, leftData.length);
|
||||
|
||||
for (int i = 0; i < selectedRows.length; i++) {
|
||||
newLeftData[leftData.length + i] = rightData[selectedRows[i]];
|
||||
}
|
||||
|
||||
DefaultTableModel leftTableModel = (DefaultTableModel) leftTable.getModel();
|
||||
leftTableModel.setDataVector(newLeftData, new Object[] { "Column" });
|
||||
leftData = newLeftData;
|
||||
|
||||
String[][] newRightData = new String[rightData.length - selectedRows.length][];
|
||||
int newIndex = 0;
|
||||
for (int i = 0; i < rightData.length; i++) {
|
||||
boolean isSelected = false;
|
||||
for (int selectedRow : selectedRows) {
|
||||
if (i == selectedRow) {
|
||||
isSelected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isSelected) {
|
||||
newRightData[newIndex++] = rightData[i];
|
||||
}
|
||||
}
|
||||
|
||||
DefaultTableModel rightTableModel = (DefaultTableModel) rightTable.getModel();
|
||||
rightTableModel.setDataVector(newRightData, new Object[] { "Column" });
|
||||
rightData = newRightData;
|
||||
}
|
||||
|
||||
public void doTask(String name, String reason) {
|
||||
TCSession session = (TCSession) application.getSession();
|
||||
|
||||
int selectedRow = rightTable.getRowCount();
|
||||
String[] uid = null;
|
||||
if (selectedRow > 0) {
|
||||
String[][] selectItems = new String[selectedRow][];
|
||||
uid = new String[selectItems.length];
|
||||
for (int i = 0; i < selectedRow; i++) {
|
||||
String[] selectedItem = rightData[i];
|
||||
selectItems[i] = selectedItem;
|
||||
System.out.println("Selected Item: " + Arrays.toString(selectedItem));
|
||||
}
|
||||
|
||||
for (int i = 0; i < selectItems.length; i++) {
|
||||
uid[i] = selectItems[i][0];
|
||||
}
|
||||
}
|
||||
|
||||
TCComponentFolder xmwjj = null;
|
||||
boolean isECR = false;
|
||||
if (targetComponent instanceof TCComponentFolder) {
|
||||
xmwjj = (TCComponentFolder) targetComponent;
|
||||
} else if (targetComponent instanceof TCComponentItem) {
|
||||
TCComponent changeFolder = ChangeNoticeFormCreateHandler.getLast((TCComponent) targetComponent, "Folder",
|
||||
"CHANGE DATA");
|
||||
if (changeFolder == null) {
|
||||
System.out.println("out Folder is null");
|
||||
}
|
||||
xmwjj = (TCComponentFolder) TcUtil.getLastReferenced(changeFolder, "VF5xmwjj", "Folder");
|
||||
isECR = true;
|
||||
}
|
||||
try {
|
||||
if (xmwjj == null) {
|
||||
throw new CustomException("xmwjj is null !");
|
||||
}
|
||||
setByFolder(xmwjj, uid, session, name, reason, isECR);
|
||||
} catch (TCException e) {
|
||||
// TODO Auto-generated catch block
|
||||
MessageBox.post(e.getMessage(), "Error", MessageBox.ERROR);
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void setByFolder(TCComponentFolder xmwjj, String[] uid, TCSession session, String name, String reason,
|
||||
boolean isECR) throws Exception {
|
||||
TCComponent[] components = xmwjj.getRelatedComponents("contents");
|
||||
TCComponentFolder changeFolder = null;
|
||||
for (TCComponent tcComponent : components) {
|
||||
if (tcComponent instanceof TCComponentFolder && tcComponent.getType().equals("Folder")
|
||||
&& tcComponent.getStringProperty("object_name").equals("CHANGE DATA")) {
|
||||
changeFolder = (TCComponentFolder) tcComponent;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
TCComponentItemRevision revision = null;
|
||||
if (changeFolder != null) {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyMM");
|
||||
String localTime = formatter.format(LocalDateTime.now());
|
||||
System.out.println("当前时间:" + localTime);
|
||||
int maxNumber = 0;
|
||||
InterfaceAIFComponent[] queryList = TcUtil.queryList(application, "MU_Find ItemRevision",
|
||||
new String[] { "ID" }, new String[] { "MECO-" + localTime + "-*" });
|
||||
if(queryList !=null) {
|
||||
for (InterfaceAIFComponent result : queryList) {
|
||||
String[] id = result.getProperty("item_id").split("-");
|
||||
if (id != null && id.length == 3) {
|
||||
int localNo = Integer.parseInt(id[id.length - 1]);
|
||||
if (localNo > maxNumber) {
|
||||
maxNumber = localNo;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
String itemId = (maxNumber + 1) + "";
|
||||
int count = 2 - itemId.length();
|
||||
for (int i = 0; i < count; i++) {
|
||||
itemId = "0" + itemId;
|
||||
}
|
||||
System.out.println("itemId : "+itemId);
|
||||
|
||||
TCComponentItem newItem = (TCComponentItem) TcUtil.createComponent(application,
|
||||
new String[] { "MECO-" + localTime + "-" + itemId, "", name }, "VF5bgtzd", "Item");
|
||||
revision = newItem.getLatestItemRevision();
|
||||
TCComponent form = revision.getRelatedComponent("IMAN_master_form_rev");
|
||||
form.setStringProperty("vf5bgyy", reason);
|
||||
changeFolder.add("contents", newItem);
|
||||
|
||||
if (isECR) {
|
||||
revision.add("VF5bgpsdgx", (TCComponent) targetComponent);
|
||||
}
|
||||
MessageBox.post("Created Successfully !", "Info", MessageBox.INFORMATION);
|
||||
|
||||
} else {
|
||||
throw new CustomException("changeFolder is null !");
|
||||
}
|
||||
|
||||
if (revision != null && uid != null & uid.length > 0) {
|
||||
TCComponent[] revList = session.stringToComponent(uid);
|
||||
revision.add("VF5ggqdxgx", revList);
|
||||
} else {
|
||||
throw new CustomException("revision is null !");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,218 @@
|
||||
package com.connor.ferrorTech.metal.changeManagement.createECO;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
|
||||
import com.connor.ferrorTech.metal.exception.CustomException;
|
||||
import com.connor.ferrorTech.metal.util.TcUtil;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
|
||||
import com.teamcenter.rac.aif.kernel.AbstractAIFSession;
|
||||
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.TCComponentBOMWindow;
|
||||
import com.teamcenter.rac.kernel.TCComponentBOMWindowType;
|
||||
import com.teamcenter.rac.kernel.TCComponentFolder;
|
||||
import com.teamcenter.rac.kernel.TCComponentItem;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||
import com.teamcenter.rac.kernel.TCException;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
import com.teamcenter.rac.util.MessageBox;
|
||||
|
||||
public class ChangeNoticeFormCreateHandler extends AbstractHandler {
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
|
||||
AbstractAIFApplication application = AIFUtility.getCurrentApplication();
|
||||
|
||||
TCComponent targetItem = judgeAndGetSingleSelectComponent(application);
|
||||
|
||||
try {
|
||||
if (targetItem != null) {
|
||||
JLabel[] jLabels = new JLabel[] { new JLabel("Name"), new JLabel("Reason for Change") };
|
||||
JComponent[] jComponents = new JComponent[] { new JTextField(20), new JTextField(20) };
|
||||
|
||||
TCComponentFolder xmwjj = null;
|
||||
if (targetItem instanceof TCComponentFolder) {
|
||||
xmwjj = (TCComponentFolder) targetItem;
|
||||
} else if (targetItem instanceof TCComponentItem) {
|
||||
TCComponent changeFolder = ChangeNoticeFormCreateHandler.getLast(targetItem, "Folder",
|
||||
"CHANGE DATA");
|
||||
|
||||
if (changeFolder == null) {
|
||||
throw new CustomException("changeFolder is null !");
|
||||
}
|
||||
xmwjj = (TCComponentFolder) TcUtil.getLastReferenced(changeFolder, "VF5xmwjj", "Folder");
|
||||
}
|
||||
|
||||
if (xmwjj == null) {
|
||||
throw new CustomException("xmwjj is null !");
|
||||
}
|
||||
List<TCComponentItemRevision> revisionList = null;
|
||||
revisionList = getCcpItemRevision(application, xmwjj);
|
||||
if (revisionList == null) {
|
||||
throw new CustomException("revisionList is null !");
|
||||
}
|
||||
String[][] data = getData(revisionList);
|
||||
ChangeNoticeFormCreateDialog searchTemplate = new ChangeNoticeFormCreateDialog(application,
|
||||
"Create ECO", jLabels, jComponents, data);
|
||||
new Thread(searchTemplate).start();
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
MessageBox.post(e.getMessage(), "Error", MessageBox.ERROR);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static TCComponent getLast(TCComponent targetComponent, String type, String name) {
|
||||
if (targetComponent != null) {
|
||||
try {
|
||||
AIFComponentContext[] parent = targetComponent.whereReferenced();
|
||||
for (int i = 0; i < parent.length; i++) {
|
||||
InterfaceAIFComponent component = (TCComponent) parent[i].getComponent();
|
||||
if (component.getType().equals(type) && component.getProperty("object_name").equals(name)) {
|
||||
return (TCComponent) parent[i].getComponent();
|
||||
}
|
||||
}
|
||||
System.out.println("Type is not exist !\n" + type);
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
System.out.println("TargetComponent Is Null !");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static TCComponent judgeAndGetSingleSelectComponent(AbstractAIFApplication application) {
|
||||
InterfaceAIFComponent targetComponent = application.getTargetComponent();
|
||||
try {
|
||||
if (targetComponent instanceof TCComponentItem
|
||||
&& ((TCComponentItem)targetComponent).getStringProperty("object_type").equals("VF5bgpsd")) {
|
||||
return (TCComponent) targetComponent;
|
||||
} else if (targetComponent instanceof TCComponentFolder
|
||||
&& ((TCComponentFolder)targetComponent).getStringProperty("object_type").equals("VF5xmwjj")) {
|
||||
return (TCComponent) targetComponent;
|
||||
}
|
||||
MessageBox.post("The Following Is Not A Specify Type !\n" + targetComponent.getUid(), "Error",
|
||||
MessageBox.ERROR);
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String[][] getData(List<TCComponentItemRevision> revisionList) throws TCException {
|
||||
// TODO Auto-generated method stub
|
||||
String[][] data = new String[revisionList.size()][];
|
||||
if (revisionList != null && revisionList.size() > 0) {
|
||||
int count = 0;
|
||||
String name = "";
|
||||
for (TCComponentItemRevision itemRevison : revisionList) {
|
||||
String type = itemRevison.getStringProperty("object_type");
|
||||
String[] rowData = new String[2];
|
||||
String uid = itemRevison.getUid();
|
||||
if (type.equals("VF5ccpRevision") || type.equals("VF5bcpRevision")) {
|
||||
String wlbm = itemRevison.getRelatedComponent("IMAN_master_form_rev").getStringProperty("vf5wlbm");
|
||||
name = wlbm + "-" + itemRevison.getStringProperty("object_name") + ";"
|
||||
+ itemRevison.getStringProperty("item_revision_id");
|
||||
} else if (type.equals("VF5gyRevision")) {
|
||||
name = itemRevison.getStringProperty("item_id") + "-" + itemRevison.getStringProperty("object_name")
|
||||
+ ";" + itemRevison.getStringProperty("item_revision_id");
|
||||
}
|
||||
rowData[0] = uid;
|
||||
rowData[1] = name;
|
||||
data[count++] = rowData;
|
||||
}
|
||||
return data;
|
||||
} else {
|
||||
return new String[][] {};
|
||||
}
|
||||
}
|
||||
|
||||
public List<TCComponentItemRevision> getCcpItemRevision(AbstractAIFApplication application, TCComponentFolder xmwjj)
|
||||
throws TCException {
|
||||
// TODO Auto-generated method stub
|
||||
TCSession session = (TCSession) application.getSession();
|
||||
TCComponentBOMWindowType winType = (TCComponentBOMWindowType) session.getTypeComponent("BOMWindow");
|
||||
// 创建视图
|
||||
TCComponentBOMWindow view = winType.create(null);
|
||||
// 发送BOM args:item对象 版本对象 ...
|
||||
|
||||
List<TCComponentItemRevision> revList = new ArrayList<>();
|
||||
|
||||
TCComponent[] components = xmwjj.getRelatedComponents("contents");
|
||||
TCComponentFolder materialFolder = null;
|
||||
TCComponentFolder porFolder = null;
|
||||
for (TCComponent tcComponent : components) {
|
||||
if (tcComponent instanceof TCComponentFolder && tcComponent.getType().equals("Folder")
|
||||
&& tcComponent.getStringProperty("object_name").equals("MATERIAL AND BOM")) {
|
||||
materialFolder = (TCComponentFolder) tcComponent;
|
||||
} else if (tcComponent instanceof TCComponentFolder && tcComponent.getType().equals("Folder")
|
||||
&& tcComponent.getStringProperty("object_name").equals("POR")) {
|
||||
porFolder = (TCComponentFolder) tcComponent;
|
||||
}
|
||||
}
|
||||
|
||||
if (materialFolder != null) {
|
||||
TCComponent[] materialChildren = materialFolder.getRelatedComponents("contents");
|
||||
for (TCComponent tcItem : materialChildren) {
|
||||
if (tcItem.getStringProperty("object_type").equals("VF5ccp")) {
|
||||
TCComponentItem ccpItem = (TCComponentItem) tcItem;
|
||||
TCComponentItemRevision ccpItemRev = ccpItem.getLatestItemRevision();
|
||||
|
||||
revList.add(ccpItemRev);
|
||||
getBcpRevision(revList, view, ccpItem, ccpItemRev);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new CustomException("materialFolder is null ! ");
|
||||
}
|
||||
|
||||
if (porFolder != null) {
|
||||
TCComponent[] porChildren = porFolder.getRelatedComponents("contents");
|
||||
for (TCComponent tcItem : porChildren) {
|
||||
if (tcItem.getStringProperty("object_type").equals("VF5gy")) {
|
||||
TCComponentItem gyItem = (TCComponentItem) tcItem;
|
||||
TCComponentItemRevision gyItemRev = gyItem.getLatestItemRevision();
|
||||
revList.add(gyItemRev);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new CustomException("porFolder is null ! ");
|
||||
}
|
||||
return revList;
|
||||
}
|
||||
|
||||
public void getBcpRevision(List<TCComponentItemRevision> revList, TCComponentBOMWindow view,
|
||||
TCComponentItem ccpItem, TCComponentItemRevision ccpItemRev) throws TCException {
|
||||
TCComponentBOMLine bomLine = view.setWindowTopLine(ccpItem, ccpItemRev, null, null);
|
||||
|
||||
boolean hasChildren = bomLine.hasChildren();
|
||||
if (hasChildren) {
|
||||
AIFComponentContext[] childrena = bomLine.getChildren();
|
||||
for (AIFComponentContext children : childrena) {
|
||||
// 强转为TCComponentBOMLine类型
|
||||
TCComponentItemRevision bcpItemRev = ((TCComponentBOMLine) children.getComponent()).getItemRevision();
|
||||
if (bcpItemRev.getStringProperty("object_type").equals("VF5bcpRevision")) {
|
||||
revList.add(bcpItemRev);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,406 @@
|
||||
package com.connor.ferrorTech.metal.changeManagement.createECR;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
|
||||
import com.connor.ferrorTech.metal.constant.ConstantPool;
|
||||
import com.connor.ferrorTech.metal.exception.CustomException;
|
||||
import com.connor.ferrorTech.metal.util.TcUtil;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponentFolder;
|
||||
import com.teamcenter.rac.kernel.TCComponentItem;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||
import com.teamcenter.rac.kernel.TCComponentType;
|
||||
import com.teamcenter.rac.kernel.TCException;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
import com.teamcenter.rac.util.MessageBox;
|
||||
|
||||
import java.awt.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class ChangeApplyFormCreateDialog extends JFrame implements Runnable {
|
||||
|
||||
private final String title;
|
||||
private AbstractAIFApplication application;
|
||||
|
||||
private final JLabel[] jLabels;
|
||||
private final JComponent[] jComponents;
|
||||
private JButton confirmButton;
|
||||
private JButton cancelButton;
|
||||
private JButton addButton;
|
||||
private JButton removeButton;
|
||||
|
||||
private JTable leftTable;
|
||||
private JTable rightTable;
|
||||
private String[][] leftData;
|
||||
private String[][] rightData;
|
||||
|
||||
public ChangeApplyFormCreateDialog(AbstractAIFApplication application,String title, Object... args) {
|
||||
int count = 0;
|
||||
this.title = title;
|
||||
this.application =application;
|
||||
jLabels = (JLabel[]) args[count++];
|
||||
jComponents = (JComponent[]) args[count++];
|
||||
leftData = (String[][]) args[count];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
initUI();
|
||||
}
|
||||
|
||||
public void initUI() {
|
||||
this.setTitle(title);
|
||||
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
this.setSize(780, 450); // 设置窗口大小
|
||||
this.setLayout(new BorderLayout()); // 设置布局
|
||||
|
||||
initializationButton();
|
||||
|
||||
JPanel topPanel = createTopPanel();
|
||||
|
||||
JPanel centerPanel = createCenterPanel();
|
||||
|
||||
JPanel southPanel = createSouthPanel();
|
||||
this.add(topPanel, BorderLayout.NORTH);
|
||||
this.add(centerPanel, BorderLayout.CENTER);
|
||||
this.add(southPanel, BorderLayout.SOUTH);
|
||||
|
||||
this.setLocationRelativeTo(null);
|
||||
this.setVisible(true);
|
||||
}
|
||||
|
||||
public void initializationButton() {
|
||||
confirmButton = new JButton(ConstantPool.EN_BUTTON_CONFIRM);
|
||||
confirmButton.setPreferredSize(new Dimension(95, 25));
|
||||
confirmButton.addActionListener(e -> {
|
||||
String name = ((JTextField) jComponents[0]).getText();
|
||||
String reason = ((JTextField) jComponents[1]).getText();
|
||||
if(name.length()>=40){
|
||||
JOptionPane.showMessageDialog(null, "The length of the name cannot exceed 40 characters", "Error", JOptionPane.ERROR_MESSAGE);
|
||||
}else{
|
||||
this.dispose();
|
||||
try {
|
||||
if(name !=null && name.isEmpty()) {
|
||||
name = "MECR";
|
||||
}
|
||||
doTask(name,reason);
|
||||
} catch (TCException e1) {
|
||||
// TODO Auto-generated catch block
|
||||
MessageBox.post(e1.getMessage(), "Error", MessageBox.ERROR);
|
||||
} catch (Exception e1) {
|
||||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
cancelButton = new JButton(ConstantPool.EN_BUTTON_CANCEL);
|
||||
cancelButton.setPreferredSize(new Dimension(95, 25));
|
||||
cancelButton.addActionListener(e -> {
|
||||
this.dispose();
|
||||
});
|
||||
|
||||
addButton = new JButton("Add>>");
|
||||
addButton.setPreferredSize(new Dimension(110, 25));
|
||||
addButton.addActionListener(e -> {
|
||||
moveRight();
|
||||
});
|
||||
|
||||
removeButton = new JButton("<<Remove");
|
||||
removeButton.setPreferredSize(new Dimension(110, 25));
|
||||
removeButton.addActionListener(e -> {
|
||||
moveLeft();
|
||||
});
|
||||
}
|
||||
|
||||
public JPanel createTopPanel() {
|
||||
JPanel topPanel = new JPanel(new GridBagLayout());
|
||||
topPanel.setBorder(BorderFactory.createEmptyBorder(20, 5, 5, 5));
|
||||
Font serif = new Font("Serif", Font.BOLD, 13);
|
||||
|
||||
GridBagConstraints gbc = new GridBagConstraints();
|
||||
gbc.gridy = 0;
|
||||
gbc.insets = new Insets(5, 20, 5, 20);
|
||||
int count = 0;
|
||||
for (int i = 0; i < jLabels.length; i++) {
|
||||
gbc.gridx = count++;
|
||||
jLabels[i].setFont(serif);
|
||||
topPanel.add(jLabels[i], gbc);
|
||||
gbc.gridx = count++;
|
||||
jComponents[i].setFont(serif);
|
||||
topPanel.add(jComponents[i], gbc);
|
||||
}
|
||||
return topPanel;
|
||||
}
|
||||
|
||||
private JPanel createSouthPanel() {
|
||||
JPanel southPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 10));
|
||||
southPanel.setBorder(BorderFactory.createEmptyBorder(-10, 5, 10, 80));
|
||||
southPanel.add(confirmButton);
|
||||
southPanel.add(cancelButton);
|
||||
return southPanel;
|
||||
}
|
||||
|
||||
public JPanel createCenterPanel() {
|
||||
JPanel centerPanel = new JPanel(new BorderLayout());
|
||||
centerPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
|
||||
centerPanel.add(createLeftPanel(), BorderLayout.WEST);
|
||||
centerPanel.add(createCenterButton(), BorderLayout.CENTER);
|
||||
centerPanel.add(createRightPanel(), BorderLayout.EAST);
|
||||
return centerPanel;
|
||||
}
|
||||
|
||||
public JPanel createLeftPanel() {
|
||||
JPanel centerPanel = new JPanel(new BorderLayout());
|
||||
centerPanel.setPreferredSize(new Dimension(this.getWidth() / 2 - 80, this.getHeight()));
|
||||
centerPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 5));
|
||||
|
||||
DefaultTableModel tableModel = new DefaultTableModel(leftData, new Object[]{"Column"}) {
|
||||
@Override
|
||||
public boolean isCellEditable(int row, int column) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRowCount() {
|
||||
return leftData.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColumnCount() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValueAt(int rowIndex, int columnIndex) {
|
||||
return leftData[rowIndex][1];
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
leftTable = new JTable(tableModel);
|
||||
|
||||
leftTable.setTableHeader(null);
|
||||
leftTable.setShowGrid(false);
|
||||
leftTable.setRowHeight(22);
|
||||
leftTable.setIntercellSpacing(new Dimension(0, 0));
|
||||
|
||||
leftTable.setDefaultRenderer(Object.class, new CustomTableCellRenderer());
|
||||
|
||||
centerPanel.add(new JScrollPane(leftTable), BorderLayout.CENTER);
|
||||
return centerPanel;
|
||||
}
|
||||
|
||||
public JPanel createCenterButton() {
|
||||
JPanel jPanel = new JPanel(new GridBagLayout());
|
||||
jPanel.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 5));
|
||||
GridBagConstraints gbc = new GridBagConstraints();
|
||||
gbc.gridx = 0;
|
||||
gbc.gridy = 0;
|
||||
gbc.anchor = GridBagConstraints.LINE_START;
|
||||
gbc.insets = new Insets(-30, 5, 30, 5);// 边距
|
||||
jPanel.add(addButton, gbc);
|
||||
gbc.insets = new Insets(0, 5, 10, 5);// 边距
|
||||
gbc.gridy = 1;
|
||||
jPanel.add(removeButton, gbc);
|
||||
return jPanel;
|
||||
}
|
||||
|
||||
public JPanel createRightPanel() {
|
||||
JPanel centerPanel = new JPanel(new BorderLayout());
|
||||
centerPanel.setPreferredSize(new Dimension(this.getWidth() / 2 - 80, this.getHeight()));
|
||||
centerPanel.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 10));
|
||||
|
||||
rightData = new String[][]{};
|
||||
|
||||
DefaultTableModel tableModel = new DefaultTableModel(rightData, new Object[]{"Column"}) {
|
||||
@Override
|
||||
public boolean isCellEditable(int row, int column) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRowCount() {
|
||||
return rightData.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColumnCount() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValueAt(int rowIndex, int columnIndex) {
|
||||
|
||||
return rightData[rowIndex][1];
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
rightTable = new JTable(tableModel);
|
||||
rightTable.setTableHeader(null);
|
||||
rightTable.setShowGrid(false);
|
||||
rightTable.setRowHeight(22);
|
||||
rightTable.setIntercellSpacing(new Dimension(0, 0));
|
||||
|
||||
rightTable.setDefaultRenderer(Object.class, new CustomTableCellRenderer());
|
||||
|
||||
centerPanel.add(new JScrollPane(rightTable), BorderLayout.CENTER);
|
||||
return centerPanel;
|
||||
}
|
||||
|
||||
public void moveRight() {
|
||||
int[] selectedRows = leftTable.getSelectedRows();
|
||||
if (selectedRows.length == 0) {
|
||||
JOptionPane.showMessageDialog(this, "Please select a row to move.", "No Selection", JOptionPane.WARNING_MESSAGE);
|
||||
return;
|
||||
}
|
||||
|
||||
String[][] newRightData = new String[rightData.length + selectedRows.length][];
|
||||
System.arraycopy(rightData, 0, newRightData, 0, rightData.length);
|
||||
|
||||
for (int i = 0; i < selectedRows.length; i++) {
|
||||
newRightData[rightData.length + i] = leftData[selectedRows[i]];
|
||||
}
|
||||
|
||||
DefaultTableModel rightTableModel = (DefaultTableModel) rightTable.getModel();
|
||||
rightTableModel.setDataVector(newRightData, new Object[]{"Column"});
|
||||
rightData = newRightData;
|
||||
|
||||
String[][] newLeftData = new String[leftData.length - selectedRows.length][];
|
||||
int newIndex = 0;
|
||||
for (int i = 0; i < leftData.length; i++) {
|
||||
boolean isSelected = false;
|
||||
for (int selectedRow : selectedRows) {
|
||||
if (i == selectedRow) {
|
||||
isSelected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isSelected) {
|
||||
newLeftData[newIndex++] = leftData[i];
|
||||
}
|
||||
}
|
||||
|
||||
DefaultTableModel leftTableModel = (DefaultTableModel) leftTable.getModel();
|
||||
leftTableModel.setDataVector(newLeftData, new Object[]{"Column"});
|
||||
leftData = newLeftData;
|
||||
}
|
||||
|
||||
public void moveLeft() {
|
||||
int[] selectedRows = rightTable.getSelectedRows();
|
||||
if (selectedRows.length == 0) {
|
||||
JOptionPane.showMessageDialog(this, "Please select a row to move.", "No Selection", JOptionPane.WARNING_MESSAGE);
|
||||
return;
|
||||
}
|
||||
|
||||
String[][] newLeftData = new String[leftData.length + selectedRows.length][];
|
||||
System.arraycopy(leftData, 0, newLeftData, 0, leftData.length);
|
||||
|
||||
for (int i = 0; i < selectedRows.length; i++) {
|
||||
newLeftData[leftData.length + i] = rightData[selectedRows[i]];
|
||||
}
|
||||
|
||||
DefaultTableModel leftTableModel = (DefaultTableModel) leftTable.getModel();
|
||||
leftTableModel.setDataVector(newLeftData, new Object[]{"Column"});
|
||||
leftData = newLeftData;
|
||||
|
||||
String[][] newRightData = new String[rightData.length - selectedRows.length][];
|
||||
int newIndex = 0;
|
||||
for (int i = 0; i < rightData.length; i++) {
|
||||
boolean isSelected = false;
|
||||
for (int selectedRow : selectedRows) {
|
||||
if (i == selectedRow) {
|
||||
isSelected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isSelected) {
|
||||
newRightData[newIndex++] = rightData[i];
|
||||
}
|
||||
}
|
||||
|
||||
DefaultTableModel rightTableModel = (DefaultTableModel) rightTable.getModel();
|
||||
rightTableModel.setDataVector(newRightData, new Object[]{"Column"});
|
||||
rightData = newRightData;
|
||||
}
|
||||
|
||||
|
||||
public void doTask(String name,String reason) throws Exception {
|
||||
TCSession session = (TCSession) application.getSession();
|
||||
|
||||
int selectedRow = rightTable.getRowCount();
|
||||
String[] uid = null;
|
||||
if (selectedRow > 0) {
|
||||
String[][] selectItems = new String[selectedRow][];
|
||||
uid = new String[selectItems.length];
|
||||
for (int i = 0; i < selectedRow; i++) {
|
||||
String[] selectedItem = rightData[i];
|
||||
selectItems[i] = selectedItem;
|
||||
System.out.println("Selected Item: " + Arrays.toString(selectedItem));
|
||||
}
|
||||
for (int i = 0; i < selectItems.length; i++) {
|
||||
uid[i] = selectItems[i][0];
|
||||
}
|
||||
}
|
||||
|
||||
TCComponentFolder xmwjj = (TCComponentFolder) TcUtil.judgeAndGetSingleSelectComponent(application,
|
||||
new String[] { "VF5xmwjj" }, "Folder");
|
||||
|
||||
TCComponent[] components = xmwjj.getRelatedComponents("contents");
|
||||
TCComponentFolder changeFolder = null;
|
||||
for (TCComponent tcComponent : components) {
|
||||
if (tcComponent instanceof TCComponentFolder && tcComponent.getType().equals("Folder")
|
||||
&& tcComponent.getStringProperty("object_name").equals("CHANGE DATA")) {
|
||||
changeFolder = (TCComponentFolder) tcComponent;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
TCComponentItemRevision revision = null;
|
||||
if(changeFolder!=null) {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyMM");
|
||||
String localTime = formatter.format(LocalDateTime.now());
|
||||
System.out.println("当前时间:" + localTime);
|
||||
int maxNumber = 0;
|
||||
InterfaceAIFComponent[] queryList = TcUtil.queryList(application, "MU_Find ItemRevision", new String[] {"ID"}, new String[] {"MECR-"+localTime+"-*"});
|
||||
for (InterfaceAIFComponent result : queryList) {
|
||||
String[] id = result.getProperty("item_id").split("-");
|
||||
if(id !=null && id.length==3){
|
||||
int localNo = Integer.parseInt(id[id.length-1]);
|
||||
if(localNo>maxNumber) {
|
||||
maxNumber = localNo;
|
||||
}
|
||||
}
|
||||
}
|
||||
String itemId = (maxNumber+1) + "";
|
||||
int count = 2 - itemId.length();
|
||||
for (int i = 0; i < count; i++) {
|
||||
itemId = "0"+itemId;
|
||||
}
|
||||
|
||||
TCComponentItem newItem = (TCComponentItem)TcUtil.createComponent(application
|
||||
, new String[] {"MECR-"+localTime+"-"+itemId,"",name}, "VF5bgpsd", "Item");
|
||||
revision = newItem.getLatestItemRevision();
|
||||
TCComponent form = revision.getRelatedComponent("IMAN_master_form_rev");
|
||||
form.setStringProperty("vf5bgyy", reason);
|
||||
changeFolder.add("contents", newItem);
|
||||
|
||||
MessageBox.post("Created Successfully !", "Info", MessageBox.INFORMATION);
|
||||
}else {
|
||||
throw new CustomException("changeFolder is null !");
|
||||
}
|
||||
|
||||
if(revision!=null && uid!=null & uid.length>0) {
|
||||
TCComponent[] revList = session.stringToComponent(uid);
|
||||
revision.add("VF5ggqdxgx", revList);
|
||||
}else {
|
||||
throw new CustomException("revision is null !");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,156 @@
|
||||
package com.connor.ferrorTech.metal.changeManagement.createECR;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
|
||||
import com.connor.ferrorTech.metal.exception.CustomException;
|
||||
import com.connor.ferrorTech.metal.util.TcUtil;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
|
||||
import com.teamcenter.rac.aif.kernel.AbstractAIFSession;
|
||||
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.TCComponentBOMWindowType;
|
||||
import com.teamcenter.rac.kernel.TCComponentFolder;
|
||||
import com.teamcenter.rac.kernel.TCComponentItem;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||
import com.teamcenter.rac.kernel.TCException;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
import com.teamcenter.rac.util.MessageBox;
|
||||
|
||||
public class ChangeApplyFormCreateHandler extends AbstractHandler {
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
|
||||
AbstractAIFApplication application = AIFUtility.getCurrentApplication();
|
||||
|
||||
TCComponentFolder xmwjj = (TCComponentFolder) TcUtil.judgeAndGetSingleSelectComponent(application,
|
||||
new String[] { "VF5xmwjj" }, "Folder");
|
||||
|
||||
try {
|
||||
if (xmwjj != null) {
|
||||
JLabel[] jLabels = new JLabel[] { new JLabel("Name"), new JLabel("Reason for Change") };
|
||||
JComponent[] jComponents = new JComponent[] { new JTextField(20), new JTextField(20) };
|
||||
|
||||
List<TCComponentItemRevision> revisionList = getCcpItemRevision(application, xmwjj);
|
||||
|
||||
String[][] data = getData(revisionList);
|
||||
|
||||
ChangeApplyFormCreateDialog searchTemplate = new ChangeApplyFormCreateDialog(application,"Create ECR", jLabels,
|
||||
jComponents,data);
|
||||
new Thread(searchTemplate).start();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
MessageBox.post(e.getMessage(), "Error", MessageBox.ERROR);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String[][] getData(List<TCComponentItemRevision> revisionList) throws TCException {
|
||||
// TODO Auto-generated method stub
|
||||
String[][] data = new String[revisionList.size()][];
|
||||
if(revisionList!=null && revisionList.size()>0) {
|
||||
int count = 0 ;
|
||||
String name = "";
|
||||
for (TCComponentItemRevision itemRevison : revisionList) {
|
||||
String type = itemRevison.getStringProperty("object_type");
|
||||
String[] rowData = new String[2];
|
||||
String uid = itemRevison.getUid();
|
||||
if(type.equals("VF5ccpRevision") || type.equals("VF5bcpRevision")) {
|
||||
String wlbm = itemRevison.getRelatedComponent("IMAN_master_form_rev").getStringProperty("vf5wlbm");
|
||||
name = wlbm +"-"+itemRevison.getStringProperty("object_name")+";"+itemRevison.getStringProperty("item_revision_id");
|
||||
}else if(type.equals("VF5gyRevision")) {
|
||||
name = itemRevison.getStringProperty("item_id") +"-"+itemRevison.getStringProperty("object_name")+";"+itemRevison.getStringProperty("item_revision_id");
|
||||
}
|
||||
rowData[0] = uid;
|
||||
rowData[1] = name;
|
||||
data[count++] = rowData;
|
||||
}
|
||||
return data;
|
||||
}else {
|
||||
return new String[][] {};
|
||||
}
|
||||
}
|
||||
|
||||
public List<TCComponentItemRevision> getCcpItemRevision(AbstractAIFApplication application, TCComponentFolder xmwjj) throws TCException {
|
||||
// TODO Auto-generated method stub
|
||||
TCSession session = (TCSession) application.getSession();
|
||||
TCComponentBOMWindowType winType = (TCComponentBOMWindowType) session.getTypeComponent("BOMWindow");
|
||||
// 创建视图
|
||||
TCComponentBOMWindow view = winType.create(null);
|
||||
// 发送BOM args:item对象 版本对象 ...
|
||||
|
||||
List<TCComponentItemRevision> revList = new ArrayList<>();
|
||||
|
||||
TCComponent[] components = xmwjj.getRelatedComponents("contents");
|
||||
TCComponentFolder materialFolder = null;
|
||||
TCComponentFolder porFolder = null;
|
||||
for (TCComponent tcComponent : components) {
|
||||
if (tcComponent instanceof TCComponentFolder && tcComponent.getType().equals("Folder")
|
||||
&& tcComponent.getStringProperty("object_name").equals("MATERIAL AND BOM")) {
|
||||
materialFolder = (TCComponentFolder) tcComponent;
|
||||
} else if (tcComponent instanceof TCComponentFolder && tcComponent.getType().equals("Folder")
|
||||
&& tcComponent.getStringProperty("object_name").equals("POR")) {
|
||||
porFolder = (TCComponentFolder) tcComponent;
|
||||
}
|
||||
}
|
||||
|
||||
if (materialFolder != null) {
|
||||
TCComponent[] materialChildren = materialFolder.getRelatedComponents("contents");
|
||||
for (TCComponent tcItem : materialChildren) {
|
||||
if (tcItem.getStringProperty("object_type").equals("VF5ccp")) {
|
||||
TCComponentItem ccpItem = (TCComponentItem) tcItem;
|
||||
TCComponentItemRevision ccpItemRev = ccpItem.getLatestItemRevision();
|
||||
|
||||
revList.add(ccpItemRev);
|
||||
getBcpRevision(revList, view, ccpItem, ccpItemRev);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new CustomException("materialFolder is null ! ");
|
||||
}
|
||||
|
||||
if (porFolder != null) {
|
||||
TCComponent[] porChildren = porFolder.getRelatedComponents("contents");
|
||||
for (TCComponent tcItem : porChildren) {
|
||||
if (tcItem.getStringProperty("object_type").equals("VF5gy")) {
|
||||
TCComponentItem gyItem = (TCComponentItem) tcItem;
|
||||
TCComponentItemRevision gyItemRev = gyItem.getLatestItemRevision();
|
||||
revList.add(gyItemRev);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new CustomException("porFolder is null ! ");
|
||||
}
|
||||
return revList;
|
||||
}
|
||||
|
||||
public void getBcpRevision(List<TCComponentItemRevision> revList, TCComponentBOMWindow view,
|
||||
TCComponentItem ccpItem, TCComponentItemRevision ccpItemRev) throws TCException {
|
||||
TCComponentBOMLine bomLine = view.setWindowTopLine(ccpItem, ccpItemRev, null, null);
|
||||
|
||||
boolean hasChildren = bomLine.hasChildren();
|
||||
if (hasChildren) {
|
||||
AIFComponentContext[] childrena = bomLine.getChildren();
|
||||
for (AIFComponentContext children : childrena) {
|
||||
// 强转为TCComponentBOMLine类型
|
||||
TCComponentItemRevision bcpItemRev = ((TCComponentBOMLine) children.getComponent()).getItemRevision();
|
||||
if (bcpItemRev.getStringProperty("object_type").equals("VF5bcpRevision")) {
|
||||
revList.add(bcpItemRev);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.connor.ferrorTech.metal.changeManagement.createECR;
|
||||
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.border.LineBorder;
|
||||
import javax.swing.table.DefaultTableCellRenderer;
|
||||
import java.awt.*;
|
||||
|
||||
public class CustomTableCellRenderer extends DefaultTableCellRenderer {
|
||||
private final Border noFocusBorder = BorderFactory.createEmptyBorder(1, 1, 1, 1);
|
||||
private final Border focusBorder = new LineBorder(Color.YELLOW, 1);
|
||||
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
|
||||
JComponent c = (JComponent) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
|
||||
if (isSelected) {
|
||||
c.setBorder(focusBorder);
|
||||
} else {
|
||||
c.setBorder(noFocusBorder);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package com.connor.ferrorTech.metal.constant;
|
||||
|
||||
public class ConstantPool {
|
||||
|
||||
public static final String EN_LABEL_UPLOAD_PATH = "Local path";
|
||||
|
||||
public static final String EN_TITLE_UPLOAD_PATH = "Please select the upload path";
|
||||
public static final String EN_TITLE_IMPORT_PATH = "Please select the import path";
|
||||
public static final String EN_TITLE_EXPORT_PATH = "Please select the export path";
|
||||
public static final String EN_TITLE_DOWNLOAD_PATH = "Please select the download path";
|
||||
|
||||
public static final String EN_BUTTON_CONFIRM = "Confirm";
|
||||
public static final String EN_BUTTON_CANCEL = "Cancel";
|
||||
public static final String EN_BUTTON_SEARCH = "Search";
|
||||
public static final String EN_BUTTON_SELECT = "Select";
|
||||
public static final String EN_BUTTON_IMPORT = "Local Import";//本地导入
|
||||
public static final String EN_BUTTON_EXPORT = "Local Export";
|
||||
public static final String EN_BUTTON_CHOOSE = "CHOOSE";
|
||||
public static final String EN_BUTTON_ADD = "Add Rows";
|
||||
public static final String EN_BUTTON_DELETE = "Delete Row";
|
||||
public static final String EN_BUTTON_MOVE_UP = "Move Up";
|
||||
public static final String EN_BUTTON_MOVE_DOWN = "Move Down";
|
||||
|
||||
public static final String EN_MESSAGE_UPLOAD_ERROR = "Please enter or select the file path";
|
||||
public static final String EN_MESSAGE_FILE_ERROR = "Invalid file path, not a directory !";
|
||||
public static final String EN_MESSAGE_EXCEL_ERROR = "Invalid file path, not a directory !";
|
||||
public static final String EN_MESSAGE_MOVE_UP = "Cannot move up, it is already the first line";
|
||||
public static final String EN_MESSAGE_MOVE_DOWN = "Cannot move down, it is already the last line";
|
||||
public static final String EN_MESSAGE_IMPORT = "Please enter or select the file path";
|
||||
public static final String EN_MESSAGE_DELETE = "Please select the row to delete";
|
||||
public static final String EN_MESSAGE_REV_ERROR = "Please select a Revision Item";
|
||||
public static final String EN_MESSAGE_REV_TYPE_ERROR = "Please select the correct version";
|
||||
public static final String EN_MESSAGE_Folder_ERROR = "Please select a file";
|
||||
public static final String EN_MESSAGE_Folder_TYPE_ERROR = "Please select the correct file type";
|
||||
|
||||
|
||||
|
||||
public static final String CH_LABEL_UPLOAD_PATH = "本地上传路径";
|
||||
|
||||
public static final String CH_TITLE_UPLOAD_PATH = "请选择上传路径";
|
||||
public static final String CH_TITLE_IMPORT_PATH = "请选择导入路径";
|
||||
public static final String CH_TITLE_EXPORT_PATH = "请选择导出路径";
|
||||
public static final String CH_TITLE_DOWNLOAD_PATH = "请选择下载路径";
|
||||
|
||||
public static final String CH_BUTTON_CONFIRM = "确定";
|
||||
public static final String CH_BUTTON_CANCEL = "取消";
|
||||
public static final String CH_BUTTON_SEARCH = "搜索";
|
||||
public static final String CH_BUTTON_SELECT = "选择";
|
||||
public static final String CH_BUTTON_IMPORT = "本地导入";
|
||||
public static final String CH_BUTTON_EXPORT = "本地导出";
|
||||
public static final String CH_BUTTON_CHOOSE = "选择";
|
||||
public static final String CH_BUTTON_ADD = "添加行";
|
||||
public static final String CH_BUTTON_DELETE = "删除行";
|
||||
public static final String CH_BUTTON_MOVE_UP = "上移";
|
||||
public static final String CH_BUTTON_MOVE_DOWN = "下移";
|
||||
|
||||
public static final String CH_MESSAGE_UPLOAD_ERROR = "请选择文件上传路径";
|
||||
public static final String CH_MESSAGE_FILE_ERROR = "错误的文件路径,请选择一个目录";
|
||||
public static final String CH_MESSAGE_EXCEL_ERROR = "文件路径无效,不是目录";
|
||||
public static final String CH_MESSAGE_MOVE_UP = "无法向上移动,它已经是第一行了";
|
||||
public static final String CH_MESSAGE_MOVE_DOWN = "无法向下移动,它已经是最后一行了";
|
||||
public static final String CH_MESSAGE_IMPORT = "请输入或选择文件路径";
|
||||
public static final String CH_MESSAGE_DELETE = "请选择要删除的行";
|
||||
public static final String CH_MESSAGE_REV_ERROR = "请选择版本对象";
|
||||
public static final String CH_MESSAGE_REV_TYPE_ERROR = "请选择正确的版本";
|
||||
public static final String CH_MESSAGE_Folder_ERROR = "请选择文件";
|
||||
public static final String CH_MESSAGE_Folder_TYPE_ERROR = "请选择正确的文件类型";
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.connor.ferrorTech.metal.createTechnicalDocuments.AinternalDrawing;
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import com.connor.ferrorTech.metal.createTechnicalDocuments.CommonAction;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
|
||||
|
||||
public class CreateInternalDrawingHandler extends AbstractHandler {
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0){
|
||||
AbstractAIFApplication application =AIFUtility.getCurrentApplication();
|
||||
CommonAction commonAction = new CommonAction(application,"VF5idgx","VF5nbtz","Internal Drawing","-ID");
|
||||
new Thread(commonAction).start();
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.connor.ferrorTech.metal.createTechnicalDocuments.BprocessControl;
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import com.connor.ferrorTech.metal.createTechnicalDocuments.CommonAction;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
|
||||
public class CreateProcessControlHandler extends AbstractHandler {
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) {
|
||||
AbstractAIFApplication application = AIFUtility.getCurrentApplication();
|
||||
CommonAction commonAction = new CommonAction(application, "VF5pcgx", "VF5procctrl","Process Control","-PC");
|
||||
new Thread(commonAction).start();
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,194 @@
|
||||
package com.connor.ferrorTech.metal.createTechnicalDocuments;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.connor.ferrorTech.metal.exception.CustomException;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
|
||||
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponentBOMLine;
|
||||
import com.teamcenter.rac.kernel.TCComponentItem;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemType;
|
||||
import com.teamcenter.rac.kernel.TCException;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
import com.teamcenter.rac.util.MessageBox;
|
||||
|
||||
public class CommonAction implements Runnable {
|
||||
|
||||
private AbstractAIFApplication application;
|
||||
private TCSession tcSession;
|
||||
|
||||
private TCComponentItemRevision[] tarRevs;
|
||||
|
||||
private String revReference;
|
||||
private String itemType;
|
||||
private String itemName;
|
||||
private String ruleName;
|
||||
|
||||
public CommonAction(AbstractAIFApplication application, String revReference, String type, String name,
|
||||
String ruleName) {
|
||||
this.application = application;
|
||||
this.tcSession = (TCSession) application.getSession();
|
||||
this.revReference = revReference;
|
||||
this.itemType = type;
|
||||
this.ruleName = ruleName;
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
boolean revFlag = false;
|
||||
try {
|
||||
revFlag = isCcpRevision();
|
||||
} catch (TCException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (!revFlag) {
|
||||
MessageBox.post("There are unexpected types in the selected version !", "error", MessageBox.ERROR);
|
||||
} else if (tarRevs == null && tarRevs.length == 0) {
|
||||
MessageBox.post("Please select version object !", "error", MessageBox.ERROR);
|
||||
} else {
|
||||
Map<String, String> nullMap = isExistNull();
|
||||
if (nullMap.isEmpty()) {
|
||||
System.out.println("enter createNbtzItem()");
|
||||
createNbtzItem();
|
||||
} else {
|
||||
StringBuffer str = new StringBuffer("");
|
||||
Set<String> keySet = nullMap.keySet();
|
||||
for (String key : keySet) {
|
||||
int count = 0;
|
||||
if (count == 0) {
|
||||
str.append("\n" + key + " | " + nullMap.get(key));
|
||||
} else if (count == keySet.size() - 1) {
|
||||
str.append(key + " | " + nullMap.get(key) + "\n");
|
||||
} else {
|
||||
str.append(key + " | " + nullMap.get(key));
|
||||
}
|
||||
}
|
||||
MessageBox.post("The material code cannot be empty !" + str.toString(), "error", MessageBox.ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isCcpRevision() throws TCException {
|
||||
// TODO Auto-generated method stub
|
||||
InterfaceAIFComponent[] targetComponents = application.getTargetComponents();
|
||||
System.out.println("length: " + targetComponents.length);
|
||||
List<TCComponentItemRevision> tempComponents = new ArrayList<>();
|
||||
for (InterfaceAIFComponent targetComponent : targetComponents) {
|
||||
System.out.println("enter judge");
|
||||
if (targetComponent instanceof TCComponentItemRevision) {
|
||||
TCComponentItemRevision tempComponentRev = (TCComponentItemRevision) targetComponent;
|
||||
if (!tempComponentRev.getStringProperty("object_type").equals("VF5ccpRevision")) {
|
||||
System.out.println("false");
|
||||
return false;
|
||||
} else {
|
||||
System.out.println("true");
|
||||
tempComponents.add(tempComponentRev);
|
||||
}
|
||||
} else if (targetComponent instanceof TCComponentBOMLine) {
|
||||
try {
|
||||
TCComponentItemRevision tempComponentRev = ((TCComponentBOMLine) targetComponent).getItemRevision();
|
||||
if (!tempComponentRev.getStringProperty("object_type").equals("VF5ccpRevision")) {
|
||||
return false;
|
||||
} else {
|
||||
tempComponents.add(tempComponentRev);
|
||||
}
|
||||
} catch (TCException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
System.out.println("tempComponents.size: " + tempComponents.size());
|
||||
tarRevs = tempComponents.toArray(new TCComponentItemRevision[tempComponents.size()]);
|
||||
return true;
|
||||
}
|
||||
|
||||
public Map<String, String> isExistNull() {
|
||||
Map<String, String> errorMap = new HashMap<>();
|
||||
for (InterfaceAIFComponent targetComponent : tarRevs) {
|
||||
TCComponentItemRevision targetRev = (TCComponentItemRevision) targetComponent;
|
||||
try {
|
||||
TCComponent[] referenceValueArray = targetRev.getTCProperty("IMAN_master_form_rev")
|
||||
.getReferenceValueArray();
|
||||
String property = referenceValueArray[0].getStringProperty("vf5wlbm");
|
||||
if (property.isEmpty()) {
|
||||
errorMap.put(targetRev.getStringProperty("item_id"), targetRev.getStringProperty("object_name"));
|
||||
}
|
||||
} catch (TCException e) {
|
||||
// TODO Auto-generated catch block
|
||||
System.out.println("isExistNull is error !");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return errorMap;
|
||||
}
|
||||
|
||||
public void createNbtzItem() {
|
||||
try {
|
||||
System.out.println("tarRevs: "+tarRevs.length);
|
||||
if (tarRevs != null && tarRevs.length > 0) {
|
||||
boolean flag = true;
|
||||
for (TCComponentItemRevision targetRev : tarRevs) {
|
||||
if (judgeIsExist(targetRev)) {
|
||||
TCComponent[] targetRevForm = targetRev.getTCProperty("IMAN_master_form_rev")
|
||||
.getReferenceValueArray();
|
||||
String property = targetRevForm[0].getStringProperty("vf5khth");
|
||||
String pn = targetRevForm[0].getStringProperty("vf5wlbm");
|
||||
|
||||
TCComponentItemType tzType = (TCComponentItemType) tcSession.getTypeComponent(itemType);
|
||||
TCComponentItem tzItem = tzType.create(pn + ruleName, "", itemType, itemName, "", null);
|
||||
if (tzItem != null) {
|
||||
TCComponentItemRevision newTcItemRev = tzItem.getLatestItemRevision();
|
||||
TCComponent[] newTcItemRevForm = newTcItemRev.getTCProperty("IMAN_master_form_rev")
|
||||
.getReferenceValueArray();
|
||||
newTcItemRevForm[0].setStringProperty("vf5khth", property);
|
||||
newTcItemRevForm[0].setStringProperty("vf5pn", pn);
|
||||
|
||||
targetRev.add(revReference, tzItem);
|
||||
} else {
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if(flag) {
|
||||
MessageBox.post("Creation Item Succuessful !", "Info", MessageBox.INFORMATION);
|
||||
}else {
|
||||
MessageBox.post("Creation Item Error !", "Error", MessageBox.ERROR);
|
||||
}
|
||||
} else {
|
||||
MessageBox.post("targetComponents is null !", "Error", MessageBox.ERROR);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean judgeIsExist(TCComponentItemRevision targetRev ) throws TCException {
|
||||
if(targetRev!=null) {
|
||||
TCComponent[] tzReferences = targetRev.getRelatedComponents(revReference);
|
||||
System.out.println("item: " + targetRev.getStringProperty("object_name"));
|
||||
if (tzReferences != null && tzReferences.length > 0) {
|
||||
for (int i = 0; i < tzReferences.length; i++) {
|
||||
if (tzReferences[i].getStringProperty("object_type").equals(itemType)) {
|
||||
System.out.println("it's exist!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}else {
|
||||
throw new CustomException("targetRev is null");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.connor.ferrorTech.metal.createTechnicalDocuments.CredlineDrawing;
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
|
||||
import com.connor.ferrorTech.metal.createTechnicalDocuments.CommonAction;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
|
||||
public class CreateRedlineDrawingHandler extends AbstractHandler {
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
AbstractAIFApplication application = AIFUtility.getCurrentApplication();
|
||||
CommonAction commonAction = new CommonAction(application, "VF5rdgx", "VF5jctz","Redline Drawing","-RD");
|
||||
new Thread(commonAction).start();
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,194 @@
|
||||
package com.connor.ferrorTech.metal.createTechnicalDocuments.DrawMaterialDrawing;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.connor.ferrorTech.metal.exception.CustomException;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
|
||||
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponentBOMLine;
|
||||
import com.teamcenter.rac.kernel.TCComponentItem;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemType;
|
||||
import com.teamcenter.rac.kernel.TCException;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
import com.teamcenter.rac.util.MessageBox;
|
||||
|
||||
public class CreateRawMaterialDrawingAction implements Runnable {
|
||||
|
||||
private AbstractAIFApplication application;
|
||||
private TCSession tcSession;
|
||||
|
||||
private TCComponentItemRevision[] tarRevs;
|
||||
|
||||
private String revReference;
|
||||
private String itemType;
|
||||
private String itemName;
|
||||
private String ruleName;
|
||||
|
||||
public CreateRawMaterialDrawingAction(AbstractAIFApplication application, String revReference, String type, String name,
|
||||
String ruleName) {
|
||||
this.application = application;
|
||||
this.tcSession = (TCSession) application.getSession();
|
||||
this.revReference = revReference;
|
||||
this.itemType = type;
|
||||
this.ruleName = ruleName;
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
boolean revFlag = false;
|
||||
try {
|
||||
revFlag = isCcpRevision();
|
||||
} catch (TCException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (!revFlag) {
|
||||
MessageBox.post("There are unexpected types in the selected version !", "error", MessageBox.ERROR);
|
||||
} else if (tarRevs == null && tarRevs.length == 0) {
|
||||
MessageBox.post("Please select version object !", "error", MessageBox.ERROR);
|
||||
} else {
|
||||
Map<String, String> nullMap = isExistNull();
|
||||
if (nullMap.isEmpty()) {
|
||||
System.out.println("enter createNbtzItem()");
|
||||
createNbtzItem();
|
||||
} else {
|
||||
StringBuffer str = new StringBuffer("");
|
||||
Set<String> keySet = nullMap.keySet();
|
||||
for (String key : keySet) {
|
||||
int count = 0;
|
||||
if (count == 0) {
|
||||
str.append("\n" + key + " | " + nullMap.get(key));
|
||||
} else if (count == keySet.size() - 1) {
|
||||
str.append(key + " | " + nullMap.get(key) + "\n");
|
||||
} else {
|
||||
str.append(key + " | " + nullMap.get(key));
|
||||
}
|
||||
}
|
||||
MessageBox.post("The material code cannot be empty !" + str.toString(), "error", MessageBox.ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isCcpRevision() throws TCException {
|
||||
// TODO Auto-generated method stub
|
||||
InterfaceAIFComponent[] targetComponents = application.getTargetComponents();
|
||||
System.out.println("length: " + targetComponents.length);
|
||||
List<TCComponentItemRevision> tempComponents = new ArrayList<>();
|
||||
for (InterfaceAIFComponent targetComponent : targetComponents) {
|
||||
System.out.println("enter judge");
|
||||
if (targetComponent instanceof TCComponentItemRevision) {
|
||||
TCComponentItemRevision tempComponentRev = (TCComponentItemRevision) targetComponent;
|
||||
if (!tempComponentRev.getStringProperty("object_type").equals("VF5clRevision")) {
|
||||
System.out.println("false");
|
||||
return false;
|
||||
} else {
|
||||
System.out.println("true");
|
||||
tempComponents.add(tempComponentRev);
|
||||
}
|
||||
} else if (targetComponent instanceof TCComponentBOMLine) {
|
||||
try {
|
||||
TCComponentItemRevision tempComponentRev = ((TCComponentBOMLine) targetComponent).getItemRevision();
|
||||
if (!tempComponentRev.getStringProperty("object_type").equals("VF5clRevision")) {
|
||||
return false;
|
||||
} else {
|
||||
tempComponents.add(tempComponentRev);
|
||||
}
|
||||
} catch (TCException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
System.out.println("tempComponents.size: " + tempComponents.size());
|
||||
tarRevs = tempComponents.toArray(new TCComponentItemRevision[tempComponents.size()]);
|
||||
return true;
|
||||
}
|
||||
|
||||
public Map<String, String> isExistNull() {
|
||||
Map<String, String> errorMap = new HashMap<>();
|
||||
for (InterfaceAIFComponent targetComponent : tarRevs) {
|
||||
TCComponentItemRevision targetRev = (TCComponentItemRevision) targetComponent;
|
||||
try {
|
||||
TCComponent[] referenceValueArray = targetRev.getTCProperty("IMAN_master_form_rev")
|
||||
.getReferenceValueArray();
|
||||
String property = referenceValueArray[0].getStringProperty("vf5wlbm");
|
||||
if (property.isEmpty()) {
|
||||
errorMap.put(targetRev.getStringProperty("item_id"), targetRev.getStringProperty("object_name"));
|
||||
}
|
||||
} catch (TCException e) {
|
||||
// TODO Auto-generated catch block
|
||||
System.out.println("isExistNull is error !");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return errorMap;
|
||||
}
|
||||
|
||||
public void createNbtzItem() {
|
||||
try {
|
||||
System.out.println("tarRevs: "+tarRevs.length);
|
||||
if (tarRevs != null && tarRevs.length > 0) {
|
||||
boolean flag = true;
|
||||
for (TCComponentItemRevision targetRev : tarRevs) {
|
||||
if (judgeIsExist(targetRev)) {
|
||||
TCComponent[] targetRevForm = targetRev.getTCProperty("IMAN_master_form_rev")
|
||||
.getReferenceValueArray();
|
||||
String property = targetRevForm[0].getStringProperty("vf5khth");
|
||||
String pn = targetRevForm[0].getStringProperty("vf5wlbm");
|
||||
|
||||
TCComponentItemType tzType = (TCComponentItemType) tcSession.getTypeComponent(itemType);
|
||||
TCComponentItem tzItem = tzType.create(pn + ruleName, "", itemType, itemName, "", null);
|
||||
if (tzItem != null) {
|
||||
TCComponentItemRevision newTcItemRev = tzItem.getLatestItemRevision();
|
||||
TCComponent[] newTcItemRevForm = newTcItemRev.getTCProperty("IMAN_master_form_rev")
|
||||
.getReferenceValueArray();
|
||||
newTcItemRevForm[0].setStringProperty("vf5khth", property);
|
||||
newTcItemRevForm[0].setStringProperty("vf5pn", pn);
|
||||
|
||||
targetRev.add(revReference, tzItem);
|
||||
} else {
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if(flag) {
|
||||
MessageBox.post("Creation Item Succuessful !", "Info", MessageBox.INFORMATION);
|
||||
}else {
|
||||
MessageBox.post("Creation Item Error !", "Error", MessageBox.ERROR);
|
||||
}
|
||||
} else {
|
||||
MessageBox.post("targetComponents is null !", "Error", MessageBox.ERROR);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean judgeIsExist(TCComponentItemRevision targetRev ) throws TCException {
|
||||
if(targetRev!=null) {
|
||||
TCComponent[] tzReferences = targetRev.getRelatedComponents(revReference);
|
||||
System.out.println("item: " + targetRev.getStringProperty("object_name"));
|
||||
if (tzReferences != null && tzReferences.length > 0) {
|
||||
for (int i = 0; i < tzReferences.length; i++) {
|
||||
if (tzReferences[i].getStringProperty("object_type").equals(itemType)) {
|
||||
System.out.println("it's exist!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}else {
|
||||
throw new CustomException("targetRev is null");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.connor.ferrorTech.metal.createTechnicalDocuments.DrawMaterialDrawing;
|
||||
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
|
||||
import com.connor.ferrorTech.metal.createTechnicalDocuments.CommonAction;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
|
||||
public class CreateRawMaterialDrawingHandler extends AbstractHandler {
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
AbstractAIFApplication application = AIFUtility.getCurrentApplication();
|
||||
CreateRawMaterialDrawingAction commonAction = new CreateRawMaterialDrawingAction(application, "VF5rmgx", "VF5ycltz","Raw Material Drawing","-RM");
|
||||
new Thread(commonAction).start();
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,194 @@
|
||||
package com.connor.ferrorTech.metal.createTechnicalDocuments.EsubPartsDrawing;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.connor.ferrorTech.metal.exception.CustomException;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
|
||||
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponentBOMLine;
|
||||
import com.teamcenter.rac.kernel.TCComponentItem;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemType;
|
||||
import com.teamcenter.rac.kernel.TCException;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
import com.teamcenter.rac.util.MessageBox;
|
||||
|
||||
public class CreateSubPartsDrawingAction implements Runnable {
|
||||
|
||||
private AbstractAIFApplication application;
|
||||
private TCSession tcSession;
|
||||
|
||||
private TCComponentItemRevision[] tarRevs;
|
||||
|
||||
private String revReference;
|
||||
private String itemType;
|
||||
private String itemName;
|
||||
private String ruleName;
|
||||
|
||||
public CreateSubPartsDrawingAction(AbstractAIFApplication application, String revReference, String type, String name,
|
||||
String ruleName) {
|
||||
this.application = application;
|
||||
this.tcSession = (TCSession) application.getSession();
|
||||
this.revReference = revReference;
|
||||
this.itemType = type;
|
||||
this.ruleName = ruleName;
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
boolean revFlag = false;
|
||||
try {
|
||||
revFlag = isCcpRevision();
|
||||
} catch (TCException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (!revFlag) {
|
||||
MessageBox.post("There are unexpected types in the selected version !", "error", MessageBox.ERROR);
|
||||
} else if (tarRevs == null && tarRevs.length == 0) {
|
||||
MessageBox.post("Please select version object !", "error", MessageBox.ERROR);
|
||||
} else {
|
||||
Map<String, String> nullMap = isExistNull();
|
||||
if (nullMap.isEmpty()) {
|
||||
System.out.println("enter createNbtzItem()");
|
||||
createNbtzItem();
|
||||
} else {
|
||||
StringBuffer str = new StringBuffer("");
|
||||
Set<String> keySet = nullMap.keySet();
|
||||
for (String key : keySet) {
|
||||
int count = 0;
|
||||
if (count == 0) {
|
||||
str.append("\n" + key + " | " + nullMap.get(key));
|
||||
} else if (count == keySet.size() - 1) {
|
||||
str.append(key + " | " + nullMap.get(key) + "\n");
|
||||
} else {
|
||||
str.append(key + " | " + nullMap.get(key));
|
||||
}
|
||||
}
|
||||
MessageBox.post("The material code cannot be empty !" + str.toString(), "error", MessageBox.ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isCcpRevision() throws TCException {
|
||||
// TODO Auto-generated method stub
|
||||
InterfaceAIFComponent[] targetComponents = application.getTargetComponents();
|
||||
System.out.println("length: " + targetComponents.length);
|
||||
List<TCComponentItemRevision> tempComponents = new ArrayList<>();
|
||||
for (InterfaceAIFComponent targetComponent : targetComponents) {
|
||||
System.out.println("enter judge");
|
||||
if (targetComponent instanceof TCComponentItemRevision) {
|
||||
TCComponentItemRevision tempComponentRev = (TCComponentItemRevision) targetComponent;
|
||||
if (!tempComponentRev.getStringProperty("object_type").equals("VF5bcpRevision")) {
|
||||
System.out.println("false");
|
||||
return false;
|
||||
} else {
|
||||
System.out.println("true");
|
||||
tempComponents.add(tempComponentRev);
|
||||
}
|
||||
} else if (targetComponent instanceof TCComponentBOMLine) {
|
||||
try {
|
||||
TCComponentItemRevision tempComponentRev = ((TCComponentBOMLine) targetComponent).getItemRevision();
|
||||
if (!tempComponentRev.getStringProperty("object_type").equals("VF5bcpRevision")) {
|
||||
return false;
|
||||
} else {
|
||||
tempComponents.add(tempComponentRev);
|
||||
}
|
||||
} catch (TCException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
System.out.println("tempComponents.size: " + tempComponents.size());
|
||||
tarRevs = tempComponents.toArray(new TCComponentItemRevision[tempComponents.size()]);
|
||||
return true;
|
||||
}
|
||||
|
||||
public Map<String, String> isExistNull() {
|
||||
Map<String, String> errorMap = new HashMap<>();
|
||||
for (InterfaceAIFComponent targetComponent : tarRevs) {
|
||||
TCComponentItemRevision targetRev = (TCComponentItemRevision) targetComponent;
|
||||
try {
|
||||
TCComponent[] referenceValueArray = targetRev.getTCProperty("IMAN_master_form_rev")
|
||||
.getReferenceValueArray();
|
||||
String property = referenceValueArray[0].getStringProperty("vf5wlbm");
|
||||
if (property.isEmpty()) {
|
||||
errorMap.put(targetRev.getStringProperty("item_id"), targetRev.getStringProperty("object_name"));
|
||||
}
|
||||
} catch (TCException e) {
|
||||
// TODO Auto-generated catch block
|
||||
System.out.println("isExistNull is error !");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return errorMap;
|
||||
}
|
||||
|
||||
public void createNbtzItem() {
|
||||
try {
|
||||
System.out.println("tarRevs: "+tarRevs.length);
|
||||
if (tarRevs != null && tarRevs.length > 0) {
|
||||
boolean flag = true;
|
||||
for (TCComponentItemRevision targetRev : tarRevs) {
|
||||
if (judgeIsExist(targetRev)) {
|
||||
TCComponent[] targetRevForm = targetRev.getTCProperty("IMAN_master_form_rev")
|
||||
.getReferenceValueArray();
|
||||
String property = targetRevForm[0].getStringProperty("vf5khth");
|
||||
String pn = targetRevForm[0].getStringProperty("vf5wlbm");
|
||||
|
||||
TCComponentItemType tzType = (TCComponentItemType) tcSession.getTypeComponent(itemType);
|
||||
TCComponentItem tzItem = tzType.create(pn + ruleName, "", itemType, itemName, "", null);
|
||||
if (tzItem != null) {
|
||||
TCComponentItemRevision newTcItemRev = tzItem.getLatestItemRevision();
|
||||
TCComponent[] newTcItemRevForm = newTcItemRev.getTCProperty("IMAN_master_form_rev")
|
||||
.getReferenceValueArray();
|
||||
newTcItemRevForm[0].setStringProperty("vf5khth", property);
|
||||
newTcItemRevForm[0].setStringProperty("vf5pn", pn);
|
||||
|
||||
targetRev.add(revReference, tzItem);
|
||||
} else {
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if(flag) {
|
||||
MessageBox.post("Creation Item Succuessful !", "Info", MessageBox.INFORMATION);
|
||||
}else {
|
||||
MessageBox.post("Creation Item Error !", "Error", MessageBox.ERROR);
|
||||
}
|
||||
} else {
|
||||
MessageBox.post("targetComponents is null !", "Error", MessageBox.ERROR);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean judgeIsExist(TCComponentItemRevision targetRev ) throws TCException {
|
||||
if(targetRev!=null) {
|
||||
TCComponent[] tzReferences = targetRev.getRelatedComponents(revReference);
|
||||
System.out.println("item: " + targetRev.getStringProperty("object_name"));
|
||||
if (tzReferences != null && tzReferences.length > 0) {
|
||||
for (int i = 0; i < tzReferences.length; i++) {
|
||||
if (tzReferences[i].getStringProperty("object_type").equals(itemType)) {
|
||||
System.out.println("it's exist!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}else {
|
||||
throw new CustomException("targetRev is null");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.connor.ferrorTech.metal.createTechnicalDocuments.EsubPartsDrawing;
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
|
||||
import com.connor.ferrorTech.metal.createTechnicalDocuments.CommonAction;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
|
||||
public class CreateSubPartsDrawingHandler extends AbstractHandler {
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
AbstractAIFApplication application = AIFUtility.getCurrentApplication();
|
||||
CreateSubPartsDrawingAction commonAction = new CreateSubPartsDrawingAction(application, "VF5spgx", "VF5bcptz","Sub-Parts Drawing","-SP");
|
||||
new Thread(commonAction).start();
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.connor.ferrorTech.metal.createTechnicalDocuments.FsetupSheet;
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
|
||||
import com.connor.ferrorTech.metal.createTechnicalDocuments.CommonAction;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
|
||||
public class CreateSetupSheetHandler extends AbstractHandler {
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
AbstractAIFApplication application = AIFUtility.getCurrentApplication();
|
||||
CommonAction commonAction = new CommonAction(application, "VF5ssgx", "VF5setupsheet","Setup Sheet","-SS");
|
||||
new Thread(commonAction).start();
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.connor.ferrorTech.metal.createTechnicalDocuments.GreworkInstruction;
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
|
||||
public class CreateReworkInstructionHandler extends AbstractHandler {
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
AbstractAIFApplication application = AIFUtility.getCurrentApplication();
|
||||
CreateReworkInstructionAction commonAction = new CreateReworkInstructionAction(application, "VF5rwigx", "VF5rwi","Rework Work Instruction","-RWI-");
|
||||
new Thread(commonAction).start();
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,225 @@
|
||||
package com.connor.ferrorTech.metal.createTechnicalDocuments;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.connor.ferrorTech.metal.exception.CustomException;
|
||||
import com.connor.ferrorTech.metal.util.TcUtil;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
|
||||
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponentBOMLine;
|
||||
import com.teamcenter.rac.kernel.TCComponentBOMWindow;
|
||||
import com.teamcenter.rac.kernel.TCComponentBOMWindowType;
|
||||
import com.teamcenter.rac.kernel.TCComponentForm;
|
||||
import com.teamcenter.rac.kernel.TCComponentItem;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemType;
|
||||
import com.teamcenter.rac.kernel.TCException;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
import com.teamcenter.rac.util.MessageBox;
|
||||
|
||||
/**
|
||||
* used: HncFile || IprocessDrawing || JpreMillDrawing
|
||||
*
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
public class GxTemplateAction implements Runnable {
|
||||
|
||||
private AbstractAIFApplication application;
|
||||
private TCSession tcSession;
|
||||
|
||||
private TCComponentItemRevision[] gyRevs;
|
||||
private TCComponentItemRevision[] gxRevs;
|
||||
|
||||
private String revReference;
|
||||
private String itemType;
|
||||
private String itemName;
|
||||
private String ruleName;
|
||||
|
||||
public GxTemplateAction(AbstractAIFApplication application, String revReference, String type, String name,
|
||||
String ruleName) {
|
||||
this.application = application;
|
||||
this.tcSession = (TCSession) application.getSession();
|
||||
this.revReference = revReference;
|
||||
this.itemType = type;
|
||||
this.itemName = name;
|
||||
this.ruleName = ruleName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
gyRevs = judgeSelectRevision(application);
|
||||
} catch (Exception e1) {
|
||||
// TODO Auto-generated catch block
|
||||
MessageBox.post(e1.getMessage(), "Error", MessageBox.ERROR);
|
||||
}
|
||||
if (gyRevs != null) {
|
||||
Map<String, String> nullMap = null;
|
||||
String[] pnValue = null;
|
||||
try {
|
||||
pnValue = new String[gyRevs.length];
|
||||
nullMap = isExistNull(pnValue);
|
||||
} catch (TCException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (nullMap != null && nullMap.isEmpty()) {
|
||||
createNbtzItem(pnValue);
|
||||
} else {
|
||||
StringBuffer str = new StringBuffer("");
|
||||
Set<String> keySet = nullMap.keySet();
|
||||
for (String key : keySet) {
|
||||
int count = 0;
|
||||
if (count == 0) {
|
||||
str.append("\n" + key + " | " + nullMap.get(key));
|
||||
} else if (count == keySet.size() - 1) {
|
||||
str.append(key + " | " + nullMap.get(key) + "\n");
|
||||
} else {
|
||||
str.append(key + " | " + nullMap.get(key));
|
||||
}
|
||||
}
|
||||
MessageBox.post("The material code cannot be empty !" + str.toString(), "error", MessageBox.ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public TCComponentItemRevision[] judgeSelectRevision(AbstractAIFApplication application) throws Exception {
|
||||
InterfaceAIFComponent[] selectComponents = application.getTargetComponents();
|
||||
List<TCComponentItemRevision> gyRevList = new ArrayList<>();
|
||||
List<TCComponentItemRevision> gxRevList = new ArrayList<>();
|
||||
try {
|
||||
for (InterfaceAIFComponent targetComponent : selectComponents) {
|
||||
TCComponentItemRevision tempComponentRev = null;
|
||||
if (targetComponent instanceof TCComponentItemRevision) {
|
||||
tempComponentRev = (TCComponentItemRevision) targetComponent;
|
||||
} else if (targetComponent instanceof TCComponentBOMLine) {
|
||||
tempComponentRev = ((TCComponentBOMLine) targetComponent).getItemRevision();
|
||||
} else {
|
||||
MessageBox.post(
|
||||
"Please Select Rule Version Object !\n" + targetComponent.getProperty("object_name"),
|
||||
"Error", MessageBox.ERROR);
|
||||
return null;
|
||||
}
|
||||
gxRevList.add(tempComponentRev);
|
||||
TCComponent[] whereUsed = tempComponentRev.whereUsed((short) 0);
|
||||
TCComponentItemRevision gyRev = null;
|
||||
if (whereUsed != null && whereUsed.length > 0) {
|
||||
for (TCComponent tcItem : whereUsed) {
|
||||
System.out.println("tcItem : " + tcItem.getStringProperty("object_name"));
|
||||
System.out.println("tcItem : " + tcItem.getStringProperty("object_type"));
|
||||
if (tcItem.getStringProperty("object_type").equals("VF5gyRevision")) {
|
||||
gyRev = (TCComponentItemRevision) tcItem;
|
||||
gyRevList.add(gyRev);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (gyRev == null) {
|
||||
throw new CustomException(
|
||||
tempComponentRev.getStringProperty("object_name") + " : parent's item is not exist !");
|
||||
}
|
||||
}else {
|
||||
throw new CustomException(
|
||||
tempComponentRev.getStringProperty("object_name") + " : parent's item is not exist !");
|
||||
}
|
||||
}
|
||||
} catch (TCException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
gxRevs = gxRevList.toArray(new TCComponentItemRevision[gxRevList.size()]);
|
||||
return gyRevList.toArray(new TCComponentItemRevision[gyRevList.size()]);
|
||||
}
|
||||
|
||||
public Map<String, String> isExistNull(String pnValue[]) throws TCException {
|
||||
Map<String, String> errorMap = new HashMap<>();
|
||||
for (TCComponentItemRevision gyItemRev : gyRevs) {
|
||||
int count = 0;
|
||||
TCComponentForm formItem = null;
|
||||
TCComponent[] ccpItems = gyItemRev.getTCProperty("IMAN_METarget").getReferenceValueArray();
|
||||
for (TCComponent ccpItem : ccpItems) {
|
||||
String type = ccpItem.getStringProperty("object_type");
|
||||
if (type.equals("VF5ccpRevision") || type.equals("VF5bcpRevision") ) {
|
||||
TCComponent[] referenceValueArray = ccpItem.getTCProperty("IMAN_master_form_rev")
|
||||
.getReferenceValueArray();
|
||||
formItem = (TCComponentForm) referenceValueArray[0];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (formItem != null) {
|
||||
String wlbm = formItem.getStringProperty("vf5wlbm");
|
||||
pnValue[count++] = wlbm;
|
||||
if (wlbm !=null && (wlbm.isEmpty() || wlbm.equals("null"))) {
|
||||
errorMap.put(gyItemRev.getStringProperty("item_id"), gyItemRev.getStringProperty("object_name"));
|
||||
}
|
||||
} else {
|
||||
System.out.println("cannot get form item !");
|
||||
}
|
||||
}
|
||||
return errorMap;
|
||||
}
|
||||
|
||||
public String getBomLineRowNumber(TCComponentItemRevision itemRev) throws TCException {
|
||||
TCComponent[] whereUsed = itemRev.whereUsed((short) 0);
|
||||
String localId = itemRev.getStringProperty("item_id");
|
||||
TCComponentBOMLine bomLine = null;
|
||||
TCComponentBOMWindow view = null;
|
||||
if (whereUsed != null && whereUsed.length > 0) {
|
||||
TCComponentItemRevision itemType = (TCComponentItemRevision) whereUsed[0];
|
||||
TCComponentBOMWindowType winType = (TCComponentBOMWindowType) tcSession.getTypeComponent("BOMWindow");
|
||||
view = winType.create(null);
|
||||
|
||||
bomLine = view.setWindowTopLine(itemType.getItem(), itemType, null, null);
|
||||
} else {
|
||||
MessageBox.post("The current object is not referenced !", "error", MessageBox.ERROR);
|
||||
}
|
||||
|
||||
if (bomLine != null && bomLine.hasChildren()) {
|
||||
AIFComponentContext[] childrena = bomLine.getChildren();
|
||||
for (int i = 0; i < childrena.length; i++) {
|
||||
TCComponentBOMLine childBomLine = (TCComponentBOMLine) childrena[i].getComponent();
|
||||
if (childBomLine.getItemRevision().getStringProperty("item_id").equals(localId)) {
|
||||
return i + 1 + "";
|
||||
}
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public void createNbtzItem(String[] pnValue) {
|
||||
for (TCComponentItemRevision targetRev : gxRevs) {
|
||||
int count = 0;
|
||||
try {
|
||||
TCComponent[] tzReferences = targetRev.getTCProperty(revReference).getReferenceValueArray();
|
||||
boolean flag = true;
|
||||
if (tzReferences != null && tzReferences.length > 0) {
|
||||
for (int i = 0; i < tzReferences.length; i++) {
|
||||
if (tzReferences[i].getStringProperty("object_type").equals(itemType)) {
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (flag) {
|
||||
TCComponentItemType tzType = (TCComponentItemType) tcSession.getTypeComponent(itemType);
|
||||
TCComponentItem tzItem = tzType.create(pnValue[count++] + ruleName, "", itemType, itemName, "",
|
||||
null);
|
||||
if (tzItem != null) {
|
||||
targetRev.add(revReference, tzItem);
|
||||
MessageBox.post("Created Successfully !", "Info", MessageBox.INFORMATION);
|
||||
} else {
|
||||
MessageBox.post("Creation Failed !", "Error", MessageBox.ERROR);
|
||||
}
|
||||
}
|
||||
} catch (TCException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.connor.ferrorTech.metal.createTechnicalDocuments.HncFile;
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
|
||||
import com.connor.ferrorTech.metal.createTechnicalDocuments.GxTemplateAction;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
|
||||
public class CreateNcFileHandler extends AbstractHandler {
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
AbstractAIFApplication application = AIFUtility.getCurrentApplication();
|
||||
GxTemplateAction commonAction = new GxTemplateAction(application, "VF5ncgx", "VF5ncfile","NC File","-NC");
|
||||
new Thread(commonAction).start();
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.connor.ferrorTech.metal.createTechnicalDocuments.IprocessDrawing;
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
|
||||
import com.connor.ferrorTech.metal.createTechnicalDocuments.GxTemplateAction;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
|
||||
public class CreateProcessDrawingHandler extends AbstractHandler {
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
AbstractAIFApplication application = AIFUtility.getCurrentApplication();
|
||||
GxTemplateAction commonAction = new GxTemplateAction(application, "VF5pdgx", "VF5gytz","Process Drawing","-PD");
|
||||
new Thread(commonAction).start();
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.connor.ferrorTech.metal.createTechnicalDocuments.JpreMillDrawing;
|
||||
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
|
||||
import com.connor.ferrorTech.metal.createTechnicalDocuments.GxTemplateAction;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
|
||||
public class CreatePreMillDrawingHandler extends AbstractHandler {
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
AbstractAIFApplication application = AIFUtility.getCurrentApplication();
|
||||
GxTemplateAction commonAction = new GxTemplateAction(application, "VF5pmgx", "VF5yjgtz","Pre-Mill Drawing","-PM");
|
||||
new Thread(commonAction).start();
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,174 @@
|
||||
package com.connor.ferrorTech.metal.createTechnicalDocuments.JrjitFixtureDrawing;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
import org.apache.commons.compress.harmony.unpack200.bytecode.forms.LocalForm;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.connor.ferrorTech.metal.constant.ConstantPool;
|
||||
import com.connor.ferrorTech.metal.util.TcUtil;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aif.AbstractAIFDialog;
|
||||
import com.teamcenter.rac.aif.kernel.AbstractAIFSession;
|
||||
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponentFolder;
|
||||
import com.teamcenter.rac.kernel.TCComponentItem;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemType;
|
||||
import com.teamcenter.rac.kernel.TCComponentType;
|
||||
import com.teamcenter.rac.kernel.TCException;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
import com.teamcenter.rac.util.MessageBox;
|
||||
|
||||
public class CreateJitFixtureDialog extends AbstractAIFDialog {
|
||||
private AbstractAIFApplication application;
|
||||
|
||||
private String title;
|
||||
private int[] sizes;
|
||||
private JLabel[] jLabels;
|
||||
private JComponent[] jComponents;
|
||||
|
||||
private JButton okButton;
|
||||
private JButton celButton;
|
||||
|
||||
private Map<String, Map<String, String>> lovMap;
|
||||
|
||||
public CreateJitFixtureDialog(AbstractAIFApplication application, String title, Object... args) {
|
||||
super(true);
|
||||
int count = 0;
|
||||
this.title = title;
|
||||
this.application = application;
|
||||
this.sizes = (int[]) args[count++];
|
||||
this.jLabels = (JLabel[]) args[count++];
|
||||
this.jComponents = (JComponent[]) args[count++];
|
||||
this.lovMap = (Map<String, Map<String, String>>) args[count];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
initUI();
|
||||
}
|
||||
|
||||
public void initUI() {
|
||||
this.setTitle(title);
|
||||
this.setSize(sizes[0], sizes[1]);
|
||||
initializationComponent();
|
||||
JScrollPane centerPanel = getCenterPanel();
|
||||
JPanel bottomPanel = getBottomPanel();
|
||||
|
||||
this.getContentPane().add(centerPanel, BorderLayout.CENTER);
|
||||
this.getContentPane().add(bottomPanel, BorderLayout.SOUTH);
|
||||
this.setLocationRelativeTo(null);
|
||||
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
this.setVisible(true);
|
||||
}
|
||||
|
||||
private void initializationComponent() {
|
||||
okButton = new JButton(ConstantPool.EN_BUTTON_CONFIRM);
|
||||
celButton = new JButton(ConstantPool.EN_BUTTON_CANCEL);
|
||||
}
|
||||
|
||||
private JScrollPane getCenterPanel() {
|
||||
JPanel centerPanel = new JPanel(new GridBagLayout());
|
||||
GridBagConstraints customLayout = new GridBagConstraints();
|
||||
for (int i = 0; i < jLabels.length; i++) {
|
||||
customLayout.insets = new Insets(5, 30, 5, 20);
|
||||
customLayout.gridx = 0;
|
||||
customLayout.weightx = 0;
|
||||
customLayout.anchor = GridBagConstraints.LINE_START;
|
||||
jLabels[i].setFont(new Font("΢ÈíÑźÚ", Font.BOLD, 13));
|
||||
centerPanel.add(jLabels[i], customLayout);
|
||||
|
||||
customLayout.insets = new Insets(5, 3, 5, 30);
|
||||
customLayout.gridx = 1;
|
||||
customLayout.weightx = 0;
|
||||
customLayout.fill = GridBagConstraints.HORIZONTAL;
|
||||
JComponent jComponent = jComponents[i];
|
||||
jComponent.setFont(new Font("΢ÈíÑźÚ", Font.BOLD, 15));
|
||||
centerPanel.add(jComponent, customLayout);
|
||||
}
|
||||
return new JScrollPane(centerPanel);
|
||||
}
|
||||
|
||||
private JPanel getBottomPanel() {
|
||||
// TODO Auto-generated method stub
|
||||
JPanel bottomPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 70, 10));
|
||||
bottomPanel.setBorder(BorderFactory.createEmptyBorder(sizes[2], 0, sizes[3], 0));
|
||||
bottomPanel.add(this.okButton);
|
||||
bottomPanel.add(this.celButton);
|
||||
okButton.addActionListener(e -> {
|
||||
boolean confirmed = confirmFunction();
|
||||
if (confirmed) {
|
||||
this.dispose();
|
||||
}
|
||||
});
|
||||
celButton.addActionListener(e -> {
|
||||
this.dispose();
|
||||
});
|
||||
return bottomPanel;
|
||||
}
|
||||
|
||||
public boolean confirmFunction() {
|
||||
String[] inputValue = new String[jComponents.length];
|
||||
for (int i = 0; i < jComponents.length; i++) {
|
||||
if (jComponents[i] instanceof JTextField) {
|
||||
inputValue[i] = ((JTextField) jComponents[i]).getText();
|
||||
} else if (jComponents[i] instanceof JComboBox) {
|
||||
JComboBox comboBox = (JComboBox) jComponents[i];
|
||||
Object selectedItem = comboBox.getSelectedItem();
|
||||
inputValue[i] = (selectedItem != null) ? selectedItem.toString() : "";
|
||||
}
|
||||
}
|
||||
try {
|
||||
createItem(inputValue);
|
||||
} catch (TCException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void createItem(String[] inputValue) throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
InterfaceAIFComponent[] queryList = TcUtil.queryList(application, "MU_Find Jit_Fixture Flow",
|
||||
new String[] { "ID" }, new String[] { "MJF*" });
|
||||
int maxFlowNo = 0;
|
||||
for (InterfaceAIFComponent tcItem : queryList) {
|
||||
String itemId = tcItem.getProperty("item_id");
|
||||
String[] split = itemId.split("-");
|
||||
if (split != null && split.length > 2) {
|
||||
int localFlowNo = Integer.parseInt(split[2]);
|
||||
if (localFlowNo >= maxFlowNo) {
|
||||
maxFlowNo = localFlowNo;
|
||||
}
|
||||
}
|
||||
}
|
||||
String strMaxFlowNo = (maxFlowNo + 1) + "";
|
||||
int addZero = 5 - strMaxFlowNo.length();
|
||||
for (int i = 0; i < addZero; i++) {
|
||||
strMaxFlowNo = "0" + strMaxFlowNo;
|
||||
}
|
||||
|
||||
String realProcess = lovMap.get("VF5gxlxlov").get(inputValue[0]);
|
||||
String name = inputValue[inputValue.length - 1].isEmpty() ? "Jit-Fixture Drawing"
|
||||
: inputValue[inputValue.length - 1];
|
||||
String itemId = "MJF-" + realProcess + inputValue[1] + "-" + strMaxFlowNo + "-"
|
||||
+ inputValue[inputValue.length - 2];
|
||||
|
||||
System.out.println("itemId : "+itemId);
|
||||
|
||||
TCComponentItem newComponent = (TCComponentItem) TcUtil.createComponent(application,
|
||||
new String[] { itemId, "", name }, "VF5gzjtz", "Item");
|
||||
if (newComponent != null) {
|
||||
MessageBox.post("Created Successfully !", "Info", MessageBox.INFORMATION);
|
||||
} else {
|
||||
MessageBox.post("Created Failed !", "Error", MessageBox.ERROR);
|
||||
}
|
||||
((TCComponentFolder) application.getTargetComponent()).add("contents", newComponent);
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package com.connor.ferrorTech.metal.createTechnicalDocuments.JrjitFixtureDrawing;
|
||||
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
|
||||
import com.connor.ferrorTech.metal.util.SwingUtil;
|
||||
import com.connor.ferrorTech.metal.util.TcUtil;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class CreateJitFixtureHandler extends AbstractHandler {
|
||||
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
AbstractAIFApplication application = AIFUtility.getCurrentApplication();
|
||||
boolean judgeSingleSelectComponent = TcUtil.judgeSingleSelectComponent(application, new String[]{"Folder","VF5xmwjj"}, "Folder");
|
||||
if(judgeSingleSelectComponent) {
|
||||
String[] enLabelName = new String[]{
|
||||
"Process", "Process Sequence", "Property","Name"
|
||||
};
|
||||
JLabel[] jLabels = new JLabel[enLabelName.length];
|
||||
JComponent[] jComponents = new JComponent[enLabelName.length];
|
||||
Map<Integer, String[]> map = new HashMap<>();
|
||||
|
||||
Map<String, Map<String, String>> lovMap = new HashMap<String,Map<String, String>>();
|
||||
map.put(0, SwingUtil.getKeyValue("VF5gxlxlov", lovMap));
|
||||
map.put(1, TcUtil.getPreferenceValues((TCSession)application.getSession(), "VF5ProcessSequence"));
|
||||
|
||||
for (int i = 0; i < enLabelName.length; i++) {
|
||||
if (map.containsKey(i)) {
|
||||
jComponents[i] = new JComboBox<>(map.get(i));
|
||||
} else {
|
||||
jComponents[i] = new JTextField(14);
|
||||
}
|
||||
jLabels[i] = new JLabel(enLabelName[i]);
|
||||
}
|
||||
|
||||
CreateJitFixtureDialog dialog = new CreateJitFixtureDialog(application,"create Jit-Fixture Drawing", new int[]{430, 400,5,5},jLabels, jComponents,lovMap);
|
||||
new Thread(dialog).start();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,237 @@
|
||||
package com.connor.ferrorTech.metal.createTechnicalDocuments.KtoolingList;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.connor.ferrorTech.metal.exception.CustomException;
|
||||
import com.connor.ferrorTech.metal.util.SwingUtil;
|
||||
import com.connor.ferrorTech.metal.util.TcUtil;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
|
||||
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponentBOMLine;
|
||||
import com.teamcenter.rac.kernel.TCComponentBOMWindow;
|
||||
import com.teamcenter.rac.kernel.TCComponentBOMWindowType;
|
||||
import com.teamcenter.rac.kernel.TCComponentForm;
|
||||
import com.teamcenter.rac.kernel.TCComponentItem;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemType;
|
||||
import com.teamcenter.rac.kernel.TCException;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
import com.teamcenter.rac.util.MessageBox;
|
||||
|
||||
public class CreateToolingListAction implements Runnable {
|
||||
|
||||
private AbstractAIFApplication application;
|
||||
private TCSession tcSession;
|
||||
|
||||
private InterfaceAIFComponent[] targetComponents;
|
||||
|
||||
private String revReference;
|
||||
private String itemType;
|
||||
private String itemName;
|
||||
private String ruleName;
|
||||
|
||||
private String[][] idList;
|
||||
|
||||
public CreateToolingListAction(AbstractAIFApplication application, String revReference, String type, String name,
|
||||
String ruleName) {
|
||||
this.application = application;
|
||||
this.tcSession = (TCSession) application.getSession();
|
||||
this.revReference = revReference;
|
||||
this.itemType = type;
|
||||
this.itemName = name;
|
||||
this.ruleName = ruleName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
targetComponents = judgeSelectRevision(application);
|
||||
} catch (Exception e1) {
|
||||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
}
|
||||
if (targetComponents != null) {
|
||||
Map<String, String> nullMap = null;
|
||||
try {
|
||||
nullMap = isExistNull();
|
||||
} catch (TCException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (nullMap != null && nullMap.isEmpty()) {
|
||||
createNbtzItem();
|
||||
} else {
|
||||
StringBuffer str = new StringBuffer("");
|
||||
Set<String> keySet = nullMap.keySet();
|
||||
for (String key : keySet) {
|
||||
int count = 0;
|
||||
if (count == 0) {
|
||||
str.append("\n" + key + " | " + nullMap.get(key));
|
||||
} else if (count == keySet.size() - 1) {
|
||||
str.append(key + " | " + nullMap.get(key) + "\n");
|
||||
} else {
|
||||
str.append(key + " | " + nullMap.get(key));
|
||||
}
|
||||
}
|
||||
MessageBox.post("The material code cannot be empty !" + str.toString(), "error", MessageBox.ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public TCComponentItemRevision[] judgeSelectRevision(AbstractAIFApplication application) throws Exception {
|
||||
InterfaceAIFComponent[] selectComponents = application.getTargetComponents();
|
||||
List<TCComponentItemRevision> gxRevList = new ArrayList<>();
|
||||
try {
|
||||
for (InterfaceAIFComponent targetComponent : selectComponents) {
|
||||
TCComponentItemRevision tempComponentRev = null;
|
||||
if (targetComponent instanceof TCComponentItemRevision) {
|
||||
tempComponentRev = (TCComponentItemRevision) targetComponent;
|
||||
} else if (targetComponent instanceof TCComponentBOMLine) {
|
||||
tempComponentRev = ((TCComponentBOMLine) targetComponent).getItemRevision();
|
||||
}
|
||||
|
||||
if (tempComponentRev != null
|
||||
&& tempComponentRev.getStringProperty("object_type").equals("VF5gxRevision")) {
|
||||
gxRevList.add(tempComponentRev);
|
||||
} else {
|
||||
MessageBox.post(
|
||||
"Please Select Rule Version Object !\n" + targetComponent.getProperty("object_name"),
|
||||
"Error", MessageBox.ERROR);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
} catch (TCException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return gxRevList.toArray(new TCComponentItemRevision[gxRevList.size()]);
|
||||
}
|
||||
|
||||
public Map<String, String> isExistNull() throws TCException {
|
||||
Map<String, String> errorMap = new HashMap<>();
|
||||
Map<String, Map<String, String>> lovMap = new HashMap<String, Map<String, String>>();
|
||||
SwingUtil.getKeyValue("VF5gxlxlov", lovMap);
|
||||
idList = new String[targetComponents.length][3];
|
||||
for (InterfaceAIFComponent targetComponent : targetComponents) {
|
||||
int count = 0;
|
||||
TCComponentItemRevision targetRev = (TCComponentItemRevision) targetComponent;
|
||||
TCComponent ccpForm = null;
|
||||
String pnValue = "";
|
||||
String processValue = "";
|
||||
String sequenceValue = getBomLineRowNumber((TCComponentItemRevision) targetRev);
|
||||
TCComponentItemRevision gyRev = null;
|
||||
TCComponent[] whereUsed = targetRev.whereUsed((short) 0);
|
||||
if (whereUsed != null && whereUsed.length > 0) {
|
||||
for (TCComponent tcItem : whereUsed) {
|
||||
if (tcItem.getStringProperty("object_type").equals("VF5gyRevision")) {
|
||||
gyRev = (TCComponentItemRevision) tcItem;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
MessageBox.post("The current object is not used !", "error", MessageBox.ERROR);
|
||||
}
|
||||
if (gyRev != null) {
|
||||
TCComponent[] ccpItems = gyRev.getTCProperty("IMAN_METarget").getReferenceValueArray();
|
||||
String type ="";
|
||||
for (TCComponent ccpItem : ccpItems) {
|
||||
type = ccpItem.getStringProperty("object_type");
|
||||
if (type.equals("VF5ccpRevision") || type.equals("VF5bcpRevision")) {
|
||||
ccpForm = ccpItem.getRelatedComponent("IMAN_master_form_rev");
|
||||
pnValue = ccpForm.getStringProperty("vf5wlbm");
|
||||
|
||||
TCComponent gxForm = targetRev.getRelatedComponent("IMAN_master_form_rev");
|
||||
String gxlx = gxForm.getStringProperty("vf5gxlx");
|
||||
System.out.println("gxForm(vf5gxlx) : " + gxlx);
|
||||
processValue = gxlx;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new CustomException(
|
||||
targetRev.getStringProperty("object_name") + " : parent's item is not exist !");
|
||||
}
|
||||
|
||||
System.out.println(
|
||||
"pnValue:" + pnValue + " | processValue:" + processValue + " | sequenceValue:" + sequenceValue);
|
||||
idList[count][0] = pnValue;
|
||||
idList[count][1] = processValue;
|
||||
idList[count++][2] = sequenceValue;
|
||||
|
||||
if (ccpForm != null) {
|
||||
String property = ccpForm.getStringProperty("vf5wlbm");
|
||||
if (property.isEmpty()) {
|
||||
errorMap.put(targetRev.getStringProperty("item_id"), targetRev.getStringProperty("object_name"));
|
||||
}
|
||||
} else {
|
||||
System.out.println("cannot get form item !");
|
||||
}
|
||||
}
|
||||
return errorMap;
|
||||
}
|
||||
|
||||
public String getBomLineRowNumber(TCComponentItemRevision itemRev) throws TCException {
|
||||
TCComponent[] whereUsed = itemRev.whereUsed((short) 0);
|
||||
String localId = itemRev.getStringProperty("item_id");
|
||||
TCComponentBOMLine bomLine = null;
|
||||
TCComponentBOMWindow view = null;
|
||||
if (whereUsed != null && whereUsed.length > 0) {
|
||||
TCComponentItemRevision tempItemRev = (TCComponentItemRevision) whereUsed[0];
|
||||
TCComponentBOMWindowType winType = (TCComponentBOMWindowType) tcSession.getTypeComponent("BOMWindow");
|
||||
view = winType.create(null);
|
||||
|
||||
bomLine = view.setWindowTopLine(tempItemRev.getItem(), tempItemRev, null, null);
|
||||
} else {
|
||||
MessageBox.post("The current object is not used !", "error", MessageBox.ERROR);
|
||||
}
|
||||
|
||||
if (bomLine != null && bomLine.hasChildren()) {
|
||||
AIFComponentContext[] childrena = bomLine.getChildren();
|
||||
for (int i = 0; i < childrena.length; i++) {
|
||||
TCComponentBOMLine childBomLine = (TCComponentBOMLine) childrena[i].getComponent();
|
||||
if (childBomLine.getItemRevision().getStringProperty("item_id").equals(localId)) {
|
||||
return i + 1 + "";
|
||||
}
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public void createNbtzItem() {
|
||||
for (InterfaceAIFComponent targetComponent : targetComponents) {
|
||||
int count = 0;
|
||||
TCComponentItemRevision targetRev = (TCComponentItemRevision) targetComponent;
|
||||
try {
|
||||
TCComponent[] tzReferences = targetRev.getTCProperty(revReference).getReferenceValueArray();
|
||||
boolean flag = true;
|
||||
if (tzReferences != null && tzReferences.length > 0) {
|
||||
for (int i = 0; i < tzReferences.length; i++) {
|
||||
if (tzReferences[i].getStringProperty("object_type").equals(itemType)) {
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (flag) {
|
||||
TCComponentItemType tzType = (TCComponentItemType) tcSession.getTypeComponent(itemType);
|
||||
TCComponentItem tzItem = tzType.create(
|
||||
idList[count][0] + ruleName + idList[count][1] + idList[count++][2], "", itemType, itemName,
|
||||
"", null);
|
||||
if (tzItem != null) {
|
||||
targetRev.add(revReference, tzItem);
|
||||
MessageBox.post("Created Successfully !", "Info", MessageBox.INFORMATION);
|
||||
} else {
|
||||
MessageBox.post("Creation Failed !", "Error", MessageBox.ERROR);
|
||||
}
|
||||
}
|
||||
} catch (TCException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.connor.ferrorTech.metal.createTechnicalDocuments.KtoolingList;
|
||||
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
|
||||
public class CreateToolingListHandler extends AbstractHandler {
|
||||
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
AbstractAIFApplication application = AIFUtility.getCurrentApplication();
|
||||
CreateToolingListAction commonAction = new CreateToolingListAction(application, "VF5tlgx", "VF5tl","ToolList","-TL-");
|
||||
new Thread(commonAction).start();
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.connor.ferrorTech.metal.createTechnicalDocuments.LTinspectionPlan;
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
|
||||
import com.connor.ferrorTech.metal.createTechnicalDocuments.GxTemplateAction;
|
||||
import com.connor.ferrorTech.metal.createTechnicalDocuments.KtoolingList.CreateToolingListAction;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
|
||||
public class InspectionPlanHandler extends AbstractHandler {
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
AbstractAIFApplication application = AIFUtility.getCurrentApplication();
|
||||
GxTemplateAction commonAction = new GxTemplateAction(application, "VF5ipgx", "VF5ip","In-Process Inspection Plan","-IP");
|
||||
new Thread(commonAction).start();
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.connor.ferrorTech.metal.createTechnicalDocuments.LstandardInstruction;
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
import com.connor.ferrorTech.metal.createTechnicalDocuments.KtoolingList.CreateToolingListAction;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
|
||||
public class CreateStandardInstructionHandler extends AbstractHandler {
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
AbstractAIFApplication application = AIFUtility.getCurrentApplication();
|
||||
CreateToolingListAction commonAction = new CreateToolingListAction(
|
||||
application, "VF5swigx", "VF5swi","Standard Work Instruction","-SWI-");
|
||||
new Thread(commonAction).start();
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,326 @@
|
||||
package com.connor.ferrorTech.metal.createTechnicalDocuments.OuploadDocuments;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dialog;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.filechooser.FileNameExtensionFilter;
|
||||
|
||||
import com.connor.ferrorTech.metal.constant.ConstantPool;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aif.AbstractAIFDialog;
|
||||
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponentDataset;
|
||||
import com.teamcenter.rac.kernel.TCComponentDatasetType;
|
||||
import com.teamcenter.rac.kernel.TCComponentItem;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||
import com.teamcenter.rac.kernel.TCException;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
import com.teamcenter.rac.util.MessageBox;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class UploadDocumentsDialog extends AbstractAIFDialog {
|
||||
|
||||
private AbstractAIFApplication application;
|
||||
private TCSession tcSession;
|
||||
|
||||
private JLabel selectUploadLabel;
|
||||
private JComponent uploadInput;
|
||||
|
||||
private JButton importButton;
|
||||
private JButton okButton;
|
||||
private JButton celButton;
|
||||
|
||||
private TCComponentDatasetType pdfType;
|
||||
private TCComponentDatasetType dwgType;
|
||||
private TCComponentDatasetType docType;
|
||||
private TCComponentDatasetType docxType;
|
||||
private TCComponentDatasetType xlsType;
|
||||
private TCComponentDatasetType xlsxType;
|
||||
private TCComponentDatasetType defaultType;
|
||||
|
||||
public UploadDocumentsDialog(AbstractAIFApplication application) {
|
||||
super(true);
|
||||
this.application = application;
|
||||
this.tcSession = (TCSession) this.application.getSession();
|
||||
}
|
||||
|
||||
public void initializationComponent() {
|
||||
selectUploadLabel = new JLabel(ConstantPool.EN_LABEL_UPLOAD_PATH);
|
||||
uploadInput = new JTextField(14);
|
||||
|
||||
importButton = new JButton(ConstantPool.EN_BUTTON_SELECT);
|
||||
okButton = new JButton(ConstantPool.EN_BUTTON_CONFIRM);
|
||||
celButton = new JButton(ConstantPool.EN_BUTTON_CANCEL);
|
||||
|
||||
SwingUtilities.getWindowAncestor(importButton);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
pdfType = (TCComponentDatasetType) tcSession.getTypeComponent("PDF");
|
||||
dwgType = (TCComponentDatasetType) tcSession.getTypeComponent("VF5CAD");
|
||||
docType = (TCComponentDatasetType) tcSession.getTypeComponent("MSWord");
|
||||
docxType = (TCComponentDatasetType) tcSession.getTypeComponent("MSWordX");
|
||||
xlsType = (TCComponentDatasetType) tcSession.getTypeComponent("MSExcel");
|
||||
xlsxType = (TCComponentDatasetType) tcSession.getTypeComponent("MSExcelX");
|
||||
defaultType = (TCComponentDatasetType) tcSession.getTypeComponent("Dataset");
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
initUi();
|
||||
}
|
||||
|
||||
/**
|
||||
* ³õʼ»¯½çÃæ
|
||||
*/
|
||||
public void initUi() {
|
||||
initializationComponent();
|
||||
this.setTitle(ConstantPool.EN_TITLE_UPLOAD_PATH);
|
||||
|
||||
this.setLayout(null);
|
||||
|
||||
selectUploadLabel.setBounds(30, 40, 80, 25);
|
||||
this.add(selectUploadLabel);
|
||||
|
||||
uploadInput.setBounds(110, 40, 150, 25);
|
||||
this.add(uploadInput);
|
||||
|
||||
importButton.setBounds(280, 40, 90, 25);
|
||||
|
||||
importButton.addActionListener(e -> {
|
||||
JFileChooser fileChooser = new JFileChooser();
|
||||
fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
|
||||
fileChooser.setMultiSelectionEnabled(false);
|
||||
FileNameExtensionFilter filter = new FileNameExtensionFilter("CSV Files", "csv");
|
||||
fileChooser.setFileFilter(filter);
|
||||
|
||||
int result = fileChooser.showOpenDialog(this);
|
||||
if (result == JFileChooser.APPROVE_OPTION) {
|
||||
((JTextField) uploadInput).setText(fileChooser.getSelectedFile().getAbsolutePath());
|
||||
}
|
||||
});
|
||||
this.add(importButton, BorderLayout.EAST);
|
||||
|
||||
okButton.setBounds(80, 90, 100, 25);
|
||||
celButton.setBounds(200, 90, 100, 25);
|
||||
|
||||
okButton.addActionListener(e -> {
|
||||
String path = ((JTextField) uploadInput).getText();
|
||||
if (path.isEmpty()) {
|
||||
JOptionPane.showMessageDialog(this, ConstantPool.EN_MESSAGE_UPLOAD_ERROR);
|
||||
} else {
|
||||
File file = new File(path);
|
||||
if (!file.exists() || !file.isDirectory()) {
|
||||
JOptionPane.showMessageDialog(this, ConstantPool.EN_MESSAGE_FILE_ERROR);
|
||||
} else {
|
||||
this.dispose();
|
||||
uploadDrawings(file);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
celButton.addActionListener(e -> {
|
||||
this.setVisible(false);
|
||||
this.disposeDialog();
|
||||
});
|
||||
this.add(okButton);
|
||||
this.add(celButton);
|
||||
this.pack();
|
||||
this.setSize(410, 190);
|
||||
this.setLocationRelativeTo((Dialog) SwingUtilities.getWindowAncestor(importButton));
|
||||
this.setVisible(true);
|
||||
}
|
||||
|
||||
private void uploadDrawings(File file) {
|
||||
List<File> localFiles = getFilesInDirectory(file.getAbsolutePath());
|
||||
|
||||
// for (File localFile : localFiles) {
|
||||
// System.out.println("Found file: " + localFile.getAbsolutePath());
|
||||
// }
|
||||
try {
|
||||
addDataSet(localFiles);
|
||||
} catch (TCException e) {
|
||||
// TODO Auto-generated catch block
|
||||
System.out.println("123");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean createDataSet(TCComponentItemRevision rev, File localFile) throws TCException {
|
||||
String fileName = localFile.getName();
|
||||
String[] split = fileName.split("\\.");
|
||||
System.out.println("ÀàÐÍ: " + split[1]);
|
||||
String type = "";
|
||||
String tool = "";
|
||||
TCComponentDatasetType tempType = null;
|
||||
if (split != null && split.length == 2) {
|
||||
switch (split[1].toLowerCase()) {
|
||||
case "pdf": {
|
||||
type = "PDF";
|
||||
tool = "PDF_Reference";
|
||||
tempType = pdfType;
|
||||
break;
|
||||
}
|
||||
case "dwg": {
|
||||
type = "VF5CAD";
|
||||
tool = "VF5dwg";
|
||||
tempType = dwgType;
|
||||
break;
|
||||
}
|
||||
case "doc": {
|
||||
type = "MSWord";
|
||||
tool = "word";
|
||||
tempType = docType;
|
||||
break;
|
||||
}
|
||||
case "docx": {
|
||||
type = "MSWordX";
|
||||
tool = "word";
|
||||
tempType = docxType;
|
||||
break;
|
||||
}
|
||||
case "xls": {
|
||||
type = "MSExcel";
|
||||
tool = "excel";
|
||||
tempType = xlsType;
|
||||
break;
|
||||
}
|
||||
case "xlsx": {
|
||||
type = "MSExcelX";
|
||||
tool = "excel";
|
||||
tempType = xlsxType;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
type = "CAEAnalysisDS";
|
||||
tool = "CAEAnaysisData";
|
||||
tempType = defaultType;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
TCComponentDataset tempData = tempType.create(fileName, "", type);
|
||||
try {
|
||||
tempData.setFiles(new String[] { localFile.getAbsolutePath() }, new String[] { tool });
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
return false;
|
||||
}
|
||||
if (tempData != null) {
|
||||
rev.add("IMAN_specification", tempData);
|
||||
return true;
|
||||
}
|
||||
|
||||
} else {
|
||||
System.out.println("Folder Name Is Error !");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void addDataSet(List<File> localFiles) throws TCException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
int successfulCount = 0;
|
||||
int failedCount = 0;
|
||||
int notFoundCount = 0;
|
||||
|
||||
// StringBuffer successfulData = new StringBuffer("");
|
||||
StringBuffer failedData = new StringBuffer("");
|
||||
StringBuffer notFoundData = new StringBuffer("");
|
||||
for (File localFile : localFiles) {
|
||||
String fileName = localFile.getName();
|
||||
String queryValue = fileName.substring(0,
|
||||
fileName.lastIndexOf(".") == -1 ? fileName.length() : fileName.lastIndexOf("."));
|
||||
System.out.println("fileName : " + fileName);
|
||||
System.out.println("queryValue : " + queryValue);
|
||||
InterfaceAIFComponent[] resultComponents = queryItem(queryValue);
|
||||
if (resultComponents != null && resultComponents.length > 0) {
|
||||
TCComponentItemRevision queryRev = null;
|
||||
if (resultComponents[0] instanceof TCComponentItem) {
|
||||
queryRev = ((TCComponentItem) resultComponents[0]).getLatestItemRevision();
|
||||
} else if (resultComponents[0] instanceof TCComponentItemRevision) {
|
||||
queryRev = (TCComponentItemRevision) resultComponents[0];
|
||||
}
|
||||
|
||||
if (resultComponents[0] != null) {
|
||||
if (createDataSet(queryRev, localFile)) {
|
||||
// successfulData.append(fileName);
|
||||
// successfulData.append(" ");
|
||||
successfulCount++;
|
||||
} else {
|
||||
failedData.append(fileName);
|
||||
failedData.append(" ");
|
||||
failedCount++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
notFoundData.append(fileName);
|
||||
notFoundData.append(" ");
|
||||
notFoundCount++;
|
||||
}
|
||||
}
|
||||
StringBuffer resultData = new StringBuffer("");
|
||||
resultData.append("Successful: ");
|
||||
resultData.append(successfulCount);
|
||||
resultData.append("\n");
|
||||
|
||||
resultData.append("Failed: ");
|
||||
resultData.append(failedCount);
|
||||
resultData.append(" ->");
|
||||
resultData.append(failedData);
|
||||
resultData.append("\n");
|
||||
|
||||
resultData.append("Not Found Rev: ");
|
||||
resultData.append(notFoundCount);
|
||||
resultData.append(" ->");
|
||||
resultData.append(notFoundData);
|
||||
resultData.append("\n");
|
||||
|
||||
MessageBox.post(resultData.toString(), "Info", MessageBox.INFORMATION);
|
||||
}
|
||||
|
||||
public InterfaceAIFComponent[] queryItem(String itemId) {
|
||||
try {
|
||||
return tcSession.search("MU_Find ItemRevision", new String[] { "ID" }, new String[] { itemId });
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<File> getFilesInDirectory(String directoryPath) {
|
||||
List<File> filesList = new ArrayList<>();
|
||||
|
||||
File directory = new File(directoryPath);
|
||||
|
||||
if (!directory.exists() || !directory.isDirectory()) {
|
||||
System.out.println("The specified path is not a valid directory: " + directoryPath);
|
||||
return filesList;
|
||||
}
|
||||
|
||||
File[] filesAndDirs = directory.listFiles();
|
||||
|
||||
if (filesAndDirs != null) {
|
||||
for (File file : filesAndDirs) {
|
||||
if (file.isFile()) {
|
||||
filesList.add(file);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
System.out.println("Failed to list files in the directory: " + directoryPath);
|
||||
}
|
||||
|
||||
return filesList;
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.connor.ferrorTech.metal.createTechnicalDocuments.OuploadDocuments;
|
||||
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
|
||||
import com.connor.ferrorTech.metal.util.TcUtil;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
|
||||
public class UploadDocumentsHandler extends AbstractHandler {
|
||||
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
AbstractAIFApplication application = AIFUtility.getCurrentApplication();
|
||||
boolean judgeSingleSelectComponent = TcUtil.judgeSingleSelectComponent(application, new String[]{"VF5NPI"}, "Folder");
|
||||
if(judgeSingleSelectComponent) {
|
||||
UploadDocumentsDialog dialog = new UploadDocumentsDialog(application);
|
||||
|
||||
new Thread(dialog).start();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,254 @@
|
||||
package com.connor.ferrorTech.metal.createTechnicalDocuments.PapprovalofTecDocuments;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.TableModelEvent;
|
||||
import javax.swing.table.DefaultTableCellRenderer;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import javax.swing.table.TableCellRenderer;
|
||||
import javax.swing.table.TableColumnModel;
|
||||
|
||||
import com.connor.ferrorTech.metal.constant.ConstantPool;
|
||||
import com.connor.ferrorTech.metal.util.TcUtil;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aif.kernel.AbstractAIFSession;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
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.workflow.commands.newprocess.NewProcessCommand;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class ApprovalofDocumentsDialog extends JFrame implements Runnable {
|
||||
|
||||
private final String title;
|
||||
|
||||
private JButton okButton;
|
||||
private JButton cancelButton;
|
||||
private JCheckBox allCheck;
|
||||
|
||||
private String[] columnNames;
|
||||
private Object[][] data;
|
||||
private JTable table;
|
||||
private AbstractAIFApplication application;
|
||||
|
||||
public ApprovalofDocumentsDialog(AbstractAIFApplication application ,String title, Object... args) {
|
||||
int count = 0;
|
||||
this.title = title;
|
||||
this.application = application;
|
||||
columnNames = (String[]) args[count++];
|
||||
data = (Object[][]) args[count];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
initUI();
|
||||
}
|
||||
|
||||
public void initializationButton() {
|
||||
okButton = new JButton(ConstantPool.EN_BUTTON_CONFIRM);
|
||||
okButton.addActionListener(e -> {
|
||||
try {
|
||||
doTask();
|
||||
} catch (TCException e1) {
|
||||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
}
|
||||
});
|
||||
cancelButton = new JButton(ConstantPool.EN_BUTTON_CANCEL);
|
||||
cancelButton.addActionListener(e -> {
|
||||
this.dispose();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void initUI() {
|
||||
// 设置窗口居中
|
||||
this.setTitle(title);
|
||||
// this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
this.setSize(600, 400); // 设置窗口大小
|
||||
this.setLayout(new BorderLayout()); // 设置布局
|
||||
this.setLocationRelativeTo(null);
|
||||
|
||||
initializationButton();
|
||||
|
||||
JPanel topPanel = createTopPanel();
|
||||
JPanel centerPanel = createCenterPanel();
|
||||
JPanel bottomPanel = createBottomPanel();
|
||||
|
||||
this.add(topPanel, BorderLayout.NORTH);
|
||||
this.add(centerPanel, BorderLayout.CENTER);
|
||||
this.add(bottomPanel, BorderLayout.SOUTH);
|
||||
|
||||
this.setVisible(true);
|
||||
}
|
||||
|
||||
private JPanel createTopPanel() {
|
||||
JPanel topPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 0));
|
||||
topPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||
allCheck = new JCheckBox("AllSelect");
|
||||
allCheck.addActionListener(e -> {
|
||||
if (allCheck.isSelected()) {
|
||||
for (int i = 0; i < table.getRowCount(); i++) {
|
||||
table.setValueAt(true, i, columnNames.length - 2);
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < table.getRowCount(); i++) {
|
||||
table.setValueAt(false, i, columnNames.length - 2);
|
||||
}
|
||||
}
|
||||
});
|
||||
topPanel.add(allCheck);
|
||||
|
||||
return topPanel;
|
||||
}
|
||||
|
||||
public JPanel createCenterPanel() {
|
||||
JPanel centerPanel = new JPanel(new BorderLayout(10, 10));
|
||||
// centerPanel.setBorder(BorderFactory.createTitledBorder(childTitle));
|
||||
centerPanel.setPreferredSize(new Dimension(400, 200));
|
||||
|
||||
DefaultTableModel model = new DefaultTableModel(data, columnNames) {
|
||||
@Override
|
||||
public boolean isCellEditable(int row, int column) {
|
||||
return column != -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getColumnClass(int columnIndex) {
|
||||
if (columnIndex == columnNames.length - 1) {
|
||||
return Boolean.class;
|
||||
}
|
||||
return String.class;
|
||||
}
|
||||
};
|
||||
table = new JTable(model);
|
||||
table.setRowHeight(18);
|
||||
table.getTableHeader().setReorderingAllowed(false);
|
||||
table.setAutoCreateRowSorter(true);
|
||||
|
||||
TableColumnModel columnModel = table.getColumnModel();
|
||||
table.setRowHeight(20);
|
||||
|
||||
table.removeColumn(columnModel.getColumn(columnModel.getColumnCount() - 2));
|
||||
|
||||
DefaultTableCellRenderer centerRenderer = new DefaultTableCellRenderer() {
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
|
||||
boolean hasFocus, int row, int column) {
|
||||
Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
|
||||
((JLabel) c).setHorizontalAlignment(SwingConstants.CENTER);
|
||||
return c;
|
||||
}
|
||||
};
|
||||
|
||||
TableCellRenderer selectRenderer = (JTable table, Object value, boolean isSelected, boolean hasFocus, int row,
|
||||
int column) -> {
|
||||
JCheckBox checkBox = new JCheckBox();
|
||||
|
||||
if (value instanceof Boolean) {
|
||||
checkBox.setSelected((Boolean) value);
|
||||
} else if (value instanceof String) {
|
||||
checkBox.setSelected(Boolean.parseBoolean((String) value));
|
||||
} else {
|
||||
checkBox.setSelected(false);
|
||||
}
|
||||
|
||||
checkBox.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
return checkBox;
|
||||
};
|
||||
|
||||
for (int i = 0; i < columnModel.getColumnCount(); i++) {
|
||||
columnModel.getColumn(i).setCellRenderer(centerRenderer);
|
||||
}
|
||||
columnModel.getColumn(columnNames.length - 2).setCellRenderer(selectRenderer);
|
||||
|
||||
table.getModel().addTableModelListener(e -> {
|
||||
if (e.getType() == TableModelEvent.UPDATE) {
|
||||
int column = e.getColumn();
|
||||
if (column == columnNames.length - 2) {
|
||||
boolean allSelected = true;
|
||||
for (int i = 0; i < table.getRowCount(); i++) {
|
||||
boolean selected = (boolean) table.getValueAt(i, column);
|
||||
if (!selected) {
|
||||
allSelected = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
allCheck.setSelected(allSelected);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
JScrollPane scrollPane = new JScrollPane(table);
|
||||
scrollPane.setPreferredSize(new Dimension(400, 150));
|
||||
centerPanel.add(scrollPane, BorderLayout.CENTER);
|
||||
return centerPanel;
|
||||
}
|
||||
|
||||
public JPanel createBottomPanel() {
|
||||
// 创建底部面板,包含按钮
|
||||
JPanel bottomPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 60, 10));
|
||||
bottomPanel.add(okButton);
|
||||
bottomPanel.add(cancelButton);
|
||||
return bottomPanel;
|
||||
}
|
||||
|
||||
public void doTask() throws TCException {
|
||||
int rowCount = table.getRowCount();
|
||||
DefaultTableModel model = (DefaultTableModel) table.getModel();
|
||||
|
||||
int selectedRowCount = 0;
|
||||
for (int i = 0; i < rowCount; i++) {
|
||||
Object value = model.getValueAt(table.convertRowIndexToModel(i), columnNames.length - 1);
|
||||
boolean isSelected = false;
|
||||
if (value instanceof Boolean) {
|
||||
isSelected = (Boolean) value;
|
||||
} else if (value instanceof String) {
|
||||
isSelected = Boolean.parseBoolean((String) value);
|
||||
}
|
||||
if (isSelected) {
|
||||
selectedRowCount++;
|
||||
}
|
||||
}
|
||||
|
||||
TCSession session = (TCSession) application.getSession();
|
||||
String[][] selectedData = new String[selectedRowCount][model.getColumnCount()];
|
||||
List<TCComponent> list = new ArrayList<>();
|
||||
int index = 0;
|
||||
for (int i = 0; i < rowCount; i++) {
|
||||
int modelIndex = table.convertRowIndexToModel(i);
|
||||
boolean isSelected = (Boolean) model.getValueAt(modelIndex, columnNames.length - 1);
|
||||
if (isSelected) {
|
||||
String[] rowData = new String[model.getColumnCount()];
|
||||
for (int j = 0; j < model.getColumnCount(); j++) {
|
||||
Object value = model.getValueAt(modelIndex, j);
|
||||
if (value instanceof String) {
|
||||
rowData[j] = (String) value;
|
||||
} else if (value instanceof Boolean) {
|
||||
rowData[j] = value.toString();
|
||||
} else {
|
||||
rowData[j] = value == null ? "" : value.toString();
|
||||
}
|
||||
}
|
||||
selectedData[index++] = rowData;
|
||||
System.out.println("Selected Row Data: " + Arrays.toString(rowData));
|
||||
list.add((TCComponent) session.stringToComponent(rowData[rowData.length - 2]));
|
||||
}
|
||||
}
|
||||
|
||||
TCComponent[] tcRev = list.toArray(new TCComponent[list.size()]);
|
||||
// TcUtil.CreateProcess(session, tcRev, TcUtil.getPreferenceValue(session, "VF5JSWJSPLC"));
|
||||
if (selectedData.length == 0) {
|
||||
System.out.println("No rows selected");
|
||||
}
|
||||
NewProcessCommand cmd = new NewProcessCommand(AIFUtility.getActiveDesktop(), application, tcRev);
|
||||
cmd.executeModeless();
|
||||
this.dispose();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.connor.ferrorTech.metal.exception;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class CustomException extends RuntimeException {
|
||||
|
||||
public CustomException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,839 @@
|
||||
package com.connor.ferrorTech.metal.importMaterial;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Frame;
|
||||
import java.awt.Label;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Base64;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JProgressBar;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aif.AbstractAIFDialog;
|
||||
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
|
||||
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
|
||||
import com.teamcenter.rac.kernel.TCComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponentBOMLine;
|
||||
import com.teamcenter.rac.kernel.TCComponentBOMWindow;
|
||||
import com.teamcenter.rac.kernel.TCComponentBOMWindowType;
|
||||
import com.teamcenter.rac.kernel.TCComponentFolder;
|
||||
import com.teamcenter.rac.kernel.TCComponentItem;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemType;
|
||||
import com.teamcenter.rac.kernel.TCException;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
import com.teamcenter.rac.kernel.TCTypeService;
|
||||
import com.teamcenter.rac.util.MessageBox;
|
||||
import com.teamcenter.rac.util.Registry;
|
||||
|
||||
public class ImportMaterialDialog extends AbstractAIFDialog {
|
||||
|
||||
Registry reg = Registry.getRegistry(this);
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private AbstractAIFUIApplication application;
|
||||
private TCSession session;
|
||||
private String url;
|
||||
private String sapCheck;
|
||||
private String errorInfo;
|
||||
|
||||
private JPanel contentPane;
|
||||
private JTextField textField;
|
||||
private File[] selectedFile;
|
||||
private TCComponent target;
|
||||
|
||||
private Map<String, TCComponent> wlbmMap = new HashMap<>();
|
||||
private Map<String, TCComponent> gxwlbmMap = new HashMap<>();
|
||||
private Map<String, TCComponentItem> newObjectMap = new HashMap<>();
|
||||
private Map<String, String> topMap = new HashMap<>();
|
||||
private Map<String, String> cjCodeMap = new HashMap<>();
|
||||
private Map<String, List<String>> excelData = new HashMap<>();
|
||||
|
||||
public ImportMaterialDialog(AbstractAIFApplication application, TCComponent target) {
|
||||
super();
|
||||
this.application = (AbstractAIFUIApplication) application;
|
||||
this.session = (TCSession) application.getSession();
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
initUI();
|
||||
|
||||
}
|
||||
|
||||
public void initUI() {
|
||||
setTitle(reg.getString("ImportMaterialDialog.0")); //$NON-NLS-1$
|
||||
setResizable(true);
|
||||
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
setBounds(100, 100, 500, 120);
|
||||
contentPane = new JPanel();
|
||||
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
|
||||
setContentPane(contentPane);
|
||||
contentPane.setLayout(null);
|
||||
|
||||
JLabel lblNewLabel = new JLabel(reg.getString("ImportMaterialDialog.1")); //$NON-NLS-1$
|
||||
lblNewLabel.setBounds(10, 10, 150, 15);
|
||||
contentPane.add(lblNewLabel);
|
||||
|
||||
textField = new JTextField();
|
||||
textField.setBounds(160, 7, 180, 21);
|
||||
contentPane.add(textField);
|
||||
textField.setColumns(10);
|
||||
|
||||
JButton btnNewButton = new JButton(reg.getString("ImportMaterialDialog.2"));
|
||||
btnNewButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
// 新建一个文件选择器
|
||||
JFileChooser jFileChooser = new JFileChooser();
|
||||
jFileChooser.setMultiSelectionEnabled(true);
|
||||
// 弹出文件选择框
|
||||
int showOpenDialog = jFileChooser.showOpenDialog(null);
|
||||
// 如果文件被选中
|
||||
if (showOpenDialog == jFileChooser.APPROVE_OPTION) {
|
||||
|
||||
selectedFile = jFileChooser.getSelectedFiles();
|
||||
String fileName = "";
|
||||
for (File file : selectedFile) {
|
||||
fileName += file.getName() + ";";
|
||||
}
|
||||
textField.setText(fileName);
|
||||
}
|
||||
}
|
||||
});
|
||||
btnNewButton.setBounds(360, 6, 100, 23);
|
||||
contentPane.add(btnNewButton);
|
||||
|
||||
JButton btnNewButton_1 = new JButton(reg.getString("ImportMaterialDialog.8")); //$NON-NLS-1$
|
||||
btnNewButton_1.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
dispose();
|
||||
}
|
||||
});
|
||||
btnNewButton_1.setBounds(250, 38, 100, 21);
|
||||
contentPane.add(btnNewButton_1);
|
||||
|
||||
JButton btnNewButton_1_1 = new JButton(reg.getString("ImportMaterialDialog.3")); //$NON-NLS-1$
|
||||
btnNewButton_1_1.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
dispose();
|
||||
WaitingDialog dia = new WaitingDialog(application.getDesktop(), "INFOMATION",
|
||||
reg.getString("ImportMaterialDialog.10")); //$NON-NLS-1$
|
||||
dia.setVisible(true);
|
||||
if (target != null) {
|
||||
if (selectedFile.length > 0) {
|
||||
// 获取首选项SAP_url的值
|
||||
String[] sapUrls = session.getPreferenceService().getStringValues("SAP_url");
|
||||
if (sapUrls != null) {
|
||||
// 获取sap的路径
|
||||
url = sapUrls[0];
|
||||
// 获取接口验证
|
||||
sapCheck = session.getPreferenceService().getStringValue("SAP_check");
|
||||
if (sapCheck != null) {
|
||||
boolean comfireFlag = comfire(selectedFile[0]);
|
||||
dia.setVisible(false);
|
||||
if (comfireFlag) {
|
||||
MessageBox.post(reg.getString("ImportMaterialDialog.11"),
|
||||
reg.getString("ImportMaterialHandler.0"), MessageBox.INFORMATION);
|
||||
} else {
|
||||
MessageBox.post(reg.getString("ImportMaterialDialog.12"),
|
||||
reg.getString("ImportMaterialHandler.0"), MessageBox.INFORMATION);
|
||||
}
|
||||
} else {
|
||||
dia.setVisible(false);
|
||||
MessageBox.post(reg.getString("ImportMaterialDialog.5"),
|
||||
reg.getString("ImportMaterialHandler.0"), MessageBox.INFORMATION);
|
||||
}
|
||||
} else {
|
||||
dia.setVisible(false);
|
||||
MessageBox.post(reg.getString("ImportMaterialDialog.4"),
|
||||
reg.getString("ImportMaterialHandler.0"), MessageBox.INFORMATION);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dia.setVisible(false);
|
||||
MessageBox.post(reg.getString("ImportMaterialDialog.4"), reg.getString("ImportMaterialHandler.0"),
|
||||
MessageBox.INFORMATION);
|
||||
}
|
||||
}
|
||||
});
|
||||
btnNewButton_1_1.setBounds(100, 38, 100, 21);
|
||||
contentPane.add(btnNewButton_1_1);
|
||||
|
||||
// 居中打开
|
||||
setLocationRelativeTo(null);
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
private boolean comfire(File file) {
|
||||
// 读取上传文件
|
||||
excelData = readExcelData(file);
|
||||
if (excelData != null && excelData.size() > 0) {
|
||||
// 通过sap接口获取物料信息
|
||||
Map<String, MaterialPropertyBean> materialInfoBySap = materialInfoBySap(excelData);
|
||||
|
||||
Map<String, Map<String, String>> materialBOMMap = materialBOMNum(excelData);
|
||||
if (materialInfoBySap != null && materialInfoBySap.size() > 0) {
|
||||
try {
|
||||
// 查询物料是否存在
|
||||
queryMaterial(excelData, materialInfoBySap);
|
||||
System.out.println("BOM个数:" + materialBOMMap.size());
|
||||
boolean flag = false;
|
||||
// 搭建BOM
|
||||
for (String str : materialBOMMap.keySet()) {
|
||||
System.out.println("BOM层级:" + str);
|
||||
if (createMaterialBOM(materialBOMMap.get(str), excelData, str)) {
|
||||
flag = true;
|
||||
} else {
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
findFolder(target, excelData);
|
||||
return flag;
|
||||
} catch (Exception e1) {
|
||||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
int length = errorInfo.length();
|
||||
if (length > 0) {
|
||||
String str = errorInfo.substring(0, length - 1);
|
||||
MessageBox.post(
|
||||
reg.getString("ImportMaterialDialog.13") + str + reg.getString("ImportMaterialDialog.14"),
|
||||
reg.getString("ImportMaterialHandler.0"), MessageBox.INFORMATION);
|
||||
errorInfo = "";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 需要搭建的BOM个数
|
||||
*
|
||||
* @param excelData
|
||||
*/
|
||||
private Map<String, Map<String, String>> materialBOMNum(Map<String, List<String>> excelData) {
|
||||
Map<String, Map<String, String>> bomMap = new HashMap<>();
|
||||
Map<String, String> bomChildrenMap = new HashMap<>();
|
||||
for (String key : excelData.keySet()) {
|
||||
// 获取层级号
|
||||
String cjh = excelData.get(key).get(0);
|
||||
// 根据逗号分割
|
||||
String[] split = cjh.split("\\.");
|
||||
if (split.length > 1) {
|
||||
if (bomMap.containsKey(split[0])) {
|
||||
Map<String, String> map = bomMap.get(split[0]);
|
||||
map.put(cjh, excelData.get(key).get(1));
|
||||
}
|
||||
} else {
|
||||
bomChildrenMap.put(cjh, excelData.get(key).get(1));
|
||||
if (split.length == 1) {
|
||||
bomMap.put(cjh, bomChildrenMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
return bomMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 搭建BOM
|
||||
*
|
||||
* @param excelData
|
||||
* @throws TCException
|
||||
*/
|
||||
private boolean createMaterialBOM(Map<String, String> data, Map<String, List<String>> excelData, String code)
|
||||
throws TCException {
|
||||
boolean flag = true;
|
||||
TCTypeService service = session.getTypeService();
|
||||
TCComponentBOMWindowType winType = (TCComponentBOMWindowType) service.getTypeComponent("BOMWindow");
|
||||
TCComponentBOMWindow win = winType.create(null);
|
||||
|
||||
System.out.println("bom编码:" + code);
|
||||
String[] split = code.split("\\.");
|
||||
if (!code.contains(".")) {
|
||||
String materialCode = cjCodeMap.get(code);
|
||||
System.out.println("物料编码:" + materialCode);
|
||||
if (gxwlbmMap.containsKey(materialCode)) {
|
||||
TCComponent component = gxwlbmMap.get(materialCode);
|
||||
try {
|
||||
TCComponentItemRevision itemRevision = (TCComponentItemRevision) component;
|
||||
// 创建BOM视图
|
||||
TCComponentBOMLine topLine = win.setWindowTopLine(itemRevision.getItem(), itemRevision, null, null);
|
||||
// 获取子层
|
||||
AIFComponentContext[] children = topLine.getChildren();
|
||||
System.out.println("子层数量:" + children.length);
|
||||
if (children.length > 0) {
|
||||
for (AIFComponentContext child : children) {
|
||||
topLine.remove("", (TCComponent) child.getComponent());
|
||||
}
|
||||
}
|
||||
// 再次搭建BOM
|
||||
for (String code2 : data.keySet()) {
|
||||
String[] split2 = code2.split("\\.");
|
||||
System.out.println("父层编码:" + code);
|
||||
System.out.println("子层编码:" + code2);
|
||||
String childrenStr = code + ".";
|
||||
System.out.println("子层:" + childrenStr);
|
||||
if (code2.contains(childrenStr)) {
|
||||
if (split2.length == (split.length + 1) && code2.startsWith(childrenStr)) {
|
||||
flag = createMaterialBOMLine(data, excelData, topLine, code2);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (TCException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
} else if (newObjectMap.containsKey(materialCode)) {
|
||||
TCComponentItem item = newObjectMap.get(materialCode);
|
||||
try {
|
||||
// 创建BOM视图
|
||||
TCComponentBOMLine topLine = win.setWindowTopLine(item, item.getLatestItemRevision(), null, null);
|
||||
// 搭建BOM
|
||||
for (String code2 : data.keySet()) {
|
||||
String[] split2 = code2.split("\\.");
|
||||
String childrenStr = code + ".";
|
||||
if (code2.contains(childrenStr)) {
|
||||
if (split2.length == (split.length + 1) && code2.startsWith(childrenStr)) {
|
||||
flag = createMaterialBOMLine(data, excelData, topLine, code2);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (TCException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
win.save();// 会触发保存后操作
|
||||
win.refresh();
|
||||
win.close();
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 搭建子层
|
||||
*
|
||||
* @param data
|
||||
* @param excelData
|
||||
* @param topLine
|
||||
* @param num
|
||||
* @param str
|
||||
* @throws TCException
|
||||
*/
|
||||
private boolean createMaterialBOMLine(Map<String, String> data, Map<String, List<String>> excelData,
|
||||
TCComponentBOMLine topLine, String str) throws TCException {
|
||||
String code = str;
|
||||
String[] split = code.split("\\.");
|
||||
if (code.equals(str)) {
|
||||
String materialCode = cjCodeMap.get(code);
|
||||
String vf5jbyl = "";
|
||||
String vf5sl = "";
|
||||
for (String str2 : excelData.keySet()) {
|
||||
String num2 = excelData.get(str2).get(0);
|
||||
if (num2.equals(code)) {
|
||||
vf5jbyl = excelData.get(str2).get(6);
|
||||
vf5sl = excelData.get(str2).get(7);
|
||||
}
|
||||
}
|
||||
TCComponentItem item = null;
|
||||
if (gxwlbmMap.containsKey(materialCode)) {
|
||||
TCComponent component = gxwlbmMap.get(materialCode);
|
||||
item = ((TCComponentItemRevision) component).getItem();
|
||||
} else if (newObjectMap.containsKey(materialCode)) {
|
||||
item = newObjectMap.get(materialCode);
|
||||
}
|
||||
try {
|
||||
if (topLine != null) {
|
||||
System.out.println("创建子层item:" + item.getStringProperty("object_name"));
|
||||
TCComponentBOMLine wuLiaoChildLine = topLine.add(item, item.getLatestItemRevision(), null, false,
|
||||
"");
|
||||
// 获取子层
|
||||
AIFComponentContext[] children = wuLiaoChildLine.getChildren();
|
||||
if (children.length > 0) {
|
||||
for (AIFComponentContext child : children) {
|
||||
topLine.remove("", (TCComponent) child.getComponent());
|
||||
}
|
||||
}
|
||||
wuLiaoChildLine.setProperty("VF5jbsl", vf5jbyl);
|
||||
wuLiaoChildLine.setProperty("VF5sl", vf5sl);
|
||||
// 搭建BOM
|
||||
for (String code2 : data.keySet()) {
|
||||
String[] split2 = code2.split("\\.");
|
||||
String childrenStr = code + ".";
|
||||
if (code2.contains(childrenStr)) {
|
||||
if (split2.length == (split.length + 1) && code2.startsWith(childrenStr)) {
|
||||
createMaterialBOMLine(data, excelData, wuLiaoChildLine, code2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (TCException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取上传的excel文件
|
||||
*
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
private Map<String, List<String>> readExcelData(File file) {
|
||||
Map<String, List<String>> tableDataMap = new HashMap<String, List<String>>();
|
||||
try (FileInputStream fileInputStream = new FileInputStream(selectedFile[0]);
|
||||
Workbook workbook = new XSSFWorkbook(fileInputStream)) {
|
||||
|
||||
Sheet sheet = workbook.getSheetAt(0); // 读取第一个工作表
|
||||
|
||||
// 获取数据行
|
||||
int lastRowNum = sheet.getLastRowNum();
|
||||
int firstRowNum = sheet.getFirstRowNum();
|
||||
int num = lastRowNum - firstRowNum;
|
||||
System.out.println("行数据量:" + num);
|
||||
int key = 0;
|
||||
if (num >= 6) {
|
||||
for (int i = 5; i <= num; i++) {
|
||||
Row row = sheet.getRow(i);
|
||||
// 判断行是否为空
|
||||
if (!isRowEmpty(row)) {
|
||||
List<String> rowList = new ArrayList<String>();
|
||||
if (sheet.getRow(i) != null) {
|
||||
// 获取单元格个数
|
||||
int lastCellNum = sheet.getRow(i).getLastCellNum();
|
||||
for (int j = 0; j < lastCellNum; j++) {
|
||||
Cell cell = sheet.getRow(i).getCell(j);
|
||||
String value = "";
|
||||
if (cell != null) {
|
||||
// 根据不同数据类型,以字符串形式输出数据
|
||||
switch (cell.getCellType()) {
|
||||
case STRING:
|
||||
value = cell.getStringCellValue() != null ? cell.getStringCellValue() : "";
|
||||
break;
|
||||
case NUMERIC:
|
||||
value = String.valueOf(cell.getNumericCellValue()) != null
|
||||
? String.valueOf(cell.getNumericCellValue())
|
||||
: "";
|
||||
if (value.endsWith(".0")) {
|
||||
value = value.substring(0, value.lastIndexOf("."));
|
||||
}
|
||||
break;
|
||||
case BOOLEAN:
|
||||
value = String.valueOf(cell.getBooleanCellValue()) != null
|
||||
? String.valueOf(cell.getBooleanCellValue())
|
||||
: "";
|
||||
break;
|
||||
case FORMULA:
|
||||
value = String.valueOf(cell.getCellFormula()) != null
|
||||
? String.valueOf(cell.getCellFormula())
|
||||
: "";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (value != null || value != "") {
|
||||
if (value.contains(",")) {
|
||||
value = value.replace(",", ";");
|
||||
}
|
||||
}
|
||||
rowList.add(value);
|
||||
}
|
||||
}
|
||||
System.out.println("表格行数据:" + rowList);
|
||||
if (rowList.get(0) == null || rowList.get(0) == "" || rowList.get(1) == null
|
||||
|| rowList.get(1) == "") {
|
||||
MessageBox.post(reg.getString("ImportMaterialDialog.7"),
|
||||
reg.getString("ImportMaterialHandler.0"), MessageBox.INFORMATION);
|
||||
return null;
|
||||
}
|
||||
tableDataMap.put(String.valueOf(key), rowList);
|
||||
key++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return tableDataMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断行是否为空
|
||||
*
|
||||
* @param row
|
||||
* @return
|
||||
*/
|
||||
private boolean isRowEmpty(Row row) {
|
||||
if (row == null) {
|
||||
return true;
|
||||
}
|
||||
for (int c = 0; c < row.getLastCellNum(); c++) {
|
||||
if (row.getCell(c) != null && row.getCell(c).toString().trim().length() > 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取产品文件夹并将顶层物料对象放置相应的位置
|
||||
*
|
||||
* @param excelData
|
||||
* @throws Exception
|
||||
*/
|
||||
private void findFolder(TCComponent target, Map<String, List<String>> excelData) throws Exception {
|
||||
TCComponentFolder newStuffFolder = session.getUser().getNewStuffFolder();
|
||||
// 获取选中文件夹下的子文件夹
|
||||
TCComponent[] relatedFolders = target.getRelatedComponents("contents");
|
||||
if (relatedFolders.length > 0) {
|
||||
Map<String, TCComponent> folders = new HashMap<>();
|
||||
for (int i = 0; i < relatedFolders.length; i++) {
|
||||
String name = relatedFolders[i].getStringProperty("object_name");
|
||||
System.out.println("name:" + name);
|
||||
folders.put(name, relatedFolders[i]);
|
||||
}
|
||||
for (String key : topMap.keySet()) {
|
||||
String name = topMap.get(key);
|
||||
if (folders.containsKey(name)) {
|
||||
TCComponent component = folders.get(name);
|
||||
TCComponent[] relatedComponents = component.getRelatedComponents("contents");
|
||||
TCComponent comp = gxwlbmMap.get(cjCodeMap.get(key));
|
||||
for (TCComponent com : relatedComponents) {
|
||||
String objectName = com.getStringProperty("object_name");
|
||||
if (objectName.equals("MATERIAL AND BOM")) {
|
||||
TCComponent[] relatedComponents2 = com.getRelatedComponents("contents");
|
||||
List<String> ids = new ArrayList<String>();
|
||||
for (TCComponent com2 : relatedComponents2) {
|
||||
ids.add(com2.getStringProperty("item_id"));
|
||||
}
|
||||
if (newObjectMap.containsKey(cjCodeMap.get(key))) {
|
||||
String id = newObjectMap.get(cjCodeMap.get(key)).getStringProperty("item_id");
|
||||
if (!ids.contains(id)) {
|
||||
com.add("contents", newObjectMap.get(cjCodeMap.get(key)));
|
||||
}
|
||||
} else if (gxwlbmMap.containsKey(cjCodeMap.get(key))) {
|
||||
String id = (((TCComponentItemRevision) comp)).getStringProperty("item_id");
|
||||
if (!ids.contains(id)) {
|
||||
com.add("contents", ((TCComponentItemRevision) comp).getItem());
|
||||
}
|
||||
} else if (wlbmMap.containsKey(cjCodeMap.get(key))) {
|
||||
String id = (((TCComponentItemRevision) comp).getStringProperty("item_id"));
|
||||
if (!ids.contains(id)) {
|
||||
com.add("contents", ((TCComponentItemRevision) comp).getItem());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
TCComponent[] relatedComponents = newStuffFolder.getRelatedComponents("contents");
|
||||
List<String> ids = new ArrayList<String>();
|
||||
for (TCComponent com2 : relatedComponents) {
|
||||
ids.add(com2.getStringProperty("item_id"));
|
||||
}
|
||||
if (newObjectMap.containsKey(cjCodeMap.get(key))) {
|
||||
String id = newObjectMap.get(cjCodeMap.get(key)).getStringProperty("item_id");
|
||||
if (!ids.contains(id)) {
|
||||
newStuffFolder.add("contents", newObjectMap.get(cjCodeMap.get(key)));
|
||||
}
|
||||
} else if (gxwlbmMap.containsKey(cjCodeMap.get(key))) {
|
||||
String id = gxwlbmMap.get(cjCodeMap.get(key)).getStringProperty("item_id");
|
||||
if (!ids.contains(id)) {
|
||||
newStuffFolder.add("contents",
|
||||
((TCComponentItemRevision) gxwlbmMap.get(cjCodeMap.get(key))).getItem());
|
||||
}
|
||||
} else if (wlbmMap.containsKey(cjCodeMap.get(key))) {
|
||||
String id = gxwlbmMap.get(cjCodeMap.get(key)).getStringProperty("item_id");
|
||||
if (!ids.contains(id)) {
|
||||
newStuffFolder.add("contents",
|
||||
((TCComponentItemRevision) gxwlbmMap.get(cjCodeMap.get(key))).getItem());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过SAP接口获取物料信息
|
||||
*/
|
||||
private Map<String, MaterialPropertyBean> materialInfoBySap(Map<String, List<String>> excelData) {
|
||||
Map<String, MaterialPropertyBean> resultMap = new HashMap<>();
|
||||
// 获取PN号
|
||||
for (String key : excelData.keySet()) {
|
||||
if (excelData.get(key).get(1) != null) {
|
||||
MaterialPropertyBean materiaPorptry = new MaterialPropertyBean();
|
||||
// 通过接口获取物料信息
|
||||
String value = sapConnect("Product", excelData.get(key).get(1));
|
||||
System.out.println("物料信息json:" + value);
|
||||
if (value != null) {
|
||||
JSONObject jsonObject = new JSONObject(value);
|
||||
materiaPorptry.setVf5wlbm(jsonObject.getString("Product"));
|
||||
if ("FERT".equals(jsonObject.getString("ProductType"))) {
|
||||
materiaPorptry.setMaterialType("VF5ccp");
|
||||
} else if ("HALB".equals(jsonObject.getString("ProductType"))) {
|
||||
materiaPorptry.setMaterialType("VF5bcp");
|
||||
} else if ("ROH".equals(jsonObject.getString("ProductType"))) {
|
||||
materiaPorptry.setMaterialType("VF5cl");
|
||||
}
|
||||
String dw = jsonObject.getString("BaseUnit");
|
||||
if("ST".equals(dw)) {
|
||||
materiaPorptry.setVf5dw("PC");
|
||||
}else {
|
||||
materiaPorptry.setVf5dw(jsonObject.getString("BaseUnit"));
|
||||
}
|
||||
materiaPorptry.setVf5zl(String.valueOf(jsonObject.getDouble("GrossWeight")));
|
||||
materiaPorptry.setVf5sjzl(String.valueOf(jsonObject.getDouble("NetWeight")));
|
||||
}
|
||||
// 物料描述信息
|
||||
String value3 = sapConnect(
|
||||
"ProductDescription(Product='" + excelData.get(key).get(1) + "',Language='EN')", "");
|
||||
if (value3 != null) {
|
||||
System.out.println("物料描述类型json:" + value3);
|
||||
JSONObject jsonObject = new JSONObject(value3);
|
||||
materiaPorptry.setObjectName(jsonObject.getString("ProductDescription"));
|
||||
}
|
||||
// 物料采购类型
|
||||
String value2 = sapConnect(
|
||||
"ProductPlantSupplyPlanning(Product='" + excelData.get(key).get(1) + "',Plant='5410')", "");
|
||||
if (value2 != null) {
|
||||
System.out.println("物料采购类型json:" + value2);
|
||||
JSONObject jsonObject = new JSONObject(value2);
|
||||
materiaPorptry.setVf5jhmrsx(jsonObject.getString("ProcurementType"));
|
||||
// if ("E".equals(jsonObject.getString("ProcurementType"))) {
|
||||
// materiaPorptry.setVf5jhmrsx("In-House Production");
|
||||
// } else if ("F".equals(jsonObject.getString("ProcurementType"))) {
|
||||
// materiaPorptry.setVf5jhmrsx("External Procurement");
|
||||
// } else if ("X".equals(jsonObject.getString("ProcurementType"))) {
|
||||
// materiaPorptry.setVf5jhmrsx("Both Procurement Type");
|
||||
// }
|
||||
materiaPorptry.setVf5jhmrsx(jsonObject.getString("ProcurementType"));
|
||||
}
|
||||
String materialType = materiaPorptry.getMaterialType();
|
||||
if (materialType != null) {
|
||||
resultMap.put(excelData.get(key).get(1), materiaPorptry);
|
||||
} else {
|
||||
if (errorInfo == null) {
|
||||
errorInfo = excelData.get(key).get(1) + ",";
|
||||
} else {
|
||||
errorInfo = errorInfo + excelData.get(key).get(1) + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
System.out.println("resultMap的大小:" + resultMap.size());
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据物料编码查询物料对象是否存在
|
||||
*
|
||||
* @param excelData
|
||||
* @throws Exception
|
||||
*/
|
||||
private void queryMaterial(Map<String, List<String>> excelData, Map<String, MaterialPropertyBean> materialInfoMap)
|
||||
throws Exception {
|
||||
List<String> pnNum = new ArrayList<String>();
|
||||
Map<String, String> khthMap = new HashMap<>();
|
||||
// 获取PN号
|
||||
for (String key : excelData.keySet()) {
|
||||
pnNum.add(excelData.get(key).get(1));
|
||||
khthMap.put(excelData.get(key).get(1), excelData.get(key).get(2));
|
||||
cjCodeMap.put(excelData.get(key).get(0), excelData.get(key).get(1));
|
||||
if (!excelData.get(key).get(0).contains(".")) {
|
||||
topMap.put(excelData.get(key).get(0), excelData.get(key).get(2));
|
||||
}
|
||||
}
|
||||
System.out.println("pnNum:" + pnNum);
|
||||
String str = String.join(";", pnNum);
|
||||
// 根据查询构建器查询
|
||||
TCComponent[] search = session.search("MU_Find Part", new String[] { "vf5wlbm" }, new String[] { str });
|
||||
System.out.println("查询个数:" + search.length);
|
||||
if (search.length > 0) {
|
||||
for (TCComponent com : search) {
|
||||
TCComponent wlbmForm = com.getRelatedComponents("IMAN_master_form_rev")[0];
|
||||
for (int i = 0; i < pnNum.size(); i++) {
|
||||
if ((wlbmForm.getStringProperty("vf5wlbm")).equals(pnNum.get(i))) {
|
||||
pnNum.remove(i);
|
||||
}
|
||||
}
|
||||
if (com.getRelatedComponents("release_status_list").length > 0) {
|
||||
wlbmMap.put(wlbmForm.getStringProperty("vf5wlbm"), com);
|
||||
} else {
|
||||
gxwlbmMap.put(wlbmForm.getStringProperty("vf5wlbm"), com);
|
||||
}
|
||||
}
|
||||
}
|
||||
System.out.println("gxwlbmMap个数:" + gxwlbmMap.size());
|
||||
if (gxwlbmMap.size() > 0) {
|
||||
for (String key : gxwlbmMap.keySet()) {
|
||||
if (materialInfoMap.containsKey(key)) {
|
||||
// 获取已存在的对象
|
||||
TCComponent existObj = gxwlbmMap.get(key).getRelatedComponents("IMAN_master_form_rev")[0];
|
||||
// 获取SAP接口返回的物料信息
|
||||
MaterialPropertyBean propertyBean = materialInfoMap.get(key);
|
||||
// 获取属性值
|
||||
existObj.setStringProperty("vf5khth", khthMap.get(key));
|
||||
existObj.setStringProperty("vf5dw", propertyBean.getVf5dw());
|
||||
existObj.setStringProperty("vf5zl", propertyBean.getVf5zl());
|
||||
existObj.setStringProperty("vf5sjzl", propertyBean.getVf5sjzl());
|
||||
existObj.setStringProperty("vf5wlbm", propertyBean.getVf5wlbm());
|
||||
existObj.setStringProperty("vf5jhmrsx", propertyBean.getVf5jhmrsx());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pnNum.size() > 0) {
|
||||
for (String code : pnNum) {
|
||||
if (materialInfoMap.containsKey(code)) {
|
||||
TCComponentItemType itemType = (TCComponentItemType) session
|
||||
.getTypeComponent(materialInfoMap.get(code).getMaterialType());
|
||||
String itemRev = itemType.getNewRev(null);// 默认
|
||||
String itemID = itemType.getNewID();
|
||||
// 获取SAP接口返回的物料信息
|
||||
MaterialPropertyBean propertyBean = materialInfoMap.get(code);
|
||||
System.out.println("新建对象类型:" + propertyBean.getMaterialType());
|
||||
TCComponentItem item = itemType.create(itemID, itemRev, propertyBean.getMaterialType(),
|
||||
propertyBean.getObjectName(), "", null);
|
||||
System.out.println("新建对象:" + item.getStringProperty("item_id"));
|
||||
// 获取版本表单
|
||||
TCComponent component = item.getLatestItemRevision()
|
||||
.getRelatedComponents("IMAN_master_form_rev")[0];
|
||||
component.setStringProperty("vf5khth", khthMap.get(code));
|
||||
component.setStringProperty("vf5dw", propertyBean.getVf5dw());
|
||||
component.setStringProperty("vf5zl", propertyBean.getVf5zl());
|
||||
component.setStringProperty("vf5sjzl", propertyBean.getVf5sjzl());
|
||||
component.setStringProperty("vf5wlbm", propertyBean.getVf5wlbm());
|
||||
component.setStringProperty("vf5jhmrsx", propertyBean.getVf5jhmrsx());
|
||||
newObjectMap.put(code, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String sapConnect(String param, String code) {
|
||||
String result = null;
|
||||
HttpsURLConnection connection = null;
|
||||
try {
|
||||
String[] split = sapCheck.split(":");
|
||||
// 基本认证用户名和密码
|
||||
String basicAuth = "Basic "
|
||||
+ new String(Base64.getEncoder().encode((split[0] + ":" + split[1]).getBytes()));
|
||||
|
||||
// 创建URL对象
|
||||
URL urlObj = null;
|
||||
if (code != null && code != "") {
|
||||
urlObj = new URL(url + "/" + param + "/" + code);
|
||||
} else {
|
||||
urlObj = new URL(url + "/" + param);
|
||||
}
|
||||
|
||||
// 打开连接
|
||||
connection = (HttpsURLConnection) urlObj.openConnection();
|
||||
// 添加认证头
|
||||
connection.setRequestProperty("Authorization", basicAuth);
|
||||
|
||||
// 设置请求方法为GET
|
||||
connection.setRequestMethod("GET");
|
||||
|
||||
// 接收响应码
|
||||
int responseCode = connection.getResponseCode();
|
||||
System.out.println("Response Code: " + responseCode);
|
||||
|
||||
// 读取响应内容
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||
String inputLine;
|
||||
StringBuilder response = new StringBuilder();
|
||||
|
||||
while ((inputLine = in.readLine()) != null) {
|
||||
response.append(inputLine);
|
||||
}
|
||||
in.close();
|
||||
|
||||
result = response.toString();
|
||||
// 打印结果
|
||||
System.out.println(response.toString());
|
||||
} catch (Exception e) {
|
||||
e.getStackTrace();
|
||||
System.out.println(e.getStackTrace());
|
||||
} finally {
|
||||
// 关闭连接
|
||||
connection.disconnect();
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class WaitingDialog extends com.teamcenter.rac.aif.AbstractAIFDialog {
|
||||
private static final long serialVersionUID = 1L;
|
||||
public JPanel panel;
|
||||
JProgressBar progressBar = null;
|
||||
|
||||
public WaitingDialog(Frame arg0, String title, String message) {
|
||||
super(arg0, title);
|
||||
this.setModal(false);
|
||||
|
||||
panel = new JPanel(new BorderLayout());
|
||||
|
||||
/*
|
||||
* JLabel label = new JLabel(message); System.out.println("message:"+message);
|
||||
* System.out.println("label:"+label); panel.add(label);
|
||||
*/
|
||||
|
||||
progressBar = new JProgressBar(SwingConstants.HORIZONTAL);
|
||||
progressBar.setVisible(true);
|
||||
progressBar.setIndeterminate(true);
|
||||
|
||||
panel.add(BorderLayout.CENTER, new Label(message));
|
||||
panel.add(BorderLayout.SOUTH, progressBar);
|
||||
|
||||
panel.setPreferredSize(new Dimension(350, 60));
|
||||
|
||||
this.getContentPane().add(panel);
|
||||
|
||||
centerToScreen();
|
||||
|
||||
pack();
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package com.connor.ferrorTech.metal.importMaterial;
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
import com.teamcenter.rac.kernel.TCComponent;
|
||||
import com.teamcenter.rac.util.MessageBox;
|
||||
import com.teamcenter.rac.util.Registry;
|
||||
|
||||
public class ImportMaterialHandler extends AbstractHandler{
|
||||
Registry reg=Registry.getRegistry(this);
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
// TODO Auto-generated method stub
|
||||
AbstractAIFApplication application = AIFUtility.getCurrentApplication();
|
||||
|
||||
//获取选中的对象
|
||||
TCComponent selectObject=(TCComponent) application.getTargetComponent();
|
||||
System.out.println("选中对象类型:" + selectObject.getType());
|
||||
if(!selectObject.getType().equals("VF5NPI")) {
|
||||
MessageBox.post(reg.getString("ImportMaterialHandler.1"), reg.getString("ImportMaterialHandler.0"), MessageBox.INFORMATION);
|
||||
return null;
|
||||
}
|
||||
ImportMaterialDialog action = new ImportMaterialDialog(application,selectObject);
|
||||
|
||||
new Thread(action).start();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
package com.connor.ferrorTech.metal.importMaterial;
|
||||
|
||||
public class MaterialPropertyBean {
|
||||
private String vf5wlbm;
|
||||
private String materialType;
|
||||
private String itemRevisionId;
|
||||
private String objectName;
|
||||
private String vf5dw;
|
||||
private String vf5sjzl;
|
||||
private String vf5zl;
|
||||
private String vf5jhmrsx;
|
||||
|
||||
public String getVf5wlbm() {
|
||||
return vf5wlbm;
|
||||
}
|
||||
|
||||
public void setVf5wlbm(String vf5wlbm) {
|
||||
this.vf5wlbm = vf5wlbm;
|
||||
}
|
||||
|
||||
public String getMaterialType() {
|
||||
return materialType;
|
||||
}
|
||||
|
||||
public void setMaterialType(String materialType) {
|
||||
this.materialType = materialType;
|
||||
}
|
||||
|
||||
public String getItemRevisionId() {
|
||||
return itemRevisionId;
|
||||
}
|
||||
|
||||
public void setItemRevisionId(String itemRevisionId) {
|
||||
this.itemRevisionId = itemRevisionId;
|
||||
}
|
||||
|
||||
public String getObjectName() {
|
||||
return objectName;
|
||||
}
|
||||
|
||||
public void setObjectName(String objectName) {
|
||||
this.objectName = objectName;
|
||||
}
|
||||
|
||||
public String getVf5dw() {
|
||||
return vf5dw;
|
||||
}
|
||||
|
||||
public void setVf5dw(String vf5dw) {
|
||||
this.vf5dw = vf5dw;
|
||||
}
|
||||
|
||||
public String getVf5sjzl() {
|
||||
return vf5sjzl;
|
||||
}
|
||||
|
||||
public void setVf5sjzl(String vf5sjzl) {
|
||||
this.vf5sjzl = vf5sjzl;
|
||||
}
|
||||
|
||||
public String getVf5zl() {
|
||||
return vf5zl;
|
||||
}
|
||||
|
||||
public void setVf5zl(String vf5zl) {
|
||||
this.vf5zl = vf5zl;
|
||||
}
|
||||
|
||||
public String getVf5jhmrsx() {
|
||||
return vf5jhmrsx;
|
||||
}
|
||||
|
||||
public void setVf5jhmrsx(String vf5jhmrsx) {
|
||||
this.vf5jhmrsx = vf5jhmrsx;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MaterialPropertyBean [vf5wlbm=" + vf5wlbm + ", materialType=" + materialType + ", itemRevisionId="
|
||||
+ itemRevisionId + ", objectName=" + objectName + ", vf5dw=" + vf5dw + ", vf5sjzl=" + vf5sjzl
|
||||
+ ", vf5zl=" + vf5zl + ", vf5jhmrsx=" + vf5jhmrsx + "]";
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,138 @@
|
||||
package com.connor.ferrorTech.metal.importMaterial;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JProgressBar;
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFDialog;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class ProgressBar extends AbstractAIFDialog {
|
||||
|
||||
private JLabel messageLabel;
|
||||
|
||||
private JProgressBar progressBar;
|
||||
|
||||
private boolean showBar = false;
|
||||
|
||||
public ProgressBar(Dimension dim) {
|
||||
super(false);
|
||||
initUI(dim);
|
||||
}
|
||||
|
||||
public ProgressBar(AbstractAIFDialog pd, Dimension dimension) {
|
||||
super(pd, false);
|
||||
initUI(dimension);
|
||||
}
|
||||
|
||||
public ProgressBar(Dimension dim,boolean showBar) {
|
||||
super(false);
|
||||
this.showBar=showBar;
|
||||
initUI(dim);
|
||||
}
|
||||
|
||||
public ProgressBar(AbstractAIFDialog pd, Dimension dimension,boolean showBar) {
|
||||
super(pd, false);
|
||||
this.showBar=showBar;
|
||||
initUI(dimension);
|
||||
}
|
||||
|
||||
public ProgressBar(JFrame pd, Dimension dimension,boolean showBar) {
|
||||
super(pd, false);
|
||||
this.showBar=showBar;
|
||||
initUI(dimension);
|
||||
}
|
||||
private void initUI(Dimension dim) {
|
||||
this.setLayout(new BorderLayout(0, 0));
|
||||
this.setUndecorated(true);
|
||||
JPanel main = new JPanel(new GridBagLayout());
|
||||
GridBagConstraints s = new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 5, 2, 5), 0, 0);
|
||||
main.setBackground(new Color(53, 53, 53));
|
||||
if (dim != null) {
|
||||
this.setPreferredSize(dim);
|
||||
} else {
|
||||
this.setPreferredSize(new Dimension(200, 40));
|
||||
}
|
||||
messageLabel = new JLabel(" ");
|
||||
messageLabel.setForeground(Color.white);
|
||||
progressBar = new JProgressBar();
|
||||
progressBar.setForeground(Color.black);
|
||||
progressBar.setIndeterminate(true);
|
||||
main.add(messageLabel, s);
|
||||
s.gridy++;
|
||||
s.insets = new Insets(0, 5, 2, 5);
|
||||
if(showBar) {
|
||||
main.add(progressBar, s);
|
||||
}
|
||||
this.add(BorderLayout.CENTER, main);
|
||||
KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
|
||||
this.getRootPane().registerKeyboardAction(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
disposeDialog();
|
||||
}
|
||||
}, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);
|
||||
MouseAdapter ma = new MouseAdapter() {
|
||||
private Point pressPoint = new Point();
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
pressPoint = e.getPoint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
pressPoint = new Point();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseDragged(MouseEvent e) {
|
||||
Rectangle r = ProgressBar.this.getBounds();
|
||||
setLocation(r.x + (e.getX() - pressPoint.x), r.y + (e.getY() - pressPoint.y));
|
||||
}
|
||||
};
|
||||
this.addMouseListener(ma);
|
||||
this.addMouseMotionListener(ma);
|
||||
}
|
||||
|
||||
public void setText(String message) {
|
||||
messageLabel.setText(message);
|
||||
}
|
||||
|
||||
public void setIndeterminate(boolean b) {
|
||||
progressBar.setIndeterminate(b);
|
||||
}
|
||||
|
||||
public void setText(String txt, int percent) {
|
||||
setText(txt);
|
||||
if (percent > progressBar.getMaximum()) {
|
||||
percent = progressBar.getMaximum();
|
||||
}
|
||||
progressBar.setValue(percent);
|
||||
}
|
||||
|
||||
public void cancel() {
|
||||
disposeDialog();
|
||||
}
|
||||
|
||||
public void startProgress() {
|
||||
showDialog();
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
ImportMaterialDialog.0=Please select the upload path
|
||||
ImportMaterialDialog.1=Local upload path:
|
||||
ImportMaterialDialog.2=Select
|
||||
ImportMaterialDialog.3=Confirm
|
||||
ImportMaterialDialog.8=Cancel
|
||||
ImportMaterialHandler.0=Info
|
||||
ImportMaterialHandler.1=The selected object type is incorrect!
|
||||
ImportMaterialDialog.4=Please select Upload file\uff01
|
||||
ImportMaterialDialog.5=Preference [SAP_check] is not configured\uff01
|
||||
ImportMaterialDialog.6=Preference [SAP_url] is not configured\uff01
|
||||
ImportMaterialDialog.7=The level or PN number in the uploaded file is empty, please check!
|
||||
ImportMaterialDialog.9=execute
|
||||
ImportMaterialDialog.10=In execution......
|
||||
ImportMaterialDialog.11=Executed successfully!
|
||||
ImportMaterialDialog.12=Execution failure!
|
||||
ImportMaterialDialog.13=Materiel\u3010
|
||||
ImportMaterialDialog.14=\u3011Failed to call SAP interface, material information could not be obtained!
|
@ -0,0 +1,17 @@
|
||||
ImportMaterialDialog.0=\u8bf7\u9009\u62e9\u4e0a\u4f20\u8def\u5f84
|
||||
ImportMaterialDialog.1=\u672c\u5730\u4e0a\u4f20\u8def\u5f84\uff1a
|
||||
ImportMaterialDialog.2=\u9009\u62e9
|
||||
ImportMaterialDialog.3=\u786e\u5b9a
|
||||
ImportMaterialDialog.8=\u53d6\u6d88
|
||||
ImportMaterialHandler.0=\u63d0\u793a
|
||||
ImportMaterialHandler.1=\u9009\u4e2d\u7684\u5bf9\u8c61\u7c7b\u578b\u9519\u8bef\uff01
|
||||
ImportMaterialDialog.4=\u8bf7\u9009\u62e9\u4e0a\u4f20\u6587\u4ef6\uff01
|
||||
ImportMaterialDialog.5=\u9996\u9009\u9879\u3010SAP_check\u3011\u672a\u914d\u7f6e\uff01
|
||||
ImportMaterialDialog.6=\u9996\u9009\u9879\u3010SAP_url\u3011\u672a\u914d\u7f6e\uff01
|
||||
ImportMaterialDialog.7=\u4e0a\u4f20\u6587\u4ef6\u4e2d\u5c42\u7ea7\u6216\u8005PN\u53f7\u5217\u4e3a\u7a7a\uff0c\u8bf7\u68c0\u67e5\uff01
|
||||
ImportMaterialDialog.9=\u6267\u884c
|
||||
ImportMaterialDialog.10=\u6267\u884c\u4e2d......
|
||||
ImportMaterialDialog.11=\u6267\u884c\u6210\u529f!
|
||||
ImportMaterialDialog.12=\u6267\u884c\u5931\u8d25!
|
||||
ImportMaterialDialog.13=\u7269\u6599\u3010
|
||||
ImportMaterialDialog.14=\u3011\u8c03\u7528SAP\u63a5\u53e3\u5931\u8d25\uff0c\u65e0\u6cd5\u83b7\u53d6\u7269\u6599\u4fe1\u606f\uff01
|
@ -0,0 +1,88 @@
|
||||
package com.connor.ferrorTech.metal.material.finishedProducts;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
|
||||
import com.connor.ferrorTech.metal.util.SwingUtil;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
|
||||
public class FinishedProductsCreateHandler extends AbstractHandler {
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
AbstractAIFApplication application = AIFUtility.getCurrentApplication();
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
String[] chLabelName = new String[] { "物料编码", "物料名称", "客户图号", "材质", "规格", "零件尺寸", "材料尺寸", "表面要求", "切割方式",
|
||||
"计量单位", "计划默认属性", "备注" };
|
||||
String[] enLabelName = new String[] { "Material code", "Material name", "Customer drawing number", "Material",
|
||||
"Specification", "Part size", "Material size", "Surface requirements", "Cutting method",
|
||||
"Unit", "Plan default attributes", "Remarks" };
|
||||
|
||||
String[] prop = new String[] { "vf5wlbm", "object_name", "vf5khth", "vf5cz", "vf5gg", "vf5ljcc", "vf5clcc",
|
||||
"vf5bmyq", "vf5qgfs", "vf5dw", "vf5jhmrsx", "vf5beizhu" };
|
||||
|
||||
JLabel[] jLabels = new JLabel[enLabelName.length];
|
||||
JComponent[] jComponents = new JComponent[enLabelName.length];
|
||||
Map<String, Map<String, String>> lovMap = new HashMap<String, Map<String, String>>();
|
||||
Map<Integer, String[]> map = new HashMap<>();
|
||||
String[] inHouse = SwingUtil.getKeyValue("VF5dwlov", lovMap);
|
||||
String[] eas = SwingUtil.getKeyValue("VF5jhmrsx", lovMap);
|
||||
map.put(enLabelName.length - 3, inHouse);
|
||||
map.put(enLabelName.length - 2, eas);
|
||||
|
||||
for (int i = 0; i < enLabelName.length; i++) {
|
||||
if (map.containsKey(i)) {
|
||||
jComponents[i] = new JComboBox<>(map.get(i));
|
||||
} else {
|
||||
jComponents[i] = new JTextField(14);
|
||||
}
|
||||
jLabels[i] = new JLabel(enLabelName[i]);
|
||||
}
|
||||
System.out.println("In house :" + inHouse);
|
||||
for (String inhouse : inHouse) {
|
||||
if (inhouse.equals("In-House Production")) {
|
||||
((JComboBox) jComponents[enLabelName.length - 2]).setSelectedItem("In-House Production");
|
||||
}
|
||||
}
|
||||
for (String ea : eas) {
|
||||
if (ea.equals("EA")) {
|
||||
((JComboBox) jComponents[enLabelName.length - 3]).setSelectedItem("EA");
|
||||
}
|
||||
}
|
||||
|
||||
Set<String> keySet = lovMap.keySet();
|
||||
for (String key : keySet) {
|
||||
StringBuffer str = new StringBuffer();
|
||||
str.append(key);
|
||||
str.append(" ==> ");
|
||||
Map<String, String> map2 = lovMap.get(key);
|
||||
Set<String> keySet2 = map2.keySet();
|
||||
for (String key2 : keySet2) {
|
||||
String value2 = map2.get(key2);
|
||||
str.append("( ");
|
||||
str.append(key2);
|
||||
str.append(" || ");
|
||||
str.append(value2);
|
||||
str.append(" )");
|
||||
}
|
||||
System.out.println(str.toString());
|
||||
}
|
||||
|
||||
ProductsCreateFrame action = new ProductsCreateFrame(application, "Create finished products",
|
||||
"finishedProducts", jLabels, jComponents, prop, lovMap);
|
||||
|
||||
new Thread(action).start();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,435 @@
|
||||
package com.connor.ferrorTech.metal.material.finishedProducts;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.Font;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
import java.util.Base64;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import com.connor.ferrorTech.metal.constant.ConstantPool;
|
||||
import com.connor.ferrorTech.metal.importMaterial.MaterialPropertyBean;
|
||||
import com.connor.ferrorTech.metal.util.SwingUtil;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
import com.teamcenter.rac.commands.open.OpenCommand;
|
||||
import com.teamcenter.rac.kernel.TCComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponentFolder;
|
||||
import com.teamcenter.rac.kernel.TCComponentItem;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemType;
|
||||
import com.teamcenter.rac.kernel.TCException;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
import com.teamcenter.rac.util.MessageBox;
|
||||
import com.teamcenter.rac.util.Registry;
|
||||
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class ProductsCreateFrame extends JFrame implements Runnable {
|
||||
|
||||
private AbstractAIFApplication application;
|
||||
private TCSession tcSession;
|
||||
|
||||
private String title;
|
||||
private String objectName;
|
||||
private JLabel[] jLabels;
|
||||
private JComponent[] jComponents;
|
||||
private String[] prop;
|
||||
private Map<String, Map<String, String>> lovMap;
|
||||
|
||||
private JButton okButton;
|
||||
private JButton celButton;
|
||||
private JButton queryButton;
|
||||
|
||||
private String url;
|
||||
private String sapCheck;
|
||||
private String soaRetrunType;
|
||||
private Map<String,String> map;
|
||||
|
||||
private TCComponentFolder targetFolder;
|
||||
|
||||
public ProductsCreateFrame(AbstractAIFApplication application, String title, String objectName, Object... args) {
|
||||
this.application = application;
|
||||
this.tcSession = (TCSession) application.getSession();
|
||||
this.title = title;
|
||||
this.objectName = objectName;
|
||||
this.jLabels = (JLabel[]) args[0];
|
||||
this.jComponents = (JComponent[]) args[1];
|
||||
this.prop = (String[]) args[2];
|
||||
this.lovMap = (Map<String, Map<String, String>>) args[3];
|
||||
|
||||
map = new HashMap<String,String>();
|
||||
map.put("finishedProducts","VF5ccp");
|
||||
map.put("semiFinishedProducts","VF5bcp");
|
||||
map.put("material","VF5cl");
|
||||
}
|
||||
|
||||
public void initUI() {
|
||||
this.setTitle(title);
|
||||
this.setSize(600, 570);
|
||||
// 初始化组件
|
||||
initializationComponent();
|
||||
// 添加内容到JFrame 并设置它的位置
|
||||
JScrollPane centerPanel = getCenterPanel();
|
||||
JPanel bottomPanel = getBottomPanel();
|
||||
|
||||
this.getContentPane().add(centerPanel, BorderLayout.CENTER);
|
||||
this.getContentPane().add(bottomPanel, BorderLayout.SOUTH);
|
||||
// 设置窗口居中
|
||||
this.setLocationRelativeTo(null);
|
||||
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
// 设置可见性
|
||||
this.setVisible(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置界面属性条目
|
||||
*/
|
||||
public void initializationComponent() {
|
||||
okButton = new JButton(ConstantPool.EN_BUTTON_CONFIRM);
|
||||
celButton = new JButton(ConstantPool.EN_BUTTON_CANCEL);
|
||||
queryButton = new JButton("Query");
|
||||
}
|
||||
|
||||
public JScrollPane getCenterPanel() {
|
||||
JPanel centerPanel = new JPanel(new GridBagLayout());
|
||||
GridBagConstraints customLayout = new GridBagConstraints();
|
||||
|
||||
// 添加第一个JLabel和JTextField
|
||||
customLayout.insets = new Insets(5, 30, 5, 20); // 边距
|
||||
customLayout.gridx = 0;
|
||||
customLayout.weightx = 0;
|
||||
customLayout.anchor = GridBagConstraints.LINE_START;
|
||||
jLabels[0].setFont(new Font("微软雅黑", Font.BOLD, 13));
|
||||
centerPanel.add(jLabels[0], customLayout);
|
||||
|
||||
customLayout.insets = new Insets(5, 3, 5, 20); // 边距
|
||||
customLayout.gridx = 1;
|
||||
customLayout.fill = GridBagConstraints.HORIZONTAL;
|
||||
JComponent jComponent = jComponents[0];
|
||||
jComponent.setFont(new Font("微软雅黑", Font.BOLD, 15));
|
||||
centerPanel.add(jComponent, customLayout);
|
||||
|
||||
// 将queryButton放在第一个输入框的右边
|
||||
customLayout.insets = new Insets(5, 3, 5, 20); // 边距
|
||||
customLayout.gridx = 2;
|
||||
customLayout.fill = GridBagConstraints.HORIZONTAL;
|
||||
queryButton.setFont(new Font("微软雅黑", Font.BOLD, 12));
|
||||
centerPanel.add(queryButton, customLayout);
|
||||
|
||||
// 添加剩余的JLabel和JTextField
|
||||
for (int i = 1; i < jLabels.length; i++) {
|
||||
customLayout.insets = new Insets(5, 30, 5, 20); // 边距
|
||||
customLayout.gridx = 0;
|
||||
customLayout.gridy = i; // 设置垂直位置
|
||||
customLayout.weightx = 0;
|
||||
customLayout.anchor = GridBagConstraints.LINE_START;
|
||||
jLabels[i].setFont(new Font("微软雅黑", Font.BOLD, 13));
|
||||
centerPanel.add(jLabels[i], customLayout);
|
||||
|
||||
customLayout.insets = new Insets(5, 3, 5, 20); // 边距
|
||||
customLayout.gridx = 1;
|
||||
customLayout.fill = GridBagConstraints.HORIZONTAL;
|
||||
jComponent = jComponents[i];
|
||||
jComponent.setFont(new Font("微软雅黑", Font.BOLD, 15));
|
||||
centerPanel.add(jComponent, customLayout);
|
||||
}
|
||||
|
||||
// 创建具有滚动功能的JPanel
|
||||
return new JScrollPane(centerPanel);
|
||||
}
|
||||
|
||||
public JPanel getBottomPanel() {
|
||||
// TODO Auto-generated method stub
|
||||
JPanel bottomPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 70, 10));
|
||||
bottomPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
|
||||
bottomPanel.add(this.okButton);
|
||||
bottomPanel.add(this.celButton);
|
||||
// 添加监听
|
||||
okButton.addActionListener(e -> {
|
||||
this.dispose(); // 关闭窗口
|
||||
confirmFunction();
|
||||
});
|
||||
celButton.addActionListener(e -> {
|
||||
this.dispose(); // 关闭窗口
|
||||
});
|
||||
queryButton.addActionListener(e->{
|
||||
try {
|
||||
queryItem();
|
||||
} catch (Exception e1) {
|
||||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
}
|
||||
});
|
||||
return bottomPanel;
|
||||
}
|
||||
|
||||
public void queryItem() throws Exception {
|
||||
// TODO 校验物料编码是否为空
|
||||
JTextField codeField = (JTextField)jComponents[0];
|
||||
String codeName = codeField.getText();
|
||||
if(codeName.isEmpty()) {
|
||||
JOptionPane.showMessageDialog(this, "Please fill in the material code!", "Info", JOptionPane.INFORMATION_MESSAGE);
|
||||
return;
|
||||
}
|
||||
InterfaceAIFComponent[] results = tcSession.search("MU_Find Part",new String[] {"vf5wlbm"}, new String[]{codeName});
|
||||
|
||||
// 存在则提示已经存在该物料,并打开查询到的物料。
|
||||
if(results!=null && results.length>0) {
|
||||
JOptionPane.showMessageDialog(this, "The material already exists!", "Info", JOptionPane.INFORMATION_MESSAGE);
|
||||
this.dispose();
|
||||
TCComponent target = (TCComponent) results[0];
|
||||
com.teamcenter.rac.common.Activator.getDefault()
|
||||
.openPerspective("com.teamcenter.rac.ui.perspectives.navigatorPerspective");
|
||||
com.teamcenter.rac.common.Activator.getDefault().openComponents(
|
||||
"com.teamcenter.rac.ui.perspectives.navigatorPerspective",
|
||||
new InterfaceAIFComponent[]{target});
|
||||
}
|
||||
//如果不存在则调用SAP物料接口获取对应物料信息
|
||||
String[] sapUrls = tcSession.getPreferenceService().getStringValues("SAP_url");
|
||||
if(sapUrls!=null && sapUrls.length>0) {
|
||||
url = sapUrls[0];
|
||||
}else {
|
||||
JOptionPane.showMessageDialog(this, "SAP_url preference configuration error!", "Info", JOptionPane.INFORMATION_MESSAGE);
|
||||
}
|
||||
|
||||
sapCheck = tcSession.getPreferenceService().getStringValue("SAP_check");
|
||||
if(sapCheck.isEmpty()) {
|
||||
JOptionPane.showMessageDialog(this, "SAP_check preference configuration error!", "Info", JOptionPane.INFORMATION_MESSAGE);
|
||||
}
|
||||
|
||||
MaterialPropertyBean materialInfo = materialInfoBySap(codeName);
|
||||
if(materialInfo == null) {
|
||||
JOptionPane.showMessageDialog(this, "SAP does not exist for this material!", "Info", JOptionPane.INFORMATION_MESSAGE);
|
||||
}else {
|
||||
System.out.println("get info :"+materialInfo.toString());
|
||||
String selectType = map.get(objectName);
|
||||
soaRetrunType = materialInfo.getMaterialType();
|
||||
if(!selectType.equals(soaRetrunType)) {
|
||||
JOptionPane.showMessageDialog(this, "The material code entered is incorrect, please re-enter!", "Info", JOptionPane.INFORMATION_MESSAGE);
|
||||
return;
|
||||
}
|
||||
JTextField nameField = (JTextField)jComponents[1];
|
||||
nameField.setText(materialInfo.getObjectName());
|
||||
|
||||
JComboBox<String> unitBox =(JComboBox) jComponents[jComponents.length-3];
|
||||
unitBox.setSelectedItem(materialInfo.getVf5dw());
|
||||
|
||||
JComboBox<String> planBox =(JComboBox) jComponents[jComponents.length-2];
|
||||
planBox.setSelectedItem(materialInfo.getVf5jhmrsx());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean confirmFunction() {
|
||||
Map<String, String> propMap = SwingUtil.getJComponentValue(prop, jComponents);
|
||||
String selectType = map.get(objectName);
|
||||
System.out.println("selectType : "+selectType);
|
||||
if(soaRetrunType!=null && !soaRetrunType.isEmpty() && !selectType.equals(soaRetrunType)) {
|
||||
JOptionPane.showMessageDialog(this, "The material code entered is incorrect, please re-enter!", "Info", JOptionPane.INFORMATION_MESSAGE);
|
||||
return false;
|
||||
}
|
||||
createItem(selectType, propMap);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void createItem(String itemType, Map<String, String> propMap) {
|
||||
// TODO Auto-generated method stub
|
||||
try {
|
||||
TCComponentItemType ccpType = (TCComponentItemType) this.tcSession.getTypeComponent(itemType);
|
||||
TCComponentItem ccpItem = ccpType.create(ccpType.getNewID(), "", itemType, propMap.get("object_name"), "",
|
||||
null);
|
||||
TCComponent[] referenceValueArray = ccpItem.getLatestItemRevision().getTCProperty("IMAN_master_form_rev")
|
||||
.getReferenceValueArray();
|
||||
TCComponent form = referenceValueArray[0];
|
||||
Set<String> keySet = propMap.keySet();
|
||||
for (String key : keySet) {
|
||||
if (key.equals("vf5jhmrsx")) {
|
||||
form.setProperty(key,lovMap.get("VF5jhmrsx").get(propMap.get(key)));
|
||||
} else {
|
||||
form.setProperty(key, propMap.get(key));
|
||||
}
|
||||
}
|
||||
targetFolder.add("contents", ccpItem);
|
||||
MessageBox.post("Created Successfully !", "Info", MessageBox.INFORMATION);
|
||||
} catch (TCException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
InterfaceAIFComponent targetComponent = this.application.getTargetComponent();
|
||||
String itemType = targetComponent.getType();
|
||||
if (targetComponent instanceof TCComponentFolder
|
||||
&& (itemType.equals("VF5NPI") || itemType.equals("VF5xmwjj") || itemType.equals("Folder"))) {
|
||||
targetFolder = (TCComponentFolder) targetComponent;
|
||||
initUI();
|
||||
} else {
|
||||
JOptionPane.showMessageDialog(null, "not Folder or type error", "Warning", JOptionPane.WARNING_MESSAGE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过查询构建器查询物料
|
||||
*
|
||||
* @param materialCode
|
||||
* @return
|
||||
*/
|
||||
public boolean queryMaterial(String materialCode) {
|
||||
|
||||
try {
|
||||
TCComponent[] materialObjects = tcSession.search("FTH_Find PartRevisionBywlbm", new String[] { "fth4wlbm" },
|
||||
new String[] { materialCode });
|
||||
if (materialObjects.length >= 1) {
|
||||
TCComponent com = materialObjects[0];
|
||||
// 打开对象
|
||||
Registry localRegistry = Registry.getRegistry("com.teamcenter.rac.commands.open.open");
|
||||
OpenCommand localOpenCommand = (OpenCommand) localRegistry.newInstanceForEx("openCommand",
|
||||
new Object[] { AIFUtility.getActiveDesktop(), com });
|
||||
localOpenCommand.executeModeless();
|
||||
return false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* sap接口连接
|
||||
*
|
||||
* @param param
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
public String sapConnect(String param, String code) {
|
||||
String result = null;
|
||||
HttpsURLConnection connection = null;
|
||||
try {
|
||||
String[] split = sapCheck.split(":");
|
||||
// 基本认证用户名和密码
|
||||
String basicAuth = "Basic "
|
||||
+ new String(Base64.getEncoder().encode((split[0] + ":" + split[1]).getBytes()));
|
||||
|
||||
// 创建URL对象
|
||||
URL urlObj = null;
|
||||
if (code != null && code != "") {
|
||||
urlObj = new URL(url + "/" + param + "/" + code);
|
||||
} else {
|
||||
urlObj = new URL(url + "/" + param);
|
||||
}
|
||||
|
||||
// 打开连接
|
||||
connection = (HttpsURLConnection) urlObj.openConnection();
|
||||
// 添加认证头
|
||||
connection.setRequestProperty("Authorization", basicAuth);
|
||||
|
||||
// 设置请求方法为GET
|
||||
connection.setRequestMethod("GET");
|
||||
|
||||
// 接收响应码
|
||||
int responseCode = connection.getResponseCode();
|
||||
System.out.println("Response Code: " + responseCode);
|
||||
|
||||
// 读取响应内容
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||
String inputLine;
|
||||
StringBuilder response = new StringBuilder();
|
||||
|
||||
while ((inputLine = in.readLine()) != null) {
|
||||
response.append(inputLine);
|
||||
}
|
||||
in.close();
|
||||
|
||||
result = response.toString();
|
||||
// 打印结果
|
||||
System.out.println(response.toString());
|
||||
} catch (Exception e) {
|
||||
e.getStackTrace();
|
||||
System.out.println(e.getStackTrace());
|
||||
} finally {
|
||||
// 关闭连接
|
||||
connection.disconnect();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过SAP接口获取物料信息
|
||||
*/
|
||||
public MaterialPropertyBean materialInfoBySap(String materialCode) {
|
||||
MaterialPropertyBean materiaPorptry = new MaterialPropertyBean();
|
||||
// 通过接口获取物料信息
|
||||
String value = sapConnect("Product", materialCode);
|
||||
System.out.println("物料信息json:" + value);
|
||||
if (value != null) {
|
||||
JSONObject jsonObject = new JSONObject(value);
|
||||
materiaPorptry.setVf5wlbm(jsonObject.getString("Product"));
|
||||
System.out.println("物料编码:" + jsonObject.getString("Product"));
|
||||
if ("FERT".equals(jsonObject.getString("ProductType"))) {
|
||||
materiaPorptry.setMaterialType("VF5ccp");
|
||||
} else if ("HALB".equals(jsonObject.getString("ProductType"))) {
|
||||
materiaPorptry.setMaterialType("VF5bcp");
|
||||
} else if ("ROH".equals(jsonObject.getString("ProductType"))) {
|
||||
materiaPorptry.setMaterialType("VF5cl");
|
||||
}
|
||||
String dw = jsonObject.getString("BaseUnit");
|
||||
if("ST".equals(dw)) {
|
||||
materiaPorptry.setVf5dw("PC");
|
||||
}else {
|
||||
materiaPorptry.setVf5dw(dw);
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
// 物料描述信息
|
||||
String value3 = sapConnect("ProductDescription(Product='" + materialCode + "',Language='EN')", "");
|
||||
if (value3 != null) {
|
||||
System.out.println("物料描述类型json:" + value3);
|
||||
JSONObject jsonObject = new JSONObject(value3);
|
||||
materiaPorptry.setObjectName(jsonObject.getString("ProductDescription"));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
// 物料采购类型
|
||||
String value2 = sapConnect("ProductPlantSupplyPlanning(Product='" + materialCode + "',Plant='5410')", "");
|
||||
if (value2 != null) {
|
||||
System.out.println("物料采购类型json:" + value2);
|
||||
JSONObject jsonObject = new JSONObject(value2);
|
||||
if ("E".equals(jsonObject.getString("ProcurementType"))) {
|
||||
materiaPorptry.setVf5jhmrsx("In-House Production");
|
||||
} else if ("F".equals(jsonObject.getString("ProcurementType"))) {
|
||||
materiaPorptry.setVf5jhmrsx("External Procurement");
|
||||
} else if ("X".equals(jsonObject.getString("ProcurementType"))) {
|
||||
materiaPorptry.setVf5jhmrsx("Both Procurement Type");
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
return materiaPorptry;
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
finishedProductsDialog.0=Create Finished Products
|
||||
finishedProductsDialog.1=Material code
|
||||
finishedProductsDialog.2=Material name
|
||||
finishedProductsDialog.3=Customer drawing number
|
||||
finishedProductsDialog.4=Material
|
||||
finishedProductsDialog.5=Specification
|
||||
finishedProductsDialog.6=Part size
|
||||
finishedProductsDialog.7=Material size
|
||||
finishedProductsDialog.8=Surface requirements
|
||||
finishedProductsDialog.9=Cutting method
|
||||
finishedProductsDialog.10=Unit
|
||||
finishedProductsDialog.11=Plan default attributes
|
||||
finishedProductsDialog.12=Remarks
|
@ -0,0 +1,72 @@
|
||||
package com.connor.ferrorTech.metal.material.material;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
|
||||
import com.connor.ferrorTech.metal.material.finishedProducts.ProductsCreateFrame;
|
||||
import com.connor.ferrorTech.metal.util.SwingUtil;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
|
||||
public class MaterialCreateHandler extends AbstractHandler {
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
AbstractAIFApplication application = AIFUtility.getCurrentApplication();
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
String[] chLabelName = new String[] { "物料编码", "物料名称", "客户图号", "材质", "规格", "零件尺寸", "材料尺寸", "表面要求", "切割方式",
|
||||
"计量单位", "计划默认属性", "备注" };
|
||||
String[] enLabelName = new String[] { "Material code", "Material name", "Customer drawing number", "Material",
|
||||
"Specification", "Part size", "Material size", "Surface requirements", "Cutting method",
|
||||
"Unit", "Plan default attributes", "Remarks" };
|
||||
|
||||
String[] prop = new String[] { "vf5wlbm", "object_name", "vf5khth", "vf5cz", "vf5gg", "vf5ljcc", "vf5clcc",
|
||||
"vf5bmyq", "vf5qgfs", "vf5dw", "vf5jhmrsx", "vf5beizhu" };
|
||||
|
||||
JLabel[] jLabels = new JLabel[enLabelName.length];
|
||||
JComponent[] jComponents = new JComponent[enLabelName.length];
|
||||
Map<String, Map<String, String>> lovMap = new HashMap<String, Map<String, String>>();
|
||||
Map<Integer, String[]> map = new HashMap<>();
|
||||
String[] inHouse = SwingUtil.getKeyValue("VF5dwlov", lovMap);
|
||||
String[] eas = SwingUtil.getKeyValue("VF5jhmrsx", lovMap);
|
||||
map.put(enLabelName.length - 3, inHouse);
|
||||
map.put(enLabelName.length - 2, eas);
|
||||
|
||||
for (int i = 0; i < enLabelName.length; i++) {
|
||||
if (map.containsKey(i)) {
|
||||
jComponents[i] = new JComboBox<>(map.get(i));
|
||||
} else {
|
||||
jComponents[i] = new JTextField(14);
|
||||
}
|
||||
jLabels[i] = new JLabel(enLabelName[i]);
|
||||
}
|
||||
System.out.println("In house :" + inHouse);
|
||||
for (String inhouse : inHouse) {
|
||||
if (inhouse.equals("In-House Production")) {
|
||||
((JComboBox) jComponents[enLabelName.length - 2]).setSelectedItem("In-House Production");
|
||||
}
|
||||
}
|
||||
for (String ea : eas) {
|
||||
if (ea.equals("EA")) {
|
||||
((JComboBox) jComponents[enLabelName.length - 3]).setSelectedItem("EA");
|
||||
}
|
||||
}
|
||||
ProductsCreateFrame action = new ProductsCreateFrame(application, "Create materials", "material", jLabels,
|
||||
jComponents, prop, lovMap);
|
||||
|
||||
new Thread(action).start();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
package com.connor.ferrorTech.metal.material.semiFinishedProducts;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
|
||||
import com.connor.ferrorTech.metal.material.finishedProducts.ProductsCreateFrame;
|
||||
import com.connor.ferrorTech.metal.util.SwingUtil;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
|
||||
public class SemiFinishedProductsCreateHandler extends AbstractHandler {
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
AbstractAIFApplication application = AIFUtility.getCurrentApplication();
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
String[] chLabelName = new String[] { "物料编码", "物料名称", "客户图号", "材质", "规格", "零件尺寸", "材料尺寸", "表面要求", "切割方式",
|
||||
"计量单位", "计划默认属性", "备注" };
|
||||
String[] enLabelName = new String[] { "Material code", "Material name", "Customer drawing number", "Material",
|
||||
"Specification", "Part size", "Material size", "Surface requirements", "Cutting method",
|
||||
"Unit", "Plan default attributes", "Remarks" };
|
||||
|
||||
String[] prop = new String[] { "vf5wlbm", "object_name", "vf5khth", "vf5cz", "vf5gg", "vf5ljcc", "vf5clcc",
|
||||
"vf5bmyq", "vf5qgfs", "vf5dw", "vf5jhmrsx", "vf5beizhu" };
|
||||
|
||||
JLabel[] jLabels = new JLabel[enLabelName.length];
|
||||
JComponent[] jComponents = new JComponent[enLabelName.length];
|
||||
Map<String, Map<String, String>> lovMap = new HashMap<String, Map<String, String>>();
|
||||
Map<Integer, String[]> map = new HashMap<>();
|
||||
String[] inHouse = SwingUtil.getKeyValue("VF5dwlov", lovMap);
|
||||
String[] eas = SwingUtil.getKeyValue("VF5jhmrsx", lovMap);
|
||||
map.put(enLabelName.length - 3, inHouse);
|
||||
map.put(enLabelName.length - 2, eas);
|
||||
|
||||
for (int i = 0; i < enLabelName.length; i++) {
|
||||
if (map.containsKey(i)) {
|
||||
jComponents[i] = new JComboBox<>(map.get(i));
|
||||
} else {
|
||||
jComponents[i] = new JTextField(14);
|
||||
}
|
||||
jLabels[i] = new JLabel(enLabelName[i]);
|
||||
}
|
||||
System.out.println("In house :" + inHouse);
|
||||
for (String inhouse : inHouse) {
|
||||
if (inhouse.equals("In-House Production")) {
|
||||
((JComboBox) jComponents[enLabelName.length - 2]).setSelectedItem("In-House Production");
|
||||
}
|
||||
}
|
||||
for (String ea : eas) {
|
||||
if (ea.equals("EA")) {
|
||||
((JComboBox) jComponents[enLabelName.length - 3]).setSelectedItem("EA");
|
||||
}
|
||||
}
|
||||
|
||||
ProductsCreateFrame action = new ProductsCreateFrame(application, "Create semi-finished products",
|
||||
"semiFinishedProducts", jLabels, jComponents, prop, lovMap);
|
||||
|
||||
new Thread(action).start();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.connor.ferrorTech.metal.materialManage;
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
|
||||
|
||||
public class DbomTransitionToEbomHandler extends AbstractHandler {
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
// TODO Auto-generated method stub
|
||||
AbstractAIFApplication app = AIFUtility.getCurrentApplication();
|
||||
TCSession session = (TCSession) app.getSession();
|
||||
try {
|
||||
DbomTransitionToEbomCommand command = new DbomTransitionToEbomCommand(app.getTargetComponent(),session);
|
||||
command.executeModal();
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
package com.connor.ferrorTech.metal.materialManage;
|
||||
|
||||
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 JTreeTable extends JXTreeTable {
|
||||
|
||||
|
||||
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 JTreeTable(JTreeTableModel testTreeTableModel) {
|
||||
// TODO Auto-generated constructor stub
|
||||
super(testTreeTableModel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCellEditable(int arg0, int arg1) {
|
||||
// TODO Auto-generated method stub
|
||||
return true;//super.isCellEditable(arg0, arg1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableCellEditor getCellEditor(int row, int column) {
|
||||
// TODO 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) {
|
||||
// TODO Auto-generated method stub
|
||||
if(this.getValueAt(row, 2) != null && (this.getValueAt(row, 2).toString().equals("0") || this.getValueAt(row, 2).toString().equals("1")) && column == 2)
|
||||
{
|
||||
return checkboxRenderer;
|
||||
}
|
||||
else
|
||||
{
|
||||
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,117 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.connor.ferrorTech.metal.materialManage;
|
||||
|
||||
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 JTreeTableModel extends DefaultTreeTableModel {
|
||||
|
||||
private String[] _names = { "DBOM对象", "EBOM对象","选中", "EBOMID", "物料描述","数量","发布状态","对应父节点"};
|
||||
|
||||
|
||||
private List<Integer> isNotEditableRow;
|
||||
|
||||
|
||||
|
||||
public JTreeTableModel(TreeTableNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
|
||||
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 NodeBean) {
|
||||
NodeBean bean = (NodeBean) o;
|
||||
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,87 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.connor.ferrorTech.metal.materialManage;
|
||||
|
||||
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author vearn
|
||||
*/
|
||||
public class NodeBean {
|
||||
|
||||
private String dbom;//对象ID
|
||||
private String dId; //dBOMID
|
||||
private String ebom;//对象名称
|
||||
private TCComponentItemRevision eRevision;//eBOm版本对象
|
||||
private String ebomId;//对象名称
|
||||
private String ebomDesc;//物料描述
|
||||
private String num;//数量
|
||||
private String label;//对象名称
|
||||
private String refreshStatus;//发布状态
|
||||
private String parentString;//对应父节点
|
||||
|
||||
public TCComponentItemRevision geteRevision() {
|
||||
return eRevision;
|
||||
}
|
||||
public void seteRevision(TCComponentItemRevision eRevision) {
|
||||
this.eRevision = eRevision;
|
||||
}
|
||||
public String getdId() {
|
||||
return dId;
|
||||
}
|
||||
public void setdId(String dId) {
|
||||
this.dId = dId;
|
||||
}
|
||||
public String getDbom() {
|
||||
return dbom;
|
||||
}
|
||||
public void setDbom(String dbom) {
|
||||
this.dbom = dbom;
|
||||
}
|
||||
public String getEbom() {
|
||||
return ebom;
|
||||
}
|
||||
public void setEbom(String ebom) {
|
||||
this.ebom = ebom;
|
||||
}
|
||||
public String getEbomId() {
|
||||
return ebomId;
|
||||
}
|
||||
public void setEbomId(String ebomId) {
|
||||
this.ebomId = ebomId;
|
||||
}
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
public String getRefreshStatus() {
|
||||
return refreshStatus;
|
||||
}
|
||||
public void setRefreshStatus(String refreshStatus) {
|
||||
this.refreshStatus = refreshStatus;
|
||||
}
|
||||
public String getParentString() {
|
||||
return parentString;
|
||||
}
|
||||
public void setParentString(String parentString) {
|
||||
this.parentString = parentString;
|
||||
}
|
||||
public String getNum() {
|
||||
return num;
|
||||
}
|
||||
public void setNum(String num) {
|
||||
this.num = num;
|
||||
}
|
||||
public String getEbomDesc() {
|
||||
return ebomDesc;
|
||||
}
|
||||
public void setEbomDesc(String ebomDesc) {
|
||||
this.ebomDesc = ebomDesc;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
package com.connor.ferrorTech.metal.materialManage;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.EventListenerList;
|
||||
import javax.swing.table.TableCellRenderer;
|
||||
|
||||
|
||||
public class TableCellCheckboxRenderer extends JCheckBox implements
|
||||
TableCellRenderer {
|
||||
private List<Integer> processRows;
|
||||
protected EventListenerList listenerList = new EventListenerList();
|
||||
protected ChangeEvent changeEvent = new ChangeEvent(this);
|
||||
//private TestTreeTableModel tableModel;
|
||||
|
||||
public List<Integer> getProcessRows() {
|
||||
return processRows;
|
||||
}
|
||||
|
||||
public void setProcessRows(List<Integer> processRows) {
|
||||
this.processRows = processRows;
|
||||
|
||||
}
|
||||
|
||||
public TableCellCheckboxRenderer(final JTreeTable table) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(JTable table, Object value,
|
||||
boolean isSelected, boolean hasFocus, int row, int column) {
|
||||
// TODO Auto-generated method stub
|
||||
this.setHorizontalAlignment(SwingConstants.CENTER);// ±íÍ·±êÇ©¾çÖÐ
|
||||
this.setBorderPainted(true);
|
||||
|
||||
if(value != null)
|
||||
{
|
||||
// if(value.toString().equals("1"))
|
||||
// {
|
||||
// if(table.getColumnName(column).equals("¸ÄÖÆ") && hasFocus)
|
||||
// {
|
||||
// if(table.getValueAt(row, column + 1).toString().equals("1"))
|
||||
// {
|
||||
// table.setValueAt(0, row, column + 1);
|
||||
// }
|
||||
// }
|
||||
// else if(table.getColumnName(column).equals("ɾ³ý") && hasFocus)
|
||||
// {
|
||||
// if(table.getValueAt(row, column - 1).toString().equals("1"))
|
||||
// {
|
||||
// table.setValueAt(0, row, column - 1);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if(value.toString().equals("1"))
|
||||
// {
|
||||
// System.out.println(value.toString().equals("1") + "====");
|
||||
// }
|
||||
this.setSelected(value.toString().equals("1"));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.setSelected(false);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package com.connor.ferrorTech.metal.processManagement.classificationCraft;
|
||||
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
import com.teamcenter.rac.kernel.TCClassificationService;
|
||||
import com.teamcenter.rac.kernel.TCException;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
import com.teamcenter.rac.kernel.ics.ICSAdminClass;
|
||||
import com.teamcenter.rac.kernel.ics.ICSSearchResult;
|
||||
|
||||
|
||||
|
||||
public class ClassificationCraftHandler extends AbstractHandler {
|
||||
|
||||
private static final String PREFERNCER = "VF5TYPICAL_GY_LIB";
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
|
||||
AbstractAIFApplication application = AIFUtility.getCurrentApplication();
|
||||
|
||||
JLabel[] jLabels = new JLabel[]{new JLabel("Technical ID"), new JLabel("Technical Name")};
|
||||
JComponent[] jComponents = new JComponent[]{new JTextField(10),new JTextField(10)};
|
||||
String[][] data = null;
|
||||
try {
|
||||
data = getClassificationData(application);
|
||||
} catch (TCException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
ClassificationCraftDialog dialog = new ClassificationCraftDialog(application,"Process Routing Library", jLabels, jComponents,data);
|
||||
new Thread(dialog).start();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public String[][] getClassificationData(AbstractAIFApplication application) throws TCException {
|
||||
TCSession tcSession = (TCSession)application.getSession();
|
||||
String classifyId = tcSession.getPreferenceService().getStringValue(PREFERNCER);
|
||||
System.out.println("classifyId = " + classifyId);
|
||||
|
||||
TCClassificationService classificationService = tcSession.getClassificationService();
|
||||
|
||||
ICSAdminClass c = classificationService.newICSAdminClass();
|
||||
c.load(classifyId);
|
||||
ICSSearchResult[] results = classificationService.searchICOs(classifyId, null, 0);
|
||||
|
||||
String[][] data = new String[results.length][2];
|
||||
for (int i = 0; i < results.length; i++) {
|
||||
String uid = results[i].getWsoUid();
|
||||
data[i][0] = uid;
|
||||
data[i][1] = results[i].getIcoId() +":" +tcSession.stringToComponent(uid).getStringProperty("object_name");
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,165 @@
|
||||
package com.connor.ferrorTech.metal.processManagement.classificationCraft;
|
||||
|
||||
import java.awt.Frame;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.connor.ferrorTech.metal.exception.CustomException;
|
||||
import com.connor.ferrorTech.metal.util.TcUtil;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aif.AbstractAIFOperation;
|
||||
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
|
||||
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
||||
import com.teamcenter.rac.kernel.DeepCopyInfo;
|
||||
import com.teamcenter.rac.kernel.TCComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponentBOMLine;
|
||||
import com.teamcenter.rac.kernel.TCComponentBOMWindow;
|
||||
import com.teamcenter.rac.kernel.TCComponentBOMWindowType;
|
||||
import com.teamcenter.rac.kernel.TCComponentFolder;
|
||||
import com.teamcenter.rac.kernel.TCComponentItem;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemType;
|
||||
import com.teamcenter.rac.kernel.TCException;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
import com.teamcenter.rac.util.MessageBox;
|
||||
|
||||
public class ClassificationCraftOperation extends AbstractAIFOperation {
|
||||
|
||||
private AbstractAIFApplication application;
|
||||
private TCSession tcSession;
|
||||
private String[] uid;
|
||||
|
||||
private TCComponentItemRevision targetRev;
|
||||
|
||||
public ClassificationCraftOperation(AbstractAIFApplication application, String[] itemUid) {
|
||||
this.application = application;
|
||||
this.tcSession = (TCSession) application.getSession();
|
||||
this.uid = itemUid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executeOperation() throws Exception {
|
||||
TCComponentFolder targetFolder = getTargetFolder();
|
||||
if (targetFolder != null) {
|
||||
TCComponent[] referenceValueArray = targetRev.getTCProperty("IMAN_master_form_rev")
|
||||
.getReferenceValueArray();
|
||||
String name = referenceValueArray[0].getStringProperty("object_name");
|
||||
TCComponentItemType component = (TCComponentItemType) tcSession.getTypeComponent("VF5gy");
|
||||
TCComponentItem item = component.create(component.getNewID(), "", "VF5gy", name, "", null);
|
||||
TCComponentItemRevision gyItemRev = item.getLatestItemRevision();
|
||||
targetFolder.add("contents", item);
|
||||
|
||||
TCComponentItemRevision targetComponent = (TCComponentItemRevision)application.getTargetComponent();
|
||||
targetComponent.add("VF5gygx", item);
|
||||
gyItemRev.add("IMAN_METarget", targetComponent);
|
||||
setReference(gyItemRev, uid);
|
||||
} else {
|
||||
MessageBox.post("Currently, no folder named POR was found !", "error", MessageBox.ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
public TCComponentFolder getTargetFolder() throws TCException {
|
||||
System.out.println("开始获取target文件夹");
|
||||
InterfaceAIFComponent targetComponent = this.application.getTargetComponent();
|
||||
String type = targetComponent.getType();
|
||||
targetRev = (TCComponentItemRevision) targetComponent;
|
||||
|
||||
TCComponentFolder targetFolder = (TCComponentFolder) TcUtil.getLastReferenced(targetRev.getItem(), "Folder","Item");
|
||||
if(targetFolder!=null) {
|
||||
targetFolder = (TCComponentFolder) TcUtil.getLastReferenced(targetFolder, "VF5xmwjj","Folder");
|
||||
}else {
|
||||
MessageBox.post("The current parent Folder is not referenced !", "error", MessageBox.ERROR);
|
||||
}
|
||||
|
||||
if (targetFolder != null) {
|
||||
TCComponent[] valueArray = targetFolder.getTCProperty("contents").getReferenceValueArray();
|
||||
for (TCComponent tcComponent : valueArray) {
|
||||
if (tcComponent instanceof TCComponentFolder
|
||||
&& tcComponent.getStringProperty("object_name").equals("POR")) {
|
||||
return (TCComponentFolder) tcComponent;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
System.out.println("targetFolder is null");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setReference(TCComponentItemRevision gyItemRev, String[] itemUid) throws TCException {
|
||||
TCComponentBOMWindowType winType = (TCComponentBOMWindowType) tcSession.getTypeComponent("BOMWindow");
|
||||
TCComponentBOMWindow view = winType.create(null);
|
||||
TCComponentBOMWindow newView = winType.create(null);
|
||||
newView.lock();
|
||||
|
||||
String[] formProp = new String[] {
|
||||
"vf5zbsj","vf5zbsjdw","vf5jqsj","vf5jqsjdw","vf5rgsj","vf5rgsjdw","vf5fjfy","vf5fjfydw"
|
||||
};
|
||||
String[] bomProp = new String[] {
|
||||
"VF5zbsj","VF5zbsjdw","VF5jqsj","VF5jqsjdw","VF5rgsj","VF5rgsjdw","VF5fjfy","VF5fjfydw"
|
||||
};
|
||||
// 新的工艺对象顶层Bom
|
||||
TCComponentBOMLine newTopBomLine = newView.setWindowTopLine(gyItemRev.getItem(),gyItemRev, null, null);
|
||||
if (itemUid != null) {
|
||||
TCComponent[] tcComponents = tcSession.stringToComponent(itemUid);
|
||||
for (TCComponent tcComponent : tcComponents) {
|
||||
TCComponentItem gyItem = null;
|
||||
TCComponentItemRevision gyRev = null;
|
||||
|
||||
System.out.println("当前item: "+tcComponent.getStringProperty("object_name"));
|
||||
if(tcComponent instanceof TCComponentItem) {
|
||||
System.out.println("is TCComponentItem");
|
||||
gyItem = (TCComponentItem) tcComponent;
|
||||
gyRev = gyItem.getLatestItemRevision();
|
||||
}else if(tcComponent instanceof TCComponentItemRevision) {
|
||||
System.out.println("is TCComponentItemRevision");
|
||||
gyRev = (TCComponentItemRevision)tcComponent;
|
||||
gyItem = gyRev.getItem();
|
||||
}
|
||||
|
||||
TCComponentBOMLine bomLine = null;
|
||||
if(gyItem != null && gyRev != null) {
|
||||
bomLine = view.setWindowTopLine(gyItem,gyRev, null, null);
|
||||
}else {
|
||||
throw new CustomException("tcItem or tcItemRev is null");
|
||||
}
|
||||
|
||||
boolean hasChildren = bomLine.hasChildren();
|
||||
if (hasChildren) {
|
||||
AIFComponentContext[] childrenBomLines = bomLine.getChildren();
|
||||
|
||||
System.out.println("begin copy bom !");
|
||||
// 遍历分类库选中的gx Bom对象
|
||||
for (AIFComponentContext children : childrenBomLines) {
|
||||
// 强转为TCComponentBOMLine类型
|
||||
TCComponentBOMLine component = (TCComponentBOMLine) children.getComponent();
|
||||
TCComponentItemRevision oldGxRev = component.getItemRevision();
|
||||
|
||||
String name = oldGxRev.getStringProperty("object_name");
|
||||
TCComponentItemType gxType = (TCComponentItemType) this.tcSession
|
||||
.getTypeComponent(oldGxRev.getItem().getStringProperty("object_type"));
|
||||
TCComponentItem newGxItem = oldGxRev.saveAsItem(gxType.getNewID(), "", name, "", true,
|
||||
(DeepCopyInfo[]) null);
|
||||
|
||||
TCComponentBOMLine newBomLine = newTopBomLine.add(newGxItem,newGxItem.getLatestItemRevision(),null,false,"");
|
||||
|
||||
TCComponent oldGxRevForm = oldGxRev.getRelatedComponent("IMAN_master_form_rev");
|
||||
for (int j = 0; j < formProp.length; j++) {
|
||||
String prop = oldGxRevForm.getStringProperty(formProp[j]);
|
||||
System.out.println(bomProp[j] + " : "+prop);
|
||||
newBomLine.setProperty(bomProp[j], prop);
|
||||
}
|
||||
|
||||
}
|
||||
}else {
|
||||
System.out.println("Currently, BomLine has no children");
|
||||
}
|
||||
}
|
||||
newView.save();
|
||||
newView.unlock();
|
||||
newView.close();
|
||||
MessageBox.post("Created Successfully !", "Info", MessageBox.INFORMATION);
|
||||
} else {
|
||||
MessageBox.post("Currently no process object selected !", "Info", MessageBox.INFORMATION);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,250 @@
|
||||
package com.connor.ferrorTech.metal.processManagement.classificationProcesses;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.DefaultTableCellRenderer;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import javax.swing.table.TableColumnModel;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.connor.ferrorTech.metal.constant.ConstantPool;
|
||||
import com.connor.ferrorTech.metal.exception.CustomException;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponentBOMLine;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||
import com.teamcenter.rac.kernel.TCException;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
|
||||
public class ClassificationProcessesDialog extends JFrame implements Runnable {
|
||||
|
||||
private AbstractAIFApplication application;
|
||||
private TCSession tcSession;
|
||||
|
||||
private final String title;
|
||||
private final String subtitle;
|
||||
|
||||
private JLabel[] jLabels;
|
||||
private JComponent[] jComponents;
|
||||
|
||||
private JButton searchButton;
|
||||
private JButton okButton;
|
||||
private JButton cancelButton;
|
||||
|
||||
private String[] columnNames;
|
||||
private String[][] data;
|
||||
private JTable table;
|
||||
|
||||
public ClassificationProcessesDialog(AbstractAIFApplication application, String title, Object... args) {
|
||||
this.application = application;
|
||||
this.tcSession = (TCSession) this.application.getSession();
|
||||
|
||||
this.subtitle = "Process List";
|
||||
int count = 0;
|
||||
this.title = title;
|
||||
this.jLabels = (JLabel[]) args[count++];
|
||||
this.jComponents = (JComponent[]) args[count++];
|
||||
this.columnNames = (String[]) args[count++];
|
||||
this.data = (String[][]) args[count];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
// TODO Auto-generated method stub
|
||||
InterfaceAIFComponent targetComponent = this.application.getTargetComponent();
|
||||
TCComponentItemRevision tempComponentRev = null;
|
||||
if (targetComponent instanceof TCComponentBOMLine) {
|
||||
tempComponentRev = ((TCComponentBOMLine) targetComponent).getItemRevision();
|
||||
} else if (targetComponent instanceof TCComponentItemRevision) {
|
||||
tempComponentRev = (TCComponentItemRevision) targetComponent;
|
||||
} else {
|
||||
throw new CustomException("Please Select The Correct Version !");
|
||||
}
|
||||
|
||||
if (tempComponentRev.getStringProperty("object_type").equals("VF5gyRevision")) {
|
||||
initUI();
|
||||
} else {
|
||||
JOptionPane.showMessageDialog(null, "Incorrect version!", "Error", JOptionPane.WARNING_MESSAGE);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
JOptionPane.showMessageDialog(null, e.getMessage(), "Error", JOptionPane.WARNING_MESSAGE);
|
||||
}
|
||||
}
|
||||
|
||||
public TCComponentBOMLine judgeSingleSelectRevision(AbstractAIFApplication application, String[] revType) {
|
||||
InterfaceAIFComponent targetComponent = application.getTargetComponent();
|
||||
try {
|
||||
TCComponentItemRevision tempComponentRev = null;
|
||||
if (targetComponent instanceof TCComponentBOMLine) {
|
||||
tempComponentRev = ((TCComponentBOMLine) targetComponent).getItemRevision();
|
||||
} else if (targetComponent instanceof TCComponentItemRevision) {
|
||||
tempComponentRev = (TCComponentItemRevision) targetComponent;
|
||||
} else {
|
||||
throw new CustomException("Please Select The Correct Version !");
|
||||
}
|
||||
|
||||
if (tempComponentRev != null && revType != null && revType.length > 0) {
|
||||
for (int i = 0; i < revType.length; i++) {
|
||||
if (tempComponentRev.getType().equals(revType[i])) {
|
||||
return (TCComponentBOMLine) targetComponent;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
System.out.println("tempComponentRev or revType is null !");
|
||||
}
|
||||
} catch (TCException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void initializationButton() {
|
||||
searchButton = new JButton(ConstantPool.EN_BUTTON_SEARCH);
|
||||
searchButton.setPreferredSize(new Dimension(80, 23));
|
||||
searchButton.addActionListener(e -> {
|
||||
searchList();
|
||||
});
|
||||
okButton = new JButton(ConstantPool.EN_BUTTON_CONFIRM);
|
||||
okButton.addActionListener(e -> {
|
||||
this.dispose();
|
||||
doTask();
|
||||
});
|
||||
cancelButton = new JButton(ConstantPool.EN_BUTTON_CANCEL);
|
||||
cancelButton.addActionListener(e -> {
|
||||
this.dispose();
|
||||
});
|
||||
}
|
||||
|
||||
public void initUI() {
|
||||
// 设置窗口居中
|
||||
this.setTitle(title);
|
||||
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
this.setSize(700, 500); // 设置窗口大小
|
||||
this.setLayout(new BorderLayout()); // 设置布局
|
||||
|
||||
initializationButton();
|
||||
|
||||
JPanel topPanel = createTopPanel();
|
||||
|
||||
JPanel centerPanel = createCenterPanel();
|
||||
|
||||
JPanel bottomPanel = createBottomPanel();
|
||||
|
||||
this.add(topPanel, BorderLayout.NORTH);
|
||||
this.add(centerPanel, BorderLayout.CENTER);
|
||||
this.add(bottomPanel, BorderLayout.SOUTH);
|
||||
|
||||
this.setLocationRelativeTo(null);
|
||||
this.setVisible(true);
|
||||
}
|
||||
|
||||
public JPanel createTopPanel() {
|
||||
JPanel topPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 10));
|
||||
|
||||
topPanel.add(jLabels[0]);
|
||||
topPanel.add(jComponents[0]);
|
||||
|
||||
topPanel.add(jLabels[1]);
|
||||
topPanel.add(jComponents[1]);
|
||||
topPanel.add(searchButton);
|
||||
return topPanel;
|
||||
}
|
||||
|
||||
public JPanel createCenterPanel() {
|
||||
JPanel centerPanel = new JPanel(new BorderLayout(10, 10));
|
||||
centerPanel.setBorder(BorderFactory.createTitledBorder(subtitle));
|
||||
centerPanel.setPreferredSize(new Dimension(400, 200));
|
||||
|
||||
table = new JTable(new DefaultTableModel(data, columnNames));
|
||||
table.setRowHeight(18);
|
||||
table.getTableHeader().setReorderingAllowed(false);
|
||||
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
|
||||
|
||||
TableColumnModel columnModel = table.getColumnModel();
|
||||
for (int i = 0; i < columnModel.getColumnCount(); i++) {
|
||||
columnModel.getColumn(i).setPreferredWidth(100); // 设置每列的宽度为120像素
|
||||
}
|
||||
|
||||
table.removeColumn(columnModel.getColumn(columnModel.getColumnCount() - 1));
|
||||
|
||||
DefaultTableCellRenderer centerRenderer = new DefaultTableCellRenderer() {
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
|
||||
boolean hasFocus, int row, int column) {
|
||||
Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
|
||||
((JLabel) c).setHorizontalAlignment(SwingConstants.CENTER); // 设置文本居中对齐
|
||||
return c;
|
||||
}
|
||||
};
|
||||
|
||||
for (int i = 0; i < columnModel.getColumnCount(); i++) {
|
||||
columnModel.getColumn(i).setCellRenderer(centerRenderer);
|
||||
}
|
||||
|
||||
JScrollPane scrollPane = new JScrollPane(table);
|
||||
scrollPane.setPreferredSize(new Dimension(400, 150));
|
||||
centerPanel.add(scrollPane, BorderLayout.CENTER);
|
||||
return centerPanel;
|
||||
}
|
||||
|
||||
public JPanel createBottomPanel() {
|
||||
JPanel bottomPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 60, 10));
|
||||
bottomPanel.add(okButton);
|
||||
bottomPanel.add(cancelButton);
|
||||
return bottomPanel;
|
||||
}
|
||||
|
||||
public void searchList() {
|
||||
if (jComponents.length < 2) {
|
||||
throw new IllegalArgumentException("jComponents 数组长度不足");
|
||||
}
|
||||
|
||||
String processCode = ((JTextField) jComponents[0]).getText().trim();
|
||||
String technicalName = ((JTextField) jComponents[1]).getText().trim();
|
||||
|
||||
DefaultTableModel model = (DefaultTableModel) table.getModel();
|
||||
model.setRowCount(0); // 清空现有数据
|
||||
|
||||
if (data == null || data.length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (String[] rowData : data) {
|
||||
String code = Objects.toString(rowData[0], "");
|
||||
String name = Objects.toString(rowData[1], "");
|
||||
if (code.contains(processCode) && name.contains(technicalName)) {
|
||||
model.addRow(rowData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void doTask() {
|
||||
int[] selectedRows = table.getSelectedRows();
|
||||
|
||||
String[][] selectedData = new String[selectedRows.length][];
|
||||
if (selectedRows.length > 0) {
|
||||
DefaultTableModel model = (DefaultTableModel) table.getModel();
|
||||
for (int i = 0; i < selectedRows.length; i++) {
|
||||
String[] rowData = new String[model.getColumnCount()];
|
||||
for (int j = 0; j < model.getColumnCount(); j++) {
|
||||
rowData[j] = (String) model.getValueAt(selectedRows[i], j);
|
||||
}
|
||||
selectedData[i] = rowData;
|
||||
System.out.println("Selected Row Data: " + Arrays.toString(rowData));
|
||||
}
|
||||
|
||||
ClassificationProcessesOperation classificationProcessesOperation = new ClassificationProcessesOperation(
|
||||
application, selectedData);
|
||||
this.tcSession.queueExcludedOperation(classificationProcessesOperation);
|
||||
} else {
|
||||
System.out.println("No rows selected");
|
||||
}
|
||||
|
||||
this.dispose();
|
||||
}
|
||||
}
|
@ -0,0 +1,105 @@
|
||||
package com.connor.ferrorTech.metal.processManagement.classificationProcesses;
|
||||
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
import com.teamcenter.rac.kernel.TCClassificationService;
|
||||
import com.teamcenter.rac.kernel.TCComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponentForm;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||
import com.teamcenter.rac.kernel.TCException;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
import com.teamcenter.rac.kernel.ics.ICSAdminClass;
|
||||
import com.teamcenter.rac.kernel.ics.ICSSearchResult;
|
||||
|
||||
|
||||
/**
|
||||
* 分类库调用工序
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
public class ClassificationProcessesHandler extends AbstractHandler {
|
||||
|
||||
private static final String PREFERNCER = "VF5TYPICAL_GX_LIB";
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
|
||||
AbstractAIFApplication application = AIFUtility.getCurrentApplication();
|
||||
|
||||
JLabel[] labels = new JLabel[]{new JLabel("ID"), new JLabel("Name")};
|
||||
JComponent[] components = {new JTextField(14), new JTextField(14)};
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
String[] chColumnNames = new String[]{
|
||||
"ID", "名称","工序类型", "准备时间", "准备时间单位",
|
||||
"工作中心编码","机器时间","机器时间单位", "人工时间", "人工时间单位",
|
||||
"附加费用","附加费用单位",""
|
||||
};
|
||||
String[] enColumnNames = new String[]{
|
||||
"ID", "Name", "Operate type", "WorkCenterInternalI","Setup",
|
||||
"Setup Unit","Machine","Machine Unit", "Labor", "Labor Unit",
|
||||
"Production Overhead","Production Overhead Unit",""
|
||||
};
|
||||
String[][] data = null;
|
||||
try {
|
||||
String[] rowProp = {
|
||||
"item_id","object_name","vf5gxlx","vf5gzzxsj","vf5zbsj",
|
||||
"vf5zbsjdw","vf5jqsj","vf5jqsjdw","vf5rgsj","vf5rgsjdw",
|
||||
"vf5fjfy","vf5fjfydw"
|
||||
};
|
||||
data = getPreference(application,rowProp);
|
||||
} catch (TCException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
ClassificationProcessesDialog dialog = new ClassificationProcessesDialog(
|
||||
application,"Operation Library",labels,components,enColumnNames,data);
|
||||
new Thread(dialog).start();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public String[][] getPreference(AbstractAIFApplication application,String[] rowProp) throws TCException {
|
||||
TCSession tcSession = (TCSession)application.getSession();
|
||||
String classifyId = tcSession.getPreferenceService().getStringValue(PREFERNCER);
|
||||
System.out.println("classifyId = " + classifyId);
|
||||
|
||||
TCClassificationService classificationService = tcSession.getClassificationService();
|
||||
|
||||
ICSAdminClass c = classificationService.newICSAdminClass();
|
||||
c.load(classifyId);
|
||||
ICSSearchResult[] results = classificationService.searchICOs(classifyId, null, 0);
|
||||
|
||||
String[][] tableData = new String[results.length][];
|
||||
int rowIndex = 0;
|
||||
for (ICSSearchResult result : results) {
|
||||
String[] rowData = new String[rowProp.length+1];
|
||||
String wsoUid = result.getWsoUid();
|
||||
|
||||
InterfaceAIFComponent targetInstance = tcSession.stringToComponent(wsoUid);
|
||||
if(targetInstance instanceof TCComponentItemRevision) {
|
||||
TCComponentItemRevision tempRev = (TCComponentItemRevision)targetInstance;
|
||||
TCComponent[] referenceValueArray = tempRev.getTCProperty("IMAN_master_form_rev").getReferenceValueArray();
|
||||
TCComponentForm itemForm = (TCComponentForm)referenceValueArray[0];
|
||||
rowData[0] = tempRev.getStringProperty(rowProp[0]);
|
||||
rowData[1] = tempRev.getStringProperty(rowProp[1]);
|
||||
for (int i = 2; i < rowProp.length; i++) {
|
||||
rowData[i] = itemForm.getStringProperty(rowProp[i]);
|
||||
}
|
||||
rowData[rowProp.length] = wsoUid;
|
||||
tableData[rowIndex++] = rowData;
|
||||
}
|
||||
}
|
||||
return tableData;
|
||||
}
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue