diff --git a/bin/com/connor/kwc/bombatchchange/BomDialog$1.class b/bin/com/connor/kwc/bombatchchange/BomDialog$1.class index 61d0c6f..f78edee 100644 Binary files a/bin/com/connor/kwc/bombatchchange/BomDialog$1.class and b/bin/com/connor/kwc/bombatchchange/BomDialog$1.class differ diff --git a/bin/com/connor/kwc/bombatchchange/BomDialog$10.class b/bin/com/connor/kwc/bombatchchange/BomDialog$10.class index 0b2ddb7..99a5d6c 100644 Binary files a/bin/com/connor/kwc/bombatchchange/BomDialog$10.class and b/bin/com/connor/kwc/bombatchchange/BomDialog$10.class differ diff --git a/bin/com/connor/kwc/bombatchchange/BomDialog$11.class b/bin/com/connor/kwc/bombatchchange/BomDialog$11.class index a8d8e12..d2ebf40 100644 Binary files a/bin/com/connor/kwc/bombatchchange/BomDialog$11.class and b/bin/com/connor/kwc/bombatchchange/BomDialog$11.class differ diff --git a/bin/com/connor/kwc/bombatchchange/BomDialog$12.class b/bin/com/connor/kwc/bombatchchange/BomDialog$12.class index 5af1abf..358476f 100644 Binary files a/bin/com/connor/kwc/bombatchchange/BomDialog$12.class and b/bin/com/connor/kwc/bombatchchange/BomDialog$12.class differ diff --git a/bin/com/connor/kwc/bombatchchange/BomDialog$13.class b/bin/com/connor/kwc/bombatchchange/BomDialog$13.class index d51baae..0b0371f 100644 Binary files a/bin/com/connor/kwc/bombatchchange/BomDialog$13.class and b/bin/com/connor/kwc/bombatchchange/BomDialog$13.class differ diff --git a/bin/com/connor/kwc/bombatchchange/BomDialog$14.class b/bin/com/connor/kwc/bombatchchange/BomDialog$14.class index 92ee4cf..d2ee069 100644 Binary files a/bin/com/connor/kwc/bombatchchange/BomDialog$14.class and b/bin/com/connor/kwc/bombatchchange/BomDialog$14.class differ diff --git a/bin/com/connor/kwc/bombatchchange/BomDialog$15.class b/bin/com/connor/kwc/bombatchchange/BomDialog$15.class index c312784..3939f5c 100644 Binary files a/bin/com/connor/kwc/bombatchchange/BomDialog$15.class and b/bin/com/connor/kwc/bombatchchange/BomDialog$15.class differ diff --git a/bin/com/connor/kwc/bombatchchange/BomDialog$16.class b/bin/com/connor/kwc/bombatchchange/BomDialog$16.class index 6b57820..1e155a3 100644 Binary files a/bin/com/connor/kwc/bombatchchange/BomDialog$16.class and b/bin/com/connor/kwc/bombatchchange/BomDialog$16.class differ diff --git a/bin/com/connor/kwc/bombatchchange/BomDialog$17.class b/bin/com/connor/kwc/bombatchchange/BomDialog$17.class index 78ad22e..73cffcd 100644 Binary files a/bin/com/connor/kwc/bombatchchange/BomDialog$17.class and b/bin/com/connor/kwc/bombatchchange/BomDialog$17.class differ diff --git a/bin/com/connor/kwc/bombatchchange/BomDialog$18.class b/bin/com/connor/kwc/bombatchchange/BomDialog$18.class index 9f98e00..de37f22 100644 Binary files a/bin/com/connor/kwc/bombatchchange/BomDialog$18.class and b/bin/com/connor/kwc/bombatchchange/BomDialog$18.class differ diff --git a/bin/com/connor/kwc/bombatchchange/BomDialog$19.class b/bin/com/connor/kwc/bombatchchange/BomDialog$19.class index 6153f10..646350f 100644 Binary files a/bin/com/connor/kwc/bombatchchange/BomDialog$19.class and b/bin/com/connor/kwc/bombatchchange/BomDialog$19.class differ diff --git a/bin/com/connor/kwc/bombatchchange/BomDialog$2.class b/bin/com/connor/kwc/bombatchchange/BomDialog$2.class index ede6db9..36b913b 100644 Binary files a/bin/com/connor/kwc/bombatchchange/BomDialog$2.class and b/bin/com/connor/kwc/bombatchchange/BomDialog$2.class differ diff --git a/bin/com/connor/kwc/bombatchchange/BomDialog$20.class b/bin/com/connor/kwc/bombatchchange/BomDialog$20.class index 38fd4a3..cbc2463 100644 Binary files a/bin/com/connor/kwc/bombatchchange/BomDialog$20.class and b/bin/com/connor/kwc/bombatchchange/BomDialog$20.class differ diff --git a/bin/com/connor/kwc/bombatchchange/BomDialog$3.class b/bin/com/connor/kwc/bombatchchange/BomDialog$3.class index 1c30027..e500ad3 100644 Binary files a/bin/com/connor/kwc/bombatchchange/BomDialog$3.class and b/bin/com/connor/kwc/bombatchchange/BomDialog$3.class differ diff --git a/bin/com/connor/kwc/bombatchchange/BomDialog$4.class b/bin/com/connor/kwc/bombatchchange/BomDialog$4.class index 9e72147..980e4f1 100644 Binary files a/bin/com/connor/kwc/bombatchchange/BomDialog$4.class and b/bin/com/connor/kwc/bombatchchange/BomDialog$4.class differ diff --git a/bin/com/connor/kwc/bombatchchange/BomDialog$5.class b/bin/com/connor/kwc/bombatchchange/BomDialog$5.class index af36dfb..5016dac 100644 Binary files a/bin/com/connor/kwc/bombatchchange/BomDialog$5.class and b/bin/com/connor/kwc/bombatchchange/BomDialog$5.class differ diff --git a/bin/com/connor/kwc/bombatchchange/BomDialog$6.class b/bin/com/connor/kwc/bombatchchange/BomDialog$6.class index cc7822f..d235512 100644 Binary files a/bin/com/connor/kwc/bombatchchange/BomDialog$6.class and b/bin/com/connor/kwc/bombatchchange/BomDialog$6.class differ diff --git a/bin/com/connor/kwc/bombatchchange/BomDialog$7.class b/bin/com/connor/kwc/bombatchchange/BomDialog$7.class index c693012..bc91b9a 100644 Binary files a/bin/com/connor/kwc/bombatchchange/BomDialog$7.class and b/bin/com/connor/kwc/bombatchchange/BomDialog$7.class differ diff --git a/bin/com/connor/kwc/bombatchchange/BomDialog$8.class b/bin/com/connor/kwc/bombatchchange/BomDialog$8.class index 94b20ad..e1b101e 100644 Binary files a/bin/com/connor/kwc/bombatchchange/BomDialog$8.class and b/bin/com/connor/kwc/bombatchchange/BomDialog$8.class differ diff --git a/bin/com/connor/kwc/bombatchchange/BomDialog$9.class b/bin/com/connor/kwc/bombatchchange/BomDialog$9.class index 26566f9..c6031ac 100644 Binary files a/bin/com/connor/kwc/bombatchchange/BomDialog$9.class and b/bin/com/connor/kwc/bombatchchange/BomDialog$9.class differ diff --git a/bin/com/connor/kwc/bombatchchange/BomDialog.class b/bin/com/connor/kwc/bombatchchange/BomDialog.class index 3228509..6d40da7 100644 Binary files a/bin/com/connor/kwc/bombatchchange/BomDialog.class and b/bin/com/connor/kwc/bombatchchange/BomDialog.class differ diff --git a/bin/com/connor/kwc/bombatchchange/DatePickerUtil$1.class b/bin/com/connor/kwc/bombatchchange/DatePickerUtil$1.class index bc98298..1edea28 100644 Binary files a/bin/com/connor/kwc/bombatchchange/DatePickerUtil$1.class and b/bin/com/connor/kwc/bombatchchange/DatePickerUtil$1.class differ diff --git a/bin/com/connor/kwc/bombatchchange/DatePickerUtil.class b/bin/com/connor/kwc/bombatchchange/DatePickerUtil.class index 34c7ad5..a83d0a0 100644 Binary files a/bin/com/connor/kwc/bombatchchange/DatePickerUtil.class and b/bin/com/connor/kwc/bombatchchange/DatePickerUtil.class differ diff --git a/bin/com/connor/kwc/bombatchchange/bomBatchChangeHandler.class b/bin/com/connor/kwc/bombatchchange/bomBatchChangeHandler.class index 1cd6790..c80da7e 100644 Binary files a/bin/com/connor/kwc/bombatchchange/bomBatchChangeHandler.class and b/bin/com/connor/kwc/bombatchchange/bomBatchChangeHandler.class differ diff --git a/bin/com/connor/kwc/createBom/CheckBoxTreeNodeSelectionListener.class b/bin/com/connor/kwc/createBom/CheckBoxTreeNodeSelectionListener.class deleted file mode 100644 index 4016675..0000000 Binary files a/bin/com/connor/kwc/createBom/CheckBoxTreeNodeSelectionListener.class and /dev/null differ diff --git a/bin/com/connor/kwc/createBom/CreateBOMHandler$1.class b/bin/com/connor/kwc/createBom/CreateBOMHandler$1.class index 7cf7b3a..9d2399d 100644 Binary files a/bin/com/connor/kwc/createBom/CreateBOMHandler$1.class and b/bin/com/connor/kwc/createBom/CreateBOMHandler$1.class differ diff --git a/bin/com/connor/kwc/createBom/CreateBOMHandler.class b/bin/com/connor/kwc/createBom/CreateBOMHandler.class index 380e314..bc14344 100644 Binary files a/bin/com/connor/kwc/createBom/CreateBOMHandler.class and b/bin/com/connor/kwc/createBom/CreateBOMHandler.class differ diff --git a/bin/com/connor/kwc/createBom/CreateBOMOperation$1.class b/bin/com/connor/kwc/createBom/CreateBOMOperation$1.class index 82ffc0d..c84d1e6 100644 Binary files a/bin/com/connor/kwc/createBom/CreateBOMOperation$1.class and b/bin/com/connor/kwc/createBom/CreateBOMOperation$1.class differ diff --git a/bin/com/connor/kwc/createBom/CreateFolderFram$1.class b/bin/com/connor/kwc/createBom/CreateFolderFram$1.class new file mode 100644 index 0000000..f2bd053 Binary files /dev/null and b/bin/com/connor/kwc/createBom/CreateFolderFram$1.class differ diff --git a/bin/com/connor/kwc/createBom/NewJFrame2$2.class b/bin/com/connor/kwc/createBom/CreateFolderFram$2.class similarity index 61% rename from bin/com/connor/kwc/createBom/NewJFrame2$2.class rename to bin/com/connor/kwc/createBom/CreateFolderFram$2.class index 171bc53..80099ac 100644 Binary files a/bin/com/connor/kwc/createBom/NewJFrame2$2.class and b/bin/com/connor/kwc/createBom/CreateFolderFram$2.class differ diff --git a/bin/com/connor/kwc/createBom/CreateFolderFram$3.class b/bin/com/connor/kwc/createBom/CreateFolderFram$3.class new file mode 100644 index 0000000..73ea759 Binary files /dev/null and b/bin/com/connor/kwc/createBom/CreateFolderFram$3.class differ diff --git a/bin/com/connor/kwc/createBom/CreateFolderFram$4.class b/bin/com/connor/kwc/createBom/CreateFolderFram$4.class new file mode 100644 index 0000000..740d1f6 Binary files /dev/null and b/bin/com/connor/kwc/createBom/CreateFolderFram$4.class differ diff --git a/bin/com/connor/kwc/createBom/CreateFolderFram.class b/bin/com/connor/kwc/createBom/CreateFolderFram.class new file mode 100644 index 0000000..8b251e5 Binary files /dev/null and b/bin/com/connor/kwc/createBom/CreateFolderFram.class differ diff --git a/bin/com/connor/kwc/createBom/NewJFrame1$1.class b/bin/com/connor/kwc/createBom/CreateItemFram$1.class similarity index 61% rename from bin/com/connor/kwc/createBom/NewJFrame1$1.class rename to bin/com/connor/kwc/createBom/CreateItemFram$1.class index 3155de9..22a77ae 100644 Binary files a/bin/com/connor/kwc/createBom/NewJFrame1$1.class and b/bin/com/connor/kwc/createBom/CreateItemFram$1.class differ diff --git a/bin/com/connor/kwc/createBom/CreateItemFram$2.class b/bin/com/connor/kwc/createBom/CreateItemFram$2.class new file mode 100644 index 0000000..65450de Binary files /dev/null and b/bin/com/connor/kwc/createBom/CreateItemFram$2.class differ diff --git a/bin/com/connor/kwc/createBom/CreateItemFram$3.class b/bin/com/connor/kwc/createBom/CreateItemFram$3.class new file mode 100644 index 0000000..57e0704 Binary files /dev/null and b/bin/com/connor/kwc/createBom/CreateItemFram$3.class differ diff --git a/bin/com/connor/kwc/createBom/CreateItemFram.class b/bin/com/connor/kwc/createBom/CreateItemFram.class new file mode 100644 index 0000000..0b4349d Binary files /dev/null and b/bin/com/connor/kwc/createBom/CreateItemFram.class differ diff --git a/bin/com/connor/kwc/createBom/NewJFrame1$2.class b/bin/com/connor/kwc/createBom/NewJFrame1$2.class deleted file mode 100644 index d33537d..0000000 Binary files a/bin/com/connor/kwc/createBom/NewJFrame1$2.class and /dev/null differ diff --git a/bin/com/connor/kwc/createBom/NewJFrame1$3.class b/bin/com/connor/kwc/createBom/NewJFrame1$3.class deleted file mode 100644 index a3f9727..0000000 Binary files a/bin/com/connor/kwc/createBom/NewJFrame1$3.class and /dev/null differ diff --git a/bin/com/connor/kwc/createBom/NewJFrame1.class b/bin/com/connor/kwc/createBom/NewJFrame1.class deleted file mode 100644 index b44ceb7..0000000 Binary files a/bin/com/connor/kwc/createBom/NewJFrame1.class and /dev/null differ diff --git a/bin/com/connor/kwc/createBom/NewJFrame2$1.class b/bin/com/connor/kwc/createBom/NewJFrame2$1.class deleted file mode 100644 index a1f97d9..0000000 Binary files a/bin/com/connor/kwc/createBom/NewJFrame2$1.class and /dev/null differ diff --git a/bin/com/connor/kwc/createBom/NewJFrame2$3.class b/bin/com/connor/kwc/createBom/NewJFrame2$3.class deleted file mode 100644 index 33b2880..0000000 Binary files a/bin/com/connor/kwc/createBom/NewJFrame2$3.class and /dev/null differ diff --git a/bin/com/connor/kwc/createBom/NewJFrame2$4.class b/bin/com/connor/kwc/createBom/NewJFrame2$4.class deleted file mode 100644 index 391d9eb..0000000 Binary files a/bin/com/connor/kwc/createBom/NewJFrame2$4.class and /dev/null differ diff --git a/bin/com/connor/kwc/createBom/NewJFrame2.class b/bin/com/connor/kwc/createBom/NewJFrame2.class deleted file mode 100644 index 085b1d2..0000000 Binary files a/bin/com/connor/kwc/createBom/NewJFrame2.class and /dev/null differ diff --git a/bin/com/connor/kwc/createBom/test$1$1.class b/bin/com/connor/kwc/createBom/test$1$1.class deleted file mode 100644 index 9ca6f4d..0000000 Binary files a/bin/com/connor/kwc/createBom/test$1$1.class and /dev/null differ diff --git a/bin/com/connor/kwc/createBom/test$1.class b/bin/com/connor/kwc/createBom/test$1.class deleted file mode 100644 index 8160563..0000000 Binary files a/bin/com/connor/kwc/createBom/test$1.class and /dev/null differ diff --git a/bin/com/connor/kwc/createBom/test.class b/bin/com/connor/kwc/createBom/test.class index 81d5bbe..1884c0a 100644 Binary files a/bin/com/connor/kwc/createBom/test.class and b/bin/com/connor/kwc/createBom/test.class differ diff --git a/bin/com/connor/kwc/createDWG/CreateDWGHandler.class b/bin/com/connor/kwc/createDWG/CreateDWGHandler.class index 29f640a..494d15f 100644 Binary files a/bin/com/connor/kwc/createDWG/CreateDWGHandler.class and b/bin/com/connor/kwc/createDWG/CreateDWGHandler.class differ diff --git a/bin/com/connor/kwc/createTemplate/CompontByNode.class b/bin/com/connor/kwc/createTemplate/CompontByNode.class index b9d5796..b8dc343 100644 Binary files a/bin/com/connor/kwc/createTemplate/CompontByNode.class and b/bin/com/connor/kwc/createTemplate/CompontByNode.class differ diff --git a/bin/com/connor/kwc/createTemplate/CreateTemplateDialg$1.class b/bin/com/connor/kwc/createTemplate/CreateTemplateDialg$1.class index b75dffb..f47aeb5 100644 Binary files a/bin/com/connor/kwc/createTemplate/CreateTemplateDialg$1.class and b/bin/com/connor/kwc/createTemplate/CreateTemplateDialg$1.class differ diff --git a/bin/com/connor/kwc/createTemplate/CreateTemplateDialg.class b/bin/com/connor/kwc/createTemplate/CreateTemplateDialg.class index 6a801bc..1c5ac8a 100644 Binary files a/bin/com/connor/kwc/createTemplate/CreateTemplateDialg.class and b/bin/com/connor/kwc/createTemplate/CreateTemplateDialg.class differ diff --git a/bin/com/connor/kwc/createBom/CheckBoxTreeCellRenderer.class b/bin/com/connor/kwc/jtreeUtilClass/CheckBoxTreeCellRenderer.class similarity index 82% rename from bin/com/connor/kwc/createBom/CheckBoxTreeCellRenderer.class rename to bin/com/connor/kwc/jtreeUtilClass/CheckBoxTreeCellRenderer.class index b36173c..a60398e 100644 Binary files a/bin/com/connor/kwc/createBom/CheckBoxTreeCellRenderer.class and b/bin/com/connor/kwc/jtreeUtilClass/CheckBoxTreeCellRenderer.class differ diff --git a/bin/com/connor/kwc/createBom/CheckBoxTreeLabel.class b/bin/com/connor/kwc/jtreeUtilClass/CheckBoxTreeLabel.class similarity index 84% rename from bin/com/connor/kwc/createBom/CheckBoxTreeLabel.class rename to bin/com/connor/kwc/jtreeUtilClass/CheckBoxTreeLabel.class index 3e3f895..a0f7059 100644 Binary files a/bin/com/connor/kwc/createBom/CheckBoxTreeLabel.class and b/bin/com/connor/kwc/jtreeUtilClass/CheckBoxTreeLabel.class differ diff --git a/bin/com/connor/kwc/createBom/CheckBoxTreeNode.class b/bin/com/connor/kwc/jtreeUtilClass/CheckBoxTreeNode.class similarity index 62% rename from bin/com/connor/kwc/createBom/CheckBoxTreeNode.class rename to bin/com/connor/kwc/jtreeUtilClass/CheckBoxTreeNode.class index 57dfd19..5ef067f 100644 Binary files a/bin/com/connor/kwc/createBom/CheckBoxTreeNode.class and b/bin/com/connor/kwc/jtreeUtilClass/CheckBoxTreeNode.class differ diff --git a/bin/com/connor/kwc/jtreeUtilClass/CheckBoxTreeNodeSelectionListener.class b/bin/com/connor/kwc/jtreeUtilClass/CheckBoxTreeNodeSelectionListener.class new file mode 100644 index 0000000..4aed687 Binary files /dev/null and b/bin/com/connor/kwc/jtreeUtilClass/CheckBoxTreeNodeSelectionListener.class differ diff --git a/bin/com/connor/kwc/message/Message.properties b/bin/com/connor/kwc/message/Message.properties index 19fb2db..e99aff7 100644 --- a/bin/com/connor/kwc/message/Message.properties +++ b/bin/com/connor/kwc/message/Message.properties @@ -1,2 +1,11 @@ xz=select -zjdx=Component object \ No newline at end of file +zjdx=Component object +yjmbcj=Create based on template +cpdh=Product code: +qd=determine +cpdhbnwk=Product code cannot be empty! +ts=prompt +mb=template +cjcg=Created successfully +cjsb=Creation failed +yczytc=Already exists in TC \ No newline at end of file diff --git a/bin/com/connor/kwc/message/Message_zh_CN.properties b/bin/com/connor/kwc/message/Message_zh_CN.properties index 6a02e2f..9d41a17 100644 --- a/bin/com/connor/kwc/message/Message_zh_CN.properties +++ b/bin/com/connor/kwc/message/Message_zh_CN.properties @@ -1,2 +1,11 @@ xz=\u9009\u62e9 -zjdx=\u7ec4\u4ef6\u5bf9\u8c61 \ No newline at end of file +zjdx=\u7ec4\u4ef6\u5bf9\u8c61 +yjmbcj=\u4F9D\u636E\u6A21\u677F\u521B\u5EFA +cpdh=\u4EA7\u54C1\u4EE3\u53F7\uFF1A +qd=\u786E\u5B9A +cpdhbnwk=\u4EA7\u54C1\u4EE3\u53F7\u4E0D\u80FD\u4E3A\u7A7A\uFF01 +ts=\u63D0\u793A +mb=\u6A21\u677F +cjcg=\u521B\u5EFA\u6210\u529F +cjsb=\u521B\u5EFA\u5931\u8D25 +yczytc=\u5DF2\u5B58\u5728\u4E8ETC \ No newline at end of file diff --git a/bin/com/connor/kwc/util/Util.class b/bin/com/connor/kwc/util/Util.class index 107577a..ddcf158 100644 Binary files a/bin/com/connor/kwc/util/Util.class and b/bin/com/connor/kwc/util/Util.class differ diff --git a/bin/com/connor/kwc/util/UtilBean.class b/bin/com/connor/kwc/util/UtilBean.class new file mode 100644 index 0000000..f764446 Binary files /dev/null and b/bin/com/connor/kwc/util/UtilBean.class differ diff --git a/hs_err_pid29588.log b/hs_err_pid29588.log new file mode 100644 index 0000000..506ca03 --- /dev/null +++ b/hs_err_pid29588.log @@ -0,0 +1,221 @@ +# +# There is insufficient memory for the Java Runtime Environment to continue. +# Native memory allocation (mmap) failed to map 257949696 bytes for G1 virtual space +# Possible reasons: +# The system is out of physical RAM or swap space +# The process is running with CompressedOops enabled, and the Java Heap may be blocking the growth of the native heap +# Possible solutions: +# Reduce memory load on the system +# Increase physical memory or swap space +# Check if swap backing store is full +# Decrease Java heap size (-Xmx/-Xms) +# Decrease number of Java threads +# Decrease Java thread stack sizes (-Xss) +# Set larger code cache with -XX:ReservedCodeCacheSize= +# JVM is running with Zero Based Compressed Oops mode in which the Java heap is +# placed in the first 32GB address space. The Java Heap base address is the +# maximum limit for the native heap growth. Please use -XX:HeapBaseMinAddress +# to set the Java Heap base and to place the Java Heap above 32GB virtual address. +# This output file may be truncated or incomplete. +# +# Out of Memory Error (os_windows.cpp:3541), pid=29588, tid=22644 +# +# JRE version: (17.0.4.1+1) (build ) +# Java VM: OpenJDK 64-Bit Server VM (17.0.4.1+1, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, windows-amd64) +# No core dump will be written. Minidumps are not enabled by default on client versions of Windows +# + +--------------- S U M M A R Y ------------ + +Command Line: -Dfile.encoding=GBK -XX:+ShowCodeDetailsInExceptionMessages com.connor.kwc.createBom.test + +Host: AMD Ryzen 5 4600H with Radeon Graphics , 12 cores, 15G, Windows 11 , 64 bit Build 23506 (10.0.23506.1000) +Time: Fri Jan 12 10:19:57 2024 Windows 11 , 64 bit Build 23506 (10.0.23506.1000) elapsed time: 0.011971 seconds (0d 0h 0m 0s) + +--------------- T H R E A D --------------- + +Current thread (0x0000022fdc886410): JavaThread "Unknown thread" [_thread_in_vm, id=22644, stack(0x000000ea04d00000,0x000000ea04e00000)] + +Stack: [0x000000ea04d00000,0x000000ea04e00000] +Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) +V [jvm.dll+0x67731a] +V [jvm.dll+0x832284] +V [jvm.dll+0x833a2e] +V [jvm.dll+0x834093] +V [jvm.dll+0x245775] +V [jvm.dll+0x674209] +V [jvm.dll+0x668a92] +V [jvm.dll+0x30471b] +V [jvm.dll+0x30bc66] +V [jvm.dll+0x35ba9e] +V [jvm.dll+0x35bccf] +V [jvm.dll+0x2db5b8] +V [jvm.dll+0x2dc524] +V [jvm.dll+0x803db1] +V [jvm.dll+0x3698f1] +V [jvm.dll+0x7e31bc] +V [jvm.dll+0x3ec25f] +V [jvm.dll+0x3edde1] +C [jli.dll+0x5277] +C [ucrtbase.dll+0x29363] +C [KERNEL32.DLL+0x126ad] +C [ntdll.dll+0x5aa08] + + +--------------- P R O C E S S --------------- + +Threads class SMR info: +_java_thread_list=0x00007ff98b674e98, length=0, elements={ +} + +Java Threads: ( => current thread ) + +Other Threads: + 0x0000022fdc8f1580 GCTaskThread "GC Thread#0" [stack: 0x000000ea04e00000,0x000000ea04f00000] [id=31264] + 0x0000022fdc9032d0 ConcurrentGCThread "G1 Main Marker" [stack: 0x000000ea04f00000,0x000000ea05000000] [id=43564] + 0x0000022fdc903be0 ConcurrentGCThread "G1 Conc#0" [stack: 0x000000ea05000000,0x000000ea05100000] [id=43708] + +[error occurred during error reporting (printing all threads), id 0xc0000005, EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ff98ae4c047] + +VM state: not at safepoint (not fully initialized) + +VM Mutex/Monitor currently owned by a thread: ([mutex/lock_event]) +[0x0000022fdc881390] Heap_lock - owner thread: 0x0000022fdc886410 + +Heap address: 0x000000070a000000, size: 3936 MB, Compressed Oops mode: Zero based, Oop shift amount: 3 + +CDS archive(s) mapped at: [0x0000000000000000-0x0000000000000000-0x0000000000000000), size 0, SharedBaseAddress: 0x0000000800000000, ArchiveRelocationMode: 0. +Narrow klass base: 0x0000000000000000, Narrow klass shift: 0, Narrow klass range: 0x0 + +GC Precious Log: + + +Heap: + garbage-first heap total 0K, used 0K [0x000000070a000000, 0x0000000800000000) + region size 2048K, 0 young (0K), 0 survivors (0K) + +[error occurred during error reporting (printing heap information), id 0xc0000005, EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ff98b230699] + +GC Heap History (0 events): +No events + +Deoptimization events (0 events): +No events + +Classes unloaded (0 events): +No events + +Classes redefined (0 events): +No events + +Internal exceptions (0 events): +No events + +VM Operations (0 events): +No events + +Events (1 events): +Event: 0.007 Loaded shared library C:\eclipse\eclipse\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.4.v20220903-1038\jre\bin\java.dll + + +Dynamic libraries: +0x00007ff73f360000 - 0x00007ff73f36e000 C:\eclipse\eclipse\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.4.v20220903-1038\jre\bin\javaw.exe +0x00007ffa24db0000 - 0x00007ffa24fc5000 C:\WINDOWS\SYSTEM32\ntdll.dll +0x00007ffa23cb0000 - 0x00007ffa23d74000 C:\WINDOWS\System32\KERNEL32.DLL +0x00007ffa22160000 - 0x00007ffa22504000 C:\WINDOWS\System32\KERNELBASE.dll +0x00007ffa22670000 - 0x00007ffa22781000 C:\WINDOWS\System32\ucrtbase.dll +0x00007ffa1e0b0000 - 0x00007ffa1e0c8000 C:\eclipse\eclipse\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.4.v20220903-1038\jre\bin\jli.dll +0x00007ffa0f070000 - 0x00007ffa0f089000 C:\eclipse\eclipse\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.4.v20220903-1038\jre\bin\VCRUNTIME140.dll +0x00007ffa23620000 - 0x00007ffa237ce000 C:\WINDOWS\System32\USER32.dll +0x00007ffa10fe0000 - 0x00007ffa11273000 C:\WINDOWS\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.23506.1000_none_f04aa4d392225b35\COMCTL32.dll +0x00007ffa22920000 - 0x00007ffa22946000 C:\WINDOWS\System32\win32u.dll +0x00007ffa24770000 - 0x00007ffa24817000 C:\WINDOWS\System32\msvcrt.dll +0x00007ffa22c30000 - 0x00007ffa22c59000 C:\WINDOWS\System32\GDI32.dll +0x00007ffa22800000 - 0x00007ffa22919000 C:\WINDOWS\System32\gdi32full.dll +0x00007ffa225d0000 - 0x00007ffa2266a000 C:\WINDOWS\System32\msvcp_win.dll +0x00007ffa22bf0000 - 0x00007ffa22c21000 C:\WINDOWS\System32\IMM32.DLL +0x00007ffa1a890000 - 0x00007ffa1a89c000 C:\eclipse\eclipse\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.4.v20220903-1038\jre\bin\vcruntime140_1.dll +0x00007ff9f3360000 - 0x00007ff9f33f1000 C:\eclipse\eclipse\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.4.v20220903-1038\jre\bin\msvcp140.dll +0x00007ff98ab60000 - 0x00007ff98b7a6000 C:\eclipse\eclipse\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.4.v20220903-1038\jre\bin\server\jvm.dll +0x00007ffa23d80000 - 0x00007ffa23e2e000 C:\WINDOWS\System32\ADVAPI32.dll +0x00007ffa22b40000 - 0x00007ffa22be4000 C:\WINDOWS\System32\sechost.dll +0x00007ffa24b70000 - 0x00007ffa24c87000 C:\WINDOWS\System32\RPCRT4.dll +0x00007ffa235a0000 - 0x00007ffa235a8000 C:\WINDOWS\System32\PSAPI.DLL +0x00007ff9f7800000 - 0x00007ff9f7809000 C:\WINDOWS\SYSTEM32\WSOCK32.dll +0x00007ffa1e8a0000 - 0x00007ffa1e8d4000 C:\WINDOWS\SYSTEM32\WINMM.dll +0x00007ffa17870000 - 0x00007ffa1787a000 C:\WINDOWS\SYSTEM32\VERSION.dll +0x00007ffa24940000 - 0x00007ffa249b1000 C:\WINDOWS\System32\WS2_32.dll +0x00007ffa211a0000 - 0x00007ffa211b8000 C:\WINDOWS\SYSTEM32\kernel.appcore.dll +0x00007ff9ea2f0000 - 0x00007ff9ea2fa000 C:\eclipse\eclipse\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.4.v20220903-1038\jre\bin\jimage.dll +0x00007ffa1f810000 - 0x00007ffa1fa3e000 C:\WINDOWS\SYSTEM32\DBGHELP.DLL +0x00007ffa23010000 - 0x00007ffa2339a000 C:\WINDOWS\System32\combase.dll +0x00007ffa24c90000 - 0x00007ffa24d67000 C:\WINDOWS\System32\OLEAUT32.dll +0x00007ffa06fc0000 - 0x00007ffa06ff2000 C:\WINDOWS\SYSTEM32\dbgcore.DLL +0x00007ffa22ac0000 - 0x00007ffa22b3b000 C:\WINDOWS\System32\bcryptPrimitives.dll +0x00007ff9a4360000 - 0x00007ff9a4385000 C:\eclipse\eclipse\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.4.v20220903-1038\jre\bin\java.dll + +dbghelp: loaded successfully - version: 4.0.5 - missing functions: none +symbol engine: initialized successfully - sym options: 0x614 - pdb path: .;C:\eclipse\eclipse\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.4.v20220903-1038\jre\bin;C:\WINDOWS\SYSTEM32;C:\WINDOWS\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.23506.1000_none_f04aa4d392225b35;C:\eclipse\eclipse\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.4.v20220903-1038\jre\bin\server + +VM Arguments: +jvm_args: -Dfile.encoding=GBK -XX:+ShowCodeDetailsInExceptionMessages +java_command: com.connor.kwc.createBom.test +java_class_path (initial): D:\Project\锡压\java\com.connor.kwc.plm\lib\sapjco3.jar;D:\Project\锡压\java\com.connor.kwc.plm\lib\sqljdbc4.jar;D:\Project\锡压\java\com.connor.kwc.plm\lib\okhttp-2.7.4.jar;D:\Project\锡压\java\com.connor.kwc.plm\lib\okio-1.13.0.jar;C:\eclipse\eclipse\plugins\org.eclipse.fx.ide.css.jfx8_3.8.0.202204150904.jar;D:\WorkEnvironment\tc14JAVA\plugins\org.eclipse.ui_3.201.100.v20220826-1037.jar;D:\WorkEnvironment\tc14JAVA\plugins\org.eclipse.swt_3.121.0.v20220829-1402.jar;D:\WorkEnvironment\tc14JAVA\plugins\org.eclipse.swt.nl_14000.3.0.jar;D:\WorkEnvironment\tc14JAVA\plugins\org.eclipse.swt.win32.win32.x86_64_3.121.0.v20220829-1402.jar;D:\WorkEnvironment\tc14JAVA\plugins\org.eclipse.jface_3.27.0.v20220817-1444.jar;D:\WorkEnvironment\tc14JAVA\plugins\org.eclipse.core.commands_3.10.200.v20220512-0851.jar;D:\WorkEnvironment\tc14JAVA\plugins\org.eclipse.ui.workbench_3.126.0.v20220823-0718.jar;D:\WorkEnvironment\tc14JAVA\plugins\org.eclipse.e4.ui.workbench3_0.16.0.v20210619-0956.jar;D:\WorkEnvironment\tc14JAVA\plugins\org.eclipse.core.runtime_3.26.0.v20220813-0916.jar;D:\WorkEnvironment\tc14JAVA\plugins\org.eclipse.osgi_3.18.100.v20220817-1601.jar;D:\WorkEnvironment\tc14JAVA\plugins\org.eclipse.osgi.compatibility.state.nl_14000.3.0.jar;D:\WorkEnvironment\tc14JAVA\plugins\org.eclipse.osgi.compatibility.state_1.2.700.v20220722-0431.jar;D:\WorkEnvironment\tc14JAVA\plugins\org.eclipse.osgi.nl_14000.3.0.jar;D:\WorkEnvironment\tc14JAVA\plugins\org.eclipse.equinox.common_3.16.200.v20220817-1601.jar;D:\WorkEnvironment\tc14JAVA\plugins\org.eclipse.core.jobs_3.13.100.v20220817-1539.jar;D:\WorkEnvironment\tc14JAVA\plugins\org.eclipse.equinox.registry_3.11.200.v20220817-1601.jar;D:\WorkEnvironment\tc14JAVA\plugins\org.eclipse.equinox.preferences_3.10.100.v20220710-1223.jar;D:\WorkEnvironment\tc14JAVA\plugins\org.osgi.service.prefs_1.1.2.202109301733.jar;D:\WorkEnvironment\tc14JAVA\plugins\org.eclipse.core.contenttype_3.8.200.v20220817-1539.jar;D:\WorkEnvironme +Launcher Type: SUN_STANDARD + +[Global flags] + intx CICompilerCount = 4 {product} {ergonomic} + uint ConcGCThreads = 3 {product} {ergonomic} + uint G1ConcRefinementThreads = 10 {product} {ergonomic} + size_t G1HeapRegionSize = 2097152 {product} {ergonomic} + uintx GCDrainStackTargetSize = 64 {product} {ergonomic} + size_t InitialHeapSize = 257949696 {product} {ergonomic} + size_t MarkStackSize = 4194304 {product} {ergonomic} + size_t MaxHeapSize = 4127195136 {product} {ergonomic} + size_t MinHeapDeltaBytes = 2097152 {product} {ergonomic} + size_t MinHeapSize = 8388608 {product} {ergonomic} + uintx NonNMethodCodeHeapSize = 5839372 {pd product} {ergonomic} + uintx NonProfiledCodeHeapSize = 122909434 {pd product} {ergonomic} + uintx ProfiledCodeHeapSize = 122909434 {pd product} {ergonomic} + uintx ReservedCodeCacheSize = 251658240 {pd product} {ergonomic} + bool SegmentedCodeCache = true {product} {ergonomic} + bool ShowCodeDetailsInExceptionMessages = true {manageable} {command line} + size_t SoftMaxHeapSize = 4127195136 {manageable} {ergonomic} + bool UseCompressedClassPointers = true {product lp64_product} {ergonomic} + bool UseCompressedOops = true {product lp64_product} {ergonomic} + bool UseG1GC = true {product} {ergonomic} + bool UseLargePagesIndividualAllocation = false {pd product} {ergonomic} + +Logging: +Log output configuration: + #0: stdout all=warning uptime,level,tags + #1: stderr all=off uptime,level,tags + +Environment Variables: +JAVA_HOME=C:\Java\jdk1.8.0_121 +CLASSPATH=.;C:\Java\jdk1.8.0_121\lib\dt.jar;C:\Java\jdk1.8.0_121\lib\tools.jar; +PATH=C:/eclipse/eclipse//plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.4.v20220903-1038/jre/bin/server;C:/eclipse/eclipse//plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.4.v20220903-1038/jre/bin;C:\Java\jdk1.8.0_121\bin;C:\Java\jdk1.8.0_121\jre\bin;C:\ProgramData\Oracle\Java\javapath;D:\Program Files (x86)\VMware\VMware Workstation\bin\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Git\bin;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;D:\Maven\apache-maven-3.9.1\bin;C:\Users\admin\AppData\Local\Microsoft\WindowsApps;;D:\Program Files (x86)\Microsoft VS Code\bin;D:\Program Files\JetBrains\IntelliJ IDEA 2020.1\bin;;C:\eclipse\eclipse; +USERNAME=admin +OS=Windows_NT +PROCESSOR_IDENTIFIER=AMD64 Family 23 Model 96 Stepping 1, AuthenticAMD +TMP=C:\Users\admin\AppData\Local\Temp +TEMP=C:\Users\admin\AppData\Local\Temp + + + +--------------- S Y S T E M --------------- + +OS: + Windows 11 , 64 bit Build 23506 (10.0.23506.1000) +OS uptime: 3 days 0:30 hours + +CPU: total 12 (initial active 12) (12 cores per cpu, 2 threads per core) family 23 model 96 stepping 1 microcode 0x0, cx8, cmov, fxsr, ht, mmx, 3dnowpref, sse, sse2, sse3, ssse3, sse4a, sse4.1, sse4.2, popcnt, lzcnt, tsc, tscinvbit, avx, avx2, aes, clmul, bmi1, bmi2, adx, sha, fma, vzeroupper, clflush, clflushopt + +Memory: 4k page, system-wide physical 15741M (2676M free) +TotalPageFile size 31086M (AvailPageFile size 105M) +current process WorkingSet (physical memory assigned to process): 11M, peak: 11M +current process commit charge ("private bytes"): 64M, peak: 310M + +vm_info: OpenJDK 64-Bit Server VM (17.0.4.1+1) for windows-amd64 JRE (17.0.4.1+1), built on Aug 17 2022 07:42:43 by "temurin" with MS VC++ 16.7 (VS2019) + +END. diff --git a/hs_err_pid37884.log b/hs_err_pid37884.log new file mode 100644 index 0000000..6b32cac --- /dev/null +++ b/hs_err_pid37884.log @@ -0,0 +1,221 @@ +# +# There is insufficient memory for the Java Runtime Environment to continue. +# Native memory allocation (mmap) failed to map 257949696 bytes for G1 virtual space +# Possible reasons: +# The system is out of physical RAM or swap space +# The process is running with CompressedOops enabled, and the Java Heap may be blocking the growth of the native heap +# Possible solutions: +# Reduce memory load on the system +# Increase physical memory or swap space +# Check if swap backing store is full +# Decrease Java heap size (-Xmx/-Xms) +# Decrease number of Java threads +# Decrease Java thread stack sizes (-Xss) +# Set larger code cache with -XX:ReservedCodeCacheSize= +# JVM is running with Zero Based Compressed Oops mode in which the Java heap is +# placed in the first 32GB address space. The Java Heap base address is the +# maximum limit for the native heap growth. Please use -XX:HeapBaseMinAddress +# to set the Java Heap base and to place the Java Heap above 32GB virtual address. +# This output file may be truncated or incomplete. +# +# Out of Memory Error (os_windows.cpp:3541), pid=37884, tid=45512 +# +# JRE version: (17.0.4.1+1) (build ) +# Java VM: OpenJDK 64-Bit Server VM (17.0.4.1+1, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, windows-amd64) +# No core dump will be written. Minidumps are not enabled by default on client versions of Windows +# + +--------------- S U M M A R Y ------------ + +Command Line: -Dfile.encoding=GBK -XX:+ShowCodeDetailsInExceptionMessages com.connor.kwc.createBom.test + +Host: AMD Ryzen 5 4600H with Radeon Graphics , 12 cores, 15G, Windows 11 , 64 bit Build 23506 (10.0.23506.1000) +Time: Fri Jan 12 10:20:12 2024 Windows 11 , 64 bit Build 23506 (10.0.23506.1000) elapsed time: 0.010289 seconds (0d 0h 0m 0s) + +--------------- T H R E A D --------------- + +Current thread (0x0000022018735f70): JavaThread "Unknown thread" [_thread_in_vm, id=45512, stack(0x0000002feb300000,0x0000002feb400000)] + +Stack: [0x0000002feb300000,0x0000002feb400000] +Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) +V [jvm.dll+0x67731a] +V [jvm.dll+0x832284] +V [jvm.dll+0x833a2e] +V [jvm.dll+0x834093] +V [jvm.dll+0x245775] +V [jvm.dll+0x674209] +V [jvm.dll+0x668a92] +V [jvm.dll+0x30471b] +V [jvm.dll+0x30bc66] +V [jvm.dll+0x35ba9e] +V [jvm.dll+0x35bccf] +V [jvm.dll+0x2db5b8] +V [jvm.dll+0x2dc524] +V [jvm.dll+0x803db1] +V [jvm.dll+0x3698f1] +V [jvm.dll+0x7e31bc] +V [jvm.dll+0x3ec25f] +V [jvm.dll+0x3edde1] +C [jli.dll+0x5277] +C [ucrtbase.dll+0x29363] +C [KERNEL32.DLL+0x126ad] +C [ntdll.dll+0x5aa08] + + +--------------- P R O C E S S --------------- + +Threads class SMR info: +_java_thread_list=0x00007ff98b674e98, length=0, elements={ +} + +Java Threads: ( => current thread ) + +Other Threads: + 0x00000220187a1400 GCTaskThread "GC Thread#0" [stack: 0x0000002feb400000,0x0000002feb500000] [id=35212] + 0x00000220187b29b0 ConcurrentGCThread "G1 Main Marker" [stack: 0x0000002feb500000,0x0000002feb600000] [id=32164] + 0x00000220187b6920 ConcurrentGCThread "G1 Conc#0" [stack: 0x0000002feb600000,0x0000002feb700000] [id=38596] + +[error occurred during error reporting (printing all threads), id 0xc0000005, EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ff98ae4c047] + +VM state: not at safepoint (not fully initialized) + +VM Mutex/Monitor currently owned by a thread: ([mutex/lock_event]) +[0x0000022018731600] Heap_lock - owner thread: 0x0000022018735f70 + +Heap address: 0x000000070a000000, size: 3936 MB, Compressed Oops mode: Zero based, Oop shift amount: 3 + +CDS archive(s) mapped at: [0x0000000000000000-0x0000000000000000-0x0000000000000000), size 0, SharedBaseAddress: 0x0000000800000000, ArchiveRelocationMode: 0. +Narrow klass base: 0x0000000000000000, Narrow klass shift: 0, Narrow klass range: 0x0 + +GC Precious Log: + + +Heap: + garbage-first heap total 0K, used 0K [0x000000070a000000, 0x0000000800000000) + region size 2048K, 0 young (0K), 0 survivors (0K) + +[error occurred during error reporting (printing heap information), id 0xc0000005, EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ff98b230699] + +GC Heap History (0 events): +No events + +Deoptimization events (0 events): +No events + +Classes unloaded (0 events): +No events + +Classes redefined (0 events): +No events + +Internal exceptions (0 events): +No events + +VM Operations (0 events): +No events + +Events (1 events): +Event: 0.005 Loaded shared library C:\eclipse\eclipse\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.4.v20220903-1038\jre\bin\java.dll + + +Dynamic libraries: +0x00007ff73f360000 - 0x00007ff73f36e000 C:\eclipse\eclipse\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.4.v20220903-1038\jre\bin\javaw.exe +0x00007ffa24db0000 - 0x00007ffa24fc5000 C:\WINDOWS\SYSTEM32\ntdll.dll +0x00007ffa23cb0000 - 0x00007ffa23d74000 C:\WINDOWS\System32\KERNEL32.DLL +0x00007ffa22160000 - 0x00007ffa22504000 C:\WINDOWS\System32\KERNELBASE.dll +0x00007ffa22670000 - 0x00007ffa22781000 C:\WINDOWS\System32\ucrtbase.dll +0x00007ffa1e0b0000 - 0x00007ffa1e0c8000 C:\eclipse\eclipse\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.4.v20220903-1038\jre\bin\jli.dll +0x00007ffa0f070000 - 0x00007ffa0f089000 C:\eclipse\eclipse\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.4.v20220903-1038\jre\bin\VCRUNTIME140.dll +0x00007ffa23620000 - 0x00007ffa237ce000 C:\WINDOWS\System32\USER32.dll +0x00007ffa22920000 - 0x00007ffa22946000 C:\WINDOWS\System32\win32u.dll +0x00007ffa10fe0000 - 0x00007ffa11273000 C:\WINDOWS\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.23506.1000_none_f04aa4d392225b35\COMCTL32.dll +0x00007ffa22c30000 - 0x00007ffa22c59000 C:\WINDOWS\System32\GDI32.dll +0x00007ffa24770000 - 0x00007ffa24817000 C:\WINDOWS\System32\msvcrt.dll +0x00007ffa22800000 - 0x00007ffa22919000 C:\WINDOWS\System32\gdi32full.dll +0x00007ffa225d0000 - 0x00007ffa2266a000 C:\WINDOWS\System32\msvcp_win.dll +0x00007ffa22bf0000 - 0x00007ffa22c21000 C:\WINDOWS\System32\IMM32.DLL +0x00007ffa1a890000 - 0x00007ffa1a89c000 C:\eclipse\eclipse\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.4.v20220903-1038\jre\bin\vcruntime140_1.dll +0x00007ff9f3360000 - 0x00007ff9f33f1000 C:\eclipse\eclipse\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.4.v20220903-1038\jre\bin\msvcp140.dll +0x00007ff98ab60000 - 0x00007ff98b7a6000 C:\eclipse\eclipse\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.4.v20220903-1038\jre\bin\server\jvm.dll +0x00007ffa23d80000 - 0x00007ffa23e2e000 C:\WINDOWS\System32\ADVAPI32.dll +0x00007ffa22b40000 - 0x00007ffa22be4000 C:\WINDOWS\System32\sechost.dll +0x00007ffa24b70000 - 0x00007ffa24c87000 C:\WINDOWS\System32\RPCRT4.dll +0x00007ffa235a0000 - 0x00007ffa235a8000 C:\WINDOWS\System32\PSAPI.DLL +0x00007ff9f7800000 - 0x00007ff9f7809000 C:\WINDOWS\SYSTEM32\WSOCK32.dll +0x00007ffa1e8a0000 - 0x00007ffa1e8d4000 C:\WINDOWS\SYSTEM32\WINMM.dll +0x00007ffa17870000 - 0x00007ffa1787a000 C:\WINDOWS\SYSTEM32\VERSION.dll +0x00007ffa24940000 - 0x00007ffa249b1000 C:\WINDOWS\System32\WS2_32.dll +0x00007ffa211a0000 - 0x00007ffa211b8000 C:\WINDOWS\SYSTEM32\kernel.appcore.dll +0x00007ff9ea2f0000 - 0x00007ff9ea2fa000 C:\eclipse\eclipse\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.4.v20220903-1038\jre\bin\jimage.dll +0x00007ffa1f810000 - 0x00007ffa1fa3e000 C:\WINDOWS\SYSTEM32\DBGHELP.DLL +0x00007ffa23010000 - 0x00007ffa2339a000 C:\WINDOWS\System32\combase.dll +0x00007ffa24c90000 - 0x00007ffa24d67000 C:\WINDOWS\System32\OLEAUT32.dll +0x00007ffa06fc0000 - 0x00007ffa06ff2000 C:\WINDOWS\SYSTEM32\dbgcore.DLL +0x00007ffa22ac0000 - 0x00007ffa22b3b000 C:\WINDOWS\System32\bcryptPrimitives.dll +0x00007ff9a4360000 - 0x00007ff9a4385000 C:\eclipse\eclipse\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.4.v20220903-1038\jre\bin\java.dll + +dbghelp: loaded successfully - version: 4.0.5 - missing functions: none +symbol engine: initialized successfully - sym options: 0x614 - pdb path: .;C:\eclipse\eclipse\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.4.v20220903-1038\jre\bin;C:\WINDOWS\SYSTEM32;C:\WINDOWS\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.23506.1000_none_f04aa4d392225b35;C:\eclipse\eclipse\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.4.v20220903-1038\jre\bin\server + +VM Arguments: +jvm_args: -Dfile.encoding=GBK -XX:+ShowCodeDetailsInExceptionMessages +java_command: com.connor.kwc.createBom.test +java_class_path (initial): D:\Project\锡压\java\com.connor.kwc.plm\lib\sapjco3.jar;D:\Project\锡压\java\com.connor.kwc.plm\lib\sqljdbc4.jar;D:\Project\锡压\java\com.connor.kwc.plm\lib\okhttp-2.7.4.jar;D:\Project\锡压\java\com.connor.kwc.plm\lib\okio-1.13.0.jar;C:\eclipse\eclipse\plugins\org.eclipse.fx.ide.css.jfx8_3.8.0.202204150904.jar;D:\WorkEnvironment\tc14JAVA\plugins\org.eclipse.ui_3.201.100.v20220826-1037.jar;D:\WorkEnvironment\tc14JAVA\plugins\org.eclipse.swt_3.121.0.v20220829-1402.jar;D:\WorkEnvironment\tc14JAVA\plugins\org.eclipse.swt.nl_14000.3.0.jar;D:\WorkEnvironment\tc14JAVA\plugins\org.eclipse.swt.win32.win32.x86_64_3.121.0.v20220829-1402.jar;D:\WorkEnvironment\tc14JAVA\plugins\org.eclipse.jface_3.27.0.v20220817-1444.jar;D:\WorkEnvironment\tc14JAVA\plugins\org.eclipse.core.commands_3.10.200.v20220512-0851.jar;D:\WorkEnvironment\tc14JAVA\plugins\org.eclipse.ui.workbench_3.126.0.v20220823-0718.jar;D:\WorkEnvironment\tc14JAVA\plugins\org.eclipse.e4.ui.workbench3_0.16.0.v20210619-0956.jar;D:\WorkEnvironment\tc14JAVA\plugins\org.eclipse.core.runtime_3.26.0.v20220813-0916.jar;D:\WorkEnvironment\tc14JAVA\plugins\org.eclipse.osgi_3.18.100.v20220817-1601.jar;D:\WorkEnvironment\tc14JAVA\plugins\org.eclipse.osgi.compatibility.state.nl_14000.3.0.jar;D:\WorkEnvironment\tc14JAVA\plugins\org.eclipse.osgi.compatibility.state_1.2.700.v20220722-0431.jar;D:\WorkEnvironment\tc14JAVA\plugins\org.eclipse.osgi.nl_14000.3.0.jar;D:\WorkEnvironment\tc14JAVA\plugins\org.eclipse.equinox.common_3.16.200.v20220817-1601.jar;D:\WorkEnvironment\tc14JAVA\plugins\org.eclipse.core.jobs_3.13.100.v20220817-1539.jar;D:\WorkEnvironment\tc14JAVA\plugins\org.eclipse.equinox.registry_3.11.200.v20220817-1601.jar;D:\WorkEnvironment\tc14JAVA\plugins\org.eclipse.equinox.preferences_3.10.100.v20220710-1223.jar;D:\WorkEnvironment\tc14JAVA\plugins\org.osgi.service.prefs_1.1.2.202109301733.jar;D:\WorkEnvironment\tc14JAVA\plugins\org.eclipse.core.contenttype_3.8.200.v20220817-1539.jar;D:\WorkEnvironme +Launcher Type: SUN_STANDARD + +[Global flags] + intx CICompilerCount = 4 {product} {ergonomic} + uint ConcGCThreads = 3 {product} {ergonomic} + uint G1ConcRefinementThreads = 10 {product} {ergonomic} + size_t G1HeapRegionSize = 2097152 {product} {ergonomic} + uintx GCDrainStackTargetSize = 64 {product} {ergonomic} + size_t InitialHeapSize = 257949696 {product} {ergonomic} + size_t MarkStackSize = 4194304 {product} {ergonomic} + size_t MaxHeapSize = 4127195136 {product} {ergonomic} + size_t MinHeapDeltaBytes = 2097152 {product} {ergonomic} + size_t MinHeapSize = 8388608 {product} {ergonomic} + uintx NonNMethodCodeHeapSize = 5839372 {pd product} {ergonomic} + uintx NonProfiledCodeHeapSize = 122909434 {pd product} {ergonomic} + uintx ProfiledCodeHeapSize = 122909434 {pd product} {ergonomic} + uintx ReservedCodeCacheSize = 251658240 {pd product} {ergonomic} + bool SegmentedCodeCache = true {product} {ergonomic} + bool ShowCodeDetailsInExceptionMessages = true {manageable} {command line} + size_t SoftMaxHeapSize = 4127195136 {manageable} {ergonomic} + bool UseCompressedClassPointers = true {product lp64_product} {ergonomic} + bool UseCompressedOops = true {product lp64_product} {ergonomic} + bool UseG1GC = true {product} {ergonomic} + bool UseLargePagesIndividualAllocation = false {pd product} {ergonomic} + +Logging: +Log output configuration: + #0: stdout all=warning uptime,level,tags + #1: stderr all=off uptime,level,tags + +Environment Variables: +JAVA_HOME=C:\Java\jdk1.8.0_121 +CLASSPATH=.;C:\Java\jdk1.8.0_121\lib\dt.jar;C:\Java\jdk1.8.0_121\lib\tools.jar; +PATH=C:/eclipse/eclipse//plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.4.v20220903-1038/jre/bin/server;C:/eclipse/eclipse//plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.4.v20220903-1038/jre/bin;C:\Java\jdk1.8.0_121\bin;C:\Java\jdk1.8.0_121\jre\bin;C:\ProgramData\Oracle\Java\javapath;D:\Program Files (x86)\VMware\VMware Workstation\bin\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Git\bin;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;D:\Maven\apache-maven-3.9.1\bin;C:\Users\admin\AppData\Local\Microsoft\WindowsApps;;D:\Program Files (x86)\Microsoft VS Code\bin;D:\Program Files\JetBrains\IntelliJ IDEA 2020.1\bin;;C:\eclipse\eclipse; +USERNAME=admin +OS=Windows_NT +PROCESSOR_IDENTIFIER=AMD64 Family 23 Model 96 Stepping 1, AuthenticAMD +TMP=C:\Users\admin\AppData\Local\Temp +TEMP=C:\Users\admin\AppData\Local\Temp + + + +--------------- S Y S T E M --------------- + +OS: + Windows 11 , 64 bit Build 23506 (10.0.23506.1000) +OS uptime: 3 days 0:31 hours + +CPU: total 12 (initial active 12) (12 cores per cpu, 2 threads per core) family 23 model 96 stepping 1 microcode 0x0, cx8, cmov, fxsr, ht, mmx, 3dnowpref, sse, sse2, sse3, ssse3, sse4a, sse4.1, sse4.2, popcnt, lzcnt, tsc, tscinvbit, avx, avx2, aes, clmul, bmi1, bmi2, adx, sha, fma, vzeroupper, clflush, clflushopt + +Memory: 4k page, system-wide physical 15741M (2680M free) +TotalPageFile size 31086M (AvailPageFile size 116M) +current process WorkingSet (physical memory assigned to process): 11M, peak: 11M +current process commit charge ("private bytes"): 64M, peak: 310M + +vm_info: OpenJDK 64-Bit Server VM (17.0.4.1+1) for windows-amd64 JRE (17.0.4.1+1), built on Aug 17 2022 07:42:43 by "temurin" with MS VC++ 16.7 (VS2019) + +END. diff --git a/src/com/connor/kwc/bombatchchange/BomDialog.java b/src/com/connor/kwc/bombatchchange/BomDialog.java index 109e2fe..4222124 100644 --- a/src/com/connor/kwc/bombatchchange/BomDialog.java +++ b/src/com/connor/kwc/bombatchchange/BomDialog.java @@ -1,4 +1,4 @@ -package com.connor.kwc.bombatchchange; +package com.connor.kwc.bomBatchChange; import java.awt.BorderLayout; import java.awt.CardLayout; @@ -60,10 +60,10 @@ import com.teamcenter.rac.util.MessageBox; /** * - * @ClassName: BomDialog + * @ClassName: BomDialog * @Description: 移植LD(联德)功能,BOM批量变更 - * @author hcj - * @date 2024年1月5日 + * @author hcj + * @date 2024年1月5日 * */ public class BomDialog extends AbstractAIFDialog { @@ -76,21 +76,20 @@ public class BomDialog extends AbstractAIFDialog { private JPanel root; private BomDialog $this; private ResourceBundle rb; - private String[] colDisplayNames2 = new String[] { "选择", "组件对象", "组件ID", "组件规格型号", "子件对象", "子件对象ID", "子件规格型号", - "用量", "基础数量", "状态" }; + private String[] colDisplayNames2 = new String[] { "选择", "组件对象", "组件ID", "组件规格型号", "子件对象", "子件对象ID", "子件规格型号", "用量", + "基础数量", "状态" }; private String[] colDisplayNames3 = new String[] { "选择", "组件对象", "组件ID", "组件规格型号", "状态" }; private String[] colDisplayNames4 = new String[] { "序号 ", "修改用户", "更改时间", "更改内容" }; private String[] colDisplayNames = new String[] { "选择", "组件对象", "组件ID", "组件规格型号", "子件对象", "子件对象ID", "子件规格型号", "状态" }; private Map> modelMap = new HashMap>(); - public BomDialog(AbstractAIFApplication app2) { // TODO Auto-generated constructor stub super(); this.app = app2; this.session = (TCSession) app.getSession(); - + } @Override @@ -102,10 +101,10 @@ public class BomDialog extends AbstractAIFDialog { /** * - * @Title: initializationData + * @Title: initializationData * @Description: 初始化数据 - * @param 参数 - * @return void 返回类型 + * @param 参数 + * @return void 返回类型 * @throws */ private void initializationData() { diff --git a/src/com/connor/kwc/bombatchchange/DatePickerUtil.java b/src/com/connor/kwc/bombatchchange/DatePickerUtil.java index f16570e..0b3c912 100644 --- a/src/com/connor/kwc/bombatchchange/DatePickerUtil.java +++ b/src/com/connor/kwc/bombatchchange/DatePickerUtil.java @@ -1,4 +1,4 @@ -package com.connor.kwc.bombatchchange; +package com.connor.kwc.bomBatchChange; import java.awt.Dimension; import java.awt.Font; diff --git a/src/com/connor/kwc/bombatchchange/bomBatchChangeHandler.java b/src/com/connor/kwc/bombatchchange/bomBatchChangeHandler.java index 2e53d75..ae5b3fb 100644 --- a/src/com/connor/kwc/bombatchchange/bomBatchChangeHandler.java +++ b/src/com/connor/kwc/bombatchchange/bomBatchChangeHandler.java @@ -1,4 +1,4 @@ -package com.connor.kwc.bombatchchange; +package com.connor.kwc.bomBatchChange; import java.util.concurrent.ExecutionException; @@ -7,12 +7,13 @@ import org.eclipse.core.commands.ExecutionEvent; import com.teamcenter.rac.aif.AbstractAIFApplication; import com.teamcenter.rac.aifrcp.AIFUtility; import org.eclipse.core.commands.AbstractHandler; + /** * - * @ClassName: bomBatchChangeHandler + * @ClassName: bomBatchChangeHandler * @Description: 移植功能 BOM批量变更 - * @author hcj - * @date 2024年1月5日 + * @author hcj + * @date 2024年1月5日 * */ public class bomBatchChangeHandler extends AbstractHandler { diff --git a/src/com/connor/kwc/createBom/CreateBOMHandler.java b/src/com/connor/kwc/createBom/CreateBOMHandler.java index 077649d..86148a2 100644 --- a/src/com/connor/kwc/createBom/CreateBOMHandler.java +++ b/src/com/connor/kwc/createBom/CreateBOMHandler.java @@ -64,6 +64,7 @@ public class CreateBOMHandler extends AbstractHandler { if (!itemTypeList .contains(((TCComponentFolder) target).getStringProperty("object_type"))) { MessageBox.post("选取的存储位置不正确", "提示", MessageBox.INFORMATION); + return; } } catch (TCException e) { // TODO Auto-generated catch block @@ -86,6 +87,7 @@ public class CreateBOMHandler extends AbstractHandler { dataMap.put("templateMap", templateMap); } else { MessageBox.post("首选项【" + preferencesName + "】长度配置有误", "提示", MessageBox.INFORMATION); + return; } } else if (target instanceof TCComponentItemRevision) { @@ -107,6 +109,7 @@ public class CreateBOMHandler extends AbstractHandler { if (!itemTypeList.contains( ((TCComponentItemRevision) target).getStringProperty("object_type"))) { MessageBox.post("选取的存储位置不正确", "提示", MessageBox.INFORMATION); + return; } // 获取ID数组 String[] ids = preferencesValues[1].split("=")[1].split(";"); diff --git a/src/com/connor/kwc/createBom/CreateBOMOperation.java b/src/com/connor/kwc/createBom/CreateBOMOperation.java index a3bbb3a..9797e6a 100644 --- a/src/com/connor/kwc/createBom/CreateBOMOperation.java +++ b/src/com/connor/kwc/createBom/CreateBOMOperation.java @@ -75,11 +75,11 @@ public class CreateBOMOperation extends AbstractAIFOperation { EventQueue.invokeLater(new Runnable() { public void run() { if ("folder".equals(type)) { - NewJFrame2 newJFrame2 = new NewJFrame2(session, dataMap, (TCComponentFolder) target); - newJFrame2.setVisible(true); + CreateFolderFram createFolderFram = new CreateFolderFram(session, dataMap, (TCComponentFolder) target); + createFolderFram.setVisible(true); } else if ("revision".equals(type)) { - NewJFrame1 newJFrame2 = new NewJFrame1(session,dataMap, (TCComponentItemRevision) target); - newJFrame2.setVisible(true); + CreateItemFram createItemFram = new CreateItemFram(session, dataMap, (TCComponentItemRevision) target); + createItemFram.setVisible(true); } } diff --git a/src/com/connor/kwc/createBom/NewJFrame2.java b/src/com/connor/kwc/createBom/CreateFolderFram.java similarity index 81% rename from src/com/connor/kwc/createBom/NewJFrame2.java rename to src/com/connor/kwc/createBom/CreateFolderFram.java index 9ce921f..38c2701 100644 --- a/src/com/connor/kwc/createBom/NewJFrame2.java +++ b/src/com/connor/kwc/createBom/CreateFolderFram.java @@ -27,8 +27,13 @@ import javax.swing.JTextField; import javax.swing.JTree; import javax.swing.LayoutStyle; import javax.swing.WindowConstants; +import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.TreePath; +import com.connor.kwc.jtreeUtilClass.CheckBoxTreeCellRenderer; +import com.connor.kwc.jtreeUtilClass.CheckBoxTreeNode; +import com.connor.kwc.jtreeUtilClass.CheckBoxTreeNodeSelectionListener; import com.connor.kwc.util.Util; import com.teamcenter.rac.aif.kernel.AIFComponentContext; import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; @@ -56,11 +61,10 @@ import com.teamcenter.soaictstubs.tagSeq_tHolder; * @date 2023年12月19日 * */ -public class NewJFrame2 extends JFrame { +public class CreateFolderFram extends JFrame { private JButton jButton1; private JButton jButton2; - private JComboBox jComboBox1; private JComboBox jComboBox2; private JComboBox jComboBox3; private JLabel jLabel1; @@ -92,7 +96,7 @@ public class NewJFrame2 extends JFrame { * @param session * @param target */ - public NewJFrame2(TCSession session, Map dataMap, TCComponentFolder target) { + public CreateFolderFram(TCSession session, Map dataMap, TCComponentFolder target) { this.session = session; this.dataMap = dataMap; this.target = target; @@ -147,7 +151,7 @@ public class NewJFrame2 extends JFrame { jLabel3.setText("类型:"); ArrayList typeList = (ArrayList) dataMap.get("typeList"); - //String[] typeArray = (String[]) typeList.toArray(); + // String[] typeArray = (String[]) typeList.toArray(); String[] typeArray = typeList.stream().toArray(String[]::new); jComboBox2.setModel(new DefaultComboBoxModel<>(typeArray)); jComboBox2.setSelectedIndex(0); @@ -169,7 +173,7 @@ public class NewJFrame2 extends JFrame { } } String[] array = tempList.stream().toArray(String[]::new); - // String[] array = (String[]) tempList.toArray(); + // String[] array = (String[]) tempList.toArray(); jComboBox3.setModel(new DefaultComboBoxModel<>(array)); jComboBox3.setSelectedIndex(0); jLabel4.setText("模板:"); @@ -188,6 +192,11 @@ public class NewJFrame2 extends JFrame { jTree1.addMouseListener(new CheckBoxTreeNodeSelectionListener()); jTree1.setModel(model); jTree1.setCellRenderer(new CheckBoxTreeCellRenderer()); + // 展开所有节点并选中 + for (int i = 0; i < jTree1.getRowCount(); i++) { + jTree1.expandRow(i); + } + rootNode.setSelected(true); } } catch (TCException e1) { @@ -320,7 +329,7 @@ public class NewJFrame2 extends JFrame { int y = (screenHeight - this.getHeight()) / 2; // 计算Frame的左上角y坐标 this.setLocation(x, y); // 设置Frame的位置 this.setDefaultCloseOperation(2); - + // 类型下拉框监听,更新模板下拉框 jComboBox2.addItemListener(new ItemListener() { @@ -342,7 +351,7 @@ public class NewJFrame2 extends JFrame { } } String[] array = tempList.stream().toArray(String[]::new); - //String[] array = (String[]) tempList.toArray(); + // String[] array = (String[]) tempList.toArray(); jComboBox3.setModel(new DefaultComboBoxModel<>(array)); } }); @@ -368,6 +377,12 @@ public class NewJFrame2 extends JFrame { jTree1.addMouseListener(new CheckBoxTreeNodeSelectionListener()); jTree1.setModel(model); jTree1.setCellRenderer(new CheckBoxTreeCellRenderer()); + jTree1.setRowHeight(0); + // 展开所有节点并选中 + for (int i = 0; i < jTree1.getRowCount(); i++) { + jTree1.expandRow(i); + } + rootNode.setSelected(true); } } catch (Exception e2) { // TODO: handle exception @@ -377,10 +392,15 @@ public class NewJFrame2 extends JFrame { } }); + + // 确定按钮更新 jButton1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { + + //开旁路 + Util.setByPass(true); // 必填判定 String field1 = jTextField1.getText(); String field2 = jTextField2.getText(); @@ -391,44 +411,57 @@ public class NewJFrame2 extends JFrame { // 开始复制对象 TCComponentItemRevision revision = (TCComponentItemRevision) component; try { - if (itemMapIsSel.get(revision.getStringProperty("object_string")).isSelected) { - TCComponentItem newItem = revision.saveAsItem(jTextField1.getText(), "A"); - //TCComponentItem newItem = revision.saveAsItem(jTextField1.getText(), "A", jTextField2.getText(),"", true, null); + if (itemMapIsSel.get(revision.getStringProperty("object_name")).isSelected) { + TCComponentItem newItem; + try { + newItem = revision.saveAsItem(jTextField1.getText(), null); + } catch (Exception e2) { + // TODO Auto-generated catch block + e2.printStackTrace(); + MessageBox.post("创建失败,ID【"+jTextField1.getText()+"】已存在于TC", "提示", MessageBox.INFORMATION); + return; + } + // TCComponentItem newItem = revision.saveAsItem(jTextField1.getText(), "A", + // jTextField2.getText(),"", true, null); TCComponentItemRevision newRevision = newItem.getLatestItemRevision(); TCComponentBOMWindowType winType = (TCComponentBOMWindowType) session .getTypeComponent("BOMWindow"); TCComponentBOMWindow view = winType.create(null); - TCComponentBOMLine line = view.setWindowTopLine(revision.getItem(), revision, null, null); + TCComponentBOMLine line = view.setWindowTopLine(newItem, newRevision, null, null); // 根据首选项的值复制对象属性 for (String attrStr : sxxdate) { if (attrStr.startsWith(line.getItemRevision().getItem().getStringProperty("object_type"))) { try { - //Util.replaceAttribute(line, newRevision, attrStr); - String[] replaces = attrStr.split("=")[1].split(";"); - for(String replace : replaces) { + // Util.replaceAttribute(line, newRevision, attrStr); + String[] replaces = attrStr.split("=")[1].split(";"); + for (String replace : replaces) { String[] getValues = replace.split("\\."); Object val = ""; - if(getValues[0].equals("item")) { - val = Util.getTCPropertyValue(line.getItem(), getValues[1]); + if (getValues[0].equals("item")) { + val = Util.getTCPropertyValue(revision, getValues[1]); Util.setTCPropertyValue(newRevision.getItem(), getValues[1], val); - //val = item.getProperty(getValues[1]); - }else if(getValues[0].equals("rev")) { - val = Util.getTCPropertyValue(line.getItemRevision(), getValues[1]); + // val = item.getProperty(getValues[1]); + } else if (getValues[0].equals("rev")) { + val = Util.getTCPropertyValue(revision, getValues[1]); Util.setTCPropertyValue(newRevision, getValues[1], val); - //val = rev.getProperty(getValues[1]); - }else if(getValues[0].equals("rm")) { - TCComponent[] oldreferenceListProperty = line.getItemRevision().getReferenceListProperty("IMAN_master_form_rev"); + // val = rev.getProperty(getValues[1]); + } else if (getValues[0].equals("rm")) { + TCComponent[] oldreferenceListProperty = revision + .getReferenceListProperty("IMAN_master_form_rev"); TCComponentForm oldform = (TCComponentForm) oldreferenceListProperty[0]; val = Util.getTCPropertyValue(oldform, getValues[1]); - TCComponent[] newreferenceListProperty = newRevision.getReferenceListProperty("IMAN_master_form_rev"); + TCComponent[] newreferenceListProperty = newRevision + .getReferenceListProperty("IMAN_master_form_rev"); TCComponentForm newform = (TCComponentForm) newreferenceListProperty[0]; Util.setTCPropertyValue(newform, getValues[1], val); - //val = form.getProperty(getValues[1]); - }else if(getValues[0].equals("bom")) { + // val = form.getProperty(getValues[1]); + } else if (getValues[0].equals("bom")) { val = Util.getTCPropertyValue(line, getValues[1]); - TCComponentBOMWindowType winType1 = (TCComponentBOMWindowType) session.getTypeComponent("BOMWindow"); + TCComponentBOMWindowType winType1 = (TCComponentBOMWindowType) session + .getTypeComponent("BOMWindow"); TCComponentBOMWindow view1 = winType1.create(null); - TCComponentBOMLine line1 = view1.setWindowTopLine(newRevision.getItem(), newRevision, null, null); + TCComponentBOMLine line1 = view1.setWindowTopLine(revision.getItem(), + revision, null, null); Util.setTCPropertyValue(line1, getValues[1], val); } } @@ -440,9 +473,9 @@ public class NewJFrame2 extends JFrame { } } // 递归BOM结构,删除未选中的对象 - collectAllBomLine(line, jTextField1.getText(), winType, view, false); - TCComponentItemRevision itemRevision = line.getItemRevision(); - target.add("contents", itemRevision); + collectAllBomLine(line, jTextField1.getText(), winType, view, true); + TCComponentItem item = line.getItem(); + target.add("contents", item); MessageBox.post("创建成功", "提示", MessageBox.INFORMATION); return; @@ -453,6 +486,9 @@ public class NewJFrame2 extends JFrame { } catch (TCException e1) { // TODO Auto-generated catch block e1.printStackTrace(); + }finally { + //关闭旁路 + Util.setByPass(false); } } }); @@ -470,7 +506,7 @@ public class NewJFrame2 extends JFrame { */ public void collectAllBomLine(TCComponentBOMLine bomLine, String newId, TCComponentBOMWindowType winType, TCComponentBOMWindow newview, Boolean flag) throws TCException { - String objectName = bomLine.getItemRevision().getStringProperty("object_string"); + String objectName = bomLine.getItemRevision().getStringProperty("object_name"); boolean selected = itemMapIsSel.get(objectName).isSelected(); // 判断界面是否选中 if (selected) { @@ -488,41 +524,59 @@ public class NewJFrame2 extends JFrame { } else { // 当不是第一次递归的时候,每次递归另存一个对象,把要同步的数据同步过去,然后将对象替换到新的bomview上去 String itemId = bomLine.getItemRevision().getStringProperty("item_id"); - + System.out.println("itemID:" + itemId); + System.out.println(bomLine.getItemRevision().getStringProperty("object_string")); String newItemId = itemId.replaceFirst(itemId.split("-")[0], jTextField1.getText()); - TCComponentItem saveAsItem = bomLine.getItemRevision().saveAsItem(newItemId, "A"); - //TCComponentItem saveAsItem = bomLine.getItemRevision().saveAsItem(jTextField1.getText(), "A", bomLine.getItemRevision().getStringProperty("object_name"), "", true, null); + System.out.println("newItemId:"+newItemId); + TCComponentItem saveAsItem; + try { + saveAsItem = bomLine.getItemRevision().saveAsItem(newItemId, null); + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + MessageBox.post("创建失败,ID【"+newItemId+"】已存在于TC", "提示", MessageBox.INFORMATION); + return; + } + // TCComponentItem saveAsItem = + // bomLine.getItemRevision().saveAsItem(jTextField1.getText(), "A", + // bomLine.getItemRevision().getStringProperty("object_name"), "", true, null); TCComponentItemRevision latestItemRevision = saveAsItem.getLatestItemRevision(); // 替换属性 for (String attrStr : sxxdate) { if (attrStr.startsWith(bomLine.getItemRevision().getItem().getStringProperty("object_type"))) { try { - //Util.replaceAttribute(itemMapBoMap.get(objectName), latestItemRevision, attrStr); - String[] replaces = attrStr.split("=")[1].split(";"); - for(String replace : replaces) { + // Util.replaceAttribute(itemMapBoMap.get(objectName), latestItemRevision, + // attrStr); + String[] replaces = attrStr.split("=")[1].split(";"); + for (String replace : replaces) { String[] getValues = replace.split("\\."); Object val = ""; - if(getValues[0].equals("item")) { + if (getValues[0].equals("item")) { val = Util.getTCPropertyValue(itemMapBoMap.get(objectName).getItem(), getValues[1]); Util.setTCPropertyValue(latestItemRevision.getItem(), getValues[1], val); - //val = item.getProperty(getValues[1]); - }else if(getValues[0].equals("rev")) { - val = Util.getTCPropertyValue(itemMapBoMap.get(objectName).getItemRevision(), getValues[1]); + // val = item.getProperty(getValues[1]); + } else if (getValues[0].equals("rev")) { + val = Util.getTCPropertyValue(itemMapBoMap.get(objectName).getItemRevision(), + getValues[1]); Util.setTCPropertyValue(latestItemRevision, getValues[1], val); - //val = rev.getProperty(getValues[1]); - }else if(getValues[0].equals("rm")) { - TCComponent[] oldreferenceListProperty = itemMapBoMap.get(objectName).getItemRevision().getReferenceListProperty("IMAN_master_form_rev"); + // val = rev.getProperty(getValues[1]); + } else if (getValues[0].equals("rm")) { + TCComponent[] oldreferenceListProperty = itemMapBoMap.get(objectName) + .getItemRevision().getReferenceListProperty("IMAN_master_form_rev"); TCComponentForm oldform = (TCComponentForm) oldreferenceListProperty[0]; val = Util.getTCPropertyValue(oldform, getValues[1]); - TCComponent[] newreferenceListProperty = latestItemRevision.getReferenceListProperty("IMAN_master_form_rev"); + TCComponent[] newreferenceListProperty = latestItemRevision + .getReferenceListProperty("IMAN_master_form_rev"); TCComponentForm newform = (TCComponentForm) newreferenceListProperty[0]; Util.setTCPropertyValue(newform, getValues[1], val); - //val = form.getProperty(getValues[1]); - }else if(getValues[0].equals("bom")) { + // val = form.getProperty(getValues[1]); + } else if (getValues[0].equals("bom")) { val = Util.getTCPropertyValue(itemMapBoMap.get(objectName), getValues[1]); - TCComponentBOMWindowType winType1 = (TCComponentBOMWindowType) session.getTypeComponent("BOMWindow"); + TCComponentBOMWindowType winType1 = (TCComponentBOMWindowType) session + .getTypeComponent("BOMWindow"); TCComponentBOMWindow view1 = winType1.create(null); - TCComponentBOMLine line1 = view1.setWindowTopLine(latestItemRevision.getItem(), latestItemRevision, null, null); + TCComponentBOMLine line1 = view1.setWindowTopLine(latestItemRevision.getItem(), + latestItemRevision, null, null); Util.setTCPropertyValue(line1, getValues[1], val); } } @@ -535,8 +589,10 @@ public class NewJFrame2 extends JFrame { } // 替换分类属性 - //添加属性 - latestItemRevision.setStringProperty("kwc6_ProductID", jTextField1.getText()); + // 添加属性 + TCComponent[] referenceListProperty = latestItemRevision.getReferenceListProperty("IMAN_master_form_rev"); + TCComponentForm form = (TCComponentForm) referenceListProperty[0]; + form.setStringProperty("XYProductID", jTextField1.getText()); // 替换bom行 bomLine.replace(saveAsItem, latestItemRevision, null); if (bomLine.hasChildren()) { @@ -562,8 +618,8 @@ public class NewJFrame2 extends JFrame { * @throws TCException */ private void getTree(TCComponentBOMLine bomLine, CheckBoxTreeNode rootNode) throws TCException { - itemMapIsSel.put(bomLine.getItemRevision().getStringProperty("object_string"), rootNode); - itemMapBoMap.put(bomLine.getItemRevision().getStringProperty("object_string"), bomLine); + itemMapIsSel.put(bomLine.getItemRevision().getStringProperty("object_name"), rootNode); + itemMapBoMap.put(bomLine.getItemRevision().getStringProperty("object_name"), bomLine); if (bomLine.hasChildren()) { AIFComponentContext[] children = bomLine.getChildren(); for (AIFComponentContext aifComponentContext : children) { diff --git a/src/com/connor/kwc/createBom/NewJFrame1.java b/src/com/connor/kwc/createBom/CreateItemFram.java similarity index 68% rename from src/com/connor/kwc/createBom/NewJFrame1.java rename to src/com/connor/kwc/createBom/CreateItemFram.java index 7c699e9..f0c70a6 100644 --- a/src/com/connor/kwc/createBom/NewJFrame1.java +++ b/src/com/connor/kwc/createBom/CreateItemFram.java @@ -32,16 +32,24 @@ import javax.swing.JTextField; import javax.swing.JTree; import javax.swing.LayoutStyle; import javax.swing.WindowConstants; +import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.TreePath; +import com.connor.kwc.jtreeUtilClass.CheckBoxTreeCellRenderer; +import com.connor.kwc.jtreeUtilClass.CheckBoxTreeNode; +import com.connor.kwc.jtreeUtilClass.CheckBoxTreeNodeSelectionListener; import com.connor.kwc.util.Util; +import com.connor.kwc.util.UtilBean; import com.fasterxml.jackson.annotation.JsonTypeInfo.Id; 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.TCComponentBOMView; import com.teamcenter.rac.kernel.TCComponentBOMWindow; import com.teamcenter.rac.kernel.TCComponentBOMWindowType; +import com.teamcenter.rac.kernel.TCComponentBomChange; import com.teamcenter.rac.kernel.TCComponentFolder; import com.teamcenter.rac.kernel.TCComponentForm; import com.teamcenter.rac.kernel.TCComponentGDE; @@ -59,7 +67,7 @@ import com.teamcenter.rac.util.MessageBox; * @date 2023年12月19日 * */ -public class NewJFrame1 extends JFrame { +public class CreateItemFram extends JFrame { private TCSession session; private Map dataMap; @@ -93,7 +101,7 @@ public class NewJFrame1 extends JFrame { /** * Creates new form NewJFrame2 */ - public NewJFrame1(TCSession session, Map dataMap, TCComponentItemRevision target) { + public CreateItemFram(TCSession session, Map dataMap, TCComponentItemRevision target) { this.session = session; this.dataMap = dataMap; this.target = target; @@ -155,8 +163,8 @@ public class NewJFrame1 extends JFrame { jLabel3.setText("类型:"); ArrayList typeList = (ArrayList) dataMap.get("typeList"); - for(String tyString : typeList) { - System.out.println("tyString:"+tyString); + for (String tyString : typeList) { + System.out.println("tyString:" + tyString); } String[] typeArray = typeList.stream().toArray(String[]::new); jComboBox2.setModel(new DefaultComboBoxModel<>(typeArray)); @@ -185,7 +193,7 @@ public class NewJFrame1 extends JFrame { jLabel4.setText("模板:"); try { // 根据模板创建树结构,给用户选择 - System.out.println("tempId:"+tempIdList.get(0)); + System.out.println("tempId:" + tempIdList.get(0)); component = session.stringToComponent(tempIdList.get(0)); TCComponentBOMWindowType winType = (TCComponentBOMWindowType) session.getTypeComponent("BOMWindow"); TCComponentBOMWindow view = winType.create(null); @@ -199,6 +207,11 @@ public class NewJFrame1 extends JFrame { jTree1.addMouseListener(new CheckBoxTreeNodeSelectionListener()); jTree1.setModel(model); jTree1.setCellRenderer(new CheckBoxTreeCellRenderer()); + // 展开所有节点并选中 + for (int i = 0; i < jTree1.getRowCount(); i++) { + jTree1.expandRow(i); + } + rootNode.setSelected(true); } } catch (TCException e1) { @@ -206,9 +219,6 @@ public class NewJFrame1 extends JFrame { e1.printStackTrace(); } - - - jLabel5.setText("专业:"); jComboBox4.setModel(new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); @@ -342,11 +352,19 @@ public class NewJFrame1 extends JFrame { int y = (screenHeight - this.getHeight()) / 2; // 计算Frame的左上角y坐标 this.setLocation(x, y); // 设置Frame的位置 this.setDefaultCloseOperation(2); - - jTextField1.setText(target.getStringProperty("item_id")); + int lastDashIndex = target.getStringProperty("item_id").lastIndexOf('-'); + if (lastDashIndex != -1) { + // 获取破折号之前的所有内容 + String valueBeforeLastDash = target.getStringProperty("item_id").substring(0, lastDashIndex); + jTextField1.setText(valueBeforeLastDash); + } else { + jTextField1.setText(target.getStringProperty("item_id")); + } + // jTextField2.setText(target.getStringProperty("object_name")); // jTextField1.setEditable(false); jTextField2.setEditable(false); + // 类型下拉框监听,更新模板下拉框 jComboBox2.addItemListener(new ItemListener() { @@ -368,7 +386,7 @@ public class NewJFrame1 extends JFrame { } } String[] array = tempList.stream().toArray(String[]::new); - //String[] array = (String[]) tempList.toArray(); + // String[] array = (String[]) tempList.toArray(); jComboBox3.setModel(new DefaultComboBoxModel<>(array)); } }); @@ -394,6 +412,12 @@ public class NewJFrame1 extends JFrame { jTree1.addMouseListener(new CheckBoxTreeNodeSelectionListener()); jTree1.setModel(model); jTree1.setCellRenderer(new CheckBoxTreeCellRenderer()); + jTree1.setRowHeight(0); + // 展开所有节点并选中 + for (int i = 0; i < jTree1.getRowCount(); i++) { + jTree1.expandRow(i); + } + rootNode.setSelected(true); } } catch (Exception e2) { // TODO: handle exception @@ -416,80 +440,156 @@ public class NewJFrame1 extends JFrame { // 开始复制对象 TCComponentItemRevision revision = (TCComponentItemRevision) component; try { - if (itemMapIsSel.get(revision.getStringProperty("object_name")).isSelected) { - TCComponentItem newItem = revision.saveAsItem(jTextField1.getText(), "A"); -// TCComponentItem newItem = revision.saveAsItem(jTextField1.getText(), "A", revision.getStringProperty("object_name"),"", true, null); - TCComponentItemRevision newRevision = newItem.getLatestItemRevision(); - TCComponentBOMWindowType winType = (TCComponentBOMWindowType) session - .getTypeComponent("BOMWindow"); - TCComponentBOMWindow view = winType.create(null); - TCComponentBOMLine line = view.setWindowTopLine(newItem, newRevision, null, null); - // 根据首选项的值复制对象属性 - for (String attrStr : sxxdate) { - if (attrStr.startsWith(line.getItemRevision().getItem().getStringProperty("object_type"))) { - try { - String[] replaces = attrStr.split("=")[1].split(";"); - for(String replace : replaces) { - String[] getValues = replace.split("\\."); - Object val = ""; - if(getValues[0].equals("item")) { - val = Util.getTCPropertyValue(revision.getItem(), getValues[1]); - Util.setTCPropertyValue(newRevision.getItem(), getValues[1], val); - //val = item.getProperty(getValues[1]); - }else if(getValues[0].equals("rev")) { - val = Util.getTCPropertyValue(revision, getValues[1]); - Util.setTCPropertyValue(newRevision, getValues[1], val); - //val = rev.getProperty(getValues[1]); - }else if(getValues[0].equals("rm")) { - TCComponent[] oldreferenceListProperty = revision.getReferenceListProperty("IMAN_master_form_rev"); - TCComponentForm oldform = (TCComponentForm) oldreferenceListProperty[0]; - val = Util.getTCPropertyValue(oldform, getValues[1]); - TCComponent[] newreferenceListProperty = newRevision.getReferenceListProperty("IMAN_master_form_rev"); - TCComponentForm newform = (TCComponentForm) newreferenceListProperty[0]; - Util.setTCPropertyValue(newform, getValues[1], val); - //val = form.getProperty(getValues[1]); - }else if(getValues[0].equals("bom")) { - TCComponentBOMWindowType winType1 = (TCComponentBOMWindowType) session.getTypeComponent("BOMWindow"); - TCComponentBOMWindow view1 = winType1.create(null); - TCComponentBOMLine line1 = view1.setWindowTopLine(revision.getItem(), revision, null, null); - val = Util.getTCPropertyValue(line1, getValues[1]); - - Util.setTCPropertyValue(line, getValues[1], val); - } - } - - } catch (Exception e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - break; - } - } - // 递归BOM结构,删除未选中的对象 - collectAllBomLine(line, jTextField1.getText(), winType, line.getBOMView(), true); - AIFComponentContext[] children = line.getChildren(); - TCComponentBOMWindowType winType1 = (TCComponentBOMWindowType) session.getTypeComponent("BOMWindow"); - TCComponentBOMWindow view1 = winType1.create(null); - TCComponentBOMLine revLine = view1.setWindowTopLine(target.getItem(), target, null, null); - for(AIFComponentContext line2 : children) { - TCComponentBOMLine bomLine = (TCComponentBOMLine)line2.getComponent(); - revLine.add(bomLine.getItem(), bomLine.getItemRevision(), null, false, ""); - view1.save(); - } - MessageBox.post("创建成功", "提示", MessageBox.INFORMATION); - return; - } else { - return; + // 开旁路 + Util.setByPass(true); + TCComponentBOMWindowType winType = (TCComponentBOMWindowType) session.getTypeComponent("BOMWindow"); + TCComponentBOMWindow view = winType.create(null); + // 获取顶层模板的itemID + String itemId = revision.getItem().getStringProperty(UtilBean.ITEMID); + // 循环根节点,判断下面的对象itemID是否包含根节点id,如果包含,则另存,不包含,则直接引用 + TCComponentBOMLine line = view.setWindowTopLine(revision.getItem(), revision, null, null); + List itemList = new ArrayList(); + eachAllBomLine(line, itemId, jTextField1.getText(), itemList); + + /* + * if (itemMapIsSel.get(revision.getStringProperty("object_name")).isSelected) { + * TCComponentItem newItem; try { newItem = + * revision.saveAsItem(jTextField1.getText(), null); } catch (Exception e2) { // + * TODO Auto-generated catch block e2.printStackTrace(); + * MessageBox.post("创建失败,ID【"+jTextField1.getText()+"】已存在于TC", "提示", + * MessageBox.INFORMATION); return; } TCComponentItem newItem = + * revision.saveAsItem(jTextField1.getText(), "A", + * revision.getStringProperty("object_name"),"", true, null); + * TCComponentItemRevision newRevision = newItem.getLatestItemRevision(); + * + * TCComponentBOMLine line = view.setWindowTopLine(newItem, newRevision, null, + * null); + * + * // 递归BOM结构,删除未选中的对象 collectAllBomLine(line, jTextField1.getText(), winType, + * line.getBOMView(), true); AIFComponentContext[] children = + * line.getChildren(); + */ + + TCComponentBOMWindowType winType1 = (TCComponentBOMWindowType) session + .getTypeComponent("BOMWindow"); + TCComponentBOMWindow view1 = winType1.create(null); + TCComponentBOMLine revLine = view1.setWindowTopLine(target.getItem(), target, null, null); + for (TCComponentItem line2 : itemList) { + revLine.add(line2, line2.getLatestItemRevision(), null, false, ""); + view1.save(); } + dispose(); + MessageBox.post("创建成功", "提示", MessageBox.INFORMATION); + return; } catch (TCException e1) { // TODO Auto-generated catch block + dispose(); + MessageBox.post("创建失败", "提示", MessageBox.INFORMATION); e1.printStackTrace(); + } finally { + // 关闭旁路 + Util.setByPass(false); } } }); } + /** + * 递归BOM结构 + * + * @param view + * @param topBomLine + * @param newId + * @param itemList + * @param string + * @param winType + * @param newview + * @throws TCException + */ + public void eachAllBomLine(TCComponentBOMLine bomLine, String isHasId, String newId, List itemList) + throws TCException { + AIFComponentContext[] children = bomLine.getChildren(); + for (AIFComponentContext componentContext : children) { + TCComponentBOMLine line = (TCComponentBOMLine) componentContext.getComponent(); + // 判断是否选中 + String objectName = line.getItemRevision().getStringProperty(UtilBean.OBJECTNAMR); + boolean selected = itemMapIsSel.get(objectName).isSelected(); + System.out.println(selected); + if (selected) { + String itemId = line.getItem().getStringProperty(UtilBean.ITEMID); + System.out.println(itemId+"=========="+isHasId); + if (itemId.contains(isHasId)) { + // 另存 + char separator = '-'; + // 替换并组合新的字符串 + String newString = newId + itemId.substring(itemId.indexOf(separator)); + System.out.println(newString); + TCComponentItem saveAsItem; + try { + saveAsItem = line.getItemRevision().saveAsItem(newString, null); + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + MessageBox.post("创建失败,ID【" + newString + "】已存在于TC", "提示", MessageBox.INFORMATION); + return; + } + TCComponentItemRevision latestItemRevision = saveAsItem.getLatestItemRevision(); + // 替换属性 + for (String attrStr : sxxdate) { + if (attrStr.startsWith(bomLine.getItemRevision().getItem().getStringProperty("object_type"))) { + try { + // Util.replaceAttribute(itemMapBoMap.get(objectName), latestItemRevision, + // attrStr); + String[] replaces = attrStr.split("=")[1].split(";"); + for (String replace : replaces) { + String[] getValues = replace.split("\\."); + Object val = ""; + if (getValues[0].equals("item")) { + val = Util.getTCPropertyValue(line.getItem(), getValues[1]); + Util.setTCPropertyValue(latestItemRevision.getItem(), getValues[1], val); + // val = item.getProperty(getValues[1]); + } else if (getValues[0].equals("rev")) { + val = Util.getTCPropertyValue(line.getItemRevision(), getValues[1]); + Util.setTCPropertyValue(latestItemRevision, getValues[1], val); + // val = rev.getProperty(getValues[1]); + } else if (getValues[0].equals("rm")) { + TCComponent[] oldreferenceListProperty = line.getItemRevision() + .getReferenceListProperty("IMAN_master_form_rev"); + TCComponentForm oldform = (TCComponentForm) oldreferenceListProperty[0]; + val = Util.getTCPropertyValue(oldform, getValues[1]); + TCComponent[] newreferenceListProperty = latestItemRevision + .getReferenceListProperty("IMAN_master_form_rev"); + TCComponentForm newform = (TCComponentForm) newreferenceListProperty[0]; + Util.setTCPropertyValue(newform, getValues[1], val); + // val = form.getProperty(getValues[1]); + } else if (getValues[0].equals("bom")) { + val = Util.getTCPropertyValue(line, getValues[1]); + TCComponentBOMWindowType winType1 = (TCComponentBOMWindowType) session + .getTypeComponent("BOMWindow"); + TCComponentBOMWindow view1 = winType1.create(null); + TCComponentBOMLine line1 = view1.setWindowTopLine(latestItemRevision.getItem(), + latestItemRevision, null, null); + Util.setTCPropertyValue(line1, getValues[1], val); + } + } + } catch (Exception e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + break; + } + } + itemList.add(saveAsItem); + } else { + // 引用 + itemList.add(line.getItem()); + } + } + } + + } + /** * 递归BOM结构 * @@ -520,43 +620,60 @@ public class NewJFrame1 extends JFrame { } else { // 当不是第一次递归的时候,每次递归另存一个对象,把要同步的数据同步过去,然后将对象替换到新的bomview上去 String itemId = bomLine.getItemRevision().getStringProperty("item_id"); - System.out.println("itemID:"+itemId); + System.out.println("itemID:" + itemId); System.out.println(bomLine.getItemRevision().getStringProperty("object_string")); String newItemId = itemId.replaceFirst(itemId.split("-")[0], jTextField1.getText()); - System.out.println("newItemId:"+newItemId); - TCComponentItem saveAsItem = bomLine.getItemRevision().saveAsItem(newItemId, "A"); - //TCComponentItem saveAsItem = bomLine.getItemRevision().saveAsItem(jTextField1.getText(), "A",bomLine.getItemRevision().getStringProperty("object_name"), "", true, null); + System.out.println("newItemId:" + newItemId); + TCComponentItem saveAsItem; + try { + saveAsItem = bomLine.getItemRevision().saveAsItem(newItemId, null); + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + MessageBox.post("创建失败,ID【" + newItemId + "】已存在于TC", "提示", MessageBox.INFORMATION); + return; + } + // TCComponentItem saveAsItem = + // bomLine.getItemRevision().saveAsItem(jTextField1.getText(), + // "A",bomLine.getItemRevision().getStringProperty("object_name"), "", true, + // null); TCComponentItemRevision latestItemRevision = saveAsItem.getLatestItemRevision(); // 替换属性 for (String attrStr : sxxdate) { if (attrStr.startsWith(bomLine.getItemRevision().getItem().getStringProperty("object_type"))) { try { - //Util.replaceAttribute(itemMapBoMap.get(objectName), latestItemRevision, attrStr); - String[] replaces = attrStr.split("=")[1].split(";"); - for(String replace : replaces) { + // Util.replaceAttribute(itemMapBoMap.get(objectName), latestItemRevision, + // attrStr); + String[] replaces = attrStr.split("=")[1].split(";"); + for (String replace : replaces) { String[] getValues = replace.split("\\."); Object val = ""; - if(getValues[0].equals("item")) { + if (getValues[0].equals("item")) { val = Util.getTCPropertyValue(itemMapBoMap.get(objectName).getItem(), getValues[1]); Util.setTCPropertyValue(latestItemRevision.getItem(), getValues[1], val); - //val = item.getProperty(getValues[1]); - }else if(getValues[0].equals("rev")) { - val = Util.getTCPropertyValue(itemMapBoMap.get(objectName).getItemRevision(), getValues[1]); + // val = item.getProperty(getValues[1]); + } else if (getValues[0].equals("rev")) { + val = Util.getTCPropertyValue(itemMapBoMap.get(objectName).getItemRevision(), + getValues[1]); Util.setTCPropertyValue(latestItemRevision, getValues[1], val); - //val = rev.getProperty(getValues[1]); - }else if(getValues[0].equals("rm")) { - TCComponent[] oldreferenceListProperty = itemMapBoMap.get(objectName).getItemRevision().getReferenceListProperty("IMAN_master_form_rev"); + // val = rev.getProperty(getValues[1]); + } else if (getValues[0].equals("rm")) { + TCComponent[] oldreferenceListProperty = itemMapBoMap.get(objectName) + .getItemRevision().getReferenceListProperty("IMAN_master_form_rev"); TCComponentForm oldform = (TCComponentForm) oldreferenceListProperty[0]; val = Util.getTCPropertyValue(oldform, getValues[1]); - TCComponent[] newreferenceListProperty = latestItemRevision.getReferenceListProperty("IMAN_master_form_rev"); + TCComponent[] newreferenceListProperty = latestItemRevision + .getReferenceListProperty("IMAN_master_form_rev"); TCComponentForm newform = (TCComponentForm) newreferenceListProperty[0]; Util.setTCPropertyValue(newform, getValues[1], val); - //val = form.getProperty(getValues[1]); - }else if(getValues[0].equals("bom")) { + // val = form.getProperty(getValues[1]); + } else if (getValues[0].equals("bom")) { val = Util.getTCPropertyValue(itemMapBoMap.get(objectName), getValues[1]); - TCComponentBOMWindowType winType1 = (TCComponentBOMWindowType) session.getTypeComponent("BOMWindow"); + TCComponentBOMWindowType winType1 = (TCComponentBOMWindowType) session + .getTypeComponent("BOMWindow"); TCComponentBOMWindow view1 = winType1.create(null); - TCComponentBOMLine line1 = view1.setWindowTopLine(latestItemRevision.getItem(), latestItemRevision, null, null); + TCComponentBOMLine line1 = view1.setWindowTopLine(latestItemRevision.getItem(), + latestItemRevision, null, null); Util.setTCPropertyValue(line1, getValues[1], val); } } @@ -568,14 +685,14 @@ public class NewJFrame1 extends JFrame { } } // 替换分类属性 - - //添加属性 + + // 添加属性 latestItemRevision.setStringProperty("kwc6_ProductID", jTextField1.getText()); // 添加bom行 String stringProperty = bomLine.getItemRevision().getStringProperty("object_string"); - System.out.println("要替换的老行:"+stringProperty); + System.out.println("要替换的老行:" + stringProperty); String stringProperty2 = latestItemRevision.getStringProperty("object_string"); - System.out.println("要替换的新行:"+stringProperty2); + System.out.println("要替换的新行:" + stringProperty2); bomLine.replace(saveAsItem, latestItemRevision, null); if (bomLine.hasChildren()) { for (AIFComponentContext aifComponentContext : bomLine.getChildren()) { @@ -613,6 +730,5 @@ public class NewJFrame1 extends JFrame { } } } - } diff --git a/src/com/connor/kwc/createBom/test.java b/src/com/connor/kwc/createBom/test.java index 669f7d3..aebac51 100644 --- a/src/com/connor/kwc/createBom/test.java +++ b/src/com/connor/kwc/createBom/test.java @@ -6,17 +6,13 @@ */ package com.connor.kwc.createBom; -import java.awt.EventQueue; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; - import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTree; -import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeModel; -import javax.swing.tree.TreeNode; -import javax.swing.tree.TreePath; +import com.connor.kwc.jtreeUtilClass.CheckBoxTreeCellRenderer; +import com.connor.kwc.jtreeUtilClass.CheckBoxTreeNode; +import com.connor.kwc.jtreeUtilClass.CheckBoxTreeNodeSelectionListener; /** * @ClassName: test @@ -27,46 +23,14 @@ import javax.swing.tree.TreePath; */ public class test { public static void main(String[] args) { - EventQueue.invokeLater(new Runnable() { - public void run() { - JFrame frame = new JFrame("CheckBoxTreeDemo"); - frame.setBounds(200, 200, 400, 400); - JTree tree = new JTree(); - CheckBoxTreeNode rootNode = new CheckBoxTreeNode("root"); - CheckBoxTreeNode node1 = new CheckBoxTreeNode("node_1"); - CheckBoxTreeNode node1_1 = new CheckBoxTreeNode("node_1_1"); - CheckBoxTreeNode node1_2 = new CheckBoxTreeNode("node_1_2"); - CheckBoxTreeNode node1_3 = new CheckBoxTreeNode("node_1_3"); - node1.add(node1_1); - node1.add(node1_2); - node1.add(node1_3); - CheckBoxTreeNode node2 = new CheckBoxTreeNode("node_2"); - boolean selected = node2.isSelected(); - CheckBoxTreeNode node2_1 = new CheckBoxTreeNode("node_2_1"); - CheckBoxTreeNode node2_2 = new CheckBoxTreeNode("node_2_2"); - node2.add(node2_1); - node2.add(node2_2); - rootNode.add(node1); - rootNode.add(node2); - DefaultTreeModel model = new DefaultTreeModel(rootNode); - tree.addMouseListener(new CheckBoxTreeNodeSelectionListener()); - tree.setModel(model); - tree.setCellRenderer(new CheckBoxTreeCellRenderer()); - tree.addMouseListener(new MouseAdapter() { - public void mousePressed(MouseEvent e) { - String string = tree.getSelectionPath().toString(); - System.out.println(string); - - } - }); - JScrollPane scroll = new JScrollPane(tree); - scroll.setBounds(0, 0, 300, 320); - frame.getContentPane().add(scroll); + - frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + String originalString = "prefix-suffix"; + char separator = '-'; + String replacement = "newPrefix"; + // 替换并组合新的字符串 + String newString = replacement + originalString.substring(originalString.indexOf(separator)); - frame.setVisible(true); - } - }); + System.out.println(newString); } } diff --git a/src/com/connor/kwc/createDWG/CreateDWGHandler.java b/src/com/connor/kwc/createDWG/CreateDWGHandler.java index 34701fa..edff037 100644 --- a/src/com/connor/kwc/createDWG/CreateDWGHandler.java +++ b/src/com/connor/kwc/createDWG/CreateDWGHandler.java @@ -88,15 +88,16 @@ public class CreateDWGHandler extends AbstractHandler { } return null; } + /** * - * @Title: createdataSetForUID + * @Title: createdataSetForUID * @Description: 根据uid创建数据集 - * @param @param revision - * @param @param templateMap - * @param @param key - * @param @throws TCException 参数 - * @return void 返回类型 + * @param @param revision + * @param @param templateMap + * @param @param key + * @param @throws TCException 参数 + * @return void 返回类型 * @throws */ public void createdataSetForUID(TCComponentItemRevision revision, Map templateMap, String key) diff --git a/src/com/connor/kwc/createTemplate/CompontByNode.java b/src/com/connor/kwc/createTemplate/CompontByNode.java index 0c0e455..dfd4f24 100644 --- a/src/com/connor/kwc/createTemplate/CompontByNode.java +++ b/src/com/connor/kwc/createTemplate/CompontByNode.java @@ -4,52 +4,45 @@ import java.util.Arrays; import com.teamcenter.rac.kernel.TCComponent; import com.teamcenter.rac.kernel.TCException; + /** * - * @ClassName: CompontByNode + * @ClassName: CompontByNode * @Description: 树节点对象 - * @author hcj - * @date 2024年1月8日 + * @author hcj + * @date 2024年1月8日 * */ public class CompontByNode { - //父对象 + // 父对象 private TCComponent component; - //子对象 + // 子对象 private TCComponent[] components; - - + public CompontByNode() { super(); } - public CompontByNode(TCComponent component, TCComponent[] components) { super(); this.component = component; this.components = components; } - public TCComponent getComponent() { return component; } - public void setComponent(TCComponent component) { this.component = component; } - public TCComponent[] getComponents() { return components; } - public void setComponents(TCComponent[] components) { this.components = components; } - - } diff --git a/src/com/connor/kwc/createTemplate/CreateTemplateDialg.java b/src/com/connor/kwc/createTemplate/CreateTemplateDialg.java index 8e4adf7..f3e25cf 100644 --- a/src/com/connor/kwc/createTemplate/CreateTemplateDialg.java +++ b/src/com/connor/kwc/createTemplate/CreateTemplateDialg.java @@ -4,48 +4,36 @@ import java.awt.Dimension; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.text.ParseException; -import java.text.SimpleDateFormat; +import java.time.Year; import java.util.ArrayList; -import java.util.Date; import java.util.HashMap; import java.util.List; +import java.util.Locale; import java.util.Map; +import java.util.ResourceBundle; import java.util.Map.Entry; - -import javax.swing.DefaultComboBoxModel; import javax.swing.GroupLayout; import javax.swing.JButton; -import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextField; import javax.swing.JTree; -import javax.swing.UIManager; import javax.swing.WindowConstants; import javax.swing.tree.DefaultTreeModel; -import com.connor.kwc.createBom.CheckBoxTreeCellRenderer; -import com.connor.kwc.createBom.CheckBoxTreeNode; -import com.connor.kwc.createBom.CheckBoxTreeNodeSelectionListener; +import com.connor.kwc.jtreeUtilClass.CheckBoxTreeCellRenderer; +import com.connor.kwc.jtreeUtilClass.CheckBoxTreeNode; +import com.connor.kwc.jtreeUtilClass.CheckBoxTreeNodeSelectionListener; import com.connor.kwc.util.Util; -import com.teamcenter.rac.aif.AIFPortal; -import com.teamcenter.rac.aif.kernel.AIFComponentContext; -import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.connor.kwc.util.UtilBean; import com.teamcenter.rac.kernel.TCComponent; -import com.teamcenter.rac.kernel.TCComponentBOMLine; -import com.teamcenter.rac.kernel.TCComponentBOMWindow; -import com.teamcenter.rac.kernel.TCComponentBOMWindowType; +import com.teamcenter.rac.kernel.TCComponentDataset; import com.teamcenter.rac.kernel.TCComponentFolder; -import com.teamcenter.rac.kernel.TCComponentFolderType; import com.teamcenter.rac.kernel.TCComponentForm; import com.teamcenter.rac.kernel.TCComponentItem; -import com.teamcenter.rac.kernel.TCComponentItemRevision; -import com.teamcenter.rac.kernel.TCComponentPseudoFolder; import com.teamcenter.rac.kernel.TCException; -import com.teamcenter.rac.kernel.TCProperty; import com.teamcenter.rac.kernel.TCSession; import com.teamcenter.rac.util.MessageBox; @@ -59,8 +47,29 @@ import com.teamcenter.rac.util.MessageBox; */ public class CreateTemplateDialg extends JFrame { + private static final long serialVersionUID = 1L; + //依据模板创建 + private final static String YJMBCJ = "yjmbcj"; + //产品代号 + private final static String CPDH = "cpdh"; + //确定 + private final static String QD = "qd"; + //产品代号不能为空! + private final static String CPDHBNWK = "cpdhbnwk"; + //提示 + private final static String TS = "ts"; + //创建失败 + private final static String CJSB = "cjsb"; + //创建成功 + private final static String CJCG = "cjcg"; + //已存在于TC + private final static String YCZYTC = "yczytc"; + //模板 + private final static String MB = "mb"; + private TCSession session; private TCComponent target; + private ResourceBundle resource; private JButton jButton3; private JLabel jLabel3; private JPanel jPanel1; @@ -69,15 +78,15 @@ public class CreateTemplateDialg extends JFrame { private JScrollPane jScrollPane1; private JTextField jTextField3; private JTree jTree1; - private String[] sxxdate; - private String[] sxxAttrDate; + private String[] createDOCtemplate; + private String[] createDOCAttribute; private Map>>> folderByNodeMap = new HashMap>>>(); - private Map>> isSavaAsMap = new HashMap>>(); + private Map>> isSavaAsMap = new HashMap>>(); private Map nodeIsSelectMap = new HashMap(); private Map> isSelectByNodeMap = new HashMap>(); /** - * Creates new form NewJFrame2 + * Creates new form CreateTemplateDialg */ public CreateTemplateDialg(TCSession session, TCComponent folder) { this.session = session; @@ -94,24 +103,24 @@ public class CreateTemplateDialg extends JFrame { /** * * @Title: getData - * @Description: 获取首选项的值 + * @Description: 清空数据,读取配置文件,获取首选项的值 * @param 参数 * @return void 返回类型 * @throws */ private void getData() { - //清理数据 + // 清理数据 System.out.println("清理数据......."); folderByNodeMap.clear(); isSavaAsMap.clear(); nodeIsSelectMap.clear(); isSelectByNodeMap.clear(); System.out.println("数据清理完毕......."); - - - // TODO Auto-generated method stub - sxxdate = Util.getSXX(session, "KWC_CreateDOCtemplate"); - sxxAttrDate = Util.getSXX(session, "KWC_CreateDOC_attribute"); + //读取配置文件 + resource = ResourceBundle.getBundle("com.connor.kwc.message.Message", Locale.getDefault()); + //读取首选项 + createDOCtemplate = Util.getSXX(session, UtilBean.CREATRDOCTEMPLATE); + createDOCAttribute = Util.getSXX(session, UtilBean.CRWATEDOCATTRIBUTE); } @@ -124,9 +133,9 @@ public class CreateTemplateDialg extends JFrame { * @throws */ @SuppressWarnings("unchecked") - // private void initComponents() throws TCException { - this.setTitle("依据模板创建"); + //依据模板创建 + this.setTitle(resource.getString(YJMBCJ)); jPanel1 = new JPanel(); jPanel2 = new JPanel(); jLabel3 = new JLabel(); @@ -137,7 +146,7 @@ public class CreateTemplateDialg extends JFrame { jTree1.setCellRenderer(new CheckBoxTreeCellRenderer()); jButton3 = new JButton(); jTextField3 = new JTextField(); - jTextField3.setText(target.getStringProperty("item_id")); + jTextField3.setText(target.getStringProperty(UtilBean.ITEMID)); jPanel4 = new JPanel(); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); @@ -146,12 +155,12 @@ public class CreateTemplateDialg extends JFrame { jPanel1.setBackground(new java.awt.Color(240, 240, 240)); jPanel2.setBackground(new java.awt.Color(240, 240, 240)); - - jLabel3.setText("产品代号:"); + //产品代号 + jLabel3.setText(resource.getString(CPDH)); jScrollPane1.setViewportView(jTree1); - - jButton3.setText("确定"); + //确定 + jButton3.setText(resource.getString(QD)); GroupLayout jPanel2Layout = new GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); @@ -214,60 +223,97 @@ public class CreateTemplateDialg extends JFrame { .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); pack(); - Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); // 获取屏幕尺寸 - int screenWidth = screenSize.width; // 获取屏幕宽度 - int screenHeight = screenSize.height; // 获取屏幕高度 - int x = (screenWidth - this.getWidth()) / 2; // 计算Frame的左上角x坐标 - int y = (screenHeight - this.getHeight()) / 2; // 计算Frame的左上角y坐标 - this.setLocation(x, y); // 设置Frame的位置 + + //设置窗口居中 + Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); + int screenWidth = screenSize.width; + int screenHeight = screenSize.height; + int x = (screenWidth - this.getWidth()) / 2; + int y = (screenHeight - this.getHeight()) / 2; + this.setLocation(x, y); // this.setDefaultCloseOperation(2); + // 确定按钮监听 this.jButton3.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - - - + // TODO Auto-generated method stub String name = jTextField3.getText(); if (name.isEmpty()) { - MessageBox.post("产品代号不能为空!", "提示 ", MessageBox.INFORMATION); + //产品代号不能为空! 提示 + MessageBox.post(resource.getString(CPDHBNWK), resource.getString(TS), MessageBox.INFORMATION); } else { try { + // 开旁路 + Util.setByPass(true); + // 根据当前文件夹下的关系匹配树节点的选中状态创建对象 - for(Entry nodeIsSelect : nodeIsSelectMap.entrySet()) { - if(nodeIsSelect.getValue().isSelected()) { - List> list = isSavaAsMap.get(nodeIsSelect.getValue()); - for(Map childMap : list) { - // 判断是否选中 + for (Entry nodeIsSelect : nodeIsSelectMap.entrySet()) { + if (nodeIsSelect.getValue().isSelected()) { + List> list = isSavaAsMap + .get(nodeIsSelect.getValue()); + for (Map childMap : list) { + // 判断是否选中 for (Map.Entry entry1 : childMap.entrySet()) { if (entry1.getValue().isSelected()) { // 创建对象 TCComponent oldObj = entry1.getKey(); - if(oldObj instanceof TCComponentFolder) { - TCComponentFolder oldFolder = (TCComponentFolder)oldObj; - TCComponentFolder saveAs = oldFolder.saveAs(jTextField3.getText() + oldFolder.getStringProperty("object_string").replaceAll("\\[.*?\\]", "")); - TCComponent[] referenceListProperty = saveAs.getReferenceListProperty("contents"); + if (oldObj instanceof TCComponentFolder) { + TCComponentFolder oldFolder = (TCComponentFolder) oldObj; + TCComponentFolder saveAs = oldFolder.saveAs(jTextField3.getText() + + oldFolder.getStringProperty(UtilBean.OBJECTSTRING) + .replaceFirst("\\[.*?\\]", "")); + + TCComponent[] referenceListProperty = saveAs + .getReferenceListProperty(UtilBean.CONTENTS); saveAs.remove("contents", referenceListProperty); - System.out.println("开始添加文件夹"+saveAs.getStringProperty("object_string")+"对象到"+nodeIsSelect.getKey()+"关系下"); - target.add(nodeIsSelect.getKey(),saveAs); + target.add(nodeIsSelect.getKey(), saveAs); // 挂载新的对象 isLoadNewCompint(oldObj, saveAs); - }else if(oldObj instanceof TCComponentItem) { - TCComponentItem oldItem = (TCComponentItem)oldObj; - TCComponentItem saveAsItem = oldItem.getLatestItemRevision().saveAsItem(jTextField3.getText()+oldItem.getStringProperty("object_string").replaceAll("\\[.*?\\]", ""), "A"); - System.out.println("开始添加item"+saveAsItem.getStringProperty("object_string")+"对象到"+nodeIsSelect.getKey()+"关系下"); - target.add(nodeIsSelect.getKey(),saveAsItem); - } + } else if (oldObj instanceof TCComponentItem) { + TCComponentItem oldItem = (TCComponentItem) oldObj; + TCComponentItem saveAsItem; + String replaceName = jTextField3.getText() + + oldItem.getStringProperty(UtilBean.OBJECTSTRING) + .replaceFirst("\\[.*?\\]", ""); + String replace = replaceName.replace("[Y]", + String.valueOf(Year.now().getValue())); + try { + + saveAsItem = oldItem.getLatestItemRevision().saveAsItem(replace, + null); + } catch (Exception e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + MessageBox.post( + //创建失败 已存在于TC + resource.getString(CJSB) + ",ID【" + replaceName + "】" + + resource.getString(YCZYTC), + resource.getString(TS), MessageBox.INFORMATION); + return; + } + target.add(nodeIsSelect.getKey(), saveAsItem); + } } } } } } dispose(); + //创建成功 + MessageBox.post(resource.getString(CJCG), resource.getString(TS), MessageBox.INFORMATION); + return; } catch (Exception e1) { e1.printStackTrace(); + dispose(); + //创建失败 + MessageBox.post(resource.getString(CJSB), resource.getString(TS), MessageBox.INFORMATION); + return; + } finally { + // 关闭旁路 + Util.setByPass(false); } } } @@ -286,43 +332,96 @@ public class CreateTemplateDialg extends JFrame { * @throws */ private void isLoadNewCompint(TCComponent oldObj, TCComponent newObj) throws TCException { - if (isSelectByNodeMap.containsKey(oldObj.getStringProperty("object_string"))) { + if (isSelectByNodeMap.containsKey(oldObj.getStringProperty(UtilBean.OBJECTSTRING))) { // 创建文件夹挂载新创建的对象 - Map map = isSelectByNodeMap.get(oldObj.getStringProperty("object_string")); - System.out.println("另存对象长度"+map.size()); + Map map = isSelectByNodeMap.get(oldObj.getStringProperty(UtilBean.OBJECTSTRING)); + System.out.println("saveAs length:" + map.size()); for (Map.Entry entry : map.entrySet()) { if (entry.getValue().isSelected()) { // 另存文件,复制属性规则 TCComponentItem item = (TCComponentItem) entry.getKey(); - System.out.println("开始另存对象"+item.getStringProperty("object_string")); - TCComponentItem saveAsItem = item.getLatestItemRevision().saveAsItem(jTextField3.getText()+item.getStringProperty("object_string").replaceAll("\\[.*?\\]", ""), "A"); + System.out.println("start saveAs:" + item.getStringProperty(UtilBean.OBJECTSTRING)); + String itemId = item.getStringProperty(UtilBean.ITEMID); + String newId = itemId.replace(UtilBean.ITEMIDHEAD, jTextField3.getText()); + String replace = newId.replace(UtilBean.YEAR, String.valueOf(Year.now().getValue())); + System.out.println("replace:" + replace); + TCComponentItem saveAsItem; + try { + saveAsItem = item.getLatestItemRevision().saveAsItem(replace, null); + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + //创建失败 已存在于TC + MessageBox.post(resource.getString(CJSB) + ",ID【" + replace + "】" + resource.getString(YCZYTC), + resource.getString(TS), MessageBox.INFORMATION); + return; + } + // 判断版本下面是否有数据集,有的话需要改变数据集的名字 + TCComponent[] spectficationObj = saveAsItem.getLatestItemRevision() + .getReferenceListProperty(UtilBean.IMANSPECIFICATION); + if (spectficationObj != null && spectficationObj.length > 0) { + for (TCComponent tcComponent : spectficationObj) { + if (tcComponent instanceof TCComponentDataset) { + TCComponentDataset dataset = (TCComponentDataset) tcComponent; + String datasettName = dataset.getStringProperty(UtilBean.OBJECTNAMR); + String[] splitName = datasettName.split("-"); + TCComponentDataset newDataset = dataset + .saveAs(replace + splitName[splitName.length - 1]); + + saveAsItem.getLatestItemRevision().remove(UtilBean.IMANSPECIFICATION, spectficationObj); + saveAsItem.getLatestItemRevision().add(UtilBean.IMANSPECIFICATION, newDataset); + + // 改变内置文件名 + String oldFileName = dataset.getRelatedComponent(UtilBean.REFLIST) + .getProperty(UtilBean.ORIGINALFILENAME); + // 分离文件名和扩展名 + int dotIndex = oldFileName.lastIndexOf('.'); + String extension = ""; + if (dotIndex != -1) { + extension = oldFileName.substring(dotIndex); + oldFileName = oldFileName.substring(0, dotIndex); + // 替换文件名前缀并添加原来的扩展名 + String newFileName = replace + splitName[splitName.length - 1] + extension; + newDataset.getRelatedComponent(UtilBean.REFLIST).setProperty(UtilBean.ORIGINALFILENAME, + newFileName); + } else { + newDataset.getRelatedComponent(UtilBean.REFLIST).setProperty(UtilBean.ORIGINALFILENAME, + replace + splitName[splitName.length - 1]); + } + break; + } + + } + + } + // 替换属性 - for (String attrStr : sxxAttrDate) { - if (attrStr.startsWith(saveAsItem.getStringProperty("object_type"))) { + for (String attrStr : createDOCAttribute) { + if (attrStr.startsWith(saveAsItem.getStringProperty(UtilBean.OBJECTTYPE))) { try { String[] replaces = attrStr.split("=")[1].split(";"); - for (String replace : replaces) { - String[] getValues = replace.split("\\."); + for (String replace1 : replaces) { + String[] getValues = replace1.split("\\."); Object val = ""; - if (getValues[0].equals("item")) { + if (getValues[0].equals(UtilBean.ITEM)) { + //替换item属性 val = Util.getTCPropertyValue(item, getValues[1]); Util.setTCPropertyValue(saveAsItem, getValues[1], val); - // val = item.getProperty(getValues[1]); - } else if (getValues[0].equals("rev")) { + } else if (getValues[0].equals(UtilBean.REV)) { + //替换版本属性 val = Util.getTCPropertyValue(item.getLatestItemRevision(), getValues[1]); Util.setTCPropertyValue(saveAsItem.getLatestItemRevision(), getValues[1], val); - // val = rev.getProperty(getValues[1]); - } else if (getValues[0].equals("rm")) { + } else if (getValues[0].equals(UtilBean.RM)) { + //替换版本表单属性 TCComponent[] oldreferenceListProperty = item.getLatestItemRevision() - .getReferenceListProperty("IMAN_master_form_rev"); + .getReferenceListProperty(UtilBean.IMANMASTERFORMREV); TCComponentForm oldform = (TCComponentForm) oldreferenceListProperty[0]; val = Util.getTCPropertyValue(oldform, getValues[1]); TCComponent[] newreferenceListProperty = saveAsItem.getLatestItemRevision() - .getReferenceListProperty("IMAN_master_form_rev"); + .getReferenceListProperty(UtilBean.IMANMASTERFORMREV); TCComponentForm newform = (TCComponentForm) newreferenceListProperty[0]; Util.setTCPropertyValue(newform, getValues[1], val); - // val = form.getProperty(getValues[1]); } } } catch (Exception e1) { @@ -340,51 +439,58 @@ public class CreateTemplateDialg extends JFrame { } - /** - * 创建树 - * - * @param tree - */ + /** + * + * @Title: initTree + * @Description: 初始化树结构 + * @param @param tree 参数 + * @return void 返回类型 + * @throws + */ private void initTree(JTree tree) { - String puids = sxxdate[0].split("=")[1]; + String puids = createDOCtemplate[0].split("=")[1]; System.out.println(puids); - String releaseNames = sxxdate[1].split("=")[1]; + String releaseNames = createDOCtemplate[1].split("=")[1]; System.out.println(releaseNames); try { - CheckBoxTreeNode rootNode = new CheckBoxTreeNode("模板"); + //模板 + CheckBoxTreeNode rootNode = new CheckBoxTreeNode(resource.getString(MB)); TCComponent tcComponent = session.stringToComponent(puids); String[] releaseName = releaseNames.split(";"); - System.out.println(tcComponent.getStringProperty("object_string")); -// Map>> foMap = new HashMap>>(); - - + System.out.println(tcComponent.getStringProperty(UtilBean.OBJECTSTRING)); + + //根据分号分割,获取关系名称,循环创建关系下的对象 for (String release : releaseName) { System.out.println("release:" + release); String[] attr = release.split("-"); CheckBoxTreeNode childNode = new CheckBoxTreeNode(attr[1]); rootNode.add(childNode); - nodeIsSelectMap.put(attr[0], childNode); TCComponent[] pseudoFolders = tcComponent.getReferenceListProperty(attr[0]); - if(pseudoFolders!=null) { + if (pseudoFolders != null) { List> components = new ArrayList>(); for (TCComponent reCompont : pseudoFolders) { Map map = new HashMap(); - CheckBoxTreeNode topNode = new CheckBoxTreeNode(reCompont.getStringProperty("object_string")); + CheckBoxTreeNode topNode = new CheckBoxTreeNode(reCompont.getStringProperty(UtilBean.OBJECTSTRING)); childNode.add(topNode); map.put(reCompont, topNode); components.add(map); + //循环创建子节点 buildTree(reCompont, topNode); } // 将List集合放入Map中,与伪文件夹关系对象 isSavaAsMap.put(childNode, components); } } + + //渲染Jtree复选框 DefaultTreeModel model = new DefaultTreeModel(rootNode); tree.addMouseListener(new CheckBoxTreeNodeSelectionListener()); tree.setModel(model); tree.setCellRenderer(new CheckBoxTreeCellRenderer()); + tree.setRowHeight(0); + // 展开所有节点并选中 for (int i = 0; i < tree.getRowCount(); i++) { tree.expandRow(i); @@ -403,16 +509,16 @@ public class CreateTemplateDialg extends JFrame { * @throws TCException */ private void buildTree(TCComponent component, CheckBoxTreeNode topNode) throws TCException { - TCComponent[] relatedComponent = component.getReferenceListProperty("contents"); + TCComponent[] relatedComponent = component.getReferenceListProperty(UtilBean.CONTENTS); if (relatedComponent != null && relatedComponent.length > 0) { - System.out.println("存储的长度"+relatedComponent.length); + System.out.println("length:" + relatedComponent.length); Map isSelectMap = new HashMap(); for (TCComponent child : relatedComponent) { - CheckBoxTreeNode childNode = new CheckBoxTreeNode(child.getStringProperty("object_string")); + CheckBoxTreeNode childNode = new CheckBoxTreeNode(child.getStringProperty(UtilBean.OBJECTSTRING)); isSelectMap.put(child, childNode); topNode.add(childNode); } - isSelectByNodeMap.put(component.getStringProperty("object_string"), isSelectMap); + isSelectByNodeMap.put(component.getStringProperty(UtilBean.OBJECTSTRING), isSelectMap); } } diff --git a/src/com/connor/kwc/createBom/CheckBoxTreeCellRenderer.java b/src/com/connor/kwc/jtreeUtilClass/CheckBoxTreeCellRenderer.java similarity index 98% rename from src/com/connor/kwc/createBom/CheckBoxTreeCellRenderer.java rename to src/com/connor/kwc/jtreeUtilClass/CheckBoxTreeCellRenderer.java index 18d6c65..17497ef 100644 --- a/src/com/connor/kwc/createBom/CheckBoxTreeCellRenderer.java +++ b/src/com/connor/kwc/jtreeUtilClass/CheckBoxTreeCellRenderer.java @@ -4,7 +4,7 @@ * @author admin * @date 2023年12月20日 * @version V1.0 */ -package com.connor.kwc.createBom; +package com.connor.kwc.jtreeUtilClass; import java.awt.Color; import java.awt.Component; diff --git a/src/com/connor/kwc/createBom/CheckBoxTreeLabel.java b/src/com/connor/kwc/jtreeUtilClass/CheckBoxTreeLabel.java similarity index 98% rename from src/com/connor/kwc/createBom/CheckBoxTreeLabel.java rename to src/com/connor/kwc/jtreeUtilClass/CheckBoxTreeLabel.java index 454a140..6720176 100644 --- a/src/com/connor/kwc/createBom/CheckBoxTreeLabel.java +++ b/src/com/connor/kwc/jtreeUtilClass/CheckBoxTreeLabel.java @@ -4,7 +4,7 @@ * @author admin * @date 2023年12月20日 * @version V1.0 */ -package com.connor.kwc.createBom; +package com.connor.kwc.jtreeUtilClass; import java.awt.Color; import java.awt.Dimension; diff --git a/src/com/connor/kwc/createBom/CheckBoxTreeNode.java b/src/com/connor/kwc/jtreeUtilClass/CheckBoxTreeNode.java similarity index 92% rename from src/com/connor/kwc/createBom/CheckBoxTreeNode.java rename to src/com/connor/kwc/jtreeUtilClass/CheckBoxTreeNode.java index 88ffe4e..c2eecb3 100644 --- a/src/com/connor/kwc/createBom/CheckBoxTreeNode.java +++ b/src/com/connor/kwc/jtreeUtilClass/CheckBoxTreeNode.java @@ -4,9 +4,16 @@ * @author admin * @date 2023年12月20日 * @version V1.0 */ -package com.connor.kwc.createBom; +package com.connor.kwc.jtreeUtilClass; +import java.awt.Component; +import java.util.Enumeration; + +import javax.swing.JTree; import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.TreeNode; +import javax.swing.tree.TreePath; /** * @ClassName: CheckBoxTreeNode @@ -17,7 +24,7 @@ import javax.swing.tree.DefaultMutableTreeNode; */ public class CheckBoxTreeNode extends DefaultMutableTreeNode { - protected boolean isSelected; + public boolean isSelected; public CheckBoxTreeNode() { this(null); @@ -94,4 +101,7 @@ public class CheckBoxTreeNode extends DefaultMutableTreeNode { // pNode.setSelected(_isSelected); } } + + + } diff --git a/src/com/connor/kwc/createBom/CheckBoxTreeNodeSelectionListener.java b/src/com/connor/kwc/jtreeUtilClass/CheckBoxTreeNodeSelectionListener.java similarity index 80% rename from src/com/connor/kwc/createBom/CheckBoxTreeNodeSelectionListener.java rename to src/com/connor/kwc/jtreeUtilClass/CheckBoxTreeNodeSelectionListener.java index 93afd2f..db93c16 100644 --- a/src/com/connor/kwc/createBom/CheckBoxTreeNodeSelectionListener.java +++ b/src/com/connor/kwc/jtreeUtilClass/CheckBoxTreeNodeSelectionListener.java @@ -4,13 +4,17 @@ * @author admin * @date 2023年12月20日 * @version V1.0 */ -package com.connor.kwc.createBom; +package com.connor.kwc.jtreeUtilClass; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.JTree; import javax.swing.tree.TreePath; + +import com.connor.kwc.util.Util; + +import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeModel; /** @@ -25,6 +29,7 @@ public class CheckBoxTreeNodeSelectionListener extends MouseAdapter { @Override public void mouseClicked(MouseEvent event) { JTree tree = (JTree) event.getSource(); + int x = event.getX(); int y = event.getY(); int row = tree.getRowForLocation(x, y); @@ -35,6 +40,10 @@ public class CheckBoxTreeNodeSelectionListener extends MouseAdapter { boolean isSelected = !node.isSelected(); node.setSelected(isSelected); ((DefaultTreeModel) tree.getModel()).nodeStructureChanged(node); + // 展开所有节点并选中 + for (int i = 0; i < tree.getRowCount(); i++) { + tree.expandRow(i); + } } } } diff --git a/src/com/connor/kwc/message/Message.properties b/src/com/connor/kwc/message/Message.properties index 19fb2db..e99aff7 100644 --- a/src/com/connor/kwc/message/Message.properties +++ b/src/com/connor/kwc/message/Message.properties @@ -1,2 +1,11 @@ xz=select -zjdx=Component object \ No newline at end of file +zjdx=Component object +yjmbcj=Create based on template +cpdh=Product code: +qd=determine +cpdhbnwk=Product code cannot be empty! +ts=prompt +mb=template +cjcg=Created successfully +cjsb=Creation failed +yczytc=Already exists in TC \ No newline at end of file diff --git a/src/com/connor/kwc/message/Message_zh_CN.properties b/src/com/connor/kwc/message/Message_zh_CN.properties index 6a02e2f..9d41a17 100644 --- a/src/com/connor/kwc/message/Message_zh_CN.properties +++ b/src/com/connor/kwc/message/Message_zh_CN.properties @@ -1,2 +1,11 @@ xz=\u9009\u62e9 -zjdx=\u7ec4\u4ef6\u5bf9\u8c61 \ No newline at end of file +zjdx=\u7ec4\u4ef6\u5bf9\u8c61 +yjmbcj=\u4F9D\u636E\u6A21\u677F\u521B\u5EFA +cpdh=\u4EA7\u54C1\u4EE3\u53F7\uFF1A +qd=\u786E\u5B9A +cpdhbnwk=\u4EA7\u54C1\u4EE3\u53F7\u4E0D\u80FD\u4E3A\u7A7A\uFF01 +ts=\u63D0\u793A +mb=\u6A21\u677F +cjcg=\u521B\u5EFA\u6210\u529F +cjsb=\u521B\u5EFA\u5931\u8D25 +yczytc=\u5DF2\u5B58\u5728\u4E8ETC \ No newline at end of file diff --git a/src/com/connor/kwc/util/Util.java b/src/com/connor/kwc/util/Util.java index ad4af12..248eca5 100644 --- a/src/com/connor/kwc/util/Util.java +++ b/src/com/connor/kwc/util/Util.java @@ -10,10 +10,15 @@ import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Arrays; import java.util.Date; +import java.util.Enumeration; import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.swing.JTree; +import javax.swing.tree.TreeNode; +import javax.swing.tree.TreePath; + import com.teamcenter.rac.aif.AbstractAIFApplication; import com.teamcenter.rac.aif.kernel.AIFComponentContext; import com.teamcenter.rac.aifrcp.AIFUtility; @@ -61,14 +66,38 @@ public class Util { textService = session.getTextService(); } + + /** * - * @Title: getRevisionPseudoFolder + * @Title: expandAll + * @Description: 扩展或折叠指定路径下的所有节点的方法 + * @param @param tree + * @param @param parent + * @param @param expand 参数 + * @return void 返回类型 + * @throws + */ + public static void expandAll(JTree tree, TreePath parent, boolean expand) { + TreeNode node = (TreeNode) parent.getLastPathComponent(); + if (node.getChildCount() >= 0) { + for (Enumeration e = node.children(); e.hasMoreElements();) { + TreeNode n = (TreeNode) e.nextElement(); + TreePath path = parent.pathByAddingChild(n); + tree.expandPath(path); // 展开路径 + expandAll(tree, path, expand); // 递归展开其子节点 + } + } + } + + /** + * + * @Title: getRevisionPseudoFolder * @Description: 获取伪文件夹 - * @param @param itemRev - * @param @param relation - * @param @return 参数 - * @return TCComponentPseudoFolder 返回类型 + * @param @param itemRev + * @param @param relation + * @param @return 参数 + * @return TCComponentPseudoFolder 返回类型 * @throws */ public static TCComponentPseudoFolder getRevisionPseudoFolder(TCComponent tcComponent, String relation) { @@ -94,17 +123,16 @@ public class Util { } return realtionFolder; } - - + /** * - * @Title: queryObject + * @Title: queryObject * @Description: 调用查询方法 - * @param @param queryName - * @param @param keys - * @param @param values - * @param @return 参数 - * @return List 返回类型 + * @param @param queryName + * @param @param keys + * @param @param values + * @param @return 参数 + * @return List 返回类型 * @throws */ public static List queryObject(String queryName, String[] keys, String[] values) { @@ -133,12 +161,12 @@ public class Util { /** * - * @Title: getTCPropertyValue + * @Title: getTCPropertyValue * @Description: 获取属性的真实值 - * @param @param item - * @param @param propertyName - * @param @return 参数 - * @return Object 返回类型 + * @param @param item + * @param @param propertyName + * @param @return 参数 + * @return Object 返回类型 * @throws */ public static Object getTCPropertyValue(TCComponent item, String propertyName) { @@ -177,12 +205,12 @@ public class Util { /** * - * @Title: setTCPropertyValue + * @Title: setTCPropertyValue * @Description: 根据对象属性类别赋值 * @param @param item * @param @param propertyName - * @param @param value 参数 - * @return void 返回类型 + * @param @param value 参数 + * @return void 返回类型 * @throws */ public static void setTCPropertyValue(TCComponent item, String propertyName, Object value) { @@ -224,8 +252,6 @@ public class Util { } } - - /** * * @Title: getSXX @@ -283,7 +309,7 @@ public class Util { userservice.call("Connor_open_bypass", new Object[] { val }); System.out.println(val ? "Open Bypass" : "Close Bypass"); } catch (Exception e) { - e.printStackTrace(); + System.out.println("【Connor_open_bypass】命名的方法未注册有用户服务"); } } diff --git a/src/com/connor/kwc/util/UtilBean.java b/src/com/connor/kwc/util/UtilBean.java new file mode 100644 index 0000000..486b8dd --- /dev/null +++ b/src/com/connor/kwc/util/UtilBean.java @@ -0,0 +1,21 @@ +package com.connor.kwc.util; + +public class UtilBean { + public static final long serialVersionUID = 1L; + public final static String CREATRDOCTEMPLATE = "KWC_CreateDOCtemplate"; + public final static String CRWATEDOCATTRIBUTE = "KWC_CreateDOC_attribute"; + public final static String ITEMID = "item_id"; + public final static String OBJECTSTRING = "object_string"; + public final static String OBJECTNAMR = "object_name"; + public final static String OBJECTTYPE = "object_type"; + public final static String CONTENTS = "contents"; + public final static String REFLIST = "ref_list"; + public final static String ORIGINALFILENAME = "original_file_name"; + public final static String ITEM = "item"; + public final static String REV = "rev"; + public final static String RM = "rm"; + public final static String IMANMASTERFORMREV = "IMAN_master_form_rev"; + public final static String IMANSPECIFICATION = "IMAN_specification"; + public final static String ITEMIDHEAD = "[CPDH]"; + public final static String YEAR = "[Y]"; +}