洪丞进 1 year ago
parent 2678a332f2
commit 0afc89c052

@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="lib" path="lib/cn.com.origin.autocode_1.0.0.jar"/>
<classpathentry exported="true" kind="lib" path="lib/commons-net-3.6.jar"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="lib" path="lib/activation-1.1.jar"/>
@ -93,6 +95,5 @@
<classpathentry kind="lib" path="lib/org.eclipse.osgi.services.nl_12000.2.0.jar"/>
<classpathentry kind="lib" path="lib/org.eclipse.osgi.services_3.7.100.v20180827-1536.jar"/>
<classpathentry kind="lib" path="lib/cn.com.origin.autocodemanager_1.0.0.jar"/>
<classpathentry kind="lib" path="lib/cn.com.origin.autocode_1.0.0.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

@ -26,12 +26,10 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.15.100",
org.eclipse.ui.navigator;bundle-version="3.7.300",
com.teamcenter.rac.ui.views;bundle-version="12000.2.0",
com.teamcenter.rac.cm;bundle-version="12000.2.0",
com.teamcenter.rac.workflow;bundle-version="12000.2.0",
com.teamcenter.rac.workflow.processdesigner;bundle-version="12000.2.0",
com.teamcenter.rac.workflow.processviewer;bundle-version="12000.2.0",
org.eclipse.osgi.services;bundle-version="3.7.100",
org.eclipse.osgi.util;bundle-version="3.5.100"
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
TcSoaCadRac,
TcSoaStructureManagementLoose;bundle-version="12000.2.0",
TcSoaStructureManagementRac;bundle-version="12000.2.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: lib/activation-1.1.jar,
lib/antlr-2.7.7.jar,
@ -117,10 +115,8 @@ Bundle-ClassPath: lib/activation-1.1.jar,
.,
lib/cn.com.origin.autocodemanager_1.0.0.jar,
lib/jxl.jar,
lib/org.eclipse.osgi.services_3.7.100.v20180827-1536.jar,
lib/Spire.Xls.jar,
lib/cn.com.origin.autocode_1.0.0.jar,
lib/org.eclipse.osgi.services.nl_12000.2.0.jar
lib/commons-net-3.6.jar,
lib/cn.com.origin.autocode_1.0.0.jar
Export-Package: .,
antlr,
antlr.ASdebug,
@ -209,10 +205,6 @@ Export-Package: .,
com.connor.dfl.plm.dfl033,
com.connor.dfl.plm.dfl034,
com.connor.dfl.plm.dfl035,
com.connor.dfl.plm.dfl036,
com.connor.dfl.plm.dfl037,
com.connor.dfl.plm.dfl038,
com.connor.dfl.plm.dfl039,
com.connor.dfl.plm.exportBOM,
com.connor.dfl.plm.forms,
com.connor.dfl.plm.table,
@ -297,110 +289,6 @@ Export-Package: .,
com.lowagie.text.xml.simpleparser,
com.lowagie.text.xml.xmp,
com.lowagie.tools,
com.spire.data.table,
com.spire.data.table.common,
com.spire.license,
com.spire.ms.System,
com.spire.ms.System.Collections,
com.spire.ms.System.Collections.Generic,
com.spire.ms.System.Collections.ObjectModel,
com.spire.ms.System.Collections.Specialized,
com.spire.ms.System.Diagnostics,
com.spire.ms.System.Reflection,
com.spire.ms.System.Security.Cryptography,
com.spire.ms.System.Security.Cryptography.X509Certificates,
com.spire.ms.System.Xml,
com.spire.ms.charsets,
com.spire.ms.charsets.euc_kr,
com.spire.ms.charsets.iso_8859_1,
com.spire.ms.charsets.iso_8859_8,
com.spire.ms.charsets.ms_936,
com.spire.ms.charsets.utf_7,
com.spire.ms.core.System.Security.Cryptography.X509Certificates,
com.spire.ms.imagecodecs.bmp.spi,
com.spire.ms.imagecodecs.gif.spi,
com.spire.ms.imagecodecs.ico.spi,
com.spire.ms.imagecodecs.jpeg.spi,
com.spire.ms.imagecodecs.png.spi,
com.spire.ms.imagecodecs.tiff.spi,
com.spire.ms.lang,
com.spire.pdf,
com.spire.pdf.actions,
com.spire.pdf.annotations,
com.spire.pdf.annotations.appearance,
com.spire.pdf.attachments,
com.spire.pdf.automaticfields,
com.spire.pdf.barcode,
com.spire.pdf.bookmarks,
com.spire.pdf.collections,
com.spire.pdf.colorspace,
com.spire.pdf.exporting,
com.spire.pdf.exporting.text,
com.spire.pdf.exporting.xps.schema,
com.spire.pdf.fields,
com.spire.pdf.general,
com.spire.pdf.general.find,
com.spire.pdf.general.paper.drawing.ps,
com.spire.pdf.general.paper.font.common,
com.spire.pdf.general.paper.font.postscript.path,
com.spire.pdf.general.paper.font.rendering.hinting,
com.spire.pdf.general.paper.font.ttf.internals,
com.spire.pdf.general.paper.font.type1.internals,
com.spire.pdf.general.paper.font.type1.internals.parsing.objects,
com.spire.pdf.graphics,
com.spire.pdf.graphics.fonts,
com.spire.pdf.graphics.layer,
com.spire.pdf.grid,
com.spire.pdf.htmlconverter,
com.spire.pdf.htmlconverter.qt,
com.spire.pdf.interfacess,
com.spire.pdf.lists,
com.spire.pdf.security,
com.spire.pdf.tables,
com.spire.pdf.tables.table,
com.spire.pdf.tables.table.common,
com.spire.pdf.widget,
com.spire.pdf.xmp,
com.spire.xls,
com.spire.xls.charts,
com.spire.xls.collections,
com.spire.xls.core,
com.spire.xls.core.converter,
com.spire.xls.core.converter.exporting,
com.spire.xls.core.converter.rendering.chart.charts.common,
com.spire.xls.core.converter.rendering.chart.charts.xlscharts.general,
com.spire.xls.core.converter.rendering.chart.charts.xlsxcharts.general,
com.spire.xls.core.converter.rendering.chart.shapes.xlsshaps.general,
com.spire.xls.core.converter.rendering.chart.shapes.xlsshaps.general.gradient,
com.spire.xls.core.converter.rendering.chart.shapes.xlsxshaps.general,
com.spire.xls.core.converter.rendering.chart.shapes.xlsxshaps.general.gradient,
com.spire.xls.core.converter.spreadsheet,
com.spire.xls.core.converter.spreadsheet.autofilter,
com.spire.xls.core.converter.spreadsheet.charts,
com.spire.xls.core.converter.spreadsheet.conditionalformatting,
com.spire.xls.core.converter.spreadsheet.conditionalformatting.xlsx,
com.spire.xls.core.converter.spreadsheet.excelstyle,
com.spire.xls.core.converter.spreadsheet.extensions,
com.spire.xls.core.converter.spreadsheet.formulaop,
com.spire.xls.core.converter.spreadsheet.pagesetup,
com.spire.xls.core.converter.spreadsheet.pivottable,
com.spire.xls.core.converter.spreadsheet.query,
com.spire.xls.core.converter.spreadsheet.shapes,
com.spire.xls.core.converter.spreadsheet.shapes.msodrawing,
com.spire.xls.core.converter.spreadsheet.sparkline,
com.spire.xls.core.converter.spreadsheet.xmlmapping,
com.spire.xls.core.converter.tables,
com.spire.xls.core.interfaces,
com.spire.xls.core.interfacess,
com.spire.xls.core.spreadsheet,
com.spire.xls.core.spreadsheet.autofilter,
com.spire.xls.core.spreadsheet.charts,
com.spire.xls.core.spreadsheet.collections,
com.spire.xls.core.spreadsheet.conditionalformatting,
com.spire.xls.core.spreadsheet.pivottables,
com.spire.xls.core.spreadsheet.shapes,
com.spire.xls.core.spreadsheet.sorting,
com.spire.xls.packages,
com.sun.activation.registries,
com.sun.activation.viewers,
com.sun.codemodel,
@ -1202,7 +1090,6 @@ Export-Package: .,
org.osgi.service.component.runtime,
org.osgi.service.component.runtime.dto,
org.osgi.service.device,
org.osgi.service.event,
org.osgi.service.http,
org.osgi.service.http.context,
org.osgi.service.http.runtime,

@ -89,5 +89,6 @@ bin.includes = plugin.xml,\
lib/org.eclipse.osgi.services_3.7.100.v20180827-1536.jar,\
lib/Spire.Xls.jar,\
lib/org.eclipse.osgi.services.nl_12000.2.0.jar,\
lib/cn.com.origin.autocode_1.0.0.jar,\
lib/cn.com.origin.autocodemanager_1.0.0.jar
lib/cn.com.origin.autocodemanager_1.0.0.jar,\
lib/commons-net-3.6.jar,\
lib/cn.com.origin.autocode_1.0.0.jar

@ -12,7 +12,6 @@
<command name="冻干机" id="com.connor.dfl.plm.dfl003.Dfl003Handler_DGJ"/>
-->
<command name="企标件" id="com.connor.dfl.plm.dfl003.Dfl003Handler_QBJ"/>
<command name="进出料" id="com.connor.dfl.plm.dfl003.Dfl003Handler_JCL"/>
<command name="隔离器" id="com.connor.dfl.plm.dfl003.Dfl003Handler_GLQ"/>
<command name="配液" id="com.connor.dfl.plm.dfl003.Dfl003Handler_PY"/>
@ -35,7 +34,12 @@
<command name="医用包材" id="com.connor.dfl.plm.dfl003.Dfl003Handler_YYBC"/>
<command name="总控外协" id="com.connor.dfl.plm.dfl003.Dfl003Handler_ZKWX"/>
<command name="承欢" id="com.connor.dfl.plm.dfl003.Dfl003Handler_CH"/>
<command name="PU1" id="com.connor.dfl.plm.dfl003.Dfl003Handler_puone"/>
<command name="水技术工程" id="com.connor.dfl.plm.dfl003.Dfl003Handler_SJSGC"/>
<command name="分类LOV本地化查重" id="com.connor.dfl.plm.classLov"/>
<command name="批量下载图纸(EXCEL)" id="com.connor.dfl.plm.outputDwg"/>
<command name="零件" id="总部-A0-中文-零件"/>
<command name="零件" id="总部-A0-英文-零件"/>
@ -194,9 +198,25 @@
<command name="补充创建" id="com.connor.dfl.plm.dfl018.Dfl018Handler"/>
<command name="物料传递ERP" id="com.connor.dfl.plm.dfl019.Dfl019Handler"/>
<command name="BOM传递ERP" id="com.connor.dfl.plm.dfl020.Dfl020Handler"/>
<!--
<command name="物料传递ERP-拼接版本" id="com.connor.dfl.plm.dfl019.Dfl019Handler2"/>
<command name="物料传递ERP-拼接版本-包含虚拟件" id="com.connor.dfl.plm.dfl019.Dfl019Handler3"/>
-->
<command name="整体BOM传递ERP" id="com.connor.dfl.plm.dfl020.Dfl020Handler"/>
<!--
<command name="BOM传递ERP-拼接版本" id="com.connor.dfl.plm.dfl020.Dfl020Handler2"/>
<command name="BOM传递ERP-拼接版本-包含虚拟件" id="com.connor.dfl.plm.dfl020.Dfl020Handler3"/>
-->
<command name="单层BOM传递ERP" id="com.connor.dfl.plm.dfl0201.Dfl0201Handler"/>
<!--
<command name="单层BOM传递ERP-拼接版本" id="com.connor.dfl.plm.dfl0201.Dfl0201Handler2"/>
<command name="单层BOM传递ERP-拼接版本-包含虚拟件" id="com.connor.dfl.plm.dfl0201.Dfl0201Handler3"/>
-->
<command name="呆滞BOM传递ERP" id="com.connor.dfl.plm.dfl049.Dfl020Handler"/>
<!--
<command name="呆滞BOM传递ERP-拼接版本" id="com.connor.dfl.plm.dfl049.Dfl020Handler2"/>
<command name="呆滞BOM传递ERP-拼接版本-包含虚拟件" id="com.connor.dfl.plm.dfl049.Dfl020Handler3"/>
-->
<command name="搜索执行的任务" id="com.connor.dfl.plm.dfl021.Dfl021Handler"/>
<command name="东富龙知识库" id="com.connor.dfl.plm.dfl023.Dfl023Hander"/>
@ -206,7 +226,13 @@
<command name="导出系统方案报表" id="com.connor.dfl.plm.dfl025.Dfl025Handler"/>
<command name="导出BOM报表" id="com.connor.dfl.plm.exportBOM.BOMExportHandler"/>
<!--
<command name="导出BOM报表-拼接版本" id="com.connor.dfl.plm.exportBOM.BOMExportHandler2"/>
-->
<command name="按组件号导出设备BOM报表" id="com.connor.dfl.plm.dfl054.Dfl054Handler"/>
<command name="导出设备BOM" id="com.connor.dfl.plm.dfl052.Dfl052Handler"/>
<command name="导出设备BOM-拼接版本" id="com.connor.dfl.plm.dfl052.Dfl052Handler2"/>
<command name="导出设备BOM-拼接版本-包含虚拟件" id="com.connor.dfl.plm.dfl052.Dfl052Handler3"/>
<command name="BOM导入" id="com.teamcenter.rac.ui.ImportBomsCommand"> </command>
<command name="添加状态" id="com.connor.dfl.plm.dfl026.Dfl026Handler"> </command>
@ -229,12 +255,33 @@
<command name="导出变更通知单报表" id="com.connor.dfl.plm.dfl038.Dfl038Handler"/>
<command name="刷新品牌标签" id="com.connor.dfl.plm.dfl039.DFL039Handler"/>
<command name="导出变更单报表" id="com.connor.dfl.plm.dfl040.Dfl038Handler"/>
<command name="导出变更单报表-新版" id="com.connor.dfl.plm.dfl048.Dfl038Handler"/>
<command name="查看变更单报表" id="com.connor.dfl.plm.dfl053.Dfl053Handler"/>
<command name="test" id="com.connor.dfl.plm.dfl055.Dfl055Handler"/>
<command name="创建标准Bom" id="com.connor.dfl.plm.dfl041.Dfl041Handler"/>
<!--
<command name="创建标准Bom-拼接版本" id="com.connor.dfl.plm.dfl041.Dfl041Handler2"/>
<command name="创建标准Bom-拼接版本-包含虚拟件" id="com.connor.dfl.plm.dfl041.Dfl041Handler3"/>
-->
<command name="ERP队列" id="com.connor.dfl.plm.dfl042.Dfl042Handler"/>
<command name="传递ERP队列" id="com.connor.dfl.plm.dfl50.Dfl50Handler"/>
<command name="传递ERP队列(历史)" id="com.connor.dfl.plm.dfl501.Dfl50Handler"/>
<command name="ERP引用查询" id="com.connor.dfl.plm.dfl051.Dfl051Handler"/>
<command name="自动填写作业编号" id="com.connor.dfl.plm.dfl043.Dfl043Handler"/>
<command name="查询零件库存和价格" id="com.connor.dfl.plm.dfl044.Dfl044Handler"/>
<command name="流程报表导出" id="com.connor.dfl.plm.dfl045.Dfl045Handler"/>
<command name="价格bom报表导出" id="com.connor.dfl.plm.dfl046.BOMExportHandler"/>
<!--
<command name="价格bom报表导出-拼接版本" id="com.connor.dfl.plm.dfl046.BOMExportHandler2"/>
-->
<command name="ERP-BOM比较" id="com.connor.dfl.plm.dfl047.Dfl047Handler"/>
<command name="更新单表" id="com.connor.dfl.plm.dfl048.Dfl048Handler"/>
<!--
<command name="ERP导出bom结构-拼接版本" id="com.connor.dfl.plm.dfl047.Dfl047Handler2"/>
<command name="ERP导出bom结构-拼接版本-包含虚拟件" id="com.connor.dfl.plm.dfl047.Dfl047Handler3"/>
-->
<command name="一键转移项目所有权" id="com.connor.dfl.plm.changeProjectOwner.ChangeProjectOwnerHandler"/>
<command name="快速另存变更" id="com.connor.dfl.plm.changeSaveAs.ChangeSaveAsHandler"/>
</extension>
<!--handlers-->
<extension point="org.eclipse.ui.handlers">
@ -293,8 +340,8 @@
<handler commandId="共和-A4-英文-零件" class="com.connor.dfl.plm.cadhandler.CreateCADModelHandler"/>
<handler commandId="共和-A4-中文-装配" class="com.connor.dfl.plm.cadhandler.CreateCADModelHandler"/>
<handler commandId="共和-A4-英文-装配" class="com.connor.dfl.plm.cadhandler.CreateCADModelHandler"/>
<handler commandId="com.connor.dfl.plm.classLov" class="com.connor.dfl.plm.classLov.SearchClassLov"/>
<handler commandId="com.connor.dfl.plm.outputDwg" class="com.connor.dfl.plm.outputDwg.OutPutDwgHandler"/>
<handler commandId="医疗装备-A0-中文-零件" class="com.connor.dfl.plm.cadhandler.CreateCADModelHandler"/>
<handler commandId="医疗装备-A0-英文-零件" class="com.connor.dfl.plm.cadhandler.CreateCADModelHandler"/>
@ -354,7 +401,9 @@
<handler commandId="com.connor.dfl.plm.dfl003.Dfl003Handler_ZKWX" class="com.connor.dfl.plm.dfl003.Dfl003Handler"/>
<handler commandId="com.connor.dfl.plm.dfl003.Dfl003Handler_CH" class="com.connor.dfl.plm.dfl003.Dfl003Handler"/>
<handler commandId="com.connor.dfl.plm.dfl003.Dfl003Handler_puone" class="com.connor.dfl.plm.dfl003.Dfl003Handler"/>
<handler commandId="com.connor.dfl.plm.dfl003.Dfl003Handler_SJSGC" class="com.connor.dfl.plm.dfl003.Dfl003Handler"/>
@ -425,7 +474,25 @@
<handler commandId="com.connor.dfl.plm.dfl018.Dfl018Handler" class="com.connor.dfl.plm.dfl018.Dfl018Handler"/>
<handler commandId="com.connor.dfl.plm.dfl019.Dfl019Handler" class="com.connor.dfl.plm.dfl019.Dfl019Handler"/>
<!--
<handler commandId="com.connor.dfl.plm.dfl019.Dfl019Handler2" class="com.connor.dfl.plm.dfl019.Dfl019Handler"/>
<handler commandId="com.connor.dfl.plm.dfl019.Dfl019Handler3" class="com.connor.dfl.plm.dfl019.Dfl019Handler"/>
-->
<handler commandId="com.connor.dfl.plm.dfl020.Dfl020Handler" class="com.connor.dfl.plm.dfl020.Dfl020Handler"/>
<!--
<handler commandId="com.connor.dfl.plm.dfl020.Dfl020Handler2" class="com.connor.dfl.plm.dfl020.Dfl020Handler"/>
<handler commandId="com.connor.dfl.plm.dfl020.Dfl020Handler3" class="com.connor.dfl.plm.dfl020.Dfl020Handler"/>
-->
<handler commandId="com.connor.dfl.plm.dfl0201.Dfl0201Handler" class="com.connor.dfl.plm.dfl0201.Dfl0201Handler"/>
<!--
<handler commandId="com.connor.dfl.plm.dfl0201.Dfl0201Handler2" class="com.connor.dfl.plm.dfl0201.Dfl0201Handler"/>
<handler commandId="com.connor.dfl.plm.dfl0201.Dfl0201Handler3" class="com.connor.dfl.plm.dfl0201.Dfl0201Handler"/>
-->
<handler commandId="com.connor.dfl.plm.dfl049.Dfl020Handler" class="com.connor.dfl.plm.dfl049.Dfl020Handler"/>
<!--
<handler commandId="com.connor.dfl.plm.dfl049.Dfl020Handler2" class="com.connor.dfl.plm.dfl049.Dfl020Handler"/>
<handler commandId="com.connor.dfl.plm.dfl049.Dfl020Handler3" class="com.connor.dfl.plm.dfl049.Dfl020Handler"/>
-->
<handler commandId="com.connor.dfl.plm.dfl021.Dfl021Handler" class="com.connor.dfl.plm.dfl021.Dfl021Handler"/>
<handler commandId="T2_PIM" class="com.connor.dfl.plm.dfl005.Dfl005Handler"/>
<handler commandId="com.connor.dfl.plm.dfl023.Dfl023Hander" class="com.connor.dfl.plm.dfl023.Dfl023Hander"/>
@ -434,6 +501,13 @@
<handler commandId="com.connor.dfl.plm.dfl026.Dfl026Handler" class="com.connor.dfl.plm.dfl026.Dfl026Handler"/>
<handler commandId="com.connor.dfl.plm.dfl027.Dfl027Handler" class="com.connor.dfl.plm.dfl027.Dfl027Handler"/>
<handler commandId="com.connor.dfl.plm.exportBOM.BOMExportHandler" class="com.connor.dfl.plm.exportBOM.BOMExportHandler"/>
<!--
<handler commandId="com.connor.dfl.plm.exportBOM.BOMExportHandler2" class="com.connor.dfl.plm.exportBOM.BOMExportHandler"/>
-->
<handler commandId="com.connor.dfl.plm.dfl054.Dfl054Handler" class="com.connor.dfl.plm.dfl054.Dfl054Handler"/>
<handler commandId="com.connor.dfl.plm.dfl053.Dfl053Handler" class="com.connor.dfl.plm.dfl053.Dfl053Handler"/>
<handler commandId="com.connor.dfl.plm.dfl055.Dfl055Handler" class="com.connor.dfl.plm.dfl055.Dfl055Handler"/>
<handler commandId="com.connor.dfl.plm.dfl028.Dfl028Handler" class="com.connor.dfl.plm.dfl028.Dfl028Handler"/>
<handler commandId="com.connor.dfl.plm.dfl029.Dfl029Handler" class="com.connor.dfl.plm.dfl029.Dfl029Handler"/>
<handler commandId="com.connor.dfl.plm.dfl031.ExportHandler" class="com.connor.dfl.plm.dfl031.ExportHandler"/>
@ -447,17 +521,39 @@
<handler commandId="com.connor.dfl.plm.dfl038.Dfl038Handler" class="com.connor.dfl.plm.dfl038.Dfl038Handler"/>
<handler commandId="com.connor.dfl.plm.dfl039.DFL039Handler" class="com.connor.dfl.plm.dfl039.DFL039Handler"/>
<handler commandId="com.connor.dfl.plm.dfl040.Dfl038Handler" class="com.connor.dfl.plm.dfl040.Dfl038Handler"/>
<handler commandId="com.connor.dfl.plm.dfl048.Dfl038Handler" class="com.connor.dfl.plm.dfl048.Dfl038Handler"/>
<handler commandId="com.connor.dfl.plm.dfl052.Dfl052Handler" class="com.connor.dfl.plm.dfl052.Dfl052Handler"/>
<handler commandId="com.connor.dfl.plm.dfl052.Dfl052Handler2" class="com.connor.dfl.plm.dfl052.Dfl052Handler"/>
<handler commandId="com.connor.dfl.plm.dfl052.Dfl052Handler3" class="com.connor.dfl.plm.dfl052.Dfl052Handler"/>
<handler commandId="com.connor.dfl.plm.dfl041.Dfl041Handler" class="com.connor.dfl.plm.dfl041.Dfl041Handler"/>
<!--
<handler commandId="com.connor.dfl.plm.dfl041.Dfl041Handler2" class="com.connor.dfl.plm.dfl041.Dfl041Handler"/>
<handler commandId="com.connor.dfl.plm.dfl041.Dfl041Handler3" class="com.connor.dfl.plm.dfl041.Dfl041Handler"/>
-->
<handler commandId="com.connor.dfl.plm.dfl042.Dfl042Handler" class="com.connor.dfl.plm.dfl042.Dfl042Handler"/>
<handler commandId="com.connor.dfl.plm.dfl50.Dfl50Handler" class="com.connor.dfl.plm.dfl50.Dfl50Handler"/>
<handler commandId="com.connor.dfl.plm.dfl501.Dfl50Handler" class="com.connor.dfl.plm.dfl501.Dfl50Handler"/>
<handler commandId="com.connor.dfl.plm.dfl051.Dfl051Handler" class="com.connor.dfl.plm.dfl051.Dfl051Handler"/>
<handler commandId="com.connor.dfl.plm.dfl043.Dfl043Handler" class="com.connor.dfl.plm.dfl043.Dfl043Handler"/>
<handler commandId="com.connor.dfl.plm.dfl044.Dfl044Handler" class="com.connor.dfl.plm.dfl044.Dfl044Handler"/>
<handler commandId="com.connor.dfl.plm.dfl045.Dfl045Handler" class="com.connor.dfl.plm.dfl045.Dfl045Handler"/>
<handler commandId="com.connor.dfl.plm.dfl046.BOMExportHandler" class="com.connor.dfl.plm.dfl046.BOMExportHandler"/>
<!--
<handler commandId="com.connor.dfl.plm.dfl046.BOMExportHandler2" class="com.connor.dfl.plm.dfl046.BOMExportHandler"/>
-->
<handler commandId="com.connor.dfl.plm.dfl047.Dfl047Handler" class="com.connor.dfl.plm.dfl047.Dfl047Handler"/>
<handler commandId="com.connor.dfl.plm.dfl048.Dfl048Handler" class="com.connor.dfl.plm.dfl048.Dfl048Handler"/>
<!--
<handler commandId="com.connor.dfl.plm.dfl047.Dfl047Handler2" class="com.connor.dfl.plm.dfl047.Dfl047Handler"/>
<handler commandId="com.connor.dfl.plm.dfl047.Dfl047Handler3" class="com.connor.dfl.plm.dfl047.Dfl047Handler"/>
-->
<!--
<handler commandId="com.connor.dfl.plm.dfl030.Dfl030Handler" class="com.connor.dfl.plm.dfl030.Dfl030Handler"/>
-->
<handler class="com.connor.dev.imp.solution.handler.ImportBOMsHandler" commandId="com.teamcenter.rac.ui.ImportBomsCommand"> </handler>
<handler class="com.connor.dfl.plm.changeProjectOwner.ChangeProjectOwnerHandler" commandId="com.connor.dfl.plm.changeProjectOwner.ChangeProjectOwnerHandler"> </handler>
<handler class="com.connor.dfl.plm.changeSaveAs.ChangeSaveAsHandler" commandId="com.connor.dfl.plm.changeSaveAs.ChangeSaveAsHandler"> </handler>
</extension>
<!--menus-->
<extension point="org.eclipse.ui.menus">
@ -485,7 +581,47 @@
</and>
</visibleWhen>
</command>
<!--
<command commandId="com.connor.dfl.plm.dfl019.Dfl019Handler2" id="com.connor.dfl.plm.dfl019.Dfl019Handler2">
<visibleWhen>
<and>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals value="com.connor.dfl.plm.dfl019.Dfl019Handler2"/>
</iterate>
</not>
</with>
</and>
</visibleWhen>
</command>
<command commandId="com.connor.dfl.plm.dfl019.Dfl019Handler3" id="com.connor.dfl.plm.dfl019.Dfl019Handler3">
<visibleWhen>
<and>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals value="com.connor.dfl.plm.dfl019.Dfl019Handler3"/>
</iterate>
</not>
</with>
</and>
</visibleWhen>
</command>
-->
<command commandId="com.connor.dfl.plm.dfl0201.Dfl0201Handler" id="com.connor.dfl.plm.dfl0201.Dfl0201Handler">
<visibleWhen>
<and>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals value="com.connor.dfl.plm.dfl0201.Dfl0201Handler"/>
</iterate>
</not>
</with>
</and>
</visibleWhen>
</command>
<command commandId="com.connor.dfl.plm.dfl020.Dfl020Handler" id="com.connor.dfl.plm.dfl020.Dfl020Handler">
<visibleWhen>
<and>
@ -499,7 +635,103 @@
</and>
</visibleWhen>
</command>
<!--
<command commandId="com.connor.dfl.plm.dfl020.Dfl020Handler2" id="com.connor.dfl.plm.dfl020.Dfl020Handler2">
<visibleWhen>
<and>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals value="com.connor.dfl.plm.dfl020.Dfl020Handler2"/>
</iterate>
</not>
</with>
</and>
</visibleWhen>
</command>
<command commandId="com.connor.dfl.plm.dfl020.Dfl020Handler3" id="com.connor.dfl.plm.dfl020.Dfl020Handler3">
<visibleWhen>
<and>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals value="com.connor.dfl.plm.dfl020.Dfl020Handler3"/>
</iterate>
</not>
</with>
</and>
</visibleWhen>
</command>-->
<!--
<command commandId="com.connor.dfl.plm.dfl0201.Dfl0201Handler2" id="com.connor.dfl.plm.dfl0201.Dfl0201Handler2">
<visibleWhen>
<and>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals value="com.connor.dfl.plm.dfl0201.Dfl0201Handler2"/>
</iterate>
</not>
</with>
</and>
</visibleWhen>
</command>
<command commandId="com.connor.dfl.plm.dfl0201.Dfl0201Handler3" id="com.connor.dfl.plm.dfl0201.Dfl0201Handler3">
<visibleWhen>
<and>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals value="com.connor.dfl.plm.dfl0201.Dfl0201Handler3"/>
</iterate>
</not>
</with>
</and>
</visibleWhen>
</command>
-->
<command commandId="com.connor.dfl.plm.dfl049.Dfl020Handler" id="com.connor.dfl.plm.dfl049.Dfl020Handler">
<visibleWhen>
<and>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals value="com.connor.dfl.plm.dfl049.Dfl020Handler"/>
</iterate>
</not>
</with>
</and>
</visibleWhen>
</command>
<!--
<command commandId="com.connor.dfl.plm.dfl049.Dfl020Handler2" id="com.connor.dfl.plm.dfl049.Dfl020Handler2">
<visibleWhen>
<and>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals value="com.connor.dfl.plm.dfl049.Dfl020Handler2"/>
</iterate>
</not>
</with>
</and>
</visibleWhen>
</command>
<command commandId="com.connor.dfl.plm.dfl049.Dfl020Handler3" id="com.connor.dfl.plm.dfl049.Dfl020Handler3">
<visibleWhen>
<and>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals value="com.connor.dfl.plm.dfl049.Dfl020Handler3"/>
</iterate>
</not>
</with>
</and>
</visibleWhen>
</command>
-->
<command commandId="com.connor.dfl.plm.dfl042.Dfl042Handler" id="com.connor.dfl.plm.dfl042.Dfl042Handler">
<visibleWhen>
<and>
@ -513,6 +745,45 @@
</and>
</visibleWhen>
</command>
<command commandId="com.connor.dfl.plm.dfl50.Dfl50Handler" id="com.connor.dfl.plm.dfl50.Dfl50Handler">
<visibleWhen>
<and>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals value="com.connor.dfl.plm.dfl50.Dfl50Handler"/>
</iterate>
</not>
</with>
</and>
</visibleWhen>
</command>
<command commandId="com.connor.dfl.plm.dfl501.Dfl50Handler" id="com.connor.dfl.plm.dfl501.Dfl50Handler">
<visibleWhen>
<and>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals value="com.connor.dfl.plm.dfl501.Dfl50Handler"/>
</iterate>
</not>
</with>
</and>
</visibleWhen>
</command>
<command commandId="com.connor.dfl.plm.dfl051.Dfl051Handler" id="com.connor.dfl.plm.dfl051.Dfl051Handler">
<visibleWhen>
<and>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals value="com.connor.dfl.plm.dfl051.Dfl051Handler"/>
</iterate>
</not>
</with>
</and>
</visibleWhen>
</command>
<command commandId="com.connor.dfl.plm.dfl044.Dfl044Handler" id="com.connor.dfl.plm.dfl044.Dfl044Handler">
<visibleWhen>
<and>
@ -526,7 +797,61 @@
</and>
</visibleWhen>
</command>
<command commandId="com.connor.dfl.plm.dfl047.Dfl047Handler" id="com.connor.dfl.plm.dfl047.Dfl047Handler">
<visibleWhen>
<and>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals value="com.connor.dfl.plm.dfl047.Dfl047Handler"/>
</iterate>
</not>
</with>
</and>
</visibleWhen>
</command>
<command commandId="com.connor.dfl.plm.dfl048.Dfl048Handler" id="com.connor.dfl.plm.dfl048.Dfl048Handler">
<visibleWhen>
<and>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals value="com.connor.dfl.plm.dfl048.Dfl048Handler"/>
</iterate>
</not>
</with>
</and>
</visibleWhen>
</command>
<!--
<command commandId="com.connor.dfl.plm.dfl047.Dfl047Handler2" id="com.connor.dfl.plm.dfl047.Dfl047Handler2">
<visibleWhen>
<and>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals value="com.connor.dfl.plm.dfl047.Dfl047Handler2"/>
</iterate>
</not>
</with>
</and>
</visibleWhen>
</command>
<command commandId="com.connor.dfl.plm.dfl047.Dfl047Handler3" id="com.connor.dfl.plm.dfl047.Dfl047Handler3">
<visibleWhen>
<and>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals value="com.connor.dfl.plm.dfl047.Dfl047Handler3"/>
</iterate>
</not>
</with>
</and>
</visibleWhen>
</command>
-->
</menu>
@ -591,6 +916,7 @@
</and>
</visibleWhen>
</command>
<command commandId="com.connor.dfl.plm.exportBOM.BOMExportHandler" id="com.connor.dfl.plm.exportBOM.BOMExportHandler">
<visibleWhen>
<and>
@ -604,6 +930,35 @@
</and>
</visibleWhen>
</command>
<!--
<command commandId="com.connor.dfl.plm.exportBOM.BOMExportHandler2" id="com.connor.dfl.plm.exportBOM.BOMExportHandler2">
<visibleWhen>
<and>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals value="com.connor.dfl.plm.exportBOM.BOMExportHandler2"/>
</iterate>
</not>
</with>
</and>
</visibleWhen>
</command>
-->
<command commandId="com.connor.dfl.plm.dfl054.Dfl054Handler" id="com.connor.dfl.plm.dfl054.Dfl054Handler">
<visibleWhen>
<and>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals value="com.connor.dfl.plm.dfl054.Dfl054Handler"/>
</iterate>
</not>
</with>
</and>
</visibleWhen>
</command>
<command commandId="com.connor.dfl.plm.dfl037.GetLatestExcelHandler" id="com.connor.dfl.plm.dfl037.GetLatestExcelHandler">
<visibleWhen>
<and>
@ -699,7 +1054,84 @@
</and>
</visibleWhen>
</command>
<command commandId="com.connor.dfl.plm.dfl048.Dfl038Handler" id="com.connor.dfl.plm.dfl048.Dfl038Handler">
<visibleWhen>
<and>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals value="com.connor.dfl.plm.dfl048.Dfl038Handler"/>
</iterate>
</not>
</with>
</and>
</visibleWhen>
</command>
<command commandId="com.connor.dfl.plm.dfl052.Dfl052Handler" id="com.connor.dfl.plm.dfl052.Dfl052Handler">
<visibleWhen>
<and>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals value="com.connor.dfl.plm.dfl052.Dfl052Handler"/>
</iterate>
</not>
</with>
</and>
</visibleWhen>
</command>
<command commandId="com.connor.dfl.plm.dfl052.Dfl052Handler2" id="com.connor.dfl.plm.dfl052.Dfl052Handler2">
<visibleWhen>
<and>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals value="com.connor.dfl.plm.dfl052.Dfl052Handler2"/>
</iterate>
</not>
</with>
</and>
</visibleWhen>
</command>
<command commandId="com.connor.dfl.plm.dfl052.Dfl052Handler3" id="com.connor.dfl.plm.dfl052.Dfl052Handler3">
<visibleWhen>
<and>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals value="com.connor.dfl.plm.dfl052.Dfl052Handler3"/>
</iterate>
</not>
</with>
</and>
</visibleWhen>
</command>
<command commandId="com.connor.dfl.plm.dfl053.Dfl053Handler" id="com.connor.dfl.plm.dfl053.Dfl053Handler">
<visibleWhen>
<and>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals value="com.connor.dfl.plm.dfl053.Dfl053Handler"/>
</iterate>
</not>
</with>
</and>
</visibleWhen>
</command>
<command commandId="com.connor.dfl.plm.dfl055.Dfl055Handler" id="com.connor.dfl.plm.dfl055.Dfl055Handler">
<visibleWhen>
<and>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals value="com.connor.dfl.plm.dfl055.Dfl055Handler"/>
</iterate>
</not>
</with>
</and>
</visibleWhen>
</command>
<command commandId="com.connor.dfl.plm.dfl046.BOMExportHandler" id="com.connor.dfl.plm.dfl046.BOMExportHandler">
<visibleWhen>
<and>
@ -713,7 +1145,21 @@
</and>
</visibleWhen>
</command>
<!--
<command commandId="com.connor.dfl.plm.dfl046.BOMExportHandler2" id="com.connor.dfl.plm.dfl046.BOMExportHandler2">
<visibleWhen>
<and>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals value="com.connor.dfl.plm.dfl046.BOMExportHandler2"/>
</iterate>
</not>
</with>
</and>
</visibleWhen>
</command>
-->
<command commandId="com.connor.dfl.plm.dfl045.Dfl045Handler" id="com.connor.dfl.plm.dfl045.Dfl045Handler">
<visibleWhen>
<and>
@ -799,7 +1245,34 @@
</and>
</visibleWhen>
</command>
<!--
<command commandId="com.connor.dfl.plm.dfl041.Dfl041Handler2" id="com.connor.dfl.plm.dfl041.Dfl041Handler2">
<visibleWhen>
<and>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals value="com.connor.dfl.plm.dfl041.Dfl041Handler2"/>
</iterate>
</not>
</with>
</and>
</visibleWhen>
</command>
<command commandId="com.connor.dfl.plm.dfl041.Dfl041Handler3" id="com.connor.dfl.plm.dfl041.Dfl041Handler3">
<visibleWhen>
<and>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals value="com.connor.dfl.plm.dfl041.Dfl041Handler3"/>
</iterate>
</not>
</with>
</and>
</visibleWhen>
</command>
-->
<command commandId="com.connor.dfl.plm.dfl027.Dfl027Handler" id="com.connor.dfl.plm.dfl027.Dfl027Handler">
<visibleWhen>
<and>
@ -878,6 +1351,26 @@
</and>
</visibleWhen>
</command>
<command commandId="com.connor.dfl.plm.changeProjectOwner.ChangeProjectOwnerHandler" id="com.connor.dfl.plm.changeProjectOwner.ChangeProjectOwnerHandler">
<visibleWhen>
<and>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals value="com.connor.dfl.plm.changeProjectOwner.ChangeProjectOwnerHandler"/>
</iterate>
</not>
</with>
</and>
</visibleWhen>
</command>
<command commandId="com.connor.dfl.plm.classLov" id="com.connor.dfl.plm.classLov">
</command>
<command commandId="com.connor.dfl.plm.outputDwg" id="com.connor.dfl.plm.outputDwg">
</command>
</menu>
</menuContribution>
@ -2421,6 +2914,47 @@
</and>
</visibleWhen>
</command>
<command commandId="com.connor.dfl.plm.dfl003.Dfl003Handler_CH" mnemonic="S" id="com.connor.dfl.plm.dfl003.Dfl003Handler_CH">
<visibleWhen>
<and>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals value="com.connor.dfl.plm.dfl003.Dfl003Handler_CH"/>
</iterate>
</not>
</with>
</and>
</visibleWhen>
</command>
<command commandId="com.connor.dfl.plm.dfl003.Dfl003Handler_puone" mnemonic="S" id="com.connor.dfl.plm.dfl003.Dfl003Handler_puone">
<visibleWhen>
<and>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals value="com.connor.dfl.plm.dfl003.Dfl003Handler_puone"/>
</iterate>
</not>
</with>
</and>
</visibleWhen>
</command>
<command commandId="com.connor.dfl.plm.dfl003.Dfl003Handler_SJSGC" mnemonic="S" id="com.connor.dfl.plm.dfl003.Dfl003Handler_SJSGC">
<visibleWhen>
<and>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals value="com.connor.dfl.plm.dfl003.Dfl003Handler_SJSGC"/>
</iterate>
</not>
</with>
</and>
</visibleWhen>
</command>
</menuContribution>
@ -2506,6 +3040,19 @@
</and>
</visibleWhen>
</command>
<command commandId="com.connor.dfl.plm.changeSaveAs.ChangeSaveAsHandler" mnemonic="S" id="com.connor.dfl.plm.changeSaveAs.ChangeSaveAsHandler">
<visibleWhen>
<and>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals value="com.connor.dfl.plm.changeSaveAs.ChangeSaveAsHandler"/>
</iterate>
</not>
</with>
</and>
</visibleWhen>
</command>
</menuContribution>

@ -4,6 +4,11 @@ import java.awt.BorderLayout;
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.KeyEvent;
import java.awt.event.KeyListener;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@ -24,9 +29,12 @@ import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.TreeNode;
import org.apache.commons.collections.set.MapBackedSet;
//import org.jacorb.idl.runtime.int_token;
import com.connor.dfl.plm.util.CodeBean;
import com.connor.dfl.plm.util.CopyPropsBean;
import com.connor.dfl.plm.util.DataBaseControl;
import com.connor.dfl.plm.util.GetCodeBean;
import com.connor.dfl.plm.util.MenuBean;
import com.teamcenter.rac.aif.AbstractAIFDialog;
@ -91,11 +99,12 @@ public class Dfl003AIFDialog extends AbstractAIFDialog {
private Map<String, String> ImportanceMap=new HashMap<String, String>();
private JTextField jText;
private JComboBox groupCode_combobox;
private JComboBox sourceCode_combobox;
private JComboBox Importantce_combobox;
private List<String> nameList =new ArrayList<String>();
private Map<String,String> idMap = new HashMap<String, String>();
public Dfl003AIFDialog(TCSession session, InterfaceAIFComponent targetComp,
@ -185,7 +194,7 @@ public class Dfl003AIFDialog extends AbstractAIFDialog {
// TODO Auto-generated method stub
this.setTitle("创建" + name);
this.setAlwaysOnTop(true);
this.setPreferredSize(new Dimension(550, 630));
this.setPreferredSize(new Dimension(650, 630));
this.setLayout(new PropertyLayout());
jp1 = new JPanel(new BorderLayout());
jp2 = new JPanel(new PropertyLayout());
@ -229,9 +238,9 @@ public class Dfl003AIFDialog extends AbstractAIFDialog {
JLabel sourceCode_lable = new JLabel("来源码:");
JLabel Important_lable = new JLabel("关键件:");
groupCode_combobox = new JComboBox();groupCode_combobox.addItem(name);
sourceCode_combobox = new JComboBox();sourceCode_combobox.addItem("自制件");
Importantce_combobox = new JComboBox();Importantce_combobox.addItem("A");
groupCode_combobox = new JComboBox();//groupCode_combobox.addItem(name);
sourceCode_combobox = new JComboBox();//sourceCode_combobox.addItem("自制件");
Importantce_combobox = new JComboBox();//Importantce_combobox.addItem("A");
jtext1 = new JTextField();
jtext2 = new JTextField();
@ -245,6 +254,7 @@ public class Dfl003AIFDialog extends AbstractAIFDialog {
jtext8.setBorder(new LineBorder(new java.awt.Color(127,157,185), 1, false));
jtext10 = new JTextField();
jcomproject.addItem("");
// idList.add(" ");
TCComponentUser user = session.getUser();
try {
String user_id = user.getStringProperty("user_id");
@ -259,7 +269,11 @@ public class Dfl003AIFDialog extends AbstractAIFDialog {
TCComponentProject project = (TCComponentProject) comp;
try {
String id = project.getStringProperty("project_id");
jcomproject.addItem(id);
String name = project.getStringProperty("object_name");
// idList.add(id);idMap
idMap.put(name, id);
nameList.add(name);
jcomproject.addItem(name);
} catch (TCException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
@ -271,6 +285,72 @@ public class Dfl003AIFDialog extends AbstractAIFDialog {
// TODO Auto-generated catch block
e2.printStackTrace();
}
jcomproject.setEditable(true);
jText = (JTextField) jcomproject.getEditor().getEditorComponent();
jText.addKeyListener(new KeyListener() {
@Override
public void keyTyped(KeyEvent e) {
// TODO Auto-generated method stub
}
@Override
public void keyReleased(KeyEvent e) {
// TODO Auto-generated method stub
addSelect(e,jcomproject,jText,nameList);
}
@Override
public void keyPressed(KeyEvent e) {
// TODO Auto-generated method stub
}
});
jText.addFocusListener(new FocusListener() {
@Override
public void focusLost(FocusEvent e) {
// TODO Auto-generated method stub
String text = jText.getText();
System.out.println("text===>"+text);
if(text !=null && !text.equals("") && !idMap.containsKey(text)) {
MessageBox.post(Dfl003AIFDialog.this,"项目信息无效,请重新选择!","提示",2);
}
}
@Override
public void focusGained(FocusEvent e) {
// TODO Auto-generated method stub
}
});
// jcomproject.addFocusListener(new FocusListener() {
//
// @Override
// public void focusLost(FocusEvent e) {
// // TODO Auto-generated method stub
//
// String text = jText.getText();
// if(text !=null && !text.equals("") && !idMap.containsKey(text)) {
// MessageBox.post("请检查项目下拉框","提示",2);
// }
//
// }
//
// @Override
// public void focusGained(FocusEvent e) {
// // TODO Auto-generated method stub
//
// }
// });
jtext1.setEnabled(false);
jtext2.setEnabled(true);
jcomname.setEnabled(false);
@ -289,7 +369,7 @@ public class Dfl003AIFDialog extends AbstractAIFDialog {
jl8.setBounds(20, 260, 40, 30);
jtext8.setBounds(60, 260, 200, 100);
jl9.setBounds(20, 370, 40, 30);
jcomproject.setBounds(60, 370, 120, 30);
jcomproject.setBounds(60, 370, 300, 30);
jl10.setBounds(20, 410, 40, 30);
jtext10.setBounds(60, 410, 120, 30);
@ -396,14 +476,9 @@ public class Dfl003AIFDialog extends AbstractAIFDialog {
String disval = value.getDisplayableValue(sourcevalues[i]);
sourceCode_combobox.addItem(disval);
sourceMap.put(disval, sourcevalues[i]);
}
}
//
@ -454,7 +529,15 @@ public class Dfl003AIFDialog extends AbstractAIFDialog {
if ( !(" ".equals(itemName)) && !( " ".equals(groupCode)) && !(" ".equals(souceCode))) {
String text = jText.getText();
System.out.println("text===>"+text);
if(text !=null && !text.equals("") && !idMap.containsKey(text)) {
MessageBox.post(Dfl003AIFDialog.this,"项目信息无效,请重新选择!","提示",2);
}else {
createItem();
}
} else {
MessageBox.post("名称、来源码、分群码不能为空!", "提示", MessageBox.INFORMATION);
}
@ -492,18 +575,35 @@ public class Dfl003AIFDialog extends AbstractAIFDialog {
TCComponentItemType tctype = (TCComponentItemType) session
.getTypeComponent(type);
try {
String newID = data.getNewCode("PLMCODE", selCodeBean);
String newID = data.getNewCode("PLMCODE", selCodeBean,session);
System.out.println("newID1==============="+newID);
// if(true) {
// return;
// }
TCComponentItem find = tctype.find(newID);
if (find != null) {
newID = data.getMaxCode("PLMCODE", selCodeBean);
System.out.println("newID2==============="+newID);
// if (find != null) {
// newID = data.getMaxCode("PLMCODE", selCodeBean);
// System.out.println("newID2==============="+newID);
// find = tctype.find(newID);
// }
// do{
// newID = data.getNewCode("PLMCODE", selCodeBean);
// find = tctype.find(newID);
// }while(find != null);
// if (find != null) {
// MessageBox.post("当前流水ID:" + newID + "已存在对象,无法创建!", "错误",
// MessageBox.ERROR);
// return;
// }
while (find!=null) {
newID = data.getNewCode("PLMCODE", selCodeBean,session);
find = tctype.find(newID);
}
if (find != null) {
MessageBox.post("当前流水ID:" + newID + "已存在对象,无法创建!", "错误",
MessageBox.ERROR);
} else {
// else {
this.setVisible(false);
String itemName="";
if (islov) {
@ -616,10 +716,11 @@ public class Dfl003AIFDialog extends AbstractAIFDialog {
MessageBox.INFORMATION);
}
}
String proID = (String) jcomproject.getSelectedItem();
if(proID != null & proID !=" ") {
String proName = (String) jcomproject.getSelectedItem();
if(proName != null & proName !=" ") {
// int selectedIndex = jcomproject.getSelectedIndex();
String[] keys = new String[]{"项目 ID"};
String[] values = new String[]{proID};
String[] values = new String[]{idMap.get(proName)};
List<TCComponent> compList = queryObject("基于项目ID查找项目", keys, values);
if(compList != null && compList.size() > 0) {
TCComponent comp = compList.get(0);
@ -714,7 +815,7 @@ public class Dfl003AIFDialog extends AbstractAIFDialog {
}
// }
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
@ -832,6 +933,37 @@ public class Dfl003AIFDialog extends AbstractAIFDialog {
}
}
protected void addSelect(KeyEvent e, JComboBox<String> combox, JTextField jtext, List<String> cpxList) {
// TODO Auto-generated method stub
Object obj = e.getSource();
int keyCode = e.getKeyCode();
if (obj == jtext) {
if(keyCode==10) {
String key = jtext.getText();
combox.removeAllItems();
if(!key.equals("")) {
combox.addItem("");
for(String name:cpxList) {
if(name.contains(key)) {
combox.addItem(name);
}
}
}else {
combox.addItem("");
for(String name:cpxList) {
// if(name.contains(key)) {
combox.addItem(name);
// }
}
}
combox.showPopup();
jtext.setText("");
jtext.setText(key);
}
}
}
/**
*
* @param queryName

@ -17,6 +17,11 @@ public class Dfl003Action extends AbstractAIFAction {
this.app = arg0;
this.tar = app.getTargetComponent();
this.session = (TCSession) app.getSession();
// String ssoLoginURL = session.getSSOLoginURL();
// System.out.println("ssoLoginURL==>"+ssoLoginURL);
// String ip = session.getLoginInfo().getPreviousSessionLoginIP();
// System.out.println("ip==>"+ip);
// System.out.println("Url==>"+session.getUrl());
this.name = name;
}

@ -270,9 +270,9 @@ public class QuickChangeDialog extends AbstractAIFDialog {
String dutyMan = comp.getStringProperty("t2_duty");
String salseType = comp.getStringProperty("t2_type");
String projectState = comp.getStringProperty("t2_ProjectPhase");
String item_id = comp.getStringProperty("item_id");
System.out.println("1.4dutyDepartment====="+dutyDepartment);
System.out.println("1.4item_id====="+item_id);
String targetType = comp.getType();
if( "T2_problemRevision".equals(targetType) ) {
@ -394,7 +394,6 @@ public class QuickChangeDialog extends AbstractAIFDialog {
project.assignToProject(new TCComponent[] {item});
}
}

@ -3,10 +3,12 @@ package com.connor.dfl.plm.dfl019;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.common.NotDefinedException;
import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
import com.teamcenter.rac.aifrcp.AIFUtility;
import com.teamcenter.rac.kernel.TCComponentGroup;
import com.teamcenter.rac.kernel.TCSession;
@ -17,8 +19,39 @@ public class Dfl019Handler extends AbstractHandler {
public Object execute(ExecutionEvent arg0) throws ExecutionException {
this.app = AIFUtility.getCurrentApplication();
this.session = (TCSession) app.getSession();
try {
InterfaceAIFComponent targetComponent = app.getTargetComponent();
if(targetComponent.getType().equals("T2_OutBuyPartRevision")) {
Dfl019Operation operation = new Dfl019Operation(app, session);
session.queueOperation(operation);
}else {
SelectDialog dialog = new SelectDialog(app);
new Thread(dialog).start();
}
// TCComponentGroup group = session.getCurrentGroup();
// String group_name = group.getStringProperty("display_name");
// if(group_name.contains("包装技术")|| group_name.contains("JCBZ")) {
// }else{
// Dfl019Operation2 operation = new Dfl019Operation2(app, session);
// //session.queueOperation(operation);
// }
// String name = arg0.getCommand().getName();
// if("物料传递ERP-拼接版本".equals(name)) {
// Dfl019Operation2 operation = new Dfl019Operation2(app, session);
// session.queueOperation(operation);
// }else if("物料传递ERP-拼接版本-包含虚拟件".equals(name)){
// Dfl019Operation3 operation = new Dfl019Operation3(app, session);
// session.queueOperation(operation);
// }else {
// Dfl019Operation operation = new Dfl019Operation(app, session);
// session.queueOperation(operation);
// }
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// session.queueOperation(operation);
// WuLiaoERP wl = new WuLiaoERP(app);
// new Thread(wl).start();
return null;

@ -1,5 +1,12 @@
package com.connor.dfl.plm.dfl019;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Font;
import java.awt.GraphicsEnvironment;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
@ -19,6 +26,13 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import com.connor.dfl.plm.util.AutoSign;
import com.connor.dfl.plm.util.ClassValueBean;
import com.connor.dfl.plm.util.ClassValueUtil;
@ -30,6 +44,7 @@ import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
import com.teamcenter.rac.kernel.TCClassificationService;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentBOMLine;
import com.teamcenter.rac.kernel.TCComponentGroup;
import com.teamcenter.rac.kernel.TCComponentICO;
import com.teamcenter.rac.kernel.TCComponentItemRevision;
import com.teamcenter.rac.kernel.TCComponentListOfValues;
@ -43,6 +58,7 @@ import com.teamcenter.rac.kernel.ics.ICSAdminClass;
import com.teamcenter.rac.kernel.ics.ICSAdminClassAttribute;
import com.teamcenter.rac.kernel.ics.ICSProperty;
import com.teamcenter.rac.util.MessageBox;
import com.teamcenter.soaictstubs.booleanSeq_tHolder;
import oracle.sql.BLOB;
@ -68,6 +84,12 @@ public class Dfl019Operation extends AbstractAIFOperation{
private AutoSign as = null;
private ProgressBarThread wait;
private JLabel exportTypeLabel;
private JComboBox<String> exportTypeBox;
private DefaultComboBoxModel<String> exportTypeModel;
private Map<String, String> account_set;
private JFrame frame=null;
private boolean flag = false;
public Dfl019Operation(AbstractAIFApplication app, TCSession session ,String accountSet,String zhangtao) {
this.app = app;
this.session = session;
@ -80,7 +102,7 @@ public class Dfl019Operation extends AbstractAIFOperation{
this.session = session;
this.as=new AutoSign();
String[] stringArrays = session.getPreferenceService().getStringValues("DFL_zhangtao");
Map<String, String> account_set = new HashMap<String, String>();
account_set = new HashMap<String, String>();
if (stringArrays == null || stringArrays.length <= 0 ) {
MessageBox.post("首选项DFL_zhangtao未配置,请联系管理员!!",
"错误", MessageBox.ERROR);
@ -95,10 +117,101 @@ public class Dfl019Operation extends AbstractAIFOperation{
}
}
String[] BOMZT = session.getPreferenceService().getStringValues("DFL_ERPBom_zhangtao");
if (BOMZT == null || BOMZT.length <= 0 ) {
MessageBox.post("首选项DFL_ERPBom_zhangtao未配置,请联系管理员!!",
"错误", MessageBox.ERROR);
return;
}
String temp = null;
try {
TCComponentGroup group = session.getCurrentGroup();
String group_name = group.getStringProperty("display_name");
System.out.println("group_name=============="+group_name);
if(group_name.contains(".")) {
String[] names = group_name.split("\\.");
if(names != null && names.length >=2) {
for (int i = 0; i < BOMZT.length; i++) {
if(BOMZT[i].contains("=")) {
String[] zts = BOMZT[i].split("=");
System.out.println("names[names.length-2]=============="+names[names.length-2]);
System.out.println("zts[0]=============="+zts[0]);
if(names[names.length-2].equals(zts[0])) {
if(names[names.length-2].contains("医用包材")) {
frame = new JFrame();
frame.setTitle("请选择传递的账套");
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
Rectangle rect = ge.getMaximumWindowBounds();
int sw = rect.width;
int sh = rect.height;
frame.setBounds((sw - 350) / 2, (sh - 300) / 2, 350, 300); // 设置位置即大小
JPanel myJPanel = new JPanel();
myJPanel.setLayout(null);
JButton okbutton;
exportTypeLabel = new JLabel("导出类型");
exportTypeLabel.setFont(new Font("微软雅黑", Font.BOLD, 20));
exportTypeLabel.setSize(100, 30);
exportTypeModel = new DefaultComboBoxModel<String>();
exportTypeBox = new JComboBox<String>(exportTypeModel);
exportTypeBox.setBounds(200, 190, 170, 30);
exportTypeBox.setFont(new Font("微软雅黑", Font.BOLD, 20));
exportTypeModel.addElement("上海包材");
exportTypeModel.addElement("上河南包材");
exportTypeLabel.setBounds(30, 50, 100, 30);
exportTypeBox.setBounds(150, 50, 150, 30);
okbutton = new JButton("确定");
okbutton.setFont(new Font("微软雅黑", Font.BOLD, 20));
okbutton.setBounds(100, 180, 120, 30);
okbutton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
final String element = exportTypeModel.getElementAt(exportTypeBox.getSelectedIndex());
System.out.println(element);
if ("上海包材".equals(element)) {
zhangtao = "DYC";
accountSet = account_set.get(zhangtao);
}else {
zhangtao = "HNC";
accountSet = account_set.get(zhangtao);
}
frame.setVisible(false);
startWork();
return;
}
});
myJPanel.add(exportTypeLabel);
myJPanel.add(exportTypeBox);
myJPanel.add(okbutton);
Container contentPane = frame.getContentPane();
contentPane.add(myJPanel, BorderLayout.CENTER);
frame.setVisible(true);
break;
}
this.zhangtao = "DFL";
this.accountSet = account_set.get(zhangtao);
startWork();
}
}
}
}
}
} catch (TCException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally {
}
}
private void startWork() {
// TODO Auto-generated method stub
session.queueOperation(this);
}
@Override
public void executeOperation() throws Exception {
InterfaceAIFComponent[] comp = app.getTargetComponents();
@ -135,16 +248,16 @@ public class Dfl019Operation extends AbstractAIFOperation{
if(targets.length>0) {
// MessageBox.post("您选中的版本对象没有在流程中","提示",MessageBox.INFORMATION);
// return;
for(int i = 0;i<targets.length;i++) {
String ss =targets[i].getStringProperty("current_name");
System.out.println("ss======"+ss);
if("传递ERP".equals(ss)) {
uid = targets[i].getUid();
}else {
MessageBox.post("您当前所在的流程不能执行传递ERP","提示",MessageBox.INFORMATION);
return;
}
}
// for(int i = 0;i<targets.length;i++) {
// String ss =targets[i].getStringProperty("current_name");
// System.out.println("ss======"+ss);
// if("传递ERP".equals(ss)) {
// uid = targets[i].getUid();
// }else {
// MessageBox.post("您当前所在的流程不能执行传递ERP","提示",MessageBox.INFORMATION);
// return;
// }
// }
}
// String uid = targets[0].getUid();
@ -306,6 +419,7 @@ public class Dfl019Operation extends AbstractAIFOperation{
}
return beanList;
}
public boolean setvalues(List<ItemBean> beanList, TCComponent comp, List<String> errList) throws TCException {
// TODO Auto-generated method stub
boolean flag2 = false;
@ -324,6 +438,7 @@ public class Dfl019Operation extends AbstractAIFOperation{
TCComponentBOMLine get_bom_line = (TCComponentBOMLine) comp;
rev = get_bom_line.getItemRevision();
}
rev.refresh();
String statu = rev.getStringProperty("t2_ERPStatus");
// if("已传".equals(statu)) {
// return flag2;
@ -331,28 +446,33 @@ public class Dfl019Operation extends AbstractAIFOperation{
try {
String type = rev.getStringProperty("object_type");
id = rev.getStringProperty("item_id");
if(id.contains("-Y")) {
id = id.replace("-Y", "");
String idlast =id.substring(id.length()-2, id.length());
System.out.println("4.2:"+id);
System.out.println("id的后两位"+idlast);
if(idlast.contains("-Y")) {
System.out.println("物料带-Y不传递");
return false;
//id = id.replace("-Y", "");
//判断这个版本是否为虚拟件版本
if("T2_VirtualRevision".equals(type)){
String[] keys = new String[]{"零组件 ID"};
String[] values = new String[]{id};
//查询零组件版本的item_id为id的
List<TCComponent> compList = queryObject("零组件版本...", keys, values);
//判断是否为不为空的
if(compList!=null) {
for(int i = 0; i < compList.size(); i++){
TCComponentItemRevision rev1 = null;
rev1 = (TCComponentItemRevision) compList.get(i);
String type1 = rev1.getStringProperty("object_type");
System.out.println("9.10===type==="+type1);
//如果查询出来的版本为设备版本则不传递erp
if("T2_EquipmentRevision".equals(type1)) {
return true;
}
}
}
}
// if("T2_VirtualRevision".equals(type)){
// String[] keys = new String[]{"零组件 ID"};
// String[] values = new String[]{id};
// //查询零组件版本的item_id为id的
// List<TCComponent> compList = queryObject("零组件版本...", keys, values);
// //判断是否为不为空的
// if(compList!=null) {
// for(int i = 0; i < compList.size(); i++){
// TCComponentItemRevision rev1 = null;
// rev1 = (TCComponentItemRevision) compList.get(i);
// String type1 = rev1.getStringProperty("object_type");
// System.out.println("9.10===type==="+type1);
// //如果查询出来的版本为设备版本则不传递erp
// if("T2_EquipmentRevision".equals(type1)) {
// return true;
// }
// }
// }
// }
}
String groupCode = rev.getStringProperty("t2_groupCode");
System.out.println("t2_groupCode============"+groupCode);
@ -361,8 +481,15 @@ public class Dfl019Operation extends AbstractAIFOperation{
if("T2_outsourceRevision".equals(type) || "T2_OutBuyPartRevision".equals(type)
||"T2_VirtualRevision".equals(type) ||"T2_EquipmentRevision".equals(type)
||"T2_SystemSchemeRevision".equals(type)) {
//判断是否有状态
// if("T2_VirtualRevision".equals(type)) {
// return false;
// }
//判断是否有状态
if("T2_outsourceRevision".equals(type)||"T2_OutBuyPartRevision".equals(type)
// ||"T2_VirtualRevision".equals(type)
) {
TCProperty tcProperty = rev.getTCProperty("release_status_list");
TCComponent[] targets = tcProperty.getReferenceValueArray();
@ -370,11 +497,18 @@ public class Dfl019Operation extends AbstractAIFOperation{
String sourceCode1 = rev.getStringProperty("t2_sourceCode");
// String status = rev.getStringProperty("release_status_list");
// System.out.println("发布状态:"+status);
if(targets==null || targets.length<=0) {
MessageBox.post(rev.getStringProperty("item_id")+"该物料没有发布状态!!",
"提示", MessageBox.WARNING);
return true;
}
// if(status.equals("")||status.equals(" ")) {
// MessageBox.post(rev.getStringProperty("item_id")+"该物料没有发布状态!!",
// "提示", MessageBox.WARNING);
// return true;
// }
if("T2_outsourceRevision".equals(type)||"T2_OutBuyPartRevision".equals(type)
) {
if(groupcode1.equals("")){
@ -398,7 +532,8 @@ public class Dfl019Operation extends AbstractAIFOperation{
boolean flag = false;
if("T2_outsourceRevision".equals(type)) {
StringBuilder sb = new StringBuilder(id);
sb.append(rev.getStringProperty("item_revision_id"));
//2022/8/23 修改取消拼接版本
//sb.append(rev.getStringProperty("item_revision_id"));
id = sb.toString();
String classID = id.substring(0, 2);
System.out.println("classID==============="+classID);
@ -799,9 +934,10 @@ public class Dfl019Operation extends AbstractAIFOperation{
protected void createXMLFile(List<ItemBean> beanList ,String zhangtao) throws TCException, IOException {
String weiyi_id = "";
Date date = new Date();
SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmm");
SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
StringBuilder uidSB = new StringBuilder();
String fileName = session.getUser().getUserName()+ "-" +df.format(date);
String fileName = "WL-"+ beanList.get(0).getItem_id() + "-" +df.format(date);
String uid_fileName ="WL-UID-"+ beanList.get(0).getItem_id() +"-"+df.format(date);
// String s1 = "<?xml version=\"1.0\"?><Request><Access><Authentication user=\"tiptop\" password=\"tiptop\" /><Connection source=\"192.168.1.8\" application=\"PLM\"/>";
// String s2 ="<Organization name=\""+AccountSet+"\"/><Locale language=\"zh_cn\"/></Access><RequestContent><Parameter><Record>";
@ -810,13 +946,13 @@ public class Dfl019Operation extends AbstractAIFOperation{
String sss1 = "<Request><Access><Authentication user=\"tiptop\" password=\"tiptop\"/><Connection application=\"NEWPLM\" source=\"192.168.1.137\"/><Organization name=\""+zhangtao+"\"/>";
String sss1 = "<Request><Access><Authentication user=\"tiptop\" password=\"tiptop\"/><Connection application=\"NEWPLM\" source=\"192.168.1.153\"/><Organization name=\""+zhangtao+"\"/>";
String sss2 ="<Locale language=\"zh_cn\"/></Access><RequestContent><Parameter><Record><Field name=\"status\" value=\"Y\"/><Field name=\"ws_name\" value=\"CreateItemMasterData\"/><Field name=\"datakey\" value=\"";
String sss3= "\"/><Field name=\"tot_cnt\" value=\"\"/><Field name=\"sub_cnt\" value=\"1\"/></Record></Parameter><Document>";
tops = sss1 + sss2;
String bottom ="</Document></RequestContent></Request>";
int j = 1;
int o = 1;
StringBuilder sss3SB = new StringBuilder();
StringBuilder xmlSB = new StringBuilder();
for (int i = 0; i < beanList.size(); i++) {
@ -828,53 +964,12 @@ public class Dfl019Operation extends AbstractAIFOperation{
String n = n1 + n2 + n3;
xmlSB.append(n);
j++;
if(i > 0 && i%60 == 0) {
sss3SB.append(fileName);
sss3SB.append("-"+o++);
sss3SB.append(sss3);
sss3SB.append(xmlSB.toString());
String zong= tops + sss3SB.toString()+bottom;
System.out.println(zong);
String tempPath = System.getProperty("java.io.tmpdir");
System.out.println("10.20temp路径======="+tempPath);
//String path = "D:\\SENDTOERPLOG\\" + fileName + ".txt";
String path = tempPath + fileName + ".txt";
File file = new File(path);
if (!file.exists()) {
//file.getParentFile().mkdirs();
file.createNewFile();
}
try {
FileOutputStream fos = new FileOutputStream(file);
fos.write(zong.getBytes());
fos.flush();
fos.close();
weiyi_id = getId();
System.out.println("=======================唯一识别码" +weiyi_id);
as.insertNewTxtFile(fileName,file,weiyi_id,session.getUser().getUid(), url, user, password ,"CreateItemMasterDataRequest",beanList.get(0).getItem_id(),zhangtao,session.getUser().getUserId(),uidSB.toString());
file.delete();
weiyi_id = "";
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
j = 1;
uidSB = new StringBuilder();
xmlSB = new StringBuilder();
sss3SB = new StringBuilder();
continue;
}
if(i < beanList.size()-1) {
uidSB.append(";");
}
}
if(!("".equals(uidSB.toString()))) {
sss3SB.append(fileName);
sss3SB.append("-"+o++);
sss3SB.append(sss3);
sss3SB.append(xmlSB.toString());
String zong= tops + sss3SB.toString()+bottom;
@ -883,11 +978,26 @@ public class Dfl019Operation extends AbstractAIFOperation{
System.out.println("10.20temp路径======="+tempPath);
//String path = "D:\\SENDTOERPLOG\\" + fileName + ".txt";
String path = tempPath + fileName + ".txt";
String path1 = tempPath + uid_fileName + ".txt";
File file = new File(path);
if (!file.exists()) {
//file.getParentFile().mkdirs();
file.createNewFile();
}
File file1 = new File(path1);
if (!file1.exists()) {
//file.getParentFile().mkdirs();
file1.createNewFile();
}
try {
FileOutputStream fos2 = new FileOutputStream(file1);
fos2.write(uidSB.toString().getBytes());
fos2.flush();
fos2.close();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
FileOutputStream fos = new FileOutputStream(file);
fos.write(zong.getBytes());
@ -898,8 +1008,7 @@ public class Dfl019Operation extends AbstractAIFOperation{
System.out.println("=======================唯一识别码" +weiyi_id);
as.insertNewTxtFile(fileName,file,weiyi_id,session.getUser().getUid(), url, user, password ,"CreateItemMasterDataRequest",beanList.get(0).getItem_id(),zhangtao,session.getUser().getUserId(),uidSB.toString());
file.delete();
as.insertNewTxtFile(path,fileName,weiyi_id,session.getUser().getUid(), url, user, password ,"CreateItemMasterDataRequest",beanList.get(0).getItem_id(),zhangtao,session.getUser().getUserId(),path1,uid_fileName,session);
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();

@ -1,13 +1,18 @@
package com.connor.dfl.plm.dfl020;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aif.AbstractAIFDialog;
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
import com.teamcenter.rac.aifrcp.AIFUtility;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentGroup;
import com.teamcenter.rac.kernel.TCComponentItemRevision;
import com.teamcenter.rac.kernel.TCSession;
public class Dfl020Handler extends AbstractHandler{
@ -16,8 +21,81 @@ public class Dfl020Handler extends AbstractHandler{
AbstractAIFApplication app = AIFUtility.getCurrentApplication();
InterfaceAIFComponent targetComp =app.getTargetComponent();
TCSession session = (TCSession) app.getSession();
try {
TCComponentGroup group = session.getCurrentGroup();
String group_name = group.getStringProperty("display_name");
// if(group_name.contains("包装技术")|| group_name.contains("JCBZ")) {
// if(targetComp instanceof TCComponentItemRevision) {
// TCComponentItemRevision comp = (TCComponentItemRevision) targetComp;
// String type = comp.getType();
// if("T2_EquipmentRevision".equals(type) || "T2_Equipment".equals(type)) {
// Date createDate = comp.getItem().getDateProperty("creation_date");
// SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd" );
// Date d = sdf.parse("2022-11-01");
// if(createDate.after(d)) {
// Dfl020Operation operation = new Dfl020Operation(app, session);
// session.queueOperation(operation);
// }else {
// Dfl020Operation3 operation = new Dfl020Operation3(app, session);
// session.queueOperation(operation);
// }
// }else {
// SelectDialog dialog = new SelectDialog(app);
// new Thread(dialog).start();
// }
// }else {
// SelectDialog dialog = new SelectDialog(app);
// new Thread(dialog).start();
// }
// }else{
// Dfl020Operation2 operation = new Dfl020Operation2(app, session);
// session.queueOperation(operation);
// }
if(targetComp instanceof TCComponentItemRevision) {
TCComponentItemRevision comp = (TCComponentItemRevision) targetComp;
String type = comp.getType();
if("T2_EquipmentRevision".equals(type) || "T2_Equipment".equals(type)) {
Date createDate = comp.getItem().getDateProperty("creation_date");
SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd" );
Date d = null;
if(group_name.contains("包装技术")|| group_name.contains("JCBZ")) {
d = sdf.parse("2022-11-01");
}else {
d = sdf.parse("2023-03-10");
}
if(createDate.after(d)) {
Dfl020Operation operation = new Dfl020Operation(app, session);
session.queueOperation(operation);
}else {
Dfl020Operation3 operation = new Dfl020Operation3(app, session);
session.queueOperation(operation);
}
}else {
SelectDialog dialog = new SelectDialog(app);
new Thread(dialog).start();
}
}else {
SelectDialog dialog = new SelectDialog(app);
new Thread(dialog).start();
}
// String name = arg0.getCommand().getName();
// if("BOM传递ERP-拼接版本".equals(name)) {
// Dfl020Operation2 operation = new Dfl020Operation2(app, session);
// session.queueOperation(operation);
// }else if("BOM传递ERP-拼接版本-包含虚拟件".equals(name)){
// Dfl020Operation3 operation = new Dfl020Operation3(app, session);
// }else {
// Dfl020Operation operation = new Dfl020Operation(app, session);
// session.queueOperation(operation);
// }
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// BOMERP createProblemSpotDialog = new BOMERP(app , targetComp);
// new Thread(createProblemSpotDialog).start();
return null;

@ -14,7 +14,7 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.jacorb.idl.runtime.int_token;
//import org.jacorb.idl.runtime.int_token;
import com.connor.dfl.plm.util.AutoSign;
import com.teamcenter.rac.aif.AbstractAIFApplication;
@ -69,13 +69,13 @@ public class Dfl020Operation extends AbstractAIFOperation{
private String tops;
private String ns ;
private String weiyi_id;
//private String weiyi_id;
String accountSet;
private String zhangtao;
private AutoSign as = null;
private List<FatherBomLineBean> list = new ArrayList<FatherBomLineBean>();
String zong;
private boolean isEquipment = false;
String z_peizhi = "";
@ -122,10 +122,13 @@ public class Dfl020Operation extends AbstractAIFOperation{
System.out.println("group_name=============="+group_name);
if(group_name.contains(".")) {
String[] names = group_name.split("\\.");
System.out.println("names=============="+names.length);
if(names != null && names.length >=2) {
for (int i = 0; i < BOMZT.length; i++) {
System.out.println("BOMZT[i]====="+BOMZT[i]);
if(BOMZT[i].contains("=")) {
String[] zts = BOMZT[i].split("=");
System.out.println("names[names.length-2]====="+names[names.length-2]);
if(names[names.length-2].equals(zts[0])) {
this.zhangtao = zts[1];
this.accountSet = account_set.get(zhangtao);
@ -189,14 +192,16 @@ public class Dfl020Operation extends AbstractAIFOperation{
TCComponent[] targets1 = tcProperty1.getReferenceValueArray();
String item_type = rev.getType();
if("T2_EquipmentRevision".equals(item_type)) {
isEquipment = true;
}
//限制没有发布状态的设备虚拟件版本发起bom传递erp命令
// if("T2_VirtualRevision".equals(item_type)||"T2_EquipmentRevision".equals(item_type)) {
// if(targets1 == null || targets1.length <= 0) {
// MessageBox.post("您选中的版本对象没有发布状态","提示",MessageBox.INFORMATION);
// return;
// }
// }
if("T2_VirtualRevision".equals(item_type) || "T2_EquipmentRevision".equals(item_type)) {
if(targets1 == null || targets1.length <= 0) {
MessageBox.post("您选中的版本对象没有发布状态","提示",MessageBox.INFORMATION);
return;
}
}
//限制外购件版本发起bom传递erp命令
if("T2_OutBuyPartRevision".equals(item_type)) {
MessageBox.post("您选中的版本对象是外购件版本不能进行bom传递erp","提示",MessageBox.INFORMATION);
@ -267,15 +272,10 @@ public class Dfl020Operation extends AbstractAIFOperation{
}
view.close();
if(!("".equals(uid))&& !(" ".equals(uid))) {
as.AutoSignServer(uid,session);
}
MessageBox.post("BOM数据存储成功准备传递ERP",
"提示", MessageBox.WARNING);
} catch (Exception e) {
// TODO Auto-generated catch block
MessageBox.post("BOM数据存储失败请检查后重新传递",
@ -287,13 +287,10 @@ public class Dfl020Operation extends AbstractAIFOperation{
//生产xml文件
protected void createXMLFile(TCComponentBOMLine line ,String zhangtao) throws TCException, IOException {
String weiyi_id = "";
// List<FatherBomLineBean> list = new ArrayList<FatherBomLineBean>();
StringBuilder uidSB = new StringBuilder();
try {
getBOMValue(line,list);
getBOMValue(line,list,1);
if(list.size() <=0) {
MessageBox.post("BOM 传递失败请检查BOM行是否正确", "提示",
MessageBox.INFORMATION);
@ -302,16 +299,25 @@ public class Dfl020Operation extends AbstractAIFOperation{
} catch (Exception e) {
// TODO: handle exception
MessageBox.post("BOM 传递失败请检查BOM行是否正确!" ,"提示",MessageBox.INFORMATION);
e.printStackTrace();
return;
}
//获取父 属性
String userName = session.getUser().getUserName();
List<String> toFus = new ArrayList<String>();
for(int f_index = 0;f_index< list.size();f_index++) {
String fuUID = list.get(f_index).getItem_uid();
if(!toFus.contains(fuUID)) {
toFus.add(fuUID);
}else {
continue;
}
StringBuilder sb2 = new StringBuilder();
StringBuilder uidSB = new StringBuilder();
Date date = new Date();
SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmm");
SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
String plmls = df.format(date);
String userName = session.getUser().getUserName();
String s1 ="<Request><Access><Authentication user=\"tiptop\" password=\"tiptop\"/><Connection application=\"NEWPLM\" source=\"192.168.1.137\"/>";
String s1 ="<Request><Access><Authentication user=\"tiptop\" password=\"tiptop\"/><Connection application=\"NEWPLM\" source=\"192.168.1.153\"/>";
String s3 = "<Organization name=\""+zhangtao+"\"/><Locale language=\"zh_cn\"/></Access><RequestContent><Parameter><Record><Field name=\"status\" value=\"Y\"/>";
String s4 = "<Field name=\"bmx10\" value=\""+userName+"\"/><Field name=\"smyslip\" value=\"4101\"/><Field name=\"ws_name\" value=\"CreatePLMBOMData\"/>";
String s5 = "<Field name=\"datakey\" value=\""+plmls+"\"/><Field name=\"tot_cnt\" value=\"1\"/><Field name=\"sub_cnt\" value=\"1\"/>";
@ -322,16 +328,18 @@ public class Dfl020Operation extends AbstractAIFOperation{
sb2.append(s4);
sb2.append(s5);
sb2.append(s6);
for(int f_index = 0;f_index< list.size();f_index++) {
uidSB.append(list.get(f_index).getItem_uid());
if(f_index< list.size()-1) {
uidSB.append(";");
}
int iii = f_index+1;
System.out.println("==== 第"+ iii+"个配置");
// int iii = f_index+1;
// System.out.println("==== 第"+ iii+"个配置");
System.out.println("******品号"+list.get(f_index).getPinhao()+"*****");
String peizhi1 ="<RecordSet id=\""+iii+"\">";
String peizhi1 ="<RecordSet id=\""+1+"\">";
// String peizhi1 ="<RecordSet id=\""+iii+"\">";
//String peizhi2 = "第"+iii +"个配置 ";
String peizhi3 = "<Master name=\"bma_file\"><Record><Field name=\"acttype\" value=\"\"/><Field name=\"bma01\" ";
String peizhi4 = "value=\""+list.get(f_index).getPinhao()+"\"/></Record></Master><Detail name=\"bmb_file\">";
@ -410,7 +418,6 @@ public class Dfl020Operation extends AbstractAIFOperation{
}
sb2.append("</Detail></RecordSet>");
}
String bottomS ="</Document></RequestContent></Request>";
@ -418,17 +425,23 @@ public class Dfl020Operation extends AbstractAIFOperation{
outPutInfo = sb2.toString();
System.out.println("================"+outPutInfo);
String fileName ="BOM"+ plmls;
String fileName ="BOM-"+ list.get(f_index).getPinhao()+"-"+plmls;
String tempPath = System.getProperty("java.io.tmpdir");
String uid_fileName ="BOM-UID-"+list.get(f_index).getPinhao()+"-"+ plmls;
System.out.println("10.20temp路径======="+tempPath);
//String path = "D:\\SENDTOERPLOG\\" + fileName + ".txt";
String path = tempPath + fileName + ".txt";
String path1 = tempPath + uid_fileName + ".txt";
File file = new File(path);
File file1 = new File(path1);
if (!file.exists()) {
//file.getParentFile().mkdirs();
file.createNewFile();
}
if (!file1.exists()) {
//file.getParentFile().mkdirs();
file1.createNewFile();
}
try {
FileOutputStream fos = new FileOutputStream(file);
fos.write(outPutInfo.getBytes());
@ -454,17 +467,24 @@ public class Dfl020Operation extends AbstractAIFOperation{
System.out.println("=======================唯一识别码" +weiyi_id);
//if(f_index > 0 && f_index%60 == 0) {
String uidString = uidSB.toString();
try {
FileOutputStream fos2 = new FileOutputStream(file1);
fos2.write(uidString.getBytes());
fos2.flush();
fos2.close();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
as.insertNewTxtFile(path,fileName, weiyi_id,session.getUser().getUid() , url, user, password,"CreatePLMBOMDataRequest",list.get(f_index).getPinhao(),zhangtao,session.getUser().getUserId(),path1,uid_fileName,session);
as.insertNewTxtFile(fileName,file, weiyi_id,session.getUser().getUid() , url, user, password,"CreatePLMBOMDataRequest",list.get(0).getPinhao(),zhangtao,session.getUser().getUserId(),uidSB.toString());
// as.insertNewTxtFile(fileName,file,weiyi_id,session.getUser().getUid(), url, user, password ,"CreateItemMasterData");
file.delete();
}
}
private void getBOMValue(TCComponentBOMLine line, List<FatherBomLineBean> list)
private void getBOMValue(TCComponentBOMLine line, List<FatherBomLineBean> list,int pQty)
{
FatherBomLineBean fatherBean = new FatherBomLineBean();
try
@ -478,12 +498,16 @@ public class Dfl020Operation extends AbstractAIFOperation{
}
List<ChirldBomBean> z_list = new ArrayList<ChirldBomBean>();
String fuID = rev.getStringProperty("item_id");
fuID = fuID.replace("-Y", "");
String idlast =fuID.substring(fuID.length()-2, fuID.length());
if(idlast.endsWith("-Y")) {
fuID = fuID.substring(0,fuID.length()-2);
}
// fuID = fuID.replace("-Y", "");
String fuType = rev.getStringProperty("object_type");
if ("T2_outsourceRevision".equals(fuType))
{
String revId = rev.getStringProperty("item_revision_id");
fuID = fuID + revId;
//fuID = fuID + revId;
}
fatherBean.setPinhao(fuID);
fatherBean.setItem_uid(rev.getUid());
@ -495,6 +519,7 @@ public class Dfl020Operation extends AbstractAIFOperation{
if ((childComp instanceof TCComponentBOMLine))
{
TCComponentBOMLine childLine = (TCComponentBOMLine)childComp;
String occType = childLine.getStringProperty("TCAI_OCC_TYPE");
String num = childLine.getStringProperty( "T2_ActualConsumption");//实际用量
if(num==null||"".equals(num.trim())) {
num = childLine.getStringProperty( "T2_DesignQuantity");//设计用量
@ -507,7 +532,7 @@ public class Dfl020Operation extends AbstractAIFOperation{
}
System.out.println("num=============="+num);
//如果是数量为“已打包的注释”则解包
if(childLine.isPacked() && "已打包的注释".equals(num))
if(childLine.isPacked() || "已打包的注释".equals(num) || "已打包的注释".equals(occType))
{
childLine.unpack();
ispack = true;
@ -529,7 +554,7 @@ public class Dfl020Operation extends AbstractAIFOperation{
String occType = childLine.getStringProperty("TCAI_OCC_TYPE");
if (!"Reference".equals(occType))
{
getChildValue(childLine, z_list, childLineNum,idList);
getChildValue(childLine, z_list, childLineNum,idList,pQty);
childLineNum++;
}
}
@ -555,7 +580,26 @@ public class Dfl020Operation extends AbstractAIFOperation{
{
AIFComponentContext[] childrenAifs = z_line.getChildren();
if (childrenAifs.length > 0) {
getBOMValue(z_line, list);
String childType = z_line.getItemRevision().getType();
if(childType.equals("T2_VirtualRevision") && isEquipment) {
TCProperty tcProperty1 = z_line.getItemRevision().getTCProperty("release_status_list");
TCComponent[] targets1 = tcProperty1.getReferenceValueArray();
if(targets1==null || targets1.length<=0) {
continue;
}
}
String num = z_line.getStringProperty( "T2_ActualConsumption");//实际用量
if(num==null||"".equals(num.trim())) {
num = z_line.getStringProperty( "T2_DesignQuantity");//设计用量
if(num==null||"".equals(num.trim())) {
num = z_line.getStringProperty( "bl_quantity");//用量
if(num==null||"".equals(num.trim())) {
num = "1";
}
}
}
// z_line.getStringProperty("bl_")
getBOMValue(z_line, list,Integer.valueOf(num)*pQty);
}
}
}
@ -570,7 +614,7 @@ public class Dfl020Operation extends AbstractAIFOperation{
// TODO Auto-generated method stub
return null;
}
public void getChildValue(TCComponentBOMLine childLine, List<ChirldBomBean> z_list,int childLineNum,List<String> idList) {
public void getChildValue(TCComponentBOMLine childLine, List<ChirldBomBean> z_list,int childLineNum,List<String> idList,int pQty) {
try {
String occType = childLine.getStringProperty("TCAI_OCC_TYPE");
if("Reference".equals(occType)) {
@ -581,7 +625,8 @@ public class Dfl020Operation extends AbstractAIFOperation{
String childRevstring = childLine.getItemRevision().getStringProperty("item_revision_id");
if("T2_outsource".equals(childtypeString)) {
StringBuilder sb = new StringBuilder(childID);
sb.append(childRevstring);
//2022/8/23 取消拼接版本
//sb.append(childRevstring);
childID = sb.toString();
}
System.out.println("childID2============"+childID);
@ -595,6 +640,8 @@ public class Dfl020Operation extends AbstractAIFOperation{
}
}
}
// int num = Integer.valueOf(Quantity)*pQty;
// Quantity = String.valueOf(num);
System.out.println("Quantity=============="+Quantity);
if(idList.contains(childID)) {
int index = idList.indexOf(childID);
@ -613,6 +660,7 @@ public class Dfl020Operation extends AbstractAIFOperation{
d2 = 1;
}
double d3 = d1 + d2;
System.out.println("d3=============="+d3);
child.setYonglian(d3+"");
return;
}else {
@ -627,7 +675,15 @@ public class Dfl020Operation extends AbstractAIFOperation{
childBean.setYonglian(Quantity);
String childRev = childLine.getItemRevision().getStringProperty("item_revision_id");
String childType = childLine.getItem().getStringProperty("object_type");
// childID = childID.replace("-Y", "");
String idlast =childID.substring(childID.length()-2, childID.length());
System.out.println("id的后两位"+idlast);
// if(idlast.contains("-Y")) {
// return;
// }
if(childID.endsWith("-Y")) {
childID = childID.replace("-Y", "");
}
System.out.println("childID============"+childID);
System.out.println("childRev============"+childRev);
System.out.println("childType============"+childType);

@ -31,7 +31,7 @@ import javax.swing.JProgressBar;
import javax.swing.JTextField;
import javax.swing.filechooser.FileSystemView;
import org.jacorb.idl.runtime.int_token;
//import org.jacorb.idl.runtime.int_token;
import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aif.AbstractAIFDialog;
@ -102,11 +102,13 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
// 获取下载文件列表
private void getload(TCComponentDataset dataset, String path, List<String> list, String itemid) {
System.out.println("----------------------getload");
try {
TCComponentTcFile[] file = dataset.getTcFiles();
System.out.println("datasetNam="+dataset.getStringProperty("object_name"));
if (file == null || file.length == 0) {
if (itemid.equals("sjj")) {
System.out.println("itemid=sjj");
String noFileString = path + "_" + dataset.getStringProperty("object_name");
noFileList.add(noFileString);
} else {
@ -130,6 +132,15 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
}
// 获取后缀名
hzm = file[i].getTCProperty("file_ext").getStringValue();
String uid = file[i].getUid();
System.out.println("=======list========");
System.out.println("i="+i);
for(String s:list) {
System.out.println(s);
}
System.out.println("hzm="+hzm);
System.out.println("uid="+uid);
System.out.println("=======list========");
// 获取文件名(带后缀)
if (list.contains(hzm)) {
String name = file[i].getTCProperty("original_file_name").getStringValue();
@ -138,7 +149,8 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
if (context.getComponent() instanceof TCComponentItemRevision) {
TCComponentItemRevision revision = (TCComponentItemRevision) context.getComponent();
if ("T2_OutBuyPartRevision".equals(revision.getType())
|| "T2_outsourceRevision".equals(revision.getType()) || "T2_VirtualRevision".equals(revision.getType())) {
|| "T2_outsourceRevision".equals(revision.getType()) || "T2_VirtualRevision".equals(revision.getType())
|| "T2_EquipmentRevision".equals(revision.getType())) {
if(isCarryRev) {
name = revision.getStringProperty("item_id")
+ revision.getStringProperty("current_revision_id") + " "
@ -147,8 +159,8 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
}
} else {
name = revision.getStringProperty("item_id") + " "
+ revision.getStringProperty("object_name");
// name = revision.getStringProperty("item_id") + " "
// + revision.getStringProperty("object_name");
}
}
@ -158,12 +170,15 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
// 获取文件名(不带后缀)
name = name.substring(0, name.lastIndexOf("."));
}
System.out.println("name="+name);
String replace = name.replace("/", "-").replace("<", "-").replace(">", "-").replace(":", "-")
.replace("|", "-").replace("\\", "-").replace("*", "-").replace("?", "-");
System.out.println("replace="+replace);
// 获取文件用户下载
File fmsFile = file[i].getFmsFile();
hzmlist.add(hzm);
namelist.add(path + File.separator + replace);
System.out.println("namelist.add="+path + File.separator + replace);
fmsFilelist.add(fmsFile);
fileSize = fileSize + fmsFile.length();
}
@ -213,6 +228,8 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
for (int i = 0; i < hzmlist.size(); i++) {
// 拼接输出文件名
String filename = namelist.get(i) + "." + hzmlist.get(i);
System.out.println("fpath="+fpath);
System.out.println("namelist.get("+i+")="+namelist.get(i));
// 拼接输出带路径全文件名
String path = fpath + File.separator + filename;
System.out.println("path=8.3" + path);
@ -515,6 +532,7 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
}
try {
for (int i = 0; i < targets.length; i++) {
if (targets[i] instanceof TCComponentBOMLine) {
List<String> itemlist = new ArrayList<String>();
// 执行获取零件类型的方法
@ -539,6 +557,7 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
System.out.println("cs" + rev.toString() + list.get(0));
String dataName2 = "";
// 遍历视图 去找符合条件的 文件夹已经创建
System.out.println("getOutPart1,dataName="+dataName);
getOutPart(rev, dataName, list);
String dataDir3 = jtf.getText() + File.separator + rev.getStringProperty("item_id") + "_"
+ rev.getStringProperty("current_revision_id") + "_" + replace + File.separator
@ -570,6 +589,7 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
// 获取数据集数据
TCComponentDataset dataset02 = (TCComponentDataset) datasets[j];
// 执行getload方法
System.out.println("getload1");
getload(dataset02, dataName, list, rev.getStringProperty("item_id"));
getload(dataset02, dataName2, list, rev.getStringProperty("item_id"));
}
@ -590,6 +610,7 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
if (itemlist.contains(revtype) || allCheck) {
if (datasetList.contains(type)) {
TCComponentDataset dataset = (TCComponentDataset) datasets2[j];
System.out.println("getload2");
getload(dataset, dataName, list, rev.getStringProperty("item_id"));
getload(dataset, dataName2, list, rev.getStringProperty("item_id"));
}
@ -600,6 +621,8 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
// 执行获取零件类型的方法
itemlist = getitemType();
TCComponentItemRevision rev = (TCComponentItemRevision) targets[i];
String revType = rev.getStringProperty("object_type");
System.out.println("Ñ¡ÔñµÄÄ¿±ê¶ÔÏóÀàÐÍÊÇ:"+revType);
String revtype = rev.getType();
String objName = rev.getStringProperty("object_name");
String replace = objName.replace("/", "-").replace("<", "-").replace(">", "-").replace(":", "-")
@ -617,6 +640,7 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
csFile.mkdir();
}
// 遍历视图 去找符合条件的 文件夹已经创建
System.out.println("getOutPart2,dataName="+dataName);
getOutPart(rev, dataName, list);
String dataDir3 = jtf.getText() + File.separator + rev.getStringProperty("item_id") + "_"
+ rev.getStringProperty("current_revision_id") + "_" + replace + File.separator
@ -628,10 +652,17 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
}
dataName2 = dataName + File.separator + rev.getStringProperty("item_id") + "_"
+ rev.getStringProperty("current_revision_id") + "_" + replace;// 文件名
TCComponent[] datasets = rev.getReferenceListProperty("IMAN_specification");
TCComponent[] datasets=null;
if(revType.equals("T2_ECNRevision")) {
datasets = rev.getReferenceListProperty("TC_Attaches");
}else {
datasets = rev.getReferenceListProperty("IMAN_specification");
}
TCComponent[] datasets2 = rev.getReferenceListProperty("IMAN_Rendering");
for (int j = 0; j < datasets.length; j++) {
for (int j = 0; j < datasets.length; j++) {
System.out.println("-----------------");
// 获取数据集数组
TCComponentDataset dataset02 = null;
if (datasets[j] instanceof TCComponentDataset) {
@ -645,6 +676,7 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
// 判断零件类型
if (itemlist.contains(revtype) || allCheck) {
if (datasetList.contains(type)) {
System.out.println("!!!!!!!!!!!!!!!");
TCComponentDataset dataset = (TCComponentDataset) datasets[j];
System.out.println("下载文件");
getload(dataset, dataName, list, rev.getStringProperty("item_id"));
@ -667,6 +699,7 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
if (itemlist.contains(revtype) || allCheck) {
if (datasetList.contains(type)) {
TCComponentDataset dataset = (TCComponentDataset) datasets2[j];
System.out.println("getload3");
getload(dataset, dataName, list, rev.getStringProperty("item_id"));
getload(dataset, dataName2, list, rev.getStringProperty("item_id"));
}
@ -717,6 +750,7 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
}
String dataName2 = "";
// 遍历视图 去找符合条件的 文件夹已经创建
System.out.println("getOutPart3,dataName="+dataName);
getOutPart(rev, dataName, list);
String dataDir3 = jtf.getText() + File.separator + rev.getStringProperty("item_id") + "_"
+ rev.getStringProperty("current_revision_id") + "_" + replace + File.separator
@ -744,6 +778,7 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
if (itemlist.contains(revtype) || allCheck) {
if (datasetList.contains(type)) {
TCComponentDataset dataset = (TCComponentDataset) datasets[j];
System.out.println("getload4");
getload(dataset, dataName, list, rev.getStringProperty("item_id"));
getload(dataset, dataName2, list, rev.getStringProperty("item_id"));
}
@ -763,6 +798,7 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
if (itemlist.contains(revtype) || allCheck) {
if (datasetList.contains(type)) {
TCComponentDataset dataset = (TCComponentDataset) datasets2[j];
System.out.println("getload5");
getload(dataset, dataName, list, rev.getStringProperty("item_id"));
getload(dataset, dataName2, list, rev.getStringProperty("item_id"));
}
@ -797,6 +833,7 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
itemlist.add("T2_OutBuyPartRevision");
itemlist.add("T2_outsourceRevision");
itemlist.add("T2_EquipmentRevision");
itemlist.add("T2_ECNRevision");
} else if ("外协件".equals(jcb.getText())) {
itemlist.add("T2_outsourceRevision");
} else if ("外购件".equals(jcb.getText())) {
@ -965,12 +1002,15 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
continue;
}
// 执行getload方法
System.out.println("getload6");
getload(dataset02, dir, list, rev.getStringProperty("item_id"));
// 复制一份到父级
if (!dir.equals(dirFs)) {
System.out.println("getload7");
getload(dataset02, dirFs, list, rev.getStringProperty("item_id"));
}
if (!dir.equals(pathMap.get("1")) && pathMap.get("1") != null) {
System.out.println("getload8");
getload(dataset02, pathMap.get("1"), list, rev.getStringProperty("item_id"));
}
}
@ -989,11 +1029,14 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
String type = dataset02.getStringProperty("object_type");
if (datasetList.contains(type)) {
TCComponentDataset dataset = (TCComponentDataset) datasets2[j];
System.out.println("getload9");
getload(dataset, dir, list, rev.getStringProperty("item_id"));
if (!dir.equals(dirFs)) {
System.out.println("getload10");
getload(dataset, dirFs, list, rev.getStringProperty("item_id"));
}
if (!dir.equals(pathMap.get("1"))) {
if (!dir.equals(pathMap.get("1"))&& pathMap.get("1") != null) {
System.out.println("getlaod11");
getload(dataset02, pathMap.get("1"), list, rev.getStringProperty("item_id"));
}
}

@ -14,7 +14,7 @@ import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.jacorb.idl.runtime.int_token;
//import org.jacorb.idl.runtime.int_token;
import com.ctc.wstx.compat.Jdk12Impl;
import com.teamcenter.rac.aif.AbstractAIFOperation;

@ -13,7 +13,7 @@ import java.util.List;
import java.util.ListIterator;
import java.util.Set;
import org.jacorb.idl.runtime.int_token;
//import org.jacorb.idl.runtime.int_token;
import com.connor.dev.imp.toolkit.SearchUtility;
import com.connor.dfl.plm.dfl037.GetLatestExcelOperation;

@ -35,6 +35,11 @@ public class ChangeBean {
private String projectCode;//ÏîÄ¿±àºÅ
private String changeReason;//¸ü¸ÄÔ­Òò
private String accountSet;//ÕËÌ×
private String reasonDetail;//明细原因
private String formMajor;//变更专业
private String pkeyword;//问题关键词
private String manageclassify; //设计管理分类
private String kkcode; //kk申请编号
public String getProjectState() {
return projectState;
@ -182,4 +187,36 @@ public class ChangeBean {
public void setDrawingTo(String drawingTo) {
this.drawingTo = drawingTo;
}
public String getReasonDetail() {
return reasonDetail;
}
public void setReasonDetail(String reasonDetail) {
this.reasonDetail = reasonDetail;
}
public String getFormMajor() {
return formMajor;
}
public void setFormMajor(String formMajor) {
this.formMajor = formMajor;
}
public String getPkeyword() {
return pkeyword;
}
public void setPkeyword(String pkeyword) {
this.pkeyword = pkeyword;
}
public String getManageclassify() {
return manageclassify;
}
public void setManageclassify(String manageclassify) {
this.manageclassify = manageclassify;
}
public String getKkcode() {
return kkcode;
}
public void setKkcode(String kkcode) {
this.kkcode = kkcode;
}
}

@ -17,11 +17,6 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import com.connor.dfl.plm.util.DataBaseControl;
import com.connor.dfl.plm.util.ProgressBarThread;
import com.spire.xls.ExcelVersion;
import com.spire.xls.OrderBy;
import com.spire.xls.SortComparsionType;
import com.spire.xls.Workbook;
import com.spire.xls.Worksheet;
import com.teamcenter.rac.aif.AbstractAIFOperation;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentDataset;
@ -156,7 +151,7 @@ public class Dfl038Operation extends AbstractAIFOperation{
XSSFCellStyle cellStyle = targetCell.getCellStyle();
for (int i = 0; i < beanList.size(); i++) {
ChangeBean bean = beanList.get(i);
String[] vals = new String[24];
String[] vals = new String[26];
vals[0] = bean.getApplyName();
vals[1] = bean.getChangeListCode();
vals[2] = bean.getApplyDate();
@ -169,18 +164,20 @@ public class Dfl038Operation extends AbstractAIFOperation{
vals[9] = bean.getSUOSU_ProductDepartment();
vals[10] = bean.getDutyDepartment();
vals[11] = bean.getDutyMan();
vals[12] = bean.getChangeType();
vals[13] = bean.getProductType();
vals[14] = bean.getErrorType();
vals[15] = bean.getPriceBooking();
vals[16] = bean.getSalseClassify();
vals[17] = bean.getIsNotProductLoss();
vals[18] = bean.getProjectState();
vals[19] = bean.getReceiveClassify();
vals[20] = bean.getDrawingTo();
vals[21] = bean.getProjectCode();
vals[22] = bean.getChangeReason();
vals[23] = bean.getAccountSet();
vals[12] = bean.getFormMajor();
vals[13] = bean.getChangeType();
vals[14] = bean.getProductType();
vals[15] = bean.getErrorType();
vals[16] = bean.getPriceBooking();
vals[17] = bean.getSalseClassify();
vals[18] = bean.getIsNotProductLoss();
vals[19] = bean.getProjectState();
vals[20] = bean.getReceiveClassify();
vals[21] = bean.getDrawingTo();
vals[22] = bean.getProjectCode();
vals[23] = bean.getChangeReason();
vals[24] = bean.getAccountSet();
vals[25] = bean.getReasonDetail();
XSSFRow row = sheet.getRow(i+1);
if(row == null){

@ -40,7 +40,7 @@ public class ChangeFormBean {
public Map<String,String> getMap(){
Map<String, String> map = new HashedMap();
map.put("APPLYNAME",applyhMan==null || "".equals(applyhMan.trim())?null:" AND APPLYNAME LIKE '%"+applyhMan+"%' ");
map.put("CHANGELISTCODE", applyId==null || "".equals(applyId.trim())?null:" AND CHANGELISTCODE LIKE '%"+applyId+"%' ");
map.put("OBJECTCODE", applyId==null || "".equals(applyId.trim())?null:" AND OBJECTCODE LIKE '%"+applyId+"%' ");
map.put("PROJECTCODE", projectId==null || "".equals(projectId.trim())?null:" AND PROJECTCODE LIKE '%"+projectId+"%' ");
map.put("PROJECTMODEL", procuctModNum==null || "".equals(procuctModNum.trim())?null:"AND PROJECTMODEL LIKE '%"+procuctModNum+"%' ");
map.put("CLIENTNAME", custName==null || "".equals(custName.trim())?null:"AND CLIENTNAME LIKE '%"+custName+"%' ");

@ -26,6 +26,7 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.function.Consumer;
@ -59,13 +60,14 @@ import org.apache.poi.xssf.usermodel.XSSFCellStyle;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.jacorb.idl.runtime.int_token;
//import org.jacorb.idl.runtime.int_token;
//import com.connor.dfl.plm.dfl038.MyComparator;
import com.connor.dfl.plm.util.DataBaseControl;
import com.connor.dfl.plm.util.ProgressBar;
import com.connor.dfl.plm.util.ProgressBarThread;
import com.lowagie.text.Row;
import com.sun.mail.handlers.image_gif;
//import com.sun.javafx.image.IntPixelAccessor;
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
import com.teamcenter.rac.kernel.TCComponent;
@ -77,6 +79,7 @@ import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.util.MessageBox;
import jdk.internal.org.objectweb.asm.tree.IntInsnNode;
import oracle.net.aso.s;
public class DFL038Jframe extends JFrame {
@ -86,7 +89,7 @@ public class DFL038Jframe extends JFrame {
private String[] drawChangeType = new String[] { "全部", "其他" };
private String[] changeType = new String[] { "设计错误", "设计优化", "内部方案更改", "方案更改", "采购更改", "销售更改" };
private String[] changeType = new String[] { "设计错误", "内部方案变更", "设计优化", "系统方案变更", "采购变更", "销售更改" };
private String[] productType = new String[] { "冻干机", "灭菌柜", "清洗机", "联动线", "自动机械", "灯检机" };
@ -94,6 +97,9 @@ public class DFL038Jframe extends JFrame {
private String[] errorType = new String[] { "P&ID图", "容器图", "机架图", "BOM表", "外协件图", "平面布局图", "其他" };
private String[] exportType = new String[] { "明细导出", "合并导出" };
private JLabel startDateLabel = new JLabel("申请日期晚于");
private JLabel endDateLabel = new JLabel("申请日期早于");
private JLabel depLabel = new JLabel("产品部门");
@ -144,32 +150,145 @@ public class DFL038Jframe extends JFrame {
private JButton cancelButton;
private JPanel centerPanel1;
private String[] title = new String[] { "产品部门", "产品名称", "变更通知单号", "产品型号", "客户名称", "申请人","更改类型", "更改原因", "图纸更改类型", "责任部门",
"责任人", "品号", "品名", "原版本", "现版本", "变更数量", "产品类型", "错误类型", "价格预告", "销售分类", "是否产生成本损失", "项目阶段", "料件领用分类",
"图纸发至", "项目编号", "通知紧急程度", "申请时间", "账套", "流程阶段" };
private JLabel exportTypeLabel;
private JComboBox<String> exportTypeBox;
private DefaultComboBoxModel<String> exportTypeModel;
private JFrame frame;
private Boolean flag = true;
private String[] title = new String[] { "产品部门", "产品名称", "变更通知单号", "产品型号", "客户名称", "申请人", "更改类型", "更改原因", "图纸更改类型",
"责任部门", "责任人", "品号", "品名", "原版本", "现版本", "变更数量", "产品类型", "错误类型", "价格预告", "销售分类", "是否产生成本损失", "项目阶段",
"料件领用分类", "图纸发至", "项目编号", "通知紧急程度", "申请时间", "账套", "流程阶段" };
public DFL038Jframe(TCSession session) {
this.session = session;
departs = session.getPreferenceService().getStringValues("T2_ECNReport");
changeType = session.getPreferenceService().getStringValues("T2_changeType");
drawChangeType = session.getPreferenceService().getStringValues("T2_drawChangeType");
productType = session.getPreferenceService().getStringValues("DFL_Form_Product_Type");
errorType = session.getPreferenceService().getStringValues("DFL_Form_Error_Type");
if (departs == null || changeType == null || productType == null || errorType == null || departs.length == 0
|| changeType.length == 0 || errorType.length == 0) {
MessageBox.post("首选项T2_ECNReport或者T2_changeType有问题请联系管理员", "错误", MessageBox.ERROR);
return;
}
frame = new JFrame();
frame.setTitle("请选择导出类型");
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
Rectangle rect = ge.getMaximumWindowBounds();
int sw = rect.width;
int sh = rect.height;
frame.setBounds((sw - 350) / 2, (sh - 300) / 2, 350, 300); // 设置位置即大小
this.setLayout(new BorderLayout());
JPanel myJPanel = new JPanel();
myJPanel.setLayout(null);
JButton okbutton;
exportTypeLabel = new JLabel("导出类型");
exportTypeLabel.setFont(new Font("微软雅黑", Font.BOLD, 20));
exportTypeLabel.setSize(100, 30);
exportTypeModel = new DefaultComboBoxModel<String>();
exportTypeBox = new JComboBox<String>(exportTypeModel);
exportTypeBox.setBounds(200, 190, 170, 30);
exportTypeBox.setFont(new Font("微软雅黑", Font.BOLD, 20));
for (String string : exportType) {
exportTypeModel.addElement(string);
}
exportTypeLabel.setBounds(30, 50, 100, 30);
exportTypeBox.setBounds(150, 50, 150, 30);
okbutton = new JButton("确定");
okbutton.setFont(new Font("微软雅黑", Font.BOLD, 20));
okbutton.setBounds(100, 180, 120, 30);
okbutton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
final String element = exportTypeModel.getElementAt(exportTypeBox.getSelectedIndex());
System.out.println(element);
if ("合并导出".equals(element)) {
flag = false;
}
frame.setVisible(false);
InitUI();
}
});
myJPanel.add(exportTypeLabel);
myJPanel.add(exportTypeBox);
myJPanel.add(okbutton);
Container contentPane = frame.getContentPane();
contentPane.add(myJPanel, BorderLayout.CENTER);
frame.setVisible(true);
}
public DFL038Jframe() {
frame = new JFrame();
frame.setTitle("请选择导出类型");
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
Rectangle rect = ge.getMaximumWindowBounds();
int sw = rect.width;
int sh = rect.height;
frame.setBounds((sw - 350) / 2, (sh - 300) / 2, 350, 300); // 设置位置即大小
this.setLayout(new BorderLayout());
JPanel myJPanel = new JPanel();
myJPanel.setLayout(null);
exportTypeLabel = new JLabel("导出类型");
exportTypeLabel.setFont(new Font("微软雅黑", Font.BOLD, 20));
exportTypeLabel.setSize(100, 30);
exportTypeModel = new DefaultComboBoxModel<String>();
exportTypeBox = new JComboBox<String>(exportTypeModel);
exportTypeBox.setBounds(200, 190, 170, 30);
exportTypeBox.setFont(new Font("微软雅黑", Font.BOLD, 20));
for (String string : exportType) {
exportTypeModel.addElement(string);
}
exportTypeLabel.setBounds(30, 50, 100, 30);
exportTypeBox.setBounds(150, 50, 150, 30);
okbutton = new JButton("确定");
okbutton.setFont(new Font("微软雅黑", Font.BOLD, 20));
okbutton.setBounds(100, 180, 120, 30);
okbutton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
String element = exportTypeModel.getElementAt(exportTypeBox.getSelectedIndex());
// System.out.println(element);
if ("合并导出".equals(element))
flag = false;
frame.setVisible(false);
InitUI();
}
});
myJPanel.add(exportTypeLabel);
myJPanel.add(exportTypeBox);
myJPanel.add(okbutton);
Container contentPane = frame.getContentPane();
contentPane.add(myJPanel, BorderLayout.CENTER);
frame.setVisible(true);
}
private void InitUI() {
// TODO Auto-generated method stub
departs = session.getPreferenceService().getStringValues("T2_ECNReport");
if(flag) {
changeType = session.getPreferenceService().getStringValues("T2_changeType");
}
drawChangeType = session.getPreferenceService().getStringValues("T2_drawChangeType");
productType = session.getPreferenceService().getStringValues("DFL_Form_Product_Type");
errorType = session.getPreferenceService().getStringValues("DFL_Form_Error_Type");
if (departs == null || changeType == null || productType == null || errorType == null
|| departs.length == 0 || changeType.length == 0 || errorType.length == 0) {
MessageBox.post("首选项T2_ECNReport或者T2_changeType有问题请联系管理员", "错误", MessageBox.ERROR);
return;
}
// 初始化窗体
// 设置标题
@ -454,6 +573,11 @@ public class DFL038Jframe extends JFrame {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
new Thread(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
ProgressBarThread progressBarThread = new ProgressBarThread("数据导出", "数据导出中,请稍等...");
progressBarThread.setBool(true);
@ -468,10 +592,10 @@ public class DFL038Jframe extends JFrame {
String depart = model.getElementAt(comboBox.getSelectedIndex());
String selectPath = sourcefile.getText();
ChangeFormBean changeFormBean = new ChangeFormBean(applyNameField.getText(), changeIdField.getText(),
productIdField.getText(), productModNumField.getText(), clientNameField.getText(),
dutyModel.getElementAt(dutyDeptBox.getSelectedIndex()), dutyManField.getText(),
changeTypeModel.getElementAt(changeTypeBox.getSelectedIndex()),
ChangeFormBean changeFormBean = new ChangeFormBean(applyNameField.getText(),
changeIdField.getText(), productIdField.getText(), productModNumField.getText(),
clientNameField.getText(), dutyModel.getElementAt(dutyDeptBox.getSelectedIndex()),
dutyManField.getText(), changeTypeModel.getElementAt(changeTypeBox.getSelectedIndex()),
productTypeModel.getElementAt(productTypeBox.getSelectedIndex()),
drawChangeTypeModel.getElementAt(drawChangeTypeBox.getSelectedIndex()),
(String) isCostLossModel.getElementAt(isCostLossBox.getSelectedIndex()),
@ -479,16 +603,17 @@ public class DFL038Jframe extends JFrame {
String conditions = changeFormBean.generateSql();
String leftConditions = "D.OBJECTCODE = F.OBJECTCODE where ";
DataBaseControl control = new DataBaseControl("oracle.jdbc.driver.OracleDriver",
"jdbc:oracle:thin:@192.168.1.138:1521/tc12", "infodba", "infodba");
"jdbc:oracle:thin:@192.168.1.152:1521/plmdb", "infodba", "infodba");
control.openDataBase();
String colString = " F.PRODUCTDEPARTMENT,F.PRODUCTNAME,F.CHANGELISTCODE,F.PROJECTMODEL,F.CLIENTNAME,F.APPLYNAME,F.CHANGETYPE,F.CHANGEREASON,F.TZGGLX,F.DUTYDEPARTMENT,F.DUTYMAN,D.PH,D.PM,D.YBB,D.XBB,D.BGSL,F.PRODUCTTYPE,F.ERRORTYPE,F.PRICEBOOKING,F.SALSECLASSIFY,F.ISNOTPRODUCTLOSS,F.XMJD,F.RECEIVECLASSIFY,F.DRAWINGTO,F.PROJECTCODE,F.NOTIFYEMERGENCYPROCEDURES,F.APPLYDATE,F.ACCOUNTSET ";
String colString = " F.PRODUCTDEPARTMENT,F.PRODUCTNAME,F.OBJECTCODE,F.PROJECTMODEL,F.CLIENTNAME,F.APPLYNAME,F.CHANGETYPE,F.CHANGEREASON,F.TZGGLX,F.DUTYDEPARTMENT,F.DUTYMAN,D.PH,D.PM,D.YBB,D.XBB,D.BGSL,F.PRODUCTTYPE,F.ERRORTYPE,F.PRICEBOOKING,F.SALSECLASSIFY,F.ISNOTPRODUCTLOSS,F.XMJD,F.RECEIVECLASSIFY,F.DRAWINGTO,F.PROJECTCODE,F.NOTIFYEMERGENCYPROCEDURES,F.APPLYDATE,F.ACCOUNTSET ";
// 获取需要判断的列
// 如果先进行进行判断
String sql1 = "select " + colString + " from DFL_CHANGEFORM F LEFT OUTER JOIN DFL_CHANGEDETAILS D ON "
+ leftConditions + " (F.OBJECTCODE like'ECN%' or F.OBJECTCODE like'QECN%') "
String sql1 = "select " + colString
+ " from DFL_CHANGEFORM F LEFT OUTER JOIN DFL_CHANGEDETAILS D ON " + leftConditions
+ " (F.OBJECTCODE like'ECN%' or F.OBJECTCODE like'QECN%') "
+ "AND F.PRODUCTDEPARTMENT = '" + depart + "' AND "
+ " F.APPLYDATE IS NOT NULL AND to_date(F.applydate,'yyyy-MM-dd HH24:mi:ss') >= to_date('"
+ startTime
@ -496,16 +621,18 @@ public class DFL038Jframe extends JFrame {
+ endTime + "','yyyy-MM-dd HH24:mi:ss') " + conditions
+ " order by F.PRODUCTDEPARTMENT,F.APPLYDATE";
if (depart == null || depart.trim().equals("")) {
sql1 = "select " + colString + " from DFL_CHANGEFORM F LEFT OUTER JOIN DFL_CHANGEDETAILS D ON "
+ leftConditions + " (F.OBJECTCODE like'ECN%' or F.OBJECTCODE like'QECN%') " + " AND "
sql1 = "select " + colString
+ " from DFL_CHANGEFORM F LEFT OUTER JOIN DFL_CHANGEDETAILS D ON " + leftConditions
+ " (F.OBJECTCODE like'ECN%' or F.OBJECTCODE like'QECN%') " + " AND "
+ " F.APPLYDATE IS NOT NULL AND to_date(F.applydate,'yyyy-MM-dd HH24:mi:ss') >= to_date('"
+ startTime
+ "','yyyy-MM-dd HH24:mi:ss') AND to_date(F.applydate,'yyyy-MM-dd HH24:mi:ss') <= to_date('"
+ endTime + "','yyyy-MM-dd HH24:mi:ss') " + conditions
+ " order by F.PRODUCTDEPARTMENT,F.APPLYDATE";
} else if (depart != null && "全部".equals(depart)) {
sql1 = "select " + colString + " from DFL_CHANGEFORM F LEFT OUTER JOIN DFL_CHANGEDETAILS D ON "
+ leftConditions + " (F.OBJECTCODE like'ECN%' or F.OBJECTCODE like'QECN%') " + " AND "
sql1 = "select " + colString
+ " from DFL_CHANGEFORM F LEFT OUTER JOIN DFL_CHANGEDETAILS D ON " + leftConditions
+ " (F.OBJECTCODE like'ECN%' or F.OBJECTCODE like'QECN%') " + " AND "
+ " F.APPLYDATE IS NOT NULL AND to_date(F.applydate,'yyyy-MM-dd HH24:mi:ss') >= to_date('"
+ startTime
+ "','yyyy-MM-dd HH24:mi:ss') AND to_date(F.applydate,'yyyy-MM-dd HH24:mi:ss') <= to_date('"
@ -536,6 +663,520 @@ public class DFL038Jframe extends JFrame {
+ endTime + "','yyyy-MM-dd HH24:mi:ss') " + conditions
+ " group by substr(applydate,0,7),CHANGETYPE order by date1 asc";
}
if (depart == null || "全部".equals(depart) || depart.trim().length() == 0) {
System.out.println("导出各个部门的月份清单!");
Date date = new Date();
SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd_HHmm");
String currentTime = df.format(date);
String absoluteFilePath = selectPath + "\\" + "更改通知单报表-" + currentTime + ".xlsx";
// System.out.println(absoluteFilePath);
File file = new File(absoluteFilePath);
if (!file.exists()) {
try {
file.createNewFile();
// System.out.println("111:"+file.getAbsolutePath());
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
try {
XSSFWorkbook workbook = new XSSFWorkbook();
XSSFCellStyle cellStyle = workbook.createCellStyle();
cellStyle.setBorderBottom(BorderStyle.THIN); // 下边框
cellStyle.setBorderLeft(BorderStyle.THIN);// 左边框
cellStyle.setBorderTop(BorderStyle.THIN);// 上边框
cellStyle.setBorderRight(BorderStyle.THIN);// 右边框
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER); // 垂直居中
cellStyle.setAlignment(HorizontalAlignment.CENTER); // 水平居中
cellStyle.setWrapText(true);
// 写第一个单元格
XSSFSheet sheet2 = workbook.createSheet("详细清单");
int i = 0;
XSSFRow titleRow = sheet2.createRow(i);
for (int j = 0; j < title.length; j++) {
XSSFCell createCell = titleRow.createCell(j);
createCell.setCellStyle(cellStyle);
createCell.setCellValue(title[j]);
}
String lastChangeFormId = null;
Boolean isRelease = false;
while (dbQuery.next()) {
i++;
XSSFRow Row = sheet2.createRow(i);
String changeFormId = dbQuery.getString(3).substring(0,dbQuery.getString(3).indexOf("/"));
if (changeFormId != null && !changeFormId.equals(lastChangeFormId)) {
List<TCComponent> queryObject = queryObject("零组件 ID", new String[] { "零组件 ID" },
new String[] { changeFormId });
System.out.println(changeFormId);
if (queryObject != null && queryObject.size() > 0) {
TCComponent component = queryObject.get(0);
AIFComponentContext[] versions = component.getChildren("revision_list");
TCComponent versionComponent = (TCComponent) versions[0].getComponent();
TCProperty tcProperty = versionComponent
.getTCProperty("release_status_list");
TCComponent[] releases = tcProperty.getReferenceValueArray();
if (releases != null && releases.length > 0) {
isRelease = true;
}else {
isRelease = false;
}
}
}
for (int j = 0; j < title.length - 1; j++) {
XSSFCell createCell = Row.createCell(j);
createCell.setCellStyle(cellStyle);
createCell.setCellValue(dbQuery.getString(j + 1));
if (j == title.length - 2) {
createCell = Row.createCell(j + 1);
createCell.setCellStyle(cellStyle);
createCell.setCellValue(isRelease ? "已发布" : "未发布");
}
}
}
// 写第二个单元
// 创建表头
// for (int ct = 0; ct <= departs.length; ct++) {
// if (ct == departs.length) {
// sql2 = "select count(*),CHANGETYPE,substr(applydate,0,7) as date1 FROM DFL_CHANGEFORM WHERE (OBJECTCODE like'ECN%' or OBJECTCODE like'QECN%') AND CHANGETYPE IS NOT NULL AND applydate IS NOT NULL AND to_date(applydate,'yyyy-MM-dd HH24:mi:ss') >= to_date('"
// + startTime
// + "','yyyy-MM-dd HH24:mi:ss') AND to_date(applydate,'yyyy-MM-dd HH24:mi:ss') <= to_date('"
// + endTime + "','yyyy-MM-dd HH24:mi:ss') " + conditions
// + " group by substr(applydate,0,7),CHANGETYPE order by date1 asc";
// System.out.println("月份汇总清单sql=>:" + sql2);
// } else if ("全部".equals(departs[ct])) {
// continue;
// } else {
// sql2 = "select count(*),CHANGETYPE,substr(applydate,0,7) as date1 FROM DFL_CHANGEFORM WHERE productdepartment='"
// + departs[ct].trim()
// + "' AND (OBJECTCODE like'ECN%' or OBJECTCODE like'QECN%') AND CHANGETYPE IS NOT NULL AND applydate IS NOT NULL AND to_date(applydate,'yyyy-MM-dd HH24:mi:ss') >= to_date('"
// + startTime
// + "','yyyy-MM-dd HH24:mi:ss') AND to_date(applydate,'yyyy-MM-dd HH24:mi:ss') <= to_date('"
// + endTime + "','yyyy-MM-dd HH24:mi:ss') " + conditions
// + " group by substr(applydate,0,7),CHANGETYPE order by date1 asc";
// System.out.println(departs[ct] + "sql=>:" + sql2);
// }
//
// ResultSet dbQuery2 = control.dbQuery3(sql2);
// XSSFSheet sheet1 = null;
// if (ct == departs.length) {
// sheet1 = workbook.createSheet("汇总月份清单");
// } else {
// System.out.println(departs[ct] + "月份清单");
// sheet1 = workbook.createSheet(departs[ct] + "月份清单");
// }
// XSSFRow titleRow2 = sheet1.createRow(0);
// for (int j = 0; j < changeType.length; j++) {
// XSSFCell createCell = titleRow2.createCell(j + 1);
// createCell.setCellStyle(cellStyle);
// createCell.setCellValue(changeType[j]);
// }
// Set<String> set = new HashSet<String>();
//
// int db2 = 0;
//
// while (dbQuery2.next()) {
// set.add(dbQuery2.getString(3));
// db2++;
// }
// System.out.println(set.size());
// if (set.size() == 0) {
// continue;
// }
// dbQuery2.first();
// dbQuery2.previous();
//
// ArrayList<String> list = new ArrayList<String>();
// for (String string2 : set) {
// list.add(string2);
// }
//
//// Collections.sort(list,new MyComparator());
// Collections.sort(list);
//
// // 创建列头
//
// XSSFRow[] rows = new XSSFRow[list.size()];
// for (int j = 0; j < list.size(); j++) {
// rows[j] = sheet1.createRow(j + 1);
// XSSFCell createCell = rows[j].createCell(0);
// createCell.setCellStyle(cellStyle);
// createCell.setCellValue(list.get(j).endsWith("-")
// ? list.get(j).substring(0, list.get(j).length() - 1)
// : list.get(j));
// }
//
// // 初始化每列的合计
//
// int num[] = new int[changeType.length];
// for (int j = 0; j < changeType.length; j++) {
// num[j] = 0;
// }
//
// for (int rowNum = 1; rowNum <= list.size(); rowNum++) {
// for (int colNum = 1; colNum <= changeType.length; colNum++) {
// XSSFCell createCell = rows[rowNum - 1].createCell(colNum);
// createCell.setCellStyle(cellStyle);
// createCell.setCellValue(0);
// }
// }
//
// System.out.println(dbQuery2.getRow() + "--1--" + changeType.length);
// int[][] CTN = new int[list.size()][changeType.length];
// int[] countNum = null;
// int countYear = 0;
// String year = list.get(0).substring(0, 4);
// int rowY = 0;
// int lastRN = list.size() + 1;
// int current = 0;
// if(flag) {
// while (dbQuery2.next()) {
// current++;
// for (int j = 0; j < list.size(); j++) {
//
// if (dbQuery2.getString(3).equals(list.get(j))) {
// System.out.println(dbQuery2.getString(3));
// for (int n = 0; n < changeType.length; n++) {
// System.out.println(dbQuery2.getString(2) + "===" + changeType[n]);
// if (dbQuery2.getString(2) != null
// && dbQuery2.getString(2).equals(changeType[n])) {
// XSSFCell createCell = rows[j].createCell(n + 1);
// createCell.setCellStyle(cellStyle);
// createCell.setCellValue(dbQuery2.getString(1));
// num[n] += Integer.parseInt(dbQuery2.getString(1));
// if (!year.equals(rows[j].getCell(0).getStringCellValue()
// .substring(0, 4))) {
// System.out.println(list);
// System.out.println(year);
// XSSFRow row = sheet1.createRow(lastRN++);
// XSSFCell cell = row.createCell(0);
// cell.setCellStyle(cellStyle);
// cell.setCellValue(year + "合计:");
// year = rows[j].getCell(0).getStringCellValue().substring(0,
// 4);
// System.out.println("after" + year);
// for (int o = 0; o < changeType.length; o++) {
// cell = row.createCell(o + 1);
// cell.setCellStyle(cellStyle);
// cell.setCellValue(CTN[j - 1][o]);
// }
// cell = row.createCell(changeType.length + 1);
// cell.setCellStyle(cellStyle);
// cell.setCellValue(getArrayCount(CTN[j - 1]));
// countNum = arrayAdd(CTN[j - 1], countNum);
//
// // sheet1.shiftRows(j, lastRN-1, 1, true, false);
// }
// }
// }
// for (int n = 0; n < changeType.length; n++) {
// CTN[j][n] = num[n];
// }
// }
//
// }
// if (current == db2) {
// if (countNum != null) {
// XSSFRow row = sheet1.createRow(lastRN++);
// XSSFCell cell = row.createCell(0);
// cell.setCellStyle(cellStyle);
// cell.setCellValue(list.get(list.size() - 1).substring(0, 4) + "合计:");
// for (int o = 0; o < changeType.length; o++) {
// cell = row.createCell(o + 1);
// cell.setCellStyle(cellStyle);
// System.out.println("cell=>" + (null == cell));
// System.out.println(
// "CTN[CTN.length-1]=>" + (null == CTN[CTN.length - 1]));
// System.out
// .println("CTN[CTN.length-1][o]=>" + CTN[CTN.length - 1][o]);
// System.out.println("countNum[o]=>" + countNum[o]);
// cell.setCellValue(CTN[CTN.length - 1][o] - countNum[o]);
// }
// cell = row.createCell(changeType.length + 1);
// cell.setCellStyle(cellStyle);
// cell.setCellValue(
// getArrayCount(CTN[CTN.length - 1]) - getArrayCount(countNum));
// }
//
// XSSFRow row = sheet1.createRow(lastRN++);
// XSSFCell cell = row.createCell(0);
// cell.setCellStyle(cellStyle);
// cell.setCellValue("合计:");
// for (int o = 0; o < changeType.length; o++) {
// cell = row.createCell(o + 1);
// cell.setCellStyle(cellStyle);
// cell.setCellValue(CTN[CTN.length - 1][o]);
// }
// cell = row.createCell(changeType.length + 1);
// cell.setCellStyle(cellStyle);
// cell.setCellValue(getArrayCount(CTN[CTN.length - 1]));
// }
// }
// }else {
// List<CountBean> countBeans = new ArrayList<CountBean>();
// for (String changetype : changeType) {
// for (String date1 : list) {
// countBeans.add(new CountBean(changetype, 0, date1));
// }
// }
//
// while(dbQuery2.next()) {
// for (CountBean countBean : countBeans) {
// if(dbQuery2.getString(3).equals(countBean.getDate()) && dbQuery2.getString(2).contains(countBean.getType())) {
// countBean.setCount(countBean.getCount()+Integer.parseInt(dbQuery2.getString(1)));
// }
// }
// }
//
//
// db2 = countBeans.size();
// Iterator<CountBean> iterator = countBeans.iterator();
//
// while (iterator.hasNext()) {
// CountBean bean = (CountBean)iterator.next();
// current++;
// for (int j = 0; j < list.size(); j++) {
//
// if (bean.getDate().equals(list.get(j))) {
// System.out.println(bean.getDate());
// for (int n = 0; n < changeType.length; n++) {
// System.out.println(bean.getType() +"==="+bean.getCount()+"===" + changeType[n]);
// if (bean.getType() != null
// && bean.getType().equals(changeType[n])) {
// XSSFCell createCell = rows[j].createCell(n + 1);
// createCell.setCellStyle(cellStyle);
// createCell.setCellValue(bean.getCount());
// num[n] += bean.getCount();
// if (!year.equals(rows[j].getCell(0).getStringCellValue()
// .substring(0, 4))) {
// System.out.println(list);
// System.out.println(year);
// XSSFRow row = sheet1.createRow(lastRN++);
// XSSFCell cell = row.createCell(0);
// cell.setCellStyle(cellStyle);
// cell.setCellValue(year + "合计:");
// year = rows[j].getCell(0).getStringCellValue().substring(0,
// 4);
// System.out.println("after" + year);
// for (int o = 0; o < changeType.length; o++) {
// cell = row.createCell(o + 1);
// cell.setCellStyle(cellStyle);
// cell.setCellValue(CTN[j - 1][o]);
// }
// cell = row.createCell(changeType.length + 1);
// cell.setCellStyle(cellStyle);
// cell.setCellValue(getArrayCount(CTN[j - 1]));
// countNum = arrayAdd(CTN[j - 1], countNum);
//
// // sheet1.shiftRows(j, lastRN-1, 1, true, false);
// }
// }
// }
// for (int n = 0; n < changeType.length; n++) {
// CTN[j][n] = num[n];
// }
// }
//
// }
// if (current == db2) {
// if (countNum != null) {
// XSSFRow row = sheet1.createRow(lastRN++);
// XSSFCell cell = row.createCell(0);
// cell.setCellStyle(cellStyle);
// cell.setCellValue(list.get(list.size() - 1).substring(0, 4) + "合计:");
// for (int o = 0; o < changeType.length; o++) {
// cell = row.createCell(o + 1);
// cell.setCellStyle(cellStyle);
// System.out.println("cell=>" + (null == cell));
// System.out.println(
// "CTN[CTN.length-1]=>" + (null == CTN[CTN.length - 1]));
// System.out
// .println("CTN[CTN.length-1][o]=>" + CTN[CTN.length - 1][o]);
// System.out.println("countNum[o]=>" + countNum[o]);
// cell.setCellValue(CTN[CTN.length - 1][o] - countNum[o]);
// }
// cell = row.createCell(changeType.length + 1);
// cell.setCellStyle(cellStyle);
// cell.setCellValue(
// getArrayCount(CTN[CTN.length - 1]) - getArrayCount(countNum));
// }
//
// XSSFRow row = sheet1.createRow(lastRN++);
// XSSFCell cell = row.createCell(0);
// cell.setCellStyle(cellStyle);
// cell.setCellValue("合计:");
// System.out.println("创建合计");
// for (int o = 0; o < changeType.length; o++) {
// cell = row.createCell(o + 1);
// cell.setCellStyle(cellStyle);
// cell.setCellValue(CTN[CTN.length - 1][o]);
// }
// cell = row.createCell(changeType.length + 1);
// cell.setCellStyle(cellStyle);
// cell.setCellValue(getArrayCount(CTN[CTN.length - 1]));
// }
// }
// }
//
// for (int p = 0; p < list.size(); p++) {
// System.out.println(Arrays.toString(CTN[p]));
// }
// }
FileOutputStream fos = FileUtils.openOutputStream(new File(absoluteFilePath));
workbook.write(fos);
if (fos != null) {
fos.close();
}
} catch (Exception e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
}
control.closeDataBase();
try {
merge(absoluteFilePath);
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
// try {
//
// File countFile = new File(absoluteFilePath);
// FileInputStream fis = FileUtils.openInputStream(countFile);
// XSSFWorkbook workbook = new XSSFWorkbook(fis);
// XSSFCellStyle cellStyle = workbook.createCellStyle();
// cellStyle.setBorderBottom(BorderStyle.THIN); // 下边框
// cellStyle.setBorderLeft(BorderStyle.THIN);// 左边框
// cellStyle.setBorderTop(BorderStyle.THIN);// 上边框
// cellStyle.setBorderRight(BorderStyle.THIN);// 右边框
// cellStyle.setVerticalAlignment(VerticalAlignment.CENTER); // 垂直居中
// cellStyle.setAlignment(HorizontalAlignment.CENTER); // 水平居中
// cellStyle.setWrapText(true);
//
// ArrayList<Bean> list = new ArrayList<Bean>();
//
// for (int cn = 0; cn <= departs.length; cn++) {
// XSSFSheet sheet = null;
// int sheetLastRow = -1;
// String departStr = null;
// if (cn == departs.length) {
// sheet = workbook.getSheet("汇总月份清单");
// System.out.println("汇总月份清单=>l:" + sheet.getLastRowNum());
// if (sheet.getLastRowNum() == 0) {
// continue;
// }
// Bean bean = new Bean();
// ArrayList<String[]> list1 = new ArrayList<String[]>();
// bean.setDepartName("全部");
//
// for (int i = 1; i <= sheet.getLastRowNum(); i++) {
// XSSFRow row = sheet.getRow(i);
// String[] arr = new String[row.getLastCellNum()];
// for (int j = 0; j < row.getLastCellNum(); j++) {
// arr[j] = ExcelUtil.getFormatterValue(row.getCell(j));
// }
// list1.add(arr);
// }
// bean.setList(list1);
// list.add(bean);
//
// } else if ("全部".equals(departs[cn])) {
// System.out.println("全部");
// continue;
// } else {
// sheet = workbook.getSheet(departs[cn] + "月份清单");
// System.out.println(departs[cn] + "月份清单=>l:" + sheet.getLastRowNum());
// if (sheet.getLastRowNum() == 0) {
// continue;
// }
// Bean bean = new Bean();
// ArrayList<String[]> list1 = new ArrayList<String[]>();
// bean.setDepartName(departs[cn]);
//
// for (int i = 1; i <= sheet.getLastRowNum(); i++) {
// XSSFRow row = sheet.getRow(i);
// String[] arr = new String[row.getLastCellNum()];
// for (int j = 0; j < row.getLastCellNum(); j++) {
// arr[j] = ExcelUtil.getFormatterValue(row.getCell(j));
// }
// list1.add(arr);
// }
// bean.setList(list1);
// list.add(bean);
// }
// }
// for (int i = 0; i < list.size(); i++) {
// System.out.println(list.get(i).getDepartName());
// for (String[] str : list.get(i).getList()) {
// System.out.println(Arrays.toString(str));
// }
// }
//
// XSSFSheet countSheet = workbook.createSheet("合并清单");
// // 创建标题行
// XSSFRow titleRow = countSheet.createRow(0);
// for (int i = 0; i < changeType.length; i++) {
// XSSFCell cell = titleRow.createCell(i + 2);
// cell.setCellStyle(cellStyle);
// cell.setCellValue(changeType[i]);
// }
// // 创建数据行
//
// int lastDepartRowNum = 0;
// for (int i = 0; i < list.size(); i++) {
// Bean bean = list.get(i);
// String departName = bean.getDepartName();
// ArrayList<String[]> departArrayList = bean.getList();
// for (int j = 0; j < departArrayList.size(); j++) {
// String[] rowStrs = departArrayList.get(j);
// XSSFRow row = countSheet.createRow(j + 1 + lastDepartRowNum);
// XSSFCell cell = row.createCell(0);
// cell.setCellStyle(cellStyle);
// cell.setCellValue(departName);
// for (int n = 0; n < rowStrs.length; n++) {
// XSSFCell cell2 = row.createCell(n + 1);
// cell2.setCellStyle(cellStyle);
// cell2.setCellValue(rowStrs[n]);
// }
// }
// lastDepartRowNum += departArrayList.size();
// }
// FileOutputStream fos = FileUtils.openOutputStream(countFile);
// workbook.write(fos);
//
// if (fis != null) {
// fis.close();
// }
// if (fos != null) {
// fos.close();
// }
//
// } catch (IOException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
System.out.println("结束");
setVisible(false);
progressBarThread.setBool(false);
progressBarThread.interrupt();
MessageBox.post("导出完成!", "提示", MessageBox.INFORMATION);
return;
}
ResultSet dbQuery2 = control.dbQuery3(sql2);
System.out.println(sql1);
@ -582,7 +1223,7 @@ public class DFL038Jframe extends JFrame {
createCell.setCellStyle(cellStyle);
createCell.setCellValue(title[j]);
}
Boolean flag = false;
Boolean isRelease = true;
String lastChangeFormId = null;
while (dbQuery.next()) {
@ -687,13 +1328,15 @@ public class DFL038Jframe extends JFrame {
if (dbQuery2.getString(3).equals(list.get(j))) {
System.out.println(dbQuery2.getString(3));
for (int n = 0; n < changeType.length; n++) {
System.out.println(dbQuery2.getString(2) + "===" + changeType[n]);
if (dbQuery2.getString(2) != null && dbQuery2.getString(2).equals(changeType[n])) {
System.out.println(dbQuery2.getString(2) + "===" +dbQuery2.getString(1)+ "===" + changeType[n]);
if (dbQuery2.getString(2) != null
&& flag?dbQuery2.getString(2).equals(changeType[n]):dbQuery2.getString(2).contains(changeType[n])) {
XSSFCell createCell = rows[j].createCell(n + 1);
createCell.setCellStyle(cellStyle);
createCell.setCellValue(dbQuery2.getString(1));
num[n] += Integer.parseInt(dbQuery2.getString(1));
if (!year.equals(rows[j].getCell(0).getStringCellValue().substring(0, 4))) {
if (!year.equals(
rows[j].getCell(0).getStringCellValue().substring(0, 4))) {
System.out.println(list);
System.out.println(year);
XSSFRow row = sheet1.createRow(lastRN++);
@ -783,11 +1426,13 @@ public class DFL038Jframe extends JFrame {
System.out.println("结束");
setVisible(false);
progressBarThread.setBool(false);
progressBarThread.interrupt();
MessageBox.post("导出完成!", "提示", MessageBox.INFORMATION);
}
}).start();
setVisible(false);
}
});
@ -978,7 +1623,7 @@ public class DFL038Jframe extends JFrame {
CellRangeAddress region = new CellRangeAddress(startRow, i - 1, 0, 0);
sheet.addMergedRegion(region);
for (int j = 1; j < title.length; j++) {
if (j == 10 || j == 11 || j == 12 || j == 13 || j == 14) {
if (j == 11 || j == 12 || j == 13 || j == 14 || j == 15) {
continue;
}
region = new CellRangeAddress(startRow, i - 1, j, j);
@ -1018,8 +1663,7 @@ public class DFL038Jframe extends JFrame {
for (int i = 0; i < array.length; i++) {
if (val == null) {
back[i] = array[i];
}
else {
} else {
back[i] = array[i] + val[i];
}
}
@ -1034,5 +1678,7 @@ public class DFL038Jframe extends JFrame {
// String currentTime = df.format(date);
// String absoluteFilePath = "更改通知单报表-"+currentTime;
// System.out.println(absoluteFilePath);
String string = "QECN0002131/01";
// System.out.println(string.substring(0,string.indexOf("/")));
}
}

@ -194,7 +194,7 @@ public class DFL038JframeProtol extends JFrame{
DataBaseControl control = new DataBaseControl("oracle.jdbc.driver.OracleDriver",
"jdbc:oracle:thin:@192.168.1.138:1521/tc12",
"jdbc:oracle:thin:@192.168.1.152:1521/plmdb",
"infodba",
"infodba");
control.openDataBase();

@ -15,7 +15,7 @@ import java.util.Map;
import java.util.UUID;
import org.apache.axis2.addressing.AddressingConstants.Final;
import org.jacorb.idl.runtime.int_token;
//import org.jacorb.idl.runtime.int_token;
import com.connor.dfl.plm.dfl020.ChirldBomBean;
import com.connor.dfl.plm.dfl020.FatherBomLineBean;
@ -76,26 +76,28 @@ public class BomToErp extends AbstractAIFOperation{
private String zhangtao;
private AutoSign as = null;
String zong;
private int flag;
String z_peizhi = "";
String outString = "";
private String txt_pinhao;
private List<FatherBomLineBean> list = new ArrayList<FatherBomLineBean>();
public BomToErp(AbstractAIFApplication app, TCSession session ,String accountSet,String zhangtao) {
public BomToErp(AbstractAIFApplication app, TCSession session ,String accountSet,String zhangtao,int flag) {
this.app = app;
this.session = session;
this.accountSet = accountSet;
this.as=new AutoSign();
this.zhangtao = zhangtao;
this.flag = flag;
}
public BomToErp(AbstractAIFApplication app, TCSession session) {
public BomToErp(AbstractAIFApplication app, TCSession session,int flag) {
this.app = app;
this.session = session;
this.as=new AutoSign();
this.flag = flag;
String[] stringArrays = session.getPreferenceService().getStringValues("DFL_zhangtao");
String[] BOMZT = session.getPreferenceService().getStringValues("DFL_ERPBom_zhangtao");
if (BOMZT == null || BOMZT.length <= 0 ) {
@ -147,7 +149,7 @@ public class BomToErp extends AbstractAIFOperation{
}
public void sendBOMTOERP(AbstractAIFApplication app) {
public void sendBOMTOERP(TCComponentItem item) {
//InterfaceAIFComponent[] comp = app.getTargetComponents();
InterfaceAIFComponent[] comp = app.getTargetComponents();
String uid ="";
@ -166,16 +168,8 @@ public class BomToErp extends AbstractAIFOperation{
pre = null;//
result = null;//
TCComponentItemRevision rev = null;
TCComponentItem item =null;
try {
if(comp[0] instanceof TCComponentItem ) {
item = (TCComponentItem) comp[0];
}
rev = item.getLatestItemRevision();
//获取描述属性
System.out.print(item.getProperty("object_string"));
@ -207,29 +201,30 @@ public class BomToErp extends AbstractAIFOperation{
//生产xml文件
protected void createXMLFile(TCComponentBOMLine line ,String zhangtao) throws TCException, IOException {
List<FatherBomLineBean> list = new ArrayList<FatherBomLineBean>();
StringBuilder uidSB = new StringBuilder();
String weiyi_id = "";
//List<FatherBomLineBean> list = new ArrayList<FatherBomLineBean>();
try {
getBOMValue(line,list);
if(list.size() <=0) {
MessageBox.post("您传递的BOM都已经传递到ERP,请检查", "提示",
MessageBox.post("BOM 传递失败请检查BOM行是否正确", "提示",
MessageBox.INFORMATION);
return;
}
} catch (Exception e) {
// TODO: handle exception
MessageBox.post("BOM 传递失败请检查BOM行是否正确" ,"提示",MessageBox.INFORMATION);
MessageBox.post("BOM 传递失败请检查BOM行是否正确!" ,"提示",MessageBox.INFORMATION);
e.printStackTrace();
return;
}
//获取父 属性
String userName = session.getUser().getUserName();
for(int f_index = 0;f_index< list.size();f_index++) {
StringBuilder sb2 = new StringBuilder();
StringBuilder uidSB = new StringBuilder();
Date date = new Date();
SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmm");
SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
String plmls = df.format(date);
String userName = session.getUser().getUserName();
String s1 ="<Request><Access><Authentication user=\"tiptop\" password=\"tiptop\"/><Connection application=\"NEWPLM\" source=\"192.168.1.137\"/>";
String s1 ="<Request><Access><Authentication user=\"tiptop\" password=\"tiptop\"/><Connection application=\"NEWPLM\" source=\"192.168.1.153\"/>";
String s3 = "<Organization name=\""+zhangtao+"\"/><Locale language=\"zh_cn\"/></Access><RequestContent><Parameter><Record><Field name=\"status\" value=\"Y\"/>";
String s4 = "<Field name=\"bmx10\" value=\""+userName+"\"/><Field name=\"smyslip\" value=\"4101\"/><Field name=\"ws_name\" value=\"CreatePLMBOMData\"/>";
String s5 = "<Field name=\"datakey\" value=\""+plmls+"\"/><Field name=\"tot_cnt\" value=\"1\"/><Field name=\"sub_cnt\" value=\"1\"/>";
@ -240,11 +235,12 @@ public class BomToErp extends AbstractAIFOperation{
sb2.append(s4);
sb2.append(s5);
sb2.append(s6);
for(int f_index = 0;f_index< list.size();f_index++) {
uidSB.append(list.get(f_index).getItem_uid());
if(f_index< list.size()-1) {
uidSB.append(";");
}
int iii = f_index+1;
System.out.println("==== 第"+ iii+"个配置");
System.out.println("******品号"+list.get(f_index).getPinhao()+"*****");
@ -273,6 +269,7 @@ public class BomToErp extends AbstractAIFOperation{
String yongliang = null;
String work_id =null;
String cha_jian =null;
String beizhu = null;
if( bean.getYonglian()==null) {
yongliang = "";
}else {
@ -290,23 +287,43 @@ public class BomToErp extends AbstractAIFOperation{
}else {
cha_jian = bean.getChajian_id();
}
if (bean.getBeizhu()==null) {
beizhu = "";
} else {
beizhu = bean.getBeizhu();
if(beizhu.contains("&")) {
beizhu = beizhu.replace("&", "&amp;");
}
if(beizhu.contains("<")) {
beizhu = beizhu.replace("<", "&lt;");
}
if(beizhu.contains(">")) {
beizhu = beizhu.replace(">", "&gt;");
}
if(beizhu.contains("\"")) {
beizhu = beizhu.replace("\"", "&quot;");
}
}
String xh = "<Record><Field name=\"bmb02\" value=\""+i+"\"/>";
String yj = "<Field name=\"bmb03\" value=\""+bean.getPinhao()+"\"/>";
String sxrq = "<Field name=\"bmb04\" value=\""+bean.getDate()+"\"/>";
String yl = "<Field name=\"bmb06\" value=\""+yongliang+"\"/>";
String zybh = "<Field name=\"bmb09\" value=\""+work_id+"\"/>";
String xjwz = "<Field name=\"bmb13\" value=\""+cha_jian+"\"/>";
String bz = "<Field name=\"bmbud01\" value=\""+beizhu+"\"/>";
String plmkey ="<Field name=\"bmb37\" value=\""+bean.getPlmkey()+"\"/></Record>";
sb2.append(xh);
sb2.append(yj);
sb2.append(sxrq);
sb2.append(yl);
sb2.append(zybh);
sb2.append(xjwz);
sb2.append(xh);//序号
sb2.append(yj);//id
sb2.append(sxrq);//生效日期
sb2.append(yl);//
sb2.append(zybh);//作业编号
sb2.append(xjwz);//
sb2.append(bz);
sb2.append(plmkey);
}
sb2.append("</Detail></RecordSet>");
}
String bottomS ="</Document></RequestContent></Request>";
@ -314,15 +331,23 @@ public class BomToErp extends AbstractAIFOperation{
outPutInfo = sb2.toString();
System.out.println("================"+outPutInfo);
String fileName ="BOM"+ plmls;
String fileName ="BOM"+ list.get(f_index).getPinhao()+plmls;
String tempPath = System.getProperty("java.io.tmpdir");
String uid_fileName ="BOM-UID"+list.get(f_index).getPinhao()+ plmls;
System.out.println("10.20temp路径======="+tempPath);
//String path = "D:\\SENDTOERPLOG\\" + fileName + ".txt";
String path = tempPath + fileName + ".txt";
String path1 = tempPath + uid_fileName + ".txt";
File file = new File(path);
File file1 = new File(path1);
if (!file.exists()) {
//file.getParentFile().mkdirs();
file.createNewFile();
}
if (!file1.exists()) {
//file.getParentFile().mkdirs();
file1.createNewFile();
}
try {
FileOutputStream fos = new FileOutputStream(file);
fos.write(outPutInfo.getBytes());
@ -348,13 +373,21 @@ public class BomToErp extends AbstractAIFOperation{
System.out.println("=======================唯一识别码" +weiyi_id);
//if(f_index > 0 && f_index%60 == 0) {
String uidString = uidSB.toString();
try {
FileOutputStream fos2 = new FileOutputStream(file1);
fos2.write(uidString.getBytes());
fos2.flush();
fos2.close();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
as.insertNewTxtFile(fileName,file, weiyi_id,session.getUser().getUid() , url, user, password,"CreatePLMBOMDataRequest",list.get(0).getPinhao(),zhangtao,session.getUser().getUserId(),uidSB.toString());
// as.insertNewTxtFile(fileName,file,weiyi_id,session.getUser().getUid(), url, user, password ,"CreateItemMasterData");
as.insertNewTxtFile(path,fileName, weiyi_id,session.getUser().getUid() , url, user, password,"CreatePLMBOMDataRequest",list.get(f_index).getPinhao(),zhangtao,session.getUser().getUserId(),path1,uid_fileName,session);
file.delete();
}
}
@ -374,11 +407,20 @@ public class BomToErp extends AbstractAIFOperation{
String fuID = rev.getStringProperty("item_id");
fuID = fuID.replace("-Y", "");
String fuType = rev.getStringProperty("object_type");
String revId = rev.getStringProperty("item_revision_id");
System.out.println("flag====="+ flag);
if ("T2_outsourceRevision".equals(fuType) )
{
String revId = rev.getStringProperty("item_revision_id");
if(flag == 1 || flag == 2) {
fuID = fuID + revId;
}
}
if(flag == 2) {
if ("T2_VirtualRevision".equals(fuType))
{
fuID = fuID + revId;
}
}
fatherBean.setPinhao(fuID);
fatherBean.setItem_uid(rev.getUid());
int childLineNum = 0;
@ -389,19 +431,20 @@ public class BomToErp extends AbstractAIFOperation{
if ((childComp instanceof TCComponentBOMLine))
{
TCComponentBOMLine childLine = (TCComponentBOMLine)childComp;
String occType = childLine.getStringProperty("TCAI_OCC_TYPE");
String num = childLine.getStringProperty( "T2_ActualConsumption");//实际用量
if(num==null||"".equals(num.trim())) {
num = childLine.getStringProperty( "T2_DesignQuantity");//设计用量
if(num==null||"".equals(num.trim())) {
num = childLine.getStringProperty( "bl_quantity");//用量
// if(num==null||"".equals(num.trim())) {
// int num1=1;
// num =String.valueOf(num1);//默认为1
// }
if(num==null||"".equals(num.trim())) {
num = "1";
}
}
}
System.out.println("num=============="+num);
if(childLine.isPacked() && "已打包的注释".equals(num))
//如果是数量为“已打包的注释”则解包
if(childLine.isPacked() || "已打包的注释".equals(num) || "已打包的注释".equals(occType))
{
childLine.unpack();
ispack = true;
@ -423,7 +466,7 @@ public class BomToErp extends AbstractAIFOperation{
String occType = childLine.getStringProperty("TCAI_OCC_TYPE");
if (!"Reference".equals(occType))
{
getChildValue(childLine, z_list, childLineNum,idList);
getChildValue(childLine, z_list, childLineNum,idList,flag);
childLineNum++;
}
}
@ -459,7 +502,7 @@ public class BomToErp extends AbstractAIFOperation{
// TODO Auto-generated method stub
return null;
}
public void getChildValue(TCComponentBOMLine childLine, List<ChirldBomBean> z_list,int childLineNum,List<String> idList) {
public void getChildValue(TCComponentBOMLine childLine, List<ChirldBomBean> z_list,int childLineNum,List<String> idList,int flag) {
try {
String occType = childLine.getStringProperty("TCAI_OCC_TYPE");
if("Reference".equals(occType)) {
@ -516,10 +559,23 @@ public class BomToErp extends AbstractAIFOperation{
System.out.println("childType============"+childType);
if("T2_outsource".equals(childType)) {
StringBuilder sb = new StringBuilder(childID);
sb.append(childRev);
//sb.append(childRev);
childID = sb.toString();
}
System.out.println("childID2============"+childID);
System.out.println("flag====="+ flag);
if ("T2_outsource".equals(childType))
{
if(flag == 1 || flag == 2) {
childID = childID + childRev;
}
}
if(flag == 2) {
if ("T2_Virtual".equals(childType))
{
childID = childID + childRev;
}
}
childBean.setPinhao(childID);//元件。也就是品号
//将获取到的date类型转换为String类型
java.text.SimpleDateFormat formatter = new SimpleDateFormat( "yyyy/MM/dd");

@ -20,7 +20,7 @@ import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import org.jacorb.idl.runtime.int_token;
//import org.jacorb.idl.runtime.int_token;
import com.connor.dfl.plm.dfl019.Dfl019Operation;
import com.connor.dfl.plm.dfl020.Dfl020Operation;
@ -98,14 +98,17 @@ public class CreateNoemBOMDialogs extends AbstractAIFDialog {
private String[] newArr;
private String bomCode;
private String xunigroup;
private int flag2 = 0;
private TCComponentItem item = null;
private List<TCComponentItemRevision> xunirevlist = new ArrayList<TCComponentItemRevision>();;
public CreateNoemBOMDialogs(AbstractAIFApplication app,InterfaceAIFComponent targetComp) {
public CreateNoemBOMDialogs(AbstractAIFApplication app,InterfaceAIFComponent targetComp, int flag) {
super();
this.app = app;
this.session = session;
this.service = session.getPreferenceService();
this.targetComp = targetComp;
this.flag2 = flag;
}
@Override
@ -155,7 +158,7 @@ public class CreateNoemBOMDialogs extends AbstractAIFDialog {
//this.setAlwaysOnTop(true);
this.setLayout(null);
TCComponentItem item = null;
//new标签对象
bomCode_lable = new JLabel(" 设备型号 :");
//new下拉框对象
@ -251,8 +254,8 @@ public class CreateNoemBOMDialogs extends AbstractAIFDialog {
//创建标准bom
createItem();
//bom传递erp
BomToErp bomToErp =new BomToErp(app, session);
bomToErp.sendBOMTOERP(app);
BomToErp bomToErp =new BomToErp(app, session,flag2);
bomToErp.sendBOMTOERP(item);
try {
ChangeDbomUtil.setByPass(false);
System.out.println("关旁路");
@ -389,6 +392,7 @@ public class CreateNoemBOMDialogs extends AbstractAIFDialog {
TCComponentItem newItem =null;
TCComponentItemRevision xunirev = null;
for (int j = 0; j < values.length; j++) {
System.out.println(" values-----------11.2=="+ values[j]);
String[] nameID = values[j].split("\\|");
String item_id = equipmentname + "" + nameID[0];
String sysandjob =nameID[1];//系统名称$作业编号
@ -449,7 +453,7 @@ public class CreateNoemBOMDialogs extends AbstractAIFDialog {
}
//物料传递erp
wuliaotoerp wuliaotoerp = new wuliaotoerp(app, session);
wuliaotoerp.Wuliaotoerp(xunirevlist);
wuliaotoerp.Wuliaotoerp(xunirevlist,flag2);
view.save();
view.unlock();

@ -1,19 +1,97 @@
package com.connor.dfl.plm.dfl041;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.common.NotDefinedException;
import com.connor.dfl.plm.dfl020.Dfl020Operation;
import com.connor.dfl.plm.dfl020.Dfl020Operation2;
import com.connor.dfl.plm.dfl0201.Dfl0201Operation;
import com.connor.dfl.plm.dfl0201.Dfl0201Operation2;
import com.connor.dfl.plm.dfl0201.Dfl0201Operation3;
import com.connor.dfl.plm.dfl0201.SelectDialog;
import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
import com.teamcenter.rac.aifrcp.AIFUtility;
import com.teamcenter.rac.kernel.TCComponentGroup;
import com.teamcenter.rac.kernel.TCComponentItem;
import com.teamcenter.rac.kernel.TCComponentItemRevision;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.util.MessageBox;
public class Dfl041Handler extends AbstractHandler {
public Object execute(ExecutionEvent arg0) throws ExecutionException {
AbstractAIFApplication app = AIFUtility.getCurrentApplication();
InterfaceAIFComponent com = app.getTargetComponent();
CreateNoemBOMDialogs createEquipment = new CreateNoemBOMDialogs(app ,com);
TCSession session = (TCSession) app.getSession();
int flag = 0;
try {
TCComponentGroup group = session.getCurrentGroup();
String group_name = group.getStringProperty("display_name");
// if(group_name.contains("包装技术")|| group_name.contains("JCBZ")) {
// if(com instanceof TCComponentItem) {
// TCComponentItem item = (TCComponentItem) com;
// String type = item.getType();
// if("T2_Equipment".equals(type)) {
// Date createDate = item.getDateProperty("creation_date");
// SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd" );
// Date d = sdf.parse("2022-11-01");
// if(createDate.after(d)) {
// flag = 0;
// }else {
// flag = 2;
// }
// }else {
// MessageBox.post("请选择设备对象进行操作,请检查!!",
// "错误", MessageBox.ERROR);
// return null;
// }
// }
// }else{
// flag = 1;
// }
//2023/2/12修改
if(com instanceof TCComponentItem) {
TCComponentItem item = (TCComponentItem) com;
String type = item.getType();
if("T2_Equipment".equals(type)) {
Date createDate = item.getDateProperty("creation_date");
SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd" );
Date d = null;
if(group_name.contains("包装技术")|| group_name.contains("JCBZ")) {
d = sdf.parse("2022-11-01");
}else {
d = sdf.parse("2023-03-10");
}
if(createDate.after(d)) {
flag = 0;
}else {
flag = 2;
}
}else {
MessageBox.post("请选择设备对象进行操作,请检查!!",
"错误", MessageBox.ERROR);
return null;
}
}
// String name = arg0.getCommand().getName();
// if("创建标准Bom-拼接版本".equals(name)) {
// flag = 1;
// }else if("创建标准Bom-拼接版本-包含虚拟件".equals(name)) {
// flag = 2;
// }
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
CreateNoemBOMDialogs createEquipment = new CreateNoemBOMDialogs(app ,com,flag);
new Thread(createEquipment).start();
return null;
}

@ -103,7 +103,7 @@ public class wuliaotoerp extends AbstractAIFOperation{
}
public void Wuliaotoerp(List<TCComponentItemRevision> revlist) throws Exception {
public void Wuliaotoerp(List<TCComponentItemRevision> revlist,int flag2) throws Exception {
// InterfaceAIFComponent[] comp = app.getTargetComponents();
// if(comp == null || comp.length <= 0) {
// MessageBox.post("请选中的要传递ERP的对象!!!!","提示",MessageBox.INFORMATION);
@ -136,7 +136,7 @@ public class wuliaotoerp extends AbstractAIFOperation{
List<String> errList = new ArrayList<String>();
List<ItemBean> beanList = getItemValue(revlist,errList);
List<ItemBean> beanList = getItemValue(revlist,errList,flag2);
//解开循环
// for (int i = 0; i < revlist.size(); i++) {
// revs = new TCComponentItemRevision();
@ -184,7 +184,7 @@ public class wuliaotoerp extends AbstractAIFOperation{
}
public List<ItemBean> getItemValue(List<TCComponentItemRevision> revslist,List<String> errList) throws TCException {
public List<ItemBean> getItemValue(List<TCComponentItemRevision> revslist,List<String> errList,int index) throws TCException {
List<ItemBean> beanList = new ArrayList<ItemBean>();
boolean flag = false;
//循环遍历revslist
@ -192,13 +192,13 @@ public class wuliaotoerp extends AbstractAIFOperation{
//定义设置属性的版本为setrev
TCComponentItemRevision setrev = (TCComponentItemRevision)revslist.get(i);
flag = setvalues(beanList,setrev,errList);
flag = setvalues(beanList,setrev,errList,index);
}
return beanList;
}
//设置属性
public boolean setvalues(List<ItemBean> beanList, TCComponentItemRevision rev, List<String> errList) throws TCException {
public boolean setvalues(List<ItemBean> beanList, TCComponentItemRevision rev, List<String> errList,int index) throws TCException {
// TODO Auto-generated method stub
boolean flag2 = false;
//if(comp instanceof TCComponentItemRevision || comp instanceof TCComponentBOMLine) {
@ -210,11 +210,22 @@ public class wuliaotoerp extends AbstractAIFOperation{
String brand ="";
String id ="";
String oldMateriel ="";
String rev_id ="";
try {
//获取属性
String type = rev.getStringProperty("object_type");
id = rev.getStringProperty("item_id");
rev_id = rev.getStringProperty("item_revision_id");
if("T2_outsourceRevision".equals(type)) {
if(index == 1 || index == 2) {
id = id + rev_id;
}
}else if("T2_VirtualRevision".equals(type)) {
if(index == 2) {
id = id + rev_id;
}
}
//对-Y的处理
if(id.contains("-Y")) {
id = id.replace("-Y", "");
@ -280,9 +291,10 @@ public class wuliaotoerp extends AbstractAIFOperation{
protected void createXMLFile(List<ItemBean> beanList ,String zhangtao) throws TCException, IOException {
String weiyi_id = "";
Date date = new Date();
SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmm");
SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
StringBuilder uidSB = new StringBuilder();
String fileName = session.getUser().getUserName()+ "-" +df.format(date);
String fileName = "WL-"+ beanList.get(0).getItem_id() + "-" +df.format(date);
String uid_fileName ="WL-UID-"+ beanList.get(0).getItem_id() +"-"+df.format(date);
// String s1 = "<?xml version=\"1.0\"?><Request><Access><Authentication user=\"tiptop\" password=\"tiptop\" /><Connection source=\"192.168.1.8\" application=\"PLM\"/>";
// String s2 ="<Organization name=\""+AccountSet+"\"/><Locale language=\"zh_cn\"/></Access><RequestContent><Parameter><Record>";
@ -291,13 +303,13 @@ public class wuliaotoerp extends AbstractAIFOperation{
String sss1 = "<Request><Access><Authentication user=\"tiptop\" password=\"tiptop\"/><Connection application=\"NEWPLM\" source=\"192.168.1.137\"/><Organization name=\""+zhangtao+"\"/>";
String sss1 = "<Request><Access><Authentication user=\"tiptop\" password=\"tiptop\"/><Connection application=\"NEWPLM\" source=\"192.168.1.153\"/><Organization name=\""+zhangtao+"\"/>";
String sss2 ="<Locale language=\"zh_cn\"/></Access><RequestContent><Parameter><Record><Field name=\"status\" value=\"Y\"/><Field name=\"ws_name\" value=\"CreateItemMasterData\"/><Field name=\"datakey\" value=\"";
String sss3= "\"/><Field name=\"tot_cnt\" value=\"\"/><Field name=\"sub_cnt\" value=\"1\"/></Record></Parameter><Document>";
tops = sss1 + sss2;
String bottom ="</Document></RequestContent></Request>";
int j = 1;
int o = 1;
StringBuilder sss3SB = new StringBuilder();
StringBuilder xmlSB = new StringBuilder();
for (int i = 0; i < beanList.size(); i++) {
@ -309,62 +321,40 @@ public class wuliaotoerp extends AbstractAIFOperation{
String n = n1 + n2 + n3;
xmlSB.append(n);
j++;
if(i > 0 && i%60 == 0) {
sss3SB.append(fileName);
sss3SB.append("-"+o++);
sss3SB.append(sss3);
sss3SB.append(xmlSB.toString());
String zong= tops + sss3SB.toString()+bottom;
System.out.println(zong);
String tempPath = System.getProperty("java.io.tmpdir");
String path = tempPath + fileName + ".txt";
File file = new File(path);
if (!file.exists()) {
//file.getParentFile().mkdirs();
file.createNewFile();
}
try {
FileOutputStream fos = new FileOutputStream(file);
fos.write(zong.getBytes());
fos.flush();
fos.close();
weiyi_id = getId();
System.out.println("=======================Ψһʶ±ðÂë" +weiyi_id);
as.insertNewTxtFile(fileName,file,weiyi_id,session.getUser().getUid(), url, user, password ,"CreateItemMasterDataRequest",beanList.get(0).getItem_id(),zhangtao,session.getUser().getUserId(),uidSB.toString());
file.delete();
weiyi_id = "";
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
j = 1;
uidSB = new StringBuilder();
xmlSB = new StringBuilder();
sss3SB = new StringBuilder();
continue;
}
if(i < beanList.size()-1) {
uidSB.append(";");
}
}
if(!("".equals(uidSB.toString()))) {
sss3SB.append(fileName);
sss3SB.append("-"+o++);
sss3SB.append(sss3);
sss3SB.append(xmlSB.toString());
String zong= tops + sss3SB.toString()+bottom;
System.out.println(zong);
String tempPath = System.getProperty("java.io.tmpdir");
System.out.println("10.20temp·¾¶======="+tempPath);
//String path = "D:\\SENDTOERPLOG\\" + fileName + ".txt";
String path = tempPath + fileName + ".txt";
String path1 = tempPath + uid_fileName + ".txt";
File file = new File(path);
if (!file.exists()) {
//file.getParentFile().mkdirs();
file.createNewFile();
}
File file1 = new File(path1);
if (!file1.exists()) {
//file.getParentFile().mkdirs();
file1.createNewFile();
}
try {
FileOutputStream fos2 = new FileOutputStream(file1);
fos2.write(uidSB.toString().getBytes());
fos2.flush();
fos2.close();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
FileOutputStream fos = new FileOutputStream(file);
fos.write(zong.getBytes());
@ -375,8 +365,7 @@ public class wuliaotoerp extends AbstractAIFOperation{
System.out.println("=======================唯一识别码" +weiyi_id);
as.insertNewTxtFile(fileName,file,weiyi_id,session.getUser().getUid(), url, user, password ,"CreateItemMasterDataRequest",beanList.get(0).getItem_id(),zhangtao,session.getUser().getUserId(),uidSB.toString());
file.delete();
as.insertNewTxtFile(path,fileName,weiyi_id,session.getUser().getUid(), url, user, password ,"CreateItemMasterDataRequest",beanList.get(0).getItem_id(),zhangtao,session.getUser().getUserId(),path1,uid_fileName,session);
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();

@ -28,7 +28,7 @@ import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableRowSorter;
import org.jacorb.idl.runtime.int_token;
//import org.jacorb.idl.runtime.int_token;
import com.connor.dfl.plm.dfl042.ERPTransferStatusbean;
import com.connor.dfl.plm.util.DataBaseControl;
@ -43,7 +43,6 @@ import com.teamcenter.rac.util.MessageBox;
import com.teamcenter.rac.util.PropertyLayout;
import com.teamcenter.rac.util.Registry;
import sun.awt.www.content.audio.x_aiff;
public class Dfl042Dialog extends AbstractAIFDialog {
@ -63,8 +62,8 @@ public class Dfl042Dialog extends AbstractAIFDialog {
private JTextField useridField;
private JTextField specField;
private JTextField cangKField;
private StringBuilder sb = new StringBuilder("select ID,FUN,TXT_PINHAO,ZHANGTAO,USERID from DFL_SEND_TXT_TO_ERP where STATUS = 0 ");
private StringBuilder numsSb = new StringBuilder("select count(*) from DFL_SEND_TXT_TO_ERP where STATUS = 0 ");
private StringBuilder sb = new StringBuilder("select ID,FUN,TXT_PINHAO,ZHANGTAO,USERID from DFL_SEND_FILE_TO_ERP_NEW where STATUS = 0 ");
private StringBuilder numsSb = new StringBuilder("select count(*) from DFL_SEND_FILE_TO_ERP_NEW where STATUS = 0 ");
private String sql2 = "";
private JComboBox<String> zhangTBox;
private String[] columnNames = {"ÐòºÅ","ÀàÐÍ","Æ·ºÅ","ÕËÌ×","Óû§"};
@ -431,8 +430,8 @@ public class Dfl042Dialog extends AbstractAIFDialog {
public void queryResult() {
String userid = useridField.getText();
if(!("".equals(userid.trim()))) {
sb.append("and userid" + "="+userid);
numsSb.append("and userid" + "="+userid);
sb.append("and userid" + "='"+userid+"'");
numsSb.append("and userid" + "='"+userid+"'");
}
sql2 = sb.toString();
@ -452,10 +451,8 @@ public class Dfl042Dialog extends AbstractAIFDialog {
// TODO Auto-generated catch block
e.printStackTrace();
}
if(beans!=null) {
refreshTable();
}
}
}

@ -1,65 +1,32 @@
package com.connor.dfl.plm.dfl043;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.swing.filechooser.FileSystemView;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.jacorb.idl.runtime.int_token;
import com.connor.dfl.plm.dfl019.ClassPropBean;
import com.connor.dfl.plm.dfl019.ItemBean;
import com.connor.dfl.plm.dfl019.ParseXMLUtil;
import com.connor.dfl.plm.exportBOM.ChangeDbomUtil;
import com.connor.dfl.plm.util.ClassValueBean;
import com.connor.dfl.plm.util.ClassValueUtil;
import com.connor.dfl.plm.util.ProgressBarThread;
import com.teamcenter.rac.aif.AbstractAIFOperation;
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
import com.teamcenter.rac.kernel.TCClassificationService;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentBOMLine;
import com.teamcenter.rac.kernel.TCComponentBOMWindow;
import com.teamcenter.rac.kernel.TCComponentBOMWindowType;
import com.teamcenter.rac.kernel.TCComponentDataset;
import com.teamcenter.rac.kernel.TCComponentForm;
import com.teamcenter.rac.kernel.TCComponentICO;
import com.teamcenter.rac.kernel.TCComponentItem;
import com.teamcenter.rac.kernel.TCComponentItemRevision;
import com.teamcenter.rac.kernel.TCComponentQuery;
import com.teamcenter.rac.kernel.TCComponentQueryType;
import com.teamcenter.rac.kernel.TCComponentUser;
import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCProperty;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.kernel.TCTypeService;
import com.teamcenter.rac.kernel.TCUserService;
import com.teamcenter.rac.kernel.ics.ICSAdminClass;
import com.teamcenter.rac.kernel.ics.ICSAdminClassAttribute;
import com.teamcenter.rac.kernel.ics.ICSProperty;
import com.teamcenter.rac.util.MessageBox;
public class Dfl043Operation extends AbstractAIFOperation{
private InterfaceAIFComponent[] comps;
private TCSession session;
private List<String> attrList;
private List<String> errList = new ArrayList<String>();
private ProgressBarThread wait;
/**
*
@ -79,7 +46,6 @@ public class Dfl043Operation extends AbstractAIFOperation{
try {
System.out.println("开旁路");
ChangeDbomUtil.setByPass(true);
//System.out.println("9.17数量为====="+comps.length);
for (int i = 0; i < comps.length; i++) {
InterfaceAIFComponent comp = comps[i];
wait = new ProgressBarThread("填写作业编号中", "执行中,请稍等...");
@ -125,29 +91,22 @@ public class Dfl043Operation extends AbstractAIFOperation{
}
//在bom中设置将作业编号发放给结构下面所有的物料
private void setworknum(TCComponentBOMLine line) {
//System.out.println("9.17.19.519.17.19.51");
if(line instanceof TCComponentBOMLine) {
//System.out.println("9.17.19.479.17.19.47");
TCComponentItemRevision rev;
try {
//System.out.println("9.17.19.479.17.19.47");
//刷新bomline
line.refresh();
rev = line.getItemRevision();
TCProperty tcProperty = rev.getTCProperty("release_status_list");
TCComponent[] targets = tcProperty.getReferenceValueArray();
String jobid = line.getStringProperty("T2_JobNumber"); //获取作业编号
//System.out.println("9.17jobid====="+jobid);
String itemid = rev.getStringProperty("item_id"); //获取itemid
//System.out.println("9.17itemid====="+itemid);
//判断是否发布了
if(targets.length>=0) {
//判断是否有作业编号
if(jobid != null || !"".equals(jobid)) {
//判断是否有子件
AIFComponentContext[] childs = line.getChildren();
//System.out.println("9.17子级个数====="+childs.length);
if(childs != null && childs.length > 0 ) {
//循环遍历子级对象
for (int j = 0;j < childs.length;j++) {
@ -159,24 +118,18 @@ public class Dfl043Operation extends AbstractAIFOperation{
TCComponentItemRevision childrev = ((TCComponentBOMLine) childline).getItemRevision();
//获取子级的id
String childid = childrev.getStringProperty("item_id");
//System.out.println("9.17子级id====="+childid);
//获取子级的版本类型
String childtype = childrev.getStringProperty("object_type");
//System.out.println("9.17子级版本类型====="+childtype);
//获取子级的作业编号
String childjobid = childline.getStringProperty("T2_JobNumber");
//System.out.println("9.17子级作业编号====="+childjobid);
if("T2_outsourceRevision".equals(childtype) || "T2_OutBuyPartRevision".equals(childtype) || "T2_VirtualRevision".equals(childtype)) {
//System.out.println("9.17.19.21");
//判断有没有作业编号
if(childjobid == null || "".equals(childjobid) || " ".equals(childjobid)) {
//没有则设置作业编号
childline.setStringProperty("T2_JobNumber", jobid);
if("T2_VirtualRevision".equals(childtype)) {
//是虚拟件版本则递归
setworknum(childline);
//System.out.println("递归方法9.17(1)");
}else {
//不是则跳出循环,进入下一个循环
continue;
@ -187,7 +140,6 @@ public class Dfl043Operation extends AbstractAIFOperation{
if("T2_VirtualRevision".equals(childtype)) {
//是虚拟件版本则递归
setworknum(childline);
//System.out.println("递归方法9.17(2)");
}else {
//不是则跳出循环,进入下一个循环
continue;
@ -208,7 +160,6 @@ public class Dfl043Operation extends AbstractAIFOperation{
TCComponentBOMLine childline2 = (TCComponentBOMLine) childcomp2;
//递归此方法
setworknum(childline2);
//System.out.println("递归方法9.17(3)");
}
}
}

@ -29,7 +29,7 @@ import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableRowSorter;
import org.jacorb.idl.runtime.int_token;
//import org.jacorb.idl.runtime.int_token;
import com.connor.dfl.plm.dfl042.ERPTransferStatusbean;
import com.connor.dfl.plm.util.DataBaseControl;
@ -47,7 +47,6 @@ import com.teamcenter.rac.util.PropertyLayout;
import com.teamcenter.rac.util.Registry;
import com.teamcenter.soaictstubs.stringSeq_tHolder;
import sun.awt.www.content.audio.x_aiff;
public class Dfl044Dialog extends AbstractAIFDialog {
@ -231,7 +230,6 @@ public class Dfl044Dialog extends AbstractAIFDialog {
public String PriceResult(String userid) {
String Price = null;
String Select = null; //选择下拉的值
//如果零件号不为空,则拼接
Select = (String) zt_combobox.getSelectedItem();
System.out.println("11.05选择的下拉值单价======="+Select);

@ -34,7 +34,7 @@ import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableRowSorter;
import org.jacorb.idl.runtime.int_token;
//import org.jacorb.idl.runtime.int_token;
import com.connor.dfl.plm.dfl025.Dfl025Operation;
import com.connor.dfl.plm.dfl028.Dfl028AIFDialog;
@ -56,7 +56,6 @@ import com.teamcenter.rac.util.PropertyLayout;
import com.teamcenter.rac.util.Registry;
import com.teamcenter.soaictstubs.stringSeq_tHolder;
import sun.awt.www.content.audio.x_aiff;
public class Dfl045Dialog extends AbstractAIFDialog {

@ -4,6 +4,7 @@ import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
import com.teamcenter.rac.aifrcp.AIFUtility;

File diff suppressed because it is too large Load Diff

@ -3,20 +3,12 @@ package com.connor.dfl.plm.dfl046;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.handlers.HandlerUtil;
import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aifrcp.AIFUtility;
import com.teamcenter.rac.kernel.TCComponentBOMLine;
import com.teamcenter.rac.kernel.TCComponentGroup;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.pse.common.BOMLineNode;
import com.teamcenter.rac.pse.common.BOMTreeTableModel;
import com.teamcenter.rac.pse.operations.ExpandBelowOperation;
import com.teamcenter.rac.psebase.AbstractBOMLineViewerApplication;
import com.teamcenter.rac.psebase.common.AbstractViewableTreeTable;
import com.teamcenter.rac.util.AdapterUtil;
import com.teamcenter.rac.util.MessageBox;
/**
@ -42,8 +34,33 @@ public class BOMExportHandler extends AbstractHandler {
//DL2_VehicleRevision DL2_EBOM
if(app.getTargetComponent() instanceof TCComponentBOMLine){
TCSession session=(TCSession) app.getSession();
test operation=new test(app, session);
session.queueOperation(operation);
try {
TCComponentGroup group = session.getCurrentGroup();
String group_name = group.getStringProperty("display_name");
// if(group_name.contains("包装技术")|| group_name.contains("JCBZ")) {
// SelectDialog dialog = new SelectDialog(app);
// new Thread(dialog).start();
// }else{
// test2 operation = new test2(app, session);
// session.queueOperation(operation);
// }
SelectDialog dialog = new SelectDialog(app);
new Thread(dialog).start();
// String name = event.getCommand().getName();
// if("价格bom报表导出-拼接版本".equals(name)) {
// test2 operation=new test2(app, session);
// session.queueOperation(operation);
// }else {
// test operation=new test(app, session);
// session.queueOperation(operation);
// }
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}else{
MessageBox.post("ÇëÑ¡ÔñBOMLine","",2);
}

@ -1,26 +1,26 @@
package com.connor.dfl.plm.dfl046;
import java.util.List;
//import java.util.List;
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
//import com.teamcenter.rac.aif.kernel.AIFComponentContext;
//import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
import com.teamcenter.rac.aifrcp.AIFUtility;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentBOMLine;
import com.teamcenter.rac.kernel.TCComponentBOMViewRevision;
import com.teamcenter.rac.kernel.TCComponentBOMWindow;
import com.teamcenter.rac.kernel.TCComponentBOMWindowType;
import com.teamcenter.rac.kernel.TCComponentContextList;
import com.teamcenter.rac.kernel.TCComponentItemRevision;
import com.teamcenter.rac.kernel.TCComponentQuery;
import com.teamcenter.rac.kernel.TCComponentQueryType;
//import com.teamcenter.rac.kernel.TCComponent;
//import com.teamcenter.rac.kernel.TCComponentBOMLine;
//import com.teamcenter.rac.kernel.TCComponentBOMViewRevision;
//import com.teamcenter.rac.kernel.TCComponentBOMWindow;
//import com.teamcenter.rac.kernel.TCComponentBOMWindowType;
//import com.teamcenter.rac.kernel.TCComponentContextList;
//import com.teamcenter.rac.kernel.TCComponentItemRevision;
//import com.teamcenter.rac.kernel.TCComponentQuery;
//import com.teamcenter.rac.kernel.TCComponentQueryType;
import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCPreferenceService;
import com.teamcenter.rac.kernel.TCQueryClause;
//import com.teamcenter.rac.kernel.TCQueryClause;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.kernel.TCTextService;
import com.teamcenter.rac.kernel.TCTypeService;
//import com.teamcenter.rac.kernel.TCTextService;
//import com.teamcenter.rac.kernel.TCTypeService;
import com.teamcenter.rac.kernel.TCUserService;
import com.teamcenter.rac.util.MessageBox;
//import com.teamcenter.rac.util.MessageBox;
public class ChangeDbomUtil {
public static TCPreferenceService service;

@ -19,7 +19,7 @@ import org.apache.poi.xssf.usermodel.XSSFCellStyle;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.jacorb.idl.runtime.int_token;
//import org.jacorb.idl.runtime.int_token;
import com.connor.dfl.plm.dfl019.ClassPropBean;
import com.connor.dfl.plm.dfl019.ItemBean;
@ -769,7 +769,7 @@ public class test extends AbstractAIFOperation {
if("T2_outsourceRevision".equals(type)) {
xuhao1 = num ;
String classID = item_id1.substring(0, 2);
item_id1 = item_id1+rev_id1;
//item_id1 = item_id1+rev_id1;
oldid1 = rev.getStringProperty("t2_OldId");
System.out.println("classID==============="+classID);
if("51".equals(classID) || "72".equals(classID) || "76".equals(classID)) {

@ -12,6 +12,7 @@ public class AutoCreateBean {
private String importance;//重要度
private String num;//序号
private int level;//等级
public String getItem_id() {
return item_id;
}

@ -3,24 +3,15 @@ package com.connor.dfl.plm.exportBOM;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.handlers.HandlerUtil;
import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aifrcp.AIFUtility;
import com.teamcenter.rac.kernel.TCComponentBOMLine;
import com.teamcenter.rac.kernel.TCComponentGroup;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.pse.common.BOMLineNode;
import com.teamcenter.rac.pse.common.BOMTreeTableModel;
import com.teamcenter.rac.pse.operations.ExpandBelowOperation;
import com.teamcenter.rac.psebase.AbstractBOMLineViewerApplication;
import com.teamcenter.rac.psebase.common.AbstractViewableTreeTable;
import com.teamcenter.rac.util.AdapterUtil;
import com.teamcenter.rac.util.MessageBox;
/**
* Our sample handler extends AbstractHandler, an IHandler base class.
*
* @see org.eclipse.core.commands.IHandler
* @see org.eclipse.core.commands.AbstractHandler
*/
@ -32,21 +23,45 @@ public class BOMExportHandler extends AbstractHandler {
}
/**
* the command has been executed, so extract extract the needed information
* from the application context.
* the command has been executed, so extract extract the needed information from
* the application context.
*/
public Object execute(ExecutionEvent event) throws ExecutionException {
AbstractAIFApplication app = AIFUtility.getCurrentApplication();
// DL2_VehicleRevision DL2_EBOM
if(app.getTargetComponent() instanceof TCComponentBOMLine){
// if(app.getTargetComponent() instanceof TCComponentItemRevision){
TCSession session = (TCSession) app.getSession();
test operation=new test(app, session);
session.queueOperation(operation);
}else{
MessageBox.post("ÇëÑ¡ÔñBOMLine","",2);
try {
TCComponentGroup group = session.getCurrentGroup();
String group_name = group.getStringProperty("display_name");
// if(group_name.contains("包装技术")|| group_name.contains("JCBZ")) {
// SelectDialog dialog = new SelectDialog(app);
// new Thread(dialog).start();
// }else{
// test2 operation = new test2(app, session);
// session.queueOperation(operation);
// }
//2023/2/12修改
SelectDialog dialog = new SelectDialog(app);
new Thread(dialog).start();
// String name = event.getCommand().getName();
// if("导出BOM报表-拼接版本".equals(name)) {
// test2 operation = new test2(app, session);
// session.queueOperation(operation);
// }else {
// test operation = new test(app, session);
// session.queueOperation(operation);
// }
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// }else{
// MessageBox.post("请选择版本","",2);
// }
return null;
}
}

@ -19,7 +19,7 @@ import org.apache.poi.xssf.usermodel.XSSFCellStyle;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.jacorb.idl.runtime.int_token;
//import org.jacorb.idl.runtime.int_token;
import com.connor.dfl.plm.dfl019.ClassPropBean;
import com.connor.dfl.plm.dfl019.ItemBean;
@ -73,6 +73,7 @@ public class test extends AbstractAIFOperation {
private String total1 = "";// 总价
private int xuhao1;
private String zhangtao = "";
public test(AbstractAIFApplication app, TCSession session) {
this.app = app;
this.session = session;
@ -80,8 +81,7 @@ public class test extends AbstractAIFOperation {
String[] BOMZT = session.getPreferenceService().getStringValues("DFL2_ZHANGTAO_WAREHOUSE");
if (BOMZT == null || BOMZT.length <= 0) {
MessageBox.post("首选项DFL2_ZHANGTAO_WAREHOUSE未配置,请联系管理员!!",
"错误", MessageBox.ERROR);
MessageBox.post("首选项DFL2_ZHANGTAO_WAREHOUSE未配置,请联系管理员!!", "错误", MessageBox.ERROR);
return;
}
TCComponentGroup group = session.getCurrentGroup();
@ -109,37 +109,79 @@ public class test extends AbstractAIFOperation {
e.printStackTrace();
}
}
@Override
public void executeOperation() throws Exception {
// TCUserService service = session.getUserService();
// ParseXMLUtil xml=new ParseXMLUtil();
// File classfile=xml.getSXX("DFL_CLASS_Xml", session);
// attrList =xml.parseXMLCode(classfile);
// try {
//
// } catch (TCException e2) {
// e2.printStackTrace();
// }
TCComponentItemRevision rev = null;
TCComponentItem item = null;
try {
System.out.println("开旁路");
ChangeDbomUtil.setByPass(true);
} catch (TCException e2) {
e2.printStackTrace();
}
try {
System.out.println("开始获取BOM模板");
String puid = session.getPreferenceService().getStringValue("DFL3_BOM_UID");
System.out.println("puid======================" + puid);
if (puid == null || "".equals(puid)) {
MessageBox.post("首选项DFL3_BOM_UID未配置,请联系管理员!!",
"错误", MessageBox.ERROR);
MessageBox.post("首选项DFL3_BOM_UID未配置,请联系管理员!!", "错误", MessageBox.ERROR);
return;
}
TCComponentDataset excel = (TCComponentDataset) session.stringToComponent(puid);
File file = ((TCComponentDataset) excel).getTcFiles()[0].getFmsFile();
InterfaceAIFComponent[] comp = app.getTargetComponents();
for (int i = 0; i < comp.length; i++) {
TCComponentBOMLine line = null;
String item_id = null;
if (comp[0] instanceof TCComponentItemRevision) {
rev = (TCComponentItemRevision) comp[i];
item = rev.getItem();
item_id = item.getStringProperty("item_id");
TCTypeService service = session.getTypeService();
// 获取BOMWindowType
TCComponentBOMWindowType winType = (TCComponentBOMWindowType) service.getTypeComponent("BOMWindow");
// 创建一个新的window
TCComponentBOMWindow view = winType.create(null);
line = view.setWindowTopLine(item, rev, null, null);
} else if (comp[0] instanceof TCComponentBOMLine) {
TCComponentBOMLine get_bom_line = (TCComponentBOMLine) comp[0];
rev = get_bom_line.getItemRevision();
item = rev.getItem();
item_id = item.getStringProperty("item_id");
TCTypeService service = session.getTypeService();
// 获取BOMWindowType
TCComponentBOMWindowType winType = (TCComponentBOMWindowType) service.getTypeComponent("BOMWindow");
// 创建一个新的window
TCComponentBOMWindow view = winType.create(null);
line = view.setWindowTopLine(item, rev, null, null);
}else {
MessageBox.post("系统错误,请联系管理员!","错误",MessageBox.ERROR);
}
SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");// 设置日期格式
String time = df.format(new Date());
FileSystemView fsv = FileSystemView.getFileSystemView();
String pathRoute = fsv.getHomeDirectory().getPath() + File.separator + "BOM汇总表" + time + ".xlsx";
String pathRoute1 = fsv.getHomeDirectory().getPath() + File.separator + "BOM对照表" + time + ".xlsx";
String pathRoute1 = fsv.getHomeDirectory().getPath() + File.separator + item_id + "BOM对照表" + time
+ ".xlsx";
wait = new ProgressBarThread("导出对照表", "执行中,请稍等...");
wait.start();// 开启进度条
TCComponentBOMLine line = (TCComponentBOMLine) app.getTargetComponent();
// TCComponentBOMLine line = (TCComponentBOMLine) comp[i];
// TCComponentBOMLine line = (TCComponentBOMLine) app.getTargetComponent();
xuanzhongid = line.getStringProperty("awb0BomLineItemId");
try {
int level = 0;
@ -161,14 +203,20 @@ public class test extends AbstractAIFOperation {
MessageBox.post("生成报表失败" + e.getMessage(), "错误", MessageBox.ERROR);
return;
}
wait.setBool(true);// 关闭进度条
wait.interrupt();
MessageBox.post("生成报表完成,请查看", "完成", MessageBox.INFORMATION);
Runtime.getRuntime().exec("cmd /c \"" + pathRoute + "\"");
Runtime.getRuntime().exec("cmd /c \"" + pathRoute1 + "\"");
}
} catch (Exception e) {
e.printStackTrace();
}
try {
ChangeDbomUtil.setByPass(false);
} catch (TCException e2) {
@ -177,7 +225,6 @@ public class test extends AbstractAIFOperation {
}
// 对照表的获取方法
private void getAndSetValue1(TCComponentBOMLine bomLine, int level, int num) {
@ -223,10 +270,10 @@ public class test extends AbstractAIFOperation {
// 判断是否属于bomline
if (comp instanceof TCComponentBOMLine) {
// 判断是否为无需传递的物料
if (!"Reference".equals(occType))
{
if ("Reference".compareToIgnoreCase(((TCComponentBOMLine) comp).getStringProperty("TCAI_OCC_TYPE"))!=0) {
// 如果版本类型是外购件版本或者外协件版本则获取属性
if ("T2_outsourceRevision".equals(type) || "T2_OutBuyPartRevision".equals(type)) {
System.out.println("reference=====>"+((TCComponentBOMLine) comp).getStringProperty("TCAI_OCC_TYPE"));
// 将遍历的对象强转类型为bomline
TCComponentBOMLine ziLine = (TCComponentBOMLine) comp;
wai.add(ziLine);
@ -242,7 +289,6 @@ public class test extends AbstractAIFOperation {
// 处理外购外协的数据
if (wai.size() > 0) {
for (int i = 0; i < wai.size(); i++) {
num++;
TCComponentBOMLine waiLine = wai.get(i);
@ -250,14 +296,42 @@ public class test extends AbstractAIFOperation {
List<String> beanList1 = new ArrayList<String>();
double a = Double.valueOf(xuninum).doubleValue();
System.out.println("a--915======"+a);
double b = Double.valueOf(design_num1).doubleValue();
System.out.println("b--915======"+b);
// double c = Double.valueOf(firstnum).doubleValue();
// System.out.println("c--915======"+c);
double d = a*b;
design_num1 = ""+d;
//如果虚拟键有父级 和 父父级 把数量 乘上
// System.out.println("9.22虚拟件id === ==="+xuniid);
String id = "";
double count = Double.valueOf(design_num1).doubleValue();
int z = 0;
System.out.println("iddddd="+item_id1);
TCComponentBOMLine parent = waiLine.parent();
// String tempId = waiLine.getStringProperty("awb0BomLineItemId");
// while(!xuanzhongid.equals(id)) {
while(z < 4) {
if(parent != null) {
id = parent.getStringProperty("awb0BomLineItemId");
System.out.println("ID-----"+id);
String quantity = parent.getStringProperty("bl_quantity");
if(quantity != null && quantity.length() > 0 ) {
count = count * Double.valueOf(quantity).doubleValue();
parent = parent.parent();
}
}else {
System.out.println("111111111");
break;
}
z++;
}
// double a = Double.valueOf(xuninum).doubleValue();
// System.out.println("a--915======" + a);
// double b = Double.valueOf(design_num1).doubleValue();
// System.out.println("b--915======" + b);
//// double c = Double.valueOf(firstnum).doubleValue();
//// System.out.println("c--915======"+c);
//
// double d = a * b;
design_num1 = "" + count;
System.out.println("design_num9.15======" + design_num1);
String xuhao2 = xuhao1 + "";
// 添加属性到字符串集合中
@ -321,7 +395,6 @@ public class test extends AbstractAIFOperation {
// 处理虚拟件的数据
if (xu.size() > 0) {
for (int i = 0; i < xu.size(); i++) {
TCComponentBOMLine xuLine = xu.get(i);
String xuniid = xuLine.getStringProperty("awb0BomLineItemId");
@ -335,7 +408,6 @@ public class test extends AbstractAIFOperation {
continue;
}
//System.out.println("9.22虚拟件id === ==="+xuniid);
design_num1 = "1";
// 先将虚拟件(xuninum)的值设为获取到的值
xuninum = design_num1;
@ -371,6 +443,7 @@ public class test extends AbstractAIFOperation {
e.printStackTrace();
}
}
private void getAndSetValue(TCComponentBOMLine bomLine, int level, int num) {
// TODO Auto-generated method stub
try {
@ -389,7 +462,6 @@ public class test extends AbstractAIFOperation {
TCComponentBOMLine ziLine = (TCComponentBOMLine) comp;
getAndSetValue(ziLine, level, num);
}
}
level--;
@ -402,6 +474,7 @@ public class test extends AbstractAIFOperation {
/**
* excel
*
* @throws Exception
*/
@ -557,6 +630,7 @@ public class test extends AbstractAIFOperation {
vals.add(spec);
return vals;
}
private String getOutsourceValue(TCComponentItemRevision rev) {
// TODO Auto-generated method stub
StringBuilder sb = new StringBuilder();
@ -722,9 +796,8 @@ public class test extends AbstractAIFOperation {
beanList.add(importance);
list.add(beanList);
}
public void getItemValue1(TCComponentBOMLine comp,int level,int num) throws TCException {
public void getItemValue1(TCComponentBOMLine comp, int level, int num) throws TCException {
// lev1 = level + "";
TCComponentItemRevision rev = comp.getItemRevision();
@ -770,7 +843,7 @@ public class test extends AbstractAIFOperation {
if ("T2_outsourceRevision".equals(type)) {
xuhao1 = num;
String classID = item_id1.substring(0, 2);
item_id1 = item_id1+rev_id1;
//item_id1 = item_id1 + rev_id1;
oldid1 = rev.getStringProperty("t2_OldId");
System.out.println("classID===============" + classID);
if ("51".equals(classID) || "72".equals(classID) || "76".equals(classID)) {
@ -787,7 +860,6 @@ public class test extends AbstractAIFOperation {
unit1 = rev.getStringProperty("t2_unit");
brand1 = "";
} else if ("T2_OutBuyPartRevision".equals(type)) {
xuhao1 = num;
ClassValueBean valueBean = ClassValueUtil.getOutBuyPartValue(rev, errList);
@ -834,9 +906,8 @@ public class test extends AbstractAIFOperation {
// 判断是否属于bomline
if (comp instanceof TCComponentBOMLine) {
if ("T2_outsourceRevision".equals(type) || "T2_OutBuyPartRevision".equals(type)) {
if (!"Reference".equals(occType))
{
List<String> beanList1 = new ArrayList<String>();
if ("Reference".compareToIgnoreCase(((TCComponentBOMLine) comp).getStringProperty("TCAI_OCC_TYPE"))!=0) {
// List<String> beanList1 = new ArrayList<String>();
// 将遍历的对象强转类型为bomline
TCComponentBOMLine ziLine = (TCComponentBOMLine) comp;
// 判断是否有已打包的注释,然后解包
@ -846,9 +917,11 @@ public class test extends AbstractAIFOperation {
ziLine.unpack();
ziLine.refresh();
unpackLine.refresh();
}else if (Judgmentnote == null || "".equals(Judgmentnote) || " ".equals(Judgmentnote)) {
} else if (Judgmentnote == null || "".equals(Judgmentnote)
|| " ".equals(Judgmentnote)) {
Judgmentnote = ziLine.getStringProperty("T2_DesignQuantity");
}if("已打包的注释".equals(Judgmentnote)) {
}
if ("已打包的注释".equals(Judgmentnote)) {
ziLine.unpack();
ziLine.refresh();
unpackLine.refresh();
@ -1025,6 +1098,7 @@ public class test extends AbstractAIFOperation {
group1 = "冻融机";
}
}
//匹配来源码
private void getsource() {
// M 自制件

@ -270,13 +270,13 @@ public class AcountSet_AddDialog_ChangeApply extends AbstractAIFDialog {
// }
String s = (cf.table1.getValueAt(10, 1) == null ? "" :cf.table1.getValueAt(10, 1).toString());
String s = (cf.table1.getValueAt(2, 5) == null ? "" :cf.table1.getValueAt(2, 5).toString());
proid = s + proid ;
//changeform.model1.setValueAt(proid, 8, 1);
cf.table1.setValueAt( proid, 10, 1);
cf.table1.setValueAt( proid, 2, 5);
disposeDialog();
MessageBox.post("账套添加完成!", "提示", MessageBox.INFORMATION);
}

@ -266,13 +266,13 @@ public class AcountSet_AddDialog_ChangeNotify extends AbstractAIFDialog {
// }
String s = (cn.table1.getValueAt(10, 1) == null ? "" :cn.table1.getValueAt(10, 1).toString());
String s = (cn.table1.getValueAt(2, 5) == null ? "" :cn.table1.getValueAt(2, 5).toString());
proid = s + proid ;
//changeform.model1.setValueAt(proid, 8, 1);
cn.table1.setValueAt( proid, 10, 1);
cn.table1.setValueAt( proid, 2, 5);
disposeDialog();
MessageBox.post("账套添加完成!", "提示", MessageBox.INFORMATION);
}

@ -265,13 +265,13 @@ public class AcountSet_AddDialog_PresserQECN extends AbstractAIFDialog {
// }
String s = (qf.table1.getValueAt(10, 1) == null ? "" :qf.table1.getValueAt(10, 1).toString());
String s = (qf.table1.getValueAt(2, 5) == null ? "" :qf.table1.getValueAt(2, 5).toString());
proid = s + proid ;
//changeform.model1.setValueAt(proid, 8, 1);
qf.table1.setValueAt( proid, 10, 1);
qf.table1.setValueAt( proid, 2, 5);
disposeDialog();
MessageBox.post("账套添加完成!", "提示", MessageBox.INFORMATION);
}

@ -129,7 +129,7 @@ public class AddDialogApply_TZ extends AbstractAIFDialog {
}
}
String s = (cf.table1.getValueAt(7, 5) == null ? "" :cf.table1.getValueAt(7, 5).toString());
String s = (cf.table1.getValueAt(9, 1) == null ? "" :cf.table1.getValueAt(9, 1).toString());
StringBuilder sb = new StringBuilder(s);
@ -150,7 +150,7 @@ public class AddDialogApply_TZ extends AbstractAIFDialog {
}
//changeform.model1.setValueAt(proid, 8, 1);
cf.table1.setValueAt( sb.toString(), 7, 5);
cf.table1.setValueAt( sb.toString(), 9, 1);
disposeDialog();
MessageBox.post("图纸发至添加完成!", "提示", MessageBox.INFORMATION);
}

@ -90,7 +90,7 @@ public class AddDialogNotify_TZ extends AbstractAIFDialog {
}
}
String s = (nf.table1.getValueAt(7, 5) == null ? "" :nf.table1.getValueAt(7, 5).toString());
String s = (nf.table1.getValueAt(9, 1) == null ? "" :nf.table1.getValueAt(9, 1).toString());
StringBuilder sb = new StringBuilder(s);
for (int i = 0; i < list.size(); i++) {
@ -110,7 +110,7 @@ public class AddDialogNotify_TZ extends AbstractAIFDialog {
}
//changeform.model1.setValueAt(proid, 8, 1);
nf.table1.setValueAt( sb.toString(), 7, 5);
nf.table1.setValueAt( sb.toString(), 9, 1);
disposeDialog();
MessageBox.post("图纸发至添加完成!", "提示", MessageBox.INFORMATION);
}

@ -261,13 +261,13 @@ public class AddDialogQuick extends AbstractAIFDialog {
// }
String s = (quickform.table1.getValueAt(8, 1) == null ? "" :quickform.table1.getValueAt(8, 1).toString());
String s = (quickform.table1.getValueAt(4, 5) == null ? "" :quickform.table1.getValueAt(4, 5).toString());
proid = s + proid ;
//changeform.model1.setValueAt(proid, 8, 1);
quickform.table1.setValueAt( proid, 8, 1);
quickform.table1.setValueAt( proid, 4, 5);
disposeDialog();
MessageBox.post("项目添加完成!", "提示", MessageBox.INFORMATION);
}

@ -432,7 +432,7 @@ public class AddDialogQuickChange_TZ extends AbstractAIFDialog {
}
}
String s = (qf.table1.getValueAt(7, 5) == null ? "" :qf.table1.getValueAt(7, 5).toString());
String s = (qf.table1.getValueAt(9, 1) == null ? "" :qf.table1.getValueAt(9, 1).toString());
StringBuilder sb = new StringBuilder(s);
for (int i = 0; i < list.size(); i++) {
@ -452,7 +452,7 @@ public class AddDialogQuickChange_TZ extends AbstractAIFDialog {
}
//changeform.model1.setValueAt(proid, 8, 1);
qf.table1.setValueAt( sb.toString(), 7, 5);
qf.table1.setValueAt( sb.toString(), 9, 1);
disposeDialog();
MessageBox.post("图纸发至添加完成!", "提示", MessageBox.INFORMATION);
}

File diff suppressed because it is too large Load Diff

@ -1,6 +1,6 @@
package com.connor.dfl.plm.forms;
import org.jacorb.idl.runtime.int_token;
//import org.jacorb.idl.runtime.int_token;
/**
*

File diff suppressed because it is too large Load Diff

@ -18,6 +18,7 @@ public class ChangeOrderBean {
private String errorType;//错误类型
private String dutyDepartment;//责任部门
private String dutyMan;//责任人
private String formMajor;//变更专业
private String changeReason;//更改原因
private String salseClassify;//销售分类
private String priceBooking;//价格预售
@ -31,6 +32,9 @@ public class ChangeOrderBean {
private String TZChangeType;//图纸更改类型
private String SUOSU_ProductDepartment;//所属产品部
private String projectState;//项目阶段
private String pkeyword;//问题关键词
private String manageclassify; //设计管理分类
private String kkcode; //kk申请编号
@ -40,7 +44,30 @@ public class ChangeOrderBean {
public String getKkcode() {
return kkcode;
}
public void setKkcode(String kkcode) {
this.kkcode = kkcode;
}
public String getFormMajor() {
return formMajor;
}
public void setFormMajor(String formMajor) {
this.formMajor = formMajor;
}
public String getPkeyword() {
return pkeyword;
}
public void setPkeyword(String pkeyword) {
this.pkeyword = pkeyword;
}
public String getManageclassify() {
return manageclassify;
}
public void setManageclassify(String manageclassify) {
this.manageclassify = manageclassify;
}
public String getProjectState() {
return projectState;
}
@ -50,24 +77,22 @@ public class ChangeOrderBean {
public ChangeOrderBean() {
}
public ChangeOrderBean(String objectCode, String applyName, String applyDate, String projectCode, String clientNae,
String productDepartment, String productCode, String productName, String projectModel, String affectedPart,
String changeType, String productType, String errorType, String dutyDepartment, String dutyMan,
String productDepartment, String productName, String projectModel, String affectedPart, String changeType,
String productType, String errorType, String dutyDepartment, String dutyMan, String formMajor,
String changeReason, String salseClassify, String priceBooking, String isNotProductLoss,
String receiveClassify, String warehouseCode, String accountSet, String notifyEmergencyProcedures,
String drawingTo,String ChangeListCode,String TZChangeType,String SUOSU_ProductDepartment,String projectState) {
this.projectState =projectState;
this.SUOSU_ProductDepartment = SUOSU_ProductDepartment;
this.TZChangeType = TZChangeType;
this.ChangeListCode = ChangeListCode;
String drawingTo, String changeListCode, String tZChangeType, String sUOSU_ProductDepartment,
String projectState, String pkeyword, String manageclassify,String kkcode) {
super();
this.objectCode = objectCode;
this.applyName = applyName;
this.applyDate = applyDate;
this.projectCode = projectCode;
this.clientNae = clientNae;
this.productDepartment = productDepartment;
this.productName = productName;
this.projectModel = projectModel;
this.affectedPart = affectedPart;
@ -76,6 +101,7 @@ public class ChangeOrderBean {
this.errorType = errorType;
this.dutyDepartment = dutyDepartment;
this.dutyMan = dutyMan;
this.formMajor = formMajor;
this.changeReason = changeReason;
this.salseClassify = salseClassify;
this.priceBooking = priceBooking;
@ -83,10 +109,16 @@ public class ChangeOrderBean {
this.receiveClassify = receiveClassify;
this.warehouseCode = warehouseCode;
this.accountSet = accountSet;
this.NotifyEmergencyProcedures = notifyEmergencyProcedures;
NotifyEmergencyProcedures = notifyEmergencyProcedures;
this.drawingTo = drawingTo;
ChangeListCode = changeListCode;
TZChangeType = tZChangeType;
SUOSU_ProductDepartment = sUOSU_ProductDepartment;
this.projectState = projectState;
this.pkeyword = pkeyword;
this.manageclassify = manageclassify;
this.kkcode = kkcode;
}
public String getSUOSU_ProductDepartment() {
return SUOSU_ProductDepartment;
}

File diff suppressed because it is too large Load Diff

@ -3,11 +3,14 @@ package com.connor.dfl.plm.util;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Date;
import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
@ -68,88 +71,65 @@ public class AutoSign {
}
public void insertNewTxtFile(String filename,File file,String uid ,String user_id ,String url,String user,String password,String fun,String txt_pinhao,String zhangtao,String userID,String item_uid) {
public void insertNewTxtFile(String filePath,String fileName,String uid ,String user_id ,String url,String user,String password,String fun,String txt_pinhao,String zhangtao,String userID,String item_uid,String uid_file_name,TCSession session) {
String[] stringArray = session.getPreferenceService().getStringValues("DFL2_FTP_Connect");
fileName = fileName + ".txt";
uid_file_name = uid_file_name + ".txt";
Date date = new Date();
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss");
SimpleDateFormat sd1 = new SimpleDateFormat("yyyy-MM-dd");
String ssd = sd.format(date);
String ssd1 = sd1.format(date);
String[] split = ssd1.split("-");
boolean flag = false;
try {
FileInputStream in = new FileInputStream(new File(filePath));
flag = FtpUtil2.uploadFile(stringArray[0], 21, stringArray[1], stringArray[2], "", "/"+ split[0]+"/"+split[1] +"/"+split[2], fileName, in);
in = new FileInputStream(new File(item_uid));
flag = FtpUtil2.uploadFile(stringArray[0], 21, stringArray[1], stringArray[2], "", "/"+ split[0]+"/"+split[1] +"/"+split[2], uid_file_name, in);
// FtpUtil.uploadFile(stringArray[0], 21, stringArray[1], stringArray[2], "/"+ split[0], "/"+split[1] +"/"+split[2], fileName, in);
// in = new FileInputStream(new File(item_uid));
// FtpUtil.uploadFile(stringArray[0], 21, stringArray[1], stringArray[2], "/"+ split[0], "/"+split[1] +"/"+split[2], uid_file_name, in);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if(flag) {
String ftpPath1 = "/"+ split[0]+ "/"+split[1] +"/"+split[2]+"/"+fileName;
String ftpPath2 = "/"+ split[0]+ "/"+split[1] +"/"+split[2]+"/"+uid_file_name;
Connection con = null;
PreparedStatement stmt = null;
ResultSet rs = null;
BufferedInputStream bis = null;
java.io.OutputStream out = null;
String tempPath = System.getProperty("java.io.tmpdir");
String sqlNewdate ="insert into DFL_SEND_TXT_TO_ERP values(seq_on_DFL.nextval,'"+fun+"', '"+filename+"',empty_blob(),0,'"+uid+"' ,'"+user_id+"','"+txt_pinhao+"','"+zhangtao+"','"+userID+"','"+item_uid+"')";
// insert into dfl_send_txt_to_erp VALUES(seq_on_DFL.nextval,'33','33',empty_blob(),2,'fdfdfdfd');
//String sqlupdate="update DFL_SEND_TXT_TO_ERP SET TXTFILE=empty_blob() where myuid='"+uid+"' for update ";
String sql = "select * from DFL_SEND_TXT_TO_ERP where myuid ='"+uid+"' for update ";
String insert="update DFL_SEND_TXT_TO_ERP SET TXTFILE=? where myuid='"+uid+"'";
try {
String sqlNewdate ="insert into DFL_SEND_FILE_TO_ERP_NEW values(seq_on_DFL.nextval,'"+fun+"', '"+ftpPath1+"',0,'"+uid+"' ,'"+user_id+"','"+txt_pinhao+"','"+zhangtao+"','"+userID+"','"+ftpPath2+"',null,'"+ssd+"',null,null,null)";
try
{
con = ConnectionFun( url, user, password);
con.setAutoCommit(false);
stmt = con.prepareStatement(sqlNewdate);
stmt.executeUpdate();
System.out.println("新的数据插入数据库完成");
stmt.close();
// stmt = con.prepareStatement(sqlupdate);
//
// stmt.executeUpdate();
// stmt.close();
stmt =con.prepareStatement(sql);
con.commit();
rs = stmt.executeQuery();
while(rs.next()) {
String ss = rs.getString(2);
System.out.println("-=================" + ss);
BLOB blob = (BLOB) rs.getBlob(4);
int size = blob.getBufferSize();
bis = new BufferedInputStream(new FileInputStream(new File(tempPath + filename + ".txt")),size);
out = blob.getBinaryOutputStream();
System.out.println(size);
byte b[]=new byte[size];
int en=0;
while((en = bis.read(b,0,size))!=-1) {
out.write(b,0,en);
}
out.flush();
stmt =con.prepareStatement(insert);
stmt.setBlob(1, blob);
//stmt.setString(2, uid);
stmt.executeUpdate();
bis.close();
out.close();
con.commit();
}
} catch (Exception ex) {
catch (Exception ex)
{
ex.printStackTrace();
} finally {
try {
}
finally
{
try
{
stmt.close();
con.close();
} catch (Exception ex) {
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
}
}
}

@ -1,10 +1,15 @@
package com.connor.dfl.plm.util;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.xpath.operations.And;
import com.connor.dfl.plm.classLov.DbPool;
import com.connor.dfl.plm.dfl019.ClassPropBean;
import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aifrcp.AIFUtility;
@ -20,13 +25,392 @@ import com.teamcenter.rac.util.MessageBox;
public class ClassValueUtil {
// public static String getClassOracle
public static ClassValueBean getClassOracle(TCComponentItemRevision rev,List<String> errList,TCSession session) throws TCException{
String idString = rev.getStringProperty("item_id")+"/"+rev.getStringProperty("item_revision_id");
String selectTXT = "select * from PICM0 where PID = '"+idString+"'";
System.out.println("idString===>"+idString);
ClassValueBean valueBean = new ClassValueBean();
StringBuilder sb = new StringBuilder();
try {
DbPool.getConnection(session);
ResultSet selectSql = DbPool.executeSelectSql(selectTXT);
if(selectSql.next()) {
String puid = selectSql.getString("PCID");
String dwPuid = puid.substring(0, puid.length()-4);
String dwPuid2 = puid.substring(0, puid.length()-2);
String getLov =
"select txt.puid,a.* from (select cnt.pname,cnt.pformat,a.PDBINDEX from(select lb1.PUNCT,lb1.PDBINDEX from PSMLB1 lb1,PSMLB0 lb0 where lb1.rtag_to_headeru = lb0.PUID and lb0.pcid = "
+ "'"+puid+"') a, PUNCT_DICT cnt where cnt.PUNCT = a.PUNCT)a left JOIN PSTXT txt on"
+ " txt.pid = a.pformat";
String dwPuidLov =
"select txt.puid,a.* from (select cnt.pname,cnt.pformat,a.PDBINDEX from(select lb1.PUNCT,lb1.PDBINDEX from PSMLB1 lb1,PSMLB0 lb0 where lb1.rtag_to_headeru = lb0.PUID and lb0.pcid = "
+ "'"+dwPuid+"') a, PUNCT_DICT cnt where cnt.PUNCT = a.PUNCT)a left JOIN PSTXT txt on"
+ " txt.pid = a.pformat";
String dwPuidLov2 =
"select txt.puid,a.* from (select cnt.pname,cnt.pformat,a.PDBINDEX from(select lb1.PUNCT,lb1.PDBINDEX from PSMLB1 lb1,PSMLB0 lb0 where lb1.rtag_to_headeru = lb0.PUID and lb0.pcid = "
+ "'"+dwPuid2+"') a, PUNCT_DICT cnt where cnt.PUNCT = a.PUNCT)a left JOIN PSTXT txt on"
+ " txt.pid = a.pformat";
ResultSet getLovSql = DbPool.executeSelectSql(getLov);
ResultSet dwPuidLovSql = DbPool.executeSelectSql(dwPuidLov);
ResultSet dwPuidLovSql2 = DbPool.executeSelectSql(dwPuidLov2);
while(dwPuidLovSql.next()) {
String attrName = dwPuidLovSql.getString("pname");
int int1 = dwPuidLovSql.getInt("PDBINDEX");
String uid = dwPuidLovSql.getString("PUID");
String value = selectSql.getString("psm"+String.format("%02d", int1));
if(uid!=null&& !uid.equals("")) {
if("/".equals(value) || "null".equals(value) || "".equals(value)) {
continue;
}
// Integer valueOf = Integer.valueOf(value);
// String getLovVal = "select PVAL_0 from PVALUE where puid = '"+uid+"' and PSEQ = '"+valueOf+"'" ;
String getLovVal = "select val.* from "
+ "(select * from PKEY key where key.puid = '"+uid+"' and PVAL_0 = '"+value+"'"
+ ")a LEFT JOIN PVALUE val on val.PSEQ = a.PSEQ and val.puid = a.puid";
ResultSet LovValSql = DbPool.executeSelectSql(getLovVal);
if(LovValSql.next()) {
value = LovValSql.getString("PVAL_0");
if("单位".equals(attrName)){
valueBean.setUnit(value);
}
}
}else {
if("单位".equals(attrName)){
valueBean.setUnit(value);
}
}
}
while(dwPuidLovSql2.next()) {
String attrName = dwPuidLovSql2.getString("pname");
int int1 = dwPuidLovSql2.getInt("PDBINDEX");
String uid = dwPuidLovSql2.getString("PUID");
String value = selectSql.getString("psm"+String.format("%02d", int1));
if(uid!=null&& !uid.equals("")) {
if("/".equals(value) || "null".equals(value) || "".equals(value)) {
continue;
}
// Integer valueOf = Integer.valueOf(value);
// String getLovVal = "select PVAL_0 from PVALUE where puid = '"+uid+"' and PSEQ = '"+valueOf+"'" ;
String getLovVal = "select val.* from "
+ "(select * from PKEY key where key.puid = '"+uid+"' and PVAL_0 = '"+value+"'"
+ ")a LEFT JOIN PVALUE val on val.PSEQ = a.PSEQ and val.puid = a.puid";
ResultSet LovValSql = DbPool.executeSelectSql(getLovVal);
if(LovValSql.next()) {
value = LovValSql.getString("PVAL_0");
if("单位".equals(attrName)){
valueBean.setUnit(value);
}
}
}else {
if("单位".equals(attrName)){
valueBean.setUnit(value);
}
}
}
while(getLovSql.next()) {
String attrName = getLovSql.getString("pname");
// System.out.println(attrName);
int int1 = getLovSql.getInt("PDBINDEX");
String uid = getLovSql.getString("PUID");
String value = selectSql.getString("psm"+String.format("%02d", int1));
// System.out.println(int1);
// System.out.println(value);
// System.out.println(uid);
if(uid!=null && !uid.equals("")) {
if( value ==null || "/".equals(value) || "null".equals(value) || "".equals(value)) {
continue;
}
// Integer valueOf = Integer.valueOf(value)-1;
// String getLovVal = "select PVAL_0 from PVALUE where puid = '"+uid+"' and PSEQ = '"+valueOf+"'" ;
String getLovVal = "select val.* from "
+ "(select * from PKEY key where key.puid = '"+uid+"' and PVAL_0 = '"+value+"'"
+ ")a LEFT JOIN PVALUE val on val.PSEQ = a.PSEQ and val.puid = a.puid";
ResultSet LovValSql = DbPool.executeSelectSql(getLovVal);
if(LovValSql.next()) {
value = LovValSql.getString("PVAL_0");
if("品牌".equals(attrName)) {
valueBean.setBrand(value);
}else if("单位".equals(attrName)){
valueBean.setUnit(value);
}else if(attrName.startsWith("规格")){
valueBean.setSpec(value);
}else if(attrName.contains("订货码")){
valueBean.setCode(value);
}else {
if("/".equals(value) || "null".equals(value) || "".equals(value)) {
// System.out.println("不进行拼接");
continue;
}
sb.append(value);
sb.append(";");
}
}
}else {
if("品牌".equals(attrName)) {
valueBean.setBrand(value);
}else if(attrName.contains("单位")){
valueBean.setUnit(value);
}else if(attrName.startsWith("规格")){
valueBean.setSpec(value);
}else if(attrName.contains("订货码")){
valueBean.setCode(value);
}else {
if("/".equals(value) || "null".equals(value) || "".equals(value)) {
// System.out.println("不进行拼接");
continue;
}
sb.append(value);
sb.append(";");
}
}
}
}else {
MessageBox.post(rev.getStringProperty("item_id")+"该物料没有发送至分类,请先发送分类!!",
"提示", MessageBox.WARNING);
return null;
}
String sb2 = "";
if(sb.length()>1) {
sb2 = sb.substring(0, sb.length()-1);
}
StringBuilder specSB = new StringBuilder();
if(valueBean.getBrand() != null) {
if(!("".equals((valueBean.getBrand()).trim()))
&& !("/".equals((valueBean.getBrand()).trim()))
&& !("null".equals((valueBean.getBrand()).trim()))) {
specSB.append(valueBean.getBrand());
specSB.append(";");
}
}
if(valueBean.getSpec() != null) {
if(!("".equals((valueBean.getSpec()).trim()))
&& !("/".equals((valueBean.getSpec()).trim()))
&& !("null".equals((valueBean.getSpec()).trim()))) {
specSB.append(valueBean.getSpec());
specSB.append(";");
}
}
if(valueBean.getCode() != null) {
if(!("".equals((valueBean.getCode()).trim()))
&& !("/".equals((valueBean.getCode()).trim()))
&& !("null".equals((valueBean.getCode()).trim()))) {
specSB.append(valueBean.getCode());
specSB.append(";");
}
}
specSB.append(sb2);
valueBean.setSpecs(specSB.toString());
// return valueBean;
}
catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}finally {
DbPool.freeAll();
}
return valueBean;
}
private static Map<String, List<ClassPropBean>> classPropMap = new HashMap<String, List<ClassPropBean>>();
private static Map<String, Map<Integer, String>> claMapMap = new HashMap<String, Map<Integer, String>>();
public static void getClassMap(TCComponentItemRevision rev,String className,TCSession session) throws TCException{
List<ClassPropBean> classPropList = new ArrayList<ClassPropBean>();
TCClassificationService classificationService = session.getClassificationService();
TCComponentICO[] icos = rev.getClassificationObjects();
ICSAdminClass c = classificationService.newICSAdminClass();
c.load(className);
if(classPropMap.containsKey(className)) {
return;
}
//String icoPUID = icos[0].getUid();
Map<Integer, String> claMap = new HashMap<Integer, String>();
if(icos != null && icos.length>0){
ICSProperty[] icss = icos[0].getICSProperties(true);
for (ICSProperty ics : icss) {
claMap.put(ics.getId(), ics.getValue());
}
}
ICSAdminClassAttribute[] icsAttrS = c.getAttributes();
if (icsAttrS != null) {
for (ICSAdminClassAttribute attr : icsAttrS) {
if (attr.isReferenceAttribute()) {
continue;
}
if (attr.isReference()) {
continue;
}
ClassPropBean bean = new ClassPropBean(attr);
classPropList.add(bean);
}
}
claMapMap.put(className, claMap);
classPropMap.put(className, classPropList);
}
public static ClassValueBean getOutBuyPartValue1(TCComponentItemRevision rev,List<String> errList,TCSession session) {
// TODO Auto-generated method stub
ClassValueBean valueBean = new ClassValueBean();
StringBuilder sb = new StringBuilder();
try {
String className = rev.getClassificationClass();
if("".equals(className.trim())) {
errList.add(className);
MessageBox.post(rev.getStringProperty("item_id")+"该物料没有发送至分类,请先发送分类!!",
"提示", MessageBox.WARNING);
return null;
}
getClassMap(rev,className,session);
Map<Integer, String> claMap = claMapMap.get(className);
List<ClassPropBean> classPropList = classPropMap.get(className);
for (int i = 0; i < classPropList.size(); i++) {
ClassPropBean bean = classPropList.get(i);
String attrName = bean.propDisName;
System.out.println("attrName==========="+attrName);
String value = claMap.get(bean.propID);
if(bean.isLov) {
String lovValue = bean.lovMapping.get(value);
if("品牌".equals(attrName)) {
valueBean.setBrand(lovValue);
}else if("单位".equals(attrName)){
valueBean.setUnit(lovValue);
}
else if(attrName.contains("规格")){
String kaitou1 = attrName.substring(0,2);
//前两个字是否为规格
if("规格".equals(kaitou1)) {
valueBean.setSpec(lovValue);
}else {
if("/".equals(lovValue) || "null".equals(lovValue)) {
System.out.println("不进行拼接");
continue;
}
sb.append(lovValue);
if(i < classPropList.size()-1) {
sb.append(";");
}
}
}
else if(attrName.contains("订货码")){
valueBean.setCode(lovValue);
}else {
if("/".equals(lovValue) || "null".equals(lovValue)) {
System.out.println("不进行拼接");
continue;
}
sb.append(lovValue);
if(i < classPropList.size()-1) {
sb.append(";");
}
}
}else {
if("品牌".equals(attrName)) {
valueBean.setBrand(value);
}else if("单位".equals(attrName)){
valueBean.setUnit(value);
}else if(attrName.contains("规格")){
String kaitou2 = attrName.substring(0,2);
//前两个字是否为规格
if("规格".equals(kaitou2)) {
valueBean.setSpec(value);
}else {
if("/".equals(value) || "null".equals(value)) {
System.out.println("不进行拼接");
continue;
}
sb.append(value);
if(i < classPropList.size()-1) {
sb.append(";");
}
}
}else if(attrName.contains("订货码")){
valueBean.setCode(value);
}else {
if("/".equals(value) || "null".equals(value)) {
System.out.println("不进行拼接");
continue;
}
sb.append(value);
if(i < classPropList.size()-1) {
sb.append(";");
}
}
}
}
} catch (TCException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
StringBuilder specSB = new StringBuilder();
if(valueBean.getBrand() != null) {
if(!("".equals((valueBean.getBrand()).trim()))
&& !("/".equals((valueBean.getBrand()).trim()))
&& !("null".equals((valueBean.getBrand()).trim()))) {
specSB.append(valueBean.getBrand());
specSB.append(";");
}
}
if(valueBean.getSpec() != null) {
if(!("".equals((valueBean.getSpec()).trim()))
&& !("/".equals((valueBean.getSpec()).trim()))
&& !("null".equals((valueBean.getSpec()).trim()))) {
specSB.append(valueBean.getSpec());
specSB.append(";");
}
}
if(valueBean.getCode() != null) {
if(!("".equals((valueBean.getCode()).trim()))
&& !("/".equals((valueBean.getCode()).trim()))
&& !("null".equals((valueBean.getCode()).trim()))) {
specSB.append(valueBean.getCode());
specSB.append(";");
}
}
specSB.append(sb.toString());
valueBean.setSpecs(specSB.toString());
return valueBean;
}
public static ClassValueBean getOutBuyPartValue(TCComponentItemRevision rev,List<String> errList) {
// TODO Auto-generated method stub
ClassValueBean valueBean = new ClassValueBean();
AbstractAIFApplication app = AIFUtility.getCurrentApplication();
TCSession session = (TCSession) app.getSession();
List<String> vals = new ArrayList<String>();
StringBuilder sb = new StringBuilder();
List<ClassPropBean> classPropList = new ArrayList<ClassPropBean>();
TCClassificationService classificationService = session.getClassificationService();
@ -74,6 +458,7 @@ public class ClassValueUtil {
String value = claMap.get(bean.propID);
if(bean.isLov) {
String lovValue = bean.lovMapping.get(value);
System.out.println("value==========="+lovValue);
if("品牌".equals(attrName)) {
valueBean.setBrand(lovValue);
}else if("单位".equals(attrName)){
@ -84,6 +469,15 @@ public class ClassValueUtil {
//前两个字是否为规格
if("规格".equals(kaitou1)) {
valueBean.setSpec(lovValue);
}else {
if("/".equals(lovValue) || "null".equals(lovValue)) {
System.out.println("不进行拼接");
continue;
}
sb.append(lovValue);
if(i < classPropList.size()-1) {
sb.append(";");
}
}
}
else if(attrName.contains("订货码")){
@ -99,6 +493,7 @@ public class ClassValueUtil {
}
}
}else {
System.out.println("value==========="+value);
if("品牌".equals(attrName)) {
valueBean.setBrand(value);
}else if("单位".equals(attrName)){
@ -108,6 +503,15 @@ public class ClassValueUtil {
//前两个字是否为规格
if("规格".equals(kaitou2)) {
valueBean.setSpec(value);
}else {
if("/".equals(value) || "null".equals(value)) {
System.out.println("不进行拼接");
continue;
}
sb.append(value);
if(i < classPropList.size()-1) {
sb.append(";");
}
}
}else if(attrName.contains("订货码")){
valueBean.setCode(value);

@ -416,7 +416,7 @@ public class DataBaseControl {
if("全部".equals(product)) {
product = "";
}
String sql = "select * from DFL_CHANGEFORM where PRODUCTDEPARTMENT like '%"+product+"%'";//
String sql = "select APPLYNAME,OBJECTCODE,APPLYDATE,PRODUCTNAME,PROJECTMODEL,CLIENTNAME,WAREHOUSECODE,NOTIFYEMERGENCYPROCEDURES,TZGGLX,PRODUCTDEPARTMENT,DUTYDEPARTMENT,DUTYMAN,CHANGETYPE,PRODUCTTYPE,ERRORTYPE,PRICEBOOKING,SALSECLASSIFY,ISNOTPRODUCTLOSS,XMJD,RECEIVECLASSIFY,DRAWINGTO,PROJECTCODE,CHANGEREASON,ACCOUNTSET,FORM_MAJOR,PKEYWORD,MANAGECLASSIFY,KKCODE,case when REASONDETAIL is null then changereason else REASONDETAIL end as REASONDETAIL from DFL_CHANGEFORM where PRODUCTDEPARTMENT like '%"+product+"%'";//
SimpleDateFormat df = new SimpleDateFormat("yyyy-M-d HH:mm");
openDataBase();
System.out.println("sql============"+sql);
@ -436,30 +436,36 @@ public class DataBaseControl {
}
if(date.after(date1) && date.before(date2)) {
ChangeBean bn = new ChangeBean();
bn.setApplyName(rs.getString(2));
bn.setApplyName(rs.getString(1));
bn.setApplyDate(rs.getString(3));
bn.setProjectCode(rs.getString(4));
bn.setClientNae(rs.getString(5));
bn.setProductName(rs.getString(7));
bn.setProjectModel(rs.getString(8));
bn.setChangeType(rs.getString(10));
bn.setProductType(rs.getString(11));
bn.setErrorType(rs.getString(12));
bn.setDutyDepartment(rs.getString(13));
bn.setDutyMan(rs.getString(14));
bn.setChangeReason(rs.getString(15));
bn.setSalseClassify(rs.getString(16));
bn.setPriceBooking(rs.getString(17));
bn.setProjectCode(rs.getString(22));
bn.setClientNae(rs.getString(6));
bn.setProductName(rs.getString(4));
bn.setProjectModel(rs.getString(5));
bn.setChangeType(rs.getString(13));
bn.setProductType(rs.getString(14));
bn.setErrorType(rs.getString(15));
bn.setDutyDepartment(rs.getString(11));
bn.setDutyMan(rs.getString(12));
bn.setChangeReason(rs.getString(23));
bn.setSalseClassify(rs.getString(17));
bn.setPriceBooking(rs.getString(16));
bn.setIsNotProductLoss(rs.getString(18));
bn.setReceiveClassify(rs.getString(19));
bn.setWarehouseCode(rs.getString(20));
bn.setAccountSet(rs.getString(21));
bn.setNotifyEmergencyProcedures(rs.getString(22));
bn.setDrawingTo(rs.getString(23));
bn.setChangeListCode(rs.getString(24));
bn.setTZChangeType(rs.getString(25));
bn.setSUOSU_ProductDepartment(rs.getString(26));
bn.setProjectState(rs.getString(27));
bn.setReceiveClassify(rs.getString(20));
bn.setWarehouseCode(rs.getString(7));
bn.setAccountSet(rs.getString(24));
bn.setNotifyEmergencyProcedures(rs.getString(8));
bn.setDrawingTo(rs.getString(21));
bn.setChangeListCode(rs.getString(2));
bn.setTZChangeType(rs.getString(9));
bn.setSUOSU_ProductDepartment(rs.getString(10));
bn.setProjectState(rs.getString(19));
bn.setFormMajor(rs.getString(25));
bn.setPkeyword(rs.getString(26));
bn.setManageclassify(rs.getString(27));
bn.setKkcode(rs.getString(28));
bn.setReasonDetail(rs.getString(29));
list.add(bn);
}
} catch (ParseException e) {
@ -549,13 +555,14 @@ public class DataBaseControl {
String max = selCodeBean.getMax();
openDataBase();
String query = "select * from (select * from pitem where pitem_id like '"+prefix+"%' order by pitem_id desc) where rownum<=1";
//String query = "select * from (select * from pitem where pitem_id like '"+prefix+"%' order by pitem_id desc) where rownum<=1";
String query = "select LSH from PLM_LSH where PREFIX = prefix";
// 查询该id在数据库中的内容
ResultSet rs = dbQuery(query);
String lshstr = col;
String lsh = "";
if (rs.next()) {
lsh = rs.getString(2);
lsh = rs.getString(0);
System.out.println("sslsh=" + lsh);
if ("".equals(lsh)) {
throw new Exception("流水码为空!");

File diff suppressed because it is too large Load Diff

@ -1,268 +1,13 @@
package com.connor.dfl.plm.util;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import javax.swing.JOptionPane;
import org.apache.poi.ddf.EscherBSERecord;
import org.apache.poi.ddf.EscherBitmapBlip;
import org.apache.poi.hssf.model.InternalWorkbook;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFClientAnchor;
import org.apache.poi.hssf.usermodel.HSSFPatriarch;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Font;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.hssf.util.HSSFCellUtil;
/**
* Excel
* */
public class ExcelUtil {
/**
* HSSFSheet簿
* @param wb HSSFWorkbook
* @param sheetName String
* @return HSSFSheet
*/
public static HSSFSheet createSheet(HSSFWorkbook wb,String sheetName){
HSSFSheet sheet=wb.createSheet(sheetName);
sheet.setDefaultColumnWidth(12);
sheet.setGridsPrinted(false);
sheet.setDisplayGridlines(false);
return sheet;
}
/**
* HSSFRow
* @param sheet HSSFSheet
* @param rowNum int
* @param height int
* @return HSSFRow
*/
public static HSSFRow createRow(HSSFSheet sheet,int rowNum,int height){
HSSFRow row=sheet.createRow(rowNum);
row.setHeight((short)height);
return row;
}
public static HSSFCell createCell0(HSSFRow row,int cellNum){
HSSFCell cell=row.createCell(cellNum);
return cell;
}
/**
* CELL
* @param row HSSFRow
* @param cellNum int
* @param style HSSFStyle
* @return HSSFCell
*/
public static HSSFCell createCell(HSSFRow row,int cellNum,CellStyle style){
HSSFCell cell=row.createCell(cellNum);
cell.setCellStyle(style);
return cell;
}
/**
* CellStyle
* @param wb HSSFWorkbook
* @param backgroundColor
* @param foregroundColor
* @param font
* @return CellStyle
*/
public static CellStyle createCellStyle(HSSFWorkbook wb,short backgroundColor,short foregroundColor,short halign,Font font){
CellStyle cs=wb.createCellStyle();
cs.setAlignment(CellStyle.ALIGN_CENTER);//halign
cs.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
cs.setFillBackgroundColor(backgroundColor);
cs.setFillForegroundColor(foregroundColor);
cs.setFillPattern(CellStyle.SOLID_FOREGROUND);
cs.setFont(font);
return cs;
}
/**
* CellStyle
* @param wb HSSFWorkbook
* @param backgroundColor
* @param foregroundColor
* @param font
* @return CellStyle
*/
public static CellStyle createBorderCellStyle(HSSFWorkbook wb,short backgroundColor,short foregroundColor,short halign,Font font){
CellStyle cs=wb.createCellStyle();
cs.setAlignment(halign);
cs.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
cs.setFillBackgroundColor(backgroundColor);
cs.setFillForegroundColor(foregroundColor);
cs.setFillPattern(CellStyle.SOLID_FOREGROUND);
cs.setFont(font);
cs.setBorderLeft(CellStyle.BORDER_DASHED);
cs.setBorderRight(CellStyle.BORDER_DASHED);
cs.setBorderTop(CellStyle.BORDER_DASHED);
cs.setBorderBottom(CellStyle.BORDER_DASHED);
return cs;
}
/**
* Excel
*/
public static void writeArrayToExcel(HSSFSheet sheet,int rows,int cells,Object [][]value){
Row row[]=new HSSFRow[rows];
Cell cell[]=new HSSFCell[cells];
for(int i=0;i<row.length;i++){
row[i]=sheet.createRow(i);
for(int j=0;j<cell.length;j++){
cell[j]=row[i].createCell(j);
cell[j].setCellValue(convertString(value[i][j]));
}
}
}
/**
* Excel
*/
public static void writeArrayToExcel(HSSFWorkbook wb,HSSFSheet sheet,int rows,int cells,Object [][]value){
Row row[]=new HSSFRow[rows];
Cell cell[]=new HSSFCell[cells];
HSSFCellStyle ztStyle = (HSSFCellStyle)wb.createCellStyle();
ztStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
Font ztFont = wb.createFont();
//ztFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
//ztFont.setItalic(true); // 设置字体为斜体字
//ztFont.setColor(Font.COLOR_RED); // 将字体设置为“红色”
ztFont.setFontHeightInPoints((short)14); // 将字体大小设置为18px
ztFont.setFontName("宋体"); // 将“华文行楷”字体应用到当前单元格上
//ztFont.setUnderline(Font.U_DOUBLE);
ztStyle.setFont(ztFont);
HSSFCellStyle ztStyle1 = (HSSFCellStyle)wb.createCellStyle();
ztStyle1.setAlignment(HSSFCellStyle.ALIGN_CENTER);
//画图的顶级管理器一个sheet只能获取一个一定要注意这点
HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
for(int i=0;i<row.length;i++){
row[i]=sheet.createRow(i);
for(int j=0;j<cell.length;j++){
cell[j]=row[i].createCell(j);
if(0==i){
cell[j].setCellValue(convertString(value[i][j]));
cell[j].setCellStyle(ztStyle);
}else if(1==i){
cell[j].setCellValue(convertString(value[i][j]));
cell[j].setCellStyle(ztStyle1);
}
else{
if(1==j){
//anchor主要用于设置图片的属性
if(value[i][j] != null){
HSSFClientAnchor anchor = new HSSFClientAnchor(50, 10, 1000, 240,(short) j, i, (short)j, i);
anchor.setAnchorType(3);
patriarch.createPicture(anchor, wb.addPicture(((ByteArrayOutputStream)value[i][j]).toByteArray(),HSSFWorkbook.PICTURE_TYPE_JPEG));
}
}else{
cell[j].setCellValue(convertString(value[i][j]));
}
cell[j].setCellStyle(ztStyle1);
row[i].setHeight((short)600);
}
}
}
sheet.setColumnWidth(4, 4000);
sheet.setColumnWidth(6, 4000);
mergeCell(sheet,0,0,0,cell.length-1);
}
import org.apache.poi.ss.usermodel.DataFormatter;
/**
*
* @param sheet HSSFSheet
* @param firstRow int
* @param lastRow int
* @param firstColumn int
* @param lastColumn int
* @return int
*/
public static int mergeCell(HSSFSheet sheet,int firstRow,int lastRow,int firstColumn,int lastColumn){
return sheet.addMergedRegion(new CellRangeAddress(firstRow,lastRow,firstColumn,lastColumn));
}
/**
*
* @param wb HSSFWorkbook
* @param boldweight short
* @param color short
* @return Font
*/
public static Font createFont(HSSFWorkbook wb,short boldweight,short color,short size){
Font font=wb.createFont();
font.setBoldweight(boldweight);
font.setColor(color);
font.setFontHeightInPoints(size);
return font;
}
/**
*
* @param sheet HSSFSheet
* @param ca CellRangAddress
* @param style CellStyle
*/
public static void setRegionStyle(HSSFSheet sheet, CellRangeAddress ca,CellStyle style) {
for (int i = ca.getFirstRow(); i <= ca.getLastRow(); i++) {
HSSFRow row = HSSFCellUtil.getRow(i, sheet);
for (int j = ca.getFirstColumn(); j <= ca.getLastColumn(); j++) {
HSSFCell cell = HSSFCellUtil.getCell(row, j);
cell.setCellStyle(style);
}
}
}
/**
* HSSFWorkbookExcel
* @param wb HSSFWorkbook
* @param absPath
* @param wbName
*/
public static void writeWorkbook(HSSFWorkbook wb,String fileName){
FileOutputStream fos=null;
File f=new File(fileName);
try {
fos=new FileOutputStream(f);
wb.write(fos);
int dialog = JOptionPane.showConfirmDialog(null,f.getName()+"导出成功!是否打开?","温馨提示", JOptionPane.YES_NO_OPTION);
if (dialog == JOptionPane.YES_OPTION) {
Runtime.getRuntime().exec("cmd /c start \"\" \"" + fileName + "\"");
}
} catch (FileNotFoundException e) {
JOptionPane.showMessageDialog(null, "导入数据前请关闭工作表");
} catch ( Exception e) {
JOptionPane.showMessageDialog(null, "没有进行筛选");
} finally{
try {
if(fos!=null){fos.close();}
} catch (IOException e) {
}
}
}
public class ExcelUtil {
public static String convertString(Object value) {
if (value == null) {
return "";
} else {
return value.toString();
}
public static String getFormatterValue(Cell cell) {
return new DataFormatter().formatCellValue(cell);
}
}

@ -21,6 +21,7 @@ import java.awt.event.WindowEvent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.JDialog;
import javax.swing.Timer;
import com.teamcenter.rac.aif.AbstractAIFDialog;
import com.teamcenter.rac.util.PropertyLayout;

@ -510,7 +510,7 @@ public class MyView extends TCComponentView{
if(currentYear == maxYear) {
TCComponentFolder yearFolder1 = (TCComponentFolder) createFolder(String.valueOf(maxYear)+"Äê", sponsorFolder);
TCComponentFolder yearFolder2 = (TCComponentFolder) createFolder(String.valueOf(maxYear)+"Äê", participationFolder);
for(int i=maxMonth;i<=curretnMonth;i++) {
for(int i=1;i<=curretnMonth;i++) {
TCComponentFolder monthFolder1 =null;
TCComponentFolder monthFolder2 =null;
monthFolder1 = (TCComponentFolder) createFolder(String.valueOf(i)+"ÔÂ", yearFolder1);
@ -521,7 +521,8 @@ public class MyView extends TCComponentView{
//È¥Äê
TCComponentFolder yearFolder1 = (TCComponentFolder) createFolder(String.valueOf(maxYear)+"Äê", sponsorFolder);
TCComponentFolder yearFolder2 = (TCComponentFolder) createFolder(String.valueOf(maxYear)+"Äê", participationFolder);
for(int i=maxMonth;i<=12;i++) {
//for(int i=maxMonth;i<=12;i++) {
for(int i=1;i<=12;i++) {
TCComponentFolder monthFolder1 =null;
TCComponentFolder monthFolder2 =null;
monthFolder1 = (TCComponentFolder) createFolder(String.valueOf(i)+"ÔÂ", yearFolder1);

Loading…
Cancel
Save