@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry exported="true" kind="lib" path="lib/xz-1.8.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/commons-compress-1.20.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/zip4j-1.3.2.jar" sourcepath="C:/Users/ADMINI~1/AppData/Local/Temp/.org.sf.feeling.decompiler1600934136321/source/zip4j-1.3.2-sources.jar"/>
|
||||
<classpathentry kind="lib" path="lib/ojdbc6.jar"/>
|
||||
<classpathentry kind="lib" path="lib/dom4j-1.6.1.jar"/>
|
||||
<classpathentry kind="lib" path="lib/groovy-all-2.4.7.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
@ -0,0 +1 @@
|
||||
/bin/
|
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>cn.net.connor.process</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
@ -0,0 +1,7 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding//src/cn/net/connor/process/Processknowledgebase=GBK
|
||||
encoding//src/cn/net/connor/process/commands/OpenPCBCommand3.java=UTF-8
|
||||
encoding//src/cn/net/connor/process/hourcalculation=GBK
|
||||
encoding//src/cn/net/connor/process/meopviewfx/ui/TableLoader.java=UTF-8
|
||||
encoding//src/cn/net/connor/process/newprocess/NewProcessDialogController.java=UTF-8
|
||||
encoding//src/cn/net/connor/process/processview=GBK
|
@ -0,0 +1,7 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
@ -0,0 +1,59 @@
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Process
|
||||
Bundle-SymbolicName: cn.net.connor.process;singleton:=true
|
||||
Bundle-Version: 1.0.0
|
||||
Bundle-Activator: cn.net.connor.process.Activator
|
||||
Eclipse-RegisterBuddy: k.util
|
||||
Require-Bundle: org.eclipse.ui,
|
||||
org.eclipse.core.runtime,
|
||||
com.teamcenter.rac.aifrcp,
|
||||
com.teamcenter.rac.common,
|
||||
com.teamcenter.rac.external,
|
||||
com.teamcenter.rac.kernel,
|
||||
com.teamcenter.rac.tcapps,
|
||||
com.teamcenter.rac.ui,
|
||||
com.teamcenter.rac.ui.commands,
|
||||
com.teamcenter.rac.util,
|
||||
k.util;bundle-version="1.0.0",
|
||||
com.teamcenter.rac.cme.mpp,
|
||||
TcSoaCoreRac,
|
||||
TcSoaCoreTypes,
|
||||
com.teamcenter.rac.pse,
|
||||
org.apache.poi.39;bundle-version="3.9.0",
|
||||
org.apache.commons.io;bundle-version="1.4.0",
|
||||
TcSoaWorkflowRac
|
||||
Automatic-Module-Name: cn.net.connor.process
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Export-Package: cn.net.connor.process,
|
||||
cn.net.connor.process.choose,
|
||||
cn.net.connor.process.commands,
|
||||
cn.net.connor.process.gcjlk,
|
||||
cn.net.connor.process.gzbomexport,
|
||||
cn.net.connor.process.meopmodel,
|
||||
cn.net.connor.process.meopviewfx,
|
||||
cn.net.connor.process.meopviewfx.bean,
|
||||
cn.net.connor.process.meopviewfx.dialog,
|
||||
cn.net.connor.process.meopviewfx.ui,
|
||||
cn.net.connor.process.modifymeopno,
|
||||
cn.net.connor.process.newmeop,
|
||||
cn.net.connor.process.newprocess,
|
||||
cn.net.connor.process.openpcb,
|
||||
cn.net.connor.process.processcard,
|
||||
cn.net.connor.process.processcardmultiple,
|
||||
cn.net.connor.process.processprocedure,
|
||||
cn.net.connor.process.processview,
|
||||
cn.net.connor.process.proctask,
|
||||
cn.net.connor.process.revisemeprocess,
|
||||
cn.net.connor.process.tsgcexport,
|
||||
cn.net.connor.process.tsgcrefexport,
|
||||
cn.net.connor.process.workflowname,
|
||||
com.teamcenter.rac.kernel
|
||||
Bundle-ClassPath: .,
|
||||
lib/zip4j-1.3.2.jar,
|
||||
lib/commons-compress-1.20.jar,
|
||||
lib/xz-1.8.jar,
|
||||
lib/ojdbc6.jar,
|
||||
lib/groovy-all-2.4.7.jar
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Import-Package: com.teamcenter.rac.kernel
|
@ -0,0 +1,14 @@
|
||||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = plugin.xml,\
|
||||
META-INF/,\
|
||||
.,\
|
||||
lib/zip4j-1.3.2.jar,\
|
||||
lib/commons-compress-1.20.jar,\
|
||||
lib/xz-1.8.jar,\
|
||||
lib/ojdbc6.jar,\
|
||||
jars.compile.order = .,\
|
||||
lib/ojdbc6.jar,\
|
||||
lib/groovy-all-2.4.7.jar,\
|
||||
icons/
|
||||
source.lib/ojdbc6.jar = src/
|
After Width: | Height: | Size: 942 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 727 B |
After Width: | Height: | Size: 474 B |
After Width: | Height: | Size: 332 B |
After Width: | Height: | Size: 526 B |
After Width: | Height: | Size: 889 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.1 KiB |
@ -0,0 +1,589 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
<extension point="org.eclipse.ui.views">
|
||||
<category id="cn.net.connor.process.view" name="工艺视图"/>
|
||||
<view
|
||||
category="cn.net.connor.process.view"
|
||||
closable="true"
|
||||
allowMultiple="false"
|
||||
icon="icons/meprocess_16.png"
|
||||
class="cn.net.connor.process.processview.ProcessPropertyView"
|
||||
id="cn.net.connor.process.processview.ProcessPropertyView"
|
||||
name="工艺工序编辑">
|
||||
</view>
|
||||
<view
|
||||
category="cn.net.connor.process.view"
|
||||
closable="true"
|
||||
allowMultiple="false"
|
||||
icon="icons/meoperation_16.png"
|
||||
class="cn.net.connor.process.meopviewfx.MEOPEditView"
|
||||
id="cn.net.connor.process.meopview.MEOPEditView"
|
||||
name="工道编辑">
|
||||
</view>
|
||||
</extension>
|
||||
<extension point="com.teamcenter.rac.aifrcp.viewDefs">
|
||||
<view
|
||||
alwaysUseSetRootInputObject="true"
|
||||
autoCloseEnabled="true"
|
||||
folderId="RAC_Folder_UR"
|
||||
id="cn.net.connor.process.processview.ProcessPropertyView"
|
||||
selectionInPrimaryEffectsInvisbleSecondary="false"
|
||||
selectionInSecondaryEffectsPrimary="false"
|
||||
type="secondary">
|
||||
</view>
|
||||
<view
|
||||
alwaysUseSetRootInputObject="true"
|
||||
autoCloseEnabled="true"
|
||||
folderId="RAC_Folder_UR"
|
||||
id="cn.net.connor.process.meopview.MEOPEditView"
|
||||
selectionInPrimaryEffectsInvisbleSecondary="false"
|
||||
selectionInSecondaryEffectsPrimary="false"
|
||||
type="secondary">
|
||||
</view>
|
||||
</extension>
|
||||
<extension point="org.eclipse.ui.commands">
|
||||
<command name="Test" id="cn.net.connor.process.commands.TestCommand"/>
|
||||
<command name="创建工艺" id="cn.net.connor.process.commands.NewProcessCommand"/>
|
||||
<command name="创建工序" id="cn.net.connor.process.commands.NewMeopCommand"/>
|
||||
<command name="修改工序号" id="cn.net.connor.process.commands.ModifyMeopNoCommand"/>
|
||||
<command name="工装BOM明细表" id="cn.net.connor.process.commands.GZBomExportCommand"/>
|
||||
<command name="生成工艺卡片" id="cn.net.connor.process.commands.ProcessCardCommand"/>
|
||||
<command name="A3幅面附表" id="cn.net.connor.process.commands.ProcessCardCommand#Connor_AVIC_GYKPSC_CATE_A3_"/>
|
||||
<command name="A4幅面附表" id="cn.net.connor.process.commands.ProcessCardCommand#Connor_AVIC_GYKPSC_CATE_A4_"/>
|
||||
<command name="生成工艺规程" id="cn.net.connor.process.commands.ProcessProcedureCommand"/>
|
||||
<command name="材料试件编辑" id="cn.net.connor.process.commands.EditItemCommand"/>
|
||||
<command name="在AD中打开" id="cn.net.connor.process.commands.OpenPCBCommand3"/>
|
||||
<command name="内部截图" id="cn.net.connor.process.commands.ScreenShotCommand"/>
|
||||
<command name="外部截图" id="cn.net.connor.process.commands.ScreenShotCommand#true"/>
|
||||
<command name="工艺分工" id="cn.net.connor.process.commands.ProcTaskCommand"/>
|
||||
<command name="流程名称提取" id="cn.net.connor.process.commands.WorkflowNameCommand"/>
|
||||
<command name="工艺工序编辑" id="cn.net.connor.process.commands.OpenViewCommand#cn.net.connor.process.processview.ProcessPropertyView"/>
|
||||
<command name="工道编辑" id="cn.net.connor.process.commands.OpenViewCommand#cn.net.connor.process.meopview.MEOPEditView"/>
|
||||
<command name="生成工序三维模型" id="cn.net.connor.process.commands.MeopModelCommand"/>
|
||||
<command name="通过产品查询特殊过程" id="cn.net.connor.process.commands.TSGCExportCommand"/>
|
||||
<command name="特殊过程被引用情况查询" id="cn.net.connor.process.commands.TSGCRefExportCommand"/>
|
||||
<command name="工艺升版" id="cn.net.connor.process.commands.ReviseMEProcessCommand"/>
|
||||
<command name="过程记录卡" id="cn.net.connor.process.commands.GCJLKCommand"/>
|
||||
<command name="工艺知识库" id="cn.net.connor.process.commands.GYZSKCommand"/>
|
||||
<command name="打开附件视图" id="cn.net.connor.process.commands.OpenViewCommand#com.teamcenter.rac.cme.attachments"/>
|
||||
</extension>
|
||||
<extension point="org.eclipse.ui.handlers">
|
||||
<handler commandId="cn.net.connor.process.commands.TestCommand" class="k.KHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.NewProcessCommand" class="k.KHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.NewMeopCommand" class="k.KHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.ModifyMeopNoCommand" class="k.KHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.GZBomExportCommand" class="k.KHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.ProcessCardCommand" class="k.KHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.ProcessCardCommand#Connor_AVIC_GYKPSC_CATE_A3_" class="k.KHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.ProcessCardCommand#Connor_AVIC_GYKPSC_CATE_A4_" class="k.KHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.ProcessProcedureCommand" class="k.KHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.ScreenShotCommand#true" class="k.KHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.ScreenShotCommand" class="k.KHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.EditItemCommand" class="k.KHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.OpenPCBCommand3" class="k.KHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.ProcTaskCommand" class="k.KHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.WorkflowNameCommand" class="k.KHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.OpenViewCommand#cn.net.connor.process.processview.ProcessPropertyView" class="k.KHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.OpenViewCommand#cn.net.connor.process.meopview.MEOPEditView" class="k.KHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.MeopModelCommand" class="k.KHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.TSGCExportCommand" class="k.KHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.TSGCRefExportCommand" class="k.KHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.ReviseMEProcessCommand" class="k.KHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.GCJLKCommand" class="k.KHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.GYZSKCommand" class="cn.net.connor.process.Processknowledgebase.SJJHHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.OpenViewCommand#com.teamcenter.rac.cme.attachments" class="k.KHandler"/>
|
||||
</extension>
|
||||
<extension point="org.eclipse.ui.bindings">
|
||||
<key
|
||||
commandId="cn.net.connor.process.commands.TestCommand"
|
||||
sequence="M3+D"
|
||||
schemeId="com.teamcenter.rac.scheme">
|
||||
</key>
|
||||
<key
|
||||
commandId="cn.net.connor.process.commands.NewProcessCommand"
|
||||
sequence="M3+B"
|
||||
schemeId="com.teamcenter.rac.scheme">
|
||||
</key>
|
||||
<key
|
||||
commandId="cn.net.connor.process.commands.NewMeopCommand"
|
||||
sequence="M3+C"
|
||||
schemeId="com.teamcenter.rac.scheme">
|
||||
</key>
|
||||
<key
|
||||
commandId="cn.net.connor.process.commands.EditItemCommand"
|
||||
sequence="M3+S"
|
||||
schemeId="com.teamcenter.rac.scheme">
|
||||
</key>
|
||||
<key
|
||||
commandId="cn.net.connor.process.commands.ModifyMeopNoCommand"
|
||||
sequence="M3+V"
|
||||
schemeId="com.teamcenter.rac.scheme">
|
||||
</key>
|
||||
<key
|
||||
commandId="cn.net.connor.process.commands.ReviseMEProcessCommand"
|
||||
sequence="M3+R"
|
||||
schemeId="com.teamcenter.rac.scheme">
|
||||
</key>
|
||||
<key
|
||||
commandId="cn.net.connor.process.commands.ProcessCardCommand"
|
||||
sequence="M3+N"
|
||||
schemeId="com.teamcenter.rac.scheme">
|
||||
</key>
|
||||
<key
|
||||
commandId="cn.net.connor.process.commands.ProcessProcedureCommand"
|
||||
sequence="M3+M"
|
||||
schemeId="com.teamcenter.rac.scheme">
|
||||
</key>
|
||||
<key
|
||||
commandId="cn.net.connor.process.commands.ProcessCardCommand#Connor_AVIC_GYKPSC_CATE_A3_"
|
||||
sequence="M3+J"
|
||||
schemeId="com.teamcenter.rac.scheme">
|
||||
</key>
|
||||
<key
|
||||
commandId="cn.net.connor.process.commands.ProcessCardCommand#Connor_AVIC_GYKPSC_CATE_A4_"
|
||||
sequence="M3+R"
|
||||
schemeId="com.teamcenter.rac.scheme">
|
||||
</key>
|
||||
<!--key
|
||||
commandId="cn.net.connor.process.commands.ScreenShotCommand"
|
||||
sequence="M3+U"
|
||||
schemeId="com.teamcenter.rac.scheme">
|
||||
</key>
|
||||
<key
|
||||
commandId="cn.net.connor.process.commands.ScreenShotCommand#true"
|
||||
sequence="M3+Y"
|
||||
schemeId="com.teamcenter.rac.scheme">
|
||||
</key-->
|
||||
<key
|
||||
commandId="cn.net.connor.process.commands.OpenViewCommand#com.teamcenter.rac.cme.attachments"
|
||||
sequence="M3+O"
|
||||
schemeId="com.teamcenter.rac.scheme">
|
||||
</key>
|
||||
</extension>
|
||||
<extension point="org.eclipse.ui.menus">
|
||||
<menuContribution locationURI="menu:org.eclipse.ui.main.menu?after=designMenu">
|
||||
<menu label="工艺管理" id="cn.net.connor.process.mainmenu">
|
||||
<separator name ="sp1" visible="false"/>
|
||||
<separator name ="sp2" visible="false"/>
|
||||
<separator name ="sp3" visible="false"/>
|
||||
<menu label="生成工艺卡" id="cn.net.connor.process.mainmenu.card"/>
|
||||
<menu label="生成工艺附表" id="cn.net.connor.process.mainmenu.gxfb"/>
|
||||
<separator name ="sp4" visible="false"/>
|
||||
<separator name ="sp5" visible="false"/>
|
||||
<menu label="工艺报表" id="cn.net.connor.process.mainmenu.gybb"/>
|
||||
<separator name ="sp6" visible="true"/>
|
||||
<menu label="截图工具" id="cn.net.connor.process.mainmenu.screenshot"/>
|
||||
</menu>
|
||||
<menu label="客户化功能" id="cn.net.connor.process.khhgn"/>
|
||||
<menu label="通用菜单" id="cn.net.connor.process.tycd"/>
|
||||
</menuContribution>
|
||||
<menuContribution locationURI="menu:cust.reportMenu.process?after=sp2">
|
||||
<command commandId="cn.net.connor.process.commands.GCJLKCommand" id="cn.net.connor.process.mainmenu.gybb.gcjlk">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<with variable="rac_command_suppression">
|
||||
<not>
|
||||
<iterate operator="or">
|
||||
<equals value="cn.net.connor.process.commands.GCJLKCommand"/>
|
||||
</iterate>
|
||||
</not>
|
||||
</with>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
<command commandId="cn.net.connor.process.commands.TSGCExportCommand" id="cn.net.connor.process.tycd.tsgcexport">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<with variable="rac_command_suppression">
|
||||
<not>
|
||||
<iterate operator="or">
|
||||
<equals value="cn.net.connor.process.commands.TSGCExportCommand"/>
|
||||
</iterate>
|
||||
</not>
|
||||
</with>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
|
||||
|
||||
|
||||
|
||||
<command commandId="cn.net.connor.process.commands.TSGCRefExportCommand" id="cn.net.connor.process.tycd.tsgcrefexport">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<with variable="rac_command_suppression">
|
||||
<not>
|
||||
<iterate operator="or">
|
||||
<equals value="cn.net.connor.process.commands.TSGCRefExportCommand"/>
|
||||
</iterate>
|
||||
</not>
|
||||
</with>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
</menuContribution>
|
||||
<!--menuContribution locationURI="menu:cn.net.connor.process.mainmenu.screenshot?after=additions">
|
||||
<command commandId="cn.net.connor.process.commands.ScreenShotCommand" id="cn.net.connor.process.mainmenu.screenshot.external">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<with variable="rac_command_suppression">
|
||||
<not>
|
||||
<iterate operator="or">
|
||||
<equals value="cn.net.connor.process.commands.ScreenShotCommand"/>
|
||||
</iterate>
|
||||
</not>
|
||||
</with>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
<command commandId="cn.net.connor.process.commands.ScreenShotCommand#true" id="cn.net.connor.process.mainmenu.screenshot.internal">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<with variable="rac_command_suppression">
|
||||
<not>
|
||||
<iterate operator="or">
|
||||
<equals value="cn.net.connor.process.commands.ScreenShotCommand#true"/>
|
||||
</iterate>
|
||||
</not>
|
||||
</with>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
</menuContribution-->
|
||||
<menuContribution locationURI="menu:cust.design.gzMenu?after=additions">
|
||||
<command commandId="cn.net.connor.process.commands.GZBomExportCommand" id="cn.net.connor.process.mainmenu.newprocess">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<reference
|
||||
definitionId="com.teamcenter.rac.pse.inMainView">
|
||||
</reference>
|
||||
<with variable="rac_command_suppression">
|
||||
<not>
|
||||
<iterate operator="or">
|
||||
<equals value="cn.net.connor.process.commands.GZBomExportCommand"/>
|
||||
</iterate>
|
||||
</not>
|
||||
</with>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
</menuContribution>
|
||||
<menuContribution locationURI="menu:cn.net.connor.process.mainmenu?after=sp1">
|
||||
<command icon="icons/meprocess_16.png" commandId="cn.net.connor.process.commands.NewProcessCommand" id="cn.net.connor.process.mainmenu.newprocess">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<with variable="rac_command_suppression">
|
||||
<not>
|
||||
<iterate operator="or">
|
||||
<equals value="cn.net.connor.process.commands.NewProcessCommand"/>
|
||||
</iterate>
|
||||
</not>
|
||||
</with>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
<command commandId="cn.net.connor.process.commands.NewMeopCommand" icon="icons/meoperation_16.png" id="popups.newmeop">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<reference
|
||||
definitionId="com.teamcenter.rac.cme.mpp.inMainView">
|
||||
</reference>
|
||||
<with variable="rac_command_suppression">
|
||||
<not>
|
||||
<iterate operator="or">
|
||||
<equals value="cn.net.connor.process.commands.NewMeopCommand"/>
|
||||
</iterate>
|
||||
</not>
|
||||
</with>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
<command commandId="cn.net.connor.process.commands.EditItemCommand" id="popups.edititem">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<reference
|
||||
definitionId="com.teamcenter.rac.cme.mpp.inMainView">
|
||||
</reference>
|
||||
<with variable="rac_command_suppression">
|
||||
<not>
|
||||
<iterate operator="or">
|
||||
<equals value="cn.net.connor.process.commands.EditItemCommand"/>
|
||||
</iterate>
|
||||
</not>
|
||||
</with>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
<!--
|
||||
<command commandId="cn.net.connor.process.commands.GYZSKCommand" id="cn.net.connor.process.commands.gyzsk">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<with variable="rac_command_suppression">
|
||||
<not>
|
||||
<iterate operator="or">
|
||||
<equals value="cn.net.connor.process.commands.GYZSKCommand"/>
|
||||
</iterate>
|
||||
</not>
|
||||
</with>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>-->
|
||||
|
||||
|
||||
<command commandId="cn.net.connor.process.commands.ModifyMeopNoCommand" id="cn.net.connor.process.mainmenu.modifymeopno">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<with variable="rac_command_suppression">
|
||||
<not>
|
||||
<iterate operator="or">
|
||||
<equals value="cn.net.connor.process.commands.ModifyMeopNoCommand"/>
|
||||
</iterate>
|
||||
</not>
|
||||
</with>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
<command commandId="cn.net.connor.process.commands.ProcTaskCommand" id="cn.net.connor.process.mainmenu.proctask">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<with variable="rac_command_suppression">
|
||||
<not>
|
||||
<iterate operator="or">
|
||||
<equals value="cn.net.connor.process.commands.ProcTaskCommand"/>
|
||||
</iterate>
|
||||
</not>
|
||||
</with>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
<command commandId="cn.net.connor.process.commands.OpenViewCommand#cn.net.connor.process.processview.ProcessPropertyView" icon="icons/meprocess_16.png" id="cn.net.connor.process.mainmenu.gygxbj">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<with variable="rac_command_suppression">
|
||||
<not>
|
||||
<iterate operator="or">
|
||||
<equals value="cn.net.connor.process.commands.OpenViewCommand#cn.net.connor.process.processview.ProcessPropertyView"/>
|
||||
</iterate>
|
||||
</not>
|
||||
</with>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
<command commandId="cn.net.connor.process.commands.OpenViewCommand#cn.net.connor.process.meopview.MEOPEditView" icon="icons/meoperation_16.png" id="cn.net.connor.process.mainmenu.gdbj">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<with variable="rac_command_suppression">
|
||||
<not>
|
||||
<iterate operator="or">
|
||||
<equals value="cn.net.connor.process.commands.OpenViewCommand#cn.net.connor.process.meopview.MEOPEditView"/>
|
||||
</iterate>
|
||||
</not>
|
||||
</with>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
</menuContribution>
|
||||
<menuContribution locationURI="menu:cn.net.connor.process.mainmenu?after=sp3">
|
||||
<!--command commandId="cn.net.connor.process.commands.ReviseMEProcessCommand" id="cn.net.connor.process.mainmenu.revisemeprocess">
|
||||
<visibleWhen>
|
||||
<with variable="rac_command_suppression">
|
||||
<not>
|
||||
<iterate operator="or">
|
||||
<equals value="cn.net.connor.process.commands.ReviseMEProcessCommand"/>
|
||||
</iterate>
|
||||
</not>
|
||||
</with>
|
||||
</visibleWhen>
|
||||
</command-->
|
||||
</menuContribution>
|
||||
<menuContribution locationURI="menu:cn.net.connor.process.mainmenu?after=sp4">
|
||||
<command commandId="cn.net.connor.process.commands.MeopModelCommand" id="cn.net.connor.process.mainmenu.meopmodel">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<reference
|
||||
definitionId="com.teamcenter.rac.cme.mpp.inMainView">
|
||||
</reference>
|
||||
</and>
|
||||
<with variable="rac_command_suppression">
|
||||
<not>
|
||||
<iterate operator="or">
|
||||
<equals value="cn.net.connor.process.commands.MeopModelCommand"/>
|
||||
</iterate>
|
||||
</not>
|
||||
</with>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
</menuContribution>
|
||||
<menuContribution locationURI="menu:cn.net.connor.process.mainmenu.gxfb?after=additions">
|
||||
<command commandId="cn.net.connor.process.commands.ProcessCardCommand#Connor_AVIC_GYKPSC_CATE_A3_" id="cn.net.connor.process.mainmenu.gxfb.a3">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<reference
|
||||
definitionId="com.teamcenter.rac.cme.mpp.inMainView">
|
||||
</reference>
|
||||
<with variable="rac_command_suppression">
|
||||
<not>
|
||||
<iterate operator="or">
|
||||
<equals value="cn.net.connor.process.commands.ProcessCardCommand#Connor_AVIC_GYKPSC_CATE_A3_"/>
|
||||
</iterate>
|
||||
</not>
|
||||
</with>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
<command commandId="cn.net.connor.process.commands.ProcessCardCommand#Connor_AVIC_GYKPSC_CATE_A4_" id="cn.net.connor.process.mainmenu.gxfb.a4">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<reference
|
||||
definitionId="com.teamcenter.rac.cme.mpp.inMainView">
|
||||
</reference>
|
||||
<with variable="rac_command_suppression">
|
||||
<not>
|
||||
<iterate operator="or">
|
||||
<equals value="cn.net.connor.process.commands.ProcessCardCommand#Connor_AVIC_GYKPSC_CATE_A4_"/>
|
||||
</iterate>
|
||||
</not>
|
||||
</with>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
</menuContribution>
|
||||
<menuContribution locationURI="menu:cn.net.connor.process.mainmenu.card?after=additions">
|
||||
<command commandId="cn.net.connor.process.commands.ProcessCardCommand" id="cn.net.connor.process.mainmenu.card.processcard">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<reference
|
||||
definitionId="com.teamcenter.rac.cme.mpp.inMainView">
|
||||
</reference>
|
||||
<with variable="rac_command_suppression">
|
||||
<not>
|
||||
<iterate operator="or">
|
||||
<equals value="cn.net.connor.process.commands.ProcessCardCommand"/>
|
||||
</iterate>
|
||||
</not>
|
||||
</with>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
<command commandId="cn.net.connor.process.commands.ProcessProcedureCommand" id="cn.net.connor.process.mainmenu.card.processproc">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<reference
|
||||
definitionId="com.teamcenter.rac.cme.mpp.inMainView">
|
||||
</reference>
|
||||
<with variable="rac_command_suppression">
|
||||
<not>
|
||||
<iterate operator="or">
|
||||
<equals value="cn.net.connor.process.commands.ProcessProcedureCommand"/>
|
||||
</iterate>
|
||||
</not>
|
||||
</with>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
</menuContribution>
|
||||
<menuContribution locationURI="popup:org.eclipse.ui.popup.any?after=additions">
|
||||
<command commandId="cn.net.connor.process.commands.NewProcessCommand" icon="icons/meprocess_16.png" id="popups.newprocess">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<!--<reference
|
||||
definitionId="com.teamcenter.rac.ui.inMainPerspective">
|
||||
</reference>
|
||||
<iterate ifEmpty="false">
|
||||
<adapt type="com.teamcenter.rac.kernel.TCComponentItem">
|
||||
<or>
|
||||
<test
|
||||
property="com.teamcenter.rac.kernel.TCComponent.property"
|
||||
args="object_type" value="Ac5_Part">
|
||||
</test>
|
||||
<test
|
||||
property="com.teamcenter.rac.kernel.TCComponent.property"
|
||||
args="object_type" value="产品开发申请书">
|
||||
</test>
|
||||
</or>
|
||||
</adapt>
|
||||
</iterate>-->
|
||||
<with variable="rac_command_suppression">
|
||||
<not>
|
||||
<iterate operator="or">
|
||||
<equals value="cn.net.connor.process.commands.NewProcessCommand"/>
|
||||
</iterate>
|
||||
</not>
|
||||
</with>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
<command commandId="cn.net.connor.process.commands.OpenPCBCommand3" id="popups.openpcbds">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<iterate ifEmpty="false">
|
||||
<adapt type="com.teamcenter.rac.kernel.TCComponent">
|
||||
<or>
|
||||
<test
|
||||
property="com.teamcenter.rac.kernel.TCComponent.typeClass"
|
||||
value="ItemRevision">
|
||||
</test>
|
||||
</or>
|
||||
</adapt>
|
||||
</iterate>
|
||||
<with variable="rac_command_suppression">
|
||||
<not>
|
||||
<iterate operator="or">
|
||||
<equals value="cn.net.connor.process.commands.OpenPCBCommand3"/>
|
||||
</iterate>
|
||||
</not>
|
||||
</with>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
<command commandId="cn.net.connor.process.commands.NewMeopCommand" icon="icons/meoperation_16.png" id="popups.newmeop">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<reference
|
||||
definitionId="com.teamcenter.rac.cme.mpp.inMainView">
|
||||
</reference>
|
||||
<with variable="rac_command_suppression">
|
||||
<not>
|
||||
<iterate operator="or">
|
||||
<equals value="cn.net.connor.process.commands.NewMeopCommand"/>
|
||||
</iterate>
|
||||
</not>
|
||||
</with>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
<command commandId="cn.net.connor.process.commands.WorkflowNameCommand" id="popups.workflowname">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<with variable="rac_command_suppression">
|
||||
<not>
|
||||
<iterate operator="or">
|
||||
<equals value="cn.net.connor.process.commands.WorkflowNameCommand"/>
|
||||
</iterate>
|
||||
</not>
|
||||
</with>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
<command commandId="cn.net.connor.process.commands.EditItemCommand" id="popups.edititem">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<reference
|
||||
definitionId="com.teamcenter.rac.cme.mpp.inMainView">
|
||||
</reference>
|
||||
<with variable="rac_command_suppression">
|
||||
<not>
|
||||
<iterate operator="or">
|
||||
<equals value="cn.net.connor.process.commands.EditItemCommand"/>
|
||||
</iterate>
|
||||
</not>
|
||||
</with>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
|
||||
</menuContribution>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
@ -0,0 +1,376 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
<extension point="org.eclipse.ui.views">
|
||||
<category id="cn.net.connor.process.view" name="工艺视图"/>
|
||||
<view
|
||||
category="cn.net.connor.process.view"
|
||||
closable="true"
|
||||
allowMultiple="false"
|
||||
icon="icons/meprocess_16.png"
|
||||
class="cn.net.connor.process.processview.ProcessPropertyView"
|
||||
id="cn.net.connor.process.processview.ProcessPropertyView"
|
||||
name="工艺工序编辑">
|
||||
</view>
|
||||
<view
|
||||
category="cn.net.connor.process.view"
|
||||
closable="true"
|
||||
allowMultiple="false"
|
||||
icon="icons/meoperation_16.png"
|
||||
class="cn.net.connor.process.meopviewfx.MEOPEditView"
|
||||
id="cn.net.connor.process.meopview.MEOPEditView"
|
||||
name="工道编辑">
|
||||
</view>
|
||||
</extension>
|
||||
<extension point="com.teamcenter.rac.aifrcp.viewDefs">
|
||||
<view
|
||||
alwaysUseSetRootInputObject="true"
|
||||
autoCloseEnabled="true"
|
||||
folderId="RAC_Folder_UR"
|
||||
id="cn.net.connor.process.processview.ProcessPropertyView"
|
||||
selectionInPrimaryEffectsInvisbleSecondary="false"
|
||||
selectionInSecondaryEffectsPrimary="false"
|
||||
type="secondary">
|
||||
</view>
|
||||
<view
|
||||
alwaysUseSetRootInputObject="true"
|
||||
autoCloseEnabled="true"
|
||||
folderId="RAC_Folder_UR"
|
||||
id="cn.net.connor.process.meopview.MEOPEditView"
|
||||
selectionInPrimaryEffectsInvisbleSecondary="false"
|
||||
selectionInSecondaryEffectsPrimary="false"
|
||||
type="secondary">
|
||||
</view>
|
||||
</extension>
|
||||
<extension point="org.eclipse.ui.commands">
|
||||
<command name="Test" id="cn.net.connor.process.commands.TestCommand"/>
|
||||
<command name="创建工艺" id="cn.net.connor.process.commands.NewProcessCommand"/>
|
||||
<command name="创建工序" id="cn.net.connor.process.commands.NewMeopCommand"/>
|
||||
<command name="修改工序号" id="cn.net.connor.process.commands.ModifyMeopNoCommand"/>
|
||||
<command name="工装BOM明细表" id="cn.net.connor.process.commands.GZBomExportCommand"/>
|
||||
<command name="生成工艺卡片" id="cn.net.connor.process.commands.ProcessCardCommand"/>
|
||||
<command name="A3" id="cn.net.connor.process.commands.ProcessCardCommand#Connor_AVIC_GYKPSC_CATE_A3_"/>
|
||||
<command name="A4" id="cn.net.connor.process.commands.ProcessCardCommand#Connor_AVIC_GYKPSC_CATE_A4_"/>
|
||||
<command name="生成工艺规程" id="cn.net.connor.process.commands.ProcessProcedureCommand"/>
|
||||
<command name="材料试件编辑" id="cn.net.connor.process.commands.EditItemCommand"/>
|
||||
<command name="在AD中打开" id="cn.net.connor.process.commands.OpenPCBCommand3"/>
|
||||
<command name="内部截图" id="cn.net.connor.process.commands.ScreenShotCommand"/>
|
||||
<command name="外部截图" id="cn.net.connor.process.commands.ScreenShotCommand#true"/>
|
||||
<command name="工艺分工" id="cn.net.connor.process.commands.ProcTaskCommand"/>
|
||||
<command name="流程名称提取" id="cn.net.connor.process.commands.WorkflowNameCommand"/>
|
||||
<command name="工艺工序编辑" id="cn.net.connor.process.commands.OpenViewCommand#cn.net.connor.process.processview.ProcessPropertyView"/>
|
||||
<command name="工道编辑" id="cn.net.connor.process.commands.OpenViewCommand#cn.net.connor.process.meopview.MEOPEditView"/>
|
||||
<command name="生成工序三维模型" id="cn.net.connor.process.commands.MeopModelCommand"/>
|
||||
<command name="通过产品查询特殊过程" id="cn.net.connor.process.commands.TSGCExportCommand"/>
|
||||
<command name="特殊过程被引用情况查询" id="cn.net.connor.process.commands.TSGCRefExportCommand"/>
|
||||
<command name="工艺升版" id="cn.net.connor.process.commands.ReviseMEProcessCommand"/>
|
||||
<command name="过程记录卡" id="cn.net.connor.process.commands.GCJLKCommand"/>
|
||||
</extension>
|
||||
<extension point="org.eclipse.ui.handlers">
|
||||
<handler commandId="cn.net.connor.process.commands.TestCommand" class="k.KHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.NewProcessCommand" class="k.KHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.NewMeopCommand" class="k.KHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.ModifyMeopNoCommand" class="k.KHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.GZBomExportCommand" class="k.KHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.ProcessCardCommand" class="k.KHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.ProcessCardCommand#Connor_AVIC_GYKPSC_CATE_A3_" class="k.KHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.ProcessCardCommand#Connor_AVIC_GYKPSC_CATE_A4_" class="k.KHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.ProcessProcedureCommand" class="k.KHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.ScreenShotCommand#true" class="k.KHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.ScreenShotCommand" class="k.KHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.EditItemCommand" class="k.KHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.OpenPCBCommand3" class="k.KHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.ProcTaskCommand" class="k.KHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.WorkflowNameCommand" class="k.KHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.OpenViewCommand#cn.net.connor.process.processview.ProcessPropertyView" class="k.KHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.OpenViewCommand#cn.net.connor.process.meopview.MEOPEditView" class="k.KHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.MeopModelCommand" class="k.KHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.TSGCExportCommand" class="k.KHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.TSGCRefExportCommand" class="k.KHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.ReviseMEProcessCommand" class="k.KHandler"/>
|
||||
<handler commandId="cn.net.connor.process.commands.GCJLKCommand" class="k.KHandler"/>
|
||||
</extension>
|
||||
<extension point="org.eclipse.ui.bindings">
|
||||
<key
|
||||
commandId="cn.net.connor.process.commands.TestCommand"
|
||||
sequence="M3+D"
|
||||
schemeId="com.teamcenter.rac.scheme">
|
||||
</key>
|
||||
</extension>
|
||||
<extension point="org.eclipse.ui.menus">
|
||||
<menuContribution locationURI="menu:org.eclipse.ui.main.menu?after=designMenu">
|
||||
<menu label="工艺管理" id="cn.net.connor.process.mainmenu">
|
||||
<separator name ="sp1" visible="false"/>
|
||||
<separator name ="sp2" visible="true"/>
|
||||
<menu label="生成工艺卡" id="cn.net.connor.process.mainmenu.card"/>
|
||||
<menu label="生成工序附表" id="cn.net.connor.process.mainmenu.gxfb"/>
|
||||
<menu label="工艺报表" id="cn.net.connor.process.mainmenu.gybb"/>
|
||||
<separator name ="sp3" visible="true"/>
|
||||
<menu label="截图工具" id="cn.net.connor.process.mainmenu.screenshot"/>
|
||||
</menu>
|
||||
<menu label="客户化功能" id="cn.net.connor.process.khhgn"/>
|
||||
<menu label="通用菜单" id="cn.net.connor.process.tycd"/>
|
||||
</menuContribution>
|
||||
<menuContribution locationURI="menu:cn.net.connor.process.mainmenu.gybb?after=additions">
|
||||
<command commandId="cn.net.connor.process.commands.GCJLKCommand" id="cn.net.connor.process.mainmenu.gybb.gcjlk"/>
|
||||
</menuContribution>
|
||||
<menuContribution locationURI="menu:cn.net.connor.process.tycd?after=additions">
|
||||
<command commandId="cn.net.connor.process.commands.TSGCExportCommand" id="cn.net.connor.process.tycd.tsgcexport"/>
|
||||
<command commandId="cn.net.connor.process.commands.TSGCRefExportCommand" id="cn.net.connor.process.tycd.tsgcrefexport"/>
|
||||
</menuContribution>
|
||||
<menuContribution locationURI="menu:cn.net.connor.process.mainmenu.screenshot?after=additions">
|
||||
<command commandId="cn.net.connor.process.commands.ScreenShotCommand" id="cn.net.connor.process.mainmenu.screenshot.external">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<with variable="rac_command_suppression">
|
||||
<not>
|
||||
<iterate operator="or">
|
||||
<equals value="cn.net.connor.process.commands.ScreenShotCommand"/>
|
||||
</iterate>
|
||||
</not>
|
||||
</with>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
<command commandId="cn.net.connor.process.commands.ScreenShotCommand#true" id="cn.net.connor.process.mainmenu.screenshot.internal">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<with variable="rac_command_suppression">
|
||||
<not>
|
||||
<iterate operator="or">
|
||||
<equals value="cn.net.connor.process.commands.ScreenShotCommand#true"/>
|
||||
</iterate>
|
||||
</not>
|
||||
</with>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
</menuContribution>
|
||||
<menuContribution locationURI="menu:cust.design.gzMenu?after=additions">
|
||||
<command commandId="cn.net.connor.process.commands.GZBomExportCommand" id="cn.net.connor.process.mainmenu.newprocess">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<reference
|
||||
definitionId="com.teamcenter.rac.pse.inMainView">
|
||||
</reference>
|
||||
<with variable="rac_command_suppression">
|
||||
<not>
|
||||
<iterate operator="or">
|
||||
<equals value="cn.net.connor.process.commands.GZBomExportCommand"/>
|
||||
</iterate>
|
||||
</not>
|
||||
</with>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
</menuContribution>
|
||||
<menuContribution locationURI="menu:cn.net.connor.process.mainmenu?after=sp1">
|
||||
<command icon="icons/meprocess_16.png" commandId="cn.net.connor.process.commands.NewProcessCommand" id="cn.net.connor.process.mainmenu.newprocess">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<with variable="rac_command_suppression">
|
||||
<not>
|
||||
<iterate operator="or">
|
||||
<equals value="cn.net.connor.process.commands.NewProcessCommand"/>
|
||||
</iterate>
|
||||
</not>
|
||||
</with>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
<command commandId="cn.net.connor.process.commands.ModifyMeopNoCommand" id="cn.net.connor.process.mainmenu.modifymeopno">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<with variable="rac_command_suppression">
|
||||
<not>
|
||||
<iterate operator="or">
|
||||
<equals value="cn.net.connor.process.commands.ModifyMeopNoCommand"/>
|
||||
</iterate>
|
||||
</not>
|
||||
</with>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
<command commandId="cn.net.connor.process.commands.ProcTaskCommand" id="cn.net.connor.process.mainmenu.proctask">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<with variable="rac_command_suppression">
|
||||
<not>
|
||||
<iterate operator="or">
|
||||
<equals value="cn.net.connor.process.commands.ProcTaskCommand"/>
|
||||
</iterate>
|
||||
</not>
|
||||
</with>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
<command commandId="cn.net.connor.process.commands.OpenViewCommand#cn.net.connor.process.processview.ProcessPropertyView" icon="icons/meprocess_16.png" id="cn.net.connor.process.mainmenu.gygxbj">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<with variable="rac_command_suppression">
|
||||
<not>
|
||||
<iterate operator="or">
|
||||
<equals value="cn.net.connor.process.commands.OpenViewCommand#cn.net.connor.process.processview.ProcessPropertyView"/>
|
||||
</iterate>
|
||||
</not>
|
||||
</with>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
<command commandId="cn.net.connor.process.commands.OpenViewCommand#cn.net.connor.process.meopview.MEOPEditView" icon="icons/meoperation_16.png" id="cn.net.connor.process.mainmenu.gdbj">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<with variable="rac_command_suppression">
|
||||
<not>
|
||||
<iterate operator="or">
|
||||
<equals value="cn.net.connor.process.commands.OpenViewCommand#cn.net.connor.process.meopview.MEOPEditView"/>
|
||||
</iterate>
|
||||
</not>
|
||||
</with>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
<command commandId="cn.net.connor.process.commands.MeopModelCommand" id="cn.net.connor.process.mainmenu.meopmodel">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<reference
|
||||
definitionId="com.teamcenter.rac.cme.mpp.inMainView">
|
||||
</reference>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
<command commandId="cn.net.connor.process.commands.ReviseMEProcessCommand" id="cn.net.connor.process.mainmenu.revisemeprocess">
|
||||
</command>
|
||||
</menuContribution>
|
||||
<menuContribution locationURI="menu:cn.net.connor.process.mainmenu.gxfb?after=additions">
|
||||
<command commandId="cn.net.connor.process.commands.ProcessCardCommand#Connor_AVIC_GYKPSC_CATE_A3_" id="cn.net.connor.process.mainmenu.gxfb.a3">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<reference
|
||||
definitionId="com.teamcenter.rac.cme.mpp.inMainView">
|
||||
</reference>
|
||||
<with variable="rac_command_suppression">
|
||||
<not>
|
||||
<iterate operator="or">
|
||||
<equals value="cn.net.connor.process.commands.ProcessCardCommand#Connor_AVIC_GYKPSC_CATE_A3_"/>
|
||||
</iterate>
|
||||
</not>
|
||||
</with>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
<command commandId="cn.net.connor.process.commands.ProcessCardCommand#Connor_AVIC_GYKPSC_CATE_A4_" id="cn.net.connor.process.mainmenu.gxfb.a4">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<reference
|
||||
definitionId="com.teamcenter.rac.cme.mpp.inMainView">
|
||||
</reference>
|
||||
<with variable="rac_command_suppression">
|
||||
<not>
|
||||
<iterate operator="or">
|
||||
<equals value="cn.net.connor.process.commands.ProcessCardCommand#Connor_AVIC_GYKPSC_CATE_A4_"/>
|
||||
</iterate>
|
||||
</not>
|
||||
</with>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
</menuContribution>
|
||||
<menuContribution locationURI="menu:cn.net.connor.process.mainmenu.card?after=additions">
|
||||
<command commandId="cn.net.connor.process.commands.ProcessCardCommand" id="cn.net.connor.process.mainmenu.card.processcard">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<reference
|
||||
definitionId="com.teamcenter.rac.cme.mpp.inMainView">
|
||||
</reference>
|
||||
<with variable="rac_command_suppression">
|
||||
<not>
|
||||
<iterate operator="or">
|
||||
<equals value="cn.net.connor.process.commands.ProcessCardCommand"/>
|
||||
</iterate>
|
||||
</not>
|
||||
</with>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
<command commandId="cn.net.connor.process.commands.ProcessProcedureCommand" id="cn.net.connor.process.mainmenu.card.processproc">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<reference
|
||||
definitionId="com.teamcenter.rac.cme.mpp.inMainView">
|
||||
</reference>
|
||||
<with variable="rac_command_suppression">
|
||||
<not>
|
||||
<iterate operator="or">
|
||||
<equals value="cn.net.connor.process.commands.ProcessProcedureCommand"/>
|
||||
</iterate>
|
||||
</not>
|
||||
</with>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
</menuContribution>
|
||||
<menuContribution locationURI="popup:org.eclipse.ui.popup.any?after=additions">
|
||||
<command commandId="cn.net.connor.process.commands.NewProcessCommand" icon="icons/meprocess_16.png" id="popups.newprocess">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<!--<reference
|
||||
definitionId="com.teamcenter.rac.ui.inMainPerspective">
|
||||
</reference>
|
||||
<iterate ifEmpty="false">
|
||||
<adapt type="com.teamcenter.rac.kernel.TCComponentItem">
|
||||
<or>
|
||||
<test
|
||||
property="com.teamcenter.rac.kernel.TCComponent.property"
|
||||
args="object_type" value="Ac5_Part">
|
||||
</test>
|
||||
<test
|
||||
property="com.teamcenter.rac.kernel.TCComponent.property"
|
||||
args="object_type" value="产品开发申请书">
|
||||
</test>
|
||||
</or>
|
||||
</adapt>
|
||||
</iterate>-->
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
<command commandId="cn.net.connor.process.commands.OpenPCBCommand3" id="popups.openpcbds">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<iterate ifEmpty="false">
|
||||
<adapt type="com.teamcenter.rac.kernel.TCComponent">
|
||||
<or>
|
||||
<test
|
||||
property="com.teamcenter.rac.kernel.TCComponent.typeClass"
|
||||
value="ItemRevision">
|
||||
</test>
|
||||
</or>
|
||||
</adapt>
|
||||
</iterate>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
<command commandId="cn.net.connor.process.commands.NewMeopCommand" icon="icons/meoperation_16.png" id="popups.newmeop">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<reference
|
||||
definitionId="com.teamcenter.rac.cme.mpp.inMainView">
|
||||
</reference>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
<command commandId="cn.net.connor.process.commands.WorkflowNameCommand" id="popups.workflowname">
|
||||
</command>
|
||||
<command commandId="cn.net.connor.process.commands.EditItemCommand" id="popups.edititem">
|
||||
<visibleWhen>
|
||||
<and>
|
||||
<reference
|
||||
definitionId="com.teamcenter.rac.cme.mpp.inMainView">
|
||||
</reference>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
</menuContribution>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
@ -0,0 +1,44 @@
|
||||
package cn.net.connor.process;
|
||||
|
||||
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
/**
|
||||
* The activator class controls the plug-in life cycle
|
||||
*/
|
||||
public class Activator extends AbstractUIPlugin {
|
||||
|
||||
// The plug-in ID
|
||||
public static final String PLUGIN_ID = "cn.net.connor.process"; //$NON-NLS-1$
|
||||
|
||||
// The shared instance
|
||||
private static Activator plugin;
|
||||
|
||||
/**
|
||||
* The constructor
|
||||
*/
|
||||
public Activator() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(BundleContext context) throws Exception {
|
||||
super.start(context);
|
||||
plugin = this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop(BundleContext context) throws Exception {
|
||||
plugin = null;
|
||||
super.stop(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the shared instance
|
||||
*
|
||||
* @return the shared instance
|
||||
*/
|
||||
public static Activator getDefault() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,191 @@
|
||||
package cn.net.connor.process;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.datatransfer.Clipboard;
|
||||
import java.awt.datatransfer.StringSelection;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileReader;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class KLocalizer extends JFrame{
|
||||
|
||||
private JTextField tf_key;
|
||||
private JTextField tf_en;
|
||||
private JTextField tf_cn;
|
||||
private JButton b_add;
|
||||
private JLabel l_info;
|
||||
private JButton b_close;
|
||||
|
||||
public static void main(String[] args) {
|
||||
new KLocalizer().initUI();
|
||||
}
|
||||
|
||||
public void initUI() {
|
||||
this.setTitle("国际化");
|
||||
this.setMinimumSize(new Dimension(400,270));
|
||||
this.setPreferredSize(new Dimension(400,270));
|
||||
this.setLayout(new BorderLayout());
|
||||
this.add(BorderLayout.CENTER,initCenterPanel());
|
||||
this.add(BorderLayout.SOUTH,initBtnPanel());
|
||||
addListeners();
|
||||
pack();
|
||||
this.setLocationRelativeTo(null);
|
||||
this.setAlwaysOnTop(true);
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
private void addListeners() {
|
||||
b_add.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
try {
|
||||
addLocaleInfo();
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
this.b_close.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
dispose();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void addLocaleInfo() throws Exception{
|
||||
this.l_info.setText("");
|
||||
String key = this.tf_key.getText();
|
||||
String en = this.tf_en.getText();
|
||||
String cn = this.tf_cn.getText();
|
||||
Package p = this.getClass().getPackage();
|
||||
String path = "src/"+p.getName().replace('.', '/');
|
||||
System.out.println("PATH: "+path);
|
||||
int index = path.lastIndexOf('/');
|
||||
if(index<=0) {
|
||||
this.l_info.setText("类路径不正确");
|
||||
return;
|
||||
}
|
||||
String title = path.substring(index+1);
|
||||
String enFile = path+"/"+title+"_locale.properties";
|
||||
String cnFile = path+"/"+title+"_locale_zh_CN.properties";
|
||||
System.out.println("TITLE: "+title);
|
||||
if(title.length()>0) {
|
||||
String code = title.substring(0,1).toUpperCase()+title.substring(1)+"Locale.getString(\""+key+"\")";
|
||||
System.out.println("PASTE: "+code);
|
||||
StringSelection selection = new StringSelection(code);
|
||||
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
|
||||
clipboard.setContents(selection, selection);
|
||||
}
|
||||
File file = new File(enFile);
|
||||
if(!file.exists()) {
|
||||
file.createNewFile();
|
||||
}
|
||||
file = new File(cnFile);
|
||||
if(!file.exists()) {
|
||||
file.createNewFile();
|
||||
}
|
||||
//System.out.println("英文路径:"+enFile);
|
||||
//System.out.println("中文路径:"+cnFile);
|
||||
Properties enProps = new Properties();
|
||||
enProps.load(new FileReader(enFile));
|
||||
Properties cnProps = new Properties();
|
||||
cnProps.load(new FileReader(cnFile));
|
||||
if(enProps.containsKey(key)||cnProps.containsKey(key)) {
|
||||
this.l_info.setText("关键字“"+key+"”已存在");
|
||||
System.out.println(title.substring(0,1).toUpperCase()+title.substring(1)+"Locale.getString(\""+key+"\")");
|
||||
return;
|
||||
}
|
||||
if(isEmpty(key)||isEmpty(en)||isEmpty(cn)) {
|
||||
this.l_info.setText("请填写完整信息");
|
||||
return;
|
||||
}
|
||||
System.out.println("英文:"+key+"="+en);
|
||||
System.out.println("中文:"+key+"="+cn);
|
||||
enProps.setProperty(key, en);
|
||||
cnProps.setProperty(key, cn);
|
||||
FileOutputStream enos;
|
||||
enProps.store(enos = new FileOutputStream(enFile), "");
|
||||
FileOutputStream cnos;
|
||||
cnProps.store(cnos = new FileOutputStream(cnFile), "");
|
||||
enos.flush();
|
||||
enos.close();
|
||||
cnos.flush();
|
||||
cnos.close();
|
||||
this.l_info.setText("写入成功");
|
||||
tf_key.setText("");
|
||||
tf_en.setText("");
|
||||
tf_cn.setText("");
|
||||
}
|
||||
|
||||
private JPanel initBtnPanel() {
|
||||
JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER,15,5));
|
||||
panel.add(this.b_add = new JButton(" 添加 "));
|
||||
panel.add(this.b_close = new JButton(" 关闭 "));
|
||||
return panel;
|
||||
}
|
||||
|
||||
private JPanel initCenterPanel() {
|
||||
JPanel panel = new JPanel(new GridBagLayout());
|
||||
panel.setBorder(BorderFactory.createEmptyBorder(0,30,0,25));
|
||||
GridBagConstraints s = new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 0, 4, 5), 0, 0);
|
||||
newRow(panel, new JLabel("关键字: "), s, 1);
|
||||
addCol(panel, this.tf_key = new JTextField(), s, 1, 1);
|
||||
newRow(panel, new JLabel("英文: "), s, 1);
|
||||
addCol(panel, this.tf_en = new JTextField(), s, 1, 1);
|
||||
newRow(panel, new JLabel("中文: "), s, 1);
|
||||
addCol(panel, this.tf_cn = new JTextField(), s, 1, 1);
|
||||
this.l_info = new JLabel();
|
||||
this.l_info.setForeground(Color.RED);
|
||||
this.l_info.setPreferredSize(new Dimension(100,50));
|
||||
newRow(panel, l_info, s, 2);
|
||||
return panel;
|
||||
}
|
||||
|
||||
public static boolean isEmpty(String str) {
|
||||
return str==null||"".equals(str.trim());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void processWindowEvent(WindowEvent e) {
|
||||
if(e.getID()==WindowEvent.WINDOW_CLOSING) {
|
||||
dispose();
|
||||
}
|
||||
super.processWindowEvent(e);
|
||||
}
|
||||
|
||||
public static void newRow(JPanel panel, Component comp, GridBagConstraints s, int width) {
|
||||
s.weightx = 0;
|
||||
s.gridwidth = width;
|
||||
s.gridx = 0;
|
||||
s.gridy++;
|
||||
panel.add(comp, s);
|
||||
}
|
||||
|
||||
public static void addCol(JPanel panel, Component comp, GridBagConstraints s, int width, double weightx) {
|
||||
s.gridx++;
|
||||
s.gridwidth = width;
|
||||
s.weightx = weightx;
|
||||
panel.add(comp, s);
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package cn.net.connor.process;
|
||||
|
||||
import com.teamcenter.rac.util.Registry;
|
||||
|
||||
|
||||
public class ProcessLocale {
|
||||
|
||||
public static final Registry reg = Registry.getRegistry(ProcessLocale.class);
|
||||
|
||||
public static String getString(String title) {
|
||||
if (isEmpty(title)) {
|
||||
return "";
|
||||
} else {
|
||||
String res = reg.getString(title);
|
||||
return isEmpty(res) ? title : res;
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isEmpty(String title) {
|
||||
return title == null || "".equals(title.trim());
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package cn.net.connor.process;
|
||||
|
||||
import k.util.KUtil;
|
||||
|
||||
public class ProcessUtil {
|
||||
|
||||
public static final String PREF_MEOP_ITEMTYPE = "Connor_AVIC_MEOP_Types";
|
||||
public static final String PREF_MEPROCESS_ITEMTYPE = "Connor_AVIC_MEProcess_Types";
|
||||
|
||||
public static boolean isMEOP(String itemTypeName) throws Exception{
|
||||
if(KUtil.isEmpty(itemTypeName)) {
|
||||
return false;
|
||||
}
|
||||
String[] types = KUtil.getPrefVals(KUtil.session, PREF_MEOP_ITEMTYPE);
|
||||
return KUtil.inArray(itemTypeName, types)>=0;
|
||||
}
|
||||
|
||||
public static boolean isMEProcess(String itemTypeName) throws Exception{
|
||||
if(KUtil.isEmpty(itemTypeName)) {
|
||||
return false;
|
||||
}
|
||||
String[] types = KUtil.getPrefVals(KUtil.session, PREF_MEPROCESS_ITEMTYPE);
|
||||
return KUtil.inArray(itemTypeName, types)>=0;
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package cn.net.connor.process.Processknowledgebase;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CustomLovBean {
|
||||
private java.util.List<CustomLovBean> sub = new ArrayList<CustomLovBean>();
|
||||
public String displayName = "";
|
||||
|
||||
public CustomLovBean(String displayName) {
|
||||
super();
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
public CustomLovBean(String displayName, String[] subArray) {
|
||||
super();
|
||||
this.displayName = displayName;
|
||||
translateArrayToSub(subArray);
|
||||
}
|
||||
|
||||
public void translateArrayToSub(String[] subArray) {
|
||||
for (int i = 0; i < subArray.length; i++) {
|
||||
sub.add(new CustomLovBean(subArray[i]));
|
||||
}
|
||||
}
|
||||
|
||||
public java.util.List<CustomLovBean> getSub() {
|
||||
return sub;
|
||||
}
|
||||
|
||||
public boolean hasChild() {
|
||||
return sub.size() != 0;
|
||||
}
|
||||
|
||||
public void addSub(CustomLovBean clb) {
|
||||
sub.add(clb);
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package cn.net.connor.process.Processknowledgebase;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
|
||||
import com.teamcenter.rac.aif.common.actions.AbstractAIFAction;
|
||||
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
import com.teamcenter.rac.util.Instancer;
|
||||
import com.teamcenter.rac.util.MessageBox;
|
||||
|
||||
import cn.net.connor.process.hourcalculation.FitterCommand;
|
||||
import cn.net.connor.process.hourcalculation.hourCCommand;
|
||||
|
||||
public class SJJHAction extends AbstractAIFAction {
|
||||
private InterfaceAIFComponent comp;
|
||||
private TCSession session;
|
||||
public SJJHAction(AbstractAIFApplication app, InterfaceAIFComponent comp,String s,TCSession session) {
|
||||
super(app,s);
|
||||
this.comp=comp;
|
||||
this.session=session;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
// AbstractAIFApplication app = AIFUtility.getCurrentApplication();
|
||||
// session = (TCSession) app.getSession();
|
||||
//SJJHCommand Command=new SJJHCommand();
|
||||
//new hourCCommand(session);
|
||||
//new FitterCommand(session);
|
||||
try {
|
||||
//Command.executeModal();
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,142 @@
|
||||
package cn.net.connor.process.Processknowledgebase;
|
||||
|
||||
import java.awt.image.RenderedImage;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.mail.Flags.Flag;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.xml.crypto.Data;
|
||||
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFCommand;
|
||||
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.TCComponentDataset;
|
||||
import com.teamcenter.rac.kernel.TCComponentICO;
|
||||
import com.teamcenter.rac.kernel.TCComponentItem;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemType;
|
||||
import com.teamcenter.rac.kernel.TCComponentTcFile;
|
||||
import com.teamcenter.rac.kernel.TCException;
|
||||
import com.teamcenter.rac.kernel.TCPreferenceService;
|
||||
import com.teamcenter.rac.kernel.TCProperty;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
import com.teamcenter.rac.kernel.ics.ICSProperty;
|
||||
import com.teamcenter.rac.kernel.ics.ICSPropertyDescription;
|
||||
import com.teamcenter.rac.kernel.tcservices.TcServicesService;
|
||||
import com.teamcenter.rac.util.MessageBox;
|
||||
|
||||
import cn.net.connor.process.meopviewfx.bean.KTableRow;
|
||||
import cn.net.connor.process.meopviewfx.bean.PropConfig;
|
||||
import javafx.scene.control.TableView;
|
||||
|
||||
|
||||
|
||||
public class SJJHCommand extends AbstractAIFCommand {
|
||||
|
||||
private TCComponentBOMLine comp;
|
||||
private TCSession session;
|
||||
private TableView<KTableRow> table;
|
||||
private List<PropConfig> propConfigs;
|
||||
public SJJHCommand(TCComponentBOMLine comp,TableView<KTableRow> table,List<PropConfig> propConfigs) {
|
||||
// TODO Auto-generated constructor stub
|
||||
this.comp = comp;
|
||||
this.propConfigs=propConfigs;
|
||||
this.table=table;
|
||||
try {
|
||||
executeModal();
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void executeModal() throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
CustomLovBean top=new CustomLovBean("展开分类库");
|
||||
// CustomLovBean parent1=new CustomLovBean("1");
|
||||
// CustomLovBean parent11=new CustomLovBean("1111111111111111111111");
|
||||
// CustomLovBean parent12=new CustomLovBean("12");
|
||||
// CustomLovBean parent13=new CustomLovBean("13");
|
||||
// CustomLovBean parent2=new CustomLovBean("2");
|
||||
// CustomLovBean parent21=new CustomLovBean("21");
|
||||
// CustomLovBean parent22=new CustomLovBean("22");
|
||||
// CustomLovBean parent23=new CustomLovBean("23");
|
||||
// CustomLovBean parent3=new CustomLovBean("3");
|
||||
// CustomLovBean parent31=new CustomLovBean("31");
|
||||
// CustomLovBean parent32=new CustomLovBean("32");
|
||||
// CustomLovBean parent33=new CustomLovBean("33");
|
||||
// parent.addSub(parent1);
|
||||
// parent1.addSub(parent11);
|
||||
// parent1.addSub(parent12);
|
||||
// parent1.addSub(parent13);
|
||||
//
|
||||
// parent.addSub(parent2);
|
||||
// parent2.addSub(parent21);
|
||||
// parent2.addSub(parent22);
|
||||
// parent2.addSub(parent23);
|
||||
//
|
||||
// parent.addSub(parent3);
|
||||
// parent3.addSub(parent31);
|
||||
// parent3.addSub(parent32);
|
||||
// parent3.addSub(parent33);
|
||||
|
||||
|
||||
// Map<String,CustomLovBean> parentMap=new HashMap<String, CustomLovBean>();//存放
|
||||
Map<String,List<String>> PtoCMap=new HashMap<String,List<String>>();//
|
||||
// 获取数据库连接
|
||||
SqlUtilT.getTCConnection();
|
||||
ResultSet rs = null;
|
||||
String sql = String.format("select parent,child from TC_ProcessKnow_View");
|
||||
rs = SqlUtilT.read(sql);
|
||||
while (rs.next()) {
|
||||
String parent=rs.getString("parent");
|
||||
String child=rs.getString("child");
|
||||
CustomLovBean childLov=new CustomLovBean(child);
|
||||
//System.out.println(parent+"===>"+child);
|
||||
if(!PtoCMap.containsKey(parent)) {
|
||||
CustomLovBean parentLov=new CustomLovBean(parent);
|
||||
List<String> list=new ArrayList<String>();
|
||||
list.add(child);
|
||||
parentLov.addSub(childLov);
|
||||
PtoCMap.put(parent, list);
|
||||
}else {
|
||||
List<String> list=PtoCMap.get(parent);
|
||||
if(!list.contains(child)) {
|
||||
list.add(child);
|
||||
PtoCMap.put(parent, list);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Set<String> parents=PtoCMap.keySet();
|
||||
for (String parent : parents) {
|
||||
CustomLovBean parentTree=new CustomLovBean(parent);
|
||||
List<String> childs=PtoCMap.get(parent);
|
||||
for(String child:childs) {
|
||||
parentTree.addSub(new CustomLovBean(child));
|
||||
}
|
||||
top.addSub(parentTree);
|
||||
}
|
||||
|
||||
new SJJHDialog(comp,table,top,propConfigs);
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package cn.net.connor.process.Processknowledgebase;
|
||||
|
||||
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.TCComponentBOMLine;
|
||||
import com.teamcenter.rac.kernel.TCComponentItem;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
import com.teamcenter.rac.util.MessageBox;
|
||||
|
||||
|
||||
public class SJJHHandler extends AbstractHandler {
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
// TODO Auto-generated method stub
|
||||
AbstractAIFApplication app = AIFUtility.getCurrentApplication();
|
||||
TCSession session = (TCSession) app.getSession();
|
||||
InterfaceAIFComponent comp;
|
||||
try {
|
||||
comp=app.getTargetComponent();
|
||||
if(comp!=null) {
|
||||
System.out.println(((TCComponentItem)comp).getStringProperty("object_name"));
|
||||
//((TCComponentItem)comp).setProperty("object_name", "ceshi");
|
||||
new Thread(new SJJHAction(app,comp,"",session)).start();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,129 @@
|
||||
package cn.net.connor.process.choose;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFDialog;
|
||||
import com.teamcenter.rac.util.MessageBox;
|
||||
|
||||
import cn.net.connor.process.ProcessLocale;
|
||||
import k.KDialog;
|
||||
import k.KDialogController;
|
||||
import k.util.KUtil;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class ChooseDialog extends KDialog {
|
||||
|
||||
private ChooseDialogController controller;
|
||||
private JButton b_ok;
|
||||
private JButton b_cel;
|
||||
private JButton b_search;
|
||||
|
||||
public ChooseDialog(AbstractAIFDialog newMeopDialog, KDialogController controller) {
|
||||
super(newMeopDialog,true,controller);
|
||||
this.controller = (ChooseDialogController) controller;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addListeners() {
|
||||
this.b_cel.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
disposeDialog();
|
||||
}
|
||||
});
|
||||
this.b_ok.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
try {
|
||||
controller.doSelect();
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
MessageBox.post(ChooseDialog.this,e1);
|
||||
}
|
||||
}
|
||||
});
|
||||
this.b_search.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
try {
|
||||
controller.doSearch();
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
MessageBox.post(ChooseDialog.this,e1);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initUI() {
|
||||
this.setTitle(ProcessLocale.getString("select.TITLE"));
|
||||
this.setPreferredSize(new Dimension(900, 500));
|
||||
this.setMinimumSize(new Dimension(550, 400));
|
||||
this.setLayout(new BorderLayout());
|
||||
this.add(BorderLayout.CENTER, initTablePanel());
|
||||
this.add(BorderLayout.EAST, initSearchPanel());
|
||||
}
|
||||
|
||||
private Component initBtnPanel() {
|
||||
JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 0));
|
||||
panel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
|
||||
this.b_search = new JButton(ProcessLocale.getString("search"));
|
||||
this.b_ok = new JButton(ProcessLocale.getString("ok"));
|
||||
this.b_cel = new JButton(ProcessLocale.getString("cancel"));
|
||||
if (controller.searchCols.size() > 0) {
|
||||
panel.add(b_search);
|
||||
}
|
||||
panel.add(b_ok);
|
||||
panel.add(b_cel);
|
||||
return panel;
|
||||
}
|
||||
|
||||
private Component initSearchPanel() {
|
||||
JPanel panel = new JPanel(new BorderLayout());
|
||||
if (controller.searchCols.size() == 0) {
|
||||
this.add(BorderLayout.SOUTH, initBtnPanel());
|
||||
return panel;
|
||||
}
|
||||
JPanel searchPanel = new JPanel(new GridBagLayout());
|
||||
searchPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
|
||||
GridBagConstraints s = getGridBagConstraints(0, 0, new Insets(5, 5, 5, 5));
|
||||
for (String title : controller.searchCols) {
|
||||
KUtil.newRow(searchPanel, new JLabel(title), s, 1);
|
||||
JTextField textField = new JTextField(12);
|
||||
controller.searchComps.put(title, textField);
|
||||
KUtil.addCol(searchPanel, textField, s, 1, 1);
|
||||
}
|
||||
s.weighty = 1;
|
||||
KUtil.newRow(searchPanel, new JLabel(""), s, 1);
|
||||
JScrollPane scroll = new JScrollPane(searchPanel);
|
||||
scroll.setBorder(null);
|
||||
panel.add(BorderLayout.CENTER, scroll);
|
||||
panel.add(BorderLayout.SOUTH, initBtnPanel());
|
||||
return panel;
|
||||
}
|
||||
|
||||
private Component initTablePanel() {
|
||||
JPanel panel = new JPanel(new BorderLayout());
|
||||
panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 0));
|
||||
JScrollPane scroll = new JScrollPane(controller.tableBean.getTable());
|
||||
panel.add(BorderLayout.CENTER, scroll);
|
||||
return panel;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,161 @@
|
||||
package cn.net.connor.process.choose;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.swing.JTextField;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.kernel.TCComponentDataset;
|
||||
|
||||
import cn.net.connor.process.ProcessLocale;
|
||||
import cn.net.connor.process.newmeop.PrefComponent;
|
||||
import k.KDialogController;
|
||||
import k.swing.KExcelTable;
|
||||
import k.swing.KExcelTable.Config;
|
||||
import k.util.KUtil;
|
||||
|
||||
public class ChooseDialogController extends KDialogController{
|
||||
|
||||
private String typeName;
|
||||
private String[] config;
|
||||
private List<PrefComponent> prefComponents;
|
||||
//private Map<String, JTextComponent> otherComps;
|
||||
private ChooseDialog dialog;
|
||||
protected File excelFile;
|
||||
protected List<Config> configs = new ArrayList<KExcelTable.Config>();
|
||||
protected List<String> searchCols = new ArrayList<String>();
|
||||
protected Map<String,JTextField> searchComps = new HashMap<String, JTextField>();
|
||||
protected KExcelTable tableBean;
|
||||
|
||||
public ChooseDialogController(AbstractAIFApplication app, String type, PrefComponent bean, List<PrefComponent> prefComponents) {
|
||||
super(app);
|
||||
this.typeName = type;
|
||||
this.config = bean.getExcelConfig();
|
||||
this.prefComponents = prefComponents;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean init() throws Exception {
|
||||
this.dialog = (ChooseDialog) aifDialog;
|
||||
int len = KUtil.getLen(config);
|
||||
if(len==0) {
|
||||
System.out.println("No Choose Config");
|
||||
KUtil.error(dialog, ProcessLocale.getString("novalidchooseconfig.ERROR"));
|
||||
return false;
|
||||
}
|
||||
String uid = config[0];
|
||||
System.out.println(">> Uid: "+uid);
|
||||
if(!KUtil.isEmpty(typeName)) {
|
||||
int ind=uid.indexOf(""+typeName+":");
|
||||
if(ind>0) {
|
||||
uid = uid.substring(ind+typeName.length()+1);
|
||||
}
|
||||
}
|
||||
int ind = uid.indexOf(';');
|
||||
if(ind>0) {
|
||||
uid = uid.substring(0,ind);
|
||||
}
|
||||
System.out.println(">> Uid for type ["+typeName+"] is: "+uid);
|
||||
if(KUtil.isEmpty(uid)) {
|
||||
KUtil.error(dialog, ProcessLocale.getString("novalidchooseconfig.ERROR"));
|
||||
return false;
|
||||
}
|
||||
TCComponentDataset excelDataset = null;
|
||||
try {
|
||||
excelDataset = (TCComponentDataset) session.stringToComponent(uid);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if(excelDataset==null||!"MSExcelX".equals(excelDataset.getType())) {
|
||||
KUtil.error(dialog, ProcessLocale.getString("novalidchooseconfig.ERROR"));
|
||||
return false;
|
||||
}
|
||||
//Read Config
|
||||
for(int i=1;i<len;i++) {
|
||||
String pref = config[i];
|
||||
String[] split = pref.split("=",-1);
|
||||
int splitCnt = KUtil.getLen(split);
|
||||
String tableCol = null, excelCol = null, propConfig = null;
|
||||
int prefW = 100;
|
||||
if(splitCnt>0) {
|
||||
tableCol = split[0];
|
||||
}
|
||||
if(splitCnt>1) {
|
||||
excelCol = split[1];
|
||||
}
|
||||
if(splitCnt>2) {
|
||||
propConfig = split[2];
|
||||
}
|
||||
if(splitCnt>3) {
|
||||
try {
|
||||
prefW = Integer.parseInt(split[3]);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if(!KUtil.isEmpty(tableCol)&&!KUtil.isEmpty(excelCol)) {
|
||||
if(tableCol.startsWith("#")) {
|
||||
tableCol = tableCol.substring(1);
|
||||
System.out.println(">> Add Search: "+tableCol);
|
||||
if(!this.searchCols.contains(tableCol)) {
|
||||
this.searchCols.add(tableCol);
|
||||
}
|
||||
}
|
||||
this.configs.add(new Config(tableCol, excelCol, propConfig, prefW));
|
||||
}else {
|
||||
System.out.println("ERROR Config: "+pref);
|
||||
}
|
||||
}
|
||||
this.excelFile = KUtil.getDatasetFile(excelDataset);
|
||||
if(this.excelFile==null||!this.excelFile.exists()) {
|
||||
KUtil.error(dialog, ProcessLocale.getString("novalidchooseconfig.ERROR"));
|
||||
return false;
|
||||
}
|
||||
this.tableBean = new KExcelTable(configs, excelFile.getAbsolutePath());
|
||||
return true;
|
||||
}
|
||||
|
||||
public void doSearch() throws Exception{
|
||||
Map<String,String> searchInfo = new HashMap<String, String>();
|
||||
System.out.println("Perform Search..");
|
||||
for (String colName : this.searchComps.keySet()) {
|
||||
String value = this.searchComps.get(colName).getText();
|
||||
if(!KUtil.isEmpty(value)) {
|
||||
System.out.println(">> "+colName+" = "+value);
|
||||
searchInfo.put(colName,value);
|
||||
}
|
||||
}
|
||||
this.tableBean.performSearch(searchInfo);
|
||||
}
|
||||
|
||||
public void doSelect() throws Exception{
|
||||
LinkedHashMap<Config, String> data = this.tableBean.getSelectedData();
|
||||
if(data==null||data.size()<=0) {
|
||||
System.out.println("No Select Info");
|
||||
dialog.disposeDialog();
|
||||
return;
|
||||
}
|
||||
System.out.println("Selected Row: "+Arrays.toString(data.values().toArray()));
|
||||
for (Config colConfig : data.keySet()) {
|
||||
String val = data.get(colConfig);
|
||||
String addition = colConfig.getAdditionalInfo();
|
||||
if(KUtil.isEmpty(addition)) {
|
||||
continue;
|
||||
}
|
||||
System.out.println(">> Set "+addition+" = "+val);
|
||||
for (PrefComponent comp : this.prefComponents) {
|
||||
if(addition.equals(comp.getPropConfig())) {
|
||||
comp.setValue(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
dialog.disposeDialog();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package cn.net.connor.process.commands;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
|
||||
import k.KCommand;
|
||||
import k.edititem.EditItemDialog;
|
||||
import k.edititem.EditItemDialogController;
|
||||
|
||||
public class EditItemCommand extends KCommand{
|
||||
|
||||
public EditItemCommand(AbstractAIFApplication app, String commandId, String actionInfo) {
|
||||
super(app, commandId, actionInfo);
|
||||
this.setRunnable(new EditItemDialog(new EditItemDialogController(app, "Connor_AVIC_CLSJBJ_")));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package cn.net.connor.process.commands;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
|
||||
import cn.net.connor.process.gcjlk.GCJLKDialog;
|
||||
import cn.net.connor.process.gcjlk.GCJLKDialogController;
|
||||
import k.KCommand;
|
||||
|
||||
public class GCJLKCommand extends KCommand{
|
||||
|
||||
public GCJLKCommand(AbstractAIFApplication app, String commandId, String actionInfo) {
|
||||
super(app, commandId, actionInfo);
|
||||
this.setRunnable(new GCJLKDialog(new GCJLKDialogController(app)));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package cn.net.connor.process.commands;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
|
||||
import cn.net.connor.process.ProcessLocale;
|
||||
import cn.net.connor.process.gzbomexport.GZBomExportOperation;
|
||||
import k.KCommand;
|
||||
|
||||
public class GZBomExportCommand extends KCommand{
|
||||
|
||||
public GZBomExportCommand(AbstractAIFApplication app, String commandId, String actionInfo) {
|
||||
super(app, commandId, actionInfo);
|
||||
this.setRunnable(new GZBomExportOperation(app, ProcessLocale.getString("gzbomfunc.TITLE")));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package cn.net.connor.process.commands;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponentBOPLine;
|
||||
import com.teamcenter.rac.util.Registry;
|
||||
|
||||
import cn.net.connor.process.ProcessLocale;
|
||||
import cn.net.connor.process.ProcessUtil;
|
||||
import cn.net.connor.process.meopmodel.DesignModelOperation;
|
||||
import cn.net.connor.process.meopmodel.MeopModelDialog;
|
||||
import cn.net.connor.process.meopmodel.MeopModelDialogController;
|
||||
import k.KCommand;
|
||||
import k.util.KUtil;
|
||||
|
||||
public class MeopModelCommand extends KCommand {
|
||||
|
||||
private static final Registry REG = Registry.getRegistry(MeopModelDialog.class);
|
||||
|
||||
public MeopModelCommand(AbstractAIFApplication app, String commandId, String actionInfo) {
|
||||
super(app, commandId, actionInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void executeCommand() throws Exception {
|
||||
InterfaceAIFComponent target = app.getTargetComponent();
|
||||
System.out.println("Select: " + target);
|
||||
String typeName = "";
|
||||
if (target instanceof TCComponentBOPLine) {
|
||||
typeName = ((TCComponentBOPLine) target).getItem().getType();
|
||||
}
|
||||
if (!ProcessUtil.isMEOP(typeName)) {
|
||||
KUtil.info(null, ProcessLocale.getString("selectmeopline.INFO"));
|
||||
return;
|
||||
}
|
||||
TCComponentBOPLine meopLine = (TCComponentBOPLine) target;
|
||||
MeopModelDialog dialog = new MeopModelDialog(new MeopModelDialogController(app, meopLine));
|
||||
int option = JOptionPane.showOptionDialog(dialog, REG.getString("meopmodeloption.MESSAGE"), "", JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE, null,
|
||||
new String[] { REG.getString("meopmodel"), REG.getString("designmodel") }, null);
|
||||
if (option == JOptionPane.YES_OPTION) {
|
||||
System.out.println("select meop model");
|
||||
this.setRunnable(dialog);
|
||||
} else if (option == JOptionPane.NO_OPTION) {
|
||||
System.out.println("select design model");
|
||||
this.setRunnable(new DesignModelOperation(app, REG.getString("designmodel.STATUS"), meopLine));
|
||||
} else {
|
||||
System.out.println("cancel");
|
||||
}
|
||||
super.executeCommand();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package cn.net.connor.process.commands;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
|
||||
import cn.net.connor.process.modifymeopno.ModifyMeopNoDialog;
|
||||
import cn.net.connor.process.modifymeopno.ModifyMeopNoDialogController;
|
||||
import k.KCommand;
|
||||
|
||||
public class ModifyMeopNoCommand extends KCommand{
|
||||
|
||||
public ModifyMeopNoCommand(AbstractAIFApplication app, String commandId, String actionInfo) {
|
||||
super(app, commandId, actionInfo);
|
||||
this.setRunnable(new ModifyMeopNoDialog(new ModifyMeopNoDialogController(app)));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package cn.net.connor.process.commands;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
|
||||
import cn.net.connor.process.newmeop.NewMeopDialog;
|
||||
import cn.net.connor.process.newmeop.NewMeopDialogController;
|
||||
import k.KCommand;
|
||||
|
||||
public class NewMeopCommand extends KCommand {
|
||||
|
||||
public NewMeopCommand(AbstractAIFApplication app, String commandId, String actionInfo) {
|
||||
super(app, commandId, actionInfo);
|
||||
this.setRunnable(new NewMeopDialog(new NewMeopDialogController(app)));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package cn.net.connor.process.commands;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
|
||||
import cn.net.connor.process.newprocess.NewProcessDialog;
|
||||
import cn.net.connor.process.newprocess.NewProcessDialogController;
|
||||
import k.KCommand;
|
||||
|
||||
public class NewProcessCommand extends KCommand{
|
||||
|
||||
public NewProcessCommand(AbstractAIFApplication app, String commandId, String actionInfo) {
|
||||
super(app, commandId, actionInfo);
|
||||
this.setRunnable(new NewProcessDialog(new NewProcessDialogController(app)));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package cn.net.connor.process.commands;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
|
||||
import cn.net.connor.process.ProcessLocale;
|
||||
import cn.net.connor.process.openpcb.OpenPCBOperation;
|
||||
import k.KCommand;
|
||||
|
||||
public class OpenPCBCommand extends KCommand{
|
||||
|
||||
public OpenPCBCommand(AbstractAIFApplication app, String commandId, String actionInfo) {
|
||||
super(app, commandId, actionInfo);
|
||||
this.setRunnable(new OpenPCBOperation(app, ProcessLocale.getString("openpcb.STATUS")));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package cn.net.connor.process.commands;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
|
||||
import cn.net.connor.process.ProcessLocale;
|
||||
import cn.net.connor.process.openpcb.OpenPCBOperation2;
|
||||
import k.KCommand;
|
||||
|
||||
public class OpenPCBCommand2 extends KCommand{
|
||||
|
||||
public OpenPCBCommand2(AbstractAIFApplication app, String commandId, String actionInfo) {
|
||||
super(app, commandId, actionInfo);
|
||||
this.setRunnable(new OpenPCBOperation2(app, ProcessLocale.getString("openpcb.STATUS")));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package cn.net.connor.process.commands;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
|
||||
import cn.net.connor.process.ProcessLocale;
|
||||
import cn.net.connor.process.openpcb.OpenPCBOperation3;
|
||||
import k.KCommand;
|
||||
|
||||
public class OpenPCBCommand3 extends KCommand{
|
||||
|
||||
public OpenPCBCommand3(AbstractAIFApplication app, String commandId, String actionInfo) {
|
||||
super(app, commandId, actionInfo);
|
||||
this.setRunnable(new OpenPCBOperation3(app, ProcessLocale.getString("openpcb.STATUS")));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package cn.net.connor.process.commands;
|
||||
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.ui.IViewPart;
|
||||
import org.eclipse.ui.IWorkbenchPage;
|
||||
import org.eclipse.ui.IWorkbenchWindow;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
import com.teamcenter.rac.util.PlatformHelper;
|
||||
|
||||
import k.KCommand;
|
||||
import k.util.KUtil;
|
||||
|
||||
public class OpenViewCommand extends KCommand{
|
||||
|
||||
public OpenViewCommand(AbstractAIFApplication app, String commandId, String actionInfo) {
|
||||
super(app, commandId, actionInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void executeCommand() throws Exception {
|
||||
System.out.println("Open View: "+actionInfo);
|
||||
if(KUtil.isEmpty(actionInfo)) {
|
||||
return;
|
||||
}
|
||||
Display.getDefault().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
IWorkbenchWindow var1 = AIFUtility.getActiveDesktop().getDesktopWindow();
|
||||
IWorkbenchPage var2 = var1.getActivePage();
|
||||
IViewPart sv = var2.findView(actionInfo);
|
||||
if (sv == null) {
|
||||
sv = var2.showView(actionInfo);
|
||||
}
|
||||
PlatformHelper.getCurrentPage().activate(sv);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package cn.net.connor.process.commands;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
|
||||
import cn.net.connor.process.proctask.ProcTaskDialog;
|
||||
import cn.net.connor.process.proctask.ProcTaskDialogController;
|
||||
import k.KCommand;
|
||||
|
||||
public class ProcTaskCommand extends KCommand{
|
||||
|
||||
public ProcTaskCommand(AbstractAIFApplication app, String commandId, String actionInfo) {
|
||||
super(app, commandId, actionInfo);
|
||||
this.setRunnable(new ProcTaskDialog(new ProcTaskDialogController(app)));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package cn.net.connor.process.commands;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
|
||||
import cn.net.connor.process.processcardmultiple.MultiProcessCardDialog;
|
||||
import cn.net.connor.process.processcardmultiple.MultiProcessCardDialogController;
|
||||
import k.KCommand;
|
||||
|
||||
public class ProcessCardCommand extends KCommand{
|
||||
|
||||
public ProcessCardCommand(AbstractAIFApplication app, String commandId, String actionInfo) {
|
||||
super(app, commandId, actionInfo);
|
||||
// this.setRunnable(new ProcessCardDialog(new ProcessCardDialogController(app, actionInfo)));
|
||||
this.setRunnable(new MultiProcessCardDialog(new MultiProcessCardDialogController(app, actionInfo)));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package cn.net.connor.process.commands;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
|
||||
import cn.net.connor.process.processprocedure.ProcessProcDialog;
|
||||
import cn.net.connor.process.processprocedure.ProcessProcDialogController;
|
||||
import k.KCommand;
|
||||
|
||||
public class ProcessProcedureCommand extends KCommand{
|
||||
|
||||
public ProcessProcedureCommand(AbstractAIFApplication app, String commandId, String actionInfo) {
|
||||
super(app, commandId, actionInfo);
|
||||
this.setRunnable(new ProcessProcDialog(new ProcessProcDialogController(app)));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package cn.net.connor.process.commands;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
|
||||
import cn.net.connor.process.ProcessLocale;
|
||||
import cn.net.connor.process.revisemeprocess.ReviseMEProcessOperation;
|
||||
import k.KCommand;
|
||||
|
||||
public class ReviseMEProcessCommand extends KCommand{
|
||||
|
||||
public ReviseMEProcessCommand(AbstractAIFApplication app, String commandId, String actionInfo) {
|
||||
super(app, commandId, actionInfo);
|
||||
this.setRunnable(new ReviseMEProcessOperation(app, ProcessLocale.getString("revisemeprocess.OP")));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package cn.net.connor.process.commands;
|
||||
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
|
||||
import com.teamcenter.rac.aif.AIFDesktop;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
|
||||
import cn.net.connor.process.ProcessLocale;
|
||||
import k.KCommand;
|
||||
import k.util.KUtil;
|
||||
|
||||
public class ScreenShotCommand extends KCommand {
|
||||
|
||||
private boolean hideTC;
|
||||
private static final String PREF_SCREENSHOT = "Connor_ScreenShot_Command";
|
||||
|
||||
public ScreenShotCommand(AbstractAIFApplication app, String commandId, String actionInfo) {
|
||||
super(app, commandId, actionInfo);
|
||||
this.hideTC = "true".equals(actionInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executeModal() throws Exception {
|
||||
String cmd = KUtil.getPrefVal((TCSession) app.getSession(), PREF_SCREENSHOT);
|
||||
System.out.println("ScreenShot: "+cmd);
|
||||
if(KUtil.isEmpty(cmd)) {
|
||||
KUtil.info(null, String.format(ProcessLocale.getString("prefnotconfiged.ERROR1"), PREF_SCREENSHOT));
|
||||
return;
|
||||
}
|
||||
if(hideTC) {
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// System.out.println(AIFDesktop.getActiveDesktop().getShell());
|
||||
AIFDesktop.getActiveDesktop().getShell().setMinimized(true);
|
||||
}
|
||||
});
|
||||
Thread.sleep(600);
|
||||
}
|
||||
Runtime.getRuntime().exec(cmd);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package cn.net.connor.process.commands;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
|
||||
import cn.net.connor.process.ProcessLocale;
|
||||
import cn.net.connor.process.tsgcexport.TSGCExportOperation;
|
||||
import k.KCommand;
|
||||
|
||||
public class TSGCExportCommand extends KCommand{
|
||||
|
||||
public TSGCExportCommand(AbstractAIFApplication app, String commandId, String actionInfo) {
|
||||
super(app, commandId, actionInfo);
|
||||
this.setRunnable(new TSGCExportOperation(app, ProcessLocale.getString("tsgcexport.STATUS")));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package cn.net.connor.process.commands;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
|
||||
import cn.net.connor.process.tsgcrefexport.TSGCRefExportDialog;
|
||||
import cn.net.connor.process.tsgcrefexport.TSGCRefExportDialogController;
|
||||
import k.KCommand;
|
||||
|
||||
public class TSGCRefExportCommand extends KCommand{
|
||||
|
||||
public TSGCRefExportCommand(AbstractAIFApplication app, String commandId, String actionInfo) {
|
||||
super(app, commandId, actionInfo);
|
||||
this.setRunnable(new TSGCRefExportDialog(new TSGCRefExportDialogController(app)));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package cn.net.connor.process.commands;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
|
||||
import cn.net.connor.process.ProcessLocale;
|
||||
import cn.net.connor.process.gzbomexport.GZBomExportOperation;
|
||||
import cn.net.connor.process.meopviewfx.dialog.TestDialog;
|
||||
import cn.net.connor.process.meopviewfx.dialog.TestDialogController;
|
||||
import cn.net.connor.process.modifymeopno.ModifyMeopNoDialog;
|
||||
import cn.net.connor.process.modifymeopno.ModifyMeopNoDialogController;
|
||||
import cn.net.connor.process.newmeop.NewMeopDialog;
|
||||
import cn.net.connor.process.newmeop.NewMeopDialogController;
|
||||
import cn.net.connor.process.newprocess.NewProcessDialog;
|
||||
import cn.net.connor.process.newprocess.NewProcessDialogController;
|
||||
import cn.net.connor.process.processcard.ProcessCardDialog;
|
||||
import cn.net.connor.process.processcard.ProcessCardDialogController;
|
||||
import cn.net.connor.process.processprocedure.ProcessProcDialog;
|
||||
import cn.net.connor.process.processprocedure.ProcessProcDialogController;
|
||||
import cn.net.connor.process.proctask.ProcTaskDialog;
|
||||
import cn.net.connor.process.proctask.ProcTaskDialogController;
|
||||
import k.KCommand;
|
||||
|
||||
public class TestCommand extends KCommand{
|
||||
|
||||
public TestCommand(AbstractAIFApplication app, String commandId, String actionInfo) {
|
||||
super(app, commandId, actionInfo);
|
||||
this.setRunnable(new NewProcessDialog(new NewProcessDialogController(app)));
|
||||
this.setRunnable(new GZBomExportOperation(app, ProcessLocale.getString("gzbomfunc.TITLE")));
|
||||
this.setRunnable(new TestDialog(new TestDialogController(app)));
|
||||
this.setRunnable(new NewMeopDialog(new NewMeopDialogController(app)));
|
||||
this.setRunnable(new ModifyMeopNoDialog(new ModifyMeopNoDialogController(app)));
|
||||
this.setRunnable(new ProcessProcDialog(new ProcessProcDialogController(app)));
|
||||
this.setRunnable(new ProcessCardDialog(new ProcessCardDialogController(app, "A3_")));
|
||||
this.setRunnable(new ProcTaskDialog(new ProcTaskDialogController(app)));
|
||||
this.setRunnable(new ProcessCardDialog(new ProcessCardDialogController(app, "")));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package cn.net.connor.process.commands;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
|
||||
import cn.net.connor.process.ProcessLocale;
|
||||
import cn.net.connor.process.workflowname.WorkflowNameOperation;
|
||||
import k.KCommand;
|
||||
|
||||
public class WorkflowNameCommand extends KCommand{
|
||||
|
||||
public WorkflowNameCommand(AbstractAIFApplication app, String commandId, String actionInfo) {
|
||||
super(app, commandId, actionInfo);
|
||||
this.setRunnable(new WorkflowNameOperation(app, ProcessLocale.getString("workflowname.CMD")));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,144 @@
|
||||
package cn.net.connor.process.gcjlk;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import javax.swing.table.TableColumnModel;
|
||||
|
||||
import com.teamcenter.rac.util.MessageBox;
|
||||
import com.teamcenter.rac.util.Registry;
|
||||
|
||||
import k.KDialog;
|
||||
import k.KDialogController;
|
||||
import k.util.KUtil;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class GCJLKDialog extends KDialog{
|
||||
|
||||
private static final Registry REG= Registry.getRegistry(GCJLKDialog.class);
|
||||
private GCJLKDialogController controller;
|
||||
private JButton b_export;
|
||||
private JButton b_cancel;
|
||||
protected DefaultTableModel tableModel;
|
||||
protected JTable table;
|
||||
protected String[] header = new String[] {
|
||||
REG.getString("index.COL"),
|
||||
REG.getString("orderno.COL"),
|
||||
REG.getString("quantity.COL"),
|
||||
REG.getString("isfirst.COL")
|
||||
};
|
||||
private int [] headerWidth = new int[] {50, 180, 100, 120};
|
||||
protected JTextField tf_ItemID;
|
||||
protected JTextField tf_RevID;
|
||||
private JButton b_query;
|
||||
|
||||
public GCJLKDialog(KDialogController controller) {
|
||||
super(controller);
|
||||
this.controller = (GCJLKDialogController)controller;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addListeners() {
|
||||
b_cancel.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
disposeDialog();
|
||||
}
|
||||
});
|
||||
b_query.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
try {
|
||||
controller.doQuery();
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
MessageBox.post(GCJLKDialog.this, e1);
|
||||
}
|
||||
}
|
||||
});
|
||||
b_export.addActionListener(new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
try {
|
||||
controller.doExport();
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
MessageBox.post(GCJLKDialog.this, e1);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initUI() {
|
||||
this.setLayout(new BorderLayout());
|
||||
this.add(BorderLayout.NORTH, initQueryPanel());
|
||||
this.add(BorderLayout.CENTER, initTablePanel());
|
||||
this.add(BorderLayout.SOUTH, initBtnPanel());
|
||||
}
|
||||
|
||||
private Component initBtnPanel() {
|
||||
JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 25, 5));
|
||||
panel.add(this.b_export = new JButton(REG.getString("export.BTN")));
|
||||
panel.add(this.b_cancel = new JButton(REG.getString("cancel.BTN")));
|
||||
this.b_cancel.setPreferredSize(this.b_export.getPreferredSize());
|
||||
return panel;
|
||||
}
|
||||
|
||||
private Component initTablePanel() {
|
||||
JPanel panel = new JPanel(new BorderLayout());
|
||||
panel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
|
||||
this.tableModel = new DefaultTableModel();
|
||||
this.table = new JTable(tableModel) {
|
||||
@Override
|
||||
public boolean isCellEditable(int row, int column) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
this.table.getTableHeader().setReorderingAllowed(false);
|
||||
this.table.setRowHeight(23);
|
||||
this.tableModel.setDataVector(null, header);
|
||||
TableColumnModel colModel = this.table.getColumnModel();
|
||||
for(int i=0; i<headerWidth.length; i++) {
|
||||
colModel.getColumn(i).setPreferredWidth(headerWidth[i]);
|
||||
}
|
||||
JScrollPane scroll = new JScrollPane(table);
|
||||
scroll.setPreferredSize(new Dimension(500, 300));
|
||||
panel.add(BorderLayout.CENTER, scroll);
|
||||
return panel;
|
||||
}
|
||||
|
||||
private Component initQueryPanel() {
|
||||
JPanel panel = new JPanel(new GridBagLayout());
|
||||
GridBagConstraints s = getGridBagConstraints(0, 0, new Insets(5, 6, 5, 0));
|
||||
KUtil.newRow(panel, new JLabel(REG.getString("itemid.LABEL")), s, 1);
|
||||
KUtil.addCol(panel, this.tf_ItemID = new JTextField(18), s, 1, 0);
|
||||
KUtil.addCol(panel, new JLabel(" "+REG.getString("revid.LABEL")), s, 1, 0);
|
||||
KUtil.addCol(panel, this.tf_RevID = new JTextField(5), s, 1, 0);
|
||||
KUtil.addCol(panel, new JLabel(" "), s, 1, 1);
|
||||
s.insets.right = 5;
|
||||
KUtil.addCol(panel, this.b_query = new JButton(REG.getString("query.BTN")), s, 1, 0);
|
||||
this.tf_ItemID.setText(controller.targetItemID);
|
||||
this.tf_RevID.setText(controller.targetRevID);
|
||||
this.tf_ItemID.setEditable(false);
|
||||
this.tf_RevID.setEditable(false);
|
||||
return panel;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,195 @@
|
||||
package cn.net.connor.process.gcjlk;
|
||||
|
||||
import java.io.File;
|
||||
import java.sql.Connection;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.swing.filechooser.FileSystemView;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
|
||||
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
import com.teamcenter.rac.kernel.TCComponentBOMLine;
|
||||
import com.teamcenter.rac.kernel.TCComponentBOPWindow;
|
||||
import com.teamcenter.rac.kernel.TCComponentBOPWindowType;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||
import com.teamcenter.rac.kernel.TCException;
|
||||
import com.teamcenter.rac.util.MessageBox;
|
||||
import com.teamcenter.rac.util.Registry;
|
||||
|
||||
import cn.net.connor.process.ProcessUtil;
|
||||
import k.KDialogController;
|
||||
import k.KOperation2;
|
||||
import k.util.KSqlUtil;
|
||||
import k.util.KUtil;
|
||||
import k.word.KWord;
|
||||
import k.word.KWordUtil;
|
||||
|
||||
public class GCJLKDialogController extends KDialogController {
|
||||
|
||||
private TCComponentItemRevision targetRev;
|
||||
private TCComponentItemRevision procRev;
|
||||
protected String targetItemID = "";
|
||||
protected String targetRevID = "";
|
||||
private GCJLKDialog dialog;
|
||||
private String dbUrl;
|
||||
private String dbUser;
|
||||
private String dbPwd;
|
||||
private String sql;
|
||||
private KWord kWord;
|
||||
private static final Registry REG = Registry.getRegistry(GCJLKDialogController.class);
|
||||
private static final String PREF_QUERY_GCJLK = "CONNOR_AVIC_GCJLK_Query";
|
||||
private static final String PREF_EXPORT_GCJLK = "CONNOR_AVIC_GCJLK_Export";
|
||||
|
||||
public GCJLKDialogController(AbstractAIFApplication app) {
|
||||
super(app);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean init() throws Exception {
|
||||
this.dialog = (GCJLKDialog) aifDialog;
|
||||
InterfaceAIFComponent target = app.getTargetComponent();
|
||||
System.out.println("Select: " + target);
|
||||
if (target != null && (target instanceof TCComponentItemRevision)) {
|
||||
this.targetRev = (TCComponentItemRevision) target;
|
||||
}
|
||||
if (this.targetRev == null) {
|
||||
throw new TCException(REG.getString("selectrev.WARN"));
|
||||
}
|
||||
AIFComponentContext[] proc = targetRev.whereReferencedByTypeRelation(null, new String[] { "IMAN_METarget" });
|
||||
System.out.println("proc: " + targetRev + " -> " + Arrays.toString(proc));
|
||||
int procCnt = KUtil.getLen(proc);
|
||||
for (int i = 0; i < procCnt; i++) {
|
||||
InterfaceAIFComponent comp = proc[i].getComponent();
|
||||
if (comp instanceof TCComponentItemRevision) {
|
||||
if (ProcessUtil.isMEProcess(((TCComponentItemRevision) comp).getItem().getType())) {
|
||||
this.procRev = (TCComponentItemRevision) comp;
|
||||
}
|
||||
}
|
||||
}
|
||||
System.out.println("find process: " + this.procRev);
|
||||
if (this.procRev == null) {
|
||||
throw new TCException(REG.getString("noprocess.ERROR"));
|
||||
}
|
||||
this.targetItemID = this.targetRev.getStringProperty("item_id");
|
||||
this.targetRevID = this.targetRev.getStringProperty("item_revision_id");
|
||||
String[] prefValues = KUtil.getPrefVals(session, PREF_QUERY_GCJLK);
|
||||
int len = KUtil.getLen(prefValues);
|
||||
if (len < 4) {
|
||||
throw new TCException(String.format(REG.getString("pref.ERROR1"), PREF_QUERY_GCJLK));
|
||||
}
|
||||
this.dbUrl = prefValues[0];
|
||||
this.dbUser = prefValues[1];
|
||||
this.dbPwd = prefValues[2];
|
||||
this.sql = "";
|
||||
for (int i = 3; i < len; i++) {
|
||||
sql += prefValues[i];
|
||||
if (i != len - 1) {
|
||||
sql += "\n";
|
||||
}
|
||||
}
|
||||
System.out.println("SQL: " + sql);
|
||||
this.kWord = new KWord(session, PREF_EXPORT_GCJLK);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void doQuery() throws Exception {
|
||||
String itemID = dialog.tf_ItemID.getText();
|
||||
// String revID = dialog.tf_RevID.getText();
|
||||
System.out.println(String.format("Query - [%s]", itemID));
|
||||
if (KUtil.isEmpty(itemID)) {
|
||||
throw new TCException(REG.getString("queryinput.ERROR"));
|
||||
}
|
||||
Connection conn = KSqlUtil.getSqlServerConnection(dbUrl, dbUser, dbPwd);
|
||||
try {
|
||||
dialog.tableModel.getDataVector().clear();
|
||||
List<String[]> data = KSqlUtil.queryStringArray(conn, sql, new String[] { itemID }, 3);
|
||||
int rowCnt = data == null ? 0 : data.size();
|
||||
System.out.println("query result count: " + rowCnt);
|
||||
for (int i = 0; i < rowCnt; i++) {
|
||||
String[] rowData = data.get(i);
|
||||
dialog.tableModel.addRow(new Object[] { i + 1, rowData[0], rowData[1], rowData[2] });
|
||||
}
|
||||
} finally {
|
||||
KSqlUtil.free(conn);
|
||||
}
|
||||
}
|
||||
|
||||
public void doExport() throws Exception {
|
||||
int rowNum = dialog.table.getSelectedRow();
|
||||
System.out.println("select row: " + rowNum);
|
||||
if (rowNum < 0) {
|
||||
throw new TCException(REG.getString("selectrow.ERROR"));
|
||||
}
|
||||
String fileName = procRev.getStringProperty("item_id")+REG.getString("filename")+KUtil.getDateStr(new Date(), "_yyyyMMdd")+".docx";
|
||||
FileSystemView fsv = FileSystemView.getFileSystemView();
|
||||
String deskPath = fsv.getHomeDirectory().getPath();
|
||||
String defaultFile = deskPath+File.separator+fileName;
|
||||
File exportFile = KUtil.chooseSaveFile(dialog, defaultFile, "docx");
|
||||
if(exportFile==null) {
|
||||
System.out.println("cancel export");
|
||||
return;
|
||||
}
|
||||
String orderNumber = (String) dialog.table.getValueAt(rowNum, 1);
|
||||
String quantity = (String) dialog.table.getValueAt(rowNum, 2);
|
||||
String isFirst = (String) dialog.table.getValueAt(rowNum, 3);
|
||||
Map<String, String> overwriteTexts = new HashMap<String, String>();
|
||||
overwriteTexts.put(dialog.header[1], orderNumber);
|
||||
overwriteTexts.put(dialog.header[2], quantity);
|
||||
overwriteTexts.put(dialog.header[3], isFirst);
|
||||
System.out.println("Overwrite texts: " + overwriteTexts);
|
||||
dialog.disposeDialog();
|
||||
new KOperation2(AIFUtility.getCurrentApplication(), REG.getString("export.STATUS")) {
|
||||
|
||||
private TCComponentBOMLine procLine;
|
||||
private TCComponentBOPWindow bopWindow;
|
||||
|
||||
@Override
|
||||
public boolean init() throws Exception {
|
||||
TCComponentBOPWindowType bopWindowType = (TCComponentBOPWindowType) session.getTypeComponent("BOPWindow");
|
||||
bopWindow = bopWindowType.createBOPWindow(null);
|
||||
procLine = bopWindow.setWindowTopLine(procRev.getItem(), procRev, null, null);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() throws Exception {
|
||||
try {
|
||||
List<KWord> kWords = new ArrayList<KWord>();
|
||||
kWords.add(kWord);
|
||||
List<TCComponentBOMLine> targetLines = new ArrayList<TCComponentBOMLine>();
|
||||
List<TCComponentItemRevision> meTargetRevs = new ArrayList<TCComponentItemRevision>();
|
||||
targetLines.add(procLine);
|
||||
meTargetRevs.add(targetRev);
|
||||
KWordUtil.startWord();
|
||||
try {
|
||||
KWord.export(session, kWords, REG.getString("filename"), null, targetLines, meTargetRevs, true, overwriteTexts, exportFile);
|
||||
KUtil.info(dialog, REG.getString("export.SUCCESS"));
|
||||
} finally {
|
||||
KWordUtil.closeWord();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
MessageBox.post(dialog, e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearCache() throws Exception {
|
||||
if (bopWindow != null) {
|
||||
bopWindow.refresh();
|
||||
bopWindow.setClearCacheOnClose(true);
|
||||
bopWindow.closeBOPWindow();
|
||||
}
|
||||
}
|
||||
}.executeModeless();
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
selectrev.WARN=\u8BF7\u9009\u62E9\u5BF9\u8C61\u7248\u672C\u8FDB\u884C\u64CD\u4F5C
|
||||
noprocess.ERROR=\u672A\u627E\u5230\u5173\u8054\u7684\u5DE5\u827A
|
||||
export.BTN=\u751F\u6210\u62A5\u8868
|
||||
cancel.BTN=\u53D6\u6D88
|
||||
index.COL=\u5E8F\u53F7
|
||||
orderno.COL=\u8BA2\u5355\u7F16\u53F7
|
||||
quantity.COL=\u6570\u91CF
|
||||
isfirst.COL=\u662F\u5426\u9996\u4EF6\u9274\u5B9A
|
||||
itemid.LABEL=\u7269\u6599\u7F16\u7801
|
||||
revid.LABEL=\u7248\u672C
|
||||
query.BTN=\u8BA2\u5355\u67E5\u8BE2
|
||||
queryinput.ERROR=\u8BF7\u8F93\u5165\u67E5\u8BE2\u6761\u4EF6
|
||||
pref.ERROR1=\u9996\u9009\u9879\u201C%s\u201D\u914D\u7F6E\u9519\u8BEF
|
||||
selectrow.ERROR=\u8BF7\u9009\u62E9\u8981\u6253\u5370\u7684\u8BA2\u5355
|
||||
export.STATUS=\u751F\u6210\u62A5\u8868
|
||||
filename=\u8FC7\u7A0B\u8BB0\u5F55\u5361
|
||||
export.SUCCESS=\u751F\u6210\u62A5\u8868\u5B8C\u6210
|
@ -0,0 +1,149 @@
|
||||
package cn.net.connor.process.gzbomexport;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
|
||||
import org.apache.poi.xssf.usermodel.XSSFRow;
|
||||
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
|
||||
import com.teamcenter.rac.kernel.TCComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponentBOMLine;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||
import com.teamcenter.rac.pse.services.PSEApplicationService;
|
||||
|
||||
import cn.net.connor.process.ProcessLocale;
|
||||
import k.KOperation;
|
||||
import k.util.KUtil;
|
||||
import k.util.POIUtil;
|
||||
|
||||
public class GZBomExportOperation extends KOperation{
|
||||
|
||||
private static final String FILENAME = ProcessLocale.getString("gzbomfilename");
|
||||
private static final String PREF_GZBOMEXPORT = "Connor_GZBomExport";
|
||||
private TCComponentBOMLine topLine;
|
||||
private List<Config> configs = new ArrayList<GZBomExportOperation.Config>();
|
||||
private int rowNum = 2;
|
||||
private XSSFSheet sheet;
|
||||
private XSSFCellStyle cellStyle;
|
||||
private static final int STARTCOL = 0;
|
||||
private String dateformat = "_yyyy_MM_dd";
|
||||
|
||||
public GZBomExportOperation(AbstractAIFApplication app, String opName) {
|
||||
super(app, opName);
|
||||
}
|
||||
|
||||
public class Config{
|
||||
String propName;
|
||||
boolean isBomProp;
|
||||
public Config(String propName, boolean isBomProp) {
|
||||
this.propName = propName;
|
||||
this.isBomProp = isBomProp;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean init() throws Exception {
|
||||
if(!(app instanceof PSEApplicationService)) {
|
||||
KUtil.error(null, ProcessLocale.getString("notinpse.ERROR"));
|
||||
return false;
|
||||
}
|
||||
String[] prefs = KUtil.getPrefVals(session, PREF_GZBOMEXPORT);
|
||||
int len = KUtil.getLen(prefs);
|
||||
for(int i=0;i<len;i++) {
|
||||
String pref = prefs[i].trim();
|
||||
if(pref.length()==1&&Character.isDigit(pref.charAt(0))) {
|
||||
int num = pref.charAt(0)-'0';
|
||||
if(num>=0) {
|
||||
System.out.println("RESET Start Row: "+num);
|
||||
this.rowNum = num;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if(pref.startsWith("##")) {
|
||||
this.dateformat = pref.substring(2);
|
||||
System.out.println("RESET DATE FORMAT: "+this.dateformat);
|
||||
continue;
|
||||
}
|
||||
String propName;
|
||||
boolean isBomProp = pref.startsWith("#");
|
||||
if(isBomProp) {
|
||||
propName = pref.substring(1);
|
||||
}else {
|
||||
propName = pref;
|
||||
}
|
||||
this.configs.add(new Config(propName, isBomProp));
|
||||
}
|
||||
if(this.configs.size()==0) {
|
||||
KUtil.info(null, String.format(ProcessLocale.getString("prefnotconfiged.ERROR1"), PREF_GZBOMEXPORT));
|
||||
return false;
|
||||
}
|
||||
PSEApplicationService pse = (PSEApplicationService) app;
|
||||
this.topLine = pse.getTopBOMLine();
|
||||
if(topLine==null) {
|
||||
KUtil.info(null, ProcessLocale.getString("notopline.ERROR"));
|
||||
return false;
|
||||
}
|
||||
System.out.println("Export: "+topLine);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void exportLine(TCComponentBOMLine parentLine) throws Exception{
|
||||
XSSFRow row = POIUtil.getRow(sheet, rowNum++);
|
||||
TCComponentItemRevision rev = parentLine.getItemRevision();
|
||||
TCComponent form = rev.getRelatedComponent("IMAN_master_form_rev");
|
||||
int colCnt = this.configs.size();
|
||||
for(int i=0;i<colCnt;i++) {
|
||||
int col = STARTCOL+i;
|
||||
Config config = this.configs.get(i);
|
||||
String val;
|
||||
if(KUtil.isEmpty(config.propName)) {
|
||||
val = "";
|
||||
}else {
|
||||
val = config.isBomProp? parentLine.getProperty(config.propName):(form==null?"":form.getProperty(config.propName));
|
||||
}
|
||||
POIUtil.setValue(row, col, val, cellStyle);
|
||||
}
|
||||
AIFComponentContext[] cLines = parentLine.getChildren();
|
||||
int len = KUtil.getLen(cLines);
|
||||
for(int i=0;i<len;i++) {
|
||||
TCComponentBOMLine cLine = (TCComponentBOMLine) cLines[i].getComponent();
|
||||
exportLine(cLine);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() throws Exception {
|
||||
String time = KUtil.isEmpty(dateformat)?"":KUtil.getDateStr(new Date(), dateformat);
|
||||
File file = KUtil.chooseSaveFile(((PSEApplicationService) app).getApplicationPanel(), FILENAME+time+".xlsx");
|
||||
if(file==null) {
|
||||
System.out.println("Cancel Export");
|
||||
return;
|
||||
}
|
||||
System.out.println("Save File: "+file.getAbsolutePath());
|
||||
InputStream input = this.getClass().getResourceAsStream("template.xlsx");
|
||||
XSSFWorkbook wb = new XSSFWorkbook(input);
|
||||
this.cellStyle = POIUtil.getCellStyle(wb, null, false);
|
||||
input.close();
|
||||
this.sheet = wb.getSheetAt(0);
|
||||
exportLine(topLine);
|
||||
FileOutputStream os = new FileOutputStream(file);
|
||||
wb.write(os);
|
||||
os.flush();
|
||||
os.close();
|
||||
int op = JOptionPane.showOptionDialog(((PSEApplicationService) app).getApplicationPanel(), ProcessLocale.getString("exportsuccess.INFO"), "", JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE, null, null, null);
|
||||
if(op==JOptionPane.YES_OPTION) {
|
||||
KUtil.openFile(file);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package cn.net.connor.process.hourcalculation;
|
||||
|
||||
import groovy.lang.Binding;
|
||||
import groovy.lang.GroovyShell;
|
||||
|
||||
public class calculation {
|
||||
public static void main(String[] args) {
|
||||
Binding binding = new Binding();
|
||||
binding.setVariable("零件长度", 1.0);
|
||||
binding.setVariable("切刀厚度", 2.0);
|
||||
binding.setVariable("车端面余量", 3.0);
|
||||
binding.setVariable("每件原材料可出零件数", 4.0);
|
||||
binding.setVariable("夹头", 5.0);
|
||||
|
||||
binding.setVariable("language", "Groovy");
|
||||
|
||||
GroovyShell shell = new GroovyShell(binding);
|
||||
String str = "[(零件长度+切刀厚度+车端面余量)*每件原材料可出零件数+夹头]/2";
|
||||
str = str.replace("[", "(").replace("]", ")");
|
||||
try {
|
||||
String f1 =String.valueOf(shell.evaluate(str));
|
||||
System.out.println(f1);
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
System.out.println("公式中存在未赋值的变量");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,115 @@
|
||||
package cn.net.connor.process.hourcalculation;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import javax.swing.JTextField;
|
||||
import com.teamcenter.rac.aif.AbstractAIFCommand;
|
||||
import com.teamcenter.rac.kernel.TCComponentBOMLine;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||
import com.teamcenter.rac.kernel.TCPreferenceService;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
import cn.net.connor.process.Processknowledgebase.CustomLovBean;
|
||||
|
||||
public class hourCCommand extends AbstractAIFCommand {
|
||||
|
||||
private TCSession session;
|
||||
private TCComponentBOMLine target;
|
||||
public JTextField Field1=new JTextField();
|
||||
public JTextField Field2=new JTextField();
|
||||
public JTextField Field3=new JTextField();
|
||||
public JTextField Field4=new JTextField();
|
||||
public JTextField Field5=new JTextField();
|
||||
// public hourCCommand(TCComponentBOMLine comp, TableView<KTableRow> table, List<PropConfig> propConfigs) {
|
||||
// // TODO Auto-generated constructor stub
|
||||
// this.comp = comp;
|
||||
// this.propConfigs = propConfigs;
|
||||
// try {
|
||||
// executeModal();
|
||||
// } catch (Exception e) {
|
||||
// // TODO Auto-generated catch block
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
|
||||
public hourCCommand(TCSession session,TCComponentBOMLine target,JTextField Field1,JTextField Field2,
|
||||
JTextField Field3,JTextField Field4,JTextField Field5) {
|
||||
// TODO Auto-generated constructor stub
|
||||
try {
|
||||
|
||||
this.session=session;
|
||||
this.target=target;
|
||||
this.Field1=Field1;
|
||||
this.Field2=Field2;
|
||||
this.Field3=Field3;
|
||||
this.Field4=Field4;
|
||||
this.Field5=Field5;
|
||||
|
||||
executeModal();
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executeModal() throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
CustomLovBean top = new CustomLovBean("展开分类库");
|
||||
//获取首选项的分类
|
||||
TCPreferenceService service = session.getPreferenceService();
|
||||
String[] strs = service.getStringValues("AVIC_Assemblyhours_Classification"); //QrlNBWsgJ19vPC
|
||||
|
||||
|
||||
// Map<String,CustomLovBean> parentMap=new HashMap<String, CustomLovBean>();//存放
|
||||
Map<String, Map<String, String>> PtoCMap = new HashMap<String, Map<String, String>>();//
|
||||
|
||||
//大类的排序
|
||||
List<String> parentList=new ArrayList<String>();
|
||||
|
||||
for(String str:strs) {
|
||||
if(str.indexOf("=")>=0) {
|
||||
String[] value=str.split("=");
|
||||
if(value.length==3) {
|
||||
if(!parentList.contains(value[0])) {
|
||||
parentList.add(value[0]);
|
||||
}
|
||||
if(!PtoCMap.containsKey(value[0])) {
|
||||
Map<String,String> map=new HashMap<String, String>();
|
||||
map.put(value[1],value[2]);
|
||||
PtoCMap.put(value[0], map);
|
||||
}else {
|
||||
Map<String,String> map=PtoCMap.get(value[0]);
|
||||
map.put(value[1],value[2]);
|
||||
PtoCMap.put(value[0], map);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//Set<String> parents=PtoCMap.keySet();
|
||||
for (String parent : parentList) {
|
||||
CustomLovBean parentTree=new CustomLovBean(parent);
|
||||
Map<String, String> children=PtoCMap.get(parent);
|
||||
Set<String> childs=children.keySet();
|
||||
for(String child:childs) {
|
||||
parentTree.addSub(new CustomLovBean(child));
|
||||
}
|
||||
top.addSub(parentTree);
|
||||
}
|
||||
|
||||
//判断对象是否有写权限
|
||||
TCComponentItemRevision rev = this.target.getItemRevision();
|
||||
boolean isWrite = session.getTCAccessControlService().checkPrivilege(rev, "WRITE");
|
||||
|
||||
|
||||
new hourCDialog(target,session,top,PtoCMap,isWrite,Field1,Field2,Field3,Field4,Field5);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,155 @@
|
||||
package cn.net.connor.process.hourcalculation;
|
||||
|
||||
import java.awt.image.RenderedImage;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.mail.Flags.Flag;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JTextField;
|
||||
import javax.xml.crypto.Data;
|
||||
|
||||
import com.sun.prism.impl.Disposer.Target;
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aif.AbstractAIFCommand;
|
||||
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
|
||||
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
import com.teamcenter.rac.kernel.TCComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponentBOMLine;
|
||||
import com.teamcenter.rac.kernel.TCComponentDataset;
|
||||
import com.teamcenter.rac.kernel.TCComponentICO;
|
||||
import com.teamcenter.rac.kernel.TCComponentItem;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemType;
|
||||
import com.teamcenter.rac.kernel.TCComponentTcFile;
|
||||
import com.teamcenter.rac.kernel.TCException;
|
||||
import com.teamcenter.rac.kernel.TCPreferenceService;
|
||||
import com.teamcenter.rac.kernel.TCProperty;
|
||||
import com.teamcenter.rac.kernel.TCSession;
|
||||
import com.teamcenter.rac.kernel.ics.ICSProperty;
|
||||
import com.teamcenter.rac.kernel.ics.ICSPropertyDescription;
|
||||
import com.teamcenter.rac.kernel.tcservices.TcServicesService;
|
||||
import com.teamcenter.rac.util.MessageBox;
|
||||
|
||||
import cn.net.connor.process.meopviewfx.bean.KTableRow;
|
||||
import cn.net.connor.process.meopviewfx.bean.PropConfig;
|
||||
import javafx.scene.control.TableView;
|
||||
|
||||
|
||||
|
||||
public class selectionCommand extends AbstractAIFCommand {
|
||||
|
||||
private TCComponentBOMLine comp;
|
||||
private TCSession session;
|
||||
private TableView<KTableRow> table;
|
||||
private List<PropConfig> propConfigs;
|
||||
private TCComponentBOMLine target;
|
||||
|
||||
public JTextField Field1=new JTextField();
|
||||
public JTextField Field2=new JTextField();
|
||||
public JTextField Field3=new JTextField();
|
||||
public JTextField Field4=new JTextField();
|
||||
public JTextField Field5=new JTextField();
|
||||
|
||||
public selectionCommand(TCComponentBOMLine target,JTextField Field1,JTextField Field2,JTextField Field3,JTextField Field4,JTextField Field5) {
|
||||
this.Field1=Field1;
|
||||
this.Field2=Field2;
|
||||
this.Field3=Field3;
|
||||
this.Field4=Field4;
|
||||
this.Field5=Field5;
|
||||
this.target=target;
|
||||
// TODO Auto-generated constructor stub
|
||||
try {
|
||||
executeModal();
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void executeModal() throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
System.out.println("select different dialog by selection");
|
||||
AbstractAIFApplication app = AIFUtility.getCurrentApplication();
|
||||
TCSession session = (TCSession) app.getSession();
|
||||
//获得当前选择的对象类型及对象名称,与首选项进行比对
|
||||
TCPreferenceService service = session.getPreferenceService();
|
||||
String[] strs = service.getStringValues("AVIC_HoursCalculation_Class");
|
||||
if(strs==null||strs.length==0) {
|
||||
MessageBox.post("您选择的工序类型没进行工时定额配置,请与管理员联系", "错误", MessageBox.ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
String type=this.target.getItemRevision().getType();
|
||||
String name=this.target.getItemRevision().getStringProperty("object_name");
|
||||
System.out.println(type+":"+name);
|
||||
|
||||
|
||||
boolean isFind=true;
|
||||
for(String str:strs) {//先遍历查找名称不为空的
|
||||
if(str.split("=").length==3) {
|
||||
if(str.split("=")[0].equals(type)&&!str.split("=")[1].equals("")&&name.indexOf(str.split("=")[1])>=0) {
|
||||
if(str.split("=")[2].equals("装配及钳工工时")) {
|
||||
new hourCCommand(session,target,Field1,Field2,Field3,Field4,Field5);
|
||||
return;
|
||||
}else if(str.split("=")[2].equals("机加工时")) {
|
||||
new FitterCommand(session,target,Field1,Field2,Field3,Field4);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(String str:strs) {//若名称不为空的没找到,再遍历为空的
|
||||
if(str.split("=").length==3) {
|
||||
if(str.split("=")[0].equals(type)&&name.indexOf(str.split("=")[1])>=0) {
|
||||
if(str.split("=")[2].equals("装配及钳工工时")) {
|
||||
new hourCCommand(session,target,Field1,Field2,Field3,Field4,Field5);
|
||||
return;
|
||||
}else if(str.split("=")[2].equals("机加工时")) {
|
||||
new FitterCommand(session,target,Field1,Field2,Field3,Field4);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
for(String str:strs) {
|
||||
if(str.split("=").length==2) {
|
||||
if(str.split("=")[0].equals(type)) {
|
||||
if(str.split("=")[1].equals("装配及钳工工时")) {
|
||||
new hourCCommand(session,target,Field1,Field2,Field3,Field4,Field5);
|
||||
return;
|
||||
// new FitterCommand(session,target,Field1,Field2);
|
||||
// return;
|
||||
}else if(str.split("=")[1].equals("机加工时")) {
|
||||
new FitterCommand(session,target,Field1,Field2,Field3,Field4);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MessageBox.post("您选择的工序类型没进行工时定额配置,请与管理员联系", "错误", MessageBox.ERROR);
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,133 @@
|
||||
package cn.net.connor.process.meopmodel;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.kernel.TCComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponentBOMLine;
|
||||
import com.teamcenter.rac.kernel.TCComponentBOPLine;
|
||||
import com.teamcenter.rac.kernel.TCComponentDataset;
|
||||
import com.teamcenter.rac.kernel.TCComponentItem;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemType;
|
||||
import com.teamcenter.rac.kernel.TCException;
|
||||
import com.teamcenter.rac.util.Registry;
|
||||
|
||||
import cn.net.connor.process.ProcessUtil;
|
||||
import k.KOperation2;
|
||||
import k.util.KUtil;
|
||||
|
||||
public class DesignModelOperation extends KOperation2 {
|
||||
|
||||
private TCComponentBOPLine meopLine;
|
||||
private TCComponentItemType itemType;
|
||||
private TCComponentBOMLine processLine;
|
||||
private TCComponentItemRevision meTargetRev;
|
||||
private List<TCComponent> datasets;
|
||||
public static final String TYPE_ITEM = "Ac5_GXMX";
|
||||
public static final String REL_REV_DATASET = "IMAN_specification";
|
||||
public static final String TYPE_DATASET = "CATPart";
|
||||
private static final Registry REG = Registry.getRegistry(DesignModelOperation.class);
|
||||
|
||||
public DesignModelOperation(AbstractAIFApplication app, String opName, TCComponentBOPLine meopLine) {
|
||||
super(app, opName);
|
||||
this.meopLine = meopLine;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean init() throws Exception {
|
||||
if (this.meopLine == null) {
|
||||
throw new TCException("meopLine can not be null");
|
||||
}
|
||||
try {
|
||||
this.itemType = (TCComponentItemType) session.getTypeComponent(TYPE_ITEM);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (this.itemType == null) {
|
||||
throw new TCException("Type is not defined: " + TYPE_ITEM);
|
||||
}
|
||||
TCComponentBOMLine pLine = this.meopLine.parent();
|
||||
while (pLine != null) {
|
||||
if (ProcessUtil.isMEProcess(pLine.getItem().getType())) {
|
||||
this.processLine = pLine;
|
||||
break;
|
||||
}
|
||||
pLine = pLine.parent();
|
||||
}
|
||||
System.out.println("Process line: " + this.processLine);
|
||||
if (this.processLine == null) {
|
||||
throw new TCException(REG.getString("meprocessnotfound.ERROR"));
|
||||
}
|
||||
TCComponent[] meTargetRevs = this.processLine.getItemRevision().getRelatedComponents("IMAN_METarget");
|
||||
System.out.println("METargets: " + Arrays.toString(meTargetRevs));
|
||||
this.meTargetRev = getLatestReleasedRev(meTargetRevs);
|
||||
System.out.println("Latest Released Rev: " + meTargetRev);
|
||||
if (this.meTargetRev == null) {
|
||||
throw new TCException(REG.getString("releasedmetargetnotfound.ERROR"));
|
||||
}
|
||||
this.datasets = KUtil.getChildComponents(meTargetRev, TYPE_DATASET, REL_REV_DATASET);
|
||||
System.out.println("Datasets: " + datasets);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static TCComponentItemRevision getLatestReleasedRev(TCComponent[] comps) {
|
||||
int size = comps == null ? 0 : comps.length;
|
||||
if (size == 0) {
|
||||
return null;
|
||||
}
|
||||
TCComponentItemRevision res = null;
|
||||
Date maxDate = null;
|
||||
try {
|
||||
for (int i = 0; i < size; i++) {
|
||||
TCComponent temp = comps[i];
|
||||
if (!(temp instanceof TCComponentItemRevision)) {
|
||||
continue;
|
||||
}
|
||||
Date tempDate = temp.getDateProperty("date_released");
|
||||
if (tempDate == null) {
|
||||
continue;
|
||||
}
|
||||
if (maxDate == null || tempDate.after(maxDate)) {
|
||||
maxDate = tempDate;
|
||||
res = (TCComponentItemRevision) temp;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() throws Exception {
|
||||
String objectName = this.meTargetRev.getStringProperty("object_name") + REG.getString("name.SUFFIX");
|
||||
String itemID = itemType.getNewID();
|
||||
String revID = itemType.getNewRev(null);
|
||||
TCComponentItem newItem = itemType.create(itemID, revID, TYPE_ITEM, objectName, "", null);
|
||||
System.out.println("New item: " + newItem);
|
||||
newItem.refresh();
|
||||
TCComponentItemRevision newRev = newItem.getLatestItemRevision();
|
||||
System.out.println("New rev: " + newRev);
|
||||
newRev.refresh();
|
||||
TCComponentBOMLine newLine = this.meopLine.add(newItem, newRev, null, false);
|
||||
System.out.println("New line: " + newLine);
|
||||
int datasetCnt = this.datasets == null ? 0 : this.datasets.size();
|
||||
for (int i = 0; i < datasetCnt; i++) {
|
||||
TCComponentDataset dataset = (TCComponentDataset) datasets.get(i);
|
||||
TCComponentDataset newDataset = dataset.saveAs(dataset.getStringProperty("object_name"));
|
||||
System.out.println("New dataset: " + newDataset);
|
||||
newRev.add(REL_REV_DATASET, newDataset);
|
||||
}
|
||||
newRev.refresh();
|
||||
this.meopLine.refresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearCache() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
package cn.net.connor.process.meopmodel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
|
||||
import com.teamcenter.rac.kernel.TCComponentBOPLine;
|
||||
import com.teamcenter.rac.kernel.TCComponentItem;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||
|
||||
import cn.net.connor.process.ProcessUtil;
|
||||
import k.util.KUtil;
|
||||
|
||||
public class MeopModelBean {
|
||||
|
||||
private TCComponentBOPLine meopLine;
|
||||
private List<TCComponentItemRevision> gxmxRevs;
|
||||
private String opNum;
|
||||
private String opName;
|
||||
|
||||
private MeopModelBean(TCComponentBOPLine meopLine, List<TCComponentItemRevision> gxmxRevs, String opNum, String opName) {
|
||||
this.meopLine = meopLine;
|
||||
this.gxmxRevs = gxmxRevs;
|
||||
this.opNum = opNum;
|
||||
this.opName = opName;
|
||||
}
|
||||
|
||||
public TCComponentBOPLine getMeopLine() {
|
||||
return meopLine;
|
||||
}
|
||||
|
||||
public List<TCComponentItemRevision> getGxmxRevs() {
|
||||
return gxmxRevs;
|
||||
}
|
||||
|
||||
public static MeopModelBean parse(TCComponentBOPLine meopLine) throws Exception {
|
||||
System.out.println("check line: " + meopLine);
|
||||
if (meopLine == null) {
|
||||
return null;
|
||||
}
|
||||
TCComponentItem meopItem = meopLine.getItem();
|
||||
if (meopItem == null) {
|
||||
System.out.println(">> get item failed");
|
||||
return null;
|
||||
}
|
||||
TCComponentItemRevision meopRev = meopLine.getItemRevision();
|
||||
if(meopRev==null) {
|
||||
System.out.println(">> get itemrevision failed");
|
||||
return null;
|
||||
}
|
||||
if (!ProcessUtil.isMEOP(meopItem.getType())) {
|
||||
System.out.println(">> not meop");
|
||||
return null;
|
||||
}
|
||||
AIFComponentContext[] cc = meopLine.getChildren();
|
||||
List<TCComponentItemRevision> gxmxRevs = new ArrayList<TCComponentItemRevision>();
|
||||
int len = KUtil.getLen(cc);
|
||||
for (int i = 0; i < len; i++) {
|
||||
TCComponentBOPLine cLine = (TCComponentBOPLine) cc[i].getComponent();
|
||||
TCComponentItemRevision cRev = cLine.getItemRevision();
|
||||
String cType = cRev == null ? "" : cRev.getItem().getType();
|
||||
System.out.println(">> " + cRev + "|" + cType);
|
||||
if (DesignModelOperation.TYPE_ITEM.equals(cType)) {
|
||||
gxmxRevs.add(cRev);
|
||||
}
|
||||
}
|
||||
if (gxmxRevs.size()==0) {
|
||||
System.out.println(">> no gxmx");
|
||||
return null;
|
||||
}
|
||||
String opNum = meopRev.getRelatedComponent("IMAN_master_form_rev").getStringProperty("ac5_OperationNumber");
|
||||
String opName = meopRev.getStringProperty("object_name");
|
||||
return new MeopModelBean(meopLine, gxmxRevs, opNum, opName);
|
||||
}
|
||||
|
||||
public Object[] getRowData() {
|
||||
return new Object[] {this, opName};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return opNum;
|
||||
}
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
package cn.net.connor.process.meopmodel;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Component;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
|
||||
import com.teamcenter.rac.util.MessageBox;
|
||||
import com.teamcenter.rac.util.Registry;
|
||||
|
||||
import k.KDialog;
|
||||
import k.KDialogController;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class MeopModelDialog extends KDialog{
|
||||
private static final Registry REG = Registry.getRegistry(MeopModelDialog.class);
|
||||
private MeopModelDialogController controller;
|
||||
private JButton b_ok;
|
||||
private JButton b_cancel;
|
||||
protected DefaultTableModel tableModel;
|
||||
protected JTable table;
|
||||
public MeopModelDialog(KDialogController controller) {
|
||||
super(controller);
|
||||
this.controller = (MeopModelDialogController)controller;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addListeners() {
|
||||
b_ok.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
try {
|
||||
controller.doCreate();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
MessageBox.post(MeopModelDialog.this, e);
|
||||
}
|
||||
}
|
||||
});
|
||||
b_cancel.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
disposeDialog();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initUI() {
|
||||
this.setTitle("");
|
||||
// this.setPreferredSize(new Dimension(300, 300));
|
||||
this.setLayout(new BorderLayout());
|
||||
this.add(BorderLayout.CENTER, initTablePanel());
|
||||
this.add(BorderLayout.SOUTH, initBtnPanel());
|
||||
}
|
||||
|
||||
private Component initBtnPanel() {
|
||||
JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 25, 5));
|
||||
panel.add(b_ok = new JButton(REG.getString("ok.BTN")));
|
||||
panel.add(b_cancel = new JButton(REG.getString("cancel.BTN")));
|
||||
return panel;
|
||||
}
|
||||
|
||||
private Component initTablePanel() {
|
||||
JPanel panel = new JPanel(new BorderLayout());
|
||||
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5));
|
||||
this.tableModel = new DefaultTableModel();
|
||||
this.table = new JTable(tableModel) {
|
||||
public boolean isCellEditable(int row, int column) {
|
||||
return false;
|
||||
};
|
||||
};
|
||||
this.table.getTableHeader().setReorderingAllowed(false);
|
||||
this.table.setRowHeight(23);
|
||||
String[] header = new String[] {REG.getString("opnum.COL"), REG.getString("opname.COL")};
|
||||
this.tableModel.setDataVector(null, header);
|
||||
JScrollPane scroll = new JScrollPane(table);
|
||||
panel.add(BorderLayout.CENTER, scroll);
|
||||
int rowCnt = controller.meopModelBeans.size();
|
||||
for(int i=0;i<rowCnt;i++) {
|
||||
this.tableModel.addRow(controller.meopModelBeans.get(i).getRowData());
|
||||
}
|
||||
this.table.getColumnModel().getColumn(0).setPreferredWidth(120);
|
||||
this.table.getColumnModel().getColumn(1).setPreferredWidth(240);
|
||||
return panel;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,126 @@
|
||||
package cn.net.connor.process.meopmodel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
|
||||
import com.teamcenter.rac.kernel.DeepCopyInfo;
|
||||
import com.teamcenter.rac.kernel.TCComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponentBOMLine;
|
||||
import com.teamcenter.rac.kernel.TCComponentBOPLine;
|
||||
import com.teamcenter.rac.kernel.TCComponentDataset;
|
||||
import com.teamcenter.rac.kernel.TCComponentItem;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemType;
|
||||
import com.teamcenter.rac.kernel.TCException;
|
||||
import com.teamcenter.rac.util.Registry;
|
||||
|
||||
import k.KDialogController;
|
||||
import k.KOperation2;
|
||||
import k.util.KUtil;
|
||||
|
||||
public class MeopModelDialogController extends KDialogController{
|
||||
|
||||
private TCComponentBOPLine targetLine;
|
||||
protected List<MeopModelBean> meopModelBeans = new ArrayList<MeopModelBean>();
|
||||
private MeopModelDialog dialog;
|
||||
private TCComponentItemType itemType;
|
||||
private static final Registry REG = Registry.getRegistry(MeopModelDialogController.class);
|
||||
public MeopModelDialogController(AbstractAIFApplication app, TCComponentBOPLine meopLine) {
|
||||
super(app);
|
||||
this.targetLine = meopLine;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean init() throws Exception {
|
||||
this.dialog = (MeopModelDialog)aifDialog;
|
||||
TCComponentBOMLine pLine = targetLine.parent();
|
||||
AIFComponentContext[] cc = pLine.getChildren();
|
||||
int len = KUtil.getLen(cc);
|
||||
for(int i=0; i<len; i++) {
|
||||
TCComponentBOPLine cLine = (TCComponentBOPLine) cc[i].getComponent();
|
||||
MeopModelBean bean = MeopModelBean.parse(cLine);
|
||||
if(bean==null) {
|
||||
continue;
|
||||
}
|
||||
meopModelBeans.add(bean);
|
||||
}
|
||||
if(this.meopModelBeans.size()==0) {
|
||||
throw new TCException(REG.getString("nomeopmodel.ERROR"));
|
||||
}
|
||||
try {
|
||||
this.itemType = (TCComponentItemType) session.getTypeComponent(DesignModelOperation.TYPE_ITEM);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (this.itemType == null) {
|
||||
throw new TCException("Type is not defined: " + DesignModelOperation.TYPE_ITEM);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void doCreate() throws Exception{
|
||||
int rowNum = dialog.table.getSelectedRow();
|
||||
System.out.println("select row: "+rowNum);
|
||||
if(rowNum<0) {
|
||||
return;
|
||||
}
|
||||
dialog.disposeDialog();
|
||||
new KOperation2(app, REG.getString("create.STATUS")) {
|
||||
@Override
|
||||
public boolean init() throws Exception {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() throws Exception {
|
||||
MeopModelBean bean = (MeopModelBean) dialog.table.getValueAt(rowNum, 0);
|
||||
TCComponentBOPLine meopLine = bean.getMeopLine();
|
||||
List<TCComponentItemRevision> gxmxRevs = bean.getGxmxRevs();
|
||||
System.out.println("template: "+meopLine+" -> "+gxmxRevs);
|
||||
int cnt = gxmxRevs.size();
|
||||
for(int i=0; i<cnt ; i++) {
|
||||
session.setStatus(String.format("( %d / %d ) %s", i+1, cnt, REG.getString("gxmxsaveas.STATUS")));
|
||||
TCComponentItemRevision rev = gxmxRevs.get(i);
|
||||
System.out.println("copy "+rev);
|
||||
String itemID = itemType.getNewID();
|
||||
String revID = itemType.getNewRev(null);
|
||||
String objectName = rev.getStringProperty("object_name");
|
||||
List<DeepCopyInfo> deepCopyInfos = new ArrayList<DeepCopyInfo>();
|
||||
List<TCComponent> datasets = KUtil.getChildComponents(rev, DesignModelOperation.TYPE_DATASET, DesignModelOperation.REL_REV_DATASET);
|
||||
System.out.println(">> find datasets: "+datasets);
|
||||
int dsCnt = datasets == null?0:datasets.size();
|
||||
for(int j=0; j<dsCnt; j++) {
|
||||
TCComponent ds = datasets.get(j);
|
||||
DeepCopyInfo deepCopyInfo = new DeepCopyInfo(ds, DeepCopyInfo.COPY_NOT_ACTION, ds.getStringProperty("object_name")+" do not copy", DesignModelOperation.REL_REV_DATASET, false, false, false);
|
||||
deepCopyInfos.add(deepCopyInfo);
|
||||
}
|
||||
TCComponentItem newItem = rev.saveAsItem(itemID, revID, objectName, "", false, deepCopyInfos.toArray(new DeepCopyInfo[] {}));
|
||||
System.out.println(">> new Item: "+newItem);
|
||||
newItem.refresh();
|
||||
TCComponentItemRevision newRev = newItem.getLatestItemRevision();
|
||||
System.out.println(">> new rev: " + newRev);
|
||||
newRev.refresh();
|
||||
for(int j=0; j<dsCnt; j++) {
|
||||
TCComponentDataset ds = (TCComponentDataset) datasets.get(j);
|
||||
TCComponentDataset newDataset = ds.saveAs(ds.getStringProperty("object_name"));
|
||||
System.out.println(">> new dataset: " + newDataset);
|
||||
newRev.add(DesignModelOperation.REL_REV_DATASET, newDataset);
|
||||
}
|
||||
newRev.refresh();
|
||||
TCComponentBOMLine newLine = targetLine.add(newItem, newRev, null, false);
|
||||
System.out.println(">> new line: " + newLine);
|
||||
}
|
||||
targetLine.refresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearCache() throws Exception {
|
||||
|
||||
}
|
||||
}.executeModeless();
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
meopmodeloption.MESSAGE=\u4ECE\u5DE5\u5E8F\u63D0\u53D6\u5DE5\u5E8F\u6A21\u578B\u6216\u4ECE\u8BBE\u8BA1\u63D0\u53D6\u5DE5\u5E8F\u6A21\u578B
|
||||
meopmodel=\u5DE5\u5E8F\u6A21\u578B
|
||||
designmodel=\u8BBE\u8BA1\u6A21\u578B
|
||||
designmodel.STATUS=\u4ECE\u8BBE\u8BA1\u63D0\u53D6\u5DE5\u5E8F\u6A21\u578B
|
||||
meprocessnotfound.ERROR=\u672A\u627E\u5230\u4E0A\u5C42\u5DE5\u827A
|
||||
releasedmetargetnotfound.ERROR=\u672A\u627E\u5230\u6700\u65B0\u7684\u53D1\u5E03\u7248\u672C\u7684\u5236\u9020\u76EE\u6807
|
||||
name.SUFFIX=_\u5DE5\u5E8F\u6A21\u578B
|
||||
nomeopmodel.ERROR=\u672A\u627E\u5230\u5DE5\u5E8F\u6A21\u578B\u6570\u636E
|
||||
ok.BTN=\u786E\u5B9A
|
||||
cancel.BTN=\u53D6\u6D88
|
||||
opnum.COL=\u5DE5\u5E8F\u53F7
|
||||
opname.COL=\u5DE5\u5E8F\u540D\u79F0
|
||||
create.STATUS=\u751F\u6210\u5DE5\u5E8F\u4E09\u7EF4\u6A21\u578B
|
||||
gxmxsaveas.STATUS=\u53E6\u5B58\u5DE5\u5E8F\u6A21\u578B
|
@ -0,0 +1,60 @@
|
||||
package cn.net.connor.process.meopviewfx;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.swt.layout.FillLayout;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
|
||||
import com.teamcenter.rac.aifrcp.AIFUtility;
|
||||
import com.teamcenter.rac.ui.views.AbstractContentViewPart;
|
||||
|
||||
import cn.net.connor.process.meopviewfx.ui.MEOPPanel;
|
||||
import javafx.embed.swt.FXCanvas;
|
||||
|
||||
public class MEOPEditView extends AbstractContentViewPart {
|
||||
public static final String ID = MEOPEditView.class.getName();
|
||||
private Object currentObj = null;
|
||||
private MEOPPanel meopPanel;
|
||||
|
||||
@Override
|
||||
protected void processEmptySelection(IWorkbenchPart iWorkbenchPart, List<Object> list) {
|
||||
if (list == null || list.size() != 1) {
|
||||
return;
|
||||
}
|
||||
final Object target = list.get(0);
|
||||
if (target != null && !(target.equals(currentObj))) {
|
||||
System.out.println("Select: " + target);
|
||||
currentObj = target;
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if(meopPanel!=null)
|
||||
meopPanel.updateSelection(target);
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}
|
||||
|
||||
public MEOPEditView() {
|
||||
this.setProcessNullSelectionsEnabled(true);
|
||||
this.setUseScrolledForm(false);
|
||||
this.setShowHeader(true);
|
||||
this.setMultiSelectionSupported(true);
|
||||
this.setUISupportsAssociate(false);
|
||||
this.setUISupportsSetScope(false);
|
||||
this.setUISupportsViewLocking(true);
|
||||
this.setUseInitialInputJobEnabled(false);
|
||||
this.setProcessSelectionFromSiblingViewEnabled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createContent(Composite parent) {
|
||||
System.out.println("Init UI...");
|
||||
parent.setLayout(new FillLayout());
|
||||
FXCanvas fxCanvas = new FXCanvas(parent, 16777216);
|
||||
fxCanvas.setScene((this.meopPanel = new MEOPPanel(AIFUtility.getCurrentApplication().getDesktop())).getScene());
|
||||
System.out.println("Init UI Complete");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,190 @@
|
||||
package cn.net.connor.process.meopviewfx.bean;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
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 javafx.beans.property.SimpleStringProperty;
|
||||
import k.util.KUtil;
|
||||
|
||||
public class KTableRow {
|
||||
|
||||
public static final String BOMLINE = "BOMLINE";
|
||||
public static final String ITEM = "ITEM";
|
||||
public static final String ITEMMASTER = "ITEMMASTER";
|
||||
public static final String REV = "REV";
|
||||
public static final String REVMASTER = "REVMASTER";
|
||||
|
||||
private TCComponentBOMLine bomline;
|
||||
private TCComponentItem item;
|
||||
private TCComponentItemRevision rev;
|
||||
private TCComponent itemMaster;
|
||||
private TCComponent revMaster;
|
||||
|
||||
public KTableRow(TCComponentBOMLine bomline, TCComponentItem item, TCComponentItemRevision rev, TCComponent itemMaster, TCComponent revMaster) {
|
||||
this.bomline = bomline;
|
||||
this.item = item;
|
||||
this.rev = rev;
|
||||
this.itemMaster = itemMaster;
|
||||
this.revMaster = revMaster;
|
||||
}
|
||||
|
||||
public Map<PropConfig, SimpleStringProperty> stringProps = new HashMap<PropConfig, SimpleStringProperty>();
|
||||
private Map<PropConfig,String> savedValues = new HashMap<PropConfig, String>();
|
||||
|
||||
public boolean parseConfig(PropConfig config) throws Exception{
|
||||
if(config==null) {
|
||||
return true;
|
||||
}
|
||||
String value = getTCValue(config.propLoc, config.propName);
|
||||
stringProps.put(config, new SimpleStringProperty(value));
|
||||
savedValues.put(config, value);
|
||||
if (!KUtil.isEmpty(config.filterValue)) {
|
||||
//&& !config.filterValue.equals(value)
|
||||
// 20200722 split filter
|
||||
String[] filters = config.filterValue.split(";");
|
||||
boolean checkOK = false;
|
||||
for (String string : filters) {
|
||||
if(string.equals(value)) {
|
||||
checkOK=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return checkOK;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getTCValue(String proploc, String propName) throws Exception{
|
||||
TCComponent comp = getTCComponent(proploc);
|
||||
if(comp == null) {
|
||||
return "";
|
||||
}
|
||||
return comp.getStringProperty(propName);
|
||||
}
|
||||
|
||||
public TCComponent getTCComponent(String proploc) {
|
||||
if(KUtil.isEmpty(proploc)) {
|
||||
return bomline;
|
||||
}
|
||||
proploc = proploc.toUpperCase();
|
||||
switch (proploc) {
|
||||
case BOMLINE:
|
||||
return bomline;
|
||||
case ITEM:
|
||||
return item;
|
||||
case REV:
|
||||
return rev;
|
||||
case ITEMMASTER:
|
||||
return itemMaster;
|
||||
case REVMASTER:
|
||||
return revMaster;
|
||||
default:
|
||||
System.out.println(">> Prop location error: " + proploc);
|
||||
break;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean loadTCValues(Map<String, String> bomlinePropMap , Map<String, String> itemPropMap,Map<String, String> revPropMap, Map<String, String> itemMasterPropMap,Map<String, String> revMasterPropMap ) {
|
||||
boolean modified = false;
|
||||
for (PropConfig config : stringProps.keySet()) {
|
||||
if(!config.canEdit) {
|
||||
continue;
|
||||
}
|
||||
String value = stringProps.get(config).getValueSafe();
|
||||
if(savedValues.containsKey(config)) {
|
||||
String savedValue = savedValues.get(config);
|
||||
if(value.equals(savedValue)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
modified = true;
|
||||
String propName = config.propName;
|
||||
String proploc = config.propLoc.toUpperCase();
|
||||
System.out.println(">> "+proploc+"."+propName+" = "+value);
|
||||
switch(proploc) {
|
||||
case BOMLINE:
|
||||
bomlinePropMap.put(propName, value);
|
||||
break;
|
||||
case ITEM:
|
||||
itemPropMap.put(propName, value);
|
||||
if("object_name".equals(propName)) {
|
||||
revPropMap.put(propName, value);
|
||||
}
|
||||
break;
|
||||
case REV:
|
||||
revPropMap.put(propName, value);
|
||||
if("object_name".equals(propName)) {
|
||||
itemPropMap.put(propName, value);
|
||||
}
|
||||
break;
|
||||
case ITEMMASTER:
|
||||
itemMasterPropMap.put(propName, value);
|
||||
break;
|
||||
case REVMASTER:
|
||||
revMasterPropMap.put(propName, value);
|
||||
break;
|
||||
default:
|
||||
System.out.println(">> Prop location error: " + proploc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return modified;
|
||||
}
|
||||
|
||||
public void saveTCData(TCComponentBOMLine parentLine, TCComponentItemType itemType) throws Exception{
|
||||
if(bomline==null) {
|
||||
if(itemType!=null&&parentLine!=null) {
|
||||
System.out.println("Create New Row...");
|
||||
item = itemType.create(itemType.getNewID(), itemType.getNewRev(null), itemType.getName(), "-", "", null);
|
||||
System.out.println(">> new item: "+item);
|
||||
rev= item.getLatestItemRevision();
|
||||
itemMaster = item.getRelatedComponent("IMAN_master_form");
|
||||
revMaster = rev.getRelatedComponent("IMAN_master_form_rev");
|
||||
bomline = parentLine.add(item, rev, null, false, "");
|
||||
}
|
||||
}
|
||||
if(bomline==null) {
|
||||
return;
|
||||
}
|
||||
System.out.println("Update: "+bomline);
|
||||
Map<String, String> revPropMap = new HashMap<>();
|
||||
Map<String, String> revMasterPropMap = new HashMap<>();
|
||||
Map<String, String> itemPropMap = new HashMap<>();
|
||||
Map<String, String> itemMasterPropMap = new HashMap<>();
|
||||
Map<String, String> bomlinePropMap = new HashMap<>();
|
||||
if(!loadTCValues(bomlinePropMap, itemPropMap, revPropMap, itemMasterPropMap, revMasterPropMap)) {
|
||||
return;
|
||||
}
|
||||
if(itemPropMap.size()>0) {
|
||||
item.setProperties(itemPropMap);
|
||||
}
|
||||
if(revPropMap.size()>0) {
|
||||
rev.setProperties(revPropMap);
|
||||
}
|
||||
if(itemMasterPropMap.size()>0) {
|
||||
itemMaster.setProperties(itemMasterPropMap);
|
||||
}
|
||||
if(revMasterPropMap.size()>0) {
|
||||
revMaster.setProperties(revMasterPropMap);
|
||||
}
|
||||
if(bomlinePropMap.size()>0) {
|
||||
bomline.setProperties(bomlinePropMap);
|
||||
}
|
||||
bomline.refresh();
|
||||
}
|
||||
|
||||
public void removeLine(TCComponentBOMLine parentLine) throws Exception{
|
||||
if(bomline!=null) {
|
||||
System.out.println(">> Remove: "+bomline);
|
||||
bomline.cut();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package cn.net.connor.process.meopviewfx.bean;
|
||||
|
||||
import com.teamcenter.rac.kernel.TCComponentListOfValues;
|
||||
import com.teamcenter.rac.kernel.TCPropertyDescriptor;
|
||||
|
||||
import javafx.scene.control.Control;
|
||||
|
||||
public class PropConfig {
|
||||
public String propName;
|
||||
public String propDisplayName;
|
||||
public String propLoc;
|
||||
public TCComponentListOfValues lov;
|
||||
public String filterValue;
|
||||
public TCPropertyDescriptor propDesc;
|
||||
public int width;
|
||||
public int maxCharacterInRow;
|
||||
public boolean canEdit;
|
||||
private Control control;
|
||||
private Object savedValue;
|
||||
|
||||
public PropConfig(String propLoc, TCPropertyDescriptor propDesc, String filterValue, int width, int maxCharacterInRow) {
|
||||
this.propName = propDesc.getName();
|
||||
this.propDisplayName = propDesc.getDisplayName();
|
||||
this.propLoc = propLoc;
|
||||
this.filterValue = filterValue;
|
||||
this.lov = propDesc.getLOV();
|
||||
this.propDesc = propDesc;
|
||||
this.width = width;
|
||||
this.maxCharacterInRow = maxCharacterInRow;
|
||||
this.canEdit = propDesc.isModifiable()&&!"bl_occ_type".equals(propName)&&!"item_id".equals(propName);
|
||||
System.out.println(propName+" >> "+lov+" >> "+canEdit+" >> "+width);
|
||||
}
|
||||
|
||||
public void setSavedValue(Object savedValue) {
|
||||
this.savedValue = savedValue;
|
||||
}
|
||||
|
||||
public boolean valueChanged(Object newValue) {
|
||||
if(savedValue!=null) {
|
||||
return !savedValue.equals(newValue);
|
||||
}
|
||||
return newValue!=null;
|
||||
}
|
||||
|
||||
public void setControl(Control control) {
|
||||
this.control = control;
|
||||
}
|
||||
|
||||
public Control getControl() {
|
||||
return control;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package cn.net.connor.process.meopviewfx.bean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import k.util.KUtil;
|
||||
|
||||
public class TextBean {
|
||||
|
||||
private String text;
|
||||
private String realValue;
|
||||
public List<TextBean> children = new ArrayList<TextBean>();
|
||||
private String itemId;
|
||||
private String revId;
|
||||
|
||||
public TextBean(String text, String itemId, String revId) {
|
||||
this.text = text;
|
||||
this.itemId = itemId;
|
||||
this.revId = revId;
|
||||
}
|
||||
|
||||
public TextBean(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public void setRealValue(String realValue) {
|
||||
this.realValue = realValue;
|
||||
}
|
||||
|
||||
public String getRealValue() {
|
||||
return KUtil.isEmpty(realValue) ? text : realValue;
|
||||
}
|
||||
|
||||
public String getDisplayValue() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public String getMKHId() {
|
||||
return itemId;
|
||||
}
|
||||
|
||||
public String getMKHRev() {
|
||||
return revId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getDisplayValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (obj instanceof TextBean) {
|
||||
return text.equals(((TextBean) obj).text);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package cn.net.connor.process.meopviewfx.dialog;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
|
||||
import cn.net.connor.process.meopviewfx.ui.MEOPPanel;
|
||||
import javafx.embed.swing.JFXPanel;
|
||||
import k.KDialog;
|
||||
import k.KDialogController;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class TestDialog extends KDialog{
|
||||
|
||||
public TestDialog(KDialogController controller) {
|
||||
super(controller);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addListeners() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initUI() {
|
||||
this.setPreferredSize(new Dimension(800, 600));
|
||||
this.setLayout(new BorderLayout());
|
||||
JFXPanel panel = new JFXPanel();
|
||||
panel.setScene(new MEOPPanel(this).getScene());
|
||||
this.add(BorderLayout.CENTER, panel);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package cn.net.connor.process.meopviewfx.dialog;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
|
||||
import k.KDialogController;
|
||||
|
||||
public class TestDialogController extends KDialogController{
|
||||
|
||||
public TestDialogController(AbstractAIFApplication app) {
|
||||
super(app);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean init() throws Exception {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,183 @@
|
||||
package cn.net.connor.process.meopviewfx.ui;
|
||||
|
||||
import javax.swing.JTextArea;
|
||||
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.teamcenter.rac.stylesheet.gdt.GdtDialog;
|
||||
import com.teamcenter.rac.stylesheet.gdt.GdtEditor;
|
||||
import com.teamcenter.rac.stylesheet.gdt.GenerateGDTHTML;
|
||||
import com.teamcenter.rac.util.UIUtilities;
|
||||
|
||||
import cn.net.connor.process.meopviewfx.bean.KTableRow;
|
||||
import cn.net.connor.process.meopviewfx.bean.PropConfig;
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.concurrent.Worker.State;
|
||||
import javafx.event.Event;
|
||||
import javafx.scene.control.TableCell;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableColumn.CellEditEvent;
|
||||
import javafx.scene.control.TablePosition;
|
||||
import javafx.scene.control.TableRow;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.input.MouseButton;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.web.WebView;
|
||||
|
||||
/**
|
||||
* select color:
|
||||
*
|
||||
* .table-row-cell .ktext { -fx-fill: black; }
|
||||
*
|
||||
* .table-row-cell:selected .ktext { -fx-fill: white; }
|
||||
*
|
||||
* .table-cell .ktext { -fx-fill: black; }
|
||||
*
|
||||
* .table-cell:selected .ktext { -fx-fill: white; }
|
||||
*
|
||||
* @author Administrator
|
||||
*
|
||||
* @param <T>
|
||||
* @param <E>
|
||||
*/
|
||||
|
||||
public class KFXEditableStringAreaHtmlTableCell<T, E> extends TableCell<T, String> {
|
||||
private WebView webView;
|
||||
private PropConfig config;
|
||||
|
||||
public KFXEditableStringAreaHtmlTableCell(PropConfig config) {
|
||||
super();
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startEdit() {
|
||||
super.startEdit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelEdit() {
|
||||
super.cancelEdit();
|
||||
// setText((String) getItem());
|
||||
// setGraphic(null);
|
||||
setGraphic(webView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateItem(String item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
if (webView == null) {
|
||||
createWebView();
|
||||
}
|
||||
if (empty) {
|
||||
setText(null);
|
||||
setGraphic(null);
|
||||
} else {
|
||||
webView.setPrefHeight(Region.USE_COMPUTED_SIZE);
|
||||
String newValue = item;
|
||||
Platform.runLater(() -> {
|
||||
try {
|
||||
// System.out.println("Load Html: " + newValue);
|
||||
String html = newValue == null || newValue.startsWith("<html>") ? newValue : GenerateGDTHTML.generatePage(newValue);
|
||||
// System.out.println(">> " + html);
|
||||
webView.getEngine().loadContent(html);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
setGraphic(webView);
|
||||
}
|
||||
}
|
||||
|
||||
private void createWebView() {
|
||||
webView = new WebView();
|
||||
webView.setPrefHeight(Region.USE_COMPUTED_SIZE);
|
||||
webView.getEngine().getLoadWorker().stateProperty().addListener(new ChangeListener<State>() {
|
||||
@Override
|
||||
public void changed(ObservableValue<? extends State> observable, State oldValue, State newValue) {
|
||||
if (newValue != State.SUCCEEDED) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Object res = webView.getEngine().executeScript(
|
||||
"var body = document.body, html = document.documentElement; Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight );");
|
||||
// System.out.println("Height: " + res);
|
||||
int height = Integer.parseInt(res.toString());
|
||||
// int width = Integer.parseInt(webView.getEngine().executeScript("var body =
|
||||
// document.body, html = document.documentElement; Math.max( body.scrollWidth,
|
||||
// body.offsetWidth, html.clientWidth, html.scrollWidth, html.offsetWidth
|
||||
// );").toString());
|
||||
webView.setPrefHeight(height+5);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
if (isEditable()) {
|
||||
webView.setOnMouseClicked(e -> {
|
||||
if (e.getButton() != MouseButton.PRIMARY || e.getClickCount() != 2) {
|
||||
return;
|
||||
}
|
||||
TableRow<?> row = getTableRow();
|
||||
KTableRow bean = (KTableRow) getTableView().getItems().get(row.getIndex());
|
||||
String oldValue = bean.stringProps.get(config).getValueSafe();
|
||||
System.out.println("Modify [" + row + "]: " + oldValue);
|
||||
Display localDisplay = Display.getCurrent();
|
||||
if (localDisplay == null) {
|
||||
localDisplay = Display.getDefault();
|
||||
}
|
||||
GdtEditor editor = new GdtEditor(new JTextArea(oldValue));
|
||||
editor.setValue(oldValue);
|
||||
localDisplay.asyncExec(new Runnable() {
|
||||
public void run() {
|
||||
Shell localShell = UIUtilities.getCurrentModalShell();
|
||||
GdtDialog gdtDialog = new GdtDialog(localShell, null, editor, true) {
|
||||
public boolean close() {
|
||||
try {
|
||||
String newValue = editor.getValue();
|
||||
System.out.println("New Value: " + newValue);
|
||||
bean.stringProps.get(config).setValue(newValue);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return super.close();
|
||||
}
|
||||
};
|
||||
editor.setGdtDialog(gdtDialog);
|
||||
gdtDialog.open();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
// webView.prefWidthProperty().bind(getTableColumn().widthProperty().subtract(20));
|
||||
}
|
||||
|
||||
protected String getString() {
|
||||
return getItem() == null ? "" : getItem().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void commitEdit(String item) {
|
||||
if (isEditing()) {
|
||||
super.commitEdit(item);
|
||||
} else {
|
||||
final TableView table = getTableView();
|
||||
if (table != null) {
|
||||
TablePosition position = new TablePosition(getTableView(), getTableRow().getIndex(), getTableColumn());
|
||||
CellEditEvent editEvent = new CellEditEvent(table, position, TableColumn.editCommitEvent(), item);
|
||||
Event.fireEvent(getTableColumn(), editEvent);
|
||||
}
|
||||
updateItem(item, false);
|
||||
if (table != null) {
|
||||
table.edit(-1, null);
|
||||
}
|
||||
// super.commitEdit(item); // 20201217 bug fix
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,92 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.geometry.*?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import java.lang.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
|
||||
<StackPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="cn.net.connor.process.meopviewfx.ui.MEOPPanelController">
|
||||
<children>
|
||||
<BorderPane prefHeight="200.0" prefWidth="200.0">
|
||||
<center>
|
||||
<SplitPane dividerPositions="1.0" prefHeight="160.0" prefWidth="200.0" BorderPane.alignment="CENTER">
|
||||
<items>
|
||||
<SplitPane dividerPositions="0.4" orientation="VERTICAL" prefHeight="200.0" prefWidth="160.0">
|
||||
<items>
|
||||
<BorderPane prefHeight="200.0" prefWidth="200.0">
|
||||
<center>
|
||||
<TableView fx:id="table1" editable="true" prefHeight="200.0" prefWidth="200.0" style="-fx-faint-focus-color: transparent; -fx-focus-color: rgba(0,0,0,0.2); -fx-background-insets: 0;" BorderPane.alignment="CENTER" />
|
||||
</center>
|
||||
</BorderPane>
|
||||
<BorderPane minHeight="0.0">
|
||||
<top>
|
||||
<ScrollPane fitToWidth="true" style="-fx-background-insets: 0;">
|
||||
<content>
|
||||
<FlowPane fx:id="propPane" hgap="8.0" vgap="5.0" BorderPane.alignment="CENTER">
|
||||
<BorderPane.margin>
|
||||
<Insets bottom="5.0" />
|
||||
</BorderPane.margin>
|
||||
<padding>
|
||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||
</padding>
|
||||
</FlowPane>
|
||||
</content>
|
||||
<BorderPane.margin>
|
||||
<Insets bottom="5.0" />
|
||||
</BorderPane.margin>
|
||||
</ScrollPane>
|
||||
</top>
|
||||
<center>
|
||||
<TableView fx:id="table2" editable="true" minHeight="0.0" prefHeight="200.0" prefWidth="200.0" style="-fx-faint-focus-color: transparent; -fx-focus-color: rgba(0,0,0,0.2);" visible="false" BorderPane.alignment="CENTER" />
|
||||
</center>
|
||||
<right>
|
||||
<VBox fx:id="buttonBox" minHeight="0.0" spacing="5.0" visible="false" BorderPane.alignment="CENTER">
|
||||
<padding>
|
||||
<Insets left="5.0" />
|
||||
</padding>
|
||||
<children>
|
||||
<Button fx:id="b_AddRow" minHeight="25.0" minWidth="25.0" mnemonicParsing="false" onAction="#addRowButtonClicked" prefHeight="25.0" prefWidth="25.0" />
|
||||
<Button fx:id="b_DelRow" minHeight="25.0" minWidth="25.0" mnemonicParsing="false" onAction="#delRowButtonClicked" prefHeight="25.0" prefWidth="25.0" />
|
||||
<Button fx:id="b_MoveUp" minHeight="25.0" minWidth="25.0" mnemonicParsing="false" onAction="#moveUpButtonClicked" prefHeight="25.0" prefWidth="25.0" />
|
||||
<Button fx:id="b_MoveDown" minHeight="25.0" minWidth="25.0" mnemonicParsing="false" onAction="#moveDownButtonClicked" prefHeight="25.0" prefWidth="25.0" />
|
||||
<Button fx:id="b_Search" minHeight="25.0" minWidth="25.0" mnemonicParsing="false" onAction="#searchButtonClicked" prefHeight="25.0" prefWidth="25.0" />
|
||||
</children>
|
||||
</VBox>
|
||||
</right>
|
||||
<padding>
|
||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||
</padding>
|
||||
</BorderPane>
|
||||
</items>
|
||||
</SplitPane>
|
||||
<TabPane fx:id="textTab" prefHeight="200.0" prefWidth="200.0" side="RIGHT" tabClosingPolicy="UNAVAILABLE" />
|
||||
</items>
|
||||
</SplitPane>
|
||||
</center>
|
||||
<bottom>
|
||||
<GridPane hgap="20.0" BorderPane.alignment="CENTER">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="NEVER" minWidth="10.0" />
|
||||
<ColumnConstraints hgrow="NEVER" minWidth="10.0" />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<Button mnemonicParsing="false" onAction="#reloadDataButtonClick" text=" 更新 " />
|
||||
<Button mnemonicParsing="false" onAction="#saveButtonClick" text=" 保存 " GridPane.columnIndex="1" />
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="5.0" left="10.0" right="5.0" top="5.0" />
|
||||
</padding>
|
||||
</GridPane>
|
||||
</bottom>
|
||||
</BorderPane>
|
||||
<AnchorPane fx:id="cover" prefHeight="200.0" prefWidth="200.0" visible="false">
|
||||
<children>
|
||||
<ProgressIndicator prefHeight="30.0" prefWidth="30.0" AnchorPane.bottomAnchor="15.0" AnchorPane.leftAnchor="15.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</children>
|
||||
</StackPane>
|
@ -0,0 +1,46 @@
|
||||
package cn.net.connor.process.meopviewfx.ui;
|
||||
|
||||
import java.awt.Window;
|
||||
|
||||
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
|
||||
import com.teamcenter.rac.kernel.TCComponentBOMLine;
|
||||
import com.teamcenter.rac.pse.common.BOMLineNode;
|
||||
|
||||
import k.ui.KFXPanel;
|
||||
import k.util.KUtil;
|
||||
|
||||
public class MEOPPanel extends KFXPanel{
|
||||
|
||||
private MEOPPanelController controller;
|
||||
|
||||
public MEOPPanel(Window dialog) {
|
||||
super(dialog, MEOPPanel.class, "style.css");
|
||||
this.controller = (MEOPPanelController)aifController;
|
||||
initData();
|
||||
}
|
||||
|
||||
public void refreshUI(TCComponentBOMLine targetLine) throws Exception{
|
||||
this.controller.refreshUI(targetLine);
|
||||
}
|
||||
|
||||
public synchronized void updateSelection(Object targetObj) {
|
||||
System.out.println("Update: "+targetObj);
|
||||
if (targetObj != null && targetObj instanceof AIFComponentContext) {
|
||||
targetObj = ((AIFComponentContext) targetObj).getComponent();
|
||||
}
|
||||
if (targetObj != null && targetObj instanceof BOMLineNode) {
|
||||
targetObj = ((BOMLineNode) targetObj).getComponent();
|
||||
}
|
||||
if (targetObj == null || !(targetObj instanceof TCComponentBOMLine)) {
|
||||
} else {
|
||||
TCComponentBOMLine targetLine = (TCComponentBOMLine) targetObj;
|
||||
try {
|
||||
refreshUI(targetLine);
|
||||
} catch (Exception e) {
|
||||
KUtil.error(getParentDialog(), e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,312 @@
|
||||
package cn.net.connor.process.meopviewfx.ui;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.teamcenter.rac.kernel.TCComponentBOMLine;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemType;
|
||||
import com.teamcenter.rac.util.MessageBox;
|
||||
|
||||
import cn.net.connor.process.ProcessLocale;
|
||||
import cn.net.connor.process.meopviewfx.bean.KTableRow;
|
||||
import cn.net.connor.process.meopviewfx.bean.TextBean;
|
||||
import javafx.application.Platform;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Tab;
|
||||
import javafx.scene.control.TabPane;
|
||||
import javafx.scene.control.TableCell;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.TreeItem;
|
||||
import javafx.scene.control.TreeView;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.input.MouseButton;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.FlowPane;
|
||||
import javafx.scene.layout.VBox;
|
||||
import k.ui.KFXPanel;
|
||||
import k.ui.KFXPanelController;
|
||||
import k.util.KUtil;
|
||||
|
||||
public class MEOPPanelController extends KFXPanelController {
|
||||
|
||||
public static final String PREF_BOM_TABLE = "Connor_AVIC_GXBZ_Bomline";
|
||||
public static final String PREF_PREFIX_BOM_TABLE_WITH_TYPE = "Connor_AVIC_GXBZ_";
|
||||
public static final String PREF_PREFIX_PROP_FLOW_WITH_TYPE = "Connor_AVIC_GXBZ_Property_";
|
||||
|
||||
@FXML
|
||||
private TableView<KTableRow> table1;
|
||||
@FXML
|
||||
private TableView<KTableRow> table2;
|
||||
@FXML
|
||||
private FlowPane propPane;
|
||||
@FXML
|
||||
private AnchorPane cover;
|
||||
@FXML
|
||||
private Button b_AddRow;
|
||||
@FXML
|
||||
private Button b_DelRow;
|
||||
@FXML
|
||||
private Button b_Search;
|
||||
@FXML
|
||||
private Button b_MoveUp;
|
||||
@FXML
|
||||
private Button b_MoveDown;
|
||||
@FXML
|
||||
private VBox buttonBox;
|
||||
@FXML
|
||||
private TabPane textTab;
|
||||
private boolean busy = false;
|
||||
|
||||
private TableLoader table1Loader = new TableLoader();
|
||||
private TableLoader table2Loader = new TableLoader();
|
||||
private PropFlowLoader propLoader = new PropFlowLoader();
|
||||
|
||||
|
||||
// private MEOPPanel panel;
|
||||
|
||||
public Image folder = new Image(MEOPPanelController.class.getResourceAsStream("/icons/folder_24.png"), 18, 18, true, false);
|
||||
public Image text = new Image(MEOPPanelController.class.getResourceAsStream("/icons/text.png"), 18, 18, true, false);
|
||||
private TCComponentBOMLine targetLine;
|
||||
|
||||
@Override
|
||||
public void initData(KFXPanel panel) throws Exception {
|
||||
// this.panel = (MEOPPanel) panel;
|
||||
// table1.getSelectionModel().setCellSelectionEnabled(true);
|
||||
// table2.getSelectionModel().setCellSelectionEnabled(true);
|
||||
b_AddRow.setGraphic(new ImageView(new Image(getClass().getResourceAsStream("/icons/add_24px.png"), 19, 19, true, false)));
|
||||
b_DelRow.setGraphic(new ImageView(new Image(getClass().getResourceAsStream("/icons/delete_24px.png"), 19, 19, true, false)));
|
||||
b_MoveUp.setGraphic(new ImageView(new Image(getClass().getResourceAsStream("/icons/up_24px.png"), 19, 19, true, false)));
|
||||
b_MoveDown.setGraphic(new ImageView(new Image(getClass().getResourceAsStream("/icons/down_24px.png"), 19, 19, true, false)));
|
||||
b_Search.setGraphic(new ImageView(new Image(getClass().getResourceAsStream("/icons/search_24px.png"), 19, 19, true, false)));
|
||||
table1.setVisible(table1Loader.load(table1, PREF_BOM_TABLE));
|
||||
|
||||
if(table1.isVisible()) {
|
||||
String colName = ProcessLocale.getString("index.COL");
|
||||
TableColumn<KTableRow, String> c = new TableColumn<KTableRow, String>(colName);
|
||||
c.setCellFactory(col -> new TableCell<KTableRow, String>(){
|
||||
@Override
|
||||
public void updateIndex(int index) {
|
||||
super.updateIndex(index);
|
||||
if (isEmpty() || index < 0) {
|
||||
setText(null);
|
||||
} else {
|
||||
setText(Integer.toString(index+1));
|
||||
}
|
||||
}
|
||||
});
|
||||
Platform.runLater(() -> {
|
||||
c.setEditable(false);
|
||||
c.setSortable(false);
|
||||
c.setPrefWidth(70);
|
||||
table1.getColumns().add(0, c);
|
||||
});
|
||||
}
|
||||
// load special text
|
||||
Map<String, TextBean> textMap = new TextTreeLoader().loadText();
|
||||
for (String sheetName : textMap.keySet()) {
|
||||
TextBean bean = textMap.get(sheetName);
|
||||
Tab tab = new Tab(sheetName);
|
||||
textTab.getTabs().add(tab);
|
||||
TreeView<TextBean> tree = new TreeView<TextBean>();
|
||||
TreeItem<TextBean> rootNode = new TreeItem<TextBean>(bean, new ImageView(folder));
|
||||
tree.setRoot(rootNode);
|
||||
tree.setShowRoot(false);
|
||||
rootNode.setExpanded(true);
|
||||
loadTree(rootNode, bean);
|
||||
tab.setContent(tree);
|
||||
tree.setOnMouseClicked(e -> {
|
||||
if (e.getButton() != MouseButton.PRIMARY || e.getClickCount() != 2) {
|
||||
return;
|
||||
}
|
||||
TreeItem<TextBean> treeItem = tree.getSelectionModel().getSelectedItem();
|
||||
if (treeItem.getChildren().size() > 0) {
|
||||
return;
|
||||
}
|
||||
TextBean textBean = treeItem.getValue();
|
||||
String text = textBean.getRealValue();
|
||||
System.out.println("Insert: " + text);
|
||||
long time = Math.max(table1Loader.focuseTime, table2Loader.focuseTime);
|
||||
time = Math.max(time, propLoader.focuseTime);
|
||||
if (propLoader.focuseTime == time) {
|
||||
propLoader.insertText(text);
|
||||
}
|
||||
if (table1Loader.focuseTime == time) {
|
||||
table1Loader.insertText(text);
|
||||
}
|
||||
if (table2Loader.focuseTime == time) {
|
||||
String parentText = treeItem.getParent()==null?"":treeItem.getParent().getValue().getRealValue();
|
||||
table2Loader.insertText(text, parentText, textBean.getMKHId(), textBean.getMKHRev());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void reloadDataButtonClick() {
|
||||
new Thread(()->{
|
||||
KUtil.session.setStatus("Reloading...");
|
||||
setProgressVisible(true);
|
||||
try {
|
||||
reloadData(null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
MessageBox.post(e);
|
||||
}
|
||||
setProgressVisible(false);
|
||||
System.out.println("Reload Complete");
|
||||
}).start();
|
||||
}
|
||||
|
||||
public void saveButtonClick() {
|
||||
new Thread(() -> {
|
||||
KUtil.session.setStatus("Saving...");
|
||||
setProgressVisible(true);
|
||||
try {
|
||||
saveData();
|
||||
reloadData(null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
MessageBox.post(e);
|
||||
}
|
||||
setProgressVisible(false);
|
||||
System.out.println("Save Complete");
|
||||
}).start();
|
||||
}
|
||||
|
||||
public synchronized void reloadData(TCComponentBOMLine targetLine) throws Exception {
|
||||
if (targetLine == null) {
|
||||
targetLine = this.targetLine;
|
||||
// AIFComponentContext cc =
|
||||
// AIFUtility.getCurrentApplication().getTargetContext();
|
||||
// System.out.println("Select: "+cc);
|
||||
// if(cc!=null&&cc.getComponent()!=null&&(cc.getComponent() instanceof
|
||||
// TCComponentBOMLine)){
|
||||
// targetLine = (TCComponentBOMLine) cc.getComponent();
|
||||
// }
|
||||
}
|
||||
if (targetLine == null) {
|
||||
return;
|
||||
}
|
||||
this.targetLine = targetLine;
|
||||
System.out.println("Load Line: " + targetLine);
|
||||
TCComponentItemType itemType = targetLine == null ? null : targetLine.getItem().getTypeComponent();
|
||||
String prefName = itemType == null ? null : PREF_PREFIX_BOM_TABLE_WITH_TYPE + itemType.getTypeName();
|
||||
boolean table2Visible = table2Loader.load(table2, prefName);
|
||||
String prefName2 = itemType == null ? null : PREF_PREFIX_PROP_FLOW_WITH_TYPE + itemType.getTypeName();
|
||||
boolean propVisible = propLoader.load(propPane, prefName2, itemType);
|
||||
if (!Platform.isFxApplicationThread()) {
|
||||
Platform.runLater(() -> {
|
||||
table2.setVisible(table2Visible);
|
||||
buttonBox.setVisible(table2Visible);
|
||||
propPane.setVisible(propVisible);
|
||||
try {
|
||||
propLoader.loadTCData(this.targetLine);
|
||||
table1Loader.loadTCData(this.targetLine, true);
|
||||
table2Loader.loadTCData(this.targetLine, false);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
MessageBox.post(e);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
table2.setVisible(table2Visible);
|
||||
buttonBox.setVisible(table2Visible);
|
||||
propPane.setVisible(propVisible);
|
||||
propLoader.loadTCData(targetLine);
|
||||
table1Loader.loadTCData(targetLine, true);
|
||||
table2Loader.loadTCData(targetLine, false);
|
||||
}
|
||||
}
|
||||
|
||||
public void saveData() throws Exception {
|
||||
if (targetLine == null) {
|
||||
return;
|
||||
}
|
||||
propLoader.saveTCData(targetLine);
|
||||
table1Loader.saveTCData(targetLine);
|
||||
table2Loader.saveTCData(targetLine);
|
||||
targetLine.refresh();
|
||||
}
|
||||
|
||||
private void loadTree(TreeItem<TextBean> rootNode, TextBean bean) {
|
||||
int childCnt = bean.children.size();
|
||||
for (int i = 0; i < childCnt; i++) {
|
||||
TextBean childBean = bean.children.get(i);
|
||||
boolean isFolder = childBean.children.size() > 0;
|
||||
TreeItem<TextBean> cNode = isFolder ? new TreeItem<TextBean>(childBean, new ImageView(folder)) : new TreeItem<TextBean>(childBean, new ImageView(text));
|
||||
rootNode.getChildren().add(cNode);
|
||||
if (isFolder) {
|
||||
loadTree(cNode, childBean);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void refreshUI(TCComponentBOMLine targetLine) throws Exception {
|
||||
if(busy) {
|
||||
System.out.println("Task Running. Skip load: "+targetLine);
|
||||
return;
|
||||
}
|
||||
setProgressVisible(true);
|
||||
try {
|
||||
reloadData(targetLine);
|
||||
} finally {
|
||||
setProgressVisible(false);
|
||||
}
|
||||
// this.targetLine = targetLine;
|
||||
// TCComponentItemType itemType = targetLine == null ? null :
|
||||
// targetLine.getItem().getTypeComponent();
|
||||
// String prefName = itemType == null ? null : PREF_PREFIX_BOM_TABLE_WITH_TYPE +
|
||||
// itemType.getTypeName();
|
||||
// boolean table2Visible = table2Loader.load(table2, prefName);
|
||||
// String prefName2 = itemType == null ? null : PREF_PREFIX_PROP_FLOW_WITH_TYPE
|
||||
// + itemType.getTypeName();
|
||||
// boolean propVisible = propLoader.load(propPane, prefName2, itemType);
|
||||
// Platform.runLater(() -> {
|
||||
// table2.setVisible(table2Visible);
|
||||
// buttonBox.setVisible(table2Visible);
|
||||
// propPane.setVisible(propVisible);
|
||||
// });
|
||||
// reloadData();
|
||||
}
|
||||
|
||||
public void addRowButtonClicked() {
|
||||
table2Loader.addRow();
|
||||
}
|
||||
|
||||
public void delRowButtonClicked() {
|
||||
table2Loader.removeRow();
|
||||
}
|
||||
|
||||
public void moveUpButtonClicked() {
|
||||
table2Loader.moveUp();
|
||||
}
|
||||
|
||||
public void moveDownButtonClicked() {
|
||||
table2Loader.moveDown();
|
||||
}
|
||||
|
||||
public void searchButtonClicked() {
|
||||
table2Loader.search(targetLine);
|
||||
}
|
||||
|
||||
|
||||
public void setProgressVisible(boolean visible) {
|
||||
this.busy = visible;
|
||||
if (cover != null) {
|
||||
if (Platform.isFxApplicationThread()) {
|
||||
cover.setVisible(visible);
|
||||
} else {
|
||||
Platform.runLater(() -> {
|
||||
cover.setVisible(visible);
|
||||
});
|
||||
}
|
||||
try {
|
||||
Thread.sleep(10);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,299 @@
|
||||
package cn.net.connor.process.meopviewfx.ui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.time.LocalDate;
|
||||
import com.teamcenter.rac.kernel.TCComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponentBOMLine;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemRevisionType;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemType;
|
||||
import com.teamcenter.rac.kernel.TCComponentListOfValues;
|
||||
import com.teamcenter.rac.kernel.TCComponentType;
|
||||
import com.teamcenter.rac.kernel.TCProperty;
|
||||
import com.teamcenter.rac.kernel.TCPropertyDescriptor;
|
||||
import com.teamcenter.rac.treetable.SwingTextContextActivator;
|
||||
|
||||
import cn.net.connor.process.ProcessLocale;
|
||||
import cn.net.connor.process.meopviewfx.bean.KTableRow;
|
||||
import cn.net.connor.process.meopviewfx.bean.PropConfig;
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.control.ComboBox;
|
||||
import javafx.scene.control.Control;
|
||||
import javafx.scene.control.DatePicker;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
import javafx.scene.layout.FlowPane;
|
||||
import k.ui.KFXTextLocator;
|
||||
import k.ui.KLOVComboBox;
|
||||
import k.util.KUtil;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public class PropFlowLoader extends KFXTextLocator {
|
||||
|
||||
protected List<PropConfig> propConfigs = new ArrayList<PropConfig>();
|
||||
|
||||
public boolean load(FlowPane flowPane, String prefName, TCComponentItemType itemType) throws Exception {
|
||||
clearLocatorData();
|
||||
Platform.runLater(() -> {
|
||||
flowPane.getChildren().clear();
|
||||
});
|
||||
propConfigs.clear();
|
||||
if (KUtil.isEmpty(prefName) || itemType == null) {
|
||||
return false;
|
||||
}
|
||||
System.out.println("Load FlowPane from pref: " + prefName);
|
||||
String[] prefVals = KUtil.getPrefVals(KUtil.session, prefName);
|
||||
int len = KUtil.getLen(prefVals);
|
||||
if (len <= 1) {
|
||||
return false;
|
||||
}
|
||||
System.out.println(">> Item Type: " + itemType.getDisplayTypeName());
|
||||
TCComponentType revMasterType = null;
|
||||
TCComponentItemRevisionType revType = itemType.getItemRevisionType();
|
||||
revMasterType = KUtil.session.getTypeComponent(revType.getTypeName() + "Master");
|
||||
if (revMasterType == null) {
|
||||
revMasterType = KUtil.session.getTypeComponent(revType.getTypeName() + " Master");
|
||||
}
|
||||
if (revMasterType == null) {
|
||||
throw new Exception(String.format(ProcessLocale.getString("typenotfound.ERROR1"), revType.getTypeName() + "Master"));
|
||||
}
|
||||
for (int i = 0; i < len; i++) {
|
||||
String propName = prefVals[i];
|
||||
System.out.println("Load Config: " + propName);
|
||||
if (KUtil.isEmpty(propName)) {
|
||||
continue;
|
||||
}
|
||||
String propLoc = KTableRow.REVMASTER;
|
||||
String filterValue = null;
|
||||
int width = 0;
|
||||
// while (!KUtil.isEmpty(propName) && Character.isDigit(propName.charAt(0))) {
|
||||
// width = width * 10 + (propName.charAt(0) - '0');
|
||||
// propName = propName.substring(1);
|
||||
// }
|
||||
// int ind = propName.indexOf('.');
|
||||
// if (ind > 0) {
|
||||
// propLoc = propName.substring(0, ind);
|
||||
// propName = propName.substring(ind + 1);
|
||||
// }
|
||||
int ind = propName.indexOf('=');
|
||||
if (ind > 0) {
|
||||
filterValue = propName.substring(ind + 1);
|
||||
propName = propName.substring(0, ind);
|
||||
}
|
||||
TCPropertyDescriptor propDesc;
|
||||
if (propName.startsWith("*")) {
|
||||
propLoc = KTableRow.REV;
|
||||
propName = propName.substring(1);
|
||||
propDesc = revType.getPropDesc(propName);
|
||||
if (propDesc == null) {
|
||||
throw new Exception(String.format(ProcessLocale.getString("propnotdefinedintype.ERROR2"), propName, revType.getDisplayTypeName()));
|
||||
}
|
||||
} else {
|
||||
propDesc = revMasterType.getPropDesc(propName);
|
||||
if (propDesc == null) {
|
||||
throw new Exception(String.format(ProcessLocale.getString("propnotdefinedintype.ERROR2"), propName, revMasterType.getDisplayTypeName()));
|
||||
}
|
||||
}
|
||||
this.propConfigs.add(new PropConfig(propLoc, propDesc, filterValue, width, 0));
|
||||
}
|
||||
System.out.println("Load complete");
|
||||
int size = this.propConfigs.size();
|
||||
if (size == 0) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < size; i++) {
|
||||
PropConfig config = propConfigs.get(i);
|
||||
addPropPane(flowPane, config);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void loadTCData(TCComponentBOMLine targetLine) throws Exception {
|
||||
if (targetLine == null) {
|
||||
return;
|
||||
}
|
||||
TCComponent revMaster = targetLine == null ? null : targetLine.getItemRevision().getRelatedComponent("IMAN_master_form_rev");
|
||||
TCComponent rev = targetLine == null ? null : targetLine.getItemRevision();
|
||||
int size = this.propConfigs.size();
|
||||
if (size == 0) {
|
||||
return;
|
||||
}
|
||||
for (int j = 0; j < size; j++) {
|
||||
PropConfig config = propConfigs.get(j);
|
||||
Control control = config.getControl();
|
||||
if (control == null) {
|
||||
continue;
|
||||
}
|
||||
TCComponent comp = KTableRow.REV.equals(config.propLoc) ? rev : revMaster;
|
||||
if (control instanceof TextField) {
|
||||
String text = comp.getStringProperty(config.propName);
|
||||
((TextField) control).setText(text);
|
||||
config.setSavedValue(text);
|
||||
} else if (control instanceof DatePicker) {
|
||||
Date date = comp.getDateProperty(config.propName);
|
||||
((DatePicker) control).setValue(KUtil.dateToLocalDate(date));
|
||||
config.setSavedValue(date);
|
||||
} else if (control instanceof KLOVComboBox) {
|
||||
String text = comp.getStringProperty(config.propName);
|
||||
((KLOVComboBox) control).setValue(text);
|
||||
config.setSavedValue(text);
|
||||
} else if (control instanceof ComboBox) {
|
||||
String text = comp.getStringProperty(config.propName);
|
||||
((ComboBox<String>) control).setValue(text);
|
||||
config.setSavedValue(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void saveTCData(TCComponentBOMLine targetLine) throws Exception {
|
||||
if (targetLine == null) {
|
||||
return;
|
||||
}
|
||||
System.out.println("Update Property: " + targetLine);
|
||||
TCComponentItemRevision rev = targetLine == null ? null : targetLine.getItemRevision();
|
||||
TCComponent revMaster = targetLine == null ? null : targetLine.getItemRevision().getRelatedComponent("IMAN_master_form_rev");
|
||||
int size = this.propConfigs.size();
|
||||
if (size == 0) {
|
||||
return;
|
||||
}
|
||||
for (int j = 0; j < size; j++) {
|
||||
PropConfig config = propConfigs.get(j);
|
||||
Control control = config.getControl();
|
||||
if (control == null || !config.canEdit) {
|
||||
continue;
|
||||
}
|
||||
TCComponent comp = KTableRow.REV.equals(config.propLoc) ? rev : revMaster;
|
||||
String propName = config.propName;
|
||||
if (control instanceof TextField) {
|
||||
String value = ((TextField) control).getText();
|
||||
if (config.valueChanged(value)) {
|
||||
System.out.println(">> " + propName + " = " + value);
|
||||
comp.setStringProperty(propName, value);
|
||||
}
|
||||
} else if (control instanceof DatePicker) {
|
||||
Date value = KUtil.localDateToDate(((DatePicker) control).getValue());
|
||||
if (config.valueChanged(value)) {
|
||||
System.out.println(">> " + propName + " = " + value);
|
||||
comp.setDateProperty(propName, value);
|
||||
}
|
||||
} else if (control instanceof KLOVComboBox) {
|
||||
String value = ((KLOVComboBox) control).getSelectionModel().getSelectedItem();
|
||||
if (config.valueChanged(value)) {
|
||||
System.out.println(">> " + propName + " = " + value);
|
||||
comp.setStringProperty(propName, value);
|
||||
}
|
||||
} else if (control instanceof ComboBox) {
|
||||
String value = ((ComboBox<String>) control).getSelectionModel().getSelectedItem();
|
||||
if (config.valueChanged(value)) {
|
||||
System.out.println(">> " + propName + " = " + value);
|
||||
comp.setStringProperty(propName, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
rev.refresh();
|
||||
revMaster.refresh();
|
||||
}
|
||||
|
||||
private void addPropPane(FlowPane flowPane, PropConfig config) throws Exception {
|
||||
String title = config.propDisplayName;
|
||||
TCComponentListOfValues lov = config.lov;
|
||||
// HBox propPane = new HBox();
|
||||
BorderPane propPane = new BorderPane();
|
||||
// propPane.setSpacing(5);
|
||||
// propPane.setAlignment(Pos.CENTER_LEFT);
|
||||
propPane.setPrefWidth(280);
|
||||
Label label = new Label(title + " ");
|
||||
label.setAlignment(Pos.CENTER_RIGHT);
|
||||
label.setMinWidth(80);
|
||||
Platform.runLater(() -> {
|
||||
// propPane.getChildren().add(label);
|
||||
BorderPane.setAlignment(label, Pos.CENTER_LEFT);
|
||||
propPane.setLeft(label);
|
||||
flowPane.getChildren().add(propPane);
|
||||
});
|
||||
if (config.propDesc.isType(TCProperty.PROP_date)) {
|
||||
DatePicker dp = new DatePicker();
|
||||
config.setControl(dp);
|
||||
dp.setDisable(!config.canEdit);
|
||||
} else if (lov == null) {
|
||||
if (!KUtil.isEmpty(config.filterValue)) {
|
||||
String[] split = config.filterValue.split(";");
|
||||
ComboBox<String> cb = new ComboBox<String>();
|
||||
cb.getItems().add("");
|
||||
for (String string : split) {
|
||||
cb.getItems().add(string);
|
||||
}
|
||||
cb.setMaxWidth(300);
|
||||
config.setControl(cb);
|
||||
cb.setDisable(!config.canEdit);
|
||||
} else {
|
||||
TextField tf = new TextField();
|
||||
config.setControl(tf);
|
||||
tf.setEditable(config.canEdit);
|
||||
tf.focusedProperty().addListener(new ChangeListener<Boolean>() {
|
||||
@Override
|
||||
public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
|
||||
if (newValue) {
|
||||
System.out.println("focus get: " + title);
|
||||
updateControl(tf);
|
||||
} else {
|
||||
System.out.println("focus lost: " + title);
|
||||
}
|
||||
}
|
||||
});
|
||||
tf.caretPositionProperty().addListener(new ChangeListener<Number>() {
|
||||
@Override
|
||||
public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
|
||||
if (tf.isFocused()) {
|
||||
System.out.println("caret: " + oldValue + " -> " + newValue);
|
||||
currentCaret = newValue.intValue();
|
||||
}
|
||||
}
|
||||
});
|
||||
tf.focusedProperty().addListener(new ChangeListener<Boolean>() {
|
||||
@Override
|
||||
public void changed(ObservableValue<? extends Boolean> paramObservableValue, Boolean oldValue, Boolean newValue) {
|
||||
if (newValue) {
|
||||
SwingTextContextActivator.instance().activateContext();
|
||||
} else {
|
||||
SwingTextContextActivator.instance().deactivateContext();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
KLOVComboBox cb = new KLOVComboBox(lov);
|
||||
cb.setMaxWidth(300);
|
||||
config.setControl(cb);
|
||||
cb.setDisable(!config.canEdit);
|
||||
}
|
||||
Platform.runLater(() -> {
|
||||
propPane.setCenter(config.getControl());
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertText(String text) {
|
||||
if (KUtil.isEmpty(text)) {
|
||||
return;
|
||||
}
|
||||
Control currentControl = getCurrentControl();
|
||||
if (currentControl == null) {
|
||||
return;
|
||||
}
|
||||
if (currentControl instanceof TextField) {
|
||||
((TextField) currentControl).insertText(currentCaret, text);
|
||||
currentCaret += text.length();
|
||||
int temp = currentCaret;
|
||||
currentControl.requestFocus();
|
||||
((TextField) currentControl).positionCaret(temp);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,269 @@
|
||||
package cn.net.connor.process.meopviewfx.ui;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.sql.Connection;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.poi.xssf.usermodel.XSSFCell;
|
||||
import org.apache.poi.xssf.usermodel.XSSFRow;
|
||||
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
|
||||
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
|
||||
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponentDataset;
|
||||
import com.teamcenter.rac.kernel.TCComponentFolder;
|
||||
|
||||
import cn.net.connor.process.ProcessLocale;
|
||||
import cn.net.connor.process.meopviewfx.bean.TextBean;
|
||||
import k.util.KSql;
|
||||
import k.util.KSqlUtil;
|
||||
import k.util.KUtil;
|
||||
|
||||
public class TextTreeLoader {
|
||||
|
||||
private static final String PREF_COMMON_FOLDER = "Connor_AVIC_GXBZ_Common_Folder";
|
||||
private static final String PREF_PERSONAL_FOLDER = "Connor_AVIC_GXBZ_Personal_Folder";
|
||||
private static final String FLAG_REALVALUE = "#RV#";
|
||||
private static final String PREFFLAG_REALVALUE = "#RealValue#";
|
||||
|
||||
public static class FileBean {
|
||||
File file;
|
||||
int realValueCol;
|
||||
|
||||
public FileBean(File file, int realValueCol) {
|
||||
this.file = file;
|
||||
this.realValueCol = realValueCol;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Map<String, TextBean> loadText() throws Exception {
|
||||
Map<String, TextBean> textMap = new LinkedHashMap<String, TextBean>();
|
||||
String key = ProcessLocale.getString("mkhgy");
|
||||
//String sql = "select pac5_JG1, pac5_JG2, pac5_JG3, pac5_JG4, pac5_JG5, pac5_JG6 from pAc5_MKHGYRevMasters";
|
||||
String sql = "select pac5_JG1, pac5_JG2, pac5_JG3, pac5_JG4, pac5_JG5, pac5_JG6, t4.pitem_id, t3.pitem_revision_id from pAc5_MKHGYRevMasters t0\r\n" +
|
||||
"left join pform t1 on t0.puid = t1.rdata_fileu\r\n" +
|
||||
"left join (select * from pimanrelation where rrelation_typeu = (select puid from pimantype where ptype_name = 'IMAN_master_form')) t2 on t2.rsecondary_objectu = t1.puid\r\n" +
|
||||
"left join pitemrevision t3 on t3.puid = t2.rprimary_objectu\r\n" +
|
||||
"left join pitem t4 on t4.puid = t3.ritems_tagu";
|
||||
sql+="\r\nleft join (\r\n" +
|
||||
" select r1.puid from pAc5_MKHGYRevision r1\r\n" +
|
||||
" left join pitemrevision r2 on r2.puid = r1.puid\r\n" +
|
||||
" where \r\n" +
|
||||
" (select pdate_released from pworkspaceobject where puid = r2.puid) is not null\r\n" +
|
||||
" and (select pdate_released from pworkspaceobject where puid = r2.puid) = "
|
||||
+ "( select max(dr) from (select (select pdate_released from pworkspaceobject where puid = pitemrevision.puid) dr from pitemrevision where ritems_tagu = r2.ritems_tagu) )\r\n" +
|
||||
" and r2.psequence_id = (select max(psequence_id) from pitemrevision where ritems_tagu = r2.ritems_tagu and pitem_revision_id = r2.pitem_revision_id)\r\n" +
|
||||
") t5 on t5.puid = t3.puid\r\n" +
|
||||
"where (t0.pac5_Effictiveness is null or t0.pac5_Effictiveness!='" + ProcessLocale.getString("shixiao") + "') and t5.puid is not null";//失效
|
||||
System.out.println("sql:" + sql);
|
||||
Connection conn = KSqlUtil.getOracleConnection(KSql.PREF_DB_CONN);
|
||||
List<String[]> data = null;
|
||||
int colCnt = 8;
|
||||
TextBean root = new TextBean(key);
|
||||
textMap.put(key, root);
|
||||
try {
|
||||
data = KSqlUtil.queryStringArray(conn, sql, null, colCnt);
|
||||
} finally {
|
||||
KSqlUtil.free(conn);
|
||||
}
|
||||
int cnt = data == null?0:data.size();
|
||||
for(int i=0; i<cnt ;i++) {
|
||||
String[] rowData = data.get(i);
|
||||
TextBean parent = root;
|
||||
String itemId = rowData[colCnt-2];
|
||||
String revId = rowData[colCnt-1];
|
||||
for(int c=0; c<colCnt-2; c++) {
|
||||
String text = rowData[c];
|
||||
if(KUtil.isEmpty(text)) {
|
||||
break;
|
||||
}
|
||||
TextBean child = new TextBean(text, itemId, revId);
|
||||
int ind = parent.children.indexOf(child);
|
||||
if(ind>=0) {
|
||||
parent = parent.children.get(ind);
|
||||
}else {
|
||||
parent.children.add(child);
|
||||
parent = child;
|
||||
}
|
||||
}
|
||||
}
|
||||
return textMap;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Map<String, TextBean> loadTextFromExcels() throws Exception {
|
||||
Map<String, TextBean> textMap = new LinkedHashMap<String, TextBean>();
|
||||
List<FileBean> docFiles = getConfigFile();
|
||||
int size = docFiles.size();
|
||||
if (size == 0) {
|
||||
System.out.println("Special Text File not found");
|
||||
return textMap;
|
||||
}
|
||||
for (int i = 0; i < size; i++) {
|
||||
FileBean docFile = docFiles.get(i);
|
||||
System.out.println("Load File: " + docFile.file.getAbsolutePath());
|
||||
InputStream in = new FileInputStream(docFile.file);
|
||||
XSSFWorkbook wb = new XSSFWorkbook(in);
|
||||
in.close();
|
||||
int sheetCnt = wb.getNumberOfSheets();
|
||||
for (int j = 0; j < sheetCnt; j++) {
|
||||
XSSFSheet sheet = wb.getSheetAt(0);
|
||||
String sheetName = sheet.getSheetName();
|
||||
System.out.println(">> Load Sheet: " + sheetName);
|
||||
if (textMap.containsKey(sheetName)) {
|
||||
System.out.println("SKIP");
|
||||
continue;
|
||||
}
|
||||
TextBean bean = readSheet(sheet, docFile.realValueCol);
|
||||
if (bean != null && bean.children.size() > 0) {
|
||||
textMap.put(sheetName, bean);
|
||||
} else {
|
||||
System.out.println("No Data");
|
||||
}
|
||||
}
|
||||
}
|
||||
return textMap;
|
||||
}
|
||||
|
||||
private TextBean readSheet(XSSFSheet sheet, int realValueCol) throws Exception {
|
||||
TextBean root = new TextBean(sheet.getSheetName());
|
||||
int firstRow = sheet.getFirstRowNum();
|
||||
int lastRow = sheet.getLastRowNum();
|
||||
Map<Integer, TextBean> parents = new HashMap<Integer, TextBean>();
|
||||
parents.put(0, root);
|
||||
for (int i = firstRow; i <= lastRow; i++) {
|
||||
XSSFRow row = sheet.getRow(i);
|
||||
if (row == null) {
|
||||
continue;
|
||||
}
|
||||
int firstCol = row.getFirstCellNum();
|
||||
if (firstCol < 0) {
|
||||
firstCol = 0;
|
||||
}
|
||||
int lastCol = row.getLastCellNum();
|
||||
for (int j = firstCol; j <= lastCol; j++) {
|
||||
XSSFCell cell = row.getCell(j);
|
||||
if (cell == null || cell.getCellType() != XSSFCell.CELL_TYPE_STRING) {
|
||||
continue;
|
||||
}
|
||||
if (!parents.containsKey(j)) {
|
||||
continue;
|
||||
}
|
||||
String text = cell.getStringCellValue();
|
||||
if (KUtil.isEmpty(text)) {
|
||||
continue;
|
||||
}
|
||||
if (j == realValueCol) {
|
||||
parents.get(j).setRealValue(text);
|
||||
continue;
|
||||
}
|
||||
if (text.startsWith(FLAG_REALVALUE)) {
|
||||
parents.get(j).setRealValue(text.substring(FLAG_REALVALUE.length()));
|
||||
continue;
|
||||
}
|
||||
TextBean bean = new TextBean(text);
|
||||
// for(int k=j+1;k<=lastCol;k++) {
|
||||
// XSSFCell realValueCell = row.getCell(k);
|
||||
// if(realValueCell!=null&&realValueCell.getCellType()==XSSFCell.CELL_TYPE_STRING)
|
||||
// {
|
||||
// String realValue = realValueCell.getStringCellValue();
|
||||
// if(!KUtil.isEmpty(realValue)) {
|
||||
// bean.setRealValue(realValue);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
parents.get(j).children.add(bean);
|
||||
parents.put(j + 1, bean);
|
||||
// break;
|
||||
}
|
||||
}
|
||||
return root;
|
||||
}
|
||||
|
||||
protected List<FileBean> getConfigFile() {
|
||||
List<FileBean> files = new ArrayList<>();
|
||||
try {
|
||||
addFileFromPref(files, PREF_COMMON_FOLDER, "");
|
||||
} catch (Exception e) {
|
||||
System.out.println("Load Text Tree From <" + PREF_COMMON_FOLDER + "> Error");
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
addFileFromPref(files, PREF_PERSONAL_FOLDER, KUtil.session.getUser().getUserId());
|
||||
} catch (Exception e) {
|
||||
System.out.println("Load Text Tree From <" + PREF_PERSONAL_FOLDER + "> Error");
|
||||
e.printStackTrace();
|
||||
}
|
||||
return files;
|
||||
}
|
||||
|
||||
private void addFileFromPref(List<FileBean> files, String prefName, String subFolder) throws Exception {
|
||||
String uid = KUtil.getPrefVal(KUtil.session, prefName);
|
||||
if (KUtil.isEmpty(uid)) {
|
||||
return;
|
||||
}
|
||||
int realValueColumn = -1;
|
||||
int ind = uid.indexOf(PREFFLAG_REALVALUE);
|
||||
if (ind > 0) {
|
||||
String numStr = uid.substring(ind + PREFFLAG_REALVALUE.length());
|
||||
uid = uid.substring(0, ind);
|
||||
try {
|
||||
realValueColumn = Integer.parseInt(numStr);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
TCComponent comp = KUtil.session.stringToComponent(uid);
|
||||
if (comp == null) {
|
||||
return;
|
||||
}
|
||||
if (comp instanceof TCComponentFolder) {
|
||||
TCComponentFolder folder = (TCComponentFolder) comp;
|
||||
AIFComponentContext[] children = folder.getChildren();
|
||||
if (!KUtil.isEmpty(subFolder)) {
|
||||
for (AIFComponentContext c : children) {
|
||||
InterfaceAIFComponent child = c.getComponent();
|
||||
if (child instanceof TCComponentFolder) {
|
||||
if (subFolder.equals(((TCComponentFolder) child).getStringProperty("object_name"))) {
|
||||
children = child.getChildren();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (AIFComponentContext c : children) {
|
||||
InterfaceAIFComponent child = c.getComponent();
|
||||
if ("MSExcelX".equals(child.getType())) {
|
||||
File[] dbFiles = ((TCComponentDataset) child).getFiles("");
|
||||
if (dbFiles != null) {
|
||||
for (int i = 0; i < dbFiles.length; i++) {
|
||||
files.add(new FileBean(dbFiles[i], realValueColumn));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (comp instanceof TCComponentDataset) {
|
||||
TCComponentDataset dataset = (TCComponentDataset) comp;
|
||||
if ("MSExcelX".equals(dataset.getType())) {
|
||||
File[] dbFiles = dataset.getFiles("");
|
||||
if (dbFiles != null) {
|
||||
for (int i = 0; i < dbFiles.length; i++) {
|
||||
files.add(new FileBean(dbFiles[i], realValueColumn));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
.root {
|
||||
-fx-font-family: "Microsoft YaHei";
|
||||
}
|
||||
|
||||
.table-row-cell .ktext {
|
||||
-fx-fill: black;
|
||||
}
|
||||
|
||||
.table-row-cell:selected .ktext {
|
||||
-fx-fill: white;
|
||||
}
|
||||
|
||||
.table-cell .ktext {
|
||||
-fx-fill: black;
|
||||
}
|
||||
|
||||
.table-cell:selected .ktext {
|
||||
-fx-fill: white;
|
||||
}
|
||||
|
||||
.tab-pane .tab-header-area {
|
||||
-fx-padding: 5 2 0 0;
|
||||
}
|
||||
|
||||
* :disabled {
|
||||
-fx-opacity: 0.85;
|
||||
}
|
@ -0,0 +1,174 @@
|
||||
package cn.net.connor.process.modifymeopno;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.table.DefaultTableCellRenderer;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import javax.swing.table.TableColumnModel;
|
||||
|
||||
import com.teamcenter.rac.util.MessageBox;
|
||||
|
||||
import cn.net.connor.process.ProcessLocale;
|
||||
import k.KDialog;
|
||||
import k.KDialogController;
|
||||
import k.util.KUtil;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class ModifyMeopNoDialog extends KDialog {
|
||||
|
||||
protected JButton b_ok;
|
||||
protected DefaultTableModel tableModel;
|
||||
protected JTable table;
|
||||
private ModifyMeopNoDialogController controller;
|
||||
protected JButton b_delete;
|
||||
protected JButton b_moveup;
|
||||
protected JButton b_movedown;
|
||||
|
||||
public ModifyMeopNoDialog(KDialogController controller) {
|
||||
super(controller);
|
||||
this.controller = (ModifyMeopNoDialogController) controller;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addListeners() {
|
||||
this.b_delete.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
try {
|
||||
controller.delete();
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
MessageBox.post(ModifyMeopNoDialog.this, e1);
|
||||
}
|
||||
}
|
||||
});
|
||||
this.b_moveup.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
try {
|
||||
controller.moveup();
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
MessageBox.post(ModifyMeopNoDialog.this, e1);
|
||||
}
|
||||
}
|
||||
});
|
||||
this.b_movedown.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
try {
|
||||
controller.movedown();
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
MessageBox.post(ModifyMeopNoDialog.this, e1);
|
||||
}
|
||||
}
|
||||
});
|
||||
this.b_ok.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
disposeDialog();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initUI() {
|
||||
this.setTitle(ProcessLocale.getString("modifymeopno.TITLE"));
|
||||
this.setPreferredSize(new Dimension(800, 600));
|
||||
this.setLayout(new BorderLayout());
|
||||
this.add(BorderLayout.CENTER, initTablePanel());
|
||||
this.add(BorderLayout.EAST, initBtnPanel());
|
||||
try {
|
||||
controller.readMeop();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
MessageBox.post(this, e);
|
||||
}
|
||||
controller.checkRelease();
|
||||
}
|
||||
|
||||
private Component initBtnPanel() {
|
||||
JPanel panel = new JPanel(new GridBagLayout());
|
||||
panel.setBorder(BorderFactory.createEmptyBorder(16, 0, 7, 7));
|
||||
GridBagConstraints s = getGridBagConstraints(0, 0, new Insets(0, 0, 12, 0));
|
||||
KUtil.newRow(panel, this.b_delete = new JButton(ProcessLocale.getString("delete")), s, 1);
|
||||
KUtil.newRow(panel, this.b_moveup = new JButton(ProcessLocale.getString("moveup")), s, 1);
|
||||
KUtil.newRow(panel, this.b_movedown = new JButton(ProcessLocale.getString("movedown")), s, 1);
|
||||
KUtil.newRow(panel, this.b_ok = new JButton(ProcessLocale.getString("ok")), s, 1);
|
||||
s.weighty = 1;
|
||||
KUtil.newRow(panel, new JLabel(), s, 1);
|
||||
return panel;
|
||||
}
|
||||
|
||||
private Component initTablePanel() {
|
||||
this.tableModel = new DefaultTableModel();
|
||||
this.table = new JTable(tableModel) {
|
||||
@Override
|
||||
public boolean isCellEditable(int row, int column) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
table.setRowHeight(23);
|
||||
tableModel.setDataVector(null, controller.tableHeaders);
|
||||
table.getTableHeader().setReorderingAllowed(false);
|
||||
table.setDefaultRenderer(Object.class, new ColorTableRenderer());
|
||||
int colCnt = KUtil.getLen(controller.tableHeaders);
|
||||
TableColumnModel colModel = this.table.getColumnModel();
|
||||
for (int i = 0; i < colCnt; i++) {
|
||||
colModel.getColumn(i).setPreferredWidth(controller.tableHeaderWidth[i]);
|
||||
}
|
||||
colModel.getColumn(0).setMinWidth(0);
|
||||
colModel.getColumn(0).setMaxWidth(0);
|
||||
if (colCnt > 5) {
|
||||
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
|
||||
}
|
||||
JScrollPane scroll = new JScrollPane(table);
|
||||
scroll.setBorder(null);
|
||||
JPanel panel = new JPanel(new BorderLayout());
|
||||
panel.add(BorderLayout.CENTER, scroll);
|
||||
panel.setBorder(BorderFactory.createEmptyBorder(7, 7, 7, 7));
|
||||
return panel;
|
||||
}
|
||||
|
||||
public static class ColorTableRenderer extends DefaultTableCellRenderer {
|
||||
public static final Color DEFBLUE = new Color(51, 153, 255);
|
||||
public static final Color RED = new Color(255, 59, 48);
|
||||
public static final Color GREEN = new Color(158, 234, 106);
|
||||
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(JTable t, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
|
||||
if (hasFocus) {
|
||||
setBackground(DEFBLUE);
|
||||
} else {
|
||||
Object obj = t.getValueAt(row, 0);
|
||||
if(obj instanceof ModifyMeopNoRow) {
|
||||
if(((ModifyMeopNoRow) obj).isReleased()) {
|
||||
setBackground(RED);
|
||||
}else {
|
||||
setBackground(GREEN);
|
||||
}
|
||||
}else {
|
||||
setBackground(Color.WHITE);
|
||||
}
|
||||
}
|
||||
return super.getTableCellRendererComponent(t, value, isSelected, hasFocus, row, column);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package cn.net.connor.process.modifymeopno;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.teamcenter.rac.kernel.TCComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponentBOMLine;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||
|
||||
import k.util.KUtil;
|
||||
import k.util.PropLocation;
|
||||
|
||||
public class ModifyMeopNoRow {
|
||||
|
||||
private TCComponentBOMLine bomline;
|
||||
private boolean isReleased;
|
||||
private HashMap<String, TCComponent> markedComponents;
|
||||
|
||||
public ModifyMeopNoRow(TCComponentBOMLine cLine) throws Exception {
|
||||
this.bomline = cLine;
|
||||
this.bomline.refresh();
|
||||
TCComponentItemRevision rev = cLine.getItemRevision();
|
||||
if(rev==null) {
|
||||
throw new Exception("revision not found: "+cLine);
|
||||
}
|
||||
rev.refresh();
|
||||
markedComponents = new HashMap<String, TCComponent>();
|
||||
PropLocation.initLocationMap(markedComponents , getBomline());
|
||||
this.isReleased=KUtil.isReleased(rev);
|
||||
}
|
||||
|
||||
public boolean isReleased() {
|
||||
return this.isReleased;
|
||||
}
|
||||
|
||||
public Object[] getRowData(String[] tableProps) throws Exception{
|
||||
int len = KUtil.getLen(tableProps);
|
||||
Object[] data = new Object[len+1];
|
||||
data[0] = this;
|
||||
for(int i=0; i<len; i++) {
|
||||
String[] config = tableProps[i].split("\\.");
|
||||
if(KUtil.getLen(config)!=2) {
|
||||
data[i+1] = tableProps[i];
|
||||
continue;
|
||||
}
|
||||
String propLoc = config[0].toUpperCase();
|
||||
if(markedComponents.containsKey(propLoc)) {
|
||||
data[i+1] = markedComponents.get(propLoc).getProperty(config[1]);
|
||||
}else {
|
||||
data[i+1] = tableProps[i];
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getBomline().toString();
|
||||
}
|
||||
|
||||
public TCComponentBOMLine getBomline() {
|
||||
return bomline;
|
||||
}
|
||||
}
|
@ -0,0 +1,139 @@
|
||||
package cn.net.connor.process.newmeop;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import javax.swing.table.TableColumnModel;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFDialog;
|
||||
import com.teamcenter.rac.util.MessageBox;
|
||||
|
||||
import cn.net.connor.process.ProcessLocale;
|
||||
import k.KDialog;
|
||||
import k.KDialogController;
|
||||
import k.util.KUtil;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class MeopNoDialog extends KDialog {
|
||||
|
||||
private JButton b_insert;
|
||||
private JButton b_ok;
|
||||
protected DefaultTableModel tableModel;
|
||||
protected JTable table;
|
||||
private MeopNoDialogController controller;
|
||||
private boolean ok = false;
|
||||
|
||||
public MeopNoDialog(AbstractAIFDialog parent, boolean model, KDialogController controller) {
|
||||
super(parent, model, controller);
|
||||
this.controller = (MeopNoDialogController) controller;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addListeners() {
|
||||
this.b_insert.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
try {
|
||||
controller.insert();
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
MessageBox.post(MeopNoDialog.this, e1);
|
||||
}
|
||||
}
|
||||
});
|
||||
this.b_ok.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
boolean meopno = false;
|
||||
try {
|
||||
//lidy20240926判断插入的工序号与当前工艺下已存在的工序的工序号是否相同
|
||||
ArrayList<Integer> list = new ArrayList<>();
|
||||
for(int i = 0; i < table.getRowCount(); i++) {
|
||||
int no = Integer.parseInt("" + table.getValueAt(i, 0));
|
||||
if(list.contains(no)) {
|
||||
meopno = true;
|
||||
throw new Exception(no + ProcessLocale.getString("meopno"));
|
||||
}
|
||||
list.add(no);
|
||||
}
|
||||
ok = true;
|
||||
disposeDialog();
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
MessageBox.post(MeopNoDialog.this, ProcessLocale.getString("error") +
|
||||
(meopno ? e1.getMessage() : e1), "ERROR", MessageBox.ERROR);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public Map<String, String> getMeopInfo() throws Exception {
|
||||
if (!initDialog()) {
|
||||
return null;
|
||||
}
|
||||
controller.readMeop();
|
||||
showDialog();
|
||||
if (!ok) {
|
||||
return null;
|
||||
}
|
||||
return controller.getInsertedData();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initUI() {
|
||||
this.setTitle(ProcessLocale.getString("applymeopno.TITLE"));
|
||||
this.setPreferredSize(new Dimension(800, 600));
|
||||
this.setLayout(new BorderLayout());
|
||||
this.add(BorderLayout.CENTER, initTablePanel());
|
||||
this.add(BorderLayout.EAST, initBtnPanel());
|
||||
}
|
||||
|
||||
private Component initBtnPanel() {
|
||||
JPanel panel = new JPanel(new GridBagLayout());
|
||||
panel.setBorder(BorderFactory.createEmptyBorder(16, 0, 7, 7));
|
||||
GridBagConstraints s = getGridBagConstraints(0, 0, new Insets(0, 0, 12, 0));
|
||||
KUtil.newRow(panel, this.b_insert = new JButton(ProcessLocale.getString("insert")), s, 1);
|
||||
KUtil.newRow(panel, this.b_ok = new JButton(ProcessLocale.getString("ok")), s, 1);
|
||||
s.weighty = 1;
|
||||
KUtil.newRow(panel, new JLabel(), s, 1);
|
||||
return panel;
|
||||
}
|
||||
|
||||
private Component initTablePanel() {
|
||||
this.tableModel = new DefaultTableModel();
|
||||
this.table = new JTable(tableModel);
|
||||
table.setRowHeight(23);
|
||||
tableModel.setDataVector(null, controller.tableHeaders);
|
||||
table.getTableHeader().setReorderingAllowed(false);
|
||||
int colCnt = KUtil.getLen(controller.tableHeaders);
|
||||
TableColumnModel colModel = this.table.getColumnModel();
|
||||
for (int i = 0; i < colCnt; i++) {
|
||||
colModel.getColumn(i).setPreferredWidth(controller.tableHeaderWidth[i]);
|
||||
}
|
||||
if (colCnt > 5) {
|
||||
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
|
||||
}
|
||||
JScrollPane scroll = new JScrollPane(table);
|
||||
scroll.setBorder(null);
|
||||
JPanel panel = new JPanel(new BorderLayout());
|
||||
panel.add(BorderLayout.CENTER, scroll);
|
||||
panel.setBorder(BorderFactory.createEmptyBorder(7, 7, 7, 7));
|
||||
return panel;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,120 @@
|
||||
package cn.net.connor.process.newmeop;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
|
||||
import com.teamcenter.rac.kernel.TCComponentBOMLine;
|
||||
|
||||
import cn.net.connor.process.ProcessLocale;
|
||||
import k.KDialogController;
|
||||
import k.util.KUtil;
|
||||
|
||||
public class MeopNoDialogController extends KDialogController {
|
||||
|
||||
public static final String PREF_MEOP_TYPE = "Connor_AVIC_SQGXH_GXLX";
|
||||
public static final String PREF_MEOP_TABLE = "Connor_AVIC_SQGXH_SXBJ";
|
||||
private String[] meopTypes;
|
||||
protected String[] tableHeaders;
|
||||
protected int[] tableHeaderWidth;
|
||||
private String[] tableProps;
|
||||
private MeopNoDialog dialog;
|
||||
private TCComponentBOMLine procLine;
|
||||
private int newRowNum = -1;
|
||||
|
||||
public MeopNoDialogController(AbstractAIFApplication app, TCComponentBOMLine procLine) {
|
||||
super(app);
|
||||
this.procLine = procLine;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean init() throws Exception {
|
||||
this.dialog = (MeopNoDialog) aifDialog;
|
||||
this.meopTypes = KUtil.getPrefVals(session, PREF_MEOP_TYPE);
|
||||
String[] tableConfigs = KUtil.getPrefVals(session, PREF_MEOP_TABLE);
|
||||
if (KUtil.getLen(meopTypes) == 0) {
|
||||
KUtil.warn(dialog, String.format(ProcessLocale.getString("prefnotconfiged.ERROR1"), PREF_MEOP_TYPE));
|
||||
return false;
|
||||
}
|
||||
if (KUtil.getLen(tableConfigs) == 0) {
|
||||
KUtil.warn(dialog, String.format(ProcessLocale.getString("prefnotconfiged.ERROR1"), PREF_MEOP_TABLE));
|
||||
return false;
|
||||
}
|
||||
int colCnt = KUtil.getLen(tableConfigs);
|
||||
tableHeaders = new String[colCnt];
|
||||
tableHeaderWidth = new int[colCnt];
|
||||
tableProps = new String[colCnt];
|
||||
for (int i = 0; i < colCnt; i++) {
|
||||
String config = tableConfigs[i];
|
||||
int ind = config.lastIndexOf('=');
|
||||
if (ind > 0) {
|
||||
tableHeaders[i] = config.substring(0, ind);
|
||||
tableProps[i] = config.substring(ind + 1);
|
||||
} else {
|
||||
tableHeaders[i] = config;
|
||||
tableProps[i] = config;
|
||||
}
|
||||
int width = 0;
|
||||
while (tableHeaders[i].length() > 0 && Character.isDigit(tableHeaders[i].charAt(0))) {
|
||||
width = width * 10 + (tableHeaders[i].charAt(0) - '0');
|
||||
tableHeaders[i] = tableHeaders[i].substring(1);
|
||||
}
|
||||
if (width < 1) {
|
||||
width = 120;
|
||||
}
|
||||
tableHeaderWidth[i] = width;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void readMeop() throws Exception {
|
||||
System.out.println("Load Meop: " + this.procLine+" | "+Arrays.toString(meopTypes));
|
||||
if (this.procLine == null) {
|
||||
return;
|
||||
}
|
||||
this.procLine.refresh();
|
||||
AIFComponentContext[] cc = this.procLine.getChildren();
|
||||
int len = KUtil.getLen(cc);
|
||||
for (int i = 0; i < len; i++) {
|
||||
TCComponentBOMLine cLine = (TCComponentBOMLine) cc[i].getComponent();
|
||||
String cType = cLine.getItem().getType();
|
||||
System.out.println((i+1)+". "+cLine+" -> "+cType);
|
||||
if(KUtil.inArray(cType, meopTypes)>=0) {
|
||||
dialog.tableModel.addRow(new MeopNoRow(cLine).getRowData(tableProps));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void insert() throws Exception {
|
||||
int selectedRow = dialog.table.getSelectedRow();
|
||||
System.out.println("Insert to: "+selectedRow);
|
||||
if(selectedRow<0) {
|
||||
newRowNum = dialog.table.getRowCount();
|
||||
dialog.tableModel.addRow(new Object[] {});
|
||||
}else {
|
||||
newRowNum = selectedRow;
|
||||
dialog.tableModel.insertRow(newRowNum, new Object[] {});
|
||||
}
|
||||
System.out.println("New RowNum: "+this.newRowNum);
|
||||
}
|
||||
|
||||
public Map<String, String> getInsertedData(){
|
||||
System.out.println("New RowNum: "+this.newRowNum);
|
||||
if(this.newRowNum<0) {
|
||||
return null;
|
||||
}
|
||||
Map<String, String> res = new HashMap<String, String>();
|
||||
int colCnt = KUtil.getLen(tableProps);
|
||||
for(int i=0; i<colCnt; i++) {
|
||||
String value = (String) dialog.table.getValueAt(this.newRowNum, i);
|
||||
if(value==null) {
|
||||
value = "";
|
||||
}
|
||||
res.put(tableProps[i], value);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package cn.net.connor.process.newmeop;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.teamcenter.rac.kernel.TCComponent;
|
||||
import com.teamcenter.rac.kernel.TCComponentBOMLine;
|
||||
|
||||
import k.util.KUtil;
|
||||
import k.util.PropLocation;
|
||||
|
||||
public class MeopNoRow {
|
||||
|
||||
private TCComponentBOMLine bomline;
|
||||
|
||||
public MeopNoRow(TCComponentBOMLine cLine) {
|
||||
this.bomline = cLine;
|
||||
}
|
||||
|
||||
|
||||
public Object[] getRowData(String[] tableProps) throws Exception{
|
||||
int len = KUtil.getLen(tableProps);
|
||||
Object[] data = new Object[len];
|
||||
Map<String, TCComponent> markedComponents = new HashMap<String, TCComponent>();
|
||||
PropLocation.initLocationMap(markedComponents , bomline);
|
||||
for(int i=0; i<len; i++) {
|
||||
String[] config = tableProps[i].split("\\.");
|
||||
if(KUtil.getLen(config)!=2) {
|
||||
data[i] = tableProps[i];
|
||||
continue;
|
||||
}
|
||||
String propLoc = config[0].toUpperCase();
|
||||
if(markedComponents.containsKey(propLoc)) {
|
||||
data[i] = markedComponents.get(propLoc).getProperty(config[1]);
|
||||
}else {
|
||||
data[i] = tableProps[i];
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
@ -0,0 +1,289 @@
|
||||
package cn.net.connor.process.newmeop;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.DefaultListModel;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JList;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.ListSelectionModel;
|
||||
import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
|
||||
import com.teamcenter.rac.util.MessageBox;
|
||||
|
||||
import cn.net.connor.process.ProcessLocale;
|
||||
import cn.net.connor.process.newmeop.NewMeopDialogController.MEOPType;
|
||||
import k.KDialog;
|
||||
import k.KDialogController;
|
||||
import k.util.KUtil;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class NewMeopDialog extends KDialog {
|
||||
|
||||
private JButton b_ok;
|
||||
private JButton b_cel;
|
||||
protected DefaultListModel<MEOPType> lm_type;
|
||||
protected JList<MEOPType> l_type;
|
||||
private NewMeopDialogController controller;
|
||||
private JButton b_assignId;
|
||||
private PrefComponent idComponent;
|
||||
private Map<PrefComponent,JButton> chooseComponents = new HashMap<PrefComponent, JButton>();
|
||||
private PrefComponent sequenceComponent;
|
||||
// private JButton b_assignMeopNo;
|
||||
private JButton b_insertMeopNo;
|
||||
|
||||
public NewMeopDialog(KDialogController controller) {
|
||||
super(controller);
|
||||
this.controller = (NewMeopDialogController)controller;
|
||||
}
|
||||
|
||||
private void setCompEnabled(boolean b) {
|
||||
b_ok.setEnabled(b);
|
||||
b_cel.setEnabled(b);
|
||||
for (JButton btn : chooseComponents.values()) {
|
||||
btn.setEnabled(b);
|
||||
}
|
||||
}
|
||||
|
||||
public void setAssignId(String newId) {
|
||||
if(idComponent!=null&&b_assignId!=null) {
|
||||
if(KUtil.isEmpty(newId)) {
|
||||
idComponent.setValue(null);
|
||||
b_assignId.setEnabled(true);
|
||||
}else {
|
||||
idComponent.setValue(newId);
|
||||
b_assignId.setEnabled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setMeopNo(String newId) {
|
||||
if(sequenceComponent!=null && b_insertMeopNo!=null) {//&&b_assignMeopNo!=null
|
||||
if(KUtil.isEmpty(newId)) {
|
||||
sequenceComponent.setValue(null);
|
||||
// b_assignMeopNo.setEnabled(true);
|
||||
// b_insertMeopNo.setEnabled(true);
|
||||
}else {
|
||||
sequenceComponent.setValue(newId);
|
||||
// b_assignMeopNo.setEnabled(false);
|
||||
// b_insertMeopNo.setEnabled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addListeners() {
|
||||
b_ok.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
setCompEnabled(false);
|
||||
try {
|
||||
controller.doCreate();
|
||||
controller.assignMeopNo();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
MessageBox.post(NewMeopDialog.this,e);
|
||||
}
|
||||
setCompEnabled(true);
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
});
|
||||
b_cel.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
disposeDialog();
|
||||
}
|
||||
});
|
||||
if(b_assignId!=null&&idComponent!=null) {
|
||||
b_assignId.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
try {
|
||||
controller.assignId();
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
MessageBox.post(NewMeopDialog.this,e1);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
if(this.sequenceComponent!=null && this.b_insertMeopNo!=null) {
|
||||
// b_assignMeopNo.addActionListener(new ActionListener() {
|
||||
// @Override
|
||||
// public void actionPerformed(ActionEvent e) {
|
||||
// try {
|
||||
// controller.assignMeopNo();//TODO
|
||||
// } catch (Exception e1) {
|
||||
// e1.printStackTrace();
|
||||
// MessageBox.post(NewMeopDialog.this,e1);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
b_insertMeopNo.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
try {
|
||||
controller.insertMeopNo();
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
MessageBox.post(NewMeopDialog.this,e1);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
for (PrefComponent bean : chooseComponents.keySet()) {
|
||||
JButton btn = chooseComponents.get(bean);
|
||||
btn.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
MEOPType typeComp = l_type.getSelectedValue();
|
||||
if (typeComp == null) {
|
||||
KUtil.warn(NewMeopDialog.this, ProcessLocale.getString("selectMeopType.INFO"));
|
||||
return;
|
||||
}
|
||||
bean.performChoose(NewMeopDialog.this, typeComp.type, controller.getApp(), controller.prefComponents);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
this.l_type.addListSelectionListener(new ListSelectionListener() {
|
||||
@Override
|
||||
public void valueChanged(ListSelectionEvent arg0) {
|
||||
if(arg0.getValueIsAdjusting()) {
|
||||
return;
|
||||
}
|
||||
System.out.println("Select Type Change > "+l_type.getSelectedValue());
|
||||
setAssignId(null);
|
||||
setMeopNo(null);
|
||||
try {
|
||||
controller.assignMeopNo();//TODO
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
MessageBox.post(NewMeopDialog.this,e1);
|
||||
}
|
||||
if(controller.shortDescPrefComp!=null&&l_type.getSelectedValue()!=null) {
|
||||
controller.shortDescPrefComp.setValue(l_type.getSelectedValue().additional);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initUI() {
|
||||
this.setTitle(ProcessLocale.getString("newmeop.TITLE"));
|
||||
this.setPreferredSize(new Dimension(780, 640));
|
||||
this.setMinimumSize(new Dimension(780, 640));
|
||||
this.setLayout(new BorderLayout());
|
||||
this.add(BorderLayout.WEST, initTypePanel());
|
||||
this.add(BorderLayout.CENTER, initPropPanel());
|
||||
this.add(BorderLayout.SOUTH, initBtnPanel());
|
||||
}
|
||||
|
||||
private Component initBtnPanel() {
|
||||
JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 20, 5));
|
||||
this.b_ok = new JButton(ProcessLocale.getString("ok"));
|
||||
this.b_cel = new JButton(ProcessLocale.getString("cancel"));
|
||||
panel.add(b_ok);
|
||||
panel.add(b_cel);
|
||||
return panel;
|
||||
}
|
||||
|
||||
private Component initPropPanel() {
|
||||
JPanel panel = new JPanel(new BorderLayout());
|
||||
panel.add(BorderLayout.CENTER, initMEPropPanel());
|
||||
panel.add(BorderLayout.SOUTH, initDESCPropPanel());
|
||||
return panel;
|
||||
}
|
||||
|
||||
private Component initDESCPropPanel() {
|
||||
JPanel panel = new JPanel(new BorderLayout());
|
||||
if(controller.shortDescPrefComp!=null) {
|
||||
//panel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(30, 5, 5, 5), ProcessLocale.getString("medesc.TITLE")));
|
||||
panel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(30, 5, 5, 5), controller.shortDescPrefComp.getLabel().getText()));
|
||||
JScrollPane scroll = new JScrollPane(controller.shortDescPrefComp.getValueComp());
|
||||
panel.add(BorderLayout.CENTER, scroll);
|
||||
controller.prefComponents.add(controller.shortDescPrefComp);
|
||||
}
|
||||
return panel;
|
||||
}
|
||||
|
||||
private Component initMEPropPanel() {
|
||||
JPanel wrapper = new JPanel(new BorderLayout());
|
||||
wrapper.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(30, 5, 5, 5), ProcessLocale.getString("meinfo.TITLE")));
|
||||
JPanel panel = new JPanel(new GridBagLayout());
|
||||
panel.setBorder(BorderFactory.createEmptyBorder(20,30,20,30));
|
||||
GridBagConstraints s = getGridBagConstraints(0, 0, new Insets(6, 6, 6, 6));
|
||||
List<PrefComponent> comps = controller.prefComponents;
|
||||
int colCnt = 1;
|
||||
int size = comps.size();
|
||||
for(int i=0;i<size;i++) {
|
||||
PrefComponent prefComponent = comps.get(i);
|
||||
if(i%colCnt==0) {
|
||||
KUtil.newRow(panel, prefComponent.label, s, 1);
|
||||
}else {
|
||||
KUtil.addCol(panel, prefComponent.label, s, 1, 0);
|
||||
}
|
||||
KUtil.addCol(panel, prefComponent.getValueComp(), s, 1, 1);
|
||||
if("item.item_id".equals(prefComponent.propConfig.toLowerCase())) {
|
||||
KUtil.addCol(panel, this.b_assignId = new JButton(ProcessLocale.getString("assign")), s, 1, 0);
|
||||
this.idComponent = prefComponent;
|
||||
}else if(KUtil.getLen(prefComponent.chooseFromExcel)>0) {
|
||||
JButton b_choose = new JButton(ProcessLocale.getString("select"));
|
||||
KUtil.addCol(panel, b_choose, s, 1, 0);
|
||||
chooseComponents.put(prefComponent, b_choose);
|
||||
}else if("revmaster.ac5_OperationNumber".equalsIgnoreCase(prefComponent.propConfig)) {
|
||||
// KUtil.addCol(panel,this.b_assignMeopNo = new JButton(ProcessLocale.getString("shenqing")), s, 1, 0);//TODO
|
||||
KUtil.addCol(panel,this.b_insertMeopNo = new JButton(ProcessLocale.getString("insert")), s, 1, 0);
|
||||
this.sequenceComponent = prefComponent;
|
||||
try {
|
||||
controller.assignMeopNo();
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
MessageBox.post(NewMeopDialog.this,e1);
|
||||
}
|
||||
}
|
||||
}
|
||||
s.weighty = 1;
|
||||
KUtil.newRow(panel, new JLabel(""), s, 1);
|
||||
JScrollPane scroll = new JScrollPane(panel);
|
||||
//scroll.setBorder(null);
|
||||
wrapper.add(BorderLayout.CENTER, scroll);
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
private Component initTypePanel() {
|
||||
JPanel panel = new JPanel(new BorderLayout());
|
||||
panel.setPreferredSize(new Dimension(200,0));
|
||||
panel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(30, 5, 5, 0), ProcessLocale.getString("meoptype.TITLE")));
|
||||
this.lm_type = new DefaultListModel<MEOPType>();
|
||||
this.l_type = new JList<MEOPType>(lm_type);
|
||||
for (MEOPType t : controller.meopTypes) {
|
||||
this.lm_type.addElement(t);
|
||||
}
|
||||
this.l_type.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
JScrollPane scroll = new JScrollPane(this.l_type);
|
||||
panel.add(BorderLayout.CENTER, scroll);
|
||||
return panel;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,376 @@
|
||||
package cn.net.connor.process.newmeop;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
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.TCComponentItemRevisionType;
|
||||
import com.teamcenter.rac.kernel.TCComponentItemType;
|
||||
import com.teamcenter.rac.kernel.TCException;
|
||||
import com.teamcenter.rac.util.Registry;
|
||||
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.CreateInput;
|
||||
import com.teamcenter.services.rac.core._2008_06.DataManagement.CreateOut;
|
||||
import com.teamcenter.services.rac.core._2008_06.DataManagement.CreateResponse;
|
||||
|
||||
import cn.net.connor.process.ProcessLocale;
|
||||
import cn.net.connor.process.ProcessUtil;
|
||||
import k.KDialogController;
|
||||
import k.util.KUtil;
|
||||
|
||||
public class NewMeopDialogController extends KDialogController {
|
||||
|
||||
private NewMeopDialog dialog;
|
||||
private TCComponentBOMLine targetLine;
|
||||
private TCComponentItemRevision targetRev;
|
||||
public static final String PREF_PREFIX = "Connor_AVIC_MEOP_";
|
||||
public static final String PREF_PREFIX_EXCEL = "Connor_AVIC_MEOPEXCEL_";
|
||||
public static final String PREF_PROPS = "Connor_AVIC_MEOP_Properties";
|
||||
public static final String PREF_REL_LOV = "Connor_AVIC_MEOP_LOV_";
|
||||
public static final Registry REG = Registry.getRegistry(NewMeopDialogController.class);
|
||||
|
||||
protected List<MEOPType> meopTypes = new ArrayList<NewMeopDialogController.MEOPType>();
|
||||
protected List<PrefComponent> prefComponents = new ArrayList<PrefComponent>();
|
||||
protected int propCols = 1;
|
||||
protected PrefComponent shortDescPrefComp;
|
||||
|
||||
public class MEOPType {
|
||||
protected String type;
|
||||
protected String disType;
|
||||
protected String additional;
|
||||
protected TCComponentItemType itemType;
|
||||
|
||||
public MEOPType(String type, String disType, String additional) throws Exception {
|
||||
this.type = type;
|
||||
this.disType = disType;
|
||||
this.additional = additional;
|
||||
this.itemType = (TCComponentItemType) KUtil.session.getTypeComponent(type);
|
||||
if (this.itemType == null) {
|
||||
throw new Exception(String.format(ProcessLocale.getString("typenotfound.ERROR1"), type));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return " " + disType;
|
||||
}
|
||||
}
|
||||
|
||||
public NewMeopDialogController(AbstractAIFApplication app) {
|
||||
super(app);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean init() throws Exception {
|
||||
this.dialog = (NewMeopDialog) aifDialog;
|
||||
InterfaceAIFComponent comp = app.getTargetComponent();
|
||||
System.out.println("Select: " + comp);
|
||||
if (comp != null) {
|
||||
if (comp instanceof TCComponentBOMLine) {
|
||||
this.targetLine = (TCComponentBOMLine) comp;
|
||||
TCComponentItemRevision rev = this.targetLine.getItemRevision();
|
||||
System.out.println(">> " + rev.getType());
|
||||
if(ProcessUtil.isMEProcess(rev.getItem().getType())) {
|
||||
//if (rev instanceof TCComponentMEProcessRevision) {
|
||||
this.targetRev = rev;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (targetRev == null) {
|
||||
KUtil.warn(dialog, ProcessLocale.getString("selectprocessrev.ERROR"));
|
||||
return false;
|
||||
}
|
||||
{
|
||||
String prefName = PREF_PREFIX + this.targetRev.getType();
|
||||
String[] prefVals = KUtil.getPrefVals(session, prefName);
|
||||
int len = KUtil.getLen(prefVals);
|
||||
for (int i = 0; i < len; i++) {
|
||||
String type = prefVals[i];
|
||||
String addition = "";
|
||||
int ind = type.indexOf('=');
|
||||
if (ind > 0) {
|
||||
addition = type.substring(ind + 1).replace("\\n", "\n");
|
||||
type = type.substring(0, ind);
|
||||
}
|
||||
String disType = KUtil.getTypeName(session, type);
|
||||
if (KUtil.isEmpty(disType)) {
|
||||
System.out.println("Error Config: " + prefVals[i]);
|
||||
continue;
|
||||
}
|
||||
this.meopTypes.add(new MEOPType(type, disType, addition));
|
||||
}
|
||||
if (this.meopTypes.size() == 0) {
|
||||
KUtil.warn(dialog, String.format(ProcessLocale.getString("prefnotconfiged.ERROR1"), prefName));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
{
|
||||
String[] prefVals = KUtil.getPrefVals(session, PREF_PROPS);
|
||||
int len = KUtil.getLen(prefVals);
|
||||
for (int i = 0; i < len; i++) {
|
||||
String pref = prefVals[i];
|
||||
if (pref.length() == 1 && Character.isDigit(pref.charAt(0))) {
|
||||
int col = pref.charAt(0) - '0';
|
||||
if (col > 0) {
|
||||
System.out.println("Reset Proc Col: " + col);
|
||||
this.propCols = col;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
PrefComponent prefComp = new PrefComponent(pref);
|
||||
if (prefComp.init(session, targetRev, prefComponents)) {
|
||||
prefComponents.add(prefComp);
|
||||
} else {
|
||||
System.out.println("Error Config: " + pref);
|
||||
}
|
||||
}
|
||||
if (prefComponents.size() == 0) {
|
||||
KUtil.warn(dialog, String.format(ProcessLocale.getString("prefnotconfiged.ERROR1"), PREF_PROPS));
|
||||
return false;
|
||||
}
|
||||
String descPropName = NewMeopDialogController.REG.getString("shortdesc.PROPNAME");
|
||||
this.shortDescPrefComp = new PrefComponent(descPropName);
|
||||
if(!shortDescPrefComp.init(session, targetRev, prefComponents)) {
|
||||
this.shortDescPrefComp = null;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void assignId() throws Exception {
|
||||
MEOPType type = dialog.l_type.getSelectedValue();
|
||||
if (type == null) {
|
||||
KUtil.warn(dialog, ProcessLocale.getString("selectMeopType.INFO"));
|
||||
return;
|
||||
}
|
||||
TCComponentItemType itemType = type.itemType;
|
||||
String newId = itemType.getNewID();
|
||||
System.out.println("New ID: " + type.type + " -> " + newId);
|
||||
dialog.setAssignId(newId);
|
||||
}
|
||||
|
||||
public static int getMeopNo(TCComponentBOMLine line) throws Exception{
|
||||
TCComponentItemRevision rev = line.getItemRevision();
|
||||
if(rev==null) {
|
||||
throw new TCException("获取版本失败:"+line);
|
||||
}
|
||||
TCComponent form = rev.getRelatedComponent("IMAN_master_form_rev");
|
||||
if(form==null) {
|
||||
throw new TCException("获取版本表单失败:"+rev);
|
||||
}
|
||||
form.refresh();
|
||||
String seqStr = form.getStringProperty("ac5_OperationNumber");
|
||||
System.out.println("Op Number: "+line+" -> "+seqStr);
|
||||
int seq = 0;
|
||||
if(!KUtil.isEmpty(seqStr)) {
|
||||
try {
|
||||
seq = Integer.parseInt(seqStr);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return seq;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void setMeopNo(TCComponentBOMLine line, int meopNo) throws Exception{
|
||||
System.out.println("Set Op Number: "+line+" -> "+meopNo);
|
||||
// if(meopNo<0) {
|
||||
// return;
|
||||
// }
|
||||
TCComponentItemRevision rev = line.getItemRevision();
|
||||
if(rev==null) {
|
||||
throw new TCException("获取版本失败:"+line);
|
||||
}
|
||||
TCComponent form = rev.getRelatedComponent("IMAN_master_form_rev");
|
||||
if(form==null) {
|
||||
throw new TCException("获取版本表单失败:"+rev);
|
||||
}
|
||||
form.refresh();
|
||||
form.lock();
|
||||
try {
|
||||
form.setStringProperty("ac5_OperationNumber", meopNo+"");
|
||||
form.save();
|
||||
form.refresh();
|
||||
} finally {
|
||||
form.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public void assignMeopNo() throws Exception{
|
||||
targetLine.refresh();
|
||||
AIFComponentContext[] cc = targetLine.getChildren();
|
||||
int maxSeq = 0;
|
||||
int len = KUtil.getLen(cc);
|
||||
for(int i=0;i<len;i++) {
|
||||
TCComponentBOMLine cLine = (TCComponentBOMLine) cc[i].getComponent();
|
||||
int seq = getMeopNo(cLine);
|
||||
maxSeq = Math.max(seq, maxSeq);
|
||||
}
|
||||
maxSeq+=5;
|
||||
System.out.println("New Sequence: "+maxSeq);
|
||||
// dialog.setMeopNo(""+maxSeq);
|
||||
dialog.setMeopNo(String.format("%02d", maxSeq));
|
||||
}
|
||||
|
||||
public void insertMeopNo() throws Exception{
|
||||
Map<String, String> propData = new MeopNoDialog(dialog, true, new MeopNoDialogController(app, targetLine)).getMeopInfo();
|
||||
System.out.println("Prop Info: "+propData);
|
||||
if(propData==null||propData.size()==0) {
|
||||
return;
|
||||
}
|
||||
for (PrefComponent comp : prefComponents) {
|
||||
String key = comp.getPropConfig();
|
||||
if(propData.containsKey(key)) {
|
||||
String value = propData.get(key);
|
||||
System.out.println(String.format("set [%s]=[%s]", key, value));
|
||||
if(key.equals("revmaster.ac5_OperationNumber") && value.length()==1)
|
||||
comp.setValue("0"+value);
|
||||
else
|
||||
comp.setValue(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void doCreate() throws Exception{
|
||||
System.out.println("doCreate() = = = = = = = =");
|
||||
MEOPType typeComp = dialog.l_type.getSelectedValue();
|
||||
if (typeComp == null) {
|
||||
KUtil.warn(dialog, ProcessLocale.getString("selectMeopType.INFO"));
|
||||
return;
|
||||
}
|
||||
TCComponentItemType itemType = typeComp.itemType;
|
||||
//Check Require
|
||||
if(!checkRequire()) {
|
||||
return;
|
||||
}
|
||||
String type = itemType.getName();
|
||||
System.out.println("Select Type: " + type);
|
||||
if (KUtil.isEmpty(type)) {
|
||||
KUtil.info(dialog, ProcessLocale.getString("selectType.INFO"));
|
||||
return;
|
||||
}
|
||||
if (!checkRequire()) {
|
||||
return;
|
||||
}
|
||||
TCComponentItemRevisionType revType = itemType.getItemRevisionType();
|
||||
String revTypeName = revType.getName();
|
||||
String itemMasterTypeName = type+" Master";
|
||||
String revMasterTypeName = revTypeName+" Master";
|
||||
if(session.getTypeComponent(itemMasterTypeName)==null) {
|
||||
itemMasterTypeName = type+"Master";
|
||||
}
|
||||
if(session.getTypeComponent(revMasterTypeName)==null) {
|
||||
revMasterTypeName = revTypeName+"Master";
|
||||
}
|
||||
System.out.println("Revision Type: " + type);
|
||||
System.out.println("Item Master Type: " + itemMasterTypeName);
|
||||
System.out.println("Revision Master Type: " + revMasterTypeName);
|
||||
Map<String, String> revPropMap = new HashMap<>();
|
||||
Map<String, String> revMasterPropMap = new HashMap<>();
|
||||
Map<String, String> itemPropMap = new HashMap<>();
|
||||
Map<String, String> itemMasterPropMap = new HashMap<>();
|
||||
Map<String, String> bomLinePropMap = new HashMap<>();
|
||||
for (PrefComponent prefComponent : this.prefComponents) {
|
||||
KUtil.initPropMap(prefComponent.propConfig,prefComponent.getValue(),itemPropMap,itemMasterPropMap,revPropMap,revMasterPropMap,bomLinePropMap);
|
||||
}
|
||||
/*String propType = "ac5_Type";
|
||||
//propType = "object_desc";
|
||||
if(revMasterPropMap.containsKey(propType)) {
|
||||
String ac5Type = revMasterPropMap.get(propType);
|
||||
System.out.println(propType+": "+ac5Type);
|
||||
if(!KUtil.isEmpty(ac5Type)) {
|
||||
revPropMap.put("item_revision_id", ac5Type+"00");
|
||||
}
|
||||
}*/
|
||||
revPropMap.put("item_revision_id", targetLine.getItemRevision().getProperty("item_revision_id"));
|
||||
CreateInput revMasterInput = new CreateInput();
|
||||
revMasterInput.boName = revMasterTypeName;
|
||||
revMasterInput.stringProps = revMasterPropMap;
|
||||
CreateInput itemMasterInput = new CreateInput();
|
||||
itemMasterInput.boName = itemMasterTypeName;
|
||||
itemMasterInput.stringProps = itemMasterPropMap;
|
||||
CreateInput revInput = new CreateInput();
|
||||
revInput.boName = revTypeName;
|
||||
revInput.stringProps = revPropMap;
|
||||
Map<String, CreateInput[]> revMasterInfoMap = new HashMap<>();
|
||||
revMasterInfoMap.put("IMAN_master_form_rev", new CreateInput[] { revMasterInput });
|
||||
revInput.compoundCreateInput = revMasterInfoMap;
|
||||
// create rev
|
||||
CreateInput itemInput = new CreateInput();
|
||||
itemInput.boName = type;
|
||||
itemInput.stringProps = itemPropMap;
|
||||
Map<String, CreateInput[]> revInfoMap = new HashMap<>();
|
||||
revInfoMap.put("revision", new CreateInput[] { revInput });
|
||||
revInfoMap.put("IMAN_master_form", new CreateInput[] {itemMasterInput});
|
||||
itemInput.compoundCreateInput = revInfoMap;
|
||||
// create info
|
||||
CreateIn cI = new CreateIn();
|
||||
cI.clientId = "CreateItem";
|
||||
cI.data = itemInput;
|
||||
// service
|
||||
DataManagementService service = DataManagementService.getService(session);
|
||||
// create
|
||||
CreateResponse resp = service.createObjects(new CreateIn[] { cI });
|
||||
KUtil.throwServiceDataError(resp.serviceData);
|
||||
CreateOut[] cOs = resp.output;
|
||||
TCComponentItem newItem = null;
|
||||
if (cOs.length > 0) {
|
||||
for (TCComponent s : cOs[0].objects) {
|
||||
if (s instanceof TCComponentItem) {
|
||||
newItem = (TCComponentItem) s;
|
||||
}
|
||||
}
|
||||
}
|
||||
System.out.println("New Item: "+newItem);
|
||||
if(newItem==null) {
|
||||
throw new Exception(ProcessLocale.getString("createprocess.ERROR"));
|
||||
}
|
||||
newItem.refresh();
|
||||
TCComponentItemRevision newRev = newItem.getLatestItemRevision();
|
||||
System.out.println("New Rev: "+newRev);
|
||||
TCComponentBOMLine newLine = this.targetLine.add(newItem, newRev, null, false);
|
||||
if(bomLinePropMap.size()>0) {
|
||||
System.out.println("Set Bom Property: "+bomLinePropMap);
|
||||
newLine.setProperties(bomLinePropMap);
|
||||
newLine.refresh();
|
||||
}
|
||||
this.targetLine.refresh();
|
||||
dialog.setAssignId(null);
|
||||
dialog.setMeopNo(null);
|
||||
//TODO
|
||||
for(PrefComponent comp : prefComponents) {
|
||||
if(!comp.hasDefault())
|
||||
comp.setValue("");
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkRequire() {
|
||||
List<String> requireTitles = new ArrayList<String>();
|
||||
for (PrefComponent prefComponent : this.prefComponents) {
|
||||
if (!prefComponent.checkRequire()) {
|
||||
requireTitles.add(prefComponent.title.replace(" ", "").replace(":", "").replace(KUtil.getReg("CN_SYMBEL4"), "").replace(KUtil.getReg("CN_SYMBEL5"), ""));
|
||||
}
|
||||
}
|
||||
if (requireTitles.size() > 0) {
|
||||
KUtil.info(dialog, String.format(ProcessLocale.getString("requireprop.INFO1"), requireTitles.toString()));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public AbstractAIFApplication getApp() {
|
||||
return app;
|
||||
}
|
||||
|
||||
}
|