6/24 代码上传

main
zouxk 5 years ago
parent f38b7d55db
commit debd6d4df1

File diff suppressed because it is too large Load Diff

@ -27,7 +27,9 @@ Export-Package: com.connor.jd.operations,
com.connor.jd.plm.util,
com.connor.jd.plm.utils,
com.teamcenter.rac.stylesheet
Import-Package: com.teamcenter.services,
Import-Package: com.connor.jd.plm.beans,
com.connor.jd.plm.table,
com.teamcenter.services,
com.teamcenter.services.rac,
com.teamcenter.services.rac.core,
com.teamcenter.services.rac.core._2008_06,
@ -56,4 +58,6 @@ Bundle-ClassPath: .,
lib/xmlbeans-3.1.0.jar,
lib/commons-lang3-3.9.jar,
lib/ojdbc6.jar,
config/
config/,
lib/datepicker.jar,
lib/aspose-cells-18.9.jar

@ -24,5 +24,7 @@ bin.includes = plugin.xml,\
lib/xmlbeans-3.1.0.jar,\
lib/ojdbc6.jar,\
lib/commons-lang3-3.9.jar,\
config/
src/config/,\
lib/datepicker.jar,\
lib/aspose-cells-18.9.jar

@ -9,7 +9,7 @@
name="Sample Category">
</category>
<command categoryId="JDProject.commands.category" name="ItemTest" id="Item"></command>
<!--滚筒PLM菜单-->
<!--研发一部PLM菜单-->
<command categoryId="JDProject.commands.category" name="年度规划大纲" id="JD2_GTNDGHDG"></command>
<command categoryId="JDProject.commands.category" name="产品立项申请表" id="JD2_GTCPLXSQB"></command>
<command categoryId="JDProject.commands.category" name="潜在竞争对手和合作伙伴清单" id="JD2_GTQZHZHBQD"></command>
@ -24,11 +24,11 @@
<command categoryId="JDProject.commands.category" name="图纸下发单" id="JD2_GTTZXFD"></command>
<command categoryId="JDProject.commands.category" name="作业指导书" id="JD2_GTZYZDS"></command>
<command categoryId="JDProject.commands.category" name="工艺卡片" id="JD2_GTGYKP"></command>
<command categoryId="JDProject.commands.category" name="工艺流程" id="JD2_GTGYLC"></command>
<command categoryId="JDProject.commands.category" name="工艺流程" id="JD2_GTGYLC"></command>
<command categoryId="JDProject.commands.category" name="样件制造申请单" id="JD2_GTYJZZSQD"></command>
<command categoryId="JDProject.commands.category" name="试验委托书" id="JD2_GTSYWTS"></command>
<command categoryId="JDProject.commands.category" name="测试报告" id="JD2_GTCSBG"></command>
<command categoryId="JDProject.commands.category" name="模具图" id="JD2_GTMJT"></command>
<command categoryId="JDProject.commands.category" name="模具图" id="JD2_GTMJT"></command>
<command categoryId="JDProject.commands.category" name="模具设计评审单" id="JD2_GTMJSJPSD"></command>
<command categoryId="JDProject.commands.category" name="注塑模具试模反馈单" id="JD2_GTZSMJSMFKD"></command>
<command categoryId="JDProject.commands.category" name="尺寸报告" id="JD2_GTCCBG"></command>
@ -48,7 +48,7 @@
<command categoryId="JDProject.commands.category" name="小批样机评审单" id="JD2_GTXPYJPSD"></command>
<command categoryId="JDProject.commands.category" name="整机封样单" id="JD2_GTZJFYD"></command>
<command categoryId="JDProject.commands.category" name="结项评审书" id="JD2_GTJXPSS"></command>
<command categoryId="JDProject.commands.category" name="PVRD" id="PVRD"></command>
<command categoryId="JDProject.commands.category" name="变更点清单" id="JD2_GTBGDQD"></command>
<command categoryId="JDProject.commands.category" name="售后资料" id="JD2_GTXCJYWPXZL"></command>
<command categoryId="JDProject.commands.category" name="宣传及业务培训资料" id="JD2_GTSHZL"></command>
<command categoryId="JDProject.commands.category" name="时间表" id="Schedule"></command>
@ -56,12 +56,48 @@
<command categoryId="JDProject.commands.category" name="变更通知单" id="JD2_GTECN"></command>
<command categoryId="JDProject.commands.category" name="齐套性检查" id="JD2_GTQTXJC"></command>
<command categoryId="JDProject.commands.category" name="滚筒新品测试项清单" id="JD2_GTXPCSXQD"></command>
<!--波轮PLM菜单-->
<command categoryId="JDProject.commands.category" name="认证类别确认单" id="JD2_GTRZLBQRD"></command>
<command categoryId="JDProject.commands.category" name="物料清单" id="JD2_GTWLQD"></command>
<command categoryId="JDProject.commands.category" name="变更点清单" id="JD2_GTPRSCBGDQD"></command>
<command categoryId="JDProject.commands.category" name="测试计划" id="JD2_GTCSJH"></command>
<command categoryId="JDProject.commands.category" name="成本估算投资估算" id="JD2_GTCBGS"></command>
<command categoryId="JDProject.commands.category" name="软件规格书" id="JD2_GTRJGGS"></command>
<command categoryId="JDProject.commands.category" name="电气规格书" id="JD2_GTDQGGS"></command>
<command categoryId="JDProject.commands.category" name="CMF报告" id="JD2_GTCMFBG"></command>
<command categoryId="JDProject.commands.category" name="问题整改清单" id="JD2_GTWTZGQD"></command>
<command categoryId="JDProject.commands.category" name="专用件清单" id="JD2_GTZYZDS"></command>
<command categoryId="JDProject.commands.category" name="注塑模具开制审批单" id="JD2_GTZSMJKZPSD"></command>
<command categoryId="JDProject.commands.category" name="试模单" id="JD2_GTSMD"></command>
<command categoryId="JDProject.commands.category" name="试模检测报告单" id="JD2_GTSMJCBG"></command>
<command categoryId="JDProject.commands.category" name="模具评审报告单" id="JD2_GTMJPSBGD"></command>
<command categoryId="JDProject.commands.category" name="成本估算投资估算" id="JD2_GTKFYZTZGS"></command>
<command categoryId="JDProject.commands.category" name="型式试验报告" id="JD2_GTXSSYBG"></command>
<command categoryId="JDProject.commands.category" name="试验跟进表" id="JD2_GTSYGJB"></command>
<command categoryId="JDProject.commands.category" name="开发样机测试确认报告" id="JD2_GTKFYJQRCSBG"></command>
<command categoryId="JDProject.commands.category" name="问题点汇总与整改方案" id="JD2_GTWTDHZYZGFA"></command>
<command categoryId="JDProject.commands.category" name="3C认证" id="JD2_GT3CRZ"></command>
<command categoryId="JDProject.commands.category" name="安全认证" id="JD2_GTAQRZ"></command>
<command categoryId="JDProject.commands.category" name="CB认证" id="JD2_GTCBRZ"></command>
<command categoryId="JDProject.commands.category" name="型式试验报告" id="JD2_GTGYXSSYBG"></command>
<command categoryId="JDProject.commands.category" name="试验跟进表" id="JD2_GTGYSYGJB"></command>
<command categoryId="JDProject.commands.category" name="工艺样机测试确认报告" id="JD2_GTGYYJCSQRBG"></command>
<command categoryId="JDProject.commands.category" name="问题点汇总与整改方案" id="JD2_GTGYWYDHZ"></command>
<command categoryId="JDProject.commands.category" name="成本估算投资估算" id="JD2_GTLCCRCBGS"></command>
<command categoryId="JDProject.commands.category" name="问题点汇总与整改方案" id="JD2_GTLCWTDHZ"></command>
<command categoryId="JDProject.commands.category" name="出厂检测报告" id="JD2_GTCCJCBG"></command>
<command categoryId="JDProject.commands.category" name="整机封样" id="JD2_GTZJFY"></command>
<command categoryId="JDProject.commands.category" name="整机式样书" id="JD2_GTZJSYS"></command>
<command categoryId="JDProject.commands.category" name="整机出厂检测报告" id="JD2_GTZJCCJCBG"></command>
<command categoryId="JDProject.commands.category" name="整机封样" id="JD2_GTZJFY"></command>
<command categoryId="JDProject.commands.category" name="专用零部件进货检查统计报告" id="JD2_GTZYLBJJCBG"></command>
<command categoryId="JDProject.commands.category" name="PQC检验工程不良数据及问题点" id="JD2_GTWTD"></command>
<command categoryId="JDProject.commands.category" name="SRA评审单" id="JD2_GTSRAPSD"></command>
<command categoryId="JDProject.commands.category" name="软件释放单" id="JD2_GTRJSFD"></command>
<!--研发二部PLM菜单-->
<command categoryId="JDProject.commands.category" name="年度规划大纲" id="JD2_BLNDGHDG"></command>
<command categoryId="JDProject.commands.category" name="产品立项申请表" id="JD2_BLCPLXSQB"></command>
<command categoryId="JDProject.commands.category" name="潜在竞争对手和合作伙伴清单" id="JD2_BLQZHZHBQD"></command>
<command categoryId="JDProject.commands.category" name="知识产权检索申请单" id="JD2_BLZSCQJSSQD"></command>
<command categoryId="JDProject.commands.category" name="设计评审报告" id="JD2_BLSJPSBG"></command>
<command categoryId="JDProject.commands.category" name="产品规格书" id="JD2_BLCPGGS"></command>
<command categoryId="JDProject.commands.category" name="立项评审单" id="JD2_BLLXPSD"></command>
<command categoryId="JDProject.commands.category" name="手版样机评审单" id="JD2_BLSBYJPSD"></command>
@ -93,14 +129,26 @@
<command categoryId="JDProject.commands.category" name="试验委托书" id="JD2_BLSYWTS"></command>
<command categoryId="JDProject.commands.category" name="测试报告" id="JD2_BLCSBG"></command>
<command categoryId="JDProject.commands.category" name="小批样机评审单" id="JD2_BLXPYJPSD"></command>
<command categoryId="JDProject.commands.category" name="结项总结报告" id="JD2_BLXMZJBG"></command>
<command categoryId="JDProject.commands.category" name="宣传及业务培训资料" id="JD2_BLXCJYWPXZL"></command>
<command categoryId="JDProject.commands.category" name="售后资料" id="JD2_BLSHZL"></command>
<command categoryId="JDProject.commands.category" name="时间表" id="Schedule"></command>
<command categoryId="JDProject.commands.category" name="问题点" id="JD2_PROBLEM"></command>
<command categoryId="JDProject.commands.category" name="变更通知单" id="JD2_BLECN"></command>
<command categoryId="JDProject.commands.category" name="齐套性检查" id="JD2_BLQTXJC"></command>
<!--冰箱PLM菜单-->
<command categoryId="JDProject.commands.category" name="立项报告" id="JD2_BLLXBG"></command>
<command categoryId="JDProject.commands.category" name="项目计划表" id="JD2_BLXMJHB"></command>
<command categoryId="JDProject.commands.category" name="设计任务书" id="JD2_BLSJRWS"></command>
<command categoryId="JDProject.commands.category" name="设计和开发确认报告" id="JD2_BLSJHKFQRBG"></command>
<command categoryId="JDProject.commands.category" name="设计和开发验证报告" id="JD2_BLSJHKFYZBG"></command>
<command categoryId="JDProject.commands.category" name="整改报告" id="JD2_BLZGBG"></command>
<command categoryId="JDProject.commands.category" name="测试报告" id="JD2_BLGYYJCSBG"></command>
<command categoryId="JDProject.commands.category" name="试验委托书" id="JD2_BLGYYJSYWTS"></command>
<command categoryId="JDProject.commands.category" name="整改报告" id="JD2_BLGYYJZGBG"></command>
<command categoryId="JDProject.commands.category" name="测试报告" id="JD2_BLPRSCCSBG"></command>
<command categoryId="JDProject.commands.category" name="试验委托书" id="JD2_BLPRSCSYWTS"></command>
<command categoryId="JDProject.commands.category" name="整改报告" id="JD2_BLPRSCZGBG"></command>
<command categoryId="JDProject.commands.category" name="改模图" id="JD2_BLGMT"></command>
<!--研发五部PLM菜单-->
<command categoryId="JDProject.commands.category" name="年度规划大纲" id="JD2_BXNDGHDG"></command>
<command categoryId="JDProject.commands.category" name="产品立项申请表" id="JD2_BXCPLXSQB"></command>
<command categoryId="JDProject.commands.category" name="潜在竞争对手和合作伙伴清单" id="JD2_BXQZHZHBQD"></command>
@ -153,6 +201,9 @@
<command categoryId="JDProject.commands.category" name="物料图纸修订" id="WLTZRevise"></command>
<command categoryId="JDProject.commands.category" name="测试项维护" id="JD2_CSXWH"></command>
<command categoryId="JDProject.commands.category" name="DBOM转EBOM" id="dbomtoebom"></command>
<command categoryId="JDProject.commands.category" name="回料BOM新增" id="ADD_HLBOM"></command>
<command categoryId="JDProject.commands.category" name="BOM管理" id="BOMManagement "></command>
</extension>
<extension
point="org.eclipse.ui.handlers">
@ -197,7 +248,7 @@
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTXPYJPSD"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTZJFYD"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTJXPSS"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="PVRD"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTBGDQD"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTXCJYWPXZL"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTSHZL"></handler>
<handler class="com.connor.jd.plm.handlers.QTXJCHandler" commandId="JD2_GTQTXJC"></handler>
@ -239,7 +290,6 @@
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_BLSYWTS"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_BLCSBG"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_BLXPYJPSD"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_BLXMZJBG"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_BLXCJYWPXZL"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_BLSHZL"></handler>
<handler class="com.connor.jd.plm.handlers.QTXJCHandler" commandId="JD2_BLQTXJC"></handler>
@ -287,16 +337,67 @@
<handler class="com.connor.jd.plm.handlers.QTXJCHandler" commandId="JD2_BXQTXJC"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_BXECN"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_BXSJPSBG"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_BLSJPSBG"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTSJPSBG"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_BXSJJHS"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_BXSJRWS"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTXPCSXQD"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_BLLXBG"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_BLXMJHB"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_BLSJRWS"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_BLSJHKFQRBG"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_BLSJHKFYZBG"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_BLZGBG"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTRZLBQRD"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTWLQD"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTPRSCBGDQD"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_BLGYYJCSBG"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_BLGYYJSYWTS"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_BLGYYJZGBG"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_BLPRSCCSBG"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_BLPRSCSYWTS"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_BLPRSCZGBG"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTCSJH"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTCBGS"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTRJGGS"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTDQGGS"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTCMFBG"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTWTZGQD"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTZYZDS"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTZSMJKZPSD"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTSMD"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTSMJCBG"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTMJPSBGD"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTKFYZTZGS"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTXSSYBG"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTSYGJB"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTKFYJQRCSBG"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTWTDHZYZGFA"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GT3CRZ"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTAQRZ"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTCBRZ"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTGYXSSYBG"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTGYSYGJB"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTGYYJCSQRBG"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTGYWYDHZ"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTLCCRCBGS"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTLCWTDHZ"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTCCJCBG"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTZJFY"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTZJSYS"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTZJCCJCBG"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTZJFY"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTZYLBJJCBG"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTWTD"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTSRAPSD"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_BLGMT"></handler>
<handler class="com.connor.jd.plm.handlers.CreateItemHandler" commandId="JD2_GTRJSFD"></handler>
<handler class="com.connor.jd.plm.handlers.CSXWHHandler" commandId="JD2_CSXWH"></handler>
<handler commandId="editClassification" class="com.connor.jd.plm.handlers.EditClassificationHandler"></handler>
<handler commandId="WLTZRevise" class="com.connor.jd.plm.handlers.WLTZReviseHandler"></handler>
<handler commandId="dbomtoebom" class="com.connor.jd.plm.handlers.TransformDesignToPartHandler"></handler>
<handler commandId="ADDHLBOM" class="com.connor.jd.plm.handlers.AddHLBOMHandler"></handler>
<handler commandId="BOMManagement" class="com.connor.jd.plm.handlers.BOMManagementHandler"></handler>
</extension>
<extension
point="org.eclipse.ui.bindings">
@ -311,7 +412,7 @@
point="org.eclipse.ui.menus">
<menuContribution
locationURI="menu:org.eclipse.ui.main.menu?after=additions">
<menu id="JDProject.menus.JD2_GTPLMMENU" label="滚筒PLM菜单" mnemonic="M">
<menu id="JDProject.menus.JD2_GTPLMMENU" label="研发一部PLM菜单" mnemonic="M">
<menu id="JDProject.menus.JD2_GTXMJFW" label="项目交付物" mnemonic="M">
<menu id="JDProject.menus.JD2_GTCPQH" label="产品企划" mnemonic="M">
<command commandId="JD2_GTNDGHDG" id="JDProject.menus.JD2_GTNDGHDG" mnemonic="S"></command>
@ -321,9 +422,18 @@
<command commandId="JD2_GTCPGGS" id="JDProject.menus.JD2_GTCPGGS" mnemonic="S"></command>
<command commandId="JD2_GTLXPSD" id="JDProject.menus.JD2_GTLXPSD" mnemonic="S"></command>
<command commandId="JD2_GTSJPSBG" id="JDProject.menus.JD2_GTSJPSBG" mnemonic="S"></command>
<command commandId="JD2_GTBGDQD" id="JDProject.menus.JD2_GTBGDQD" mnemonic="S"></command>
<command commandId="JD2_GTRZLBQRD" id="JDProject.menus.JD2_GTRZLBQRD" mnemonic="S"></command>
<command commandId="JD2_GTCSJH" id="JDProject.menus.JD2_GTCSJH" mnemonic="S"></command>
<command commandId="JD2_GTCBGS" id="JDProject.menus.JD2_GTCBGS" mnemonic="S"></command>
</menu>
<menu id="JDProject.menus.JD2_GTSBYJ" label="手版样机" mnemonic="M">
<command commandId="JD2_GTSBYJPSD" id="JDProject.menus.JD2_GTSBYJPSD" mnemonic="S"></command>
<command commandId="JD2_GTWLQD" id="JDProject.menus.JD2_GTWLQD" mnemonic="S"></command>
<command commandId="JD2_GTRJGGS" id="JDProject.menus.JD2_GTRJGGS" mnemonic="S"></command>
<command commandId="JD2_GTDQGGS" id="JDProject.menus.JD2_GTDQGGS" mnemonic="S"></command>
<command commandId="JD2_GTCMFBG" id="JDProject.menus.JD2_GTCMFBG" mnemonic="S"></command>
<command commandId="JD2_GTWTZGQD" id="JDProject.menus.JD2_GTWTZGQD" mnemonic="S"></command>
</menu>
<menu id="JDProject.menus.JD2_GTKFYJ" label="开发样机" mnemonic="M">
<command commandId="JD2_GTTZPSD" id="JDProject.menus.JD2_GTTZPSD" mnemonic="S"></command>
@ -347,6 +457,17 @@
<command commandId="JD2_GTYPQRD" id="JDProject.menus.JD2_GTYPQRD" mnemonic="S"></command>
<command commandId="JD2_GTKFYJPSD" id="JDProject.menus.JD2_GTKFYJPSD" mnemonic="S"></command>
<command commandId="JD2_GTXPCSXQD" id="JDProject.menus.JD2_GTXPCSXQD" mnemonic="S"></command>
<command commandId="JD2_GTZYZDS" id="JDProject.menus.JD2_GTZYZDS" mnemonic="S"></command>
<command commandId="JD2_GTZSMJKZPSD" id="JDProject.menus.JD2_GTZSMJKZPSD" mnemonic="S"></command>
<command commandId="JD2_GTSMD" id="JDProject.menus.JD2_GTSMD" mnemonic="S"></command>
<command commandId="JD2_GTSMJCBG" id="JDProject.menus.JD2_GTSMJCBG" mnemonic="S"></command>
<command commandId="JD2_GTMJPSBGD" id="JDProject.menus.JD2_GTMJPSBGD" mnemonic="S"></command>
<command commandId="JD2_GTKFYZTZGS" id="JDProject.menus.JD2_GTKFYZTZGS" mnemonic="S"></command>
<command commandId="JD2_GTXSSYBG" id="JDProject.menus.JD2_GTXSSYBG" mnemonic="S"></command>
<command commandId="JD2_GTSYGJB" id="JDProject.menus.JD2_GTSYGJB" mnemonic="S"></command>
<command commandId="JD2_GTKFYJQRCSBG" id="JDProject.menus.JD2_GTKFYJQRCSBG" mnemonic="S"></command>
<command commandId="JD2_GTWTDHZYZGFA" id="JDProject.menus.JD2_GTWTDHZYZGFA" mnemonic="S"></command>
<command commandId="JD2_GTRJSFD" id="JDProject.menus.JD2_GTRJSFD" mnemonic="S"></command>
</menu>
<menu id="JDProject.menus.JD2_GTGYYJ" label="工艺样机" mnemonic="M">
<command commandId="JD2_GTRZZL" id="JDProject.menus.JD2_GTRZZL" mnemonic="S"></command>
@ -354,6 +475,13 @@
<command commandId="JD2_GTCSBG" id="JDProject.menus.JD2_GTCSBG" mnemonic="S"></command>
<command commandId="JD2_GTGYYJPSD" id="JDProject.menus.JD2_GTGYYJPSD" mnemonic="S"></command>
<command commandId="JD2_GTRZBG" id="JDProject.menus.JD2_GTRZBG" mnemonic="S"></command>
<command commandId="JD2_GT3CRZ" id="JDProject.menus.JD2_GT3CRZ" mnemonic="S"></command>
<command commandId="JD2_GTAQRZ" id="JDProject.menus.JD2_GTAQRZ" mnemonic="S"></command>
<command commandId="JD2_GTCBRZ" id="JDProject.menus.JD2_GTCBRZ" mnemonic="S"></command>
<command commandId="JD2_GTGYXSSYBG" id="JDProject.menus.JD2_GTGYXSSYBG" mnemonic="S"></command>
<command commandId="JD2_GTGYSYGJB" id="JDProject.menus.JD2_GTGYSYGJB" mnemonic="S"></command>
<command commandId="JD2_GTGYYJCSQRBG" id="JDProject.menus.JD2_GTGYYJCSQRBG" mnemonic="S"></command>
<command commandId="JD2_GTGYWYDHZ" id="JDProject.menus.JD2_GTGYWYDHZ" mnemonic="S"></command>
</menu>
<menu id="JDProject.menus.JD2_GTPRSC" label="PR试产" mnemonic="M">
<command commandId="JD2_GTSYWTS" id="JDProject.menus.JD2_GTSYWTS" mnemonic="S"></command>
@ -361,11 +489,21 @@
<command commandId="JD2_GTXPYJPSD" id="JDProject.menus.JD2_GTXPYJPSD" mnemonic="S"></command>
<command commandId="JD2_GTZJFYD" id="JDProject.menus.JD2_GTZJFYD" mnemonic="S"></command>
<command commandId="JD2_GTJXPSS" id="JDProject.menus.JD2_GTJXPSS" mnemonic="S"></command>
<command commandId="PVRD" id="JDProject.menus.PVRD" mnemonic="S"></command>
<command commandId="JD2_GTPRSCBGDQD" id="JDProject.menus.JD2_GTPRSCBGDQD" mnemonic="S"></command>
<command commandId="JD2_GTXCJYWPXZL" id="JDProject.menus.JD2_GTXCJYWPXZL" mnemonic="S"></command>
<command commandId="JD2_GTLCCRCBGS" id="JDProject.menus.JD2_GTLCCRCBGS" mnemonic="S"></command>
<command commandId="JD2_GTLCWTDHZ" id="JDProject.menus.JD2_GTLCWTDHZ" mnemonic="S"></command>
<command commandId="JD2_GTCCJCBG" id="JDProject.menus.JD2_GTCCJCBG" mnemonic="S"></command>
<command commandId="JD2_GTZJFY" id="JDProject.menus.JD2_GTZJFY" mnemonic="S"></command>
<command commandId="JD2_GTZJSYS" id="JDProject.menus.JD2_GTZJSYS" mnemonic="S"></command>
<command commandId="JD2_GTZJCCJCBG" id="JDProject.menus.JD2_GTZJCCJCBG" mnemonic="S"></command>
<command commandId="JD2_GTZJFY" id="JDProject.menus.JD2_GTZJFY" mnemonic="S"></command>
<command commandId="JD2_GTZYLBJJCBG" id="JDProject.menus.JD2_GTZYLBJJCBG" mnemonic="S"></command>
<command commandId="JD2_GTWTD" id="JDProject.menus.JD2_GTWTD" mnemonic="S"></command>
</menu>
<menu id="JDProject.menus.JD2_GTSRLC" label="SR量产" mnemonic="M">
<command commandId="JD2_GTSHZL" id="JDProject.menus.JD2_GTSHZL" mnemonic="S"></command>
<command commandId="JD2_GTSRAPSD" id="JDProject.menus.JD2_GTSRAPSD" mnemonic="S"></command>
</menu>
</menu>
<command commandId="Schedule" id="JDProject.menus.Schedule" mnemonic="S"></command>
@ -376,16 +514,18 @@
</menuContribution>
<menuContribution
locationURI="menu:org.eclipse.ui.main.menu?after=additions">
<menu id="JDProject.menus.JD2_BLPLMMENU" label="波轮PLM菜单" mnemonic="M">
<menu id="JDProject.menus.JD2_BLPLMMENU" label="研发二部PLM菜单" mnemonic="M">
<menu id="JDProject.menus.JD2_BLXMJFW" label="项目交付物" mnemonic="M">
<menu id="JDProject.menus.JD2_BLCPQH" label="产品企划" mnemonic="M">
<command commandId="JD2_BLNDGHDG" id="JDProject.menus.JD2_BLNDGHDG" mnemonic="S"></command>
<command commandId="JD2_BLCPLXSQB" id="JDProject.menus.JD2_BLCPLXSQB" mnemonic="S"></command>
<command commandId="JD2_BLQZHZHBQD" id="JDProject.menus.JD2_BLQZHZHBQD" mnemonic="S"></command>
<command commandId="JD2_BLZSCQJSSQD" id="JDProject.menus.JD2_BLZSCQJSSQD" mnemonic="S"></command>
<command commandId="JD2_BLSJPSBG" id="JDProject.menus.JD2_BLSJPSBG" mnemonic="S"></command>
<command commandId="JD2_BLCPGGS" id="JDProject.menus.JD2_BLCPGGS" mnemonic="S"></command>
<command commandId="JD2_BLLXPSD" id="JDProject.menus.JD2_BLLXPSD" mnemonic="S"></command>
<command commandId="JD2_BLLXBG" id="JDProject.menus.JD2_BLLXBG" mnemonic="S"></command>
<command commandId="JD2_BLXMJHB" id="JDProject.menus.JD2_BLXMJHB" mnemonic="S"></command>
<command commandId="JD2_BLSJRWS" id="JDProject.menus.JD2_BLSJRWS" mnemonic="S"></command>
</menu>
<menu id="JDProject.menus.JD2_BLSBYJ" label="手版样机" mnemonic="M">
<command commandId="JD2_BLSBYJPSD" id="JDProject.menus.JD2_BLSBYJPSD" mnemonic="S"></command>
@ -411,19 +551,26 @@
<command commandId="JD2_BLCPRZQRB" id="JDProject.menus.JD2_BLCPRZQRB" mnemonic="S"></command>
<command commandId="JD2_BLYPQRD" id="JDProject.menus.JD2_BLYPQRD" mnemonic="S"></command>
<command commandId="JD2_BLKFYJPSD" id="JDProject.menus.JD2_BLKFYJPSD" mnemonic="S"></command>
<command commandId="JD2_BLZGBG" id="JDProject.menus.JD2_BLZGBG" mnemonic="S"></command>
<command commandId="JD2_BLGMT" id="JDProject.menus.JD2_BLGMT" mnemonic="S"></command>
</menu>
<menu id="JDProject.menus.JD2_BLGYYJ" label="工艺样机" mnemonic="M">
<command commandId="JD2_BLRZZL" id="JDProject.menus.JD2_BLRZZL" mnemonic="S"></command>
<command commandId="JD2_BLSYWTS" id="JDProject.menus.JD2_BLSYWTS" mnemonic="S"></command>
<command commandId="JD2_BLCSBG" id="JDProject.menus.JD2_BLCSBG" mnemonic="S"></command>
<command commandId="JD2_BLGYYJSYWTS" id="JDProject.menus.JD2_BLGYYJSYWTS" mnemonic="S"></command>
<command commandId="JD2_BLGYYJCSBG" id="JDProject.menus.JD2_BLGYYJCSBG" mnemonic="S"></command>
<command commandId="JD2_BLGYYJPSD" id="JDProject.menus.JD2_BLGYYJPSD" mnemonic="S"></command>
<command commandId="JD2_BLRZBG" id="JDProject.menus.JD2_BLRZBG" mnemonic="S"></command>
<command commandId="JD2_BLGYYJZGBG" id="JDProject.menus.JD2_BLGYYJZGBG" mnemonic="S"></command>
<command commandId="JD2_BLGMT" id="JDProject.menus.JD2_BLGMT" mnemonic="S"></command>
</menu>
<menu id="JDProject.menus.JD2_BLPRSC" label="PR试产" mnemonic="M">
<command commandId="JD2_BLSYWTS" id="JDProject.menus.JD2_BLSYWTS" mnemonic="S"></command>
<command commandId="JD2_BLCSBG" id="JDProject.menus.JD2_BLCSBG" mnemonic="S"></command>
<command commandId="JD2_BLPRSCSYWTS" id="JDProject.menus.JD2_BLPRSCSYWTS" mnemonic="S"></command>
<command commandId="JD2_BLPRSCCSBG" id="JDProject.menus.JD2_BLPRSCCSBG" mnemonic="S"></command>
<command commandId="JD2_BLXPYJPSD" id="JDProject.menus.JD2_BLXPYJPSD" mnemonic="S"></command>
<command commandId="JD2_BLXMZJBG" id="JDProject.menus.JD2_BLXMZJBG" mnemonic="S"></command>
<command commandId="JD2_BLSJHKFQRBG" id="JDProject.menus.JD2_BLSJHKFQRBG" mnemonic="S"></command>
<command commandId="JD2_BLSJHKFYZBG" id="JDProject.menus.JD2_BLSJHKFYZBG" mnemonic="S"></command>
<command commandId="JD2_BLPRSCZGBG" id="JDProject.menus.JD2_BLPRSCZGBG" mnemonic="S"></command>
<command commandId="JD2_BLGMT" id="JDProject.menus.JD2_BLGMT" mnemonic="S"></command>
</menu>
<menu id="JDProject.menus.JD2_BLSRLC" label="SR量产" mnemonic="M">
<command commandId="JD2_BLXCJYWPXZL" id="JDProject.menus.JD2_BLXCJYWPXZL" mnemonic="S"></command>
@ -438,7 +585,7 @@
</menuContribution>
<menuContribution
locationURI="menu:org.eclipse.ui.main.menu?after=additions">
<menu id="JDProject.menus.JD2_BXPLMMENU" label="冰箱PLM菜单" mnemonic="M">
<menu id="JDProject.menus.JD2_BXPLMMENU" label="研发五部PLM菜单" mnemonic="M">
<menu id="JDProject.menus.JD2_BXXMJFW" label="项目交付物" mnemonic="M">
<menu id="JDProject.menus.JD2_BXCPQH" label="产品企划" mnemonic="M">
<command commandId="JD2_BXNDGHDG" id="JDProject.menus.JD2_BXNDGHDG" mnemonic="S"></command>
@ -506,6 +653,9 @@
<menu id="JDProject.menus.JD2_CSXWHMENU" label="测试项维护" mnemonic="M">
<command commandId="JD2_CSXWH" id="JDProject.menus.JD2_CSXWH" mnemonic="S"></command>
</menu>
</menuContribution>
<menuContribution locationURI="menu:org.eclipse.ui.main.menu?after=additions">
<command commandId="BOMManagement" id="JDProject.menus.BOMManagement" mnemonic="S"></command>
</menuContribution>
<menuContribution
locationURI="popup:org.eclipse.ui.popup.any?after=additions">
@ -530,6 +680,13 @@
id="com.connor.jd.WLTZRevise">
<visibleWhen>true</visibleWhen>
</command>
<command
commandId="ADDHLBOM"
mnemonic="S"
label="回料BOM新增"
id="com.connor.jd.ADDHLBOM">
<visibleWhen>true</visibleWhen>
</command>
</menuContribution>
</extension>

@ -1,10 +1,52 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
public class Test {
public static void main(String[] args) {
String fileName = "111.xlsx";
String[] filename = fileName.split("\\.");
System.out.println(fileName.lastIndexOf("."));
String[] arr = new String[] { "0,1", "1,10", "0,100", "xx", "1,2" };
Arrays.sort(arr, new Comparator<String>() {
@Override
public int compare(String o1, String o2) {
if (o1.indexOf(",") == -1 || o2.indexOf(",") == -1) {
return 0;
}
String[] temp1 = o1.split(",");
String[] temp2 = o2.split(",");
if (temp1[0].equals(temp2[0])) {
return Integer.parseInt(temp1[1]) - Integer.parseInt(temp2[1]);
} else {
return Integer.parseInt(temp1[0]) - Integer.parseInt(temp2[0]);
}
}
});
System.out.println(Arrays.toString(arr));
List<String> list1 = new ArrayList<String>();
List<String> list2 = new ArrayList<String>();
List<String> list3 = new ArrayList<String>();
for (int i = 0; i < arr.length; i++) {
if (arr[i].indexOf(",") == -1 || "0".equals(arr[i].split(",")[0])) {
list1.add(arr[i]);
} else {
list2.add(arr[i]);
}
}
int maxLength = Math.max(list1.size(), list2.size());
for (int i = 0; i < maxLength; i++) {
if (i > list1.size() - 1) {
list3.add("");
list3.add(list2.get(i));
} else if (i > list2.size() - 1) {
list3.add(list1.get(i));
list3.add("");
} else {
list3.add(list1.get(i));
list3.add(list2.get(i));
}
}
System.out.println(Arrays.toString(list3.toArray()));
}
}

@ -6,13 +6,17 @@ import java.sql.SQLException;
import java.sql.Statement;
import com.connor.jd.plm.utils.DBConnectionUtil;
import com.teamcenter.rac.aifrcp.AIFUtility;
import com.teamcenter.rac.kernel.TCSession;
public class CreateTableOperation {
private static Connection con = null;
private static Statement ps = null;
private static ResultSet rs = null;
private static TCSession session;
public static void create() {
session = (TCSession) AIFUtility.getCurrentApplication().getSession();
String createTable1 = "CREATE TABLE JD2_Component (test_type VARCHAR(255),test_project VARCHAR(255),test_time VARCHAR(255),test_num NUMBER,test_cost FLOAT, test_id NUMBER primary key)";
String createSeq1 = "CREATE sequence component_id_seq minvalue 1 nomaxvalue INCREMENT BY 1 START WITH 1 nocache";
String createTRG1 = "CREATE or REPLACE TRIGGER component_id_ins_trg before INSERT ON JD2_COMPONENT for each ROW BEGIN SELECT component_id_seq.Nextval into : new.TEST_ID from dual; END;";
@ -22,7 +26,7 @@ public class CreateTableOperation {
String createTRG2 = "CREATE or REPLACE TRIGGER machine_id_ins_trg before INSERT ON JD2_MACHINE for each ROW BEGIN SELECT machine_id_seq.Nextval into : new.TEST_ID from dual; END;";
String[] sqls = { createTable1, createSeq1, createTRG1, createTable2, createSeq2, createTRG2 };
try {
con = DBConnectionUtil.dbConn("infodba", "infodba");
con = DBConnectionUtil.dbConn(session);
String sqlString = "SELECT count(*) from user_tables WHERE table_name='JD2_COMPONENT'";
if (con == null) {
System.out.print("Á¬½Óʧ°Ü");

@ -0,0 +1,96 @@
package com.connor.jd.plm.action;
import java.util.Arrays;
import java.util.Comparator;
import javax.swing.JOptionPane;
import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aif.common.actions.AbstractAIFAction;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentItem;
import com.teamcenter.rac.kernel.TCComponentItemRevision;
import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.util.MessageBox;
public class AddHLBOMAction extends AbstractAIFAction {
private AbstractAIFApplication app;
private TCSession session;
public AddHLBOMAction(AbstractAIFApplication arg0, String arg1) {
super(arg0, arg1);
// TODO Auto-generated constructor stub
this.app = arg0;
this.session = (TCSession) app.getSession();
}
@Override
public void run() {
// TODO Auto-generated method stub
TCComponent target = (TCComponent) app.getTargetComponent();
TCComponentItemRevision rev = null;
if (target instanceof TCComponentItemRevision) {
rev = (TCComponentItemRevision) target;
} else if (target instanceof TCComponentItem) {
try {
rev = ((TCComponentItem) target).getLatestItemRevision();
} catch (TCException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
try {
TCComponent[] revs = rev.getRelatedComponents("JD2_HLBOM");
String itemId = rev.getProperty("item_id");
String itemName = rev.getProperty("object_name");
TCComponentItem newItem = null;
session.getUserService().call("bs_bypass", new Object[] { true });
if (revs.length == 0) {
newItem = rev.saveAsItem(itemId + "-1", null);
} else {
Arrays.sort(revs, new Comparator<TCComponent>() {
@Override
public int compare(TCComponent o1, TCComponent o2) {
// TODO Auto-generated method stub
try {
return o1.getProperty("item_id").compareTo(o2.getProperty("item_id"));
} catch (TCException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return 0;
}
});
String str = revs[revs.length - 1].getProperty("item_id");
str = str.split("-")[1];
newItem = rev.saveAsItem(itemId + "-" + (Integer.parseInt(str) + 1), null);
}
rev.add("JD2_HLBOM", newItem);
TCComponentItemRevision newRev = newItem.getLatestItemRevision();
TCComponent[] comps = newRev.getRelatedComponents("JD2_HLBOM");
System.out.println(Arrays.toString(comps));
newRev.cutOperation("JD2_HLBOM", comps);
newRev.lock();
newRev.setProperty("jd2_ishl", "1");
newRev.save();
newRev.unlock();
rev.refresh();
MessageBox.post("´´½¨³É¹¦", "Ìáʾ", MessageBox.WARNING);
} catch (TCException e) {
// TODO Auto-generated catch block
e.printStackTrace();
JOptionPane.showMessageDialog(null, e.getMessage(), "´íÎó", JOptionPane.ERROR_MESSAGE);
} finally {
try {
session.getUserService().call("bs_bypass", new Object[] { false });
} catch (TCException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}

@ -0,0 +1,23 @@
package com.connor.jd.plm.action;
import com.connor.jd.plm.dialogs.BOMManagementFrame;
import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aif.common.actions.AbstractAIFAction;
public class BOMManagementAction extends AbstractAIFAction {
private AbstractAIFApplication app;
public BOMManagementAction(AbstractAIFApplication arg0, String arg1) {
super(arg0, arg1);
// TODO Auto-generated constructor stub
this.app = arg0;
}
@Override
public void run() {
// TODO Auto-generated method stub
new BOMManagementFrame(app);
}
}

@ -0,0 +1,28 @@
package com.connor.jd.plm.action;
import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aif.common.actions.AbstractAIFAction;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentItemRevision;
import com.teamcenter.rac.kernel.TCSession;
public class ExportBOMAction extends AbstractAIFAction {
private AbstractAIFApplication app;
private TCSession session;
public ExportBOMAction(AbstractAIFApplication arg0, String arg1) {
super(arg0, arg1);
this.app = arg0;
this.session = (TCSession) app.getSession();
}
@Override
public void run() {
TCComponent target = (TCComponent) app.getTargetComponent();
TCComponentItemRevision rev;
if (target instanceof TCComponentItemRevision) {
}
}
}

@ -10,6 +10,7 @@ import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aif.common.actions.AbstractAIFAction;
import com.teamcenter.rac.aifrcp.AIFUtility;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentBOMLine;
import com.teamcenter.rac.kernel.TCComponentICO;
import com.teamcenter.rac.kernel.TCComponentItem;
import com.teamcenter.rac.kernel.TCComponentItemRevision;
@ -27,7 +28,6 @@ public class WLTZReviseAction extends AbstractAIFAction {
super(arg0, arg1);
this.app = arg0;
this.session = (TCSession) app.getSession();
}
@Override
@ -39,9 +39,24 @@ public class WLTZReviseAction extends AbstractAIFAction {
for (String s : list) {
System.out.println(s);
}
TCComponentItemRevision rev;
if (target instanceof TCComponentItemRevision) {
rev = (TCComponentItemRevision) target;
} else if (target instanceof TCComponentBOMLine) {
try {
rev = ((TCComponentBOMLine) target).getItemRevision();
} catch (TCException e) {
// TODO Auto-generated catch block
e.printStackTrace();
MessageBox.post(e.getMessage(), "错误", MessageBox.ERROR);
return;
}
} else {
MessageBox.post("当前对象类型不允许修订并发送分类!", "错误", MessageBox.ERROR);
return;
}
try {
TCComponentItemRevision rev = (TCComponentItemRevision) target;
String type = rev.getType();
System.out.println(type);
if (!list.contains(type)) {
@ -76,7 +91,7 @@ public class WLTZReviseAction extends AbstractAIFAction {
MessageBox.post(´ÅäÖÃjd2_server_ipÊ×Ñ¡Ïî", "´íÎó", MessageBox.ERROR);
return;
}
String url = "http://" + server + ":8080/classification";
String url = "http://" + server + ":8880/sendClassification";
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("uid", uid);
paramMap.put("cid", cid);
@ -96,9 +111,6 @@ public class WLTZReviseAction extends AbstractAIFAction {
// TODO Auto-generated catch block
e.printStackTrace();
}
} else {
MessageBox.post("当前对象类型不允许修订并发送分类!", "错误", MessageBox.ERROR);
}
}
/**

@ -0,0 +1,96 @@
package com.connor.jd.plm.beans;
import cn.hutool.core.util.StrUtil;
public class BOMExportBean {
private String pid;// 父id
private String prev;// 父版本
private String cid;// 子id
private String crev;// 子版本
private String childCount;// 子数量
private String childUnit;// 子单位
private String HLCount;// 回料数量
private String SN;// 编号
public BOMExportBean(String pid, String prev, String cid, String crev, String childCount, String childUnit,
String HLCount, String SN) {
super();
this.pid = pid;
this.prev = prev;
this.cid = cid;
this.crev = crev;
this.childCount = childCount;
this.childUnit = childUnit;
this.HLCount = HLCount;
this.SN = SN;
}
public String getPid() {
return pid;
}
public void setPid(String pid) {
this.pid = pid;
}
public String getPrev() {
return prev;
}
public void setPrev(String prev) {
this.prev = prev;
}
public String getCid() {
return cid;
}
public void setCid(String cid) {
this.cid = cid;
}
public String getCrev() {
return crev;
}
public void setCrev(String crev) {
this.crev = crev;
}
public String getChildCount() {
return childCount;
}
public void setChildCount(String childCount) {
this.childCount = childCount;
}
public String getChildUnit() {
return childUnit;
}
public void setChildUnit(String childUnit) {
this.childUnit = childUnit;
}
public String getHLCount() {
return HLCount;
}
public void setHLCount(String HLCount) {
this.HLCount = HLCount;
}
public String getSN() {
return SN;
}
public void setSN(String SN) {
this.SN = SN;
}
public int isNegative() {
return StrUtil.isBlank(HLCount) ? 0 : Integer.parseInt(HLCount) < 0 ? 1 : 0;
}
}

@ -0,0 +1,74 @@
package com.connor.jd.plm.beans;
import com.teamcenter.rac.kernel.TCComponentBOMLine;
import com.teamcenter.rac.kernel.TCComponentItemRevision;
public class BOMManageTableBean {
private String parentString;
private String childString;
private TCComponentItemRevision parentRev;
private TCComponentItemRevision childRev;
private TCComponentBOMLine parentLine;
private TCComponentBOMLine childLine;
public BOMManageTableBean(String parentString, String childString, TCComponentItemRevision parentRev,
TCComponentItemRevision childRev, TCComponentBOMLine parentLine, TCComponentBOMLine childLine) {
super();
this.parentString = parentString;
this.childString = childString;
this.parentRev = parentRev;
this.childRev = childRev;
this.parentLine = parentLine;
this.childLine = childLine;
}
public String getParentString() {
return parentString;
}
public void setParentString(String parentString) {
this.parentString = parentString;
}
public String getChildString() {
return childString;
}
public void setChildString(String childString) {
this.childString = childString;
}
public TCComponentItemRevision getParentRev() {
return parentRev;
}
public void setParentRev(TCComponentItemRevision parentRev) {
this.parentRev = parentRev;
}
public TCComponentItemRevision getChildRev() {
return childRev;
}
public void setChildRev(TCComponentItemRevision childRev) {
this.childRev = childRev;
}
public TCComponentBOMLine getParentLine() {
return parentLine;
}
public void setParentLine(TCComponentBOMLine parentLine) {
this.parentLine = parentLine;
}
public TCComponentBOMLine getChildLine() {
return childLine;
}
public void setChildLine(TCComponentBOMLine childLine) {
this.childLine = childLine;
}
}

@ -0,0 +1,14 @@
package com.connor.jd.plm.beans;
public class CheckBoxPo {
public Object value = null;
public String text = null;
public CheckBoxPo() {
}
public CheckBoxPo(String text, Object value) {
this.value = value;
this.text = text;
}
}

@ -0,0 +1,39 @@
package com.connor.jd.plm.beans;
public class ClassPropBean {
private int id;
private String name;
private String value;
public ClassPropBean(int id, String name, String value) {
super();
this.id = id;
this.name = name;
this.value = value;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}

@ -0,0 +1,38 @@
package com.connor.jd.plm.beans;
import java.util.ArrayList;
import java.util.List;
public class CustomLovBean {
private List<CustomLovBean> sub = new ArrayList<CustomLovBean>();
public String displayName = "";
public CustomLovBean(String displayName) {
super();
this.displayName = displayName;
}
public CustomLovBean(String displayName, String[] subArray) {
super();
this.displayName = displayName;
translateArrayToSub(subArray);
}
public void translateArrayToSub(String[] subArray) {
for (int i = 0; i < subArray.length; i++) {
sub.add(new CustomLovBean(subArray[i]));
}
}
public List<CustomLovBean> getSub() {
return sub;
}
public boolean hasChild() {
return sub.size() != 0;
}
public void addSub(CustomLovBean clb) {
sub.add(clb);
}
}

@ -0,0 +1,39 @@
package com.connor.jd.plm.beans;
public class ResultData {
private boolean res;
private String Message;
private Object data;
public ResultData(boolean res, String message, Object data) {
super();
this.res = res;
Message = message;
this.data = data;
}
public boolean isRes() {
return res;
}
public void setRes(boolean res) {
this.res = res;
}
public String getMessage() {
return Message;
}
public void setMessage(String message) {
Message = message;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
}

@ -1,39 +1,44 @@
package com.connor.jd.plm.dialog;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.ScrollPane;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import com.connor.jd.plm.beans.ClassPropBean;
import com.connor.jd.plm.utils.ExcelInfoScanner;
import com.connor.jd.plm.utils.JDMethodUtil;
import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aif.AbstractAIFDialog;
import com.teamcenter.rac.aifrcp.AIFUtility;
import com.teamcenter.rac.kernel.TCClassificationService;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentDataset;
import com.teamcenter.rac.kernel.TCComponentICO;
import com.teamcenter.rac.kernel.TCComponentItemRevision;
import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.kernel.ics.ICSApplicationObject;
import com.teamcenter.rac.kernel.ics.ICSAdminClass;
import com.teamcenter.rac.kernel.ics.ICSProperty;
import com.teamcenter.rac.kernel.ics.ICSPropertyDescription;
import com.teamcenter.rac.util.MessageBox;
import cn.hutool.json.JSONObject;
public class EditClassificationDialog extends AbstractAIFDialog {
/**
@ -43,9 +48,13 @@ public class EditClassificationDialog extends AbstractAIFDialog {
private AbstractAIFApplication app;
private TCSession session;
private TCComponent target;
private Map<String, JTextField> propMap;
private Map<String, JComponent> propMap;
private TCClassificationService myService;
final EditClassificationDialog DIALOG = this;
private TCComponentItemRevision rev;
private int[] ids;
private String[] values;
private String[] names;
public EditClassificationDialog(AbstractAIFApplication app) throws TCException {
this.app = app;
@ -70,30 +79,28 @@ public class EditClassificationDialog extends AbstractAIFDialog {
private void initUI() {
this.setTitle("Ð޸ķÖÀàÊôÐÔ");
this.setAutoRequestFocus(true);
this.setResizable(true);
this.setResizable(false);
this.setAlwaysOnTop(true);
JPanel rootPanel = new JPanel(new BorderLayout());
rootPanel.setBorder(BorderFactory.createLineBorder(Color.black, 1));
GridBagConstraints gbs = new GridBagConstraints();
GridBagLayout gbl = new GridBagLayout();
JPanel editPanel = new JPanel(gbl);
gbs.anchor = GridBagConstraints.NORTHWEST;
gbs.fill = GridBagConstraints.BOTH;
gbs.insets = new Insets(10, 20, 5, 10);
gbs.weighty = 0.2;
gbs.gridheight = 1;
Map<String, String> attr = null;
propMap = new HashMap<String, JTextField>();
JPanel rootPanel = new JPanel();
rootPanel.setLayout(null);
rootPanel.setPreferredSize(new Dimension(300, 350));
Map<Integer, ClassPropBean> displayMap = new LinkedHashMap<Integer, ClassPropBean>();
propMap = new HashMap<String, JComponent>();
TCComponentItemRevision rev = (TCComponentItemRevision) target;
try {
if (rev.getClassificationClass() != null || !"".equals(rev.getClassificationClass())) {
try {
attr = rev.getClassificationAttributes();
TCComponentICO ico = rev.getClassificationObjects()[0];
for (Entry<String, String> entry : attr.entrySet()) {
System.out.println(entry.getKey() + "===>" + entry.getValue());
ICSProperty[] props = ico.getICSProperties(true);
ICSPropertyDescription[] desc = ico.getICSPropertyDescriptors();
for (int i = 0; i < props.length; i++) {
System.out.println(props[i].getId() + "===>" + props[i].getValue());
displayMap.put(props[i].getId(),
new ClassPropBean(props[i].getId(), desc[i].getName(), props[i].getValue()));
}
} catch (TCException e1) {
// TODO Auto-generated catch block
@ -108,45 +115,85 @@ public class EditClassificationDialog extends AbstractAIFDialog {
e.printStackTrace();
}
if (attr != null) {
if (displayMap.size() == 0) {
return;
}
String uid = JDMethodUtil.getPrefStr("jd_class_prop_option", session);
System.out.println("uid======>" + uid);
Map<Integer, String> propOption = null;
try {
TCComponent comp = session.stringToComponent(uid);
if (comp != null) {
TCComponentDataset op = (TCComponentDataset) comp;
String temp = System.getenv("temp");
String[] types = op.getProperty("ref_names").split(",");
File optionFile = op.getFiles(types[0], temp)[0];
optionFile.deleteOnExit();
System.out.println(rev.getItem().getProperty("object_type"));
propOption = ExcelInfoScanner.getClassPropOptions(optionFile.getPath(),
rev.getItem().getProperty("object_type"));
System.out.println("propOption count======>" + propOption.size());
}
} catch (TCException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
}
JPanel content = new JPanel();
content.setLayout(null);
content.setPreferredSize(new Dimension(300, displayMap.size() * (25 + 10)));
int num = 0;
JLabel[] names = new JLabel[attr.size()];
JTextField[] values = new JTextField[attr.size()];
for (Entry<String, String> entry : attr.entrySet()) {
gbs.gridwidth = 1;
gbs.weightx = 0.4;
names[num] = new JLabel(entry.getKey() + "£º");
gbl.setConstraints(names[num], gbs);
gbs.gridwidth = GridBagConstraints.REMAINDER;
gbs.weightx = 2;
values[num] = new JTextField(entry.getValue());
propMap.put(entry.getKey(), values[num]);
gbl.setConstraints(values[num], gbs);
editPanel.add(names[num]);
editPanel.add(values[num]);
for (Entry<Integer, ClassPropBean> entry : displayMap.entrySet()) {
JLabel label = new JLabel(entry.getValue().getName() + "");
label.setBounds(10, num * 35 + 10, 100, 25);
if (propOption != null && propOption.containsKey(entry.getKey())) {
String[] items = propOption.get(entry.getKey()).split(",");
JComboBox<String> combo = new JComboBox<String>();
combo.addItem(" ");
for (String s : items) {
combo.addItem(s);
}
combo.setSelectedItem(entry.getValue().getValue());
if (combo.getSelectedItem() == null || combo.getSelectedIndex() < 0) {
combo.addItem(entry.getValue().getValue());
combo.setSelectedItem(entry.getValue().getValue());
}
combo.setBounds(130, num * 35 + 10, 150, 25);
propMap.put(entry.getValue().getName(), combo);
content.add(combo);
} else {
JTextField text = new JTextField(entry.getValue().getValue());
text.setBounds(130, num * 35 + 10, 150, 25);
propMap.put(entry.getValue().getName(), text);
content.add(text);
}
content.add(label);
num++;
}
JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
JButton cancelBtn = new JButton("È¡Ïû");
cancelBtn.addActionListener(cancel());
JButton okBtn = new JButton("È·ÈÏ");
okBtn.setBounds(40, 310, 100, 25);
okBtn.setSelected(true);
okBtn.addActionListener(ok());
buttonPanel.add(okBtn);
buttonPanel.add(cancelBtn);
ScrollPane scroll = new ScrollPane();
scroll.add(editPanel);
scroll.setPreferredSize(new Dimension(300, 300));
rootPanel.add(scroll, BorderLayout.CENTER);
rootPanel.add(buttonPanel, BorderLayout.SOUTH);
this.setLayout(new BorderLayout());
JButton cancelBtn = new JButton("取消");
cancelBtn.setBounds(160, 310, 100, 25);
cancelBtn.addActionListener(cancel());
JScrollPane jsp = new JScrollPane(content);
jsp.setBounds(0, 0, 300, 300);
jsp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
rootPanel.add(jsp);
rootPanel.add(okBtn);
rootPanel.add(cancelBtn);
this.add(rootPanel);
this.pack();
this.centerToScreen();
this.showDialog();
}
}
private ActionListener ok() {
return new ActionListener() {
@ -154,7 +201,7 @@ public class EditClassificationDialog extends AbstractAIFDialog {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
TCComponentItemRevision rev = (TCComponentItemRevision) target;
rev = (TCComponentItemRevision) target;
saveClassification(rev);
// try {
@ -193,7 +240,6 @@ public class EditClassificationDialog extends AbstractAIFDialog {
private boolean saveClassification(TCComponentItemRevision rev) {
try {
ICSApplicationObject icsAppObj = myService.newICSApplicationObject("ICM");
TCComponentICO[] icoS = rev.getClassificationObjects();
String classID = rev.getClassificationClass();
if (icoS == null || icoS.length == 0) {
@ -203,27 +249,107 @@ public class EditClassificationDialog extends AbstractAIFDialog {
TCComponentICO ico = icoS[i];
ICSPropertyDescription[] desc = ico.getICSPropertyDescriptors();
ICSProperty[] oldICSProps = ico.getICSProperties(true);
ICSProperty[] newICSProps = new ICSProperty[oldICSProps.length];
ids = new int[oldICSProps.length];
values = new String[oldICSProps.length];
names = new String[oldICSProps.length];
for (int j = 0; j < oldICSProps.length; j++) {
ICSProperty icsProp = oldICSProps[j];
// icsProp.setValue("1111");
newICSProps[j] = new ICSProperty(icsProp.getId(), "111111");
ids[j] = oldICSProps[j].getId();
if (propMap.get(desc[j].getName()) instanceof JComboBox) {
String str = ((JComboBox<String>) propMap.get(desc[j].getName())).getSelectedItem().toString();
values[j] = " ".equals(str) ? "" : str;
} else {
values[j] = ((JTextField) propMap.get(desc[j].getName())).getText();
}
for (int j = 0; j < oldICSProps.length; j++) {
newICSProps[j].setValue(propMap.get(desc[j].getName()).getText());
names[j] = desc[j].getName();
}
ico.delete();
icsAppObj.create(myService.getTCComponentId(rev), myService.getTCComponentUid(rev));
icsAppObj.setView(classID);
icsAppObj.setProperties(newICSProps);
icsAppObj.save();
JSONObject obj = new JSONObject();
obj.put("ids", ids);
obj.put("values", values);
String prop = obj.toString();
// prop = prop.replace("\"", "\\\"");
String server = JDMethodUtil.getPrefStr("jd2_server_ip", session);
if (server == null || "".equals(server)) {
MessageBox.post("未配置jd2_server_ip首选项", "错误", MessageBox.ERROR);
return false;
}
String url = "http://" + server + ":8880/api/sendClassification";
Map<String, Object> paramMap = new HashMap<String, Object>();
String uid = rev.getUid();
paramMap.put("uid", uid);
paramMap.put("cid", classID);
paramMap.put("prop", prop);
System.out.println(url);
System.out.println(prop);
final String URL = url;
final Map<String, Object> PARAMMAP = paramMap;
final TCComponentItemRevision REV = rev;
new Thread(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
cn.hutool.http.HttpUtil.post(URL, PARAMMAP);
finish();
}
}).start();
}
rev.refresh();
} catch (TCException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
return true;
}
private void finish() {
try {
rev.refresh();
String[] prefArr = JDMethodUtil.getPrefStrArray("jd2_custom_display_name", session);
String classAddress = getClassificationAddress(rev.getClassificationClass());
System.out.println("classAddress=====>" + classAddress);
for (String pref : prefArr) {
String[] className = pref.split(":")[0].split("/");
if (classAddress.contains(className[0]) && classAddress.contains(className[1])) {
String[] prefClassNamesArr = pref.split(":")[1].split(",");
System.out.println("pref class porp names=====>" + Arrays.toString(prefClassNamesArr));
StringBuilder builder = new StringBuilder();
for (int i = 0; i < prefClassNamesArr.length; i++) {
System.out.println(prefClassNamesArr[i]);
for (int ii = 0; ii < names.length; ii++) {
System.out.println(names[ii]);
if (prefClassNamesArr[i].equals(names[ii]) && !"".equals(values[ii].trim())) {
builder.append(values[ii] + ",");
}
}
}
String temp = builder.toString().substring(0, builder.toString().length() - 1);
System.out.println("class porp values=====>" + temp);
session.getUserService().call("bs_bypass", new Object[] { true });
rev.lock();
rev.setProperty("jd2_flfh", temp);
rev.save();
rev.unlock();
session.getUserService().call("bs_bypass", new Object[] { false });
break;
}
}
} catch (TCException e) {
// TODO Auto-generated catch block
e.printStackTrace();
JOptionPane.showMessageDialog(null, "首选项jd2_custom_display_name配置有误请检查\r\n" + e.getMessage(), "提示",
JOptionPane.WARNING_MESSAGE);
return;
}
System.out.println("success");
}
private String getClassificationAddress(String classId) throws TCException {
ICSAdminClass clazz = session.getClassificationService().newICSAdminClass();
clazz.load(classId);
if ("ICM".equals(clazz.askClassId())) {
return "根";
}
return clazz.getName() + "=>" + getClassificationAddress(clazz.getParent());
}
}

@ -1,7 +0,0 @@
package com.connor.jd.plm.dialog;
import javafx.scene.control.Dialog;
public class MsgDialog extends Dialog<String> {
}

@ -15,8 +15,9 @@ import com.connor.jd.operations.CreateTableOperation;
import com.connor.jd.plm.beans.ComponentBean;
import com.connor.jd.plm.beans.MachineBean;
import com.connor.jd.plm.utils.DBConnectionUtil;
import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aifrcp.AIFUtility;
import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCSession;
import javafx.application.Application;
import javafx.beans.value.ChangeListener;
@ -49,7 +50,6 @@ import javafx.stage.Stage;
public class CSXWHDialog extends Application {
private AbstractAIFApplication app;
private static Connection con = null;
private static PreparedStatement ps = null;
private static ResultSet rs = null;
@ -57,6 +57,7 @@ public class CSXWHDialog extends Application {
private ObservableList<MachineBean> machineData = FXCollections.observableArrayList();
private ObservableList<ComponentBean> findList = FXCollections.observableArrayList();
private ObservableList<MachineBean> findMacList = FXCollections.observableArrayList();
private TCSession session;
public CSXWHDialog() throws TCException {
@ -72,6 +73,7 @@ public class CSXWHDialog extends Application {
@Override
public void start(Stage arg0) throws Exception {
session = (TCSession) AIFUtility.getCurrentApplication().getSession();
msgStage = new Stage();
msgContent = new Label("");
msgContent.setFont(new Font(STYLESHEET_CASPIAN, 16));
@ -94,7 +96,7 @@ public class CSXWHDialog extends Application {
CreateTableOperation.create();
try {
con = DBConnectionUtil.dbConn("infodba", "infodba");
con = DBConnectionUtil.dbConn(session);
String sqlString = "select * from JD2_Component";
if (con == null) {
msgContent.setText("连接失败");
@ -375,7 +377,7 @@ public class CSXWHDialog extends Application {
tab0.setClosable(false);
// 第二个页面
try {
con = DBConnectionUtil.dbConn("infodba", "infodba");
con = DBConnectionUtil.dbConn(session);
String sqlString = "select * from JD2_Machine";
if (con == null) {
System.out.print("连接失败");
@ -520,7 +522,7 @@ public class CSXWHDialog extends Application {
for (int i = 0; i < delAddList.size(); i++) {
System.out.println("deList的长度" + delList.size());
System.out.println("选中的" + delAddList.get(i));
for (int j = 0; j < findList.size(); j++) {
for (int j = 0; j < findMacList.size(); j++) {
if (findMacList.get(j).getMacId() == 0) {
if (delAddList.get(i) == findMacList.get(j).getAddId()) {
findMacList.remove(j);
@ -640,7 +642,7 @@ public class CSXWHDialog extends Application {
private void selectId(ComponentBean com) {
String sql = "select component_id_seq.nextval from dual";
con = DBConnectionUtil.dbConn("infodba", "infodba");
con = DBConnectionUtil.dbConn(session);
try {
ps = con.prepareStatement(sql);
rs = ps.executeQuery();
@ -671,7 +673,7 @@ public class CSXWHDialog extends Application {
private void selectMacId(MachineBean com) {
String sql = "select machine_id_seq.nextval from dual";
con = DBConnectionUtil.dbConn("infodba", "infodba");
con = DBConnectionUtil.dbConn(session);
try {
ps = con.prepareStatement(sql);
rs = ps.executeQuery();
@ -700,7 +702,7 @@ public class CSXWHDialog extends Application {
private void insert(ComponentBean com) {
String sql = "insert into JD2_Component(test_type,test_project,test_time,test_num,test_cost) values(?,?,?,?,?)";
con = DBConnectionUtil.dbConn("infodba", "infodba");
con = DBConnectionUtil.dbConn(session);
try {
System.out.println("添加");
ps = con.prepareStatement(sql);
@ -751,7 +753,7 @@ public class CSXWHDialog extends Application {
private void insertMac(MachineBean mac) {
String sql = "insert into JD2_Machine(test_type,test_project,test_cost) values(?,?,?)";
con = DBConnectionUtil.dbConn("infodba", "infodba");
con = DBConnectionUtil.dbConn(session);
try {
ps = con.prepareStatement(sql);
ps.setString(1, mac.getType());
@ -795,7 +797,7 @@ public class CSXWHDialog extends Application {
private void update(ComponentBean com) {
String sql = "update JD2_Component set test_type=?,test_project=?,test_time=?,test_num=?,test_cost=? where test_id=?";
con = DBConnectionUtil.dbConn("infodba", "infodba");
con = DBConnectionUtil.dbConn(session);
try {
ps = con.prepareStatement(sql);
ps.setString(1, com.getType());
@ -841,7 +843,7 @@ public class CSXWHDialog extends Application {
}
private void update(String sql, int id) {
con = DBConnectionUtil.dbConn("infodba", "infodba");
con = DBConnectionUtil.dbConn(session);
try {
ps = con.prepareStatement(sql);
ps.setInt(1, id);
@ -878,7 +880,7 @@ public class CSXWHDialog extends Application {
private void updateMac(MachineBean mac) {
String sql = "update JD2_Machine set test_type=?,test_project=?,test_cost=? where test_id=?";
con = DBConnectionUtil.dbConn("infodba", "infodba");
con = DBConnectionUtil.dbConn(session);
try {
ps = con.prepareStatement(sql);
ps.setString(1, mac.getType());

@ -0,0 +1,14 @@
package com.connor.jd.plm.dialogs;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.teamcenter.rac.kernel.TCComponentItemRevision;
public class ColorMaterialBean {
public List<String[]> colorMaterial = new ArrayList<String[]>();
public Map<TCComponentItemRevision, Object[]> data = new HashMap<TCComponentItemRevision, Object[]>();
}

@ -0,0 +1,40 @@
package com.connor.jd.plm.dialogs;
import java.awt.Component;
import javax.swing.JTree;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;
import com.teamcenter.rac.kernel.TCSession;
public class MyTreeCellRenderer extends DefaultTreeCellRenderer {
private TCSession session;
public MyTreeCellRenderer(TCSession session) {
this.session = session;
}
@Override
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf,
int row, boolean hasFocus) {
super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
setText(value.toString());
if (sel) {
setForeground(getTextSelectionColor());
} else {
setForeground(getTextNonSelectionColor());
}
DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
String str = node.toString();
if (!"".equals(str)) {
// session.search(arg0, arg1, arg2)
}
return this;
}
}

@ -1,6 +1,7 @@
package com.connor.jd.plm.dialogs;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -13,17 +14,20 @@ import java.awt.event.MouseEvent;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import javax.swing.BorderFactory;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollBar;
import javax.swing.JScrollPane;
@ -35,6 +39,7 @@ import javax.swing.tree.TreeModel;
import javax.swing.tree.TreePath;
import com.connor.jd.plm.beans.TransformBomBean;
import com.connor.jd.plm.utils.DialogUtil;
import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aif.AbstractAIFDialog;
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
@ -254,7 +259,24 @@ public class TransformDesignToPartDialog extends AbstractAIFDialog implements Ac
System.out.println("进行转换");
if (win == null)
createWindow();
createMaterialBom(topTree);
ColorMaterialBean bean = new ColorMaterialBean();
createMaterialBom(topTree, bean);
if (bean.colorMaterial.size() != 0) {
System.out.println(
Arrays.deepToString(bean.colorMaterial.toArray(new String[bean.colorMaterial.size()][])));
JScrollPane msgPanel = DialogUtil.createTableMsg(new String[] { "ID", "版本", "名称", "颜色" },
bean.colorMaterial).panel;
int r = JOptionPane.showConfirmDialog((Component) e.getSource(), msgPanel, "颜色件确认",
JOptionPane.PLAIN_MESSAGE);
if (r == JOptionPane.OK_OPTION) {
createBom1(bean);
} else {
System.out.println("cancel");
return;
}
} else {
createBom1(bean);
}
MessageBox.post("转换bom成功", "提示", MessageBox.INFORMATION);
this.dispose();
} catch (TCException e1) {
@ -279,6 +301,17 @@ public class TransformDesignToPartDialog extends AbstractAIFDialog implements Ac
}
@SuppressWarnings("unchecked")
private void createBom1(ColorMaterialBean bean) throws TCException {
for (Entry<TCComponentItemRevision, Object[]> entry : bean.data.entrySet()) {
List<TCComponentItemRevision> arg1 = entry.getValue()[1] == null ? null
: (List<TCComponentItemRevision>) entry.getValue()[1];
List<String> arg2 = entry.getValue()[2] == null ? null : (List<String>) entry.getValue()[2];
List<String> arg3 = entry.getValue()[3] == null ? null : (List<String>) entry.getValue()[3];
createBom(entry.getKey(), arg1, arg2, arg3);
}
}
/**
* Treeitem
*
@ -311,7 +344,7 @@ public class TransformDesignToPartDialog extends AbstractAIFDialog implements Ac
* @param node
* @throws TCException
*/
private void createMaterialBom(CheckBoxTreeNode node) throws TCException {
private void createMaterialBom(CheckBoxTreeNode node, ColorMaterialBean colorMaterialBean) throws TCException {
// System.out.println("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
TransformBomBean bean = (TransformBomBean) node.getUserObject();
TCComponentItemRevision materialRev = bean.selectRev;
@ -343,11 +376,20 @@ public class TransformDesignToPartDialog extends AbstractAIFDialog implements Ac
return;
}
} else {
createMaterialBom(childNode);
createMaterialBom(childNode, colorMaterialBean);
}
}
}
for (TCComponentItemRevision material : childrenList) {
String ys = material.getProperty("jd2_classys");
if (ys != null && !"".equals(ys)) {
System.out.println("颜色件:" + material.getProperty("object_string"));
colorMaterialBean.colorMaterial.add(new String[] { material.getProperty("item_id"),
material.getProperty("item_revision_id"), material.getProperty("object_name"), ys });
}
}
createBom(materialRev, childrenList, null, quantityList);
colorMaterialBean.data.put(materialRev, new Object[] { materialRev, childrenList, null, quantityList });
}
private TreePath findInPath(TreePath treePath, String str) {
@ -817,4 +859,17 @@ public class TransformDesignToPartDialog extends AbstractAIFDialog implements Ac
}
private boolean isYSMaterial(TCComponentItemRevision rev) {
try {
Map<String, String> map = rev.getClassificationAttributes();
if (map.get("颜色") != null && !"".equals(map.get("颜色"))) {
return true;
}
} catch (TCException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return false;
}
}

@ -13,6 +13,8 @@ import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -27,23 +29,28 @@ import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.filechooser.FileFilter;
import javax.swing.filechooser.FileNameExtensionFilter;
import javax.swing.table.DefaultTableModel;
import com.connor.jd.plm.beans.ComponentBean;
import com.connor.jd.plm.beans.JG;
import com.connor.jd.plm.table.DatePickerCellEditor;
import com.connor.jd.plm.table.TCTableUtil;
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
import com.teamcenter.rac.aifrcp.AIFUtility;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentDataset;
import com.teamcenter.rac.kernel.TCComponentDatasetType;
import com.teamcenter.rac.kernel.TCComponentForm;
import com.teamcenter.rac.kernel.TCComponentItem;
import com.teamcenter.rac.kernel.TCComponentItemRevision;
import com.teamcenter.rac.kernel.TCComponentItemType;
import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.stylesheet.AbstractRendering;
import com.teamcenter.rac.util.MessageBox;
import com.teamcenter.services.rac.core.DataManagementService;
import com.teamcenter.services.rac.core._2008_06.DataManagement.CreateIn;
import com.teamcenter.services.rac.core._2008_06.DataManagement.CreateResponse;
@ -62,11 +69,14 @@ public class CSJHForm extends AbstractRendering {
private static ResultSet rs = null;
private ObservableList<ComponentBean> componentData = FXCollections.observableArrayList();
String[] propNames = new String[] { "jd2_syxh", "jd2_symd", "jd2_wtry", "jd2_syxm", "jd2_syts", "jd2_syzq",
"jd2_syfy", "jd2_jhrc", "jd2_sjrc", "jd2_syzt", "jd2_syjg", "jd2_sycs", "jd2_syry", "jd2_csbg", "jd2_bz" };
"jd2_syfy", "jd2_jhrc", "jd2_jhrc1", "jd2_sjrc", "jd2_sjrc1", "jd2_syzt", "jd2_syjg", "jd2_sycs",
"jd2_syry", "jd2_csbg", "jd2_bz" };
private JLabel label3;
private List<Integer> editable = new ArrayList<Integer>();
private Map<String, JG> res;
private Map<Integer, String> rowNo;
private JTable table;
private boolean againAllow;
public CSJHForm(TCComponent form) throws Exception {
super();
@ -128,7 +138,7 @@ public class CSJHForm extends AbstractRendering {
// }
// }
// }
this.setPreferredSize(new Dimension(1000, 250));
this.setPreferredSize(new Dimension(1200, 250));
TCComponent[] tables = form.getTCProperty("jd2_csjh").getReferenceValueArray();
AIFComponentContext[] contexts = form.whereReferenced();
for (int i = 0; i < contexts.length; i++) {
@ -140,19 +150,20 @@ public class CSJHForm extends AbstractRendering {
}
}
}
String[] info = new String[] { "NO", "实验型号", "实验目的", "委托人员", "实验项目", "实验台数", "实验周期", "试验费用", "计划日期", "实际日期",
"实验状态", "实验结果", "第_次实验", "实验人员", "测试报告", "备注" };
String[] info = new String[] { "NO", "实验型号", "实验目的", "委托人员", "实验项目", "实验台数", "实验周期", "试验费用", "计划开始日期", "计划完成日期",
"实际开始日期", "实际完成日期", "实验状态", "实验结果", "第_次实验", "实验人员", "测试报告", "备注" };
model = new DefaultTableModel(info, 0);
JComboBox<String> testStage = new JComboBox();
JComboBox<String> testResult = new JComboBox();
String[] stageInfo = { "待测", "进行中", "完成" };
String[] stageInfo = { "待测", "进行中", "完成", " " };
for (int i = 0; i < stageInfo.length; i++) {
testStage.addItem(stageInfo[i]);
}
testResult.addItem("不合格");
testResult.addItem("合格");
testResult.addItem(" ");
for (int i = 0; i < tables.length; i++) {
String[] temp = new String[16];
String[] temp = new String[18];
temp[0] = Integer.toString(index++);
String[] props = tables[i].getProperties(propNames);
for (int j = 0; j < props.length; j++) {
@ -160,6 +171,59 @@ public class CSJHForm extends AbstractRendering {
}
model.addRow(temp);
}
TCComponentItemRevision[] revs = itemR.getItem().getReleasedItemRevisions();
Comparator<TCComponent> leatestRevisionComparator = new Comparator<TCComponent>() {
@Override
public int compare(TCComponent o1, TCComponent o2) {
// TODO Auto-generated method stub
try {
return o1.getProperty("item_revision_id").compareTo(o2.getProperty("item_revision_id"));
} catch (TCException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return 0;
}
};
Arrays.parallelSort(revs, leatestRevisionComparator);
if (revs.length > 0) {
List<Map<String, String>> dataMap = TCTableUtil.getTableMapList(
(TCComponentForm) revs[revs.length - 1].getRelatedComponent("IMAN_master_form_rev"), "jd2_csjh",
propNames);
List<String> realNoList = new ArrayList<String>();
for (Map<String, String> tempMap : dataMap) {
realNoList.add(tempMap.get("jd2_syxm") + "," + tempMap.get("jd2_sycs"));
}
for (int i = 0; i < tables.length; i++) {
if (realNoList.contains(tables[i].getProperty("jd2_syxm") + "," + tables[i].getProperty("jd2_sycs"))) {
editable.add(i);
}
}
}
// 目前版本是否为最新发布的下一个版本
List<String> releasedObjectString = new ArrayList<String>();
for (int i = 0; i < revs.length; i++) {
releasedObjectString.add(revs[i].getProperty("object_string"));
}
if (revs.length > 0) {
if (!releasedObjectString.contains(itemR.getProperty("object_string"))) {
TCComponent[] allRev = itemR.getItem().getRelatedComponents("revision_list");
Arrays.parallelSort(allRev, leatestRevisionComparator);
for (int i = 0; i < allRev.length; i++) {
if (allRev[i].getProperty("object_string")
.equals(revs[revs.length - 1].getProperty("object_string")) && i + 1 < allRev.length) {
if (itemR.getProperty("object_string").equals(allRev[i + 1].getProperty("object_string"))) {
againAllow = true;
break;
}
}
}
}
}
// for (int i = 0; i < componentData.size(); i++) {
// // for (int j = 0; j < tables.length; j++) {
// String project = componentData.get(i).getProject();
@ -181,11 +245,11 @@ public class CSJHForm extends AbstractRendering {
//// }
// }
final JTable table = new JTable(model) {
table = new JTable(model) {
@Override
public boolean isCellEditable(int row, int column) {
if (column == 3 || column == 4 || column == 5 || column == 6 || column == 7 || column == 14
|| column == 12 || editable.contains(row))
if (column == 3 || column == 4 || column == 5 || column == 6 || column == 7 || column == 16
|| column == 14 || editable.contains(row))
return false;
else
return true;
@ -198,7 +262,7 @@ public class CSJHForm extends AbstractRendering {
}
});
for (int i = 0; i < 16; i++) {
table.getColumn(table.getColumnName(i)).setMinWidth(60);
table.getColumn(table.getColumnName(i)).setMinWidth(100);
}
DefaultCellEditor dce1 = new DefaultCellEditor(testStage) {
@ -219,7 +283,7 @@ public class CSJHForm extends AbstractRendering {
Object obj = super.getCellEditorValue();
if ("完成".equals(obj.toString())) {
editable.add(row);
// editable.add(row);
} else {
if (editable.contains(row)) {
editable.remove(row);
@ -240,7 +304,7 @@ public class CSJHForm extends AbstractRendering {
// TODO Auto-generated method stub
t = paramJTable;
row = paramInt1;
String str = t.getValueAt(row, 12) == null ? "" : t.getValueAt(row, 12).toString();
String str = t.getValueAt(row, 14) == null ? "" : t.getValueAt(row, 14).toString();
num = Objects.equals(str, "") ? 0 : Integer.parseInt(str);
return super.getTableCellEditorComponent(paramJTable, paramObject, paramBoolean, paramInt1, paramInt2);
}
@ -274,9 +338,21 @@ public class CSJHForm extends AbstractRendering {
return obj;
}
};
table.getColumn(table.getColumnName(10)).setCellEditor(dce1);
table.getColumn(table.getColumnName(11)).setCellEditor(dce2);
DatePickerCellEditor dpce = new DatePickerCellEditor(new JTextField());
DefaultCellEditor deafult = new DefaultCellEditor(new JTextField());
for (int i = 0; i < table.getColumnCount(); i++) {
table.getColumnModel().getColumn(i).setCellEditor(deafult);
}
table.getColumn(table.getColumnName(8)).setCellEditor(dpce);
table.getColumn(table.getColumnName(9)).setCellEditor(dpce);
table.getColumn(table.getColumnName(10)).setCellEditor(dpce);
table.getColumn(table.getColumnName(11)).setCellEditor(dpce);
table.getColumn(table.getColumnName(12)).setCellEditor(dce1);
table.getColumn(table.getColumnName(13)).setCellEditor(dce2);
table.setRowHeight(25);
table.setAutoscrolls(true);
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
table.getTableHeader().setReorderingAllowed(false);
if (form.isCheckedOut()) {
table.setEnabled(true);
} else {
@ -294,7 +370,7 @@ public class CSJHForm extends AbstractRendering {
}
label2.setText(allcost + "元");
label3 = new JLabel("结论:合格");
label3 = new JLabel("结论:");
res = new HashMap<String, JG>();
rowNo = new HashMap<Integer, String>();
String no;
@ -306,7 +382,7 @@ public class CSJHForm extends AbstractRendering {
int times = Integer.parseInt(
Objects.equals(tables[i].getProperty("jd2_sycs"), "") ? "0" : tables[i].getProperty("jd2_sycs"));
if ("完成".equals(tables[i].getProperty("jd2_syzt"))) {
editable.add(i);
// editable.add(i);
}
if (res.containsKey(no)) {
if (times >= res.get(no).getTimes()) {
@ -317,14 +393,24 @@ public class CSJHForm extends AbstractRendering {
res.put(no, new JG(i, times, jg));
}
}
boolean notEmpty = false;
boolean qualified = true;
for (Entry<String, JG> entry : res.entrySet()) {
System.out.println(entry.getKey() + entry.getValue().getRow() + entry.getValue().getJg()
+ entry.getValue().getTimes());
// System.out.println(entry.getKey() + entry.getValue().getRow() + entry.getValue().getJg()
// + entry.getValue().getTimes());
if (!"".equals(entry.getValue().getJg().trim())) {
notEmpty = true;
}
if ("不合格".equals(entry.getValue().getJg())) {
label3.setText("结论:不合格");
qualified = false;
break;
}
}
if (notEmpty && !qualified) {
label3.setText("结论:不合格");
} else if (notEmpty) {
label3.setText("结论:合格");
}
panelLable.add(label);
panelLable.add(label2);
@ -354,13 +440,17 @@ public class CSJHForm extends AbstractRendering {
setLayout(new BorderLayout());
panel.add(pane, BorderLayout.CENTER);
add(bottom, BorderLayout.EAST);
add(panelLable, BorderLayout.SOUTH);
add(pane, BorderLayout.CENTER);
JPanel root = new JPanel(new BorderLayout());
root.add(bottom, BorderLayout.EAST);
root.add(panelLable, BorderLayout.SOUTH);
root.add(pane, BorderLayout.CENTER);
JScrollPane jsp = new JScrollPane(root);
add(jsp, BorderLayout.CENTER);
testButton.addActionListener(e -> {
JFileChooser chooser = new JFileChooser();
chooser.setDialogTitle("选择上传的测试报告");
FileFilter filter = new FileNameExtensionFilter("Excel工作簿(.xlsx)", "xlsx");// 设置文件过滤器只列出JPG或GIF格式的图片
FileFilter filter = new FileNameExtensionFilter("Excel工作簿(.xlsx,.xls,.xlsm)", "xlsx", "xls", "xlsm");// 设置文件过滤器只列出JPG或GIF格式的图片
chooser.setFileFilter(filter);
chooser.showOpenDialog(null);
File file = chooser.getSelectedFile();
@ -371,7 +461,7 @@ public class CSJHForm extends AbstractRendering {
System.out.println(filePath);
System.out.println(fileName);
int row = table.getSelectedRow();
String value = model.getValueAt(row, 14) == null ? "" : model.getValueAt(row, 14).toString();
String value = model.getValueAt(row, 16) == null ? "" : model.getValueAt(row, 16).toString();
if (value.equals("")) {
try {
TCComponentItemType itemtype = (TCComponentItemType) session.getTypeComponent("JD2_GTCSBG");
@ -390,7 +480,7 @@ public class CSJHForm extends AbstractRendering {
TCComponentDataset datasetMSExcelX = datasetType.create(filename, "", msType);
datasetMSExcelX.setFiles(new String[] { filePath }, new String[] { "excel" });// 两参文件路径命名应用text
item.getLatestItemRevision().add("IMAN_specification", datasetMSExcelX);
model.setValueAt(item.getProperty("current_id"), row, 14);
model.setValueAt(item.getProperty("current_id"), row, 16);
} catch (TCException e1) {
e1.printStackTrace();
}
@ -432,7 +522,7 @@ public class CSJHForm extends AbstractRendering {
TCComponentDataset datasetMSExcelX = datasetType.create(filename, "", msType);
datasetMSExcelX.setFiles(new String[] { filePath }, new String[] { "excel" });// 两参文件路径命名应用text
item.getLatestItemRevision().add("IMAN_specification", datasetMSExcelX);
model.setValueAt(item.getProperty("current_id"), row, 14);
model.setValueAt(item.getProperty("current_id"), row, 16);
} catch (TCException e1) {
e1.printStackTrace();
}
@ -447,13 +537,27 @@ public class CSJHForm extends AbstractRendering {
});
huizongButton.addActionListener(e -> {
int row = table.getSelectedRow();
String value = (String) model.getValueAt(row, 14);
String value = (String) model.getValueAt(row, 16);
JFileChooser chooser = new JFileChooser();
chooser.setDialogTitle("选择上传的汇总结论");
FileFilter filter = new FileNameExtensionFilter("Excel工作簿(.xlsx)", "xlsx");// 设置文件过滤器只列出JPG或GIF格式的图片
FileFilter filter = new FileNameExtensionFilter("Excel工作簿(.xlsx,.xls,.xlsm),PPT演示文稿(.ppt,.pptx)", "xlsx",
"xls", "xlsm", "ppt", "pptx");// 设置文件过滤器只列出JPG或GIF格式的图片
chooser.setFileFilter(filter);
chooser.showOpenDialog(null);
File file = chooser.getSelectedFile();
TCComponentItemRevision parentRev = null;
try {
AIFComponentContext[] aifs = itemR.getItem().whereReferenced();
for (AIFComponentContext aif : aifs) {
if (aif.getComponent().getType().equals("JD2_GTSYWTSRevision")) {
parentRev = (TCComponentItemRevision) aif.getComponent();
System.out.println("JD2_GTSYWTSRevision check");
}
}
} catch (TCException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
}
if (file != null) {
String filePath = file.getPath();
String fileName = file.getName();
@ -466,17 +570,26 @@ public class CSJHForm extends AbstractRendering {
String itemId = itemtype.getNewID();
String itemRev = itemtype.getNewRev(null);
TCComponentItem item = itemtype.create(itemId, itemRev, "JD2_GTCSBG", fileName, "描述", null);
itemR.add("JD2_CSBGHZ", item);
parentRev.add("JD2_CSBGHZ", item);
TCComponentDatasetType datasetType = (TCComponentDatasetType) session
.getTypeComponent("Dataset");
String msType = "";
String fileType = "";
if (filePath.endsWith(".xls")) {
msType = "MSExcel";
fileType = "excel";
} else if (filePath.endsWith(".xlsx") || filePath.endsWith(".xlsm")) {
msType = "MSExcelX";
fileType = "excel";
} else if (filePath.endsWith(".ppt")) {
msType = "MSPowerPoint";
fileType = "powerpoint";
} else if (filePath.endsWith(".pptx")) {
msType = "MSPowerPointX";
fileType = "powerpoint";
}
TCComponentDataset datasetMSExcelX = datasetType.create(filename, "", msType);
datasetMSExcelX.setFiles(new String[] { filePath }, new String[] { "excel" });// 两参文件路径命名应用text
datasetMSExcelX.setFiles(new String[] { filePath }, new String[] { fileType });// 两参文件路径命名应用text
item.getLatestItemRevision().add("IMAN_specification", datasetMSExcelX);
} catch (TCException e1) {
e1.printStackTrace();
@ -507,7 +620,7 @@ public class CSJHForm extends AbstractRendering {
String itemRev = itemtype.getNewRev(null);
TCComponentItem item = itemtype.create(itemId, itemRev, "JD2_GTCSBG", fileName, "描述",
null);
itemR.add("JD2_CSBGHZ", item);
parentRev.add("JD2_CSBGHZ", item);
TCComponentDatasetType datasetType = (TCComponentDatasetType) session
.getTypeComponent("Dataset");
String msType = "";
@ -542,7 +655,7 @@ public class CSJHForm extends AbstractRendering {
temp[5] = (String) model.getValueAt(table.getSelectedRow(), 5);
temp[6] = (String) model.getValueAt(table.getSelectedRow(), 6);
temp[7] = (String) model.getValueAt(table.getSelectedRow(), 7);
String chishu = (String) model.getValueAt(table.getSelectedRow(), 12);
String chishu = (String) model.getValueAt(table.getSelectedRow(), 14);
if ("".equals(chishu)) {
chishu = "0";
System.out.println(chishu);
@ -550,8 +663,64 @@ public class CSJHForm extends AbstractRendering {
if (chishu == null) {
chishu = "0";
}
temp[12] = String.valueOf(Integer.valueOf(chishu) + 1);
// temp[14] = (String) model.getValueAt(table.getSelectedRow(), 14);
int cishuNum = Integer.valueOf(chishu);
boolean isNotLatest = false;
Object obj;
String xm;
int num1;
if (!againAllow) {
MessageBox.post("当前操作的版本不是最新发布版本的下一个未发布版本,不允许再次试验", "提示", MessageBox.WARNING);
return;
}
for (int i = 0; i < table.getRowCount(); i++) {
xm = (obj = table.getValueAt(i, 4)) == null ? "" : obj.toString();
if (temp[4].equals(xm)) {
num1 = Integer.parseInt((obj = table.getValueAt(i, 14)) == null ? "0" : obj.toString());
if (cishuNum < num1) {
isNotLatest = true;
break;
}
}
}
if (isNotLatest) {
MessageBox.post("请选择最新的一次实验", "提示", MessageBox.WARNING);
return;
}
// boolean allowFlag = false;
// if (againAllowFlow == null) {
// try {
// againAllowFlow = JDMethodUtil.getPrefStrArray("jd_csjh_again_allow", session)[1];// 部件
// TCComponent[] comps = form.getRelatedComponents("fnd0AllWorkflows");
// if (comps.length > 0) {
// String flowName;
// for (TCComponent comp : comps) {
// flowName = comps[0].getProperty("object_name");
// System.out.println(flowName);
// if (flowName.equals(againAllowFlow)) {
// allowFlag = true;
// break;
// }
// }
// } else {
// MessageBox.post("无法再次试验,请确认当前目标处于流程中", "提示", MessageBox.WARNING);
// return;
// }
// } catch (ArrayIndexOutOfBoundsException ex) {
// // TODO: handle exception
// ex.printStackTrace();
// MessageBox.post("首选项\"jd_csjh_again_allow\"配置错误", "错误", MessageBox.ERROR);
// return;
// } catch (TCException e1) {
// // TODO Auto-generated catch block
// e1.printStackTrace();
// }
// }
// if (!allowFlag) {
// MessageBox.post("无法再次试验,目标所处流程状态不满足\"jd_csjh_again_allow\"配置", "提示", MessageBox.WARNING);
// return;
// }
temp[14] = String.valueOf(cishuNum + 1);
// temp[16] = (String) model.getValueAt(table.getSelectedRow(), 16);
temp[15] = (String) model.getValueAt(table.getSelectedRow(), 15);
model.insertRow(table.getSelectedRow() + 1, temp);
for (int i = table.getSelectedRow() + 1; i < model.getRowCount(); i++) {
@ -567,17 +736,28 @@ public class CSJHForm extends AbstractRendering {
}
label2.setText(allcost2 + "元");
editable.add(table.getSelectedRow());
for (int i = 0; i < editable.size(); i++) {
if (editable.get(i) >= (table.getSelectedRow() + 1)) {
editable.set(i, editable.get(i) + 1);
}
}
for (Entry<String, JG> entry : res.entrySet()) {
if (entry.getValue().getRow() >= (table.getSelectedRow() + 1)) {
res.get(entry.getKey()).setRow(entry.getValue().getRow() + 1);
}
}
rowNo.put(table.getSelectedRow() + 1, rowNo.get(table.getSelectedRow()));
});
table.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (table.getSelectedColumn() == 14) {
if (table.getSelectedColumn() == 16) {
if (e.getClickCount() == 2) {
System.out.println("双击了");
int selectedRow = table.getSelectedRow(); // 获得选中行索引
String value = (String) model.getValueAt(selectedRow, 14);
String value = (String) model.getValueAt(selectedRow, 16);
if (value == null)
value = "";
if (!value.equals("")) {
@ -605,7 +785,9 @@ public class CSJHForm extends AbstractRendering {
public void saveRendering() {
try {
List<TCComponent> c = new ArrayList<TCComponent>();
if (table.getSelectedColumn() >= 0) {
table.getColumnModel().getColumn(table.getSelectedColumn()).getCellEditor().stopCellEditing();
}
// TCComponent[] com = form.getTCProperty("sf6_EplanBOMLineTable").getReferenceValueArray();
// for (int j = 0; j < com.length; j++) {
// c.add(com[j]);

@ -9,7 +9,6 @@ import java.awt.FlowLayout;
import java.awt.ScrollPane;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
@ -27,6 +26,7 @@ import com.connor.jd.plm.table.CTMap;
import com.connor.jd.plm.table.CTable;
import com.connor.jd.plm.table.MyCellEditor4;
import com.connor.jd.plm.table.TCTableUtil;
import com.connor.jd.plm.utils.DBUtil;
import com.teamcenter.rac.aifrcp.AIFUtility;
import com.teamcenter.rac.kernel.TCComponentForm;
import com.teamcenter.rac.kernel.TCComponentItem;
@ -34,6 +34,7 @@ import com.teamcenter.rac.kernel.TCComponentItemRevision;
import com.teamcenter.rac.kernel.TCComponentItemType;
import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.util.MessageBox;
import cn.hutool.db.Db;
import cn.hutool.db.Entity;
@ -142,7 +143,7 @@ public class ComponentTestFrame extends JFrame {
// ÌîдÊý¾Ý
try {
list = Db.use().findAll("JD2_COMPONENT");
list = Db.use(DBUtil.getDataSource(session)).findAll("JD2_COMPONENT");
bottom = list.size();
for (int i = 0; i < bottom; i++) {
if (i > model.getRowCount() - 2) {
@ -159,9 +160,11 @@ public class ComponentTestFrame extends JFrame {
System.out.println(list.get(i).toString());
}
} catch (SQLException e) {
} catch (Exception e) {
// TODO Auto-generated catch block
MessageBox.post("数据库配置错误", "错误", MessageBox.ERROR);
e.printStackTrace();
return;
}
// °´Å¥

@ -4,7 +4,6 @@ import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.ScrollPane;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
@ -20,6 +19,7 @@ import javax.swing.BorderFactory;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
@ -33,6 +33,7 @@ import com.connor.jd.plm.table.TCTableUtil;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentForm;
import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.stylesheet.AbstractRendering;
public class ExperimentalPowerOfAttorneyForm extends AbstractRendering implements MyCallBack {
@ -63,6 +64,7 @@ public class ExperimentalPowerOfAttorneyForm extends AbstractRendering implement
super(arg0);
if (arg0 instanceof TCComponentForm) {
this.form = (TCComponentForm) arg0;
TCSession session = arg0.getSession();
loadRendering();
}
}
@ -107,6 +109,7 @@ public class ExperimentalPowerOfAttorneyForm extends AbstractRendering implement
table.getColumnModel().getColumn(8).setPreferredWidth(80);
table.getColumnModel().getColumn(9).setPreferredWidth(150);
table.getColumnModel().getColumn(10).setPreferredWidth(60);
table.putClientProperty("terminateEditOnFocusLost", true);
DefaultTableCellRenderer tcr1 = new DefaultTableCellRenderer() {
// ÖØÐ´·½·¨
@ -172,6 +175,7 @@ public class ExperimentalPowerOfAttorneyForm extends AbstractRendering implement
table2.getColumnModel().getColumn(8).setPreferredWidth(80);
table2.getColumnModel().getColumn(9).setPreferredWidth(150);
table2.getColumnModel().getColumn(10).setPreferredWidth(60);
table2.putClientProperty("terminateEditOnFocusLost", true);
DefaultTableCellRenderer tcr2 = new DefaultTableCellRenderer() {
// ÖØÐ´·½·¨
@ -254,15 +258,21 @@ public class ExperimentalPowerOfAttorneyForm extends AbstractRendering implement
model.setValueAt(rows[i][ii], top + i + 1, ii > 2 ? ii > 3 ? ii + 4 : ii + 2 : ii);
}
}
// ÊôÐÔÓ³Éä
try {
model.setValueAt(form.whereReferenced()[0].getComponent().getProperty("item_id"), 0, 9);
model.setValueAt(form.getProperty("creation_date"), 1, 9);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
JPanel inner = new JPanel(new BorderLayout());
inner.add(table, BorderLayout.CENTER);
inner.add(table2, BorderLayout.SOUTH);
ScrollPane pane = new ScrollPane();
pane.add(inner);
// ScrollPane pane2 = new ScrollPane();
// pane2.add(table2);
root.add(pane, BorderLayout.CENTER);
// root.add(pane2, BorderLayout.SOUTH);
JScrollPane jsp = new JScrollPane(inner);
root.add(jsp, BorderLayout.CENTER);
this.add(menu);
this.add(root);
}
@ -347,7 +357,6 @@ public class ExperimentalPowerOfAttorneyForm extends AbstractRendering implement
model.setValueAt(i - top, i, 0);
disableEdit.add(i + ",0");
}
}
private void initModel2() {
@ -436,16 +445,19 @@ public class ExperimentalPowerOfAttorneyForm extends AbstractRendering implement
if (prop.containsKey("jd2_sywts")) {
List<String[]> data = new ArrayList<String[]>();
int num = 0;
while (model.getValueAt(top + 1 + num, 1) != null && !"".equals(model.getValueAt(top + 1 + num, 1))) {
while (true) {
boolean isNotEmpty = false;
String[] row = new String[7];
for (int ii = 0; ii < row.length; ii++) {
Object object = model.getValueAt(top + 1 + num, ii > 2 ? ii > 3 ? ii + 4 : ii + 2 : ii);
if (object == null) {
row[ii] = "";
} else {
row[ii] = object.toString();
row[ii] = object == null ? "" : object.toString();
if (!isNotEmpty && ii > 0 && ii < 4) {
isNotEmpty = !"".equals(row[ii]);
}
}
if (!isNotEmpty) {
break;
}
data.add(row);
num++;
if (top + 1 + num > bottom) {

@ -6,7 +6,6 @@ import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.ScrollPane;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
@ -14,6 +13,7 @@ import java.awt.event.MouseEvent;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -28,6 +28,7 @@ import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.filechooser.FileFilter;
import javax.swing.filechooser.FileNameExtensionFilter;
import javax.swing.table.DefaultTableModel;
@ -35,6 +36,7 @@ import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
import com.connor.jd.plm.beans.JG;
import com.connor.jd.plm.table.DatePickerCellEditor;
import com.connor.jd.plm.table.TCTableUtil;
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
import com.teamcenter.rac.aifrcp.AIFUtility;
@ -48,6 +50,7 @@ import com.teamcenter.rac.kernel.TCComponentItemType;
import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.stylesheet.AbstractRendering;
import com.teamcenter.rac.util.MessageBox;
public class GTCSJHForm extends AbstractRendering {
private TCComponentForm form;
@ -57,11 +60,12 @@ public class GTCSJHForm extends AbstractRendering {
private String[] labellTexts = { "jd2_xmxx", "jd2_lxsj", "jd2_jbxh", "jd2_csxh", "jd2_cpxh", "jd2_xmzl", "jd2_cpjl",
"jd2_cpbgd", "jd2_pzjl", "jd2_kfrc", "jd2_kfdj", "jd2_kfjd" };
private String[] colNames = { "jd2_no", "jd2_syxh", "jd2_symd", "jd2_wtry", "jd2_syxm", "jd2_syts", "jd2_syzq",
"jd2_syfy", "jd2_jhrc", "jd2_sjrc", "jd2_syzt", "jd2_syjg", "jd2_sycs", "jd2_syry", "jd2_csbg", "jd2_bz" };
"jd2_syfy", "jd2_jhrc", "jd2_jhrc1", "jd2_sjrc", "jd2_sjrc1", "jd2_syzt", "jd2_syjg", "jd2_sycs",
"jd2_syry", "jd2_csbg", "jd2_bz" };
private String[] colDisplayNames = new String[] { "realNo", "NO", "试验型号", "试验目的", "委托人员", "试验项目", "试验台数", "试验周期",
"试验费用", "计划日程", "实际日程", "试验状态", "实验结果", "第_次试验", "实验人员", "测试报告", "备注" };
"试验费用", "计划开始日程", "计划完成日程", "实际开始日程", "实际完成日程", "试验状态", "实验结果", "第_次试验", "实验人员", "测试报告", "备注" };
private List<Integer> disableRows = new ArrayList<Integer>();
private List<Integer> disableColumns = Arrays.asList(4, 5, 6, 7, 8, 13, 15);
private List<Integer> disableColumns = Arrays.asList(4, 5, 6, 8, 15, 17);// 委托人员, 试验项目, 试验台数,第_次试验,测试报告
private Map<String, JG> resultMap = new HashMap<String, JG>();
private JTable table;
private DefaultTableModel model;
@ -69,6 +73,7 @@ public class GTCSJHForm extends AbstractRendering {
private TCSession session;
private JLabel cost;
private JLabel jg;
private boolean againAllow = false;
public GTCSJHForm(TCComponent arg0) throws Exception {
super(arg0);
@ -165,6 +170,7 @@ public class GTCSJHForm extends AbstractRendering {
status.addItem("待测");
status.addItem("进行中");
status.addItem("完成");
status.addItem(" ");
DefaultCellEditor dce1 = new DefaultCellEditor(status) {
int row;
@ -179,7 +185,7 @@ public class GTCSJHForm extends AbstractRendering {
public Object getCellEditorValue() {
Object obj = super.getCellEditorValue();
if ("完成".equals(obj == null ? "" : obj.toString())) {
disableRows.add(row);
// disableRows.add(row);
}
return obj;
}
@ -187,6 +193,7 @@ public class GTCSJHForm extends AbstractRendering {
JComboBox<String> result = new JComboBox<String>();
result.addItem("合格");
result.addItem("不合格");
result.addItem(" ");
DefaultCellEditor dce2 = new DefaultCellEditor(result) {
JTable table;
int row;
@ -205,32 +212,44 @@ public class GTCSJHForm extends AbstractRendering {
String res = (obj == null ? "" : obj.toString());
String no = table.getValueAt(row, 0).toString();
Object temp;
int times = Integer.parseInt((temp = table.getValueAt(row, 13)) == null ? "0" : temp.toString().trim());
int times = Integer.parseInt((temp = table.getValueAt(row, 15)) == null ? "0" : temp.toString().trim());
System.out.println("结果:" + res);
addResult(no, row, times, res);
jg.setText(getResult());
return obj;
}
};
DatePickerCellEditor dpce = new DatePickerCellEditor(new JTextField());
table = new JTable(model);
TableColumn tc = table.getColumnModel().getColumn(0);
for (int i = 1; i < table.getColumnCount(); i++) {
table.getColumnModel().getColumn(i).setMinWidth(100);
}
hiddenColumn(table, 0);
table.getColumnModel().getColumn(11).setCellEditor(dce1);
table.getColumnModel().getColumn(12).setCellEditor(dce2);
DefaultCellEditor deafult = new DefaultCellEditor(new JTextField());
for (int i = 0; i < table.getColumnCount(); i++) {
table.getColumnModel().getColumn(i).setCellEditor(deafult);
}
table.getColumnModel().getColumn(9).setCellEditor(dpce);
table.getColumnModel().getColumn(10).setCellEditor(dpce);
table.getColumnModel().getColumn(11).setCellEditor(dpce);
table.getColumnModel().getColumn(12).setCellEditor(dpce);
table.getColumnModel().getColumn(13).setCellEditor(dce1);
table.getColumnModel().getColumn(14).setCellEditor(dce2);
table.setRowHeight(25);
table.setAutoscrolls(true);
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
table.getTableHeader().setReorderingAllowed(false);
// table.putClientProperty("terminateEditOnFocusLost", true);// 表格失去焦点自动提交(事件控件today会有问题)
table.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (table.getSelectedColumn() == 15) {
if (table.getSelectedColumn() == 17) {
if (e.getClickCount() == 2) {
System.out.println("双击了");
int selectedRow = table.getSelectedRow(); // 获得选中行索引
String value = (String) model.getValueAt(selectedRow, 15);
String value = (String) model.getValueAt(selectedRow, 17);
if (value == null)
value = "";
if (!value.equals("")) {
@ -252,7 +271,6 @@ public class GTCSJHForm extends AbstractRendering {
}
});
JScrollPane jsp = new JScrollPane(table);
jsp.setAutoscrolls(true);
innerCenter.add(jsp, BorderLayout.CENTER);
JButton test = new JButton("<html>测试报告<br>上传</html>");
@ -285,7 +303,7 @@ public class GTCSJHForm extends AbstractRendering {
AIFComponentContext[] aifs = form.whereReferenced();
String temp;
for (AIFComponentContext a1 : aifs) {
System.out.println("测试计划版本:" + (temp = a1.getComponent().getType()));
System.out.println("测试结论版本:" + (temp = a1.getComponent().getType()));
if ("JD2_GTXPXMCSJHRevision".equals(temp)) {
TCComponentItemRevision rev = (TCComponentItemRevision) a1.getComponent();
AIFComponentContext[] aifs2 = rev.getItem().whereReferenced();
@ -311,30 +329,81 @@ public class GTCSJHForm extends AbstractRendering {
}
String[][] data = TCTableUtil.getTableRows(form, "jd2_csjhtable", colNames);
// colNames = { "jd2_no", "jd2_syxh", "jd2_symd", "jd2_wtry", "jd2_syxm", "jd2_syts", "jd2_syzq",
// "jd2_syfy", "jd2_jhrc", "jd2_sjrc", "jd2_syzt", "jd2_syjg", "jd2_sycs", "jd2_syry", "jd2_csbg", "jd2_bz" };
// colDisplayNames = new String[] { "realNo", "NO", "试验型号", "试验目的", "委托人员", "试验项目", "试验台数", "试验周期",
// "试验费用", "计划日程", "实际日程", "试验状态", "实验结果", "第_次试验", "实验人员", "测试报告", "备注" };
System.out.println(data[0].length);
System.out.println(colNames.length);
System.out.println(Arrays.deepToString(data));
System.out.println(data.length);
double sum = 0;
for (int i = 0; i < data.length; i++) {
String[] rowData = new String[17];
String[] rowData = new String[19];
rowData[0] = data[i][0];
rowData[1] = i + 1 + "";
for (int ii = 1; ii < colNames.length; ii++) {
rowData[ii + 1] = data[i][ii];
}
Arrays.toString(rowData);
model.addRow(rowData);
if ("完成".equals(data[i][10])) {
disableRows.add(i);
if ("完成".equals(data[i][12])) {
// disableRows.add(i);
}
sum += Double.parseDouble(data[i][7]);
addResult(data[i][0], i, Integer.parseInt(data[i][12]), data[i][11]);
addResult(data[i][0], i, Integer.parseInt(data[i][14]), data[i][13]);
}
// 最新发布
TCComponentItem item = rev.getItem();
TCComponentItemRevision[] revs = item.getReleasedItemRevisions();
Comparator<TCComponent> leatestRevisionComparator = new Comparator<TCComponent>() {
@Override
public int compare(TCComponent o1, TCComponent o2) {
// TODO Auto-generated method stub
try {
return o1.getProperty("item_revision_id").compareTo(o2.getProperty("item_revision_id"));
} catch (TCException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return 0;
}
};
Arrays.parallelSort(revs, leatestRevisionComparator);
if (revs.length > 0) {
List<Map<String, String>> dataMap = TCTableUtil.getTableMapList(
(TCComponentForm) revs[revs.length - 1].getRelatedComponent("IMAN_master_form_rev"),
"jd2_csjhtable", colNames);
List<String> realNoList = new ArrayList<String>();
for (Map<String, String> tempMap : dataMap) {
realNoList.add(tempMap.get("jd2_no") + "," + tempMap.get("jd2_sycs"));
}
for (int i = 0; i < data.length; i++) {
if (realNoList.contains(data[i][0] + "," + data[i][14])) {
disableRows.add(i);
}
}
}
// 目前版本是否为最新发布的下一个版本
List<String> releasedObjectString = new ArrayList<String>();
for (int i = 0; i < revs.length; i++) {
releasedObjectString.add(revs[i].getProperty("object_string"));
}
if (revs.length > 0) {
if (!releasedObjectString.contains(rev.getProperty("object_string"))) {
TCComponent[] allRev = item.getRelatedComponents("revision_list");
Arrays.parallelSort(allRev, leatestRevisionComparator);
for (int i = 0; i < allRev.length; i++) {
if (allRev[i].getProperty("object_string")
.equals(revs[revs.length - 1].getProperty("object_string")) && i + 1 < allRev.length) {
if (rev.getProperty("object_string").equals(allRev[i + 1].getProperty("object_string"))) {
againAllow = true;
break;
}
}
}
}
}
table.revalidate();
table.repaint();
cost.setText(sum + "");
@ -344,14 +413,16 @@ public class GTCSJHForm extends AbstractRendering {
inner.add(innerCenter);
root.add(top, BorderLayout.NORTH);
root.add(inner, BorderLayout.CENTER);
ScrollPane sc = new ScrollPane();
sc.add(root);
this.add(sc, BorderLayout.CENTER);
JScrollPane jsp1 = new JScrollPane(root);
this.add(jsp1, BorderLayout.CENTER);
}
@Override
public void saveRendering() {
// TODO Auto-generated method stub
if (table.getSelectedColumn() >= 0) {
table.getColumnModel().getColumn(table.getSelectedColumn()).getCellEditor().stopCellEditing();
}
String[][] data = new String[0][];
List<String[]> dataList = new ArrayList<String[]>();
Object obj;
@ -374,10 +445,11 @@ public class GTCSJHForm extends AbstractRendering {
// TODO Auto-generated method stub
JFileChooser chooser = new JFileChooser();
chooser.setDialogTitle("选择上传的测试报告");
FileFilter filter = new FileNameExtensionFilter("Excel工作簿(.xlsx)", "xlsx");
FileFilter filter = new FileNameExtensionFilter("Excel工作簿(.xlsx,.xls,.xlsm)", "xlsx", "xls", "xlsm");
chooser.setFileFilter(filter);
chooser.showOpenDialog(null);
File file = chooser.getSelectedFile();
if (file != null) {
String filePath = file.getPath();
String fileName = file.getName();
@ -385,7 +457,7 @@ public class GTCSJHForm extends AbstractRendering {
System.out.println(filePath);
System.out.println(fileName);
int row = table.getSelectedRow();
String value = model.getValueAt(row, 15) == null ? "" : model.getValueAt(row, 15).toString();
String value = model.getValueAt(row, 17) == null ? "" : model.getValueAt(row, 17).toString();
if (value.equals("")) {
try {
TCComponentItemType itemtype = (TCComponentItemType) session.getTypeComponent("JD2_GTCSBG");
@ -404,7 +476,7 @@ public class GTCSJHForm extends AbstractRendering {
TCComponentDataset datasetMSExcelX = datasetType.create(filename, "", msType);
datasetMSExcelX.setFiles(new String[] { filePath }, new String[] { "excel" });// 两参文件路径命名应用text
item.getLatestItemRevision().add("IMAN_specification", datasetMSExcelX);
model.setValueAt(item.getProperty("current_id"), row, 15);
model.setValueAt(item.getProperty("current_id"), row, 17);
} catch (TCException e1) {
e1.printStackTrace();
}
@ -446,7 +518,7 @@ public class GTCSJHForm extends AbstractRendering {
TCComponentDataset datasetMSExcelX = datasetType.create(filename, "", msType);
datasetMSExcelX.setFiles(new String[] { filePath }, new String[] { "excel" });// 两参文件路径命名应用text
item.getLatestItemRevision().add("IMAN_specification", datasetMSExcelX);
model.setValueAt(item.getProperty("current_id"), row, 15);
model.setValueAt(item.getProperty("current_id"), row, 17);
} catch (TCException e1) {
e1.printStackTrace();
}
@ -467,88 +539,113 @@ public class GTCSJHForm extends AbstractRendering {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
int row = table.getSelectedRow();
String value = (String) model.getValueAt(row, 15);
// int row = table.getSelectedRow();
// String value = (String) model.getValueAt(row, 17);
JFileChooser chooser = new JFileChooser();
chooser.setDialogTitle("选择上传的汇总结论");
FileFilter filter = new FileNameExtensionFilter("Excel工作簿(.xlsx)", "xlsx");// 设置文件过滤器只列出JPG或GIF格式的图片
FileFilter filter = new FileNameExtensionFilter("Excel工作簿(.xlsx,.xls,.xlsm),PPT演示文稿(.ppt,.pptx)",
"xlsx", "xls", "xlsm", "ppt", "pptx");// 设置文件过滤器只列出JPG或GIF格式的图片
chooser.setFileFilter(filter);
chooser.showOpenDialog(null);
File file = chooser.getSelectedFile();
if (file != null) {
TCComponentItemRevision parentRev = null;
try {
AIFComponentContext[] aifs = rev.getItem().whereReferenced();
for (AIFComponentContext aif : aifs) {
if (aif.getComponent().getType().equals("JD2_GTXPCSXQDRevision")) {
parentRev = (TCComponentItemRevision) aif.getComponent();
break;
}
}
} catch (TCException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
}
if (file != null && parentRev != null) {
String filePath = file.getPath();
String fileName = file.getName();
String filename = fileName.substring(0, fileName.lastIndexOf("."));
System.out.println(filePath);
System.out.println(fileName);
if (value.equals("")) {
// if (value.equals("")) {
try {
TCComponentItemType itemtype = (TCComponentItemType) session.getTypeComponent("JD2_GTCSBG");
String itemId = itemtype.getNewID();
String itemRev = itemtype.getNewRev(null);
TCComponentItem item = itemtype.create(itemId, itemRev, "JD2_GTCSBG", fileName, "描述", null);
rev.add("JD2_CSBGHZ", item);
TCComponentDatasetType datasetType = (TCComponentDatasetType) session
.getTypeComponent("Dataset");
String msType = "";
if (filePath.endsWith(".xls")) {
msType = "MSExcel";
} else if (filePath.endsWith(".xlsx") || filePath.endsWith(".xlsm")) {
msType = "MSExcelX";
}
TCComponentDataset datasetMSExcelX = datasetType.create(filename, "", msType);
datasetMSExcelX.setFiles(new String[] { filePath }, new String[] { "excel" });// 两参文件路径命名应用text
item.getLatestItemRevision().add("IMAN_specification", datasetMSExcelX);
} catch (TCException e1) {
e1.printStackTrace();
}
} else {
// 添加到数据集
boolean exist = false;
try {
TCComponent[] tcc = rev.getTCProperty("JD2_CSBGHZ").getReferenceValueArray();
for (int i = 0; i < tcc.length; i++) {
if (value.equals(tcc[i].getProperty("current_id"))) {
exist = true;
TCComponentItem item = (TCComponentItem) tcc[i];
TCComponent[] tccitem = item.getLatestItemRevision()
.getTCProperty("IMAN_specification").getReferenceValueArray();
TCComponentDataset dataset = (TCComponentDataset) tccitem[0];
dataset.setFiles(new String[] { file.getPath() }, new String[] { "excel" });
dataset.setProperty("object_name", filename);
item.setProperty("object_name", filename);
item.getLatestItemRevision().setProperty("object_name", filename);
}
}
if (!exist) {
try {
TCComponentItemType itemtype = (TCComponentItemType) session
.getTypeComponent("JD2_GTCSBG");
String itemId = itemtype.getNewID();
String itemRev = itemtype.getNewRev(null);
TCComponentItem item = itemtype.create(itemId, itemRev, "JD2_GTCSBG", fileName,
"描述", null);
rev.add("JD2_CSBGHZ", item);
parentRev.add("JD2_CSBGHZ", item);
TCComponentDatasetType datasetType = (TCComponentDatasetType) session
.getTypeComponent("Dataset");
String msType = "";
String fileType = "";
if (filePath.endsWith(".xls")) {
msType = "MSExcel";
fileType = "excel";
} else if (filePath.endsWith(".xlsx") || filePath.endsWith(".xlsm")) {
msType = "MSExcelX";
fileType = "excel";
} else if (filePath.endsWith(".ppt")) {
msType = "MSPowerPoint";
fileType = "powerpoint";
} else if (filePath.endsWith(".pptx")) {
msType = "MSPowerPointX";
fileType = "powerpoint";
}
TCComponentDataset datasetMSExcelX = datasetType.create(filename, "", msType);
datasetMSExcelX.setFiles(new String[] { filePath }, new String[] { "excel" });// 两参文件路径命名应用text
datasetMSExcelX.setFiles(new String[] { filePath }, new String[] { fileType });// 两参文件路径命名应用text
item.getLatestItemRevision().add("IMAN_specification", datasetMSExcelX);
MessageBox.post("上传成功", "提示", MessageBox.WARNING);
} catch (TCException e1) {
e1.printStackTrace();
}
}
} catch (TCException e1) {
e1.printStackTrace();
}
}
// } else {
// // 添加到数据集
// boolean exist = false;
// try {
// TCComponent[] tcc = rev.getTCProperty("JD2_CSBGHZ").getReferenceValueArray();
// for (int i = 0; i < tcc.length; i++) {
// if (value.equals(tcc[i].getProperty("current_id"))) {
// exist = true;
// TCComponentItem item = (TCComponentItem) tcc[i];
// TCComponent[] tccitem = item.getLatestItemRevision()
// .getTCProperty("IMAN_specification").getReferenceValueArray();
// TCComponentDataset dataset = (TCComponentDataset) tccitem[0];
// dataset.setFiles(new String[] { file.getPath() }, new String[] { "excel" });
// dataset.setProperty("object_name", filename);
// item.setProperty("object_name", filename);
// item.getLatestItemRevision().setProperty("object_name", filename);
// }
// }
// if (!exist) {
// try {
// TCComponentItemType itemtype = (TCComponentItemType) session
// .getTypeComponent("JD2_GTCSBG");
// String itemId = itemtype.getNewID();
// String itemRev = itemtype.getNewRev(null);
// TCComponentItem item = itemtype.create(itemId, itemRev, "JD2_GTCSBG", fileName,
// "描述", null);
// parentRev.add("JD2_CSBGHZ", item);
// TCComponentDatasetType datasetType = (TCComponentDatasetType) session
// .getTypeComponent("Dataset");
// String msType = "";
// if (filePath.endsWith(".xls")) {
// msType = "MSExcel";
// } else if (filePath.endsWith(".xlsx") || filePath.endsWith(".xlsm")) {
// msType = "MSExcelX";
// }
// TCComponentDataset datasetMSExcelX = datasetType.create(filename, "", msType);
// datasetMSExcelX.setFiles(new String[] { filePath }, new String[] { "excel" });// 两参文件路径命名应用text
// item.getLatestItemRevision().add("IMAN_specification", datasetMSExcelX);
// } catch (TCException e1) {
// e1.printStackTrace();
// }
// }
// } catch (TCException e1) {
// e1.printStackTrace();
// }
//
// }
}
}
};
@ -562,27 +659,91 @@ public class GTCSJHForm extends AbstractRendering {
// TODO Auto-generated method stub
int row = table.getSelectedRow();
Object obj;
// "realNo", "NO", "试验型号", "试验目的", "委托人员", "试验项目", "试验台数", "试验周期",
// "试验费用", "计划日程", "实际日程", "试验状态", "实验结果", "第_次试验", "实验人员", "测试报告", "备注"
if (row != -1) {
if (!againAllow) {
MessageBox.post("当前操作的版本不是最新发布版本的下一个未发布版本,不允许再次试验", "提示", MessageBox.WARNING);
return;
}
String realNum = (obj = table.getValueAt(row, 0)) == null ? "0" : obj.toString();
int num = Integer.parseInt((obj = table.getValueAt(row, 1)) == null ? "0" : obj.toString());
String[] rowData = new String[table.getColumnCount()];
rowData[0] = realNum;
rowData[1] = num + 1 + "";
num = Integer.parseInt((obj = table.getValueAt(row, 15)) == null ? "0" : obj.toString());
boolean isNotLatest = false;
String realNum1;
int num1;
for (int i = 0; i < table.getRowCount(); i++) {
realNum1 = (obj = table.getValueAt(i, 0)) == null ? "0" : obj.toString();
if (realNum.equals(realNum1)) {
num1 = Integer.parseInt((obj = table.getValueAt(i, 15)) == null ? "0" : obj.toString());
if (num < num1) {
isNotLatest = true;
break;
}
}
}
if (isNotLatest) {
MessageBox.post("请选择最新的一次实验", "提示", MessageBox.WARNING);
return;
}
// boolean allowFlag = false;
// if (againAllowFlow == null) {
// try {
// againAllowFlow = JDMethodUtil.getPrefStrArray("jd_csjh_again_allow", session)[0];// 整机
// TCComponent[] comps = form.getRelatedComponents("fnd0AllWorkflows");
// if (comps.length > 0) {
// String flowName;
// for (TCComponent comp : comps) {
// flowName = comps[0].getProperty("object_name");
// System.out.println(flowName);
// if (flowName.equals(againAllowFlow)) {
// allowFlag = true;
// break;
// }
// }
// } else {
// MessageBox.post("无法再次试验,请确认当前目标处于流程中", "提示", MessageBox.WARNING);
// return;
// }
// } catch (ArrayIndexOutOfBoundsException ex) {
// // TODO: handle exception
// ex.printStackTrace();
// MessageBox.post("首选项\"jd_csjh_again_allow\"配置错误", "错误", MessageBox.ERROR);
// return;
// } catch (TCException e1) {
// // TODO Auto-generated catch block
// e1.printStackTrace();
// }
// }
// if (!allowFlag) {
// MessageBox.post("无法再次试验,目标所处流程状态不满足\"jd_csjh_again_allow\"配置", "提示", MessageBox.WARNING);
// return;
// }
for (int i = 2; i < 9; i++) {
rowData[i] = (obj = table.getValueAt(row, i)) == null ? "" : obj.toString();
}
num = Integer.parseInt((obj = table.getValueAt(row, 13)) == null ? "0" : obj.toString());
rowData[13] = num + 1 + "";
rowData[15] = num + 1 + "";
rowData[16] = (obj = table.getValueAt(row, 16)) == null ? "" : obj.toString();
disableRows.add(row);
model.insertRow(row + 1, rowData);
for (int i = 0; i < disableRows.size(); i++) {
if (disableRows.get(i) >= (row + 1)) {
disableRows.set(i, disableRows.get(i) + 1);
}
}
for (Entry<String, JG> entry : resultMap.entrySet()) {
if (entry.getValue().getRow() >= (row + 1)) {
resultMap.get(entry.getKey()).setRow(entry.getValue().getRow() + 1);
}
}
table.revalidate();
table.repaint();
cost.setText(getCost() + "");
}
}
};
}
@ -611,8 +772,10 @@ public class GTCSJHForm extends AbstractRendering {
private void addResult(String realNo, int row, int times, String result) {
if (resultMap.containsKey(realNo)) {
if (times > resultMap.get(realNo).getTimes()) {
disableRows.add(resultMap.get(realNo).getRow());
if (times >= resultMap.get(realNo).getTimes()) {
if (table.getSelectedRow() < 0) {
disableRows.add(resultMap.get(realNo).getRow());// 初始化时禁止填写次数小的
}
resultMap.put(realNo, new JG(row, times, result));
}
} else {
@ -621,14 +784,21 @@ public class GTCSJHForm extends AbstractRendering {
}
private String getResult() {
boolean notEmpty = false;
boolean qualified = true;
for (Entry<String, JG> entry : resultMap.entrySet()) {
System.out.println("realNo:" + entry.getKey() + "row:" + entry.getValue().getRow() + "jg:"
+ entry.getValue().getJg() + "times:" + entry.getValue().getTimes());
// System.out.println("realNo:" + entry.getKey() + "row:" + entry.getValue().getRow() + "jg:"
// + entry.getValue().getJg() + "times:" + entry.getValue().getTimes());
if (!"".equals(entry.getValue().getJg().trim())) {
notEmpty = true;
}
if ("不合格".equals(entry.getValue().getJg())) {
return "不合格";
qualified = false;
break;
}
}
return "合格";
return notEmpty ? (qualified ? "合格" : "不合格") : "";
}
@Override

@ -6,7 +6,6 @@ import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.ScrollPane;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
@ -14,6 +13,9 @@ import java.awt.event.MouseEvent;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -22,8 +24,10 @@ import javax.swing.DefaultCellEditor;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
@ -31,16 +35,23 @@ import javax.swing.table.DefaultTableCellRenderer;
import com.connor.jd.plm.table.CTMap;
import com.connor.jd.plm.table.CTable;
import com.connor.jd.plm.table.JCheckPanel;
import com.connor.jd.plm.table.ModelList;
import com.connor.jd.plm.table.ModelValue;
import com.connor.jd.plm.table.MyCellEditor3;
import com.connor.jd.plm.table.TCTableUtil;
import com.connor.jd.plm.utils.DBUtil;
import com.connor.jd.plm.utils.DialogUtil;
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
import com.teamcenter.rac.aifrcp.AIFUtility;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentDataset;
import com.teamcenter.rac.kernel.TCComponentForm;
import com.teamcenter.rac.kernel.TCComponentItem;
import com.teamcenter.rac.kernel.TCComponentItemRevision;
import com.teamcenter.rac.kernel.TCComponentItemType;
import com.teamcenter.rac.kernel.TCComponentProject;
import com.teamcenter.rac.kernel.TCComponentSchedule;
import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.stylesheet.AbstractRendering;
@ -65,14 +76,31 @@ public class NewProductTestForm extends AbstractRendering {
private String[] colNames = { "jd2_no", "jd2_lb", "jd2_xm", "jd2_xmfy", "jd2_DV", "jd2_PV", "jd2_PR", "jd2_SR",
"jd2_bz" };
private String[] colNames2 = { "jd2_no", "jd2_wtry", "jd2_syxm", "jd2_syts", "jd2_syfy", "jd2_sycs" };
private String[] colNames3 = { "jd2_no", "jd2_syxh", "jd2_symd", "jd2_wtry", "jd2_syxm", "jd2_syts", "jd2_syzq",
"jd2_syfy", "jd2_jhrc", "jd2_jhrc1", "jd2_sjrc", "jd2_sjrc1", "jd2_syzt", "jd2_syjg", "jd2_sycs",
"jd2_syry", "jd2_csbg", "jd2_bz" };
private String[] jieduan = { "DV", "PV", "PR", "SR" };
private TCSession session;
private List<String[]> compareDataList = new ArrayList<String[]>();
private boolean testFlag = false;
private List<String> realIdStr = new ArrayList<String>();
private TCComponentProject project;
private NewProductTestForm $this;
public NewProductTestForm(TCComponent arg0) throws Exception {
super(arg0);
if (arg0 instanceof TCComponentForm) {
this.form = (TCComponentForm) arg0;
this.session = (TCSession) AIFUtility.getCurrentApplication().getSession();
try {
dbData = Db.use(DBUtil.getDataSource(session))
.query("select * from JD2_Machine ORDER BY TEST_TYPE ASC");
} catch (Exception e) {
MessageBox.post("数据库配置错误", "错误", MessageBox.ERROR);
e.printStackTrace();
return;
}
$this = this;
loadRendering();
}
}
@ -125,6 +153,7 @@ public class NewProductTestForm extends AbstractRendering {
table1.getColumnModel().getColumn(1).setPreferredWidth(100);
table1.getColumnModel().getColumn(2).setPreferredWidth(100);
table1.getColumnModel().getColumn(3).setPreferredWidth(200);
table1.putClientProperty("terminateEditOnFocusLost", true);
DefaultTableCellRenderer tcr1 = new DefaultTableCellRenderer() {
// 重写方法
@ -132,6 +161,9 @@ public class NewProductTestForm extends AbstractRendering {
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
boolean hasFocus, int row, int column) {
// TODO Auto-generated method stub
if (value instanceof JCheckPanel) {
return (JCheckPanel) value;
}
int maxPreferredHeight = 0;
for (int i = 0; i < table.getColumnCount(); i++) {
@ -177,16 +209,10 @@ public class NewProductTestForm extends AbstractRendering {
data = TCTableUtil.getTableRows(form, "jd2_xpcsxqd", colNames);
if (data.length == 0) {
try {
dbData = Db.use().query("select * from JD2_Machine ORDER BY TEST_TYPE ASC");
model2 = new CTMap(dbData.size() + 3, 9);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
for (int i = 0; i < dbData.size(); i++) {
System.out.println(dbData.get(i).toString());
realIdStr.add(dbData.get(i).getStr("TEST_ID"));
modelList2.add(new ModelValue(dbData.get(i).getStr("TEST_PROJECT"), false, i + 2, 2, false));
modelList2.add(new ModelValue(dbData.get(i).getInt("TEST_COST") + "", false, i + 2, 3, false));
if (i == 0) {
@ -199,7 +225,8 @@ public class NewProductTestForm extends AbstractRendering {
type = dbData.get(i).getStr("TEST_TYPE");
typeSpan = 0;
}
if ((i == dbData.size() - 1)) {
System.out.println(dbData.get(i).toString());
if (i == dbData.size() - 1) {
System.out.println(type);
modelList2.add(
new ModelValue(type, false, i - typeSpan + 2, 1, false, i - typeSpan + 2, i + 2, 1, 1));
@ -211,11 +238,44 @@ public class NewProductTestForm extends AbstractRendering {
typeSpan++;
}
} else {
for (int i = 0; i < data.length; i++) {
compareDataList.add(data[i]);
realIdStr.add(data[i][0]);
}
for (int i = 0; i < dbData.size(); i++) {
String realId = dbData.get(i).getStr("TEST_ID");
String[] rowData;
if (realIdStr.indexOf(realId) >= 0) {
rowData = compareDataList.get(realIdStr.indexOf(realId));
rowData[1] = dbData.get(i).getStr("TEST_TYPE");
rowData[2] = dbData.get(i).getStr("TEST_PROJECT");
rowData[3] = dbData.get(i).getStr("TEST_COST");
compareDataList.set(realIdStr.indexOf(realId), rowData);
} else {
rowData = new String[data[0].length];
rowData[0] = realId;
rowData[1] = dbData.get(i).getStr("TEST_TYPE");
rowData[2] = dbData.get(i).getStr("TEST_PROJECT");
rowData[3] = dbData.get(i).getStr("TEST_COST");
rowData[data[0].length - 1] = "";
compareDataList.add(rowData);
}
}
Collections.sort(compareDataList, new Comparator<String[]>() {
@Override
public int compare(String[] o1, String[] o2) {
// TODO Auto-generated method stub
return o1[1].compareTo(o2[1]);
}
});
data = compareDataList.toArray(new String[compareDataList.size()][]);
model2 = new CTMap(data.length + 3, 9);
realIdStr.clear();
for (int i = 0; i < data.length; i++) {
System.out.println(Arrays.toString(data[i]));
modelList2.add(new ModelValue(data[i][2], false, i + 2, 2, false));
modelList2.add(new ModelValue(data[i][3], false, i + 2, 3, false));
realIdStr.add(data[i][0]);
modelList2.add(new ModelValue(data[i][2] == null ? "" : data[i][2], false, i + 2, 2, false));
modelList2.add(new ModelValue(data[i][3] == null ? "" : data[i][3], false, i + 2, 3, false));
if (i == 0) {
type = data[i][1];
}
@ -226,14 +286,16 @@ public class NewProductTestForm extends AbstractRendering {
type = data[i][1];
typeSpan = 0;
}
if ((i == data.length - 1)) {
System.out.println(Arrays.toString(data[i]));
if (i == data.length - 1) {
System.out.println(type);
modelList2.add(
new ModelValue(type, false, i - typeSpan + 2, 1, false, i - typeSpan + 2, i + 2, 1, 1));
}
model2.setValueAt(i + 1, i + 2, 0);
for (int ii = 4; ii < 9; ii++) {
model2.setValueAt(data[i][ii], i + 2, ii);
model2.setValueAt((data[i][ii] == null) ? "/" : data[i][ii], i + 2, ii);
}
typeSpan++;
}
@ -252,7 +314,7 @@ public class NewProductTestForm extends AbstractRendering {
table2 = new CTable(model2) {
@Override
public boolean isCellEditable(int row, int col) {
if (modelList2.isDisableEdit(row, col) || col == 0 || row == table2.getRowCount() - 1) {
if (modelList2.isDisableEdit(row, col)) {
return false;
}
return true;
@ -270,6 +332,7 @@ public class NewProductTestForm extends AbstractRendering {
table2.getColumnModel().getColumn(6).setPreferredWidth(50);
table2.getColumnModel().getColumn(7).setPreferredWidth(50);
table2.getColumnModel().getColumn(8).setPreferredWidth(60);
table2.putClientProperty("terminateEditOnFocusLost", true);
DefaultTableCellRenderer tcr2 = new DefaultTableCellRenderer() {
// 重写方法
@ -321,7 +384,7 @@ public class NewProductTestForm extends AbstractRendering {
if (obj != null) {
String objStr = obj.toString().trim();
try {
if ("/".equals(objStr)) {
if ("/".equals(objStr) || "".equals(objStr)) {
objStr = "0";
}
int num = Integer.parseInt(objStr);
@ -396,7 +459,42 @@ public class NewProductTestForm extends AbstractRendering {
JPanel btns = new JPanel(new FlowLayout(FlowLayout.CENTER));
JButton create = new JButton("创建测试计划");
create.addActionListener(create());
JButton updateDV = new JButton("更新DV");
updateDV.addActionListener(update("DV"));
JButton updatePV = new JButton("更新PV");
updatePV.addActionListener(update("PV"));
JButton updatePR = new JButton("更新PR");
updatePR.addActionListener(update("PR"));
JButton updateSR = new JButton("更新SR");
updateSR.addActionListener(update("SR"));
JButton testBtn = new JButton("清空table内容");
testBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
String[][] temp = new String[0][];
TCTableUtil.setTableRows(form, "jd2_xpcsxqd", "JD2_XPCSXQD", colNames, temp);
// try {
// Map<String, String> testMap = ((TCComponentItemRevision) form.whereReferenced()[0].getComponent())
// .getClassificationAttributes();
// for (Entry<String, String> entry : testMap.entrySet()) {
// System.out.println(entry.getKey() + "====>" + entry.getValue());
// }
// } catch (TCException e1) {
// // TODO Auto-generated catch block
// e1.printStackTrace();
// }
testFlag = true;
}
});
btns.add(create);
btns.add(updateDV);
btns.add(updatePV);
btns.add(updatePR);
btns.add(updateSR);
btns.add(testBtn);
menu.setVisible(false);
addR = new JMenuItem("新增测试项");
@ -404,24 +502,26 @@ public class NewProductTestForm extends AbstractRendering {
addR.addActionListener(addRow());
menu.add(addR);
ScrollPane sc = new ScrollPane();
sc.add(inner);
root.add(sc, BorderLayout.CENTER);
JScrollPane jsp = new JScrollPane(inner);
root.add(jsp, BorderLayout.CENTER);
root.add(btns, BorderLayout.SOUTH);
this.add(root);
}
@Override
public void saveRendering() {
savePropValue(table1, modelList1);
savePropValue(table2, modelList2);
if (testFlag) {
return;
}
saveModel(table1, modelList1);
saveModel(table2, modelList2);
Object obj;
if (data.length == 0) {
if (dbData.size() == 0) {
try {
dbData = Db.use().query("select * from JD2_Machine ORDER BY TEST_TYPE ASC");
dbData = Db.use(DBUtil.getDataSource(session))
.query("select * from JD2_Machine ORDER BY TEST_TYPE ASC");
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@ -430,7 +530,7 @@ public class NewProductTestForm extends AbstractRendering {
data = new String[table2.getRowCount() - 3][9];
for (int i = 0; i < dbData.size(); i++) {
data[i][0] = (obj = model2.getValueAt(i + 2, 0)) == null ? "" : obj.toString();
data[i][0] = dbData.get(i).getStr("TEST_ID");
data[i][1] = dbData.get(i).getStr("TEST_TYPE");
data[i][2] = dbData.get(i).getStr("TEST_PROJECT");
data[i][3] = dbData.get(i).getStr("TEST_COST");
@ -440,8 +540,9 @@ public class NewProductTestForm extends AbstractRendering {
}
System.out.println("dbData.size() " + dbData.size());
System.out.println("table2.getRowCount() " + table2.getRowCount());
for (int i = dbData.size() + 2; i < table2.getRowCount() - 1; i++) {
for (int ii = 0; ii < 9; ii++) {
for (int i = dbData.size(); i < table2.getRowCount() - 3; i++) {
data[i][0] = realIdStr.get(i);
for (int ii = 1; ii < 9; ii++) {
data[i][ii] = (obj = model2.getValueAt(i + 2, ii)) == null ? "" : obj.toString();
}
}
@ -455,8 +556,9 @@ public class NewProductTestForm extends AbstractRendering {
newData[i][ii] = (obj = model2.getValueAt(i + 2, ii)) == null ? "" : obj.toString();
}
}
for (int i = data.length + 2; i < table2.getRowCount() - 1; i++) {
for (int ii = 0; ii < 9; ii++) {
for (int i = data.length; i < table2.getRowCount() - 3; i++) {
newData[i][0] = realIdStr.get(i);
for (int ii = 1; ii < 9; ii++) {
newData[i][ii] = (obj = model2.getValueAt(i + 2, ii)) == null ? "" : obj.toString();
}
}
@ -465,22 +567,6 @@ public class NewProductTestForm extends AbstractRendering {
}
}
private void savePropValue(CTable table, ModelList ml) {
for (ModelValue mv : ml) {
if (mv.isProp()) {
Object obj = table.getValueAt(mv.getRow(), mv.getCol());
try {
if (prop.containsKey(mv.getValue())) {
form.setProperty(mv.getValue(), obj == null ? "" : obj.toString());
}
} catch (TCException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
private MouseAdapter rightClick() {
return new MouseAdapter() {
@Override
@ -503,8 +589,13 @@ public class NewProductTestForm extends AbstractRendering {
// TODO Auto-generated method stub
int row = model2.getRowCount() - 2;
int num = Integer.parseInt(model2.getValueAt(row, 0).toString());
modelList2.findAndAddRow(row + 1, table2.getColumnCount(), 1);
model2.insertRow(model2.getRowCount() - 1);
realIdStr.add(System.currentTimeMillis() + "");
model2.setValueAt(num + 1, row + 1, 0);
for (int i = 4; i < 8; i++) {
model2.setValueAt("/", row + 1, i);
}
table2.revalidate();
table2.repaint();
}
@ -518,15 +609,11 @@ public class NewProductTestForm extends AbstractRendering {
public void actionPerformed(ActionEvent paramActionEvent) {
// TODO Auto-generated method stub
try {
AIFComponentContext[] comps = form.whereReferenced();
StringBuilder msg = new StringBuilder();
for (AIFComponentContext aif : comps) {
System.out.println("ref type:" + aif.getComponent().getType());
if ("JD2_GTXPCSXQDRevision".equals(aif.getComponent().getType())) {
TCComponentItemRevision rev = (TCComponentItemRevision) aif.getComponent();
TCComponent[] compArr = rev.getTCProperty("JD2_CSJH").getReferenceValueArray();
TCComponentItemRevision rev = (TCComponentItemRevision) form.whereReferenced()[0].getComponent();
TCComponent[] comps = rev.getRelatedComponents("JD2_CSJH");
String exist = "";
for (TCComponent t : compArr) {
for (TCComponent t : comps) {
exist += t.getProperty("object_name");
}
List<String[]> colData = new ArrayList<String[]>();
@ -539,44 +626,38 @@ public class NewProductTestForm extends AbstractRendering {
}
Object obj;
Object temp;
int rowNum = 0;
for (int ii = 2; ii < table2.getRowCount() - 1; ii++) {
obj = table2.getValueAt(ii, i + 4);
if (obj != null && !"/".equals(obj.toString().trim())) {
// colNames2 = { "jd2_no", "jd2_wtry", "jd2_syxm", "jd2_syts", "jd2_syfy",
// "jd2_sycs" };
String[] row = new String[6];
row[0] = rowNum + "";
row[0] = realIdStr.get(ii - 2);
row[1] = ownner;
row[2] = (temp = table2.getValueAt(ii, 2)) == null ? "" : temp.toString();
row[3] = obj.toString().trim();
row[4] = (temp = table2.getValueAt(ii, 3)) == null ? "0"
: temp.toString().trim();
row[4] = (temp = table2.getValueAt(ii, 3)) == null ? "0" : temp.toString().trim();
row[5] = "1";
System.out.println(Arrays.toString(row));
colData.add(row);
rowNum++;
}
}
if (colData.size() != 0) {
TCComponentItemType type = (TCComponentItemType) session
.getTypeComponent("JD2_GTXPXMCSJH");
TCComponentItem item = type.create(null, null, "JD2_GTXPXMCSJH",
jieduan[i] + "½×¶Î²âÊԼƻ®", "", null);
TCComponentItemType type = (TCComponentItemType) session.getTypeComponent("JD2_GTXPXMCSJH");
TCComponentItem item = type.create(null, null, "JD2_GTXPXMCSJH", jieduan[i] + "阶段测试计划", "",
null);
rev.add("JD2_CSJH", item);
TCComponentItemRevision rev1 = item.getLatestItemRevision();
TCComponentForm form1 = (TCComponentForm) rev1
.getRelatedComponents("IMAN_master_form_rev")[0];
String[][] dataArr = colData.toArray(new String[colData.size()][6]);
System.out.println(Arrays.deepToString(dataArr));
TCTableUtil.setTableRows(form1, "jd2_csjhtable", "JD2_CSJHTABLE", colNames2,
dataArr);
TCTableUtil.setTableRows(form1, "jd2_csjhtable", "JD2_CSJHTABLE", colNames2, dataArr);
msg.append("\"" + jieduan[i] + "阶段\"测试计划创建成功\n");
}
colData.clear();
}
}
}
MessageBox.post(msg.toString(), "提示", MessageBox.WARNING);
} catch (TCException e) {
// TODO Auto-generated catch block
@ -592,11 +673,98 @@ public class NewProductTestForm extends AbstractRendering {
return form.isCheckedOut();
}
// String[] textArr1 = { "项目信息:", "立项时间:", "基本型号:", "测试型号:", "产品型号:", "项目资料:", "产品经理:", "产品变更点:", "品质经理:", "开发日程:",
// "开发等级:", "开发阶段:" };
// String[] propArr = { "jd2_xmxx", "jd2_lxsj", "jd2_jbxh", "jd2_csxh", "jd2_cpxh", "jd2_xmzl", "jd2_cpjl",
// "jd2_cpbgd", "jd2_pzjl", "jd2_kfrc", "jd2_kfdj", "jd2_kfjd" };
private void initModel(CTMap model, ModelList modelList) {
try {
TCComponentItemRevision rev = (TCComponentItemRevision) form.whereReferenced()[0].getComponent();
AIFComponentContext[] aifs = rev.whereReferenced();
for (AIFComponentContext aif : aifs) {
if (aif.getComponent() instanceof TCComponentProject) {
project = (TCComponentProject) aif.getComponent();
break;
}
}
} catch (TCException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
for (ModelValue mv : modelList) {
if (mv.isProp()) {
if (prop.containsKey(mv.getValue())) {
if (modelList == modelList1 && project != null) {
// 属性映射
try {
switch (mv.getValue()) {
case "jd2_lxsj":
model.setValueAt(project.getProperty("creation_date"), mv.getRow(), mv.getCol());
break;
case "jd2_xmxx":
model.setValueAt(project.getProjectID(), mv.getRow(), mv.getCol());
break;
case "jd2_jbxh":
model.setValueAt(project.getProperty("jd2_cpxh"), mv.getRow(), mv.getCol());
break;
case "jd2_kfdj":
model.setValueAt(project.getProperty("jd2_xmdj"), mv.getRow(), mv.getCol());
break;
case "jd2_kfjd":
String str = form.getProperty("jd2_kfjd");
JCheckPanel checkPanel = new JCheckPanel(jieduan, false);
checkPanel.setSelected(str);
model.setValueAt(checkPanel, mv.getRow(), mv.getCol());
table1.getColumnModel().getColumn(mv.getCol())
.setCellEditor(new MyCellEditor3(new JTextField()));
break;
case "jd2_cpbgd":
TCComponent[] cpbgd = project.getRelatedComponents("jd2_cpbgd");// 不知道是什么属性
if (cpbgd.length > 0) {
String displayValue = "";
for (TCComponent comp : cpbgd) {
displayValue += comp.toString() + ";";
}
model.setValueAt(displayValue, mv.getRow(), mv.getCol());
table1.addMouseListener(openCPBGD(cpbgd, mv));
}
break;
case "jd2_kfrc":
TCComponent[] kfrc = project.getRelatedComponents("jd2_kfrc");
if (kfrc.length > 0) {
TCComponentSchedule schedule = (TCComponentSchedule) kfrc[0];
TCComponent[] tasks = schedule.getAllTasks();
String startTime = "";
String endTime = "";
for (TCComponent task : tasks) {
if ("立项申请".equals(task.getProperty("object_name"))) {
startTime = task.getProperty("");
}
if ("小批量产评审PRA".equals(task.getProperty("object_name"))) {
endTime = task.getProperty("");
}
}
if (!"".equals(startTime) || !"".equals(endTime)) {
model.setValueAt(startTime + "-" + endTime, mv.getRow(), mv.getCol());
}
}
break;
default:
if ("".equals(prop.get(mv.getValue()))) {
model.setValueAt("/", mv.getRow(), mv.getCol());
} else {
model.setValueAt(prop.get(mv.getValue()), mv.getRow(), mv.getCol());
}
}
} catch (TCException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} else {
model.setValueAt(prop.get(mv.getValue()), mv.getRow(), mv.getCol());
}
} else {
System.out.println("属性‘" + mv.getValue() + "’不存在");
}
@ -607,14 +775,67 @@ public class NewProductTestForm extends AbstractRendering {
model.combine(mv.getCombineRows(), mv.getCombineColumns());
}
}
}
private void saveModel(ModelList modelList) {
private MouseAdapter openCPBGD(TCComponent[] cpbgd, ModelValue mv) {
return new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2 && table1.getSelectedRow() == mv.getRow()
&& table1.getSelectedColumn() == mv.getCol()) {
try {
if (cpbgd.length > 1) {
List<String[]> data = new ArrayList<String[]>();
for (TCComponent comp : cpbgd) {
data.add(new String[] { data.size() + 1 + "", comp.toString() });
}
DialogUtil.TableMsg msg = DialogUtil.createTableMsg(new String[] { "序号", "名称" }, data);
int res = JOptionPane.showConfirmDialog($this, msg.panel, "选择", JOptionPane.PLAIN_MESSAGE);
if (res == JOptionPane.OK_OPTION) {
if (msg.table.getSelectedRow() > 0) {
TCComponentItem item = (TCComponentItem) cpbgd[msg.table.getSelectedRow()];
TCComponent[] tccitem = item.getLatestItemRevision()
.getTCProperty("IMAN_specification").getReferenceValueArray();
TCComponentDataset dataset = (TCComponentDataset) tccitem[0];
dataset.open();
}
}
} else {
TCComponentItem item = (TCComponentItem) cpbgd[0];
TCComponent[] tccitem = item.getLatestItemRevision().getTCProperty("IMAN_specification")
.getReferenceValueArray();
TCComponentDataset dataset = (TCComponentDataset) tccitem[0];
dataset.open();
}
} catch (Exception e1) {
e1.printStackTrace();
}
}
}
};
}
private void saveModel(JTable table, ModelList modelList) {
Object obj;
for (ModelValue mv : modelList) {
if (mv.isProp()) {
if (prop.containsKey(mv.getValue())) {
obj = table2.getValueAt(mv.getRow(), mv.getCol());
obj = table.getValueAt(mv.getRow(), mv.getCol());
if (modelList == modelList1 && project != null) {
if ("jd2_kfjd".equals(mv.getValue())) {
obj = table.getValueAt(mv.getRow(), mv.getCol());
if (obj != null) {
String selectedText = ((JCheckPanel) obj).getSelectedText();
try {
form.setProperty(mv.getValue(), selectedText);
} catch (TCException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
try {
form.setProperty(mv.getValue(), obj == null ? "" : obj.toString());
} catch (TCException e) {
@ -628,4 +849,82 @@ public class NewProductTestForm extends AbstractRendering {
}
};
private ActionListener update(String jieduanStr) {
return new ActionListener() {
@Override
public void actionPerformed(ActionEvent paramActionEvent) {
// TODO Auto-generated method stub
try {
TCComponentItemRevision rev = (TCComponentItemRevision) form.whereReferenced()[0].getComponent();
TCComponent[] comps = rev.getRelatedComponents("JD2_CSJH");
TCComponentItem item = null;
for (TCComponent comp : comps) {
System.out.println(comp.getProperty("object_string"));
if (comp.getProperty("object_string").contains(jieduanStr)) {
item = (TCComponentItem) comp;
break;
}
}
if (item == null) {
MessageBox.post("\"" + jieduanStr + "阶段\"测试计划未创建,请先创建", "提示", MessageBox.WARNING);
return;
}
TCComponentItemRevision rev1 = item.getLatestItemRevision();
TCComponentForm form1 = (TCComponentForm) rev1.getRelatedComponents("IMAN_master_form_rev")[0];
List<Map<String, String>> tableRows = TCTableUtil.getTableMapList(form1, "jd2_csjhtable",
colNames3);
List<String> realNo = new ArrayList<String>();
for (Map<String, String> map : tableRows) {
realNo.add(map.get("jd2_no"));
}
String ownner = form.getTCProperty("owning_user").getUIFValue();
Object obj, temp;
List<String> jieduanList = Arrays.asList(jieduan);
for (int i = 2; i < table2.getRowCount() - 1; i++) {
obj = table2.getValueAt(i, jieduanList.indexOf(jieduanStr) + 4);
if (obj != null && !"/".equals(obj.toString().trim())) {
// colNames2 = { "jd2_no", "jd2_wtry", "jd2_syxm", "jd2_syts", "jd2_syfy",
// "jd2_sycs" };
Map<String, String> tempMap;
if (realNo.contains(realIdStr.get(i - 2))) {
int index = realNo.indexOf(realIdStr.get(i - 2));
for (int ii = index; ii < realNo.size(); ii++) {// 再次试验会出现重复realNo
if (realNo.get(ii).equals(realIdStr.get(i - 2))) {
tempMap = tableRows.get(ii);
tempMap.put("jd2_syxm",
(temp = table2.getValueAt(i, 2)) == null ? "" : temp.toString());
tempMap.put("jd2_syts", obj.toString().trim());
tempMap.put("jd2_syfy",
(temp = table2.getValueAt(i, 3)) == null ? "" : temp.toString());
tableRows.set(ii, tempMap);
}
}
} else {
tempMap = new HashMap<String, String>();
tempMap.put("jd2_no", realIdStr.get(i - 2));
tempMap.put("jd2_wtry", ownner);
tempMap.put("jd2_syxm",
(temp = table2.getValueAt(i, 2)) == null ? "" : temp.toString());
tempMap.put("jd2_syts", obj.toString().trim());
tempMap.put("jd2_syfy",
(temp = table2.getValueAt(i, 3)) == null ? "0" : temp.toString().trim());
tempMap.put("jd2_sycs", "1");
tableRows.add(tempMap);
}
}
}
TCTableUtil.setTableMapList(form1, "jd2_csjhtable", "JD2_CSJHTABLE", tableRows);
MessageBox.post("更新成功", "提示", MessageBox.WARNING);
} catch (TCException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
};
}
}

@ -6,7 +6,7 @@ import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.ScrollPane;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
@ -21,6 +21,7 @@ import java.util.Map;
import java.util.Map.Entry;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFileChooser;
@ -28,6 +29,7 @@ import javax.swing.JLabel;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
@ -86,7 +88,8 @@ public class SampleConfirmationForm extends AbstractRendering {
private Map<String, int[]> general3;
private List<String> disableEdit;
private List<String> disableEdit3;
private Map<String, int[]> pic;
private Map<String, int[]> picMap = new HashMap<String, int[]>();// 图片;
private Map<String, int[]> fileMap = new HashMap<String, int[]>();// 文件;
private List<String> disableEdit2;
private JRadioPanel yssl;
private JCheckPanel mqjd;
@ -132,8 +135,14 @@ public class SampleConfirmationForm extends AbstractRendering {
jgItems.put("拒绝", "1");
jgItems.put("保留", "2");
jgItems.put("更改图纸", "3");
AIFComponentContext[] ref = form.whereReferenced();
rev = (TCComponentItemRevision) ref[0].getComponent();
jgItems.put(" ", null);
AIFComponentContext[] aifs = form.whereReferenced();
for (AIFComponentContext aif : aifs) {
if ("JD2_GTYPQRDRevision".equals(aif.getComponent().getType())) {
rev = (TCComponentItemRevision) aif.getComponent();
break;
}
}
setLayout(new BorderLayout());
JPanel root = new JPanel(new BorderLayout());
@ -259,7 +268,17 @@ public class SampleConfirmationForm extends AbstractRendering {
// TODO Auto-generated method stub
if (value instanceof JLabel) {
return (JLabel) value;
JLabel label = (JLabel) value;
if (isSelected) {
label.setForeground(Color.WHITE);
label.setBackground(new Color(0xff0078D7));
label.setOpaque(true);
} else {
label.setForeground(new Color(0xff0078D7));
label.setBackground(Color.WHITE);
label.setOpaque(true);
}
return label;
}
if (value instanceof JComboBox) {
return (JComboBox<String>) value;
@ -287,6 +306,7 @@ public class SampleConfirmationForm extends AbstractRendering {
return this;
}
};
tcr3.setHorizontalAlignment(SwingConstants.CENTER);
table3.setDefaultRenderer(Object.class, tcr3);
@ -297,7 +317,7 @@ public class SampleConfirmationForm extends AbstractRendering {
// 属性映射
prop = form.getProperties();
AIFComponentContext[] parents = rev.whereReferenced();
AIFComponentContext[] parents = rev.getItem().whereReferenced();
TCComponentItemRevision parentRev = null;
for (AIFComponentContext aif : parents) {
try {
@ -378,7 +398,7 @@ public class SampleConfirmationForm extends AbstractRendering {
System.out.println("属性jd2_mqjd未找到");
}
for (Entry<String, int[]> entry : pic.entrySet()) {
for (Entry<String, int[]> entry : picMap.entrySet()) {
int row = entry.getValue()[0];
int col = entry.getValue()[1];
if (prop.containsKey(entry.getKey())) {
@ -395,32 +415,63 @@ public class SampleConfirmationForm extends AbstractRendering {
File img = dataset.getFiles(types[0], temp)[0];
System.out.println(img.getPath());
// ImageIcon icon = new ImageIcon(img.getPath());
ImageIcon icon = new ImageIcon(img.getPath());
int[] arr = model3.getSpan(row, col);
System.out.println("row:" + arr[0] + ",col:" + arr[1]);
icon.setImage(icon.getImage().getScaledInstance(
table3.getColumnModel().getColumn(col).getPreferredWidth() * arr[1],
table3.getRowHeight() * arr[0], Image.SCALE_SMOOTH));
JLabel label = new JLabel();
label.setLayout(new FlowLayout(FlowLayout.CENTER));
label.setIcon(icon);
label.setHorizontalAlignment(SwingConstants.CENTER);
label.addMouseListener(showImg(img.getPath()));
label.setToolTipText(dataset.getUid());
model3.setValueAt(label, row, col);
} else {
model3.setValueAt(new JLabel(""), row, col);
}
} catch (Exception e) {
model3.setValueAt(new JLabel(""), row, col);
e.printStackTrace();
}
} else {
model3.setValueAt(new JLabel(""), row, col);
System.out.println("属性‘" + entry.getKey() + "’未找到");
}
}
for (Entry<String, int[]> entry : fileMap.entrySet()) {
int row = entry.getValue()[0];
int col = entry.getValue()[1];
if (prop.containsKey(entry.getKey())) {
TCComponent comp = null;
try {
if (!"".equals(prop.get(entry.getKey()))) {
comp = session.stringToComponent(prop.get(entry.getKey()));
TCComponentDataset dataset = (TCComponentDataset) comp;
String temp = System.getenv("temp");
System.out.println(temp);
String[] types = dataset.getProperty("ref_names").split(",");
System.out.println(Arrays.toString(types));
System.out.println(Arrays.toString(dataset.getFileNames(types[0])));
File img = dataset.getFiles(types[0], temp)[0];
System.out.println(img.getPath());
int[] arr = model3.getSpan(row, col);
// int width = 0;
// for (int i = 0; i < arr[1]; i++) {
// width+=table3.getColumnModel().getColumn()
// }
System.out.println("row:" + arr[0] + ",col:" + arr[1]);
// icon.setImage(icon.getImage().getScaledInstance(
// table3.getColumnModel().getColumn(col).getPreferredWidth() * arr[1],
// table3.getRowHeight() * arr[0], Image.SCALE_SMOOTH));
JLabel label = new JLabel();
label.setLayout(new FlowLayout(FlowLayout.CENTER));
// label.setIcon(icon);
label.setForeground(new Color(0xff0078D7));
label.setText(img.getName());
if ("jd2_icqjyzds".equals(entry.getKey())) {
label.setHorizontalAlignment(SwingConstants.CENTER);
label.addMouseListener(showFile(dataset));
} else {
label.addMouseListener(showImg(img.getPath()));
}
label.setToolTipText(dataset.getUid());
model3.setValueAt(label, row, col);
} else {
model3.setValueAt(new JLabel(""), row, col);
// System.out.println("未找到uid为\"" + prop.get(entry.getKey()) + "\"的数据集");
}
} catch (Exception e) {
model3.setValueAt(new JLabel(""), row, col);
@ -432,6 +483,7 @@ public class SampleConfirmationForm extends AbstractRendering {
System.out.println("属性‘" + entry.getKey() + "’未找到");
}
}
if (prop.containsKey("jd2_ypqrdtable")) {
String[][] tableRows = TCTableUtil.getTableRows(form, "jd2_ypqrdtable", colNames);
System.out.println(Arrays.deepToString(tableRows));
@ -466,12 +518,11 @@ public class SampleConfirmationForm extends AbstractRendering {
inner.add(table, BorderLayout.CENTER);
inner.add(table3, BorderLayout.SOUTH);
ScrollPane confirmScrollPanel1 = new ScrollPane();
confirmScrollPanel1.add(inner);
// ScrollPane confirmScrollPanel3 = new ScrollPane();
// confirmScrollPanel3.add(table3);
// ScrollPane confirmScrollPanel1 = new ScrollPane();
// confirmScrollPanel1.add(inner);
JScrollPane confirmScrollPanel1 = new JScrollPane(inner);
confirmPanel.add(confirmScrollPanel1, BorderLayout.CENTER);
// confirmPanel.add(confirmScrollPanel3, BorderLayout.SOUTH);
// 检查表
examinePanel.setBorder(BorderFactory.createLineBorder(Color.black, 1));
examinePanel.setLayout(new BorderLayout());
@ -547,9 +598,6 @@ public class SampleConfirmationForm extends AbstractRendering {
maxPreferredHeight = Math.max(maxPreferredHeight, getPreferredSize().height);
}
setBackground(Color.white);
// if(points1.contains(new Point(row,column)))
// setForeground(new Color(0,0,255));
// else
setForeground(Color.black);
if (isSelected) {
setBackground(new Color(0, 120, 215));
@ -617,8 +665,9 @@ public class SampleConfirmationForm extends AbstractRendering {
}
}
ScrollPane examineScrollPanel = new ScrollPane();
examineScrollPanel.add(examinePanel);
// ScrollPane examineScrollPanel = new ScrollPane();
// examineScrollPanel.add(examinePanel);
JScrollPane examineScrollPanel = new JScrollPane(examinePanel);
// 确认单右键菜单
menu.setVisible(false);
@ -670,6 +719,7 @@ public class SampleConfirmationForm extends AbstractRendering {
center.add("confirm", confirmPanel);
center.add("examine", examineScrollPanel);
root.add(buttons, BorderLayout.NORTH);
root.add(center, BorderLayout.CENTER);
this.add(menu);
@ -729,10 +779,14 @@ public class SampleConfirmationForm extends AbstractRendering {
try {
if (form.getTCProperty("jd2_fl") != null) {
String[] items = form.getTCProperty("jd2_fl").getLOV().getListOfValues().getLOVDisplayValues();
fl.addItem(" ");
for (String s : items) {
fl.addItem(s);
}
fl.setSelectedItem(form.getProperty("jd2_fl"));
if ("".equals(form.getProperty("jd2_fl"))) {
fl.setSelectedItem(" ");
}
model.setValueAt(fl, 6, 17);
}
@ -754,10 +808,14 @@ public class SampleConfirmationForm extends AbstractRendering {
try {
if (form.getTCProperty("jd2_zt") != null) {
String[] items = form.getTCProperty("jd2_zt").getLOV().getListOfValues().getLOVDisplayValues();
zt.addItem(" ");
for (String s : items) {
zt.addItem(s);
}
zt.setSelectedItem(form.getProperty("jd2_zt"));
if ("".equals(form.getProperty("jd2_zt"))) {
zt.setSelectedItem(" ");
}
model.setValueAt(zt, 7, 17);
}
@ -891,11 +949,11 @@ public class SampleConfirmationForm extends AbstractRendering {
private void initModel3() {
disableEdit3 = new ArrayList<>();// 不允许编辑
general3 = new HashMap<String, int[]>();// 要填写的一般属性
pic = new HashMap<String, int[]>();// 图片
model3.setValueAt("被标记为“CTQ”的尺寸非常重要", 0, 0);// 从“底部”开始
disableEdit3.add(0 + ",0");
model3.setValueAt("SPL Picture", 1, 0);
pic.put("jd2_ypzp", new int[] { 2, 0 });
// picMap.put("jd2_ypzp", new int[] { 2, 0 });
picMap.put("user_data_1", new int[] { 2, 0 });
disableEdit3.add(1 + ",0");
model3.setValueAt("注塑条件", 1, 4);
disableEdit3.add(1 + ",4");
@ -919,11 +977,11 @@ public class SampleConfirmationForm extends AbstractRendering {
general3.put("jd2_zs", new int[] { 2, 6 });
general3.put("jd2_lq", new int[] { 2, 7 });
general3.put("jd2_baoz", new int[] { 2, 8 });
pic.put("jd2_gfzjbg", new int[] { 2, 9 });
// pic.put("user_data_2", new int[] { 2, 9 });
pic.put("jd2_gfzyzds", new int[] { 2, 12 });
pic.put("jd2_gfqcgct", new int[] { 2, 15 });
pic.put("jd2_wlbzjbq", new int[] { 2, 18 });
// fileMap.put("jd2_gfzjbg", new int[] { 2, 9 });
fileMap.put("user_data_2", new int[] { 2, 9 });
fileMap.put("jd2_gfzyzds", new int[] { 2, 12 });
fileMap.put("jd2_gfqcgct", new int[] { 2, 15 });
fileMap.put("jd2_wlbzjbq", new int[] { 2, 18 });
model3.setValueAt("Shot/24Hr", 3, 5);
disableEdit3.add(3 + ",5");
model3.setValueAt("吨", 3, 6);
@ -944,18 +1002,17 @@ public class SampleConfirmationForm extends AbstractRendering {
disableEdit3.add(5 + ",15");
model3.setValueAt("模具标识", 5, 18);
disableEdit3.add(5 + ",18");
pic.put("jd2_zsgytj", new int[] { 6, 7 });
pic.put("jd2_icqsjbg", new int[] { 6, 9 });
pic.put("jd2_csbg", new int[] { 6, 12 });
pic.put("jd2_czbg", new int[] { 6, 15 });
pic.put("jd2_mjbs", new int[] { 6, 18 });
fileMap.put("jd2_zsgytj", new int[] { 6, 7 });
fileMap.put("jd2_icqsjbg", new int[] { 6, 9 });
fileMap.put("jd2_csbg", new int[] { 6, 12 });
fileMap.put("jd2_czbg", new int[] { 6, 15 });
fileMap.put("jd2_mjbs", new int[] { 6, 18 });
model3.setValueAt("实测重量", 7, 4);
disableEdit3.add(7 + ",4");
general3.put("jd2_sczl", new int[] { 7, 5 });
model3.setValueAt("IQC作业指导书", 9, 4);
disableEdit3.add(9 + ",4");
pic.put("jd2_icqjyzds", new int[] { 10, 4 });
// pic.put("user_data_1", new int[] { 10, 4 });
fileMap.put("jd2_icqjyzds", new int[] { 10, 4 });
model3.setValueAt("决定", 11, 12);
disableEdit3.add(11 + ",12");
jued = new JComboBox<String>();
@ -963,10 +1020,14 @@ public class SampleConfirmationForm extends AbstractRendering {
try {
if (form.getTCProperty("jd2_jued") != null) {
String[] items = form.getTCProperty("jd2_jued").getLOV().getListOfValues().getLOVDisplayValues();
jued.addItem(" ");
for (String s : items) {
jued.addItem(s);
}
jued.setSelectedItem(form.getProperty("jd2_jued"));
if ("".equals(form.getProperty("jd2_jued"))) {
jued.setSelectedItem(" ");
}
model3.setValueAt(jued, 11, 15);
}
@ -974,7 +1035,7 @@ public class SampleConfirmationForm extends AbstractRendering {
// TODO Auto-generated catch block
e.printStackTrace();
}
pic.put("jd2_qtbg", new int[] { 9, 7 });
fileMap.put("jd2_qtbg", new int[] { 9, 7 });
model3.combine(new int[] { 0 }, new int[] { 0, 1, 2, 3, 4, 5 });
model3.combine(new int[] { 1 }, new int[] { 0, 1 });
@ -1017,7 +1078,7 @@ public class SampleConfirmationForm extends AbstractRendering {
public void saveRendering() {
// 保存图片
JLabel label = null;
for (Entry<String, int[]> entry : pic.entrySet()) {
for (Entry<String, int[]> entry : picMap.entrySet()) {
if (prop.containsKey(entry.getKey())) {
System.out.println(entry.getKey());
label = (JLabel) model3.getValueAt(entry.getValue()[0], entry.getValue()[1]);
@ -1030,6 +1091,22 @@ public class SampleConfirmationForm extends AbstractRendering {
}
}
// 保存文件
for (Entry<String, int[]> entry : fileMap.entrySet()) {
if (prop.containsKey(entry.getKey())) {
System.out.println(entry.getKey());
label = (JLabel) model3.getValueAt(entry.getValue()[0], entry.getValue()[1]);
try {
form.setProperty(entry.getKey(), label.getToolTipText() == null ? "" : label.getToolTipText());
} catch (TCException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
// 保存选择
try {
if (prop.containsKey("jd2_yssl")) {
@ -1051,28 +1128,28 @@ public class SampleConfirmationForm extends AbstractRendering {
if (form.getTCProperty("jd2_bpdj").getLOV() != null && !" ".equals(value)) {
value = (String) form.getTCProperty("jd2_bpdj").getLOV().getListOfValues().getRealValue(value);
}
form.setProperty("jd2_bpdj", value);
form.setProperty("jd2_bpdj", " ".equals(value) ? null : value);
}
if (prop.containsKey("jd2_fl")) {
String value = fl.getSelectedItem() == null ? " " : fl.getSelectedItem().toString();
if (form.getTCProperty("jd2_fl").getLOV() != null && !" ".equals(value)) {
value = (String) form.getTCProperty("jd2_fl").getLOV().getListOfValues().getRealValue(value);
}
form.setProperty("jd2_fl", value);
form.setProperty("jd2_fl", " ".equals(value) ? null : value);
}
if (prop.containsKey("jd2_zt")) {
String value = zt.getSelectedItem() == null ? " " : zt.getSelectedItem().toString();
if (form.getTCProperty("jd2_zt").getLOV() != null && !" ".equals(value)) {
value = (String) form.getTCProperty("jd2_zt").getLOV().getListOfValues().getRealValue(value);
}
form.setProperty("jd2_zt", value);
form.setProperty("jd2_zt", " ".equals(value) ? null : value);
}
if (prop.containsKey("jd2_jued")) {
String value = jued.getSelectedItem() == null ? " " : jued.getSelectedItem().toString();
if (form.getTCProperty("jd2_jued").getLOV() != null && !" ".equals(value)) {
value = (String) form.getTCProperty("jd2_jued").getLOV().getListOfValues().getRealValue(value);
}
form.setProperty("jd2_jued", value);
form.setProperty("jd2_jued", " ".equals(value) ? null : value);
}
} catch (TCException e) {
@ -1306,7 +1383,7 @@ public class SampleConfirmationForm extends AbstractRendering {
int row = table3.getSelectedRow();
int col = table3.getSelectedColumn();
boolean flag = false;
for (Entry<String, int[]> entry : pic.entrySet()) {
for (Entry<String, int[]> entry : picMap.entrySet()) {
if (entry.getValue()[0] == row && entry.getValue()[1] == col) {
flag = true;
break;
@ -1314,14 +1391,15 @@ public class SampleConfirmationForm extends AbstractRendering {
}
addP.setEnabled(flag);
delP.setEnabled(flag);
addF.setEnabled(false);
delF.setEnabled(false);
if (pic.get("jd2_icqjyzds")[0] == row && pic.get("jd2_icqjyzds")[1] == col) {
addF.setEnabled(true);
delF.setEnabled(true);
addP.setEnabled(false);
delP.setEnabled(false);
flag = false;
for (Entry<String, int[]> entry : fileMap.entrySet()) {
if (entry.getValue()[0] == row && entry.getValue()[1] == col) {
flag = true;
break;
}
}
addF.setEnabled(flag);
delF.setEnabled(flag);
menu3.show(e.getComponent(), e.getX(), e.getY());
}
@ -1369,7 +1447,7 @@ public class SampleConfirmationForm extends AbstractRendering {
rev.add("IMAN_specification", dataset);
String uid = dataset.getUid();
System.out.println("uid:" + uid);
// ImageIcon icon = new ImageIcon(file.getPath());
ImageIcon icon = new ImageIcon(file.getPath());
int row = table3.getSelectedRow();
int col = table3.getSelectedColumn();
String str = ((JLabel) model3.getValueAt(row, col)).getToolTipText();
@ -1385,14 +1463,12 @@ public class SampleConfirmationForm extends AbstractRendering {
}
int[] arr = model3.getSpan(row, col);
System.out.println("row:" + arr[0] + ",col:" + arr[1]);
// icon.setImage(icon.getImage().getScaledInstance(
// table3.getColumnModel().getColumn(col).getPreferredWidth() * arr[1],
// table3.getRowHeight() * arr[0], Image.SCALE_SMOOTH));
icon.setImage(icon.getImage().getScaledInstance(
table3.getColumnModel().getColumn(col).getPreferredWidth() * arr[1],
table3.getRowHeight() * arr[0], Image.SCALE_SMOOTH));
JLabel label = new JLabel();
label.setLayout(new FlowLayout(FlowLayout.CENTER));
// label.setIcon(icon);
label.setText(file.getName());
label.setForeground(new Color(0xff0078D7));
label.setIcon(icon);
label.addMouseListener(showImg(file.getPath()));
label.setToolTipText(uid);
model3.setValueAt(label, table3.getSelectedRow(), table3.getSelectedColumn());
@ -1448,8 +1524,6 @@ public class SampleConfirmationForm extends AbstractRendering {
model.setValueAt(num + 1, bottom, 0);
model.combine(new int[] { bottom }, new int[] { 2, 3, 4 });
// System.out.println(bottom);
// initModel();
table.revalidate();
table.repaint();
}
@ -1489,8 +1563,6 @@ public class SampleConfirmationForm extends AbstractRendering {
}
model.combine(new int[] { row }, new int[] { 2, 3, 4 });
// System.out.println(bottom);
// initModel();
table.revalidate();
table.repaint();
}
@ -1535,8 +1607,6 @@ public class SampleConfirmationForm extends AbstractRendering {
}
}
// System.out.println(bottom);
// initModel();
table.revalidate();
table.repaint();
}
@ -1617,14 +1687,16 @@ public class SampleConfirmationForm extends AbstractRendering {
@Override
public String getDescription() {
// TODO Auto-generated method stub
return "(文档,表格)*.doc;*.docx;*.xls;*.xlsx;";
return "(文档,表格,图片)*.doc;*.docx;*.xls;*.xlsx;*.png;*.jpg;*.jpeg;*.bmp;";
}
@Override
public boolean accept(File var1) {
// TODO Auto-generated method stub
return var1.getName().endsWith(".doc") || var1.getName().endsWith(".docx")
|| var1.getName().endsWith(".xls") || var1.getName().endsWith(".xlsx");
|| var1.getName().endsWith(".xls") || var1.getName().endsWith(".xlsx")
|| var1.getName().endsWith(".png") || var1.getName().endsWith(".jpg")
|| var1.getName().endsWith(".jpeg") || var1.getName().endsWith(".bmp");
}
});
fileChooser.showOpenDialog(menu3);// 参数表示定位
@ -1646,6 +1718,9 @@ public class SampleConfirmationForm extends AbstractRendering {
} else if (file.getName().endsWith(".xlsx")) {
as2[0] = "excel";
type = "MSExcelX";
} else {
as2[0] = "Image";
type = "Image";
}
TCComponentDatasetType datasetType;
try {
@ -1656,7 +1731,6 @@ public class SampleConfirmationForm extends AbstractRendering {
rev.add("IMAN_specification", dataset);
String uid = dataset.getUid();
System.out.println("uid:" + uid);
// ImageIcon icon = new ImageIcon(file.getPath());
int row = table3.getSelectedRow();
int col = table3.getSelectedColumn();
String str = ((JLabel) model3.getValueAt(row, col)).getToolTipText();
@ -1672,13 +1746,10 @@ public class SampleConfirmationForm extends AbstractRendering {
}
int[] arr = model3.getSpan(row, col);
System.out.println("row:" + arr[0] + ",col:" + arr[1]);
// icon.setImage(icon.getImage().getScaledInstance(
// table3.getColumnModel().getColumn(col).getPreferredWidth() * arr[1],
// table3.getRowHeight() * arr[0], Image.SCALE_SMOOTH));
JLabel label = new JLabel();
label.setLayout(new FlowLayout(FlowLayout.CENTER));
// label.setIcon(icon);
label.setText(file.getName());
label.setHorizontalAlignment(SwingConstants.CENTER);
label.setForeground(new Color(0xff0078D7));
label.addMouseListener(showFile(dataset));
label.setToolTipText(uid);

@ -0,0 +1,22 @@
package com.connor.jd.plm.handlers;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import com.connor.jd.plm.action.AddHLBOMAction;
import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aifrcp.AIFUtility;
public class AddHLBOMHandler extends AbstractHandler {
@Override
public Object execute(ExecutionEvent arg0) throws ExecutionException {
// TODO Auto-generated method stub
AbstractAIFApplication app = AIFUtility.getCurrentApplication();
AddHLBOMAction action = new AddHLBOMAction(app, "");
new Thread(action).start();
return null;
}
}

@ -0,0 +1,22 @@
package com.connor.jd.plm.handlers;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import com.connor.jd.plm.action.BOMManagementAction;
import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aifrcp.AIFUtility;
public class BOMManagementHandler extends AbstractHandler {
@Override
public Object execute(ExecutionEvent arg0) throws ExecutionException {
// TODO Auto-generated method stub
AbstractAIFApplication app = AIFUtility.getCurrentApplication();
BOMManagementAction action = new BOMManagementAction(app, "");
new Thread(action).start();
return null;
}
}

@ -0,0 +1,21 @@
package com.connor.jd.plm.handlers;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import com.connor.jd.plm.action.ExportBOMAction;
import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aifrcp.AIFUtility;
public class ExportBOMHandler extends AbstractHandler {
@Override
public Object execute(ExecutionEvent arg0) throws ExecutionException {
AbstractAIFApplication app = AIFUtility.getCurrentApplication();
ExportBOMAction action = new ExportBOMAction(app, "");
new Thread(action).start();
return null;
}
}

@ -13,7 +13,6 @@ import org.eclipse.ui.PlatformUI;
import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
import com.teamcenter.rac.aifrcp.AIFUtility;
import com.teamcenter.rac.kernel.TCComponentFolder;
import com.teamcenter.rac.kernel.TCPreferenceService;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.schedule.commands.newschedule.NewScheduleHandler;
@ -44,7 +43,6 @@ public class Wf001ScheduleHandler extends NewBOHandler {
if (targetComp == null) {
return null;
}
if (targetComp instanceof TCComponentFolder) {
scheduleModel = null;
wizardId = "com.teamcenter.rac.schedule.commands.newschedule.GenericScheduleWizard";
@ -81,8 +79,6 @@ public class Wf001ScheduleHandler extends NewBOHandler {
// MessageBox.post("ÇëÑ¡ÖÐÏîĿִÐд´½¨!!", "´íÎó", MessageBox.ERROR);
// return null;
}
return null;
}
@Override
public String getWizardTitle() {

@ -0,0 +1,34 @@
package com.connor.jd.plm.table;
import java.awt.Component;
import javax.swing.DefaultCellEditor;
import javax.swing.JTable;
import javax.swing.JTextField;
import com.connor.jd.plm.utils.DatePickerUtil;
import com.eltima.components.ui.DatePicker;
public class DatePickerCellEditor extends DefaultCellEditor {
private DatePicker datePicker;
public DatePickerCellEditor(JTextField arg0) {
super(arg0);
// TODO Auto-generated constructor stub
}
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
// TODO Auto-generated method stub
datePicker = DatePickerUtil.getDatePicker(null);
return datePicker;
}
@Override
public Object getCellEditorValue() {
// TODO Auto-generated method stub
return datePicker.getText();
}
}

@ -25,6 +25,19 @@ public class JCheckPanel extends JPanel {
setLayout(new FlowLayout(FlowLayout.LEFT));
}
public JCheckPanel(String[] text, boolean isSingle) {
buttons = new JCheckBox[text.length];
for (int i = 0; i < text.length; i++) {
buttons[i] = new JCheckBox(text[i]);
buttons[i].setPreferredSize(new Dimension(100, 25));
if (isSingle) {
buttonGroup.add(buttons[i]);
}
add(buttons[i]);
}
setLayout(new FlowLayout(FlowLayout.LEFT));
}
public JCheckBox[] getButtons() {
return buttons;
}

@ -67,4 +67,21 @@ public class ModelList extends ArrayList<ModelValue> {
return disableEdit.contains(row + "," + col);
}
public void findAndAddRow(int row, int tableColumsCount, int offset) {
if (offset <= 0) {
return;
}
if (this.size() == 0) {
return;
}
for (int i = 0; i < tableColumsCount; i++) {
if (this.getModelValue(row, i) != null) {
System.out.println(this.getModelValue(row, i).getValue());
this.getModelValue(row, i).setRow(row + offset);
this.removeDisableEdit(row, i);
this.addDisableEdit(row + offset, i);
}
}
}
}

@ -0,0 +1,19 @@
package com.connor.jd.plm.table;
import java.awt.Component;
import javax.swing.JCheckBox;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;
public class MyCellRenderer extends DefaultTableCellRenderer {
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
int row, int column) {
// TODO Auto-generated method stub
if (value instanceof JCheckBox) {
return (JCheckBox) value;
}
return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
}
}

@ -40,6 +40,31 @@ public class TCTableUtil {
return null;
}
public static List<Map<String, String>> getTableMapList(TCComponentForm form, String prop, String[] colNames) {
try {
TCProperty tcProperty = form.getTCProperty(prop);
TCComponent[] components = tcProperty.getReferenceValueArray();
List<Map<String, String>> res = new ArrayList<Map<String, String>>();
for (int i = 0; i < components.length; i++) {
Map<String, String> temp = new HashMap<String, String>();
for (int ii = 0; ii < colNames.length; ii++) {
temp.put(colNames[ii], components[i].getPropertyDisplayableValue(colNames[ii]));
}
res.add(temp);
}
return res;
} catch (NullPointerException e) {
System.out.println("ÊôÐÔ\"" + prop + "\"²»´æÔÚ");
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
public static boolean setTableRows(TCComponentForm form, String prop, String refName, String[] colNames,
String[][] rows) {
List<TCComponent> list = new ArrayList<TCComponent>();
@ -79,4 +104,38 @@ public class TCTableUtil {
return false;
}
public static boolean setTableMapList(TCComponentForm form, String prop, String refName,
List<Map<String, String>> dataList) {
List<TCComponent> list = new ArrayList<TCComponent>();
DataManagementService service = DataManagementService
.getService((TCSession) AIFUtility.getCurrentApplication().getSession());
CreateIn ci = new CreateIn();
ci.data.boName = refName;
for (int i = 0; i < dataList.size(); i++) {
System.out.println(dataList.get(i).size());
ci.data.stringProps = dataList.get(i);
try {
CreateResponse response = service.createObjects(new CreateIn[] { ci });
System.out.println("CreateResponse size:" + response.serviceData.sizeOfCreatedObjects());
if (response.serviceData.sizeOfCreatedObjects() > 0) {
list.add(response.output[0].objects[0]);
} else {
String str = String.join(",", response.serviceData.getPartialError(0).getMessages());
System.out.println(str);
}
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
try {
form.getTCProperty(prop).setReferenceValueArray(list.toArray(new TCComponent[list.size()]));
System.out.println("±£´ætable³É¹¦");
return true;
} catch (TCException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return false;
}
}

@ -3,10 +3,15 @@ package com.connor.jd.plm.utils;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.util.MessageBox;
public class DBConnectionUtil {
public static Connection dbConn(String name, String pass) {
public static Connection dbConn(TCSession session) {
Connection c = null;
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
@ -15,7 +20,18 @@ public class DBConnectionUtil {
e.printStackTrace();
}
try {
c = DriverManager.getConnection("jdbc:oracle:thin:@10.20.4.75:1521:TC12", name, pass);
String[] dbSettings = JDMethodUtil.getPrefStrArray("jd2_db_settings", session);
if (dbSettings.length != 3) {
MessageBox.post("jd2_db_settings数据库连接配置错误", "错误", MessageBox.ERROR);
throw new Exception("jd2_db_settings数据库连接配置错误");
} else {
Map<String, String> settingMap = new HashMap<String, String>();
for (String s : dbSettings) {
settingMap.put(s.substring(0, s.indexOf(":")), s.substring(s.indexOf(":") + 1, s.length()));
}
System.out.println(settingMap.get("url") + settingMap.get("user") + settingMap.get("pass"));
c = DriverManager.getConnection(settingMap.get("url"), settingMap.get("user"), settingMap.get("pass"));
}
// c = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:TC", name, pass);
// 连接数据的方法有四种, 这个属于最简单的,一般用网页程序 TC是你的数据库实例名称在下载的文件test.sql中可以执行语句查看
// "jdbc:oracle:thin:@计算机名称:监听端口:系统实例名", username, password,
@ -26,6 +42,8 @@ public class DBConnectionUtil {
} catch (SQLException e) {
e.printStackTrace();
} catch (Exception e1) {
e1.printStackTrace();
}
return c;
}

@ -0,0 +1,38 @@
package com.connor.jd.plm.utils;
import java.util.HashMap;
import java.util.Map;
import javax.sql.DataSource;
import javax.swing.JOptionPane;
import com.teamcenter.rac.kernel.TCSession;
import cn.hutool.db.ds.simple.SimpleDataSource;
public class DBUtil {
public static DataSource getDataSource(TCSession session) {
Map<String, String> settingMap = getDbSetting(session);
String str = settingMap.get("url") + settingMap.get("user") + settingMap.get("pass");
DataSource dataSource = new SimpleDataSource(settingMap.get("url"), settingMap.get("user"),
settingMap.get("pass"));
return dataSource;
}
private static Map<String, String> getDbSetting(TCSession session) {
Map<String, String> settingMap = null;
String[] dbSettings = JDMethodUtil.getPrefStrArray("jd2_db_settings", session);
if (dbSettings.length != 3) {
JOptionPane.showMessageDialog(null, "jd2_db_settings数据库连接配置错误", "错误", JOptionPane.ERROR);
} else {
settingMap = new HashMap<String, String>();
for (String s : dbSettings) {
settingMap.put(s.substring(0, s.indexOf(":")), s.substring(s.indexOf(":") + 1, s.length()));
}
}
return settingMap;
}
}

@ -0,0 +1,80 @@
package com.connor.jd.plm.utils;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Date;
import java.util.Locale;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import com.eltima.components.ui.DatePicker;
public class DatePickerUtil {
public static void main(String[] args) {
JFrame f = new JFrame("LoL");
f.setSize(400, 300);
f.setLocation(200, 200);
f.setLayout(null);
final DatePicker datepick;
datepick = getDatePicker("yyyy-MM-dd hh:mm");
f.add(datepick);
JButton b = new JButton("获取时间");
b.setBounds(137, 183, 100, 30);
f.add(b);
b.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JOptionPane.showMessageDialog(f, "获取控件中的日期:" + datepick.getText());
System.out.println(datepick.getValue());
}
});
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
}
public static DatePicker getDatePicker(String format) {
final DatePicker datepick;
// 格式 如果包含事件会出现时间选择的UI
String DefaultFormat = "yyyy-MM-dd";
// 当前时间
Date date = new Date();
// 字体
Font font = new Font("Times New Roman", Font.BOLD, 14);
Dimension dimension = new Dimension(180, 24);
// int[] hilightDays = { 1, 3, 5, 7 };
// int[] disabledDays = { 4, 6, 5, 9 };
datepick = new DatePicker(date, format == null ? DefaultFormat : format, font, dimension);
datepick.setLocation(137, 83);
datepick.setBounds(137, 83, 180, 24);
// 设置一个月份中需要高亮显示的日子
// datepick.setHightlightdays(hilightDays, Color.red);
// 设置一个月份中不需要的日子,呈灰色显示
// datepick.setDisableddays(disabledDays);
// 设置国家
datepick.setLocale(Locale.CHINA);
// 设置时钟面板可见
if (format != null) {
datepick.setTimePanleVisible(true);
} else {
datepick.setTimePanleVisible(false);
}
return datepick;
}
}

@ -0,0 +1,286 @@
package com.connor.jd.plm.utils;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dialog.ModalityType;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.util.ArrayList;
import java.util.List;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
import com.connor.jd.plm.dialogs.BOMManagementFrame;
import com.teamcenter.rac.aifrcp.AIFUtility;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentItem;
import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCSession;
public class DialogUtil {
public static TableMsg createTableMsg(String[] header, List<String[]> msgContent) {
DefaultTableModel msgModel = new DefaultTableModel(header, 0) {
@Override
public boolean isCellEditable(int paramInt1, int paramInt2) {
// TODO Auto-generated method stub
return false;
}
};
JTable msgTable = new JTable(msgModel);
for (int columnIndex = 0; columnIndex < msgTable.getColumnCount(); columnIndex++) {
msgTable.getColumnModel().getColumn(columnIndex).setMinWidth(100);
}
msgTable.setRowHeight(25);
msgTable.setShowGrid(false);
msgTable.setAutoscrolls(true);
msgTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
msgTable.getTableHeader().setReorderingAllowed(false);
// msgTable.getTableHeader().setVisible(false);
for (String[] row : msgContent) {
msgModel.addRow(row);
}
msgTable.invalidate();
msgTable.repaint();
JScrollPane msgPanel = new JScrollPane(msgTable);
msgPanel.setPreferredSize(new Dimension(header.length * 100, 200));
msgPanel.setBorder(BorderFactory.createEmptyBorder());
return new TableMsg(msgPanel, msgTable);
}
public static JDialog createSearchAndSelectRevDialog(BOMManagementFrame frame, JTable paramTable,
JCheckBox selectAll, JButton field) {
JDialog dialog = new JDialog();
dialog.setTitle("搜索零组件版本");
dialog.setSize(520, 400);
dialog.setResizable(true);
dialog.setAutoRequestFocus(true);
dialog.setAlwaysOnTop(true);
dialog.setLocationRelativeTo(frame);
dialog.setModalityType(ModalityType.APPLICATION_MODAL);
JPanel content = new JPanel();
content.setLayout(null);
content.setPreferredSize(new Dimension(520, 400));
JLabel targetLabel = new JLabel("目标");
targetLabel.setBounds(10, 10, 50, 25);
JTextField targetText = new JTextField();
targetText.setText("输入要搜索的零组件ID");
targetText.setForeground(Color.GRAY);
if (!"".equals(field.getText())) {
targetText.setText(field.getText().substring(0, field.getText().indexOf("/")));
targetText.setForeground(Color.BLACK);
}
targetText.setBounds(20, 50, 300, 25);
JButton searchBtn = new JButton("查找");
searchBtn.setBounds(380, 50, 100, 25);
String[] colDisplayNames = new String[] { "对象", "描述", "发布状态", "所有者", "组ID", "对象" };
DefaultTableModel model = new DefaultTableModel(colDisplayNames, 0) {
@Override
public boolean isCellEditable(int paramInt1, int paramInt2) {
return false;
}
};
JTable table = new JTable(model);
table.getColumnModel().getColumn(0).setMinWidth(100);
table.getColumnModel().getColumn(1).setMinWidth(100);
table.getColumnModel().getColumn(2).setMinWidth(100);
table.getColumnModel().getColumn(3).setMinWidth(100);
table.getColumnModel().getColumn(4).setMinWidth(60);
table.getColumnModel().getColumn(4).setPreferredWidth(60);
TableColumnModel tcm = table.getColumnModel();
TableColumn tc = tcm.getColumn(5);
tc.setWidth(0);
tc.setPreferredWidth(0);
tc.setMaxWidth(0);
tc.setMinWidth(0);
table.getTableHeader().getColumnModel().getColumn(5).setMaxWidth(0);
table.getTableHeader().getColumnModel().getColumn(5).setMinWidth(0);
table.setRowHeight(25);
table.setAutoscrolls(true);
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
table.getTableHeader().setReorderingAllowed(false);
JScrollPane jsp = new JScrollPane(table);
jsp.setBounds(20, 100, 460, 200);
JButton okBtn = new JButton("确定");
okBtn.setBounds(140, 320, 100, 25);
JButton cancelBtn = new JButton("取消");
cancelBtn.setBounds(260, 320, 100, 25);
targetText.addFocusListener(new FocusListener() {
@Override
public void focusLost(FocusEvent e) {
// TODO Auto-generated method stub
if ("".equals(targetText.getText())) {
targetText.setText("输入要搜索的零组件ID");
targetText.setForeground(Color.GRAY);
}
}
@Override
public void focusGained(FocusEvent e) {
// TODO Auto-generated method stub
if ("输入要搜索的零组件ID".equals(targetText.getText())) {
targetText.setText("");
targetText.setForeground(Color.BLACK);
}
}
});
targetText.addKeyListener(new KeyAdapter() {
@Override
public void keyTyped(KeyEvent paramKeyEvent) {
// TODO Auto-generated method stub
super.keyTyped(paramKeyEvent);
if (paramKeyEvent.getKeyChar() == KeyEvent.VK_ENTER) {
searchBtn.doClick();
}
}
});
searchBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
int cnt = model.getRowCount();
for (int i = 0; i < cnt; i++) {
model.removeRow(0);
}
table.revalidate();
table.repaint();
String text = targetText.getText();
System.out.println(text);
if ("输入要搜索的零组件ID".equals(text)) {
return;
}
long startTime = System.currentTimeMillis();
TCSession session = (TCSession) AIFUtility.getCurrentApplication().getSession();
TCComponentItem[] items = getTarget(content, text, session);
if (items == null) {
return;
}
List<Object[]> tableDataList = new ArrayList<Object[]>();
for (TCComponentItem item : items) {
try {
TCComponent[] comps = item.getRelatedComponents("revision_list");
for (TCComponent comp : comps) {
String objetcString = comp.getProperty("object_string");
TCComponent[] forms = comp.getRelatedComponents("IMAN_master_form_rev");
String desc = "";
if (forms.length > 0) {
desc = forms[0].getProperty("jd2_wlms");
}
TCComponent[] statusArray = comp.getRelatedComponents("release_status_list");
String status = "";
if (statusArray != null && statusArray.length > 0) {
status = statusArray[statusArray.length - 1].getProperty("object_name");
}
String owningUser = comp.getProperty("owning_user");
String groupId = comp.getProperty("owning_group");
tableDataList.add(new Object[] { objetcString, desc, status, owningUser, groupId, comp });
}
} catch (TCException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
for (Object[] rowData : tableDataList) {
model.addRow(rowData);
}
table.revalidate();
table.repaint();
System.out.println("搜索结果已显示,用时" + (System.currentTimeMillis() - startTime) + "ms");
}
});
okBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent paramActionEvent) {
// TODO Auto-generated method stub
frame.okCallback(table, paramTable, selectAll, field);
// dialog.setVisible(false);
dialog.dispose();
}
});
cancelBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent paramActionEvent) {
// TODO Auto-generated method stub
// dialog.setVisible(false);
dialog.dispose();
}
});
content.add(targetLabel);
content.add(targetText);
content.add(searchBtn);
content.add(jsp);
content.add(okBtn);
content.add(cancelBtn);
dialog.add(content);
dialog.setVisible(true);
return dialog;
}
private static TCComponentItem[] getTarget(Component parent, String itemId, TCSession session) {
TCComponent[] comps = null;
try {
comps = session.search("Item ID", new String[] { "零组件 ID" }, new String[] { itemId });
// TCComponentItemType type = new TCComponentItemType();
// comps = type.findItems(itemId);
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
return null;
}
if (comps == null || comps.length == 0) {
JOptionPane.showMessageDialog(parent, "无效的物料编码,请确认编码是否正确", "提示", JOptionPane.WARNING_MESSAGE);
return null;
}
TCComponentItem[] items = new TCComponentItem[comps.length];
for (int i = 0; i < comps.length; i++) {
items[i] = (TCComponentItem) comps[i];
}
return items;
}
public static class TableMsg {
public JScrollPane panel;
public JTable table;
public TableMsg(JScrollPane panel, JTable table) {
super();
this.panel = panel;
this.table = table;
}
}
}

@ -0,0 +1,47 @@
package com.connor.jd.plm.utils;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import com.aspose.cells.Cells;
import com.aspose.cells.License;
import com.aspose.cells.Workbook;
import com.aspose.cells.WorksheetCollection;
public class ExcelInfoScanner {
public static Map<Integer, String> getClassPropOptions(String path, String nodeName) {
Map<Integer, String> res = new HashMap<Integer, String>();
try {
getLicense();
Workbook excel = new Workbook(path);
WorksheetCollection wc = excel.getWorksheets();
Cells cells = wc.get(0).getCells();
for (int i = 0; i <= cells.getMaxDataRow(); i++) {
if (cells.get(i, 0).getStringValue().equals(nodeName)) {
res.put(cells.get(i, 1).getIntValue(), cells.get(i, 2).getStringValue());
}
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return res;
}
public static boolean getLicense() throws Exception {
boolean result = false;
try {
InputStream is = com.aspose.cells.Cell.class.getResourceAsStream("/com/aspose/cells/resources/license.xml");
License aposeLic = new License();
aposeLic.setLicense(is);
result = true;
is.close();
} catch (Exception e) {
e.printStackTrace(System.out);
throw e;
}
return result;
}
}

@ -0,0 +1,96 @@
package com.connor.jd.plm.utils;
import java.awt.Component;
import java.util.Vector;
import javax.swing.DefaultComboBoxModel;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JComboBox;
import javax.swing.JList;
import com.connor.jd.plm.beans.CheckBoxPo;
public class KeyValComboBox extends JComboBox {
public KeyValComboBox(Vector values) {
super(values);
rendererData(); // 渲染数据
}
public void rendererData() {
DefaultListCellRenderer render = new DefaultListCellRenderer() {
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (value instanceof CheckBoxPo) {
CheckBoxPo po = (CheckBoxPo) value;
this.setText(po.text);
}
return this;
}
};
this.setRenderer(render);
}
// 修改Combox中的数据
public void updateData(Vector values) {
setModel(new DefaultComboBoxModel(values));
rendererData();
}
@Override
public void setSelectedItem(Object anObject) { // 选中text与传入的参数相同的项
if (anObject != null) {
if (anObject instanceof CheckBoxPo) {
super.setSelectedItem(anObject);
}
if (anObject instanceof String) {
for (int index = 0; index < getItemCount(); index++) {
CheckBoxPo po = (CheckBoxPo) getItemAt(index);
if (po.text.equals(anObject.toString())) {
super.setSelectedIndex(index);
}
}
}
} else {
super.setSelectedItem(anObject);
}
}
public void setSelectedValue(Object anObject) { // 选中value与传入的参数相同的项
if (anObject != null) {
if (anObject instanceof CheckBoxPo) {
super.setSelectedItem(anObject);
}
if (anObject instanceof String) {
for (int index = 0; index < getItemCount(); index++) {
CheckBoxPo po = (CheckBoxPo) getItemAt(index);
if (po.value.equals(anObject.toString())) {
super.setSelectedIndex(index);
}
}
}
} else {
super.setSelectedItem(anObject);
}
}
// 获得选中项的键值
public Object getSelectedValue() {
if (getSelectedItem() instanceof CheckBoxPo) {
CheckBoxPo po = (CheckBoxPo) getSelectedItem();
return po.value;
}
return (getSelectedItem() != null) ? getSelectedItem().toString() : null;
}
// 获得选中项的显示文本
public String getSelectedText() {
if (getSelectedItem() instanceof CheckBoxPo) {
CheckBoxPo po = (CheckBoxPo) getSelectedItem();
return po.text;
}
return (getSelectedItem() != null) ? getSelectedItem().toString() : null;
}
}

@ -0,0 +1,21 @@
package com.connor.jd.plm.utils;
public class StringCreateUtil {
public static String createBlank(int num) {
StringBuilder sb = new StringBuilder();
while (num > 0) {
sb.append(" ");
num--;
}
return sb.toString();
}
public static String createPoint(int num) {
StringBuilder sb = new StringBuilder();
while (num > 0) {
sb.append(".");
num--;
}
return sb.toString();
}
}
Loading…
Cancel
Save