commit c48739e9b384a4b6c4ca01750dcde53cd0889607 Author: ChenZichaoczc <2974997276@qq.com> Date: Tue Jun 3 16:17:38 2025 +0800 first commit diff --git a/SubstMacros-MSExcel.wsf b/SubstMacros-MSExcel.wsf new file mode 100644 index 0000000..c2b4a6f --- /dev/null +++ b/SubstMacros-MSExcel.wsf @@ -0,0 +1,168 @@ + + + diff --git a/SubstMacros-MSWord.wsf b/SubstMacros-MSWord.wsf new file mode 100644 index 0000000..43a70f5 --- /dev/null +++ b/SubstMacros-MSWord.wsf @@ -0,0 +1,221 @@ + + + + diff --git a/cn.net.connor.designtopart.zip b/cn.net.connor.designtopart.zip new file mode 100644 index 0000000..8e14972 Binary files /dev/null and b/cn.net.connor.designtopart.zip differ diff --git a/cn.net.connor.designtopart/.classpath b/cn.net.connor.designtopart/.classpath new file mode 100644 index 0000000..8a7b5a7 --- /dev/null +++ b/cn.net.connor.designtopart/.classpath @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/cn.net.connor.designtopart/.gitignore b/cn.net.connor.designtopart/.gitignore new file mode 100644 index 0000000..ae3c172 --- /dev/null +++ b/cn.net.connor.designtopart/.gitignore @@ -0,0 +1 @@ +/bin/ diff --git a/cn.net.connor.designtopart/.project b/cn.net.connor.designtopart/.project new file mode 100644 index 0000000..b036b3e --- /dev/null +++ b/cn.net.connor.designtopart/.project @@ -0,0 +1,28 @@ + + + cn.net.connor.designtopart + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/cn.net.connor.designtopart/.settings/org.eclipse.core.resources.prefs b/cn.net.connor.designtopart/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..618525c --- /dev/null +++ b/cn.net.connor.designtopart/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +encoding//src/cn/net/connor/plm/util/ExcelWriteTable1.java=UTF-8 +encoding//src/cn/net/connor/plm/util/ExcelWriteTable2.java=UTF-8 +encoding//src/cn/net/connor/plm/util/ExcelWriteTable3.java=UTF-8 diff --git a/cn.net.connor.designtopart/.settings/org.eclipse.jdt.core.prefs b/cn.net.connor.designtopart/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..0c68a61 --- /dev/null +++ b/cn.net.connor.designtopart/.settings/org.eclipse.jdt.core.prefs @@ -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 diff --git a/cn.net.connor.designtopart/META-INF/MANIFEST.MF b/cn.net.connor.designtopart/META-INF/MANIFEST.MF new file mode 100644 index 0000000..1a846b8 --- /dev/null +++ b/cn.net.connor.designtopart/META-INF/MANIFEST.MF @@ -0,0 +1,73 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Designtopart +Bundle-SymbolicName: cn.net.connor.designtopart;singleton:=true +Bundle-Version: 1.0.0 +Bundle-Activator: cn.net.connor.designtopart.Activator +Eclipse-RegisterBuddy: k.util +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + com.teamcenter.rac.aifrcp;bundle-version="12000.3.0", + com.teamcenter.rac.common;bundle-version="12000.3.0", + com.teamcenter.rac.external;bundle-version="12000.3.0", + com.teamcenter.rac.kernel;bundle-version="12000.3.0", + com.teamcenter.rac.tcapps;bundle-version="12000.3.0", + com.teamcenter.rac.ui;bundle-version="12000.3.0", + com.teamcenter.rac.ui.commands;bundle-version="12000.3.0", + com.teamcenter.rac.util;bundle-version="12000.3.0", + k.util;bundle-version="1.0.0", + TcSoaCoreLoose;bundle-version="12000.3.0", + TcSoaCoreRac;bundle-version="12000.3.0", + TcSoaCoreTypes;bundle-version="12000.3.0", + org.apache.poi.315;bundle-version="3.15.0" +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Automatic-Module-Name: cn.net.connor.designtopart +Bundle-ActivationPolicy: lazy +Export-Package: cn.net.connor.designtopart, + cn.net.connor.designtopart.commands, + cn.net.connor.designtopart.designtopart, + com.connor.dfl.plm.util, + oracle.core.lmx, + oracle.core.lvf, + oracle.jdbc, + oracle.jdbc.aq, + oracle.jdbc.babelfish, + oracle.jdbc.connector, + oracle.jdbc.dcn, + oracle.jdbc.diagnostics, + oracle.jdbc.driver, + oracle.jdbc.internal, + oracle.jdbc.oci, + oracle.jdbc.oracore, + oracle.jdbc.pool, + oracle.jdbc.pooling, + oracle.jdbc.proxy, + oracle.jdbc.proxy.annotation, + oracle.jdbc.replay, + oracle.jdbc.replay.driver, + oracle.jdbc.replay.internal, + oracle.jdbc.rowset, + oracle.jdbc.util, + oracle.jdbc.xa, + oracle.jdbc.xa.client, + oracle.jpub.runtime, + oracle.net.ano, + oracle.net.aso, + oracle.net.jdbc.TNSAddress, + oracle.net.jdbc.nl, + oracle.net.jdbc.nl.mesg, + oracle.net.jndi, + oracle.net.ns, + oracle.net.nt, + oracle.net.resolver, + oracle.security.o3logon, + oracle.security.o5logon, + oracle.sql, + oracle.sql.converter +Bundle-ClassPath: ., + lib/ojdbc7.jar, + lib/core-renderer.jar, + lib/iTextAsian.jar, + lib/iTextAsianCmaps.jar, + lib/itextpdf-5.0.6.jar +Import-Package: com.teamcenter.rac.ui.common diff --git a/cn.net.connor.designtopart/README.MD b/cn.net.connor.designtopart/README.MD new file mode 100644 index 0000000..e802225 --- /dev/null +++ b/cn.net.connor.designtopart/README.MD @@ -0,0 +1,17 @@ +## 鍥剧焊杞墿鏂 + +> 閰嶇疆棣栭夐」锛欳onnor_Design_To_Part + +```text +闇瑕佽浆鎹esign瀵硅薄绫诲瀷=[-]鍏崇郴鍚嶇О=杞崲鍚庡璞$被鍨+鈥渱鈥濆垎闅旓紝鍚庤竟涓哄睘鎬х户鎵垮搴斿叧绯伙紝R涓虹増鏈笂灞炴э紝RM涓虹増鏈〃鍗曞睘鎬э紝I涓哄璞′笂鐨勫睘鎬э紝+鈥*鈥濇爣璇嗗睘鎬т负蹇呭~+鈥滐紒鈥濅负鍙紪杈戯紱 +鍊硷細Design鐗堟湰=Part鐗堟湰|R.Design灞炴у=R.Part灞炴у*锛侊紱RM. Design灞炴у=RM.Part灞炴у; + +鍏崇郴鍚嶇О鍓嶅姞鈥-鈥濊〃绀哄皢闇瑕佽浆鎹㈢殑瀵硅薄鐗堟湰娣诲姞鍒拌浆鎹㈠悗鐨勫璞$増鏈殑鍏崇郴涓 +``` + +绀轰緥 + +```text +ItemRevision=-IMAN_reference=Part Revision|R.object_desc=R.object_desc;RM.object_desc=RM.object_desc*! +Ac5_ProductInfoRevision=IMAN_reference=Ac5_ProductInfoRevision|R.object_string=R.object_desc;R.object_name=R.object_name;RM.ac5_BearingResearchDepart=RM.ac5_BearingResearchDepart!*;RM.ac5_ByTheHost=RM.ac5_ByTheHost;RM.ac5_CAE=rm.ac5_CAE;rm.ac5_ChiefDesigner=rm.ac5_ChiefDesigner;rm.ac5_ContractSigningTime=rm.ac5_ContractSigningTime;rm.ac5_CustomerIndustry=rm.ac5_CustomerIndustry;rm.ac5_Laboratory=rm.ac5_Laboratory;rm.ac5_MainEnginePlants=rm.ac5_MainEnginePlants;rm.ac5_NumberOfUnitsInstalled=rm.ac5_NumberOfUnitsInstalled +``` \ No newline at end of file diff --git a/cn.net.connor.designtopart/build.properties b/cn.net.connor.designtopart/build.properties new file mode 100644 index 0000000..e86059d --- /dev/null +++ b/cn.net.connor.designtopart/build.properties @@ -0,0 +1,11 @@ +output.. = bin/ +bin.includes = plugin.xml,\ + META-INF/,\ + icons/,\ + .,\ + lib/ojdbc7.jar,\ + lib/core-renderer.jar,\ + lib/iTextAsian.jar,\ + lib/iTextAsianCmaps.jar,\ + lib/itextpdf-5.0.6.jar +source.. = src/ diff --git a/cn.net.connor.designtopart/icons/ojdbc7.jar b/cn.net.connor.designtopart/icons/ojdbc7.jar new file mode 100644 index 0000000..811da0f Binary files /dev/null and b/cn.net.connor.designtopart/icons/ojdbc7.jar differ diff --git a/cn.net.connor.designtopart/icons/sample.png b/cn.net.connor.designtopart/icons/sample.png new file mode 100644 index 0000000..02c4b79 Binary files /dev/null and b/cn.net.connor.designtopart/icons/sample.png differ diff --git a/cn.net.connor.designtopart/icons/sample@2x.png b/cn.net.connor.designtopart/icons/sample@2x.png new file mode 100644 index 0000000..c1224d1 Binary files /dev/null and b/cn.net.connor.designtopart/icons/sample@2x.png differ diff --git a/cn.net.connor.designtopart/lib/core-renderer.jar b/cn.net.connor.designtopart/lib/core-renderer.jar new file mode 100644 index 0000000..871fabf Binary files /dev/null and b/cn.net.connor.designtopart/lib/core-renderer.jar differ diff --git a/cn.net.connor.designtopart/lib/iTextAsian.jar b/cn.net.connor.designtopart/lib/iTextAsian.jar new file mode 100644 index 0000000..3fa2157 Binary files /dev/null and b/cn.net.connor.designtopart/lib/iTextAsian.jar differ diff --git a/cn.net.connor.designtopart/lib/iTextAsianCmaps.jar b/cn.net.connor.designtopart/lib/iTextAsianCmaps.jar new file mode 100644 index 0000000..aa2b429 Binary files /dev/null and b/cn.net.connor.designtopart/lib/iTextAsianCmaps.jar differ diff --git a/cn.net.connor.designtopart/lib/itextpdf-5.0.6.jar b/cn.net.connor.designtopart/lib/itextpdf-5.0.6.jar new file mode 100644 index 0000000..d716b4e Binary files /dev/null and b/cn.net.connor.designtopart/lib/itextpdf-5.0.6.jar differ diff --git a/cn.net.connor.designtopart/lib/ojdbc7.jar b/cn.net.connor.designtopart/lib/ojdbc7.jar new file mode 100644 index 0000000..811da0f Binary files /dev/null and b/cn.net.connor.designtopart/lib/ojdbc7.jar differ diff --git a/cn.net.connor.designtopart/plugin.xml b/cn.net.connor.designtopart/plugin.xml new file mode 100644 index 0000000..a8e8b57 --- /dev/null +++ b/cn.net.connor.designtopart/plugin.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cn.net.connor.designtopart/src/cn/net/connor/designtopart/Activator.java b/cn.net.connor.designtopart/src/cn/net/connor/designtopart/Activator.java new file mode 100644 index 0000000..cdcb7a7 --- /dev/null +++ b/cn.net.connor.designtopart/src/cn/net/connor/designtopart/Activator.java @@ -0,0 +1,44 @@ +package cn.net.connor.designtopart; + +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.designtopart"; //$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; + } + +} diff --git a/cn.net.connor.designtopart/src/cn/net/connor/designtopart/DesigntopartLocale.java b/cn.net.connor.designtopart/src/cn/net/connor/designtopart/DesigntopartLocale.java new file mode 100644 index 0000000..1642fe0 --- /dev/null +++ b/cn.net.connor.designtopart/src/cn/net/connor/designtopart/DesigntopartLocale.java @@ -0,0 +1,22 @@ +package cn.net.connor.designtopart; + +import com.teamcenter.rac.util.Registry; + + +public class DesigntopartLocale { + + public static final Registry reg = Registry.getRegistry(DesigntopartLocale.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()); + } +} diff --git a/cn.net.connor.designtopart/src/cn/net/connor/designtopart/commands/DesignToPartCommand.java b/cn.net.connor.designtopart/src/cn/net/connor/designtopart/commands/DesignToPartCommand.java new file mode 100644 index 0000000..73b4147 --- /dev/null +++ b/cn.net.connor.designtopart/src/cn/net/connor/designtopart/commands/DesignToPartCommand.java @@ -0,0 +1,16 @@ +package cn.net.connor.designtopart.commands; + +import com.teamcenter.rac.aif.AbstractAIFApplication; + +import cn.net.connor.designtopart.designtopart.DesignToPartDialog; +import cn.net.connor.designtopart.designtopart.DesignToPartDialogController; +import k.KCommand; + +public class DesignToPartCommand extends KCommand { + + public DesignToPartCommand(AbstractAIFApplication app, String commandId, String actionInfo) { + super(app, commandId, actionInfo); + this.setRunnable(new DesignToPartDialog(new DesignToPartDialogController(app))); + } + +} diff --git a/cn.net.connor.designtopart/src/cn/net/connor/designtopart/designtopart/DesignToPartDialog.java b/cn.net.connor.designtopart/src/cn/net/connor/designtopart/designtopart/DesignToPartDialog.java new file mode 100644 index 0000000..bcb263d --- /dev/null +++ b/cn.net.connor.designtopart/src/cn/net/connor/designtopart/designtopart/DesignToPartDialog.java @@ -0,0 +1,35 @@ +package cn.net.connor.designtopart.designtopart; + +import java.awt.BorderLayout; +import java.awt.Dimension; + +import cn.net.connor.designtopart.DesigntopartLocale; +import javafx.embed.swing.JFXPanel; +import k.KDialog; +import k.KDialogController; + +@SuppressWarnings("serial") +public class DesignToPartDialog extends KDialog { + + protected DesignToPartDialogController controller; + + public DesignToPartDialog(KDialogController controller) { + super(controller); + this.controller = (DesignToPartDialogController) controller; + } + + @Override + protected void addListeners() { + } + + @Override + protected void initUI() { + this.setTitle(DesigntopartLocale.getString("designtopart")); + this.setPreferredSize(new Dimension(800, 600)); + this.setMinimumSize(new Dimension(800, 600)); + JFXPanel panel = new JFXPanel(); + panel.setScene(new DesignToPartPanel(this).getScene()); + this.add(BorderLayout.CENTER, panel); + } + +} diff --git a/cn.net.connor.designtopart/src/cn/net/connor/designtopart/designtopart/DesignToPartDialogController.java b/cn.net.connor.designtopart/src/cn/net/connor/designtopart/designtopart/DesignToPartDialogController.java new file mode 100644 index 0000000..defba3b --- /dev/null +++ b/cn.net.connor.designtopart/src/cn/net/connor/designtopart/designtopart/DesignToPartDialogController.java @@ -0,0 +1,72 @@ +package cn.net.connor.designtopart.designtopart; + +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.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCException; + +import cn.net.connor.designtopart.DesigntopartLocale; +import k.KDialogController; +import k.util.KUtil; + +public class DesignToPartDialogController extends KDialogController { + + public static final String PREF_TRANSFER = DesigntopartLocale.getString("DESIGNTOPART.PREF"); + protected List tableBuilders = new ArrayList(); + + public DesignToPartDialogController(AbstractAIFApplication app) { + super(app); + } + + @Override + public boolean init() throws Exception { + InterfaceAIFComponent[] targets = app.getTargetComponents(); + Map> selectedRevMap = new HashMap<>(64); + int targetCnt = KUtil.getLen(targets); + for (int i = 0; i < targetCnt; i++) { + InterfaceAIFComponent target = targets[i]; + if (!(target instanceof TCComponentItemRevision)) { + continue; + } + TCComponentItemRevision rev = (TCComponentItemRevision) target; + String type = rev.getType(); + List list; + if (selectedRevMap.containsKey(type)) { + list = selectedRevMap.get(type); + } else { + list = new ArrayList(); + selectedRevMap.put(type, list); + } + if (!list.contains(rev)) { + list.add(rev); + } + } + selectedRevMap.forEach((k, v) -> System.out.println("类型 = " + k + ", " + v)); + if (selectedRevMap.size() == 0) { + throw new TCException(DesigntopartLocale.getString("selectrev.INFO")); + } + // Connor_Design_To_Part + String[] prefVals = KUtil.getPrefVals(session, PREF_TRANSFER); + int len = KUtil.getLen(prefVals); + int counter = 0; + for (int i = 0; i < len; i++) { + String prefVal = prefVals[i]; + TableBuilder builder = new TableBuilder(session, prefVal, selectedRevMap); + tableBuilders.add(builder); + counter += (builder.fromRevList == null ? 0 : builder.fromRevList.size()); + } + if (tableBuilders.size() == 0) { + throw new TCException(String.format(DesigntopartLocale.getString("pref.ERROR1"), PREF_TRANSFER)); + } + if (counter == 0) { + throw new TCException(DesigntopartLocale.getString("notransferdata.INFO")); + } + return true; + } + +} diff --git a/cn.net.connor.designtopart/src/cn/net/connor/designtopart/designtopart/DesignToPartPanel.fxml b/cn.net.connor.designtopart/src/cn/net/connor/designtopart/designtopart/DesignToPartPanel.fxml new file mode 100644 index 0000000..f2185a1 --- /dev/null +++ b/cn.net.connor.designtopart/src/cn/net/connor/designtopart/designtopart/DesignToPartPanel.fxml @@ -0,0 +1,48 @@ + + + + + + + + + +
+ + + + + + + + + +
+ + + + + + + + + + +