commit 6c3f0c738941c39a371f0b68a556a0831d506a43 Author: lijh Date: Tue Mar 10 11:06:12 2026 +0800 first commit diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..d6885eb --- /dev/null +++ b/.classpath @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..744c10f --- /dev/null +++ b/.project @@ -0,0 +1,28 @@ + + + com.connor.jk.plm + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..39ec1d9 --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,91 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore +org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable +org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore +org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/META-INF/MANIFEST.MF b/META-INF/MANIFEST.MF new file mode 100644 index 0000000..3c33719 --- /dev/null +++ b/META-INF/MANIFEST.MF @@ -0,0 +1,500 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Plm +Bundle-SymbolicName: com.connor.jk.plm; singleton:=true +Bundle-Version: 1.0.0 +Bundle-Activator: com.connor.jk.plm.Activator +Bundle-Vendor: CONNOR +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + com.teamcenter.rac.util;bundle-version="11000.2.0", + com.teamcenter.rac.kernel;bundle-version="11000.2.0", + com.teamcenter.rac.aifrcp;bundle-version="11000.2.0", + com.teamcenter.rac.tcapps;bundle-version="11000.2.0", + com.teamcenter.rac.common;bundle-version="11000.2.0", + org.eclipse.ui.forms;bundle-version="3.5.200", + org.apache.log4j;bundle-version="1.2.15", + org.apache.poi;bundle-version="3.6.0", + com.teamcenter.rac.ui;bundle-version="11000.2.0", + TcSoaCoreRac;bundle-version="11000.2.0", + com.teamcenter.rac.pse;bundle-version="11000.2.0", + TcSoaStructureManagementRac, + com.teamcenter.rac.project;bundle-version="11000.2.0", + TcSoaCadRac;bundle-version="11000.2.0" +Bundle-RequiredExecutionEnvironment: JavaSE-1.7 +Bundle-ActivationPolicy: lazy +Export-Package: com.connor.jk.plm, + com.connor.jk.plm.DbomToEbom, + com.connor.jk.plm.E_U8ToU8, + com.connor.jk.plm.TC_OA_Integration, + com.connor.jk.plm.YSXQForm, + com.connor.jk.plm.addMark, + com.connor.jk.plm.allBomline, + com.connor.jk.plm.bom.until, + com.connor.jk.plm.classify, + com.connor.jk.plm.createPCBForm, + com.connor.jk.plm.createproject, + com.connor.jk.plm.exportBOM, + com.connor.jk.plm.exportForm, + com.connor.jk.plm.exportPCB, + com.connor.jk.plm.form, + com.connor.jk.plm.handlers, + com.connor.jk.plm.imform, + com.connor.jk.plm.imp.bom, + com.connor.jk.plm.importPCB, + com.connor.jk.plm.itemsave, + com.connor.jk.plm.mail, + com.connor.jk.plm.paste, + com.connor.jk.plm.pcb, + com.connor.jk.plm.project, + com.connor.jk.plm.report, + com.connor.jk.plm.search, + com.connor.jk.plm.sendToClassification, + com.connor.jk.plm.setBomline, + com.connor.jk.plm.sign, + com.connor.jk.plm.sqb, + com.connor.jk.plm.tallySheet, + com.connor.jk.plm.tempToFormal, + com.connor.jk.plm.transfer, + com.connor.jk.plm.util, + com.connor.jk.plm.view, + com.connor.jk.plm.xmkb, + com.jacob.activeX, + com.jacob.com, + com.keypoint, + com.microsoft.jdbc.base, + com.microsoft.jdbc.extensions, + com.microsoft.jdbc.sqlserver, + com.microsoft.jdbc.sqlserver.tds, + com.microsoft.jdbc.vprt, + com.microsoft.jdbcx.base, + com.microsoft.jdbcx.sqlserver, + com.microsoft.sqlserver.jdbc, + com.microsoft.util, + com.sun.mail.handlers, + com.sun.mail.smtp, + com.sun.mail.util, + com.teamcenter.rac.commands.cut, + com.teamcenter.rac.form, + com.teamcenter.rac.project.views, + javax.mail, + javax.mail.event, + javax.mail.internet, + javax.mail.search, + javax.mail.util, + javax.xml, + javax.xml.namespace, + javax.xml.stream, + javax.xml.stream.events, + javax.xml.stream.util, + jxl, + jxl.biff, + jxl.biff.drawing, + jxl.biff.formula, + jxl.common, + jxl.common.log, + jxl.demo, + jxl.format, + jxl.read.biff, + jxl.write, + jxl.write.biff, + microsoft.sql, + oracle.core.lmx, + oracle.core.lvf, + oracle.jdbc, + oracle.jdbc.aq, + oracle.jdbc.babelfish, + oracle.jdbc.connector, + oracle.jdbc.dcn, + oracle.jdbc.diagnostics, + oracle.jdbc.driver, + oracle.jdbc.internal, + oracle.jdbc.oci, + oracle.jdbc.oracore, + oracle.jdbc.pool, + oracle.jdbc.proxy, + oracle.jdbc.proxy.annotation, + oracle.jdbc.replay, + oracle.jdbc.replay.driver, + oracle.jdbc.replay.internal, + oracle.jdbc.rowset, + oracle.jdbc.util, + oracle.jdbc.xa, + oracle.jdbc.xa.client, + oracle.jpub.runtime, + oracle.net.ano, + oracle.net.aso, + oracle.net.jdbc.TNSAddress, + oracle.net.jdbc.nl, + oracle.net.jdbc.nl.mesg, + oracle.net.jndi, + oracle.net.ns, + oracle.net.nt, + oracle.net.resolver, + oracle.security.o3logon, + oracle.security.o5logon, + oracle.sql, + oracle.sql.converter, + org.apache.commons.codec, + org.apache.commons.codec.binary, + org.apache.commons.codec.digest, + org.apache.commons.codec.language, + org.apache.commons.codec.language.bm, + org.apache.commons.codec.net, + org.apache.commons.logging, + org.apache.commons.logging.impl, + org.apache.poi, + org.apache.poi.common.usermodel, + org.apache.poi.ddf, + org.apache.poi.dev, + org.apache.poi.extractor, + org.apache.poi.hdf.event, + org.apache.poi.hdf.extractor, + org.apache.poi.hdf.extractor.data, + org.apache.poi.hdf.extractor.util, + org.apache.poi.hdf.model, + org.apache.poi.hdf.model.hdftypes, + org.apache.poi.hdf.model.hdftypes.definitions, + org.apache.poi.hdf.model.util, + org.apache.poi.hdgf, + org.apache.poi.hdgf.chunks, + org.apache.poi.hdgf.dev, + org.apache.poi.hdgf.exceptions, + org.apache.poi.hdgf.extractor, + org.apache.poi.hdgf.pointers, + org.apache.poi.hdgf.streams, + org.apache.poi.hmef, + org.apache.poi.hmef.attribute, + org.apache.poi.hmef.dev, + org.apache.poi.hmef.extractor, + org.apache.poi.hpbf, + org.apache.poi.hpbf.dev, + org.apache.poi.hpbf.extractor, + org.apache.poi.hpbf.model, + org.apache.poi.hpbf.model.qcbits, + org.apache.poi.hpsf, + org.apache.poi.hpsf.examples, + org.apache.poi.hpsf.extractor, + org.apache.poi.hpsf.wellknown, + org.apache.poi.hslf, + org.apache.poi.hslf.blip, + org.apache.poi.hslf.dev, + org.apache.poi.hslf.examples, + org.apache.poi.hslf.exceptions, + org.apache.poi.hslf.extractor, + org.apache.poi.hslf.model, + org.apache.poi.hslf.model.textproperties, + org.apache.poi.hslf.record, + org.apache.poi.hslf.usermodel, + org.apache.poi.hslf.util, + org.apache.poi.hsmf, + org.apache.poi.hsmf.datatypes, + org.apache.poi.hsmf.dev, + org.apache.poi.hsmf.examples, + org.apache.poi.hsmf.exceptions, + org.apache.poi.hsmf.extractor, + org.apache.poi.hsmf.parsers, + org.apache.poi.hssf, + org.apache.poi.hssf.converter, + org.apache.poi.hssf.dev, + org.apache.poi.hssf.eventmodel, + org.apache.poi.hssf.eventusermodel, + org.apache.poi.hssf.eventusermodel.dummyrecord, + org.apache.poi.hssf.eventusermodel.examples, + org.apache.poi.hssf.extractor, + org.apache.poi.hssf.model, + org.apache.poi.hssf.record, + org.apache.poi.hssf.record.aggregates, + org.apache.poi.hssf.record.cf, + org.apache.poi.hssf.record.chart, + org.apache.poi.hssf.record.common, + org.apache.poi.hssf.record.cont, + org.apache.poi.hssf.record.crypto, + org.apache.poi.hssf.record.pivottable, + org.apache.poi.hssf.usermodel, + org.apache.poi.hssf.usermodel.examples, + org.apache.poi.hssf.util, + org.apache.poi.hssf.view, + org.apache.poi.hssf.view.brush, + org.apache.poi.hwpf, + org.apache.poi.hwpf.converter, + org.apache.poi.hwpf.dev, + org.apache.poi.hwpf.extractor, + org.apache.poi.hwpf.model, + org.apache.poi.hwpf.model.io, + org.apache.poi.hwpf.model.types, + org.apache.poi.hwpf.sprm, + org.apache.poi.hwpf.usermodel, + org.apache.poi.openxml4j.exceptions, + org.apache.poi.openxml4j.opc, + org.apache.poi.openxml4j.opc.internal, + org.apache.poi.openxml4j.opc.internal.marshallers, + org.apache.poi.openxml4j.opc.internal.signature, + org.apache.poi.openxml4j.opc.internal.unmarshallers, + org.apache.poi.openxml4j.opc.signature, + org.apache.poi.openxml4j.util, + org.apache.poi.poifs.common, + org.apache.poi.poifs.crypt, + org.apache.poi.poifs.dev, + org.apache.poi.poifs.eventfilesystem, + org.apache.poi.poifs.filesystem, + org.apache.poi.poifs.nio, + org.apache.poi.poifs.poibrowser, + org.apache.poi.poifs.property, + org.apache.poi.poifs.storage, + org.apache.poi.sl.usermodel, + org.apache.poi.ss, + org.apache.poi.ss.examples, + org.apache.poi.ss.examples.formula, + org.apache.poi.ss.examples.html, + org.apache.poi.ss.excelant, + org.apache.poi.ss.excelant.util, + org.apache.poi.ss.extractor, + org.apache.poi.ss.format, + org.apache.poi.ss.formula, + org.apache.poi.ss.formula.atp, + org.apache.poi.ss.formula.constant, + org.apache.poi.ss.formula.eval, + org.apache.poi.ss.formula.eval.forked, + org.apache.poi.ss.formula.function, + org.apache.poi.ss.formula.functions, + org.apache.poi.ss.formula.ptg, + org.apache.poi.ss.formula.udf, + org.apache.poi.ss.usermodel, + org.apache.poi.ss.usermodel.charts, + org.apache.poi.ss.util, + org.apache.poi.ss.util.cellwalk, + org.apache.poi.util, + org.apache.poi.xslf, + org.apache.poi.xslf.extractor, + org.apache.poi.xslf.model, + org.apache.poi.xslf.model.geom, + org.apache.poi.xslf.usermodel, + org.apache.poi.xslf.usermodel.tutorial, + org.apache.poi.xslf.util, + org.apache.poi.xssf.dev, + org.apache.poi.xssf.eventusermodel, + org.apache.poi.xssf.eventusermodel.examples, + org.apache.poi.xssf.extractor, + org.apache.poi.xssf.model, + org.apache.poi.xssf.streaming, + org.apache.poi.xssf.usermodel, + org.apache.poi.xssf.usermodel.charts, + org.apache.poi.xssf.usermodel.examples, + org.apache.poi.xssf.usermodel.extensions, + org.apache.poi.xssf.usermodel.helpers, + org.apache.poi.xssf.util, + org.apache.poi.xwpf.extractor, + org.apache.poi.xwpf.model, + org.apache.poi.xwpf.usermodel, + org.apache.xmlbeans, + org.apache.xmlbeans.impl.common, + org.apache.xmlbeans.impl.config, + org.apache.xmlbeans.impl.inst2xsd, + org.apache.xmlbeans.impl.inst2xsd.util, + org.apache.xmlbeans.impl.jam, + org.apache.xmlbeans.impl.jam.annotation, + org.apache.xmlbeans.impl.jam.internal, + org.apache.xmlbeans.impl.jam.internal.classrefs, + org.apache.xmlbeans.impl.jam.internal.elements, + org.apache.xmlbeans.impl.jam.internal.javadoc, + org.apache.xmlbeans.impl.jam.internal.parser, + org.apache.xmlbeans.impl.jam.internal.reflect, + org.apache.xmlbeans.impl.jam.mutable, + org.apache.xmlbeans.impl.jam.provider, + org.apache.xmlbeans.impl.jam.visitor, + org.apache.xmlbeans.impl.jam.xml, + org.apache.xmlbeans.impl.piccolo.io, + org.apache.xmlbeans.impl.piccolo.util, + org.apache.xmlbeans.impl.piccolo.xml, + org.apache.xmlbeans.impl.regex, + org.apache.xmlbeans.impl.richParser, + org.apache.xmlbeans.impl.schema, + org.apache.xmlbeans.impl.soap, + org.apache.xmlbeans.impl.store, + org.apache.xmlbeans.impl.tool, + org.apache.xmlbeans.impl.util, + org.apache.xmlbeans.impl.validator, + org.apache.xmlbeans.impl.values, + org.apache.xmlbeans.impl.xb.ltgfmt, + org.apache.xmlbeans.impl.xb.ltgfmt.impl, + org.apache.xmlbeans.impl.xb.substwsdl, + org.apache.xmlbeans.impl.xb.substwsdl.impl, + org.apache.xmlbeans.impl.xb.xmlconfig, + org.apache.xmlbeans.impl.xb.xmlconfig.impl, + org.apache.xmlbeans.impl.xb.xmlschema, + org.apache.xmlbeans.impl.xb.xmlschema.impl, + org.apache.xmlbeans.impl.xb.xsdownload, + org.apache.xmlbeans.impl.xb.xsdownload.impl, + org.apache.xmlbeans.impl.xb.xsdschema, + org.apache.xmlbeans.impl.xb.xsdschema.impl, + org.apache.xmlbeans.impl.xpathgen, + org.apache.xmlbeans.impl.xsd2inst, + org.apache.xmlbeans.soap, + org.apache.xmlbeans.xml.stream, + org.apache.xmlbeans.xml.stream.events, + org.apache.xmlbeans.xml.stream.utils, + org.dom4j, + org.dom4j.bean, + org.dom4j.datatype, + org.dom4j.dom, + org.dom4j.dtd, + org.dom4j.io, + org.dom4j.jaxb, + org.dom4j.rule, + org.dom4j.rule.pattern, + org.dom4j.swing, + org.dom4j.tree, + org.dom4j.util, + org.dom4j.xpath, + org.dom4j.xpp, + org.openxmlformats.schemas.drawingml.x2006.chart, + org.openxmlformats.schemas.drawingml.x2006.chart.impl, + org.openxmlformats.schemas.drawingml.x2006.main, + org.openxmlformats.schemas.drawingml.x2006.main.impl, + org.openxmlformats.schemas.drawingml.x2006.picture, + org.openxmlformats.schemas.drawingml.x2006.picture.impl, + org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing, + org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.impl, + org.openxmlformats.schemas.drawingml.x2006.wordprocessingDrawing, + org.openxmlformats.schemas.drawingml.x2006.wordprocessingDrawing.impl, + org.openxmlformats.schemas.officeDocument.x2006.customProperties, + org.openxmlformats.schemas.officeDocument.x2006.customProperties.impl, + org.openxmlformats.schemas.officeDocument.x2006.docPropsVTypes, + org.openxmlformats.schemas.officeDocument.x2006.docPropsVTypes.impl, + org.openxmlformats.schemas.officeDocument.x2006.extendedProperties, + org.openxmlformats.schemas.officeDocument.x2006.extendedProperties.impl, + org.openxmlformats.schemas.officeDocument.x2006.relationships, + org.openxmlformats.schemas.officeDocument.x2006.relationships.impl, + org.openxmlformats.schemas.presentationml.x2006.main, + org.openxmlformats.schemas.presentationml.x2006.main.impl, + org.openxmlformats.schemas.spreadsheetml.x2006.main, + org.openxmlformats.schemas.spreadsheetml.x2006.main.impl, + org.openxmlformats.schemas.wordprocessingml.x2006.main, + org.openxmlformats.schemas.wordprocessingml.x2006.main.impl, + org.w3c.dom, + repackage, + schemaorg_apache_xmlbeans.system.sE130CAA0A01A7CDE5A2B4FEB8B311707, + schemaorg_apache_xmlbeans.system.sXMLCONFIG, + schemaorg_apache_xmlbeans.system.sXMLLANG, + schemaorg_apache_xmlbeans.system.sXMLSCHEMA, + schemaorg_apache_xmlbeans.system.sXMLTOOLS, + schemasMicrosoftComOfficeExcel, + schemasMicrosoftComOfficeExcel.impl, + schemasMicrosoftComOfficeOffice, + schemasMicrosoftComOfficeOffice.impl, + schemasMicrosoftComVml, + schemasMicrosoftComVml.impl +Bundle-ClassPath: poilib/commons-codec-1.10.jar, + poilib/commons-logging-1.1.jar, + poilib/dom4j-1.6.1.jar, + poilib/geronimo-stax-api_1.0_spec-1.0.jar, + poilib/jacob.jar, + poilib/jcommon-1.0.12.jar, + poilib/jfreechart-1.0.9.jar, + poilib/jsr173_1.0_api.jar, + poilib/jxl_1.0.0.jar, + poilib/poi-3.9-20121203.jar, + poilib/poi-examples-3.9-20121203.jar, + poilib/poi-excelant-3.9-20121203.jar, + poilib/poi-ooxml-3.9-20121203.jar, + poilib/poi-ooxml-schemas-3.9-20121203.jar, + poilib/poi-scratchpad-3.9-20121203.jar, + poilib/xmlbeans-2.5.0.jar, + ., + poilib/ojdbc6.jar, + poilib/msbase.jar, + poilib/mssqlserver.jar, + poilib/msutil.jar, + poilib/sqljdbc41.jar, + poilib/mailapi.jar, + poilib/smtp.jar, + axis2_1.6/activation-1.1.jar, + axis2_1.6/antlr-2.7.7.jar, + axis2_1.6/apache-mime4j-core-0.7.2.jar, + axis2_1.6/axiom-api-1.2.13.jar, + axis2_1.6/axiom-dom-1.2.13.jar, + axis2_1.6/axiom-impl-1.2.13.jar, + axis2_1.6/axis2-adb-1.6.2.jar, + axis2_1.6/axis2-adb-codegen-1.6.2.jar, + axis2_1.6/axis2-ant-plugin-1.6.2.jar, + axis2_1.6/axis2-clustering-1.6.2.jar, + axis2_1.6/axis2-codegen-1.6.2.jar, + axis2_1.6/axis2-corba-1.6.2.jar, + axis2_1.6/axis2-fastinfoset-1.6.2.jar, + axis2_1.6/axis2-java2wsdl-1.6.2.jar, + axis2_1.6/axis2-jaxbri-1.6.2.jar, + axis2_1.6/axis2-jaxws-1.6.2.jar, + axis2_1.6/axis2-jibx-1.6.2.jar, + axis2_1.6/axis2-json-1.6.2.jar, + axis2_1.6/axis2-kernel-1.6.2.jar, + axis2_1.6/axis2-metadata-1.6.2.jar, + axis2_1.6/axis2-mtompolicy-1.6.2.jar, + axis2_1.6/axis2-saaj-1.6.2.jar, + axis2_1.6/axis2-soapmonitor-servlet-1.6.2.jar, + axis2_1.6/axis2-spring-1.6.2.jar, + axis2_1.6/axis2-transport-http-1.6.2.jar, + axis2_1.6/axis2-transport-local-1.6.2.jar, + axis2_1.6/axis2-xmlbeans-1.6.2.jar, + axis2_1.6/bcel-5.1.jar, + axis2_1.6/commons-cli-1.2.jar, + axis2_1.6/commons-codec-1.3.jar, + axis2_1.6/commons-fileupload-1.2.jar, + axis2_1.6/commons-httpclient-3.1.jar, + axis2_1.6/commons-io-1.4.jar, + axis2_1.6/commons-logging-1.1.1.jar, + axis2_1.6/geronimo-annotation_1.0_spec-1.1.jar, + axis2_1.6/geronimo-jaxws_2.2_spec-1.0.jar, + axis2_1.6/geronimo-jta_1.1_spec-1.1.jar, + axis2_1.6/geronimo-saaj_1.3_spec-1.0.1.jar, + axis2_1.6/geronimo-stax-api_1.0_spec-1.0.1.jar, + axis2_1.6/geronimo-ws-metadata_2.0_spec-1.1.2.jar, + axis2_1.6/httpcore-4.0.jar, + axis2_1.6/jalopy-1.5rc3.jar, + axis2_1.6/jaxb-api-2.1.jar, + axis2_1.6/jaxb-impl-2.1.7.jar, + axis2_1.6/jaxb-xjc-2.1.7.jar, + axis2_1.6/jaxen-1.1.1.jar, + axis2_1.6/jaxws-tools-2.1.3.jar, + axis2_1.6/jettison-1.0-RC2.jar, + axis2_1.6/jibx-bind-1.2.jar, + axis2_1.6/jibx-run-1.2.jar, + axis2_1.6/jsr311-api-1.0.jar, + axis2_1.6/juli-6.0.16.jar, + axis2_1.6/log4j-1.2.15.jar, + axis2_1.6/mail-1.4.jar, + axis2_1.6/mex-1.6.2-impl.jar, + axis2_1.6/neethi-3.0.2.jar, + axis2_1.6/regexp-1.2.jar, + axis2_1.6/tribes-6.0.16.jar, + axis2_1.6/woden-api-1.0M9.jar, + axis2_1.6/woden-impl-commons-1.0M9.jar, + axis2_1.6/woden-impl-dom-1.0M9.jar, + axis2_1.6/wsdl4j-1.6.2.jar, + axis2_1.6/wstx-asl-3.2.9.jar, + axis2_1.6/xalan-2.7.0.jar, + axis2_1.6/xml-resolver-1.2.jar, + axis2_1.6/xmlbeans-2.3.0.jar, + axis2_1.6/XmlSchema-1.4.7.jar, + jason/commons-beanutils-1.7.0.jar, + jason/commons-collections-3.2.jar, + jason/commons-lang-2.4.jar, + jason/commons-logging-1.1.jar, + jason/ezmorph-1.0.4.jar, + jason/jdom.jar, + jason/json-lib-2.2.2-jdk15.jar, + jason/json-lib-2.2.3-jdk13.jar, + jason/itext-2.0.3.jar, + jason/okhttp-2.7.4.jar, + jason/okio-1.13.0.jar, + jason/fastjson-1.2.76.jar +Import-Package: com.teamcenter.rac.aif.registryeditor, + com.teamcenter.rac.ui.views.providers, + com.teamcenter.rac.vns.model, + com.teamcenter.services, + com.teamcenter.services.internal, + com.teamcenter.services.internal.rac.structuremanagement, + com.teamcenter.services.internal.rac.structuremanagement._2007_06, + com.teamcenter.services.rac, + com.teamcenter.soa.exceptions, + org.apache.poi.hssf.usermodel diff --git a/axis2_1.6/XmlSchema-1.4.7.jar b/axis2_1.6/XmlSchema-1.4.7.jar new file mode 100644 index 0000000..79251c6 Binary files /dev/null and b/axis2_1.6/XmlSchema-1.4.7.jar differ diff --git a/axis2_1.6/activation-1.1.jar b/axis2_1.6/activation-1.1.jar new file mode 100644 index 0000000..53f82a1 Binary files /dev/null and b/axis2_1.6/activation-1.1.jar differ diff --git a/axis2_1.6/antlr-2.7.7.jar b/axis2_1.6/antlr-2.7.7.jar new file mode 100644 index 0000000..5e5f14b Binary files /dev/null and b/axis2_1.6/antlr-2.7.7.jar differ diff --git a/axis2_1.6/apache-mime4j-core-0.7.2.jar b/axis2_1.6/apache-mime4j-core-0.7.2.jar new file mode 100644 index 0000000..b5c225b Binary files /dev/null and b/axis2_1.6/apache-mime4j-core-0.7.2.jar differ diff --git a/axis2_1.6/axiom-api-1.2.13.jar b/axis2_1.6/axiom-api-1.2.13.jar new file mode 100644 index 0000000..84cb42c Binary files /dev/null and b/axis2_1.6/axiom-api-1.2.13.jar differ diff --git a/axis2_1.6/axiom-dom-1.2.13.jar b/axis2_1.6/axiom-dom-1.2.13.jar new file mode 100644 index 0000000..4890bb2 Binary files /dev/null and b/axis2_1.6/axiom-dom-1.2.13.jar differ diff --git a/axis2_1.6/axiom-impl-1.2.13.jar b/axis2_1.6/axiom-impl-1.2.13.jar new file mode 100644 index 0000000..a959b28 Binary files /dev/null and b/axis2_1.6/axiom-impl-1.2.13.jar differ diff --git a/axis2_1.6/axis2-adb-1.6.2.jar b/axis2_1.6/axis2-adb-1.6.2.jar new file mode 100644 index 0000000..6234fdb Binary files /dev/null and b/axis2_1.6/axis2-adb-1.6.2.jar differ diff --git a/axis2_1.6/axis2-adb-codegen-1.6.2.jar b/axis2_1.6/axis2-adb-codegen-1.6.2.jar new file mode 100644 index 0000000..7d037d4 Binary files /dev/null and b/axis2_1.6/axis2-adb-codegen-1.6.2.jar differ diff --git a/axis2_1.6/axis2-ant-plugin-1.6.2.jar b/axis2_1.6/axis2-ant-plugin-1.6.2.jar new file mode 100644 index 0000000..771b222 Binary files /dev/null and b/axis2_1.6/axis2-ant-plugin-1.6.2.jar differ diff --git a/axis2_1.6/axis2-clustering-1.6.2.jar b/axis2_1.6/axis2-clustering-1.6.2.jar new file mode 100644 index 0000000..e45be99 Binary files /dev/null and b/axis2_1.6/axis2-clustering-1.6.2.jar differ diff --git a/axis2_1.6/axis2-codegen-1.6.2.jar b/axis2_1.6/axis2-codegen-1.6.2.jar new file mode 100644 index 0000000..f742f19 Binary files /dev/null and b/axis2_1.6/axis2-codegen-1.6.2.jar differ diff --git a/axis2_1.6/axis2-corba-1.6.2.jar b/axis2_1.6/axis2-corba-1.6.2.jar new file mode 100644 index 0000000..ee3c78e Binary files /dev/null and b/axis2_1.6/axis2-corba-1.6.2.jar differ diff --git a/axis2_1.6/axis2-fastinfoset-1.6.2.jar b/axis2_1.6/axis2-fastinfoset-1.6.2.jar new file mode 100644 index 0000000..d10c36a Binary files /dev/null and b/axis2_1.6/axis2-fastinfoset-1.6.2.jar differ diff --git a/axis2_1.6/axis2-java2wsdl-1.6.2.jar b/axis2_1.6/axis2-java2wsdl-1.6.2.jar new file mode 100644 index 0000000..0bb869d Binary files /dev/null and b/axis2_1.6/axis2-java2wsdl-1.6.2.jar differ diff --git a/axis2_1.6/axis2-jaxbri-1.6.2.jar b/axis2_1.6/axis2-jaxbri-1.6.2.jar new file mode 100644 index 0000000..616eec9 Binary files /dev/null and b/axis2_1.6/axis2-jaxbri-1.6.2.jar differ diff --git a/axis2_1.6/axis2-jaxws-1.6.2.jar b/axis2_1.6/axis2-jaxws-1.6.2.jar new file mode 100644 index 0000000..064351a Binary files /dev/null and b/axis2_1.6/axis2-jaxws-1.6.2.jar differ diff --git a/axis2_1.6/axis2-jibx-1.6.2.jar b/axis2_1.6/axis2-jibx-1.6.2.jar new file mode 100644 index 0000000..75f9d1a Binary files /dev/null and b/axis2_1.6/axis2-jibx-1.6.2.jar differ diff --git a/axis2_1.6/axis2-json-1.6.2.jar b/axis2_1.6/axis2-json-1.6.2.jar new file mode 100644 index 0000000..edd7936 Binary files /dev/null and b/axis2_1.6/axis2-json-1.6.2.jar differ diff --git a/axis2_1.6/axis2-kernel-1.6.2.jar b/axis2_1.6/axis2-kernel-1.6.2.jar new file mode 100644 index 0000000..3ae5f7a Binary files /dev/null and b/axis2_1.6/axis2-kernel-1.6.2.jar differ diff --git a/axis2_1.6/axis2-metadata-1.6.2.jar b/axis2_1.6/axis2-metadata-1.6.2.jar new file mode 100644 index 0000000..492f1ac Binary files /dev/null and b/axis2_1.6/axis2-metadata-1.6.2.jar differ diff --git a/axis2_1.6/axis2-mtompolicy-1.6.2.jar b/axis2_1.6/axis2-mtompolicy-1.6.2.jar new file mode 100644 index 0000000..561e84a Binary files /dev/null and b/axis2_1.6/axis2-mtompolicy-1.6.2.jar differ diff --git a/axis2_1.6/axis2-saaj-1.6.2.jar b/axis2_1.6/axis2-saaj-1.6.2.jar new file mode 100644 index 0000000..c14531d Binary files /dev/null and b/axis2_1.6/axis2-saaj-1.6.2.jar differ diff --git a/axis2_1.6/axis2-soapmonitor-servlet-1.6.2.jar b/axis2_1.6/axis2-soapmonitor-servlet-1.6.2.jar new file mode 100644 index 0000000..276dac7 Binary files /dev/null and b/axis2_1.6/axis2-soapmonitor-servlet-1.6.2.jar differ diff --git a/axis2_1.6/axis2-spring-1.6.2.jar b/axis2_1.6/axis2-spring-1.6.2.jar new file mode 100644 index 0000000..30b9baa Binary files /dev/null and b/axis2_1.6/axis2-spring-1.6.2.jar differ diff --git a/axis2_1.6/axis2-transport-http-1.6.2.jar b/axis2_1.6/axis2-transport-http-1.6.2.jar new file mode 100644 index 0000000..b1dad78 Binary files /dev/null and b/axis2_1.6/axis2-transport-http-1.6.2.jar differ diff --git a/axis2_1.6/axis2-transport-local-1.6.2.jar b/axis2_1.6/axis2-transport-local-1.6.2.jar new file mode 100644 index 0000000..34a7073 Binary files /dev/null and b/axis2_1.6/axis2-transport-local-1.6.2.jar differ diff --git a/axis2_1.6/axis2-xmlbeans-1.6.2.jar b/axis2_1.6/axis2-xmlbeans-1.6.2.jar new file mode 100644 index 0000000..58fba9b Binary files /dev/null and b/axis2_1.6/axis2-xmlbeans-1.6.2.jar differ diff --git a/axis2_1.6/bcel-5.1.jar b/axis2_1.6/bcel-5.1.jar new file mode 100644 index 0000000..524e375 Binary files /dev/null and b/axis2_1.6/bcel-5.1.jar differ diff --git a/axis2_1.6/commons-cli-1.2.jar b/axis2_1.6/commons-cli-1.2.jar new file mode 100644 index 0000000..ce4b9ff Binary files /dev/null and b/axis2_1.6/commons-cli-1.2.jar differ diff --git a/axis2_1.6/commons-codec-1.3.jar b/axis2_1.6/commons-codec-1.3.jar new file mode 100644 index 0000000..957b675 Binary files /dev/null and b/axis2_1.6/commons-codec-1.3.jar differ diff --git a/axis2_1.6/commons-fileupload-1.2.jar b/axis2_1.6/commons-fileupload-1.2.jar new file mode 100644 index 0000000..12539f5 Binary files /dev/null and b/axis2_1.6/commons-fileupload-1.2.jar differ diff --git a/axis2_1.6/commons-httpclient-3.1.jar b/axis2_1.6/commons-httpclient-3.1.jar new file mode 100644 index 0000000..7c59774 Binary files /dev/null and b/axis2_1.6/commons-httpclient-3.1.jar differ diff --git a/axis2_1.6/commons-io-1.4.jar b/axis2_1.6/commons-io-1.4.jar new file mode 100644 index 0000000..133dc6c Binary files /dev/null and b/axis2_1.6/commons-io-1.4.jar differ diff --git a/axis2_1.6/commons-logging-1.1.1.jar b/axis2_1.6/commons-logging-1.1.1.jar new file mode 100644 index 0000000..1deef14 Binary files /dev/null and b/axis2_1.6/commons-logging-1.1.1.jar differ diff --git a/axis2_1.6/geronimo-annotation_1.0_spec-1.1.jar b/axis2_1.6/geronimo-annotation_1.0_spec-1.1.jar new file mode 100644 index 0000000..7a6f529 Binary files /dev/null and b/axis2_1.6/geronimo-annotation_1.0_spec-1.1.jar differ diff --git a/axis2_1.6/geronimo-jaxws_2.2_spec-1.0.jar b/axis2_1.6/geronimo-jaxws_2.2_spec-1.0.jar new file mode 100644 index 0000000..888f839 Binary files /dev/null and b/axis2_1.6/geronimo-jaxws_2.2_spec-1.0.jar differ diff --git a/axis2_1.6/geronimo-jta_1.1_spec-1.1.jar b/axis2_1.6/geronimo-jta_1.1_spec-1.1.jar new file mode 100644 index 0000000..bba9290 Binary files /dev/null and b/axis2_1.6/geronimo-jta_1.1_spec-1.1.jar differ diff --git a/axis2_1.6/geronimo-saaj_1.3_spec-1.0.1.jar b/axis2_1.6/geronimo-saaj_1.3_spec-1.0.1.jar new file mode 100644 index 0000000..b2f6e81 Binary files /dev/null and b/axis2_1.6/geronimo-saaj_1.3_spec-1.0.1.jar differ diff --git a/axis2_1.6/geronimo-stax-api_1.0_spec-1.0.1.jar b/axis2_1.6/geronimo-stax-api_1.0_spec-1.0.1.jar new file mode 100644 index 0000000..ab1ee3b Binary files /dev/null and b/axis2_1.6/geronimo-stax-api_1.0_spec-1.0.1.jar differ diff --git a/axis2_1.6/geronimo-ws-metadata_2.0_spec-1.1.2.jar b/axis2_1.6/geronimo-ws-metadata_2.0_spec-1.1.2.jar new file mode 100644 index 0000000..c8a795a Binary files /dev/null and b/axis2_1.6/geronimo-ws-metadata_2.0_spec-1.1.2.jar differ diff --git a/axis2_1.6/httpcore-4.0.jar b/axis2_1.6/httpcore-4.0.jar new file mode 100644 index 0000000..37eb7d4 Binary files /dev/null and b/axis2_1.6/httpcore-4.0.jar differ diff --git a/axis2_1.6/jalopy-1.5rc3.jar b/axis2_1.6/jalopy-1.5rc3.jar new file mode 100644 index 0000000..fe51ce2 Binary files /dev/null and b/axis2_1.6/jalopy-1.5rc3.jar differ diff --git a/axis2_1.6/jaxb-api-2.1.jar b/axis2_1.6/jaxb-api-2.1.jar new file mode 100644 index 0000000..be3d6dc Binary files /dev/null and b/axis2_1.6/jaxb-api-2.1.jar differ diff --git a/axis2_1.6/jaxb-impl-2.1.7.jar b/axis2_1.6/jaxb-impl-2.1.7.jar new file mode 100644 index 0000000..034c158 Binary files /dev/null and b/axis2_1.6/jaxb-impl-2.1.7.jar differ diff --git a/axis2_1.6/jaxb-xjc-2.1.7.jar b/axis2_1.6/jaxb-xjc-2.1.7.jar new file mode 100644 index 0000000..ba2ec46 Binary files /dev/null and b/axis2_1.6/jaxb-xjc-2.1.7.jar differ diff --git a/axis2_1.6/jaxen-1.1.1.jar b/axis2_1.6/jaxen-1.1.1.jar new file mode 100644 index 0000000..b633631 Binary files /dev/null and b/axis2_1.6/jaxen-1.1.1.jar differ diff --git a/axis2_1.6/jaxws-tools-2.1.3.jar b/axis2_1.6/jaxws-tools-2.1.3.jar new file mode 100644 index 0000000..1006bfd Binary files /dev/null and b/axis2_1.6/jaxws-tools-2.1.3.jar differ diff --git a/axis2_1.6/jettison-1.0-RC2.jar b/axis2_1.6/jettison-1.0-RC2.jar new file mode 100644 index 0000000..3a00ed2 Binary files /dev/null and b/axis2_1.6/jettison-1.0-RC2.jar differ diff --git a/axis2_1.6/jibx-bind-1.2.jar b/axis2_1.6/jibx-bind-1.2.jar new file mode 100644 index 0000000..c8d3887 Binary files /dev/null and b/axis2_1.6/jibx-bind-1.2.jar differ diff --git a/axis2_1.6/jibx-run-1.2.jar b/axis2_1.6/jibx-run-1.2.jar new file mode 100644 index 0000000..6b467d3 Binary files /dev/null and b/axis2_1.6/jibx-run-1.2.jar differ diff --git a/axis2_1.6/jsr311-api-1.0.jar b/axis2_1.6/jsr311-api-1.0.jar new file mode 100644 index 0000000..2bede66 Binary files /dev/null and b/axis2_1.6/jsr311-api-1.0.jar differ diff --git a/axis2_1.6/juli-6.0.16.jar b/axis2_1.6/juli-6.0.16.jar new file mode 100644 index 0000000..c3fe977 Binary files /dev/null and b/axis2_1.6/juli-6.0.16.jar differ diff --git a/axis2_1.6/log4j-1.2.15.jar b/axis2_1.6/log4j-1.2.15.jar new file mode 100644 index 0000000..c930a6a Binary files /dev/null and b/axis2_1.6/log4j-1.2.15.jar differ diff --git a/axis2_1.6/mail-1.4.jar b/axis2_1.6/mail-1.4.jar new file mode 100644 index 0000000..fd4555b Binary files /dev/null and b/axis2_1.6/mail-1.4.jar differ diff --git a/axis2_1.6/mex-1.6.2-impl.jar b/axis2_1.6/mex-1.6.2-impl.jar new file mode 100644 index 0000000..ed67cf3 Binary files /dev/null and b/axis2_1.6/mex-1.6.2-impl.jar differ diff --git a/axis2_1.6/neethi-3.0.2.jar b/axis2_1.6/neethi-3.0.2.jar new file mode 100644 index 0000000..383efde Binary files /dev/null and b/axis2_1.6/neethi-3.0.2.jar differ diff --git a/axis2_1.6/regexp-1.2.jar b/axis2_1.6/regexp-1.2.jar new file mode 100644 index 0000000..713441c Binary files /dev/null and b/axis2_1.6/regexp-1.2.jar differ diff --git a/axis2_1.6/tribes-6.0.16.jar b/axis2_1.6/tribes-6.0.16.jar new file mode 100644 index 0000000..bb85de1 Binary files /dev/null and b/axis2_1.6/tribes-6.0.16.jar differ diff --git a/axis2_1.6/woden-api-1.0M9.jar b/axis2_1.6/woden-api-1.0M9.jar new file mode 100644 index 0000000..3b07e8e Binary files /dev/null and b/axis2_1.6/woden-api-1.0M9.jar differ diff --git a/axis2_1.6/woden-impl-commons-1.0M9.jar b/axis2_1.6/woden-impl-commons-1.0M9.jar new file mode 100644 index 0000000..f99c8d7 Binary files /dev/null and b/axis2_1.6/woden-impl-commons-1.0M9.jar differ diff --git a/axis2_1.6/woden-impl-dom-1.0M9.jar b/axis2_1.6/woden-impl-dom-1.0M9.jar new file mode 100644 index 0000000..0e3fff5 Binary files /dev/null and b/axis2_1.6/woden-impl-dom-1.0M9.jar differ diff --git a/axis2_1.6/wsdl4j-1.6.2.jar b/axis2_1.6/wsdl4j-1.6.2.jar new file mode 100644 index 0000000..b9ffc36 Binary files /dev/null and b/axis2_1.6/wsdl4j-1.6.2.jar differ diff --git a/axis2_1.6/wstx-asl-3.2.9.jar b/axis2_1.6/wstx-asl-3.2.9.jar new file mode 100644 index 0000000..ffdbd1f Binary files /dev/null and b/axis2_1.6/wstx-asl-3.2.9.jar differ diff --git a/axis2_1.6/xalan-2.7.0.jar b/axis2_1.6/xalan-2.7.0.jar new file mode 100644 index 0000000..007be39 Binary files /dev/null and b/axis2_1.6/xalan-2.7.0.jar differ diff --git a/axis2_1.6/xml-resolver-1.2.jar b/axis2_1.6/xml-resolver-1.2.jar new file mode 100644 index 0000000..e535bdc Binary files /dev/null and b/axis2_1.6/xml-resolver-1.2.jar differ diff --git a/axis2_1.6/xmlbeans-2.3.0.jar b/axis2_1.6/xmlbeans-2.3.0.jar new file mode 100644 index 0000000..ccd8163 Binary files /dev/null and b/axis2_1.6/xmlbeans-2.3.0.jar differ diff --git a/bin/com/connor/jk/plm/Activator.class b/bin/com/connor/jk/plm/Activator.class new file mode 100644 index 0000000..3625406 Binary files /dev/null and b/bin/com/connor/jk/plm/Activator.class differ diff --git a/bin/com/connor/jk/plm/Alarm/JK8WarnrNPINOAppForm_Action.class b/bin/com/connor/jk/plm/Alarm/JK8WarnrNPINOAppForm_Action.class new file mode 100644 index 0000000..63b9524 Binary files /dev/null and b/bin/com/connor/jk/plm/Alarm/JK8WarnrNPINOAppForm_Action.class differ diff --git a/bin/com/connor/jk/plm/Alarm/JK8WarnrNPINOAppForm_Command.class b/bin/com/connor/jk/plm/Alarm/JK8WarnrNPINOAppForm_Command.class new file mode 100644 index 0000000..69e2e54 Binary files /dev/null and b/bin/com/connor/jk/plm/Alarm/JK8WarnrNPINOAppForm_Command.class differ diff --git a/bin/com/connor/jk/plm/Alarm/JK8WarnrNPINOAppForm_Handler.class b/bin/com/connor/jk/plm/Alarm/JK8WarnrNPINOAppForm_Handler.class new file mode 100644 index 0000000..c3467d9 Binary files /dev/null and b/bin/com/connor/jk/plm/Alarm/JK8WarnrNPINOAppForm_Handler.class differ diff --git a/bin/com/connor/jk/plm/Alarm/JK8WarnrNPINOAppForm_Operation.class b/bin/com/connor/jk/plm/Alarm/JK8WarnrNPINOAppForm_Operation.class new file mode 100644 index 0000000..7e2aa4a Binary files /dev/null and b/bin/com/connor/jk/plm/Alarm/JK8WarnrNPINOAppForm_Operation.class differ diff --git a/bin/com/connor/jk/plm/Alarm/JK8_Alarm_Action.class b/bin/com/connor/jk/plm/Alarm/JK8_Alarm_Action.class new file mode 100644 index 0000000..dacc488 Binary files /dev/null and b/bin/com/connor/jk/plm/Alarm/JK8_Alarm_Action.class differ diff --git a/bin/com/connor/jk/plm/Alarm/JK8_Alarm_Command.class b/bin/com/connor/jk/plm/Alarm/JK8_Alarm_Command.class new file mode 100644 index 0000000..547d274 Binary files /dev/null and b/bin/com/connor/jk/plm/Alarm/JK8_Alarm_Command.class differ diff --git a/bin/com/connor/jk/plm/Alarm/JK8_Alarm_Handler.class b/bin/com/connor/jk/plm/Alarm/JK8_Alarm_Handler.class new file mode 100644 index 0000000..ca95fed Binary files /dev/null and b/bin/com/connor/jk/plm/Alarm/JK8_Alarm_Handler.class differ diff --git a/bin/com/connor/jk/plm/Alarm/JK8_Alarm_Operation.class b/bin/com/connor/jk/plm/Alarm/JK8_Alarm_Operation.class new file mode 100644 index 0000000..d82c071 Binary files /dev/null and b/bin/com/connor/jk/plm/Alarm/JK8_Alarm_Operation.class differ diff --git a/bin/com/connor/jk/plm/DbomToEbom/ChangeDbomBean.class b/bin/com/connor/jk/plm/DbomToEbom/ChangeDbomBean.class new file mode 100644 index 0000000..3010f8a Binary files /dev/null and b/bin/com/connor/jk/plm/DbomToEbom/ChangeDbomBean.class differ diff --git a/bin/com/connor/jk/plm/DbomToEbom/ChangeDbomCommand.class b/bin/com/connor/jk/plm/DbomToEbom/ChangeDbomCommand.class new file mode 100644 index 0000000..6c1af9b Binary files /dev/null and b/bin/com/connor/jk/plm/DbomToEbom/ChangeDbomCommand.class differ diff --git a/bin/com/connor/jk/plm/DbomToEbom/ChangeDbomDialog.class b/bin/com/connor/jk/plm/DbomToEbom/ChangeDbomDialog.class new file mode 100644 index 0000000..9642f1b Binary files /dev/null and b/bin/com/connor/jk/plm/DbomToEbom/ChangeDbomDialog.class differ diff --git a/bin/com/connor/jk/plm/DbomToEbom/ChangeDbomDialogInput$1.class b/bin/com/connor/jk/plm/DbomToEbom/ChangeDbomDialogInput$1.class new file mode 100644 index 0000000..4bb0bed Binary files /dev/null and b/bin/com/connor/jk/plm/DbomToEbom/ChangeDbomDialogInput$1.class differ diff --git a/bin/com/connor/jk/plm/DbomToEbom/ChangeDbomDialogInput$2.class b/bin/com/connor/jk/plm/DbomToEbom/ChangeDbomDialogInput$2.class new file mode 100644 index 0000000..19e4e1f Binary files /dev/null and b/bin/com/connor/jk/plm/DbomToEbom/ChangeDbomDialogInput$2.class differ diff --git a/bin/com/connor/jk/plm/DbomToEbom/ChangeDbomDialogInput.class b/bin/com/connor/jk/plm/DbomToEbom/ChangeDbomDialogInput.class new file mode 100644 index 0000000..cb43073 Binary files /dev/null and b/bin/com/connor/jk/plm/DbomToEbom/ChangeDbomDialogInput.class differ diff --git a/bin/com/connor/jk/plm/DbomToEbom/ChangeDbomHandler.class b/bin/com/connor/jk/plm/DbomToEbom/ChangeDbomHandler.class new file mode 100644 index 0000000..9b895bc Binary files /dev/null and b/bin/com/connor/jk/plm/DbomToEbom/ChangeDbomHandler.class differ diff --git a/bin/com/connor/jk/plm/DbomToEbom/ChangeDbomOperation.class b/bin/com/connor/jk/plm/DbomToEbom/ChangeDbomOperation.class new file mode 100644 index 0000000..4833ebe Binary files /dev/null and b/bin/com/connor/jk/plm/DbomToEbom/ChangeDbomOperation.class differ diff --git a/bin/com/connor/jk/plm/DbomToEbom/ChangeDbomUtil.class b/bin/com/connor/jk/plm/DbomToEbom/ChangeDbomUtil.class new file mode 100644 index 0000000..291c0e2 Binary files /dev/null and b/bin/com/connor/jk/plm/DbomToEbom/ChangeDbomUtil.class differ diff --git a/bin/com/connor/jk/plm/DbomToEbom/InputOperation.class b/bin/com/connor/jk/plm/DbomToEbom/InputOperation.class new file mode 100644 index 0000000..f86b6a5 Binary files /dev/null and b/bin/com/connor/jk/plm/DbomToEbom/InputOperation.class differ diff --git a/bin/com/connor/jk/plm/DbomToEbom/JoyoungStaticFinal.class b/bin/com/connor/jk/plm/DbomToEbom/JoyoungStaticFinal.class new file mode 100644 index 0000000..73e7937 Binary files /dev/null and b/bin/com/connor/jk/plm/DbomToEbom/JoyoungStaticFinal.class differ diff --git a/bin/com/connor/jk/plm/DbomToEbom/MyCellEditor.class b/bin/com/connor/jk/plm/DbomToEbom/MyCellEditor.class new file mode 100644 index 0000000..0c491e0 Binary files /dev/null and b/bin/com/connor/jk/plm/DbomToEbom/MyCellEditor.class differ diff --git a/bin/com/connor/jk/plm/DbomToEbom/ProgressBar$1.class b/bin/com/connor/jk/plm/DbomToEbom/ProgressBar$1.class new file mode 100644 index 0000000..e61f536 Binary files /dev/null and b/bin/com/connor/jk/plm/DbomToEbom/ProgressBar$1.class differ diff --git a/bin/com/connor/jk/plm/DbomToEbom/ProgressBar$TaskThread.class b/bin/com/connor/jk/plm/DbomToEbom/ProgressBar$TaskThread.class new file mode 100644 index 0000000..2f7fd0d Binary files /dev/null and b/bin/com/connor/jk/plm/DbomToEbom/ProgressBar$TaskThread.class differ diff --git a/bin/com/connor/jk/plm/DbomToEbom/ProgressBar.class b/bin/com/connor/jk/plm/DbomToEbom/ProgressBar.class new file mode 100644 index 0000000..772bfc1 Binary files /dev/null and b/bin/com/connor/jk/plm/DbomToEbom/ProgressBar.class differ diff --git a/bin/com/connor/jk/plm/DbomToEbom/ProgressBarThread.class b/bin/com/connor/jk/plm/DbomToEbom/ProgressBarThread.class new file mode 100644 index 0000000..4825187 Binary files /dev/null and b/bin/com/connor/jk/plm/DbomToEbom/ProgressBarThread.class differ diff --git a/bin/com/connor/jk/plm/DbomToEbom/TableComboxRender.class b/bin/com/connor/jk/plm/DbomToEbom/TableComboxRender.class new file mode 100644 index 0000000..5bbee90 Binary files /dev/null and b/bin/com/connor/jk/plm/DbomToEbom/TableComboxRender.class differ diff --git a/bin/com/connor/jk/plm/E_U8ToEBOM_New/AutoCompleter.class b/bin/com/connor/jk/plm/E_U8ToEBOM_New/AutoCompleter.class new file mode 100644 index 0000000..6243a79 Binary files /dev/null and b/bin/com/connor/jk/plm/E_U8ToEBOM_New/AutoCompleter.class differ diff --git a/bin/com/connor/jk/plm/E_U8ToEBOM_New/ClassProperty.class b/bin/com/connor/jk/plm/E_U8ToEBOM_New/ClassProperty.class new file mode 100644 index 0000000..62de91e Binary files /dev/null and b/bin/com/connor/jk/plm/E_U8ToEBOM_New/ClassProperty.class differ diff --git a/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8T0U8_Operation20191227备份 b/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8T0U8_Operation20191227备份 new file mode 100644 index 0000000..36d6314 --- /dev/null +++ b/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8T0U8_Operation20191227备份 @@ -0,0 +1,501 @@ +package com.connor.jk.plm.E_U8ToEBOM_New; + +import java.util.ArrayList; +import java.util.List; + +import javax.swing.JTextField; + +//import com.connor.jk.plm.tempToFormal.ClassProperty; +//import com.connor.jk.plm.tempToFormal.SoaServerUtil; +import com.teamcenter.rac.aif.AbstractAIFApplication; +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.TCComponentBOMViewRevision; +import com.teamcenter.rac.kernel.TCComponentBOMWindow; +import com.teamcenter.rac.kernel.TCComponentBOMWindowType; +import com.teamcenter.rac.kernel.TCComponentFolder; +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.TCComponentItemType; +import com.teamcenter.rac.kernel.TCComponentUser; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.kernel.TCTypeService; +import com.teamcenter.rac.kernel.TCUserService; +import com.teamcenter.rac.kernel.ics.ICSApplicationObject; +import com.teamcenter.rac.kernel.ics.ICSProperty; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.schemas.soa._2006_03.exceptions.ServiceException; + +public class E_U8ToU8_Operation extends AbstractAIFOperation { + private AbstractAIFApplication app; + private TCSession session; + private InterfaceAIFComponent targetComp; + private AIFComponentContext aif; + private String[] prop; + private TCProperty[] props; + private TCUserService userService; + private TCPreferenceService service; + private TCComponentItem target; + private TCComponentBOMLine line = null; + private TCComponentBOMWindow window=null; + private TCComponentBOMWindow windowOld=null; + private List childRevList;//봴JListй + + public E_U8ToU8_Operation(AbstractAIFApplication app2, AIFComponentContext aif, InterfaceAIFComponent targetComp, + TCSession session2) { + this.app = app2; + this.targetComp = targetComp; + this.aif = aif; + this.session = session2; + } + + private String itemId;// ʽϵID + private String itemRev;// ʽϵİ汾 + private String itemName;// ʽϵ + + private TCComponentItemRevision itemRevision;// ʽϵİ汾 + + private TCComponentItemRevision rev; + private TCComponentBOMViewRevision bomViewRevision; + private AIFComponentContext[] Context2; + String class_id ; + Integer[] keys = null; + String[] vals = null; + String url=""; + String[] propertyValue=null; + String[] properties=null; + String[] values=null; + @Override + public void executeOperation() throws Exception { + service=session.getPreferenceService(); + url= service.getStringValue("Autocode_SendClassServer_URL"); + // TODO + // 1.ȡѷ°汾ķ + class_id = ((TCComponent) aif.getComponent()).getClassificationClass(); + if(class_id==""){ + MessageBox.post("δִ࣬д˲", "", MessageBox.ERROR); + return; + } +// int a=1; +// target = (TCComponentItem) targetComp; + // TODO ѡ +// service = session.getPreferenceService(); + // String class_id=service.getStringValue(""); + if (aif.getComponent() instanceof TCComponentItemRevision) { + rev = (TCComponentItemRevision) aif.getComponent(); + + +// AIFComponentd + // object_name + props = rev.getTCProperties(new String[] { "object_name" }); + itemName = props[0].getStringValue(); + + // ID + props = rev.getTCProperties(new String[] { "item_id" }); + itemId = props[0].getStringValue().substring(2); + + } + + //ֻתһ汾 + TCComponentItem newitem =null; + TCComponentItemRevision newrev=null; + boolean isExist=false; + try { + //ӦȲѯһ¿ǷѾitemû½оֱӻȡ + newitem = rev.saveAsItem(itemId, null); + newrev = newitem.getLatestItemRevision();//°汾 + + } catch (Exception e1) { +// TCComponent[] u8items=session.search("...", new String[] {" ID"}, new String[] {itemId}); + InterfaceAIFComponent[] comps = null; + comps = Util.searchComponentsCollection(session,"...", new String[] { " ID" },new String[] { itemId }); + +// newitem=(TCComponentItem) u8items[0]; + newitem=(TCComponentItem) comps[0]; + //ҪѾɵu8bomǷѾ + if(newitem.getLatestItemRevision().getProperty("release_status_list").length()>0) { + + try { + newrev=newitem.getLatestItemRevision().saveAs(newitem.getNewRev()); + } catch (Exception e) { +// e.printStackTrace(); + } + isExist=true; + }else { + MessageBox.post("ѾΪU8,U8°Ƿ񷢲","",MessageBox.ERROR); + return; + } + + } + + if(isExist==false) { + + TCComponentUser user = this.session.getUser(); + TCComponentFolder newStuff = user.getNewStuffFolder(); + newStuff.add("contents", newitem); + } + + newitem.refresh(); + propertyValue=service.getStringValues("jk_prop_value");//ַ֧͵Ըֵ + TCComponentForm form1=(TCComponentForm) rev.getReferenceListProperty("IMAN_master_form_rev")[0]; + TCComponentForm form2=(TCComponentForm) newitem.getLatestItemRevision().getReferenceListProperty("IMAN_master_form_rev")[0]; + if(propertyValue==null) { + MessageBox.post("ϵԱѡjk_prop_value","",MessageBox.ERROR); + return; + } + for(int i=0;i"+keys[count1]); + vals[count1] = cPropS[j].getValue(); + System.out.println("vals["+count1+"]================>"+vals[count1]); + count1++; + } + break; + } +// if(a==1){ +// return; +// } + // TODO 2.,°汾͵ + // class_id = "";// TODO дѡ + try { +// createICS(class_id, newrev, newrev.getTCProperty("item_id").getStringValue(), keys, vals); + sendObjToClassficationByWebService(newitem.getLatestItemRevision(),keys,vals); + } catch (Exception e) { + MessageBox.post("ʧ","",MessageBox.ERROR); + e.printStackTrace(); + return; + } + + if(isSucceed==false) { + MessageBox.post("ʧ","",MessageBox.ERROR); + return; + } + + if (isExist == false) { + + MessageBox.post("" + itemId + "ɹ\nNewStuffļ", "ɹ", MessageBox.INFORMATION); + }else { + MessageBox.post("" + itemId + "ɹ", "ɹ", MessageBox.INFORMATION); + } + + } + + // ϰ汾͵ + public void createICS(String class_id, TCComponentItemRevision target, String partid, Integer[] integers, + String[] vals) throws TCException { + TCClassificationService myService = session.getClassificationService(); + ICSApplicationObject icsAppObj = myService.newICSApplicationObject("ICM"); + icsAppObj.create(partid, target.getUid()); + icsAppObj.setView(class_id); +// // ɾʱ +// rev = (TCComponentItemRevision) aif.getComponent(); +// TCComponentICO[] ico = rev.getClassificationObjects(); +// for (int i = 0; i < ico.length; i++) { +// ico[0].delete(); +// } + ICSProperty icspro[] = new ICSProperty[integers.length]; + + for (int i = 0; i < icspro.length; i++) { + System.out.println(" CLASS ID = " + integers[i] + " =" + vals[i]); + icspro[i] = new ICSProperty(integers[i], vals[i]); + } + icsAppObj.setProperties(icspro); +// icsAppObj.save();TODO ʲôã + } + + + + public TCComponentBOMLine getTopLineByRev(TCComponentItemRevision rev) {//öbomline + try { + TCTypeService service = session.getTypeService(); + TCComponentBOMWindowType winType = (TCComponentBOMWindowType) service + .getTypeComponent("BOMWindow"); + window = winType.create(null); + line = window.setWindowTopLine(rev.getItem(), rev, null, null); +// window.close();//رգᵼBOMռãBOMİ汾ɾTC + } catch (TCException e) { + e.printStackTrace(); + } + + return line; + } + public TCComponentBOMLine getTopLineByRev2(TCComponentItemRevision rev,TCComponentBOMWindow window) {//öbomline + try { + + line = window.setWindowTopLine(rev.getItem(), rev, null, null); +// window.close();//رգᵼBOMռãBOMİ汾ɾTC + } catch (TCException e) { + e.printStackTrace(); + } + + return line; + } + + private void setbom(TCComponentBOMLine line ,TCComponentItemRevision rev) {//bom + + try { +// setGlxq(rev); +// System.out.println("lineddd=" + line.toString()); + AIFComponentContext[] lins = line.getChildren(); + if (lins == null || lins.length <= 0) { + return; + } + for (AIFComponentContext l : lins) { + TCComponent lt = (TCComponent) l.getComponent(); + //bl_substitute_listԣб + String bl_substitute_list=((TCComponentBOMLine) lt).getProperty("bl_substitute_list"); + System.out.println("bl_substitute_list---->"+bl_substitute_list); + String[] substitute_list=bl_substitute_list.split(","); + System.out.println("bl_substitute_list=========>"+substitute_list.length); + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------1----------"+substitute_list[i]); + } + TCProperty[] tcs = ((TCComponentBOMLine) lt) + .getTCProperties(new String[] { + "bl_quantity","bl_sequence_no", +// "jk8SubstitRatio", "jk8SubstitOrder","jk8EffectiveDate","jk8SubCompLossRate",//治˻ȡ +// "bl_item_uom_tag","jk8TechnicModel","jk8SpecificModel",// + "JK8Remark","JK8SupplyType","JK8Warehouse", + "JK8RemarkDesc","jk8SubCompLossRate" + + });//ֿ⡢Ӧͣbl_substituteȣjk8SubstitRatiojk8SubstitOrderЧڣjk8EffectiveDate + line.lock(); + line.remove("", lt); + +// TCComponentItem chitem = ((TCComponentBOMLine) lt).getItem() +// .getLatestItemRevision().saveAsItem(null, null); +// TCComponentItemRevision r = chitem.getLatestItemRevision(); +// TCComponentItemRevision r=((TCComponentBOMLine) lt).getItem().getLatestItemRevision(); + TCComponentItemRevision r=((TCComponentBOMLine) lt).getItemRevision();//BOMLineӦItemRevision + System.out.println(line==null); + System.out.println(r==null); + TCComponentBOMLine childBomLine = line.add(r.getItem(), r, + null, false, ""); + if(substitute_list.length>0&&!bl_substitute_list.trim().equals("")){ + + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------------"+substitute_list[i]+"----------"); + TCComponentItemRevision itemRevision=((TCComponentItem)(session.search(" ID",new String[]{ " ID"}, new String[]{substitute_list[i].trim()})[0])).getLatestItemRevision(); + childBomLine.add(null, itemRevision, null, true); + } + } + childBomLine.setTCProperties(tcs); + + setbom(childBomLine,r); + line.save(); + line.unlock(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + + private void setbom2(TCComponentBOMWindow window,TCComponentBOMLine line ,TCComponentBOMLine lineOld,int mark) {//bom + System.out.println("bom"); + if (mark == 0) { + try { + AIFComponentContext[] lins = line.getChildren(); + if (lins == null || lins.length <= 0) { +// return; + }else { + window.lock(); + // ɾӼbomline + for (AIFComponentContext l : lins) { + System.out.println("ɾbom"); + TCComponent lt = (TCComponent) l.getComponent(); + + line.lock(); + line.remove("", lt); + line.save(); + line.unlock(); + } + } + + // ٰebomԸƽbomlineӹ + lins = lineOld.getChildren(); + if (lins == null || lins.length <= 0) { + return; + } + for (AIFComponentContext l : lins) { + TCComponent lt = (TCComponent) l.getComponent(); + //bl_substitute_listԣб + String bl_substitute_list=((TCComponentBOMLine) lt).getProperty("bl_substitute_list"); + System.out.println("bl_substitute_list---->"+bl_substitute_list); + String[] substitute_list=bl_substitute_list.split(","); + System.out.println("bl_substitute_list=========>"+substitute_list.length); + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------1----------"+substitute_list[i]); + } + TCProperty[] tcs = ((TCComponentBOMLine) lt) + .getTCProperties(new String[] { + "bl_quantity","bl_sequence_no", + "JK8Remark","JK8SupplyType","JK8Warehouse", + "JK8RemarkDesc","jk8SubCompLossRate" + + });//ֿ⡢Ӧͣbl_substituteȣjk8SubstitRatiojk8SubstitOrderЧڣjk8EffectiveDate + line.lock(); + + + TCComponentItemRevision r=((TCComponentBOMLine) lt).getItemRevision();//BOMLineӦItemRevision + + TCComponentBOMLine childBomLine = line.add(r.getItem(), r, + null, false, ""); + if(substitute_list.length>0&&!bl_substitute_list.trim().equals("")){ + + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------------"+substitute_list[i]+"----------"); + TCComponentItemRevision itemRevision=((TCComponentItem)(session.search(" ID",new String[]{ " ID"}, new String[]{substitute_list[i].trim()})[0])).getLatestItemRevision(); + childBomLine.add(null, itemRevision, null, true); + } + } + childBomLine.setTCProperties(tcs); + +// setbom2(childBomLine,r,1); + line.save(); + line.unlock(); + } + window.save(); + window.unlock(); + ; + } catch (Exception e) { + e.printStackTrace(); + } + } + + } + //͵ class_id=codeRemarkˮ룿 + boolean isSucceed=true; + public void sendObjToClassficationByWebService(TCComponentItemRevision rev,Integer[] keys, + String[] vals){ + try { + System.out.println("class_id-----dddddd----->"+class_id); + if( !class_id.replace(" ", "").equals("") ){ + + List propList = new ArrayList<>(); + for(int i = 0; i < keys.length; i++){ + ClassProperty prop = new ClassProperty(keys[i], vals[i]);// + propList.add(prop); + } + String json = SoaServerUtil.objectToJson(propList);//JavaתΪjson + try { + SoaServerUtil.grantWritePrivilege(session, rev);//дȨ + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + try { + SoaServerUtil.sendToClass(rev.getUid(), class_id, json,url);//͵ + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + try { + SoaServerUtil.grantReadPrivilege(session, rev);//Ȩ + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + } catch (Exception e) { + isSucceed=false; + e.printStackTrace(); + } + + } + +} diff --git a/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToEBOMBean.class b/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToEBOMBean.class new file mode 100644 index 0000000..23fb2c5 Binary files /dev/null and b/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToEBOMBean.class differ diff --git a/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToEBOMUtil.class b/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToEBOMUtil.class new file mode 100644 index 0000000..ba6c566 Binary files /dev/null and b/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToEBOMUtil.class differ diff --git a/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU820191210_Handler.class b/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU820191210_Handler.class new file mode 100644 index 0000000..8e8d627 Binary files /dev/null and b/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU820191210_Handler.class differ diff --git a/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Action.class b/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Action.class new file mode 100644 index 0000000..486f95e Binary files /dev/null and b/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Action.class differ diff --git a/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Action20191210.class b/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Action20191210.class new file mode 100644 index 0000000..a607a23 Binary files /dev/null and b/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Action20191210.class differ diff --git a/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Dialog$1.class b/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Dialog$1.class new file mode 100644 index 0000000..3b99138 Binary files /dev/null and b/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Dialog$1.class differ diff --git a/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Dialog$2.class b/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Dialog$2.class new file mode 100644 index 0000000..fb08456 Binary files /dev/null and b/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Dialog$2.class differ diff --git a/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Dialog$3.class b/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Dialog$3.class new file mode 100644 index 0000000..f36163c Binary files /dev/null and b/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Dialog$3.class differ diff --git a/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Dialog.class b/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Dialog.class new file mode 100644 index 0000000..63a96eb Binary files /dev/null and b/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Dialog.class differ diff --git a/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Dialog20190429 b/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Dialog20190429 new file mode 100644 index 0000000..e69de29 diff --git a/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Handler.class b/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Handler.class new file mode 100644 index 0000000..e565bb7 Binary files /dev/null and b/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Handler.class differ diff --git a/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Operation.class b/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Operation.class new file mode 100644 index 0000000..6b678d6 Binary files /dev/null and b/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Operation.class differ diff --git a/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Operation2 20190429 b/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Operation2 20190429 new file mode 100644 index 0000000..386b106 --- /dev/null +++ b/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Operation2 20190429 @@ -0,0 +1,532 @@ +package com.connor.jk.plm.E_U8ToEBOM_New; + +import java.util.ArrayList; +import java.util.List; + +import javax.swing.JTextField; + +//import com.connor.jk.plm.tempToFormal.ClassProperty; +//import com.connor.jk.plm.tempToFormal.SoaServerUtil; +import com.teamcenter.rac.aif.AbstractAIFApplication; +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.TCComponentBOMViewRevision; +import com.teamcenter.rac.kernel.TCComponentBOMWindow; +import com.teamcenter.rac.kernel.TCComponentBOMWindowType; +import com.teamcenter.rac.kernel.TCComponentFolder; +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.TCComponentItemType; +import com.teamcenter.rac.kernel.TCComponentUser; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.kernel.TCTypeService; +import com.teamcenter.rac.kernel.TCUserService; +import com.teamcenter.rac.kernel.ics.ICSApplicationObject; +import com.teamcenter.rac.kernel.ics.ICSProperty; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.schemas.soa._2006_03.exceptions.ServiceException; + +public class E_U8ToU8_Operation extends AbstractAIFOperation { + private AbstractAIFApplication app; + private TCSession session; + private InterfaceAIFComponent targetComp; + private AIFComponentContext aif; + private String[] prop; + private TCProperty[] props; + private TCUserService userService; + private TCPreferenceService service; + private TCComponentItem target; + private TCComponentBOMLine line = null; + private TCComponentBOMWindow window=null; + private TCComponentBOMWindow windowOld=null; + private List childRevList;//봴JListй + + public E_U8ToU8_Operation(AbstractAIFApplication app2, AIFComponentContext aif, InterfaceAIFComponent targetComp, + TCSession session2) { + this.app = app2; + this.targetComp = targetComp; + this.aif = aif; + this.session = session2; + } + + private String itemId;// ʽϵID + private String itemRev;// ʽϵİ汾 + private String itemName;// ʽϵ + + private TCComponentItemRevision itemRevision;// ʽϵİ汾 + + private TCComponentItemRevision rev; + private TCComponentBOMViewRevision bomViewRevision; + private AIFComponentContext[] Context2; + String class_id ; + Integer[] keys = null; + String[] vals = null; + String url=""; + String[] propertyValue=null; + String[] properties=null; + String[] values=null; + @Override + public void executeOperation() throws Exception { + service=session.getPreferenceService(); + url= service.getStringValue("Autocode_SendClassServer_URL"); + // TODO + // 1.ȡѷ°汾ķ + class_id = ((TCComponent) aif.getComponent()).getClassificationClass(); + if(class_id==""){ + MessageBox.post("δִ࣬д˲", "", MessageBox.ERROR); + return; + } +// int a=1; +// target = (TCComponentItem) targetComp; + // TODO ѡ +// service = session.getPreferenceService(); + // String class_id=service.getStringValue(""); + if (aif.getComponent() instanceof TCComponentItemRevision) { + rev = (TCComponentItemRevision) aif.getComponent(); + + +// AIFComponentd + // object_name + props = rev.getTCProperties(new String[] { "object_name" }); + itemName = props[0].getStringValue(); + + // ID + props = rev.getTCProperties(new String[] { "item_id" }); + itemId = props[0].getStringValue().substring(2); + + } + + //ֻתһ汾 + TCComponentItem newitem =null; + TCComponentItemRevision newrev=null; + boolean isExist=false; + try { + //ӦȲѯһ¿ǷѾitemû½оֱӻȡ + newitem = rev.saveAsItem(itemId, null); + newrev = newitem.getLatestItemRevision();//°汾 + + } catch (Exception e1) { +// TCComponent[] u8items=session.search("...", new String[] {" ID"}, new String[] {itemId}); + InterfaceAIFComponent[] comps = null; + comps = Util.searchComponentsCollection(session, + "...", new String[] { " ID" }, + new String[] { itemId }); + +// newitem=(TCComponentItem) u8items[0]; + newitem=(TCComponentItem) comps[0]; + //ҪѾɵu8bomǷѾ + if(newitem.getLatestItemRevision().getProperty("release_status_list").length()>0) { + + try { + newrev=newitem.getLatestItemRevision().saveAs(newitem.getNewRev()); + } catch (Exception e) { +// e.printStackTrace(); + } + isExist=true; + }else { + MessageBox.post("ѾΪU8,U8°Ƿ񷢲","",MessageBox.ERROR); + return; + } + + } + + if(isExist==false) { + + TCComponentUser user = this.session.getUser(); + TCComponentFolder newStuff = user.getNewStuffFolder(); + newStuff.add("contents", newitem); + } + + newitem.refresh(); + propertyValue=service.getStringValues("jk_prop_value");//ַ֧͵Ըֵ + TCComponentForm form1=(TCComponentForm) rev.getReferenceListProperty("IMAN_master_form_rev")[0]; + TCComponentForm form2=(TCComponentForm) newitem.getLatestItemRevision().getReferenceListProperty("IMAN_master_form_rev")[0]; + for(int i=0;i"+keys[count1]); + vals[count1] = cPropS[j].getValue(); + System.out.println("vals["+count1+"]================>"+vals[count1]); + count1++; + } + break; + } +// if(a==1){ +// return; +// } + // TODO 2.,°汾͵ + // class_id = "";// TODO дѡ + try { +// createICS(class_id, newrev, newrev.getTCProperty("item_id").getStringValue(), keys, vals); + sendObjToClassficationByWebService(newitem.getLatestItemRevision(),keys,vals); + } catch (Exception e) { + MessageBox.post("ʧ","",MessageBox.ERROR); + e.printStackTrace(); + return; + } + + if(isSucceed==false) { + MessageBox.post("ʧ","",MessageBox.ERROR); + return; + } + + if (isExist == false) { + + MessageBox.post("" + itemId + "ɹ\nNewStuffļ", "ɹ", MessageBox.INFORMATION); + }else { + MessageBox.post("" + itemId + "ɹ\nNewStuffļ", "ɹ", MessageBox.INFORMATION); + } + + } + + // ϰ汾͵ + public void createICS(String class_id, TCComponentItemRevision target, String partid, Integer[] integers, + String[] vals) throws TCException { + TCClassificationService myService = session.getClassificationService(); + ICSApplicationObject icsAppObj = myService.newICSApplicationObject("ICM"); + icsAppObj.create(partid, target.getUid()); + icsAppObj.setView(class_id); +// // ɾʱ +// rev = (TCComponentItemRevision) aif.getComponent(); +// TCComponentICO[] ico = rev.getClassificationObjects(); +// for (int i = 0; i < ico.length; i++) { +// ico[0].delete(); +// } + ICSProperty icspro[] = new ICSProperty[integers.length]; + + for (int i = 0; i < icspro.length; i++) { + System.out.println(" CLASS ID = " + integers[i] + " =" + vals[i]); + icspro[i] = new ICSProperty(integers[i], vals[i]); + } + icsAppObj.setProperties(icspro); +// icsAppObj.save();TODO ʲôã + } + + + + public TCComponentBOMLine getTopLineByRev(TCComponentItemRevision rev) {//öbomline + try { + TCTypeService service = session.getTypeService(); + TCComponentBOMWindowType winType = (TCComponentBOMWindowType) service + .getTypeComponent("BOMWindow"); + window = winType.create(null); + line = window.setWindowTopLine(rev.getItem(), rev, null, null); +// window.close();//رգᵼBOMռãBOMİ汾ɾTC + } catch (TCException e) { + e.printStackTrace(); + } + + return line; + } + public TCComponentBOMLine getTopLineByRev2(TCComponentItemRevision rev,TCComponentBOMWindow window) {//öbomline + try { + + line = window.setWindowTopLine(rev.getItem(), rev, null, null); +// window.close();//رգᵼBOMռãBOMİ汾ɾTC + } catch (TCException e) { + e.printStackTrace(); + } + + return line; + } + + private void setbom(TCComponentBOMLine line ,TCComponentItemRevision rev) {//bom + + try { +// setGlxq(rev); +// System.out.println("lineddd=" + line.toString()); + AIFComponentContext[] lins = line.getChildren(); + if (lins == null || lins.length <= 0) { + return; + } + for (AIFComponentContext l : lins) { + TCComponent lt = (TCComponent) l.getComponent(); + //bl_substitute_listԣб + String bl_substitute_list=((TCComponentBOMLine) lt).getProperty("bl_substitute_list"); + System.out.println("bl_substitute_list---->"+bl_substitute_list); + String[] substitute_list=bl_substitute_list.split(","); + System.out.println("bl_substitute_list=========>"+substitute_list.length); + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------1----------"+substitute_list[i]); + } + TCProperty[] tcs = ((TCComponentBOMLine) lt) + .getTCProperties(new String[] { + "bl_quantity","bl_sequence_no", +// "jk8SubstitRatio", "jk8SubstitOrder","jk8EffectiveDate","jk8SubCompLossRate",//治˻ȡ +// "bl_item_uom_tag","jk8TechnicModel","jk8SpecificModel",// + "JK8Remark","JK8SupplyType","JK8Warehouse", + "JK8RemarkDesc","jk8SubCompLossRate" + + });//ֿ⡢Ӧͣbl_substituteȣjk8SubstitRatiojk8SubstitOrderЧڣjk8EffectiveDate + line.lock(); + line.remove("", lt); + +// TCComponentItem chitem = ((TCComponentBOMLine) lt).getItem() +// .getLatestItemRevision().saveAsItem(null, null); +// TCComponentItemRevision r = chitem.getLatestItemRevision(); +// TCComponentItemRevision r=((TCComponentBOMLine) lt).getItem().getLatestItemRevision(); + TCComponentItemRevision r=((TCComponentBOMLine) lt).getItemRevision();//BOMLineӦItemRevision + + TCComponentBOMLine childBomLine = line.add(r.getItem(), r, + null, false, ""); + if(substitute_list.length>0&&!bl_substitute_list.trim().equals("")){ + + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------------"+substitute_list[i]+"----------"); + TCComponentItemRevision itemRevision=((TCComponentItem)(session.search(" ID",new String[]{ " ID"}, new String[]{substitute_list[i].trim()})[0])).getLatestItemRevision(); + childBomLine.add(null, itemRevision, null, true); + } + } + childBomLine.setTCProperties(tcs); + + setbom(childBomLine,r); + line.save(); + line.unlock(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + + private void setbom2(TCComponentBOMLine line ,TCComponentBOMLine lineOld,int mark) {//bom + + if (mark == 0) { + try { + AIFComponentContext[] lins = line.getChildren(); + if (lins == null || lins.length <= 0) { + return; + } + // ɾӼbomline + for (AIFComponentContext l : lins) { + TCComponent lt = (TCComponent) l.getComponent(); + + line.lock(); + line.remove("", lt); + line.save(); + line.unlock(); + } + // ٰebomԸƽbomlineӹ + lins = lineOld.getChildren(); + if (lins == null || lins.length <= 0) { + return; + } + for (AIFComponentContext l : lins) { + TCComponent lt = (TCComponent) l.getComponent(); + //bl_substitute_listԣб + String bl_substitute_list=((TCComponentBOMLine) lt).getProperty("bl_substitute_list"); + System.out.println("bl_substitute_list---->"+bl_substitute_list); + String[] substitute_list=bl_substitute_list.split(","); + System.out.println("bl_substitute_list=========>"+substitute_list.length); + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------1----------"+substitute_list[i]); + } + TCProperty[] tcs = ((TCComponentBOMLine) lt) + .getTCProperties(new String[] { + "bl_quantity","bl_sequence_no", + "JK8Remark","JK8SupplyType","JK8Warehouse", + "JK8RemarkDesc","jk8SubCompLossRate" + + });//ֿ⡢Ӧͣbl_substituteȣjk8SubstitRatiojk8SubstitOrderЧڣjk8EffectiveDate + line.lock(); + + + TCComponentItemRevision r=((TCComponentBOMLine) lt).getItemRevision();//BOMLineӦItemRevision + + TCComponentBOMLine childBomLine = line.add(r.getItem(), r, + null, false, ""); + if(substitute_list.length>0&&!bl_substitute_list.trim().equals("")){ + + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------------"+substitute_list[i]+"----------"); + TCComponentItemRevision itemRevision=((TCComponentItem)(session.search(" ID",new String[]{ " ID"}, new String[]{substitute_list[i].trim()})[0])).getLatestItemRevision(); + childBomLine.add(null, itemRevision, null, true); + } + } + childBomLine.setTCProperties(tcs); + +// setbom2(childBomLine,r,1); + line.save(); + line.unlock(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + /*try { + AIFComponentContext[] lins = line.getChildren(); + if (lins == null || lins.length <= 0) { + return; + } + for (AIFComponentContext l : lins) { + TCComponent lt = (TCComponent) l.getComponent(); + //bl_substitute_listԣб + String bl_substitute_list=((TCComponentBOMLine) lt).getProperty("bl_substitute_list"); + System.out.println("bl_substitute_list---->"+bl_substitute_list); + String[] substitute_list=bl_substitute_list.split(","); + System.out.println("bl_substitute_list=========>"+substitute_list.length); + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------1----------"+substitute_list[i]); + } + TCProperty[] tcs = ((TCComponentBOMLine) lt) + .getTCProperties(new String[] { + "bl_quantity","bl_sequence_no", + "JK8Remark","JK8SupplyType","JK8Warehouse", + "JK8RemarkDesc","jk8SubCompLossRate" + + });//ֿ⡢Ӧͣbl_substituteȣjk8SubstitRatiojk8SubstitOrderЧڣjk8EffectiveDate + line.lock(); + line.remove("", lt); + + + TCComponentItemRevision r=((TCComponentBOMLine) lt).getItemRevision();//BOMLineӦItemRevision + + TCComponentBOMLine childBomLine = line.add(r.getItem(), r, + null, false, ""); + if(substitute_list.length>0&&!bl_substitute_list.trim().equals("")){ + + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------------"+substitute_list[i]+"----------"); + TCComponentItemRevision itemRevision=((TCComponentItem)(session.search(" ID",new String[]{ " ID"}, new String[]{substitute_list[i].trim()})[0])).getLatestItemRevision(); + childBomLine.add(null, itemRevision, null, true); + } + } + childBomLine.setTCProperties(tcs); + + setbom2(childBomLine,r,1); + line.save(); + line.unlock(); + } + } catch (Exception e) { + e.printStackTrace(); + }*/ + } + //͵ class_id=codeRemarkˮ룿 + boolean isSucceed=true; + public void sendObjToClassficationByWebService(TCComponentItemRevision rev,Integer[] keys, + String[] vals){ + try { + System.out.println("class_id-----dddddd----->"+class_id); + if( !class_id.replace(" ", "").equals("") ){ + + List propList = new ArrayList<>(); + for(int i = 0; i < keys.length; i++){ + ClassProperty prop = new ClassProperty(keys[i], vals[i]);// + propList.add(prop); + } + String json = SoaServerUtil.objectToJson(propList);//JavaתΪjson + try { + SoaServerUtil.grantWritePrivilege(session, rev);//дȨ + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + try { + SoaServerUtil.sendToClass(rev.getUid(), class_id, json,url);//͵ + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + try { + SoaServerUtil.grantReadPrivilege(session, rev);//Ȩ + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + } catch (Exception e) { + isSucceed=false; + e.printStackTrace(); + } + + } + +} diff --git a/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Operation2.class b/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Operation2.class new file mode 100644 index 0000000..cad2689 Binary files /dev/null and b/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Operation2.class differ diff --git a/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Operation20191210.class b/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Operation20191210.class new file mode 100644 index 0000000..34dfcb0 Binary files /dev/null and b/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Operation20191210.class differ diff --git a/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_OperationBefore b/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_OperationBefore new file mode 100644 index 0000000..ab0958a --- /dev/null +++ b/bin/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_OperationBefore @@ -0,0 +1,319 @@ +package com.connor.jk.plm.E_U8ToEBOM_New; + +import java.util.ArrayList; +import java.util.List; + +import javax.swing.JTextField; + +//import com.connor.jk.plm.tempToFormal.ClassProperty; +//import com.connor.jk.plm.tempToFormal.SoaServerUtil; +import com.teamcenter.rac.aif.AbstractAIFApplication; +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.TCComponentBOMViewRevision; +import com.teamcenter.rac.kernel.TCComponentBOMWindow; +import com.teamcenter.rac.kernel.TCComponentBOMWindowType; +import com.teamcenter.rac.kernel.TCComponentFolder; +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.TCComponentItemType; +import com.teamcenter.rac.kernel.TCComponentUser; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.kernel.TCTypeService; +import com.teamcenter.rac.kernel.TCUserService; +import com.teamcenter.rac.kernel.ics.ICSApplicationObject; +import com.teamcenter.rac.kernel.ics.ICSProperty; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.schemas.soa._2006_03.exceptions.ServiceException; + +public class E_U8ToU8_Operation extends AbstractAIFOperation { + private AbstractAIFApplication app; + private TCSession session; + private InterfaceAIFComponent targetComp; + private AIFComponentContext aif; + private String[] prop; + private TCProperty[] props; + private TCUserService userService; + private TCPreferenceService service; + private TCComponentItem target; + private TCComponentBOMLine line = null; + private TCComponentBOMWindow window=null; + private List childRevList;//봴JListй + + public E_U8ToU8_Operation(AbstractAIFApplication app2, AIFComponentContext aif, InterfaceAIFComponent targetComp, + TCSession session2) { + this.app = app2; + this.targetComp = targetComp; + this.aif = aif; + this.session = session2; + } + + private String itemId;// ʽϵID + private String itemRev;// ʽϵİ汾 + private String itemName;// ʽϵ + + private TCComponentItemRevision itemRevision;// ʽϵİ汾 + + private TCComponentItemRevision rev; + private TCComponentBOMViewRevision bomViewRevision; + private AIFComponentContext[] Context2; + String class_id ; + Integer[] keys = null; + String[] vals = null; + String url=""; + @Override + public void executeOperation() throws Exception { + service=session.getPreferenceService(); + url= service.getStringValue("Autocode_SendClassServer_URL"); + // TODO + // 1.ȡѷ°汾ķ + class_id = ((TCComponent) aif.getComponent()).getClassificationClass(); + if(class_id==""){ + MessageBox.post("δִ࣬д˲", "", MessageBox.ERROR); + return; + } +// int a=1; +// target = (TCComponentItem) targetComp; + // TODO ѡ +// service = session.getPreferenceService(); + // String class_id=service.getStringValue(""); + if (aif.getComponent() instanceof TCComponentItemRevision) { + rev = (TCComponentItemRevision) aif.getComponent(); + + +// AIFComponentd + // object_name + props = rev.getTCProperties(new String[] { "object_name" }); + itemName = props[0].getStringValue(); + + // ID + props = rev.getTCProperties(new String[] { "item_id" }); + itemId = props[0].getStringValue().substring(2); + + + } + + //ֻתһ汾 + TCComponentItem newitem =null; + try { + //ӦȲѯһ¿ǷѾitemû½оֱӻȡ + newitem = rev.saveAsItem(itemId, null); + + } catch (Exception e1) { + e1.printStackTrace(); + MessageBox.post(e1.getMessage()+"\nϿѾΪU8,ϵͳ޸U8ϴڡ","",MessageBox.ERROR); + return; + } + TCComponentItemRevision newrev = newitem.getLatestItemRevision();//°汾 + + // newstuffļ + TCComponentUser user = this.session.getUser(); + TCComponentFolder newStuff = user.getNewStuffFolder(); + newStuff.add("contents", newitem); + + //2017.9.15 + TCComponentForm oldForm=(TCComponentForm)((TCComponentItemRevision)aif.getComponent()).getReferenceListProperty("IMAN_master_form_rev")[0]; + TCComponentForm newForm=(TCComponentForm) newrev.getReferenceListProperty("IMAN_master_form_rev")[0]; + try { + newForm.setTCProperties(oldForm.getAllTCProperties()); + } catch (Exception e1) { + e1.printStackTrace(); + } + + newForm.getTCProperty("object_name").setStringValue(oldForm.getTCProperty("object_name").getStringValue().split("E-")[1]); + if(newForm.getTCProperty("object_name").getStringValue().startsWith("8")) { + newForm.getTCProperty("jk8IsDomesticMarket").setStringValue(""); + } + //2018.5.7 û02ʱתʱ汾ͻʵʲӦ + String name=newForm.getTCProperty("object_name").getStringValue(); + System.out.println(name); + name=name.split("/")[0]+"/"+"01"; + newForm.getTCProperty("object_name").setStringValue(name); + //TODO ͼ + TCComponentBOMLine line = getTopLineByRev(newrev);//öbomline + if(line!=null){ + setbom(line,rev); + } + window.close(); + + rev = itemRevision; + TCComponentICO[] icoS = ((TCComponentItemRevision)aif.getComponent()).getClassificationObjects(); + + int count=0; + int count1=0; + System.out.println("icoS.length---------------"+icoS.length); + for (int i = 0; i < icoS.length; i++) { + ICSProperty[] cPropS = icoS[i].getICSProperties(true); + + for (int j = 0; j < cPropS.length; j++) { + System.out.println(count); + count++; + } + keys=new Integer[count]; + vals = new String[count]; + for (int j = 0; j < cPropS.length; j++) { + System.out.println(count); + keys[count1] = cPropS[j].getId(); + System.out.println("keys["+count1+"]================>"+keys[count1]); + vals[count1] = cPropS[j].getValue(); + System.out.println("vals["+count1+"]================>"+vals[count1]); + count1++; + } + break; + } +// if(a==1){ +// return; +// } + // TODO 2.,°汾͵ + // class_id = "";// TODO дѡ + try { +// createICS(class_id, newrev, newrev.getTCProperty("item_id").getStringValue(), keys, vals); + sendObjToClassficationByWebService(newrev,keys,vals); + } catch (Exception e) { + MessageBox.post("ʧ","",MessageBox.ERROR); + e.printStackTrace(); + return; + } + + if(isSucceed==false) { + MessageBox.post("ʧ","",MessageBox.ERROR); + return; + } + + + + MessageBox.post(""+itemId+"ɹ\nNewStuffļ", "ɹ", MessageBox.INFORMATION); + + } + + // ϰ汾͵ + public void createICS(String class_id, TCComponentItemRevision target, String partid, Integer[] integers, + String[] vals) throws TCException { + TCClassificationService myService = session.getClassificationService(); + ICSApplicationObject icsAppObj = myService.newICSApplicationObject("ICM"); + icsAppObj.create(partid, target.getUid()); + icsAppObj.setView(class_id); +// // ɾʱ +// rev = (TCComponentItemRevision) aif.getComponent(); +// TCComponentICO[] ico = rev.getClassificationObjects(); +// for (int i = 0; i < ico.length; i++) { +// ico[0].delete(); +// } + ICSProperty icspro[] = new ICSProperty[integers.length]; + + for (int i = 0; i < icspro.length; i++) { + System.out.println(" CLASS ID = " + integers[i] + " =" + vals[i]); + icspro[i] = new ICSProperty(integers[i], vals[i]); + } + icsAppObj.setProperties(icspro); +// icsAppObj.save();TODO ʲôã + } + + + + public TCComponentBOMLine getTopLineByRev(TCComponentItemRevision rev) {//öbomline + try { + TCTypeService service = session.getTypeService(); + TCComponentBOMWindowType winType = (TCComponentBOMWindowType) service + .getTypeComponent("BOMWindow"); + window = winType.create(null); + line = window.setWindowTopLine(rev.getItem(), rev, null, null); +// window.close();//رգᵼBOMռãBOMİ汾ɾTC + } catch (TCException e) { + e.printStackTrace(); + } + + return line; + } + + + private void setbom(TCComponentBOMLine line ,TCComponentItemRevision rev) {//bom + + try { +// setGlxq(rev); +// System.out.println("lineddd=" + line.toString()); + AIFComponentContext[] lins = line.getChildren(); + if (lins == null || lins.length <= 0) { + return; + } + for (AIFComponentContext l : lins) { + TCComponent lt = (TCComponent) l.getComponent(); + //bl_substitute_listԣб + String bl_substitute_list=((TCComponentBOMLine) lt).getProperty("bl_substitute_list"); + System.out.println("bl_substitute_list---->"+bl_substitute_list); + String[] substitute_list=bl_substitute_list.split(","); + System.out.println("bl_substitute_list=========>"+substitute_list.length); + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------1----------"+substitute_list[i]); + } + TCProperty[] tcs = ((TCComponentBOMLine) lt) + .getTCProperties(new String[] { + "bl_quantity","bl_sequence_no", +// "jk8SubstitRatio", "jk8SubstitOrder","jk8EffectiveDate","jk8SubCompLossRate",//治˻ȡ +// "bl_item_uom_tag","jk8TechnicModel","jk8SpecificModel",// + "JK8Remark","JK8SupplyType","JK8Warehouse", + "JK8RemarkDesc","jk8SubCompLossRate" + + });//ֿ⡢Ӧͣbl_substituteȣjk8SubstitRatiojk8SubstitOrderЧڣjk8EffectiveDate + line.lock(); + line.remove("", lt); + + TCComponentItemRevision r=((TCComponentBOMLine) lt).getItemRevision();//BOMLineӦItemRevision + + TCComponentBOMLine childBomLine = line.add(r.getItem(), r, + null, false, ""); + if(substitute_list.length>0&&!bl_substitute_list.trim().equals("")){ + + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------------"+substitute_list[i]+"----------"); + TCComponentItemRevision itemRevision=((TCComponentItem)(session.search(" ID",new String[]{ " ID"}, new String[]{substitute_list[i].trim()})[0])).getLatestItemRevision(); + childBomLine.add(null, itemRevision, null, true); + } + } + childBomLine.setTCProperties(tcs); + + setbom(childBomLine,r); + line.save(); + line.unlock(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + //͵ class_id=codeRemarkˮ룿 + boolean isSucceed=true; + public void sendObjToClassficationByWebService(TCComponentItemRevision rev,Integer[] keys, + String[] vals){ + try { + System.out.println("class_id-----dddddd----->"+class_id); + if( !class_id.replace(" ", "").equals("") ){ + + List propList = new ArrayList<>(); + for(int i = 0; i < keys.length; i++){ + ClassProperty prop = new ClassProperty(keys[i], vals[i]);// + propList.add(prop); + } + String json = SoaServerUtil.objectToJson(propList);//JavaתΪjson + SoaServerUtil.grantWritePrivilege(session, rev);//дȨ + SoaServerUtil.sendToClass(rev.getUid(), class_id, json,url);//͵ + + SoaServerUtil.grantReadPrivilege(session, rev);//Ȩ + } + + } catch (Exception e) { + isSucceed=false; + e.printStackTrace(); + } + + } + +} diff --git a/bin/com/connor/jk/plm/E_U8ToEBOM_New/JAutoCompleteComboBox.class b/bin/com/connor/jk/plm/E_U8ToEBOM_New/JAutoCompleteComboBox.class new file mode 100644 index 0000000..7ef6e8f Binary files /dev/null and b/bin/com/connor/jk/plm/E_U8ToEBOM_New/JAutoCompleteComboBox.class differ diff --git a/bin/com/connor/jk/plm/E_U8ToEBOM_New/ProgressBar$1.class b/bin/com/connor/jk/plm/E_U8ToEBOM_New/ProgressBar$1.class new file mode 100644 index 0000000..54631f9 Binary files /dev/null and b/bin/com/connor/jk/plm/E_U8ToEBOM_New/ProgressBar$1.class differ diff --git a/bin/com/connor/jk/plm/E_U8ToEBOM_New/ProgressBar$TaskThread.class b/bin/com/connor/jk/plm/E_U8ToEBOM_New/ProgressBar$TaskThread.class new file mode 100644 index 0000000..20e247c Binary files /dev/null and b/bin/com/connor/jk/plm/E_U8ToEBOM_New/ProgressBar$TaskThread.class differ diff --git a/bin/com/connor/jk/plm/E_U8ToEBOM_New/ProgressBar.class b/bin/com/connor/jk/plm/E_U8ToEBOM_New/ProgressBar.class new file mode 100644 index 0000000..ce47149 Binary files /dev/null and b/bin/com/connor/jk/plm/E_U8ToEBOM_New/ProgressBar.class differ diff --git a/bin/com/connor/jk/plm/E_U8ToEBOM_New/ProgressBarThread.class b/bin/com/connor/jk/plm/E_U8ToEBOM_New/ProgressBarThread.class new file mode 100644 index 0000000..24fd013 Binary files /dev/null and b/bin/com/connor/jk/plm/E_U8ToEBOM_New/ProgressBarThread.class differ diff --git a/bin/com/connor/jk/plm/E_U8ToEBOM_New/SoaServerUtil.class b/bin/com/connor/jk/plm/E_U8ToEBOM_New/SoaServerUtil.class new file mode 100644 index 0000000..e6bb5f7 Binary files /dev/null and b/bin/com/connor/jk/plm/E_U8ToEBOM_New/SoaServerUtil.class differ diff --git a/bin/com/connor/jk/plm/E_U8ToEBOM_New/Util.class b/bin/com/connor/jk/plm/E_U8ToEBOM_New/Util.class new file mode 100644 index 0000000..772ec53 Binary files /dev/null and b/bin/com/connor/jk/plm/E_U8ToEBOM_New/Util.class differ diff --git a/bin/com/connor/jk/plm/E_U8ToU8/ClassProperty.class b/bin/com/connor/jk/plm/E_U8ToU8/ClassProperty.class new file mode 100644 index 0000000..475ac98 Binary files /dev/null and b/bin/com/connor/jk/plm/E_U8ToU8/ClassProperty.class differ diff --git a/bin/com/connor/jk/plm/E_U8ToU8/E_U8ToU8_Action.class b/bin/com/connor/jk/plm/E_U8ToU8/E_U8ToU8_Action.class new file mode 100644 index 0000000..da7f5b8 Binary files /dev/null and b/bin/com/connor/jk/plm/E_U8ToU8/E_U8ToU8_Action.class differ diff --git a/bin/com/connor/jk/plm/E_U8ToU8/E_U8ToU8_Handler.class b/bin/com/connor/jk/plm/E_U8ToU8/E_U8ToU8_Handler.class new file mode 100644 index 0000000..1e1949e Binary files /dev/null and b/bin/com/connor/jk/plm/E_U8ToU8/E_U8ToU8_Handler.class differ diff --git a/bin/com/connor/jk/plm/E_U8ToU8/E_U8ToU8_Operation.class b/bin/com/connor/jk/plm/E_U8ToU8/E_U8ToU8_Operation.class new file mode 100644 index 0000000..e5b5896 Binary files /dev/null and b/bin/com/connor/jk/plm/E_U8ToU8/E_U8ToU8_Operation.class differ diff --git a/bin/com/connor/jk/plm/E_U8ToU8/SoaServerUtil.class b/bin/com/connor/jk/plm/E_U8ToU8/SoaServerUtil.class new file mode 100644 index 0000000..e4e8ec9 Binary files /dev/null and b/bin/com/connor/jk/plm/E_U8ToU8/SoaServerUtil.class differ diff --git a/bin/com/connor/jk/plm/EdaBomline/BomlineBean.class b/bin/com/connor/jk/plm/EdaBomline/BomlineBean.class new file mode 100644 index 0000000..80081ed Binary files /dev/null and b/bin/com/connor/jk/plm/EdaBomline/BomlineBean.class differ diff --git a/bin/com/connor/jk/plm/EdaBomline/EdaBomline_Action.class b/bin/com/connor/jk/plm/EdaBomline/EdaBomline_Action.class new file mode 100644 index 0000000..f7d9647 Binary files /dev/null and b/bin/com/connor/jk/plm/EdaBomline/EdaBomline_Action.class differ diff --git a/bin/com/connor/jk/plm/EdaBomline/EdaBomline_Command.class b/bin/com/connor/jk/plm/EdaBomline/EdaBomline_Command.class new file mode 100644 index 0000000..cbe1a4a Binary files /dev/null and b/bin/com/connor/jk/plm/EdaBomline/EdaBomline_Command.class differ diff --git a/bin/com/connor/jk/plm/EdaBomline/EdaBomline_Dialog.class b/bin/com/connor/jk/plm/EdaBomline/EdaBomline_Dialog.class new file mode 100644 index 0000000..5b58957 Binary files /dev/null and b/bin/com/connor/jk/plm/EdaBomline/EdaBomline_Dialog.class differ diff --git a/bin/com/connor/jk/plm/EdaBomline/EdaBomline_Handler.class b/bin/com/connor/jk/plm/EdaBomline/EdaBomline_Handler.class new file mode 100644 index 0000000..862488b Binary files /dev/null and b/bin/com/connor/jk/plm/EdaBomline/EdaBomline_Handler.class differ diff --git a/bin/com/connor/jk/plm/EdaBomline/EdaBomline_Operation.class b/bin/com/connor/jk/plm/EdaBomline/EdaBomline_Operation.class new file mode 100644 index 0000000..8900eed Binary files /dev/null and b/bin/com/connor/jk/plm/EdaBomline/EdaBomline_Operation.class differ diff --git a/bin/com/connor/jk/plm/EdaBomline/EdaInBomline_Action.class b/bin/com/connor/jk/plm/EdaBomline/EdaInBomline_Action.class new file mode 100644 index 0000000..9e84ff3 Binary files /dev/null and b/bin/com/connor/jk/plm/EdaBomline/EdaInBomline_Action.class differ diff --git a/bin/com/connor/jk/plm/EdaBomline/EdaInBomline_Command.class b/bin/com/connor/jk/plm/EdaBomline/EdaInBomline_Command.class new file mode 100644 index 0000000..15bc119 Binary files /dev/null and b/bin/com/connor/jk/plm/EdaBomline/EdaInBomline_Command.class differ diff --git a/bin/com/connor/jk/plm/EdaBomline/EdaInBomline_Dialog.class b/bin/com/connor/jk/plm/EdaBomline/EdaInBomline_Dialog.class new file mode 100644 index 0000000..6bf6e4e Binary files /dev/null and b/bin/com/connor/jk/plm/EdaBomline/EdaInBomline_Dialog.class differ diff --git a/bin/com/connor/jk/plm/EdaBomline/EdaInBomline_Handler.class b/bin/com/connor/jk/plm/EdaBomline/EdaInBomline_Handler.class new file mode 100644 index 0000000..25d56c7 Binary files /dev/null and b/bin/com/connor/jk/plm/EdaBomline/EdaInBomline_Handler.class differ diff --git a/bin/com/connor/jk/plm/EdaBomline/EdaInBomline_Operation.class b/bin/com/connor/jk/plm/EdaBomline/EdaInBomline_Operation.class new file mode 100644 index 0000000..560f617 Binary files /dev/null and b/bin/com/connor/jk/plm/EdaBomline/EdaInBomline_Operation.class differ diff --git a/bin/com/connor/jk/plm/MESreport/DataBaseControl.class b/bin/com/connor/jk/plm/MESreport/DataBaseControl.class new file mode 100644 index 0000000..19363b7 Binary files /dev/null and b/bin/com/connor/jk/plm/MESreport/DataBaseControl.class differ diff --git a/bin/com/connor/jk/plm/MESreport/DateChooser$1.class b/bin/com/connor/jk/plm/MESreport/DateChooser$1.class new file mode 100644 index 0000000..055938b Binary files /dev/null and b/bin/com/connor/jk/plm/MESreport/DateChooser$1.class differ diff --git a/bin/com/connor/jk/plm/MESreport/DateChooser$2.class b/bin/com/connor/jk/plm/MESreport/DateChooser$2.class new file mode 100644 index 0000000..0ade391 Binary files /dev/null and b/bin/com/connor/jk/plm/MESreport/DateChooser$2.class differ diff --git a/bin/com/connor/jk/plm/MESreport/DateChooser$3.class b/bin/com/connor/jk/plm/MESreport/DateChooser$3.class new file mode 100644 index 0000000..b6a217b Binary files /dev/null and b/bin/com/connor/jk/plm/MESreport/DateChooser$3.class differ diff --git a/bin/com/connor/jk/plm/MESreport/DateChooser$4.class b/bin/com/connor/jk/plm/MESreport/DateChooser$4.class new file mode 100644 index 0000000..329ee98 Binary files /dev/null and b/bin/com/connor/jk/plm/MESreport/DateChooser$4.class differ diff --git a/bin/com/connor/jk/plm/MESreport/DateChooser$JP1$1.class b/bin/com/connor/jk/plm/MESreport/DateChooser$JP1$1.class new file mode 100644 index 0000000..beef9e7 Binary files /dev/null and b/bin/com/connor/jk/plm/MESreport/DateChooser$JP1$1.class differ diff --git a/bin/com/connor/jk/plm/MESreport/DateChooser$JP1$2.class b/bin/com/connor/jk/plm/MESreport/DateChooser$JP1$2.class new file mode 100644 index 0000000..a78d272 Binary files /dev/null and b/bin/com/connor/jk/plm/MESreport/DateChooser$JP1$2.class differ diff --git a/bin/com/connor/jk/plm/MESreport/DateChooser$JP1$3.class b/bin/com/connor/jk/plm/MESreport/DateChooser$JP1$3.class new file mode 100644 index 0000000..51655e8 Binary files /dev/null and b/bin/com/connor/jk/plm/MESreport/DateChooser$JP1$3.class differ diff --git a/bin/com/connor/jk/plm/MESreport/DateChooser$JP1$4.class b/bin/com/connor/jk/plm/MESreport/DateChooser$JP1$4.class new file mode 100644 index 0000000..d2361c0 Binary files /dev/null and b/bin/com/connor/jk/plm/MESreport/DateChooser$JP1$4.class differ diff --git a/bin/com/connor/jk/plm/MESreport/DateChooser$JP1.class b/bin/com/connor/jk/plm/MESreport/DateChooser$JP1.class new file mode 100644 index 0000000..b7f82cf Binary files /dev/null and b/bin/com/connor/jk/plm/MESreport/DateChooser$JP1.class differ diff --git a/bin/com/connor/jk/plm/MESreport/DateChooser$JP2.class b/bin/com/connor/jk/plm/MESreport/DateChooser$JP2.class new file mode 100644 index 0000000..0be1b2d Binary files /dev/null and b/bin/com/connor/jk/plm/MESreport/DateChooser$JP2.class differ diff --git a/bin/com/connor/jk/plm/MESreport/DateChooser$JP3.class b/bin/com/connor/jk/plm/MESreport/DateChooser$JP3.class new file mode 100644 index 0000000..7c8800e Binary files /dev/null and b/bin/com/connor/jk/plm/MESreport/DateChooser$JP3.class differ diff --git a/bin/com/connor/jk/plm/MESreport/DateChooser$JP4$1.class b/bin/com/connor/jk/plm/MESreport/DateChooser$JP4$1.class new file mode 100644 index 0000000..692690e Binary files /dev/null and b/bin/com/connor/jk/plm/MESreport/DateChooser$JP4$1.class differ diff --git a/bin/com/connor/jk/plm/MESreport/DateChooser$JP4.class b/bin/com/connor/jk/plm/MESreport/DateChooser$JP4.class new file mode 100644 index 0000000..7267718 Binary files /dev/null and b/bin/com/connor/jk/plm/MESreport/DateChooser$JP4.class differ diff --git a/bin/com/connor/jk/plm/MESreport/DateChooser$LabelManager.class b/bin/com/connor/jk/plm/MESreport/DateChooser$LabelManager.class new file mode 100644 index 0000000..10888cd Binary files /dev/null and b/bin/com/connor/jk/plm/MESreport/DateChooser$LabelManager.class differ diff --git a/bin/com/connor/jk/plm/MESreport/DateChooser$MyLabel.class b/bin/com/connor/jk/plm/MESreport/DateChooser$MyLabel.class new file mode 100644 index 0000000..c98fdfe Binary files /dev/null and b/bin/com/connor/jk/plm/MESreport/DateChooser$MyLabel.class differ diff --git a/bin/com/connor/jk/plm/MESreport/DateChooser.class b/bin/com/connor/jk/plm/MESreport/DateChooser.class new file mode 100644 index 0000000..b3362e1 Binary files /dev/null and b/bin/com/connor/jk/plm/MESreport/DateChooser.class differ diff --git a/bin/com/connor/jk/plm/MESreport/MESreportDialog$1.class b/bin/com/connor/jk/plm/MESreport/MESreportDialog$1.class new file mode 100644 index 0000000..9d19ac5 Binary files /dev/null and b/bin/com/connor/jk/plm/MESreport/MESreportDialog$1.class differ diff --git a/bin/com/connor/jk/plm/MESreport/MESreportDialog.class b/bin/com/connor/jk/plm/MESreport/MESreportDialog.class new file mode 100644 index 0000000..77d4a29 Binary files /dev/null and b/bin/com/connor/jk/plm/MESreport/MESreportDialog.class differ diff --git a/bin/com/connor/jk/plm/MESreport/MESreportHandler.class b/bin/com/connor/jk/plm/MESreport/MESreportHandler.class new file mode 100644 index 0000000..5f9cf06 Binary files /dev/null and b/bin/com/connor/jk/plm/MESreport/MESreportHandler.class differ diff --git a/bin/com/connor/jk/plm/MESreport/MESreportOperation$1.class b/bin/com/connor/jk/plm/MESreport/MESreportOperation$1.class new file mode 100644 index 0000000..3b50a94 Binary files /dev/null and b/bin/com/connor/jk/plm/MESreport/MESreportOperation$1.class differ diff --git a/bin/com/connor/jk/plm/MESreport/MESreportOperation$WaitingDialog.class b/bin/com/connor/jk/plm/MESreport/MESreportOperation$WaitingDialog.class new file mode 100644 index 0000000..31e9d1b Binary files /dev/null and b/bin/com/connor/jk/plm/MESreport/MESreportOperation$WaitingDialog.class differ diff --git a/bin/com/connor/jk/plm/MESreport/MESreportOperation.class b/bin/com/connor/jk/plm/MESreport/MESreportOperation.class new file mode 100644 index 0000000..c93d622 Binary files /dev/null and b/bin/com/connor/jk/plm/MESreport/MESreportOperation.class differ diff --git a/bin/com/connor/jk/plm/MESreport/Test$1.class b/bin/com/connor/jk/plm/MESreport/Test$1.class new file mode 100644 index 0000000..a414d5c Binary files /dev/null and b/bin/com/connor/jk/plm/MESreport/Test$1.class differ diff --git a/bin/com/connor/jk/plm/MESreport/Test.class b/bin/com/connor/jk/plm/MESreport/Test.class new file mode 100644 index 0000000..89f4d0f Binary files /dev/null and b/bin/com/connor/jk/plm/MESreport/Test.class differ diff --git a/bin/com/connor/jk/plm/ModifyClassify/ModifyClassify_Handler.class b/bin/com/connor/jk/plm/ModifyClassify/ModifyClassify_Handler.class new file mode 100644 index 0000000..49f2038 Binary files /dev/null and b/bin/com/connor/jk/plm/ModifyClassify/ModifyClassify_Handler.class differ diff --git a/bin/com/connor/jk/plm/TC_OA_Integration/IntegrationBean.class b/bin/com/connor/jk/plm/TC_OA_Integration/IntegrationBean.class new file mode 100644 index 0000000..002fdb1 Binary files /dev/null and b/bin/com/connor/jk/plm/TC_OA_Integration/IntegrationBean.class differ diff --git a/bin/com/connor/jk/plm/TC_OA_Integration/Integration_Action.class b/bin/com/connor/jk/plm/TC_OA_Integration/Integration_Action.class new file mode 100644 index 0000000..8c92dd5 Binary files /dev/null and b/bin/com/connor/jk/plm/TC_OA_Integration/Integration_Action.class differ diff --git a/bin/com/connor/jk/plm/TC_OA_Integration/Integration_Handler.class b/bin/com/connor/jk/plm/TC_OA_Integration/Integration_Handler.class new file mode 100644 index 0000000..05fb547 Binary files /dev/null and b/bin/com/connor/jk/plm/TC_OA_Integration/Integration_Handler.class differ diff --git a/bin/com/connor/jk/plm/TC_OA_Integration/ProgressBar$1.class b/bin/com/connor/jk/plm/TC_OA_Integration/ProgressBar$1.class new file mode 100644 index 0000000..4effd2a Binary files /dev/null and b/bin/com/connor/jk/plm/TC_OA_Integration/ProgressBar$1.class differ diff --git a/bin/com/connor/jk/plm/TC_OA_Integration/ProgressBar$TaskThread.class b/bin/com/connor/jk/plm/TC_OA_Integration/ProgressBar$TaskThread.class new file mode 100644 index 0000000..2f2ab3e Binary files /dev/null and b/bin/com/connor/jk/plm/TC_OA_Integration/ProgressBar$TaskThread.class differ diff --git a/bin/com/connor/jk/plm/TC_OA_Integration/ProgressBar.class b/bin/com/connor/jk/plm/TC_OA_Integration/ProgressBar.class new file mode 100644 index 0000000..4b54f33 Binary files /dev/null and b/bin/com/connor/jk/plm/TC_OA_Integration/ProgressBar.class differ diff --git a/bin/com/connor/jk/plm/TC_OA_Integration/ProgressBarThread.class b/bin/com/connor/jk/plm/TC_OA_Integration/ProgressBarThread.class new file mode 100644 index 0000000..30d058d Binary files /dev/null and b/bin/com/connor/jk/plm/TC_OA_Integration/ProgressBarThread.class differ diff --git a/bin/com/connor/jk/plm/TC_OA_Integration/ProjTestHandler$1.class b/bin/com/connor/jk/plm/TC_OA_Integration/ProjTestHandler$1.class new file mode 100644 index 0000000..32ef417 Binary files /dev/null and b/bin/com/connor/jk/plm/TC_OA_Integration/ProjTestHandler$1.class differ diff --git a/bin/com/connor/jk/plm/TC_OA_Integration/ProjTestHandler.class b/bin/com/connor/jk/plm/TC_OA_Integration/ProjTestHandler.class new file mode 100644 index 0000000..8800142 Binary files /dev/null and b/bin/com/connor/jk/plm/TC_OA_Integration/ProjTestHandler.class differ diff --git a/bin/com/connor/jk/plm/TC_OA_Integration/SqlUtil.class b/bin/com/connor/jk/plm/TC_OA_Integration/SqlUtil.class new file mode 100644 index 0000000..eb39511 Binary files /dev/null and b/bin/com/connor/jk/plm/TC_OA_Integration/SqlUtil.class differ diff --git a/bin/com/connor/jk/plm/TC_OA_Integration/TEST.class b/bin/com/connor/jk/plm/TC_OA_Integration/TEST.class new file mode 100644 index 0000000..42e2cce Binary files /dev/null and b/bin/com/connor/jk/plm/TC_OA_Integration/TEST.class differ diff --git a/bin/com/connor/jk/plm/TC_OA_Integration/database.properties b/bin/com/connor/jk/plm/TC_OA_Integration/database.properties new file mode 100644 index 0000000..8ce8340 --- /dev/null +++ b/bin/com/connor/jk/plm/TC_OA_Integration/database.properties @@ -0,0 +1,20 @@ +# +#ORACEL_NAME=tc +# +#ORACEL_PASSWORD=Tc123456 +# +##ORACEL_URL=jdbc:oracle:thin:@192.168.1.248:1521:TOPPROD +# +#ORACEL_URL=jdbc:microsoft:sqlserver://10.200.1.33:1433;DatabaseName=ecology +# +#ORACEL_DRIVER=com.microsoft.jdbc.sqlserver.SQLServerDriver + +ORACEL_NAME=tc + +ORACEL_PASSWORD=Tc_1234 + +#ORACEL_URL=jdbc:oracle:thin:@192.168.1.248:1521:TOPPROD + +ORACEL_URL=jdbc:microsoft:sqlserver://10.200.1.66:1433;DatabaseName=ecology + +ORACEL_DRIVER=com.microsoft.jdbc.sqlserver.SQLServerDriver \ No newline at end of file diff --git a/bin/com/connor/jk/plm/Testlog.class b/bin/com/connor/jk/plm/Testlog.class new file mode 100644 index 0000000..12c9b3c Binary files /dev/null and b/bin/com/connor/jk/plm/Testlog.class differ diff --git a/bin/com/connor/jk/plm/YSXQForm/CalendarPanel$1.class b/bin/com/connor/jk/plm/YSXQForm/CalendarPanel$1.class new file mode 100644 index 0000000..459fa31 Binary files /dev/null and b/bin/com/connor/jk/plm/YSXQForm/CalendarPanel$1.class differ diff --git a/bin/com/connor/jk/plm/YSXQForm/CalendarPanel$2.class b/bin/com/connor/jk/plm/YSXQForm/CalendarPanel$2.class new file mode 100644 index 0000000..b5a71f2 Binary files /dev/null and b/bin/com/connor/jk/plm/YSXQForm/CalendarPanel$2.class differ diff --git a/bin/com/connor/jk/plm/YSXQForm/CalendarPanel$3.class b/bin/com/connor/jk/plm/YSXQForm/CalendarPanel$3.class new file mode 100644 index 0000000..424cec3 Binary files /dev/null and b/bin/com/connor/jk/plm/YSXQForm/CalendarPanel$3.class differ diff --git a/bin/com/connor/jk/plm/YSXQForm/CalendarPanel$4.class b/bin/com/connor/jk/plm/YSXQForm/CalendarPanel$4.class new file mode 100644 index 0000000..134a11c Binary files /dev/null and b/bin/com/connor/jk/plm/YSXQForm/CalendarPanel$4.class differ diff --git a/bin/com/connor/jk/plm/YSXQForm/CalendarPanel$5.class b/bin/com/connor/jk/plm/YSXQForm/CalendarPanel$5.class new file mode 100644 index 0000000..858a56d Binary files /dev/null and b/bin/com/connor/jk/plm/YSXQForm/CalendarPanel$5.class differ diff --git a/bin/com/connor/jk/plm/YSXQForm/CalendarPanel$6.class b/bin/com/connor/jk/plm/YSXQForm/CalendarPanel$6.class new file mode 100644 index 0000000..ca9a095 Binary files /dev/null and b/bin/com/connor/jk/plm/YSXQForm/CalendarPanel$6.class differ diff --git a/bin/com/connor/jk/plm/YSXQForm/CalendarPanel$7.class b/bin/com/connor/jk/plm/YSXQForm/CalendarPanel$7.class new file mode 100644 index 0000000..46cdd7c Binary files /dev/null and b/bin/com/connor/jk/plm/YSXQForm/CalendarPanel$7.class differ diff --git a/bin/com/connor/jk/plm/YSXQForm/CalendarPanel.class b/bin/com/connor/jk/plm/YSXQForm/CalendarPanel.class new file mode 100644 index 0000000..1d2e6fa Binary files /dev/null and b/bin/com/connor/jk/plm/YSXQForm/CalendarPanel.class differ diff --git a/bin/com/connor/jk/plm/YSXQForm/DefaultTableCellRenderer2.class b/bin/com/connor/jk/plm/YSXQForm/DefaultTableCellRenderer2.class new file mode 100644 index 0000000..5b6d348 Binary files /dev/null and b/bin/com/connor/jk/plm/YSXQForm/DefaultTableCellRenderer2.class differ diff --git a/bin/com/connor/jk/plm/YSXQForm/JK8_YSXQ_Form$1.class b/bin/com/connor/jk/plm/YSXQForm/JK8_YSXQ_Form$1.class new file mode 100644 index 0000000..cd85729 Binary files /dev/null and b/bin/com/connor/jk/plm/YSXQForm/JK8_YSXQ_Form$1.class differ diff --git a/bin/com/connor/jk/plm/YSXQForm/JK8_YSXQ_Form$2.class b/bin/com/connor/jk/plm/YSXQForm/JK8_YSXQ_Form$2.class new file mode 100644 index 0000000..9bae741 Binary files /dev/null and b/bin/com/connor/jk/plm/YSXQForm/JK8_YSXQ_Form$2.class differ diff --git a/bin/com/connor/jk/plm/YSXQForm/JK8_YSXQ_Form$3.class b/bin/com/connor/jk/plm/YSXQForm/JK8_YSXQ_Form$3.class new file mode 100644 index 0000000..0ee2354 Binary files /dev/null and b/bin/com/connor/jk/plm/YSXQForm/JK8_YSXQ_Form$3.class differ diff --git a/bin/com/connor/jk/plm/YSXQForm/JK8_YSXQ_Form.class b/bin/com/connor/jk/plm/YSXQForm/JK8_YSXQ_Form.class new file mode 100644 index 0000000..b668e3a Binary files /dev/null and b/bin/com/connor/jk/plm/YSXQForm/JK8_YSXQ_Form.class differ diff --git a/bin/com/connor/jk/plm/YSXQForm/JK8_YSXQ_Form_Dialog$1.class b/bin/com/connor/jk/plm/YSXQForm/JK8_YSXQ_Form_Dialog$1.class new file mode 100644 index 0000000..e6de845 Binary files /dev/null and b/bin/com/connor/jk/plm/YSXQForm/JK8_YSXQ_Form_Dialog$1.class differ diff --git a/bin/com/connor/jk/plm/YSXQForm/JK8_YSXQ_Form_Dialog$2.class b/bin/com/connor/jk/plm/YSXQForm/JK8_YSXQ_Form_Dialog$2.class new file mode 100644 index 0000000..0020c06 Binary files /dev/null and b/bin/com/connor/jk/plm/YSXQForm/JK8_YSXQ_Form_Dialog$2.class differ diff --git a/bin/com/connor/jk/plm/YSXQForm/JK8_YSXQ_Form_Dialog$3.class b/bin/com/connor/jk/plm/YSXQForm/JK8_YSXQ_Form_Dialog$3.class new file mode 100644 index 0000000..6fdedc4 Binary files /dev/null and b/bin/com/connor/jk/plm/YSXQForm/JK8_YSXQ_Form_Dialog$3.class differ diff --git a/bin/com/connor/jk/plm/YSXQForm/JK8_YSXQ_Form_Dialog.class b/bin/com/connor/jk/plm/YSXQForm/JK8_YSXQ_Form_Dialog.class new file mode 100644 index 0000000..ba11982 Binary files /dev/null and b/bin/com/connor/jk/plm/YSXQForm/JK8_YSXQ_Form_Dialog.class differ diff --git a/bin/com/connor/jk/plm/YSXQForm/JTable2.class b/bin/com/connor/jk/plm/YSXQForm/JTable2.class new file mode 100644 index 0000000..9701a3b Binary files /dev/null and b/bin/com/connor/jk/plm/YSXQForm/JTable2.class differ diff --git a/bin/com/connor/jk/plm/YSXQForm/JTableModel2.class b/bin/com/connor/jk/plm/YSXQForm/JTableModel2.class new file mode 100644 index 0000000..465b1ab Binary files /dev/null and b/bin/com/connor/jk/plm/YSXQForm/JTableModel2.class differ diff --git a/bin/com/connor/jk/plm/YSXQForm/RolloverSpinnerListModel.class b/bin/com/connor/jk/plm/YSXQForm/RolloverSpinnerListModel.class new file mode 100644 index 0000000..f775677 Binary files /dev/null and b/bin/com/connor/jk/plm/YSXQForm/RolloverSpinnerListModel.class differ diff --git a/bin/com/connor/jk/plm/YSXQForm/TableWithRowHead$ButtonColumn.class b/bin/com/connor/jk/plm/YSXQForm/TableWithRowHead$ButtonColumn.class new file mode 100644 index 0000000..5fc4059 Binary files /dev/null and b/bin/com/connor/jk/plm/YSXQForm/TableWithRowHead$ButtonColumn.class differ diff --git a/bin/com/connor/jk/plm/YSXQForm/TableWithRowHead.class b/bin/com/connor/jk/plm/YSXQForm/TableWithRowHead.class new file mode 100644 index 0000000..8cf15ce Binary files /dev/null and b/bin/com/connor/jk/plm/YSXQForm/TableWithRowHead.class differ diff --git a/bin/com/connor/jk/plm/addMark/ProgressBar$1.class b/bin/com/connor/jk/plm/addMark/ProgressBar$1.class new file mode 100644 index 0000000..1a5cc8f Binary files /dev/null and b/bin/com/connor/jk/plm/addMark/ProgressBar$1.class differ diff --git a/bin/com/connor/jk/plm/addMark/ProgressBar$TaskThread.class b/bin/com/connor/jk/plm/addMark/ProgressBar$TaskThread.class new file mode 100644 index 0000000..39fe04a Binary files /dev/null and b/bin/com/connor/jk/plm/addMark/ProgressBar$TaskThread.class differ diff --git a/bin/com/connor/jk/plm/addMark/ProgressBar.class b/bin/com/connor/jk/plm/addMark/ProgressBar.class new file mode 100644 index 0000000..3ea8359 Binary files /dev/null and b/bin/com/connor/jk/plm/addMark/ProgressBar.class differ diff --git a/bin/com/connor/jk/plm/addMark/ProgressBarThread.class b/bin/com/connor/jk/plm/addMark/ProgressBarThread.class new file mode 100644 index 0000000..13154d3 Binary files /dev/null and b/bin/com/connor/jk/plm/addMark/ProgressBarThread.class differ diff --git a/bin/com/connor/jk/plm/addMark/Util.class b/bin/com/connor/jk/plm/addMark/Util.class new file mode 100644 index 0000000..45c9119 Binary files /dev/null and b/bin/com/connor/jk/plm/addMark/Util.class differ diff --git a/bin/com/connor/jk/plm/addMark/addMark_Action.class b/bin/com/connor/jk/plm/addMark/addMark_Action.class new file mode 100644 index 0000000..639ebb0 Binary files /dev/null and b/bin/com/connor/jk/plm/addMark/addMark_Action.class differ diff --git a/bin/com/connor/jk/plm/addMark/addMark_Bean.class b/bin/com/connor/jk/plm/addMark/addMark_Bean.class new file mode 100644 index 0000000..0f88153 Binary files /dev/null and b/bin/com/connor/jk/plm/addMark/addMark_Bean.class differ diff --git a/bin/com/connor/jk/plm/addMark/addMark_Dialog$1.class b/bin/com/connor/jk/plm/addMark/addMark_Dialog$1.class new file mode 100644 index 0000000..5b5c6c3 Binary files /dev/null and b/bin/com/connor/jk/plm/addMark/addMark_Dialog$1.class differ diff --git a/bin/com/connor/jk/plm/addMark/addMark_Dialog$2.class b/bin/com/connor/jk/plm/addMark/addMark_Dialog$2.class new file mode 100644 index 0000000..c8237f2 Binary files /dev/null and b/bin/com/connor/jk/plm/addMark/addMark_Dialog$2.class differ diff --git a/bin/com/connor/jk/plm/addMark/addMark_Dialog$3.class b/bin/com/connor/jk/plm/addMark/addMark_Dialog$3.class new file mode 100644 index 0000000..563ca33 Binary files /dev/null and b/bin/com/connor/jk/plm/addMark/addMark_Dialog$3.class differ diff --git a/bin/com/connor/jk/plm/addMark/addMark_Dialog.class b/bin/com/connor/jk/plm/addMark/addMark_Dialog.class new file mode 100644 index 0000000..0173cd1 Binary files /dev/null and b/bin/com/connor/jk/plm/addMark/addMark_Dialog.class differ diff --git a/bin/com/connor/jk/plm/addMark/addMark_Handler.class b/bin/com/connor/jk/plm/addMark/addMark_Handler.class new file mode 100644 index 0000000..6f6844c Binary files /dev/null and b/bin/com/connor/jk/plm/addMark/addMark_Handler.class differ diff --git a/bin/com/connor/jk/plm/addMark/addMark_Operation.class b/bin/com/connor/jk/plm/addMark/addMark_Operation.class new file mode 100644 index 0000000..22a6d1f Binary files /dev/null and b/bin/com/connor/jk/plm/addMark/addMark_Operation.class differ diff --git a/bin/com/connor/jk/plm/allBomline/Dialog$1.class b/bin/com/connor/jk/plm/allBomline/Dialog$1.class new file mode 100644 index 0000000..d29e803 Binary files /dev/null and b/bin/com/connor/jk/plm/allBomline/Dialog$1.class differ diff --git a/bin/com/connor/jk/plm/allBomline/Dialog$2.class b/bin/com/connor/jk/plm/allBomline/Dialog$2.class new file mode 100644 index 0000000..55d2a3f Binary files /dev/null and b/bin/com/connor/jk/plm/allBomline/Dialog$2.class differ diff --git a/bin/com/connor/jk/plm/allBomline/Dialog$3.class b/bin/com/connor/jk/plm/allBomline/Dialog$3.class new file mode 100644 index 0000000..19bd392 Binary files /dev/null and b/bin/com/connor/jk/plm/allBomline/Dialog$3.class differ diff --git a/bin/com/connor/jk/plm/allBomline/Dialog.class b/bin/com/connor/jk/plm/allBomline/Dialog.class new file mode 100644 index 0000000..ec8eef1 Binary files /dev/null and b/bin/com/connor/jk/plm/allBomline/Dialog.class differ diff --git a/bin/com/connor/jk/plm/allBomline/Global_Action.class b/bin/com/connor/jk/plm/allBomline/Global_Action.class new file mode 100644 index 0000000..e22d971 Binary files /dev/null and b/bin/com/connor/jk/plm/allBomline/Global_Action.class differ diff --git a/bin/com/connor/jk/plm/allBomline/Global_Command.class b/bin/com/connor/jk/plm/allBomline/Global_Command.class new file mode 100644 index 0000000..4eb6534 Binary files /dev/null and b/bin/com/connor/jk/plm/allBomline/Global_Command.class differ diff --git a/bin/com/connor/jk/plm/allBomline/Global_Dialog$1.class b/bin/com/connor/jk/plm/allBomline/Global_Dialog$1.class new file mode 100644 index 0000000..2cbeadc Binary files /dev/null and b/bin/com/connor/jk/plm/allBomline/Global_Dialog$1.class differ diff --git a/bin/com/connor/jk/plm/allBomline/Global_Dialog$2.class b/bin/com/connor/jk/plm/allBomline/Global_Dialog$2.class new file mode 100644 index 0000000..9f32183 Binary files /dev/null and b/bin/com/connor/jk/plm/allBomline/Global_Dialog$2.class differ diff --git a/bin/com/connor/jk/plm/allBomline/Global_Dialog$3.class b/bin/com/connor/jk/plm/allBomline/Global_Dialog$3.class new file mode 100644 index 0000000..e56d178 Binary files /dev/null and b/bin/com/connor/jk/plm/allBomline/Global_Dialog$3.class differ diff --git a/bin/com/connor/jk/plm/allBomline/Global_Dialog$4.class b/bin/com/connor/jk/plm/allBomline/Global_Dialog$4.class new file mode 100644 index 0000000..65bd1b5 Binary files /dev/null and b/bin/com/connor/jk/plm/allBomline/Global_Dialog$4.class differ diff --git a/bin/com/connor/jk/plm/allBomline/Global_Dialog.class b/bin/com/connor/jk/plm/allBomline/Global_Dialog.class new file mode 100644 index 0000000..1d18d77 Binary files /dev/null and b/bin/com/connor/jk/plm/allBomline/Global_Dialog.class differ diff --git a/bin/com/connor/jk/plm/allBomline/Global_Handler.class b/bin/com/connor/jk/plm/allBomline/Global_Handler.class new file mode 100644 index 0000000..52f229f Binary files /dev/null and b/bin/com/connor/jk/plm/allBomline/Global_Handler.class differ diff --git a/bin/com/connor/jk/plm/allBomline/ManageGlobalAlternatesPanel$1.class b/bin/com/connor/jk/plm/allBomline/ManageGlobalAlternatesPanel$1.class new file mode 100644 index 0000000..f61bef3 Binary files /dev/null and b/bin/com/connor/jk/plm/allBomline/ManageGlobalAlternatesPanel$1.class differ diff --git a/bin/com/connor/jk/plm/allBomline/ManageGlobalAlternatesPanel$2.class b/bin/com/connor/jk/plm/allBomline/ManageGlobalAlternatesPanel$2.class new file mode 100644 index 0000000..b02f292 Binary files /dev/null and b/bin/com/connor/jk/plm/allBomline/ManageGlobalAlternatesPanel$2.class differ diff --git a/bin/com/connor/jk/plm/allBomline/ManageGlobalAlternatesPanel$3.class b/bin/com/connor/jk/plm/allBomline/ManageGlobalAlternatesPanel$3.class new file mode 100644 index 0000000..9b17154 Binary files /dev/null and b/bin/com/connor/jk/plm/allBomline/ManageGlobalAlternatesPanel$3.class differ diff --git a/bin/com/connor/jk/plm/allBomline/ManageGlobalAlternatesPanel$4.class b/bin/com/connor/jk/plm/allBomline/ManageGlobalAlternatesPanel$4.class new file mode 100644 index 0000000..a63d7ae Binary files /dev/null and b/bin/com/connor/jk/plm/allBomline/ManageGlobalAlternatesPanel$4.class differ diff --git a/bin/com/connor/jk/plm/allBomline/ManageGlobalAlternatesPanel$GlobalAlternates.class b/bin/com/connor/jk/plm/allBomline/ManageGlobalAlternatesPanel$GlobalAlternates.class new file mode 100644 index 0000000..3963a66 Binary files /dev/null and b/bin/com/connor/jk/plm/allBomline/ManageGlobalAlternatesPanel$GlobalAlternates.class differ diff --git a/bin/com/connor/jk/plm/allBomline/ManageGlobalAlternatesPanel.class b/bin/com/connor/jk/plm/allBomline/ManageGlobalAlternatesPanel.class new file mode 100644 index 0000000..c476e40 Binary files /dev/null and b/bin/com/connor/jk/plm/allBomline/ManageGlobalAlternatesPanel.class differ diff --git a/bin/com/connor/jk/plm/bom/until/ExcelUtil.class b/bin/com/connor/jk/plm/bom/until/ExcelUtil.class new file mode 100644 index 0000000..b500f19 Binary files /dev/null and b/bin/com/connor/jk/plm/bom/until/ExcelUtil.class differ diff --git a/bin/com/connor/jk/plm/bom/until/ExcelUtil07.class b/bin/com/connor/jk/plm/bom/until/ExcelUtil07.class new file mode 100644 index 0000000..b6a9d62 Binary files /dev/null and b/bin/com/connor/jk/plm/bom/until/ExcelUtil07.class differ diff --git a/bin/com/connor/jk/plm/bom/until/Logger.class b/bin/com/connor/jk/plm/bom/until/Logger.class new file mode 100644 index 0000000..7195106 Binary files /dev/null and b/bin/com/connor/jk/plm/bom/until/Logger.class differ diff --git a/bin/com/connor/jk/plm/bom/until/ProgressBar$1.class b/bin/com/connor/jk/plm/bom/until/ProgressBar$1.class new file mode 100644 index 0000000..59c5902 Binary files /dev/null and b/bin/com/connor/jk/plm/bom/until/ProgressBar$1.class differ diff --git a/bin/com/connor/jk/plm/bom/until/ProgressBar$TaskThread.class b/bin/com/connor/jk/plm/bom/until/ProgressBar$TaskThread.class new file mode 100644 index 0000000..b7b7c90 Binary files /dev/null and b/bin/com/connor/jk/plm/bom/until/ProgressBar$TaskThread.class differ diff --git a/bin/com/connor/jk/plm/bom/until/ProgressBar.class b/bin/com/connor/jk/plm/bom/until/ProgressBar.class new file mode 100644 index 0000000..b411ab1 Binary files /dev/null and b/bin/com/connor/jk/plm/bom/until/ProgressBar.class differ diff --git a/bin/com/connor/jk/plm/bom/until/ProgressBarThread.class b/bin/com/connor/jk/plm/bom/until/ProgressBarThread.class new file mode 100644 index 0000000..074dcad Binary files /dev/null and b/bin/com/connor/jk/plm/bom/until/ProgressBarThread.class differ diff --git a/bin/com/connor/jk/plm/bom/until/SearchUtility.class b/bin/com/connor/jk/plm/bom/until/SearchUtility.class new file mode 100644 index 0000000..94b272d Binary files /dev/null and b/bin/com/connor/jk/plm/bom/until/SearchUtility.class differ diff --git a/bin/com/connor/jk/plm/classify/ClassifyDialog$1.class b/bin/com/connor/jk/plm/classify/ClassifyDialog$1.class new file mode 100644 index 0000000..3b50c62 Binary files /dev/null and b/bin/com/connor/jk/plm/classify/ClassifyDialog$1.class differ diff --git a/bin/com/connor/jk/plm/classify/ClassifyDialog$2.class b/bin/com/connor/jk/plm/classify/ClassifyDialog$2.class new file mode 100644 index 0000000..09af940 Binary files /dev/null and b/bin/com/connor/jk/plm/classify/ClassifyDialog$2.class differ diff --git a/bin/com/connor/jk/plm/classify/ClassifyDialog$3.class b/bin/com/connor/jk/plm/classify/ClassifyDialog$3.class new file mode 100644 index 0000000..14160bc Binary files /dev/null and b/bin/com/connor/jk/plm/classify/ClassifyDialog$3.class differ diff --git a/bin/com/connor/jk/plm/classify/ClassifyDialog.class b/bin/com/connor/jk/plm/classify/ClassifyDialog.class new file mode 100644 index 0000000..746ef79 Binary files /dev/null and b/bin/com/connor/jk/plm/classify/ClassifyDialog.class differ diff --git a/bin/com/connor/jk/plm/classify/ClassifyHandler.class b/bin/com/connor/jk/plm/classify/ClassifyHandler.class new file mode 100644 index 0000000..e801f59 Binary files /dev/null and b/bin/com/connor/jk/plm/classify/ClassifyHandler.class differ diff --git a/bin/com/connor/jk/plm/classify/ClassifyHandler_2.class b/bin/com/connor/jk/plm/classify/ClassifyHandler_2.class new file mode 100644 index 0000000..48ad958 Binary files /dev/null and b/bin/com/connor/jk/plm/classify/ClassifyHandler_2.class differ diff --git a/bin/com/connor/jk/plm/classify/ClassifyHandler_3.class b/bin/com/connor/jk/plm/classify/ClassifyHandler_3.class new file mode 100644 index 0000000..6ebc9fb Binary files /dev/null and b/bin/com/connor/jk/plm/classify/ClassifyHandler_3.class differ diff --git a/bin/com/connor/jk/plm/classify/ClassifyOperation.class b/bin/com/connor/jk/plm/classify/ClassifyOperation.class new file mode 100644 index 0000000..f83fe0d Binary files /dev/null and b/bin/com/connor/jk/plm/classify/ClassifyOperation.class differ diff --git a/bin/com/connor/jk/plm/classify/ClassifyOperation_3.class b/bin/com/connor/jk/plm/classify/ClassifyOperation_3.class new file mode 100644 index 0000000..9daa96d Binary files /dev/null and b/bin/com/connor/jk/plm/classify/ClassifyOperation_3.class differ diff --git a/bin/com/connor/jk/plm/classify/ClassifyValBean.class b/bin/com/connor/jk/plm/classify/ClassifyValBean.class new file mode 100644 index 0000000..1f5e0d4 Binary files /dev/null and b/bin/com/connor/jk/plm/classify/ClassifyValBean.class differ diff --git a/bin/com/connor/jk/plm/classify/DataBaseControl.class b/bin/com/connor/jk/plm/classify/DataBaseControl.class new file mode 100644 index 0000000..fde91ba Binary files /dev/null and b/bin/com/connor/jk/plm/classify/DataBaseControl.class differ diff --git a/bin/com/connor/jk/plm/createPCBForm/CreateDerPCBForm_Handler.class b/bin/com/connor/jk/plm/createPCBForm/CreateDerPCBForm_Handler.class new file mode 100644 index 0000000..9a6adf3 Binary files /dev/null and b/bin/com/connor/jk/plm/createPCBForm/CreateDerPCBForm_Handler.class differ diff --git a/bin/com/connor/jk/plm/createPCBForm/CreatePCBForm_Action.class b/bin/com/connor/jk/plm/createPCBForm/CreatePCBForm_Action.class new file mode 100644 index 0000000..2c9d823 Binary files /dev/null and b/bin/com/connor/jk/plm/createPCBForm/CreatePCBForm_Action.class differ diff --git a/bin/com/connor/jk/plm/createPCBForm/CreatePCBForm_Command.class b/bin/com/connor/jk/plm/createPCBForm/CreatePCBForm_Command.class new file mode 100644 index 0000000..ac404d6 Binary files /dev/null and b/bin/com/connor/jk/plm/createPCBForm/CreatePCBForm_Command.class differ diff --git a/bin/com/connor/jk/plm/createPCBForm/CreatePCBForm_Handler.class b/bin/com/connor/jk/plm/createPCBForm/CreatePCBForm_Handler.class new file mode 100644 index 0000000..68b078d Binary files /dev/null and b/bin/com/connor/jk/plm/createPCBForm/CreatePCBForm_Handler.class differ diff --git a/bin/com/connor/jk/plm/createPCBForm/CreatePCBForm_Operation.class b/bin/com/connor/jk/plm/createPCBForm/CreatePCBForm_Operation.class new file mode 100644 index 0000000..3c76b19 Binary files /dev/null and b/bin/com/connor/jk/plm/createPCBForm/CreatePCBForm_Operation.class differ diff --git a/bin/com/connor/jk/plm/createproject/CreateProjrct_Action.class b/bin/com/connor/jk/plm/createproject/CreateProjrct_Action.class new file mode 100644 index 0000000..d70e58d Binary files /dev/null and b/bin/com/connor/jk/plm/createproject/CreateProjrct_Action.class differ diff --git a/bin/com/connor/jk/plm/createproject/CreateProjrct_Command.class b/bin/com/connor/jk/plm/createproject/CreateProjrct_Command.class new file mode 100644 index 0000000..4b3ce28 Binary files /dev/null and b/bin/com/connor/jk/plm/createproject/CreateProjrct_Command.class differ diff --git a/bin/com/connor/jk/plm/createproject/CreateProjrct_Dialog$1.class b/bin/com/connor/jk/plm/createproject/CreateProjrct_Dialog$1.class new file mode 100644 index 0000000..fdba071 Binary files /dev/null and b/bin/com/connor/jk/plm/createproject/CreateProjrct_Dialog$1.class differ diff --git a/bin/com/connor/jk/plm/createproject/CreateProjrct_Dialog$2.class b/bin/com/connor/jk/plm/createproject/CreateProjrct_Dialog$2.class new file mode 100644 index 0000000..eef116d Binary files /dev/null and b/bin/com/connor/jk/plm/createproject/CreateProjrct_Dialog$2.class differ diff --git a/bin/com/connor/jk/plm/createproject/CreateProjrct_Dialog$3.class b/bin/com/connor/jk/plm/createproject/CreateProjrct_Dialog$3.class new file mode 100644 index 0000000..4355e4f Binary files /dev/null and b/bin/com/connor/jk/plm/createproject/CreateProjrct_Dialog$3.class differ diff --git a/bin/com/connor/jk/plm/createproject/CreateProjrct_Dialog.class b/bin/com/connor/jk/plm/createproject/CreateProjrct_Dialog.class new file mode 100644 index 0000000..c7d7482 Binary files /dev/null and b/bin/com/connor/jk/plm/createproject/CreateProjrct_Dialog.class differ diff --git a/bin/com/connor/jk/plm/createproject/CreateProjrct_Operation.class b/bin/com/connor/jk/plm/createproject/CreateProjrct_Operation.class new file mode 100644 index 0000000..fd583ae Binary files /dev/null and b/bin/com/connor/jk/plm/createproject/CreateProjrct_Operation.class differ diff --git a/bin/com/connor/jk/plm/createproject/GetLsmUtil.class b/bin/com/connor/jk/plm/createproject/GetLsmUtil.class new file mode 100644 index 0000000..9184be7 Binary files /dev/null and b/bin/com/connor/jk/plm/createproject/GetLsmUtil.class differ diff --git a/bin/com/connor/jk/plm/createproject/createproject_locale.properties b/bin/com/connor/jk/plm/createproject/createproject_locale.properties new file mode 100644 index 0000000..960b080 --- /dev/null +++ b/bin/com/connor/jk/plm/createproject/createproject_locale.properties @@ -0,0 +1,5 @@ +JdbcDriverClass=oracle.jdbc.driver.OracleDriver +ConnectionString=jdbc:oracle:thin:@10.200.2.43:1521:jktc +DbUser=serial_number +DbPass=serial_number + diff --git a/bin/com/connor/jk/plm/downloadDS/DownloadDSDialog.class b/bin/com/connor/jk/plm/downloadDS/DownloadDSDialog.class new file mode 100644 index 0000000..d260ed7 Binary files /dev/null and b/bin/com/connor/jk/plm/downloadDS/DownloadDSDialog.class differ diff --git a/bin/com/connor/jk/plm/downloadDS/DownloadDSHandler.class b/bin/com/connor/jk/plm/downloadDS/DownloadDSHandler.class new file mode 100644 index 0000000..b14d7c2 Binary files /dev/null and b/bin/com/connor/jk/plm/downloadDS/DownloadDSHandler.class differ diff --git a/bin/com/connor/jk/plm/downloadDS/DownloadDSOperation$1.class b/bin/com/connor/jk/plm/downloadDS/DownloadDSOperation$1.class new file mode 100644 index 0000000..54cb352 Binary files /dev/null and b/bin/com/connor/jk/plm/downloadDS/DownloadDSOperation$1.class differ diff --git a/bin/com/connor/jk/plm/downloadDS/DownloadDSOperation$WaitingDialog.class b/bin/com/connor/jk/plm/downloadDS/DownloadDSOperation$WaitingDialog.class new file mode 100644 index 0000000..8e5b7b4 Binary files /dev/null and b/bin/com/connor/jk/plm/downloadDS/DownloadDSOperation$WaitingDialog.class differ diff --git a/bin/com/connor/jk/plm/downloadDS/DownloadDSOperation.class b/bin/com/connor/jk/plm/downloadDS/DownloadDSOperation.class new file mode 100644 index 0000000..f354928 Binary files /dev/null and b/bin/com/connor/jk/plm/downloadDS/DownloadDSOperation.class differ diff --git a/bin/com/connor/jk/plm/exportBOM/ProgressBar$1.class b/bin/com/connor/jk/plm/exportBOM/ProgressBar$1.class new file mode 100644 index 0000000..197771d Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM/ProgressBar$1.class differ diff --git a/bin/com/connor/jk/plm/exportBOM/ProgressBar$TaskThread.class b/bin/com/connor/jk/plm/exportBOM/ProgressBar$TaskThread.class new file mode 100644 index 0000000..3ba00d0 Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM/ProgressBar$TaskThread.class differ diff --git a/bin/com/connor/jk/plm/exportBOM/ProgressBar.class b/bin/com/connor/jk/plm/exportBOM/ProgressBar.class new file mode 100644 index 0000000..7708ff1 Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM/ProgressBar.class differ diff --git a/bin/com/connor/jk/plm/exportBOM/ProgressBarThread.class b/bin/com/connor/jk/plm/exportBOM/ProgressBarThread.class new file mode 100644 index 0000000..9375984 Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM/ProgressBarThread.class differ diff --git a/bin/com/connor/jk/plm/exportBOM/exportBOM_Action.class b/bin/com/connor/jk/plm/exportBOM/exportBOM_Action.class new file mode 100644 index 0000000..2d4c162 Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM/exportBOM_Action.class differ diff --git a/bin/com/connor/jk/plm/exportBOM/exportBOM_Bean.class b/bin/com/connor/jk/plm/exportBOM/exportBOM_Bean.class new file mode 100644 index 0000000..4e6cc16 Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM/exportBOM_Bean.class differ diff --git a/bin/com/connor/jk/plm/exportBOM/exportBOM_Dialog$1.class b/bin/com/connor/jk/plm/exportBOM/exportBOM_Dialog$1.class new file mode 100644 index 0000000..c5eebb9 Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM/exportBOM_Dialog$1.class differ diff --git a/bin/com/connor/jk/plm/exportBOM/exportBOM_Dialog$2.class b/bin/com/connor/jk/plm/exportBOM/exportBOM_Dialog$2.class new file mode 100644 index 0000000..29ea7ed Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM/exportBOM_Dialog$2.class differ diff --git a/bin/com/connor/jk/plm/exportBOM/exportBOM_Dialog$3.class b/bin/com/connor/jk/plm/exportBOM/exportBOM_Dialog$3.class new file mode 100644 index 0000000..ea69489 Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM/exportBOM_Dialog$3.class differ diff --git a/bin/com/connor/jk/plm/exportBOM/exportBOM_Dialog$4.class b/bin/com/connor/jk/plm/exportBOM/exportBOM_Dialog$4.class new file mode 100644 index 0000000..8fe5a2f Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM/exportBOM_Dialog$4.class differ diff --git a/bin/com/connor/jk/plm/exportBOM/exportBOM_Dialog$5.class b/bin/com/connor/jk/plm/exportBOM/exportBOM_Dialog$5.class new file mode 100644 index 0000000..959c6b7 Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM/exportBOM_Dialog$5.class differ diff --git a/bin/com/connor/jk/plm/exportBOM/exportBOM_Dialog.class b/bin/com/connor/jk/plm/exportBOM/exportBOM_Dialog.class new file mode 100644 index 0000000..c43b5ae Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM/exportBOM_Dialog.class differ diff --git a/bin/com/connor/jk/plm/exportBOM/exportBOM_Handler.class b/bin/com/connor/jk/plm/exportBOM/exportBOM_Handler.class new file mode 100644 index 0000000..fe637d6 Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM/exportBOM_Handler.class differ diff --git a/bin/com/connor/jk/plm/exportBOM/exportBOM_Operation.class b/bin/com/connor/jk/plm/exportBOM/exportBOM_Operation.class new file mode 100644 index 0000000..0c0b346 Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM/exportBOM_Operation.class differ diff --git a/bin/com/connor/jk/plm/exportBOM/exportHardwareBOM_Bean.class b/bin/com/connor/jk/plm/exportBOM/exportHardwareBOM_Bean.class new file mode 100644 index 0000000..9b0ea2b Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM/exportHardwareBOM_Bean.class differ diff --git a/bin/com/connor/jk/plm/exportBOM/exportHardwareBOM_Operation.class b/bin/com/connor/jk/plm/exportBOM/exportHardwareBOM_Operation.class new file mode 100644 index 0000000..40a987d Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM/exportHardwareBOM_Operation.class differ diff --git a/bin/com/connor/jk/plm/exportBOM20200221/ProgressBar$1.class b/bin/com/connor/jk/plm/exportBOM20200221/ProgressBar$1.class new file mode 100644 index 0000000..5f204de Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM20200221/ProgressBar$1.class differ diff --git a/bin/com/connor/jk/plm/exportBOM20200221/ProgressBar$TaskThread.class b/bin/com/connor/jk/plm/exportBOM20200221/ProgressBar$TaskThread.class new file mode 100644 index 0000000..b9cf341 Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM20200221/ProgressBar$TaskThread.class differ diff --git a/bin/com/connor/jk/plm/exportBOM20200221/ProgressBar.class b/bin/com/connor/jk/plm/exportBOM20200221/ProgressBar.class new file mode 100644 index 0000000..c25eaee Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM20200221/ProgressBar.class differ diff --git a/bin/com/connor/jk/plm/exportBOM20200221/ProgressBarThread.class b/bin/com/connor/jk/plm/exportBOM20200221/ProgressBarThread.class new file mode 100644 index 0000000..7a092ff Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM20200221/ProgressBarThread.class differ diff --git a/bin/com/connor/jk/plm/exportBOM20200221/exportBOM_Action.class b/bin/com/connor/jk/plm/exportBOM20200221/exportBOM_Action.class new file mode 100644 index 0000000..9f75a76 Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM20200221/exportBOM_Action.class differ diff --git a/bin/com/connor/jk/plm/exportBOM20200221/exportBOM_Bean.class b/bin/com/connor/jk/plm/exportBOM20200221/exportBOM_Bean.class new file mode 100644 index 0000000..17ff609 Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM20200221/exportBOM_Bean.class differ diff --git a/bin/com/connor/jk/plm/exportBOM20200221/exportBOM_Dialog$1.class b/bin/com/connor/jk/plm/exportBOM20200221/exportBOM_Dialog$1.class new file mode 100644 index 0000000..d837ae2 Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM20200221/exportBOM_Dialog$1.class differ diff --git a/bin/com/connor/jk/plm/exportBOM20200221/exportBOM_Dialog$2.class b/bin/com/connor/jk/plm/exportBOM20200221/exportBOM_Dialog$2.class new file mode 100644 index 0000000..82dcbab Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM20200221/exportBOM_Dialog$2.class differ diff --git a/bin/com/connor/jk/plm/exportBOM20200221/exportBOM_Dialog$3.class b/bin/com/connor/jk/plm/exportBOM20200221/exportBOM_Dialog$3.class new file mode 100644 index 0000000..fbda8cf Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM20200221/exportBOM_Dialog$3.class differ diff --git a/bin/com/connor/jk/plm/exportBOM20200221/exportBOM_Dialog$4.class b/bin/com/connor/jk/plm/exportBOM20200221/exportBOM_Dialog$4.class new file mode 100644 index 0000000..eb3ea31 Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM20200221/exportBOM_Dialog$4.class differ diff --git a/bin/com/connor/jk/plm/exportBOM20200221/exportBOM_Dialog$5.class b/bin/com/connor/jk/plm/exportBOM20200221/exportBOM_Dialog$5.class new file mode 100644 index 0000000..9a335ea Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM20200221/exportBOM_Dialog$5.class differ diff --git a/bin/com/connor/jk/plm/exportBOM20200221/exportBOM_Dialog.class b/bin/com/connor/jk/plm/exportBOM20200221/exportBOM_Dialog.class new file mode 100644 index 0000000..05cfc19 Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM20200221/exportBOM_Dialog.class differ diff --git a/bin/com/connor/jk/plm/exportBOM20200221/exportBOM_Handler.class b/bin/com/connor/jk/plm/exportBOM20200221/exportBOM_Handler.class new file mode 100644 index 0000000..4b00ff0 Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM20200221/exportBOM_Handler.class differ diff --git a/bin/com/connor/jk/plm/exportBOM20200221/exportBOM_Operation.class b/bin/com/connor/jk/plm/exportBOM20200221/exportBOM_Operation.class new file mode 100644 index 0000000..bdf65ef Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM20200221/exportBOM_Operation.class differ diff --git a/bin/com/connor/jk/plm/exportBOM20200221/exportHardwareBOM_Bean.class b/bin/com/connor/jk/plm/exportBOM20200221/exportHardwareBOM_Bean.class new file mode 100644 index 0000000..24208b4 Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM20200221/exportHardwareBOM_Bean.class differ diff --git a/bin/com/connor/jk/plm/exportBOM20200221/exportHardwareBOM_Operation.class b/bin/com/connor/jk/plm/exportBOM20200221/exportHardwareBOM_Operation.class new file mode 100644 index 0000000..569ce0d Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM20200221/exportHardwareBOM_Operation.class differ diff --git a/bin/com/connor/jk/plm/exportBOM20200224/DeleteFile.class b/bin/com/connor/jk/plm/exportBOM20200224/DeleteFile.class new file mode 100644 index 0000000..a5659d4 Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM20200224/DeleteFile.class differ diff --git a/bin/com/connor/jk/plm/exportBOM20200224/ProgressBar$1.class b/bin/com/connor/jk/plm/exportBOM20200224/ProgressBar$1.class new file mode 100644 index 0000000..c72c33e Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM20200224/ProgressBar$1.class differ diff --git a/bin/com/connor/jk/plm/exportBOM20200224/ProgressBar$TaskThread.class b/bin/com/connor/jk/plm/exportBOM20200224/ProgressBar$TaskThread.class new file mode 100644 index 0000000..8de582a Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM20200224/ProgressBar$TaskThread.class differ diff --git a/bin/com/connor/jk/plm/exportBOM20200224/ProgressBar.class b/bin/com/connor/jk/plm/exportBOM20200224/ProgressBar.class new file mode 100644 index 0000000..b4d2826 Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM20200224/ProgressBar.class differ diff --git a/bin/com/connor/jk/plm/exportBOM20200224/ProgressBarThread.class b/bin/com/connor/jk/plm/exportBOM20200224/ProgressBarThread.class new file mode 100644 index 0000000..ed26c5a Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM20200224/ProgressBarThread.class differ diff --git a/bin/com/connor/jk/plm/exportBOM20200224/exportBOM_Action.class b/bin/com/connor/jk/plm/exportBOM20200224/exportBOM_Action.class new file mode 100644 index 0000000..bf1f4b5 Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM20200224/exportBOM_Action.class differ diff --git a/bin/com/connor/jk/plm/exportBOM20200224/exportBOM_Bean.class b/bin/com/connor/jk/plm/exportBOM20200224/exportBOM_Bean.class new file mode 100644 index 0000000..8f072d6 Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM20200224/exportBOM_Bean.class differ diff --git a/bin/com/connor/jk/plm/exportBOM20200224/exportBOM_Dialog$1.class b/bin/com/connor/jk/plm/exportBOM20200224/exportBOM_Dialog$1.class new file mode 100644 index 0000000..1d80a81 Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM20200224/exportBOM_Dialog$1.class differ diff --git a/bin/com/connor/jk/plm/exportBOM20200224/exportBOM_Dialog$2.class b/bin/com/connor/jk/plm/exportBOM20200224/exportBOM_Dialog$2.class new file mode 100644 index 0000000..81c4b2c Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM20200224/exportBOM_Dialog$2.class differ diff --git a/bin/com/connor/jk/plm/exportBOM20200224/exportBOM_Dialog$3.class b/bin/com/connor/jk/plm/exportBOM20200224/exportBOM_Dialog$3.class new file mode 100644 index 0000000..44f3571 Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM20200224/exportBOM_Dialog$3.class differ diff --git a/bin/com/connor/jk/plm/exportBOM20200224/exportBOM_Dialog$4.class b/bin/com/connor/jk/plm/exportBOM20200224/exportBOM_Dialog$4.class new file mode 100644 index 0000000..99506f2 Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM20200224/exportBOM_Dialog$4.class differ diff --git a/bin/com/connor/jk/plm/exportBOM20200224/exportBOM_Dialog.class b/bin/com/connor/jk/plm/exportBOM20200224/exportBOM_Dialog.class new file mode 100644 index 0000000..15f6ba0 Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM20200224/exportBOM_Dialog.class differ diff --git a/bin/com/connor/jk/plm/exportBOM20200224/exportBOM_Handler.class b/bin/com/connor/jk/plm/exportBOM20200224/exportBOM_Handler.class new file mode 100644 index 0000000..e7ddbb6 Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM20200224/exportBOM_Handler.class differ diff --git a/bin/com/connor/jk/plm/exportBOM20200224/exportBOM_Operation.class b/bin/com/connor/jk/plm/exportBOM20200224/exportBOM_Operation.class new file mode 100644 index 0000000..d660e19 Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM20200224/exportBOM_Operation.class differ diff --git a/bin/com/connor/jk/plm/exportBOM20200224/exportHardwareBOM_Bean.class b/bin/com/connor/jk/plm/exportBOM20200224/exportHardwareBOM_Bean.class new file mode 100644 index 0000000..66d804c Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM20200224/exportHardwareBOM_Bean.class differ diff --git a/bin/com/connor/jk/plm/exportBOM20200224/exportHardwareBOM_Operation.class b/bin/com/connor/jk/plm/exportBOM20200224/exportHardwareBOM_Operation.class new file mode 100644 index 0000000..f14f5a6 Binary files /dev/null and b/bin/com/connor/jk/plm/exportBOM20200224/exportHardwareBOM_Operation.class differ diff --git a/bin/com/connor/jk/plm/exportForm/ExportHZB_Dialog$1.class b/bin/com/connor/jk/plm/exportForm/ExportHZB_Dialog$1.class new file mode 100644 index 0000000..d921f73 Binary files /dev/null and b/bin/com/connor/jk/plm/exportForm/ExportHZB_Dialog$1.class differ diff --git a/bin/com/connor/jk/plm/exportForm/ExportHZB_Dialog$2.class b/bin/com/connor/jk/plm/exportForm/ExportHZB_Dialog$2.class new file mode 100644 index 0000000..88d71b8 Binary files /dev/null and b/bin/com/connor/jk/plm/exportForm/ExportHZB_Dialog$2.class differ diff --git a/bin/com/connor/jk/plm/exportForm/ExportHZB_Dialog$3.class b/bin/com/connor/jk/plm/exportForm/ExportHZB_Dialog$3.class new file mode 100644 index 0000000..c06584c Binary files /dev/null and b/bin/com/connor/jk/plm/exportForm/ExportHZB_Dialog$3.class differ diff --git a/bin/com/connor/jk/plm/exportForm/ExportHZB_Dialog.class b/bin/com/connor/jk/plm/exportForm/ExportHZB_Dialog.class new file mode 100644 index 0000000..c94b890 Binary files /dev/null and b/bin/com/connor/jk/plm/exportForm/ExportHZB_Dialog.class differ diff --git a/bin/com/connor/jk/plm/exportForm/ExportHZB_Handler.class b/bin/com/connor/jk/plm/exportForm/ExportHZB_Handler.class new file mode 100644 index 0000000..0097ab6 Binary files /dev/null and b/bin/com/connor/jk/plm/exportForm/ExportHZB_Handler.class differ diff --git a/bin/com/connor/jk/plm/exportForm/ExportHZB_Operation.class b/bin/com/connor/jk/plm/exportForm/ExportHZB_Operation.class new file mode 100644 index 0000000..b436f06 Binary files /dev/null and b/bin/com/connor/jk/plm/exportForm/ExportHZB_Operation.class differ diff --git a/bin/com/connor/jk/plm/exportForm/ExportHZB_Operation20230613.class b/bin/com/connor/jk/plm/exportForm/ExportHZB_Operation20230613.class new file mode 100644 index 0000000..397a622 Binary files /dev/null and b/bin/com/connor/jk/plm/exportForm/ExportHZB_Operation20230613.class differ diff --git a/bin/com/connor/jk/plm/exportPCB/ProgressBar$1.class b/bin/com/connor/jk/plm/exportPCB/ProgressBar$1.class new file mode 100644 index 0000000..faf02f0 Binary files /dev/null and b/bin/com/connor/jk/plm/exportPCB/ProgressBar$1.class differ diff --git a/bin/com/connor/jk/plm/exportPCB/ProgressBar$TaskThread.class b/bin/com/connor/jk/plm/exportPCB/ProgressBar$TaskThread.class new file mode 100644 index 0000000..d26c283 Binary files /dev/null and b/bin/com/connor/jk/plm/exportPCB/ProgressBar$TaskThread.class differ diff --git a/bin/com/connor/jk/plm/exportPCB/ProgressBar.class b/bin/com/connor/jk/plm/exportPCB/ProgressBar.class new file mode 100644 index 0000000..c2f7271 Binary files /dev/null and b/bin/com/connor/jk/plm/exportPCB/ProgressBar.class differ diff --git a/bin/com/connor/jk/plm/exportPCB/ProgressBarThread.class b/bin/com/connor/jk/plm/exportPCB/ProgressBarThread.class new file mode 100644 index 0000000..d724900 Binary files /dev/null and b/bin/com/connor/jk/plm/exportPCB/ProgressBarThread.class differ diff --git a/bin/com/connor/jk/plm/exportPCB/exportPCB_Dialog$1.class b/bin/com/connor/jk/plm/exportPCB/exportPCB_Dialog$1.class new file mode 100644 index 0000000..a5bd87a Binary files /dev/null and b/bin/com/connor/jk/plm/exportPCB/exportPCB_Dialog$1.class differ diff --git a/bin/com/connor/jk/plm/exportPCB/exportPCB_Dialog$2.class b/bin/com/connor/jk/plm/exportPCB/exportPCB_Dialog$2.class new file mode 100644 index 0000000..29375a8 Binary files /dev/null and b/bin/com/connor/jk/plm/exportPCB/exportPCB_Dialog$2.class differ diff --git a/bin/com/connor/jk/plm/exportPCB/exportPCB_Dialog$3.class b/bin/com/connor/jk/plm/exportPCB/exportPCB_Dialog$3.class new file mode 100644 index 0000000..77e9f07 Binary files /dev/null and b/bin/com/connor/jk/plm/exportPCB/exportPCB_Dialog$3.class differ diff --git a/bin/com/connor/jk/plm/exportPCB/exportPCB_Dialog.class b/bin/com/connor/jk/plm/exportPCB/exportPCB_Dialog.class new file mode 100644 index 0000000..897e97a Binary files /dev/null and b/bin/com/connor/jk/plm/exportPCB/exportPCB_Dialog.class differ diff --git a/bin/com/connor/jk/plm/exportPCB/exportPCB_Handler.class b/bin/com/connor/jk/plm/exportPCB/exportPCB_Handler.class new file mode 100644 index 0000000..db0b10b Binary files /dev/null and b/bin/com/connor/jk/plm/exportPCB/exportPCB_Handler.class differ diff --git a/bin/com/connor/jk/plm/exportPCB/exportPCB_Operation.class b/bin/com/connor/jk/plm/exportPCB/exportPCB_Operation.class new file mode 100644 index 0000000..022f357 Binary files /dev/null and b/bin/com/connor/jk/plm/exportPCB/exportPCB_Operation.class differ diff --git a/bin/com/connor/jk/plm/exportWaterForm/ExportWaterForm_Dialog$1.class b/bin/com/connor/jk/plm/exportWaterForm/ExportWaterForm_Dialog$1.class new file mode 100644 index 0000000..c4f896f Binary files /dev/null and b/bin/com/connor/jk/plm/exportWaterForm/ExportWaterForm_Dialog$1.class differ diff --git a/bin/com/connor/jk/plm/exportWaterForm/ExportWaterForm_Dialog$2.class b/bin/com/connor/jk/plm/exportWaterForm/ExportWaterForm_Dialog$2.class new file mode 100644 index 0000000..10bc59e Binary files /dev/null and b/bin/com/connor/jk/plm/exportWaterForm/ExportWaterForm_Dialog$2.class differ diff --git a/bin/com/connor/jk/plm/exportWaterForm/ExportWaterForm_Dialog$3.class b/bin/com/connor/jk/plm/exportWaterForm/ExportWaterForm_Dialog$3.class new file mode 100644 index 0000000..bbb987d Binary files /dev/null and b/bin/com/connor/jk/plm/exportWaterForm/ExportWaterForm_Dialog$3.class differ diff --git a/bin/com/connor/jk/plm/exportWaterForm/ExportWaterForm_Dialog.class b/bin/com/connor/jk/plm/exportWaterForm/ExportWaterForm_Dialog.class new file mode 100644 index 0000000..f525011 Binary files /dev/null and b/bin/com/connor/jk/plm/exportWaterForm/ExportWaterForm_Dialog.class differ diff --git a/bin/com/connor/jk/plm/exportWaterForm/ExportWaterForm_Handler.class b/bin/com/connor/jk/plm/exportWaterForm/ExportWaterForm_Handler.class new file mode 100644 index 0000000..e8b3e1d Binary files /dev/null and b/bin/com/connor/jk/plm/exportWaterForm/ExportWaterForm_Handler.class differ diff --git a/bin/com/connor/jk/plm/exportWaterForm/ExportWaterForm_Operation.class b/bin/com/connor/jk/plm/exportWaterForm/ExportWaterForm_Operation.class new file mode 100644 index 0000000..a2b76a9 Binary files /dev/null and b/bin/com/connor/jk/plm/exportWaterForm/ExportWaterForm_Operation.class differ diff --git a/bin/com/connor/jk/plm/form/BOM.class b/bin/com/connor/jk/plm/form/BOM.class new file mode 100644 index 0000000..0c12a3b Binary files /dev/null and b/bin/com/connor/jk/plm/form/BOM.class differ diff --git a/bin/com/connor/jk/plm/form/BZGXBean.class b/bin/com/connor/jk/plm/form/BZGXBean.class new file mode 100644 index 0000000..a347421 Binary files /dev/null and b/bin/com/connor/jk/plm/form/BZGXBean.class differ diff --git a/bin/com/connor/jk/plm/form/BomStructBean.class b/bin/com/connor/jk/plm/form/BomStructBean.class new file mode 100644 index 0000000..9fd2b6a Binary files /dev/null and b/bin/com/connor/jk/plm/form/BomStructBean.class differ diff --git a/bin/com/connor/jk/plm/form/BomStructTree$1.class b/bin/com/connor/jk/plm/form/BomStructTree$1.class new file mode 100644 index 0000000..6dd5533 Binary files /dev/null and b/bin/com/connor/jk/plm/form/BomStructTree$1.class differ diff --git a/bin/com/connor/jk/plm/form/BomStructTree$BomStructTreeCellRenderer.class b/bin/com/connor/jk/plm/form/BomStructTree$BomStructTreeCellRenderer.class new file mode 100644 index 0000000..eaf4230 Binary files /dev/null and b/bin/com/connor/jk/plm/form/BomStructTree$BomStructTreeCellRenderer.class differ diff --git a/bin/com/connor/jk/plm/form/BomStructTree.class b/bin/com/connor/jk/plm/form/BomStructTree.class new file mode 100644 index 0000000..ec85a8f Binary files /dev/null and b/bin/com/connor/jk/plm/form/BomStructTree.class differ diff --git a/bin/com/connor/jk/plm/form/CellRender.class b/bin/com/connor/jk/plm/form/CellRender.class new file mode 100644 index 0000000..d61f274 Binary files /dev/null and b/bin/com/connor/jk/plm/form/CellRender.class differ diff --git a/bin/com/connor/jk/plm/form/GYLXFormPropBean.class b/bin/com/connor/jk/plm/form/GYLXFormPropBean.class new file mode 100644 index 0000000..6d20465 Binary files /dev/null and b/bin/com/connor/jk/plm/form/GYLXFormPropBean.class differ diff --git a/bin/com/connor/jk/plm/form/GYLXFormStyleSheet.class b/bin/com/connor/jk/plm/form/GYLXFormStyleSheet.class new file mode 100644 index 0000000..cb6ff9b Binary files /dev/null and b/bin/com/connor/jk/plm/form/GYLXFormStyleSheet.class differ diff --git a/bin/com/connor/jk/plm/form/HX3_BZGX$1.class b/bin/com/connor/jk/plm/form/HX3_BZGX$1.class new file mode 100644 index 0000000..4cf68b4 Binary files /dev/null and b/bin/com/connor/jk/plm/form/HX3_BZGX$1.class differ diff --git a/bin/com/connor/jk/plm/form/HX3_BZGX.class b/bin/com/connor/jk/plm/form/HX3_BZGX.class new file mode 100644 index 0000000..013f7b4 Binary files /dev/null and b/bin/com/connor/jk/plm/form/HX3_BZGX.class differ diff --git a/bin/com/connor/jk/plm/form/HX3_GYLXRevisionFormPropBean.class b/bin/com/connor/jk/plm/form/HX3_GYLXRevisionFormPropBean.class new file mode 100644 index 0000000..66869e8 Binary files /dev/null and b/bin/com/connor/jk/plm/form/HX3_GYLXRevisionFormPropBean.class differ diff --git a/bin/com/connor/jk/plm/form/HX3_SelectBzgxDialog.class b/bin/com/connor/jk/plm/form/HX3_SelectBzgxDialog.class new file mode 100644 index 0000000..7920b04 Binary files /dev/null and b/bin/com/connor/jk/plm/form/HX3_SelectBzgxDialog.class differ diff --git a/bin/com/connor/jk/plm/form/LOVBean.class b/bin/com/connor/jk/plm/form/LOVBean.class new file mode 100644 index 0000000..8440c5d Binary files /dev/null and b/bin/com/connor/jk/plm/form/LOVBean.class differ diff --git a/bin/com/connor/jk/plm/form/MyComboBoxEditor.class b/bin/com/connor/jk/plm/form/MyComboBoxEditor.class new file mode 100644 index 0000000..d1c984f Binary files /dev/null and b/bin/com/connor/jk/plm/form/MyComboBoxEditor.class differ diff --git a/bin/com/connor/jk/plm/form/MyComboBoxRenderer.class b/bin/com/connor/jk/plm/form/MyComboBoxRenderer.class new file mode 100644 index 0000000..180403d Binary files /dev/null and b/bin/com/connor/jk/plm/form/MyComboBoxRenderer.class differ diff --git a/bin/com/connor/jk/plm/form/MyTCComponent.class b/bin/com/connor/jk/plm/form/MyTCComponent.class new file mode 100644 index 0000000..81cd1df Binary files /dev/null and b/bin/com/connor/jk/plm/form/MyTCComponent.class differ diff --git a/bin/com/connor/jk/plm/form/WL_Form.class b/bin/com/connor/jk/plm/form/WL_Form.class new file mode 100644 index 0000000..d239bd8 Binary files /dev/null and b/bin/com/connor/jk/plm/form/WL_Form.class differ diff --git a/bin/com/connor/jk/plm/handlers/CreateProjrct_Handler.class b/bin/com/connor/jk/plm/handlers/CreateProjrct_Handler.class new file mode 100644 index 0000000..ef5ddfc Binary files /dev/null and b/bin/com/connor/jk/plm/handlers/CreateProjrct_Handler.class differ diff --git a/bin/com/connor/jk/plm/handlers/Generate_Handler.class b/bin/com/connor/jk/plm/handlers/Generate_Handler.class new file mode 100644 index 0000000..fbd68af Binary files /dev/null and b/bin/com/connor/jk/plm/handlers/Generate_Handler.class differ diff --git a/bin/com/connor/jk/plm/handlers/ImportBOM_Handler.class b/bin/com/connor/jk/plm/handlers/ImportBOM_Handler.class new file mode 100644 index 0000000..760010d Binary files /dev/null and b/bin/com/connor/jk/plm/handlers/ImportBOM_Handler.class differ diff --git a/bin/com/connor/jk/plm/handlers/JK8CotlerPModAppForm_Handler.class b/bin/com/connor/jk/plm/handlers/JK8CotlerPModAppForm_Handler.class new file mode 100644 index 0000000..54f4703 Binary files /dev/null and b/bin/com/connor/jk/plm/handlers/JK8CotlerPModAppForm_Handler.class differ diff --git a/bin/com/connor/jk/plm/handlers/JK8_CJQ_Handler.class b/bin/com/connor/jk/plm/handlers/JK8_CJQ_Handler.class new file mode 100644 index 0000000..dc8b55d Binary files /dev/null and b/bin/com/connor/jk/plm/handlers/JK8_CJQ_Handler.class differ diff --git a/bin/com/connor/jk/plm/handlers/JK8_CPXH_Handler.class b/bin/com/connor/jk/plm/handlers/JK8_CPXH_Handler.class new file mode 100644 index 0000000..54ce586 Binary files /dev/null and b/bin/com/connor/jk/plm/handlers/JK8_CPXH_Handler.class differ diff --git a/bin/com/connor/jk/plm/handlers/JK8_ColPIdenNOAppForm_Handler.class b/bin/com/connor/jk/plm/handlers/JK8_ColPIdenNOAppForm_Handler.class new file mode 100644 index 0000000..86ec619 Binary files /dev/null and b/bin/com/connor/jk/plm/handlers/JK8_ColPIdenNOAppForm_Handler.class differ diff --git a/bin/com/connor/jk/plm/handlers/JK8_SBH_Handler.class b/bin/com/connor/jk/plm/handlers/JK8_SBH_Handler.class new file mode 100644 index 0000000..c26b4c6 Binary files /dev/null and b/bin/com/connor/jk/plm/handlers/JK8_SBH_Handler.class differ diff --git a/bin/com/connor/jk/plm/handlers/JK8_TSSBH_Handler.class b/bin/com/connor/jk/plm/handlers/JK8_TSSBH_Handler.class new file mode 100644 index 0000000..fc1377b Binary files /dev/null and b/bin/com/connor/jk/plm/handlers/JK8_TSSBH_Handler.class differ diff --git a/bin/com/connor/jk/plm/handlers/JK8_YSSBH_Handler.class b/bin/com/connor/jk/plm/handlers/JK8_YSSBH_Handler.class new file mode 100644 index 0000000..339bced Binary files /dev/null and b/bin/com/connor/jk/plm/handlers/JK8_YSSBH_Handler.class differ diff --git a/bin/com/connor/jk/plm/handlers/JK8_YZCPXHSQB_Handler.class b/bin/com/connor/jk/plm/handlers/JK8_YZCPXHSQB_Handler.class new file mode 100644 index 0000000..34d4601 Binary files /dev/null and b/bin/com/connor/jk/plm/handlers/JK8_YZCPXHSQB_Handler.class differ diff --git a/bin/com/connor/jk/plm/handlers/JspsReport_Handler.class b/bin/com/connor/jk/plm/handlers/JspsReport_Handler.class new file mode 100644 index 0000000..0bbd11b Binary files /dev/null and b/bin/com/connor/jk/plm/handlers/JspsReport_Handler.class differ diff --git a/bin/com/connor/jk/plm/imform/FormBean.class b/bin/com/connor/jk/plm/imform/FormBean.class new file mode 100644 index 0000000..7bffa37 Binary files /dev/null and b/bin/com/connor/jk/plm/imform/FormBean.class differ diff --git a/bin/com/connor/jk/plm/imform/ImfomAIFDialog$1.class b/bin/com/connor/jk/plm/imform/ImfomAIFDialog$1.class new file mode 100644 index 0000000..4d6a028 Binary files /dev/null and b/bin/com/connor/jk/plm/imform/ImfomAIFDialog$1.class differ diff --git a/bin/com/connor/jk/plm/imform/ImfomAIFDialog$2.class b/bin/com/connor/jk/plm/imform/ImfomAIFDialog$2.class new file mode 100644 index 0000000..ee5cba2 Binary files /dev/null and b/bin/com/connor/jk/plm/imform/ImfomAIFDialog$2.class differ diff --git a/bin/com/connor/jk/plm/imform/ImfomAIFDialog$3.class b/bin/com/connor/jk/plm/imform/ImfomAIFDialog$3.class new file mode 100644 index 0000000..5b60868 Binary files /dev/null and b/bin/com/connor/jk/plm/imform/ImfomAIFDialog$3.class differ diff --git a/bin/com/connor/jk/plm/imform/ImfomAIFDialog$4.class b/bin/com/connor/jk/plm/imform/ImfomAIFDialog$4.class new file mode 100644 index 0000000..2ffff08 Binary files /dev/null and b/bin/com/connor/jk/plm/imform/ImfomAIFDialog$4.class differ diff --git a/bin/com/connor/jk/plm/imform/ImfomAIFDialog.class b/bin/com/connor/jk/plm/imform/ImfomAIFDialog.class new file mode 100644 index 0000000..8f43751 Binary files /dev/null and b/bin/com/connor/jk/plm/imform/ImfomAIFDialog.class differ diff --git a/bin/com/connor/jk/plm/imform/ImformHandler.class b/bin/com/connor/jk/plm/imform/ImformHandler.class new file mode 100644 index 0000000..496ff03 Binary files /dev/null and b/bin/com/connor/jk/plm/imform/ImformHandler.class differ diff --git a/bin/com/connor/jk/plm/imform/SetExcel.class b/bin/com/connor/jk/plm/imform/SetExcel.class new file mode 100644 index 0000000..30da8ad Binary files /dev/null and b/bin/com/connor/jk/plm/imform/SetExcel.class differ diff --git a/bin/com/connor/jk/plm/imp/bom/ImportBOM_Action.class b/bin/com/connor/jk/plm/imp/bom/ImportBOM_Action.class new file mode 100644 index 0000000..0ffcdc6 Binary files /dev/null and b/bin/com/connor/jk/plm/imp/bom/ImportBOM_Action.class differ diff --git a/bin/com/connor/jk/plm/imp/bom/ImportBOM_Command.class b/bin/com/connor/jk/plm/imp/bom/ImportBOM_Command.class new file mode 100644 index 0000000..6beabb7 Binary files /dev/null and b/bin/com/connor/jk/plm/imp/bom/ImportBOM_Command.class differ diff --git a/bin/com/connor/jk/plm/imp/bom/ImportBOM_Dialog$1.class b/bin/com/connor/jk/plm/imp/bom/ImportBOM_Dialog$1.class new file mode 100644 index 0000000..76dc7ae Binary files /dev/null and b/bin/com/connor/jk/plm/imp/bom/ImportBOM_Dialog$1.class differ diff --git a/bin/com/connor/jk/plm/imp/bom/ImportBOM_Dialog$2.class b/bin/com/connor/jk/plm/imp/bom/ImportBOM_Dialog$2.class new file mode 100644 index 0000000..025725a Binary files /dev/null and b/bin/com/connor/jk/plm/imp/bom/ImportBOM_Dialog$2.class differ diff --git a/bin/com/connor/jk/plm/imp/bom/ImportBOM_Dialog$3.class b/bin/com/connor/jk/plm/imp/bom/ImportBOM_Dialog$3.class new file mode 100644 index 0000000..f084ab2 Binary files /dev/null and b/bin/com/connor/jk/plm/imp/bom/ImportBOM_Dialog$3.class differ diff --git a/bin/com/connor/jk/plm/imp/bom/ImportBOM_Dialog.class b/bin/com/connor/jk/plm/imp/bom/ImportBOM_Dialog.class new file mode 100644 index 0000000..4179dcd Binary files /dev/null and b/bin/com/connor/jk/plm/imp/bom/ImportBOM_Dialog.class differ diff --git a/bin/com/connor/jk/plm/imp/bom/ImportBOM_Operation.class b/bin/com/connor/jk/plm/imp/bom/ImportBOM_Operation.class new file mode 100644 index 0000000..794be9f Binary files /dev/null and b/bin/com/connor/jk/plm/imp/bom/ImportBOM_Operation.class differ diff --git a/bin/com/connor/jk/plm/imp/bom/PropertyBean.class b/bin/com/connor/jk/plm/imp/bom/PropertyBean.class new file mode 100644 index 0000000..69febef Binary files /dev/null and b/bin/com/connor/jk/plm/imp/bom/PropertyBean.class differ diff --git a/bin/com/connor/jk/plm/imp/bom/SearchUtility.class b/bin/com/connor/jk/plm/imp/bom/SearchUtility.class new file mode 100644 index 0000000..8eb5353 Binary files /dev/null and b/bin/com/connor/jk/plm/imp/bom/SearchUtility.class differ diff --git a/bin/com/connor/jk/plm/importPCB/FormBean.class b/bin/com/connor/jk/plm/importPCB/FormBean.class new file mode 100644 index 0000000..9f6f01f Binary files /dev/null and b/bin/com/connor/jk/plm/importPCB/FormBean.class differ diff --git a/bin/com/connor/jk/plm/importPCB/ProgressBar$1.class b/bin/com/connor/jk/plm/importPCB/ProgressBar$1.class new file mode 100644 index 0000000..bc34407 Binary files /dev/null and b/bin/com/connor/jk/plm/importPCB/ProgressBar$1.class differ diff --git a/bin/com/connor/jk/plm/importPCB/ProgressBar$TaskThread.class b/bin/com/connor/jk/plm/importPCB/ProgressBar$TaskThread.class new file mode 100644 index 0000000..7c2939c Binary files /dev/null and b/bin/com/connor/jk/plm/importPCB/ProgressBar$TaskThread.class differ diff --git a/bin/com/connor/jk/plm/importPCB/ProgressBar.class b/bin/com/connor/jk/plm/importPCB/ProgressBar.class new file mode 100644 index 0000000..842d56c Binary files /dev/null and b/bin/com/connor/jk/plm/importPCB/ProgressBar.class differ diff --git a/bin/com/connor/jk/plm/importPCB/ProgressBarThread.class b/bin/com/connor/jk/plm/importPCB/ProgressBarThread.class new file mode 100644 index 0000000..5ea534c Binary files /dev/null and b/bin/com/connor/jk/plm/importPCB/ProgressBarThread.class differ diff --git a/bin/com/connor/jk/plm/importPCB/SetExcel.class b/bin/com/connor/jk/plm/importPCB/SetExcel.class new file mode 100644 index 0000000..69ca3cd Binary files /dev/null and b/bin/com/connor/jk/plm/importPCB/SetExcel.class differ diff --git a/bin/com/connor/jk/plm/importPCB/importPCB_Dialog$1.class b/bin/com/connor/jk/plm/importPCB/importPCB_Dialog$1.class new file mode 100644 index 0000000..6cf9179 Binary files /dev/null and b/bin/com/connor/jk/plm/importPCB/importPCB_Dialog$1.class differ diff --git a/bin/com/connor/jk/plm/importPCB/importPCB_Dialog$2.class b/bin/com/connor/jk/plm/importPCB/importPCB_Dialog$2.class new file mode 100644 index 0000000..961a930 Binary files /dev/null and b/bin/com/connor/jk/plm/importPCB/importPCB_Dialog$2.class differ diff --git a/bin/com/connor/jk/plm/importPCB/importPCB_Dialog$3.class b/bin/com/connor/jk/plm/importPCB/importPCB_Dialog$3.class new file mode 100644 index 0000000..0150fdc Binary files /dev/null and b/bin/com/connor/jk/plm/importPCB/importPCB_Dialog$3.class differ diff --git a/bin/com/connor/jk/plm/importPCB/importPCB_Dialog$4.class b/bin/com/connor/jk/plm/importPCB/importPCB_Dialog$4.class new file mode 100644 index 0000000..5f5f542 Binary files /dev/null and b/bin/com/connor/jk/plm/importPCB/importPCB_Dialog$4.class differ diff --git a/bin/com/connor/jk/plm/importPCB/importPCB_Dialog.class b/bin/com/connor/jk/plm/importPCB/importPCB_Dialog.class new file mode 100644 index 0000000..44fb7bc Binary files /dev/null and b/bin/com/connor/jk/plm/importPCB/importPCB_Dialog.class differ diff --git a/bin/com/connor/jk/plm/importPCB/importPCB_Handler.class b/bin/com/connor/jk/plm/importPCB/importPCB_Handler.class new file mode 100644 index 0000000..fd36e27 Binary files /dev/null and b/bin/com/connor/jk/plm/importPCB/importPCB_Handler.class differ diff --git a/bin/com/connor/jk/plm/importWaterForm/ProgressBar$1.class b/bin/com/connor/jk/plm/importWaterForm/ProgressBar$1.class new file mode 100644 index 0000000..a92d625 Binary files /dev/null and b/bin/com/connor/jk/plm/importWaterForm/ProgressBar$1.class differ diff --git a/bin/com/connor/jk/plm/importWaterForm/ProgressBar$TaskThread.class b/bin/com/connor/jk/plm/importWaterForm/ProgressBar$TaskThread.class new file mode 100644 index 0000000..047978c Binary files /dev/null and b/bin/com/connor/jk/plm/importWaterForm/ProgressBar$TaskThread.class differ diff --git a/bin/com/connor/jk/plm/importWaterForm/ProgressBar.class b/bin/com/connor/jk/plm/importWaterForm/ProgressBar.class new file mode 100644 index 0000000..37318f3 Binary files /dev/null and b/bin/com/connor/jk/plm/importWaterForm/ProgressBar.class differ diff --git a/bin/com/connor/jk/plm/importWaterForm/ProgressBarThread.class b/bin/com/connor/jk/plm/importWaterForm/ProgressBarThread.class new file mode 100644 index 0000000..49d0bf5 Binary files /dev/null and b/bin/com/connor/jk/plm/importWaterForm/ProgressBarThread.class differ diff --git a/bin/com/connor/jk/plm/importWaterForm/SetWaterExcel.class b/bin/com/connor/jk/plm/importWaterForm/SetWaterExcel.class new file mode 100644 index 0000000..ffde1ee Binary files /dev/null and b/bin/com/connor/jk/plm/importWaterForm/SetWaterExcel.class differ diff --git a/bin/com/connor/jk/plm/importWaterForm/importWater_Dialog$1.class b/bin/com/connor/jk/plm/importWaterForm/importWater_Dialog$1.class new file mode 100644 index 0000000..92f1430 Binary files /dev/null and b/bin/com/connor/jk/plm/importWaterForm/importWater_Dialog$1.class differ diff --git a/bin/com/connor/jk/plm/importWaterForm/importWater_Dialog$2.class b/bin/com/connor/jk/plm/importWaterForm/importWater_Dialog$2.class new file mode 100644 index 0000000..11301ce Binary files /dev/null and b/bin/com/connor/jk/plm/importWaterForm/importWater_Dialog$2.class differ diff --git a/bin/com/connor/jk/plm/importWaterForm/importWater_Dialog$3.class b/bin/com/connor/jk/plm/importWaterForm/importWater_Dialog$3.class new file mode 100644 index 0000000..10fc2f4 Binary files /dev/null and b/bin/com/connor/jk/plm/importWaterForm/importWater_Dialog$3.class differ diff --git a/bin/com/connor/jk/plm/importWaterForm/importWater_Dialog$4.class b/bin/com/connor/jk/plm/importWaterForm/importWater_Dialog$4.class new file mode 100644 index 0000000..c0f4ffc Binary files /dev/null and b/bin/com/connor/jk/plm/importWaterForm/importWater_Dialog$4.class differ diff --git a/bin/com/connor/jk/plm/importWaterForm/importWater_Dialog.class b/bin/com/connor/jk/plm/importWaterForm/importWater_Dialog.class new file mode 100644 index 0000000..25bc38e Binary files /dev/null and b/bin/com/connor/jk/plm/importWaterForm/importWater_Dialog.class differ diff --git a/bin/com/connor/jk/plm/importWaterForm/importWater_Handler.class b/bin/com/connor/jk/plm/importWaterForm/importWater_Handler.class new file mode 100644 index 0000000..00d151e Binary files /dev/null and b/bin/com/connor/jk/plm/importWaterForm/importWater_Handler.class differ diff --git a/bin/com/connor/jk/plm/importWaterForm/waterFormBean.class b/bin/com/connor/jk/plm/importWaterForm/waterFormBean.class new file mode 100644 index 0000000..042589f Binary files /dev/null and b/bin/com/connor/jk/plm/importWaterForm/waterFormBean.class differ diff --git a/bin/com/connor/jk/plm/itemsave/Itemsave_Action.class b/bin/com/connor/jk/plm/itemsave/Itemsave_Action.class new file mode 100644 index 0000000..da1584f Binary files /dev/null and b/bin/com/connor/jk/plm/itemsave/Itemsave_Action.class differ diff --git a/bin/com/connor/jk/plm/itemsave/Itemsave_Handler.class b/bin/com/connor/jk/plm/itemsave/Itemsave_Handler.class new file mode 100644 index 0000000..7ef587b Binary files /dev/null and b/bin/com/connor/jk/plm/itemsave/Itemsave_Handler.class differ diff --git a/bin/com/connor/jk/plm/itemsave/Itemsave_Operation.class b/bin/com/connor/jk/plm/itemsave/Itemsave_Operation.class new file mode 100644 index 0000000..0b503f9 Binary files /dev/null and b/bin/com/connor/jk/plm/itemsave/Itemsave_Operation.class differ diff --git a/bin/com/connor/jk/plm/jk8Frequency/Util.class b/bin/com/connor/jk/plm/jk8Frequency/Util.class new file mode 100644 index 0000000..3a7157f Binary files /dev/null and b/bin/com/connor/jk/plm/jk8Frequency/Util.class differ diff --git a/bin/com/connor/jk/plm/jk8Frequency/jk8Frequency_Handler.class b/bin/com/connor/jk/plm/jk8Frequency/jk8Frequency_Handler.class new file mode 100644 index 0000000..3d0de0b Binary files /dev/null and b/bin/com/connor/jk/plm/jk8Frequency/jk8Frequency_Handler.class differ diff --git a/bin/com/connor/jk/plm/kzq/DataBaseControl.class b/bin/com/connor/jk/plm/kzq/DataBaseControl.class new file mode 100644 index 0000000..f48166d Binary files /dev/null and b/bin/com/connor/jk/plm/kzq/DataBaseControl.class differ diff --git a/bin/com/connor/jk/plm/kzq/GenerateKzq_Action.class b/bin/com/connor/jk/plm/kzq/GenerateKzq_Action.class new file mode 100644 index 0000000..289a8c6 Binary files /dev/null and b/bin/com/connor/jk/plm/kzq/GenerateKzq_Action.class differ diff --git a/bin/com/connor/jk/plm/kzq/GenerateKzq_Handler.class b/bin/com/connor/jk/plm/kzq/GenerateKzq_Handler.class new file mode 100644 index 0000000..f94ee60 Binary files /dev/null and b/bin/com/connor/jk/plm/kzq/GenerateKzq_Handler.class differ diff --git a/bin/com/connor/jk/plm/kzq/GenerateKzq_Operation.class b/bin/com/connor/jk/plm/kzq/GenerateKzq_Operation.class new file mode 100644 index 0000000..e4f98cc Binary files /dev/null and b/bin/com/connor/jk/plm/kzq/GenerateKzq_Operation.class differ diff --git a/bin/com/connor/jk/plm/kzq/JK8ALIdenNOAppForm_Handler.class b/bin/com/connor/jk/plm/kzq/JK8ALIdenNOAppForm_Handler.class new file mode 100644 index 0000000..9abc6e0 Binary files /dev/null and b/bin/com/connor/jk/plm/kzq/JK8ALIdenNOAppForm_Handler.class differ diff --git a/bin/com/connor/jk/plm/kzq/JK8ALModNORegForm_Handler.class b/bin/com/connor/jk/plm/kzq/JK8ALModNORegForm_Handler.class new file mode 100644 index 0000000..20f0172 Binary files /dev/null and b/bin/com/connor/jk/plm/kzq/JK8ALModNORegForm_Handler.class differ diff --git a/bin/com/connor/jk/plm/kzq/JK8ALPModAppForm_Handler.class b/bin/com/connor/jk/plm/kzq/JK8ALPModAppForm_Handler.class new file mode 100644 index 0000000..131164d Binary files /dev/null and b/bin/com/connor/jk/plm/kzq/JK8ALPModAppForm_Handler.class differ diff --git a/bin/com/connor/jk/plm/kzq/JK8WSpecPINOAppForm_Handler.class b/bin/com/connor/jk/plm/kzq/JK8WSpecPINOAppForm_Handler.class new file mode 100644 index 0000000..5563c76 Binary files /dev/null and b/bin/com/connor/jk/plm/kzq/JK8WSpecPINOAppForm_Handler.class differ diff --git a/bin/com/connor/jk/plm/kzq/JK8_water_Action.class b/bin/com/connor/jk/plm/kzq/JK8_water_Action.class new file mode 100644 index 0000000..98921ac Binary files /dev/null and b/bin/com/connor/jk/plm/kzq/JK8_water_Action.class differ diff --git a/bin/com/connor/jk/plm/kzq/JK8_water_Command.class b/bin/com/connor/jk/plm/kzq/JK8_water_Command.class new file mode 100644 index 0000000..ffe55fa Binary files /dev/null and b/bin/com/connor/jk/plm/kzq/JK8_water_Command.class differ diff --git a/bin/com/connor/jk/plm/kzq/JK8_water_Operation.class b/bin/com/connor/jk/plm/kzq/JK8_water_Operation.class new file mode 100644 index 0000000..738c282 Binary files /dev/null and b/bin/com/connor/jk/plm/kzq/JK8_water_Operation.class differ diff --git a/bin/com/connor/jk/plm/mail/DataBaseControl.class b/bin/com/connor/jk/plm/mail/DataBaseControl.class new file mode 100644 index 0000000..3c4a117 Binary files /dev/null and b/bin/com/connor/jk/plm/mail/DataBaseControl.class differ diff --git a/bin/com/connor/jk/plm/mail/Demo1.class b/bin/com/connor/jk/plm/mail/Demo1.class new file mode 100644 index 0000000..24f8a8a Binary files /dev/null and b/bin/com/connor/jk/plm/mail/Demo1.class differ diff --git a/bin/com/connor/jk/plm/mail/SendMail_Action.class b/bin/com/connor/jk/plm/mail/SendMail_Action.class new file mode 100644 index 0000000..518bb8c Binary files /dev/null and b/bin/com/connor/jk/plm/mail/SendMail_Action.class differ diff --git a/bin/com/connor/jk/plm/mail/SendMail_Command.class b/bin/com/connor/jk/plm/mail/SendMail_Command.class new file mode 100644 index 0000000..4ca6da1 Binary files /dev/null and b/bin/com/connor/jk/plm/mail/SendMail_Command.class differ diff --git a/bin/com/connor/jk/plm/mail/SendMail_Dialog$1.class b/bin/com/connor/jk/plm/mail/SendMail_Dialog$1.class new file mode 100644 index 0000000..df516df Binary files /dev/null and b/bin/com/connor/jk/plm/mail/SendMail_Dialog$1.class differ diff --git a/bin/com/connor/jk/plm/mail/SendMail_Dialog$2.class b/bin/com/connor/jk/plm/mail/SendMail_Dialog$2.class new file mode 100644 index 0000000..8b0ec04 Binary files /dev/null and b/bin/com/connor/jk/plm/mail/SendMail_Dialog$2.class differ diff --git a/bin/com/connor/jk/plm/mail/SendMail_Dialog$3.class b/bin/com/connor/jk/plm/mail/SendMail_Dialog$3.class new file mode 100644 index 0000000..0ce478b Binary files /dev/null and b/bin/com/connor/jk/plm/mail/SendMail_Dialog$3.class differ diff --git a/bin/com/connor/jk/plm/mail/SendMail_Dialog$4.class b/bin/com/connor/jk/plm/mail/SendMail_Dialog$4.class new file mode 100644 index 0000000..523b402 Binary files /dev/null and b/bin/com/connor/jk/plm/mail/SendMail_Dialog$4.class differ diff --git a/bin/com/connor/jk/plm/mail/SendMail_Dialog$5.class b/bin/com/connor/jk/plm/mail/SendMail_Dialog$5.class new file mode 100644 index 0000000..4c0c137 Binary files /dev/null and b/bin/com/connor/jk/plm/mail/SendMail_Dialog$5.class differ diff --git a/bin/com/connor/jk/plm/mail/SendMail_Dialog.class b/bin/com/connor/jk/plm/mail/SendMail_Dialog.class new file mode 100644 index 0000000..b7815a4 Binary files /dev/null and b/bin/com/connor/jk/plm/mail/SendMail_Dialog.class differ diff --git a/bin/com/connor/jk/plm/mail/SendMail_Handler.class b/bin/com/connor/jk/plm/mail/SendMail_Handler.class new file mode 100644 index 0000000..4fa1f8b Binary files /dev/null and b/bin/com/connor/jk/plm/mail/SendMail_Handler.class differ diff --git a/bin/com/connor/jk/plm/paste/JKPasteOperation.class b/bin/com/connor/jk/plm/paste/JKPasteOperation.class new file mode 100644 index 0000000..f7b65ee Binary files /dev/null and b/bin/com/connor/jk/plm/paste/JKPasteOperation.class differ diff --git a/bin/com/connor/jk/plm/paste/Util.class b/bin/com/connor/jk/plm/paste/Util.class new file mode 100644 index 0000000..60b602a Binary files /dev/null and b/bin/com/connor/jk/plm/paste/Util.class differ diff --git a/bin/com/connor/jk/plm/pcb/GeneratePCB_Action.class b/bin/com/connor/jk/plm/pcb/GeneratePCB_Action.class new file mode 100644 index 0000000..7e17a4f Binary files /dev/null and b/bin/com/connor/jk/plm/pcb/GeneratePCB_Action.class differ diff --git a/bin/com/connor/jk/plm/pcb/GeneratePCB_Handler.class b/bin/com/connor/jk/plm/pcb/GeneratePCB_Handler.class new file mode 100644 index 0000000..a21f08f Binary files /dev/null and b/bin/com/connor/jk/plm/pcb/GeneratePCB_Handler.class differ diff --git a/bin/com/connor/jk/plm/pcb/GeneratePCB_Operation.class b/bin/com/connor/jk/plm/pcb/GeneratePCB_Operation.class new file mode 100644 index 0000000..f1cd57c Binary files /dev/null and b/bin/com/connor/jk/plm/pcb/GeneratePCB_Operation.class differ diff --git a/bin/com/connor/jk/plm/project/ProgressBar$1.class b/bin/com/connor/jk/plm/project/ProgressBar$1.class new file mode 100644 index 0000000..09da25e Binary files /dev/null and b/bin/com/connor/jk/plm/project/ProgressBar$1.class differ diff --git a/bin/com/connor/jk/plm/project/ProgressBar$TaskThread.class b/bin/com/connor/jk/plm/project/ProgressBar$TaskThread.class new file mode 100644 index 0000000..0689698 Binary files /dev/null and b/bin/com/connor/jk/plm/project/ProgressBar$TaskThread.class differ diff --git a/bin/com/connor/jk/plm/project/ProgressBar.class b/bin/com/connor/jk/plm/project/ProgressBar.class new file mode 100644 index 0000000..dcfe9a3 Binary files /dev/null and b/bin/com/connor/jk/plm/project/ProgressBar.class differ diff --git a/bin/com/connor/jk/plm/project/ProgressBarThread.class b/bin/com/connor/jk/plm/project/ProgressBarThread.class new file mode 100644 index 0000000..dcadceb Binary files /dev/null and b/bin/com/connor/jk/plm/project/ProgressBarThread.class differ diff --git a/bin/com/connor/jk/plm/project/ProjectBean.class b/bin/com/connor/jk/plm/project/ProjectBean.class new file mode 100644 index 0000000..f4c6708 Binary files /dev/null and b/bin/com/connor/jk/plm/project/ProjectBean.class differ diff --git a/bin/com/connor/jk/plm/project/Project_Action.class b/bin/com/connor/jk/plm/project/Project_Action.class new file mode 100644 index 0000000..7f4c9bd Binary files /dev/null and b/bin/com/connor/jk/plm/project/Project_Action.class differ diff --git a/bin/com/connor/jk/plm/project/Project_Dialog.class b/bin/com/connor/jk/plm/project/Project_Dialog.class new file mode 100644 index 0000000..5a3210a Binary files /dev/null and b/bin/com/connor/jk/plm/project/Project_Dialog.class differ diff --git a/bin/com/connor/jk/plm/project/Project_Handler.class b/bin/com/connor/jk/plm/project/Project_Handler.class new file mode 100644 index 0000000..3382822 Binary files /dev/null and b/bin/com/connor/jk/plm/project/Project_Handler.class differ diff --git a/bin/com/connor/jk/plm/project/Project_Operation.class b/bin/com/connor/jk/plm/project/Project_Operation.class new file mode 100644 index 0000000..30403b2 Binary files /dev/null and b/bin/com/connor/jk/plm/project/Project_Operation.class differ diff --git a/bin/com/connor/jk/plm/project/SqlUtil.class b/bin/com/connor/jk/plm/project/SqlUtil.class new file mode 100644 index 0000000..055fe55 Binary files /dev/null and b/bin/com/connor/jk/plm/project/SqlUtil.class differ diff --git a/bin/com/connor/jk/plm/report/CalendarPanel$1.class b/bin/com/connor/jk/plm/report/CalendarPanel$1.class new file mode 100644 index 0000000..495cc75 Binary files /dev/null and b/bin/com/connor/jk/plm/report/CalendarPanel$1.class differ diff --git a/bin/com/connor/jk/plm/report/CalendarPanel$2.class b/bin/com/connor/jk/plm/report/CalendarPanel$2.class new file mode 100644 index 0000000..ab6dc74 Binary files /dev/null and b/bin/com/connor/jk/plm/report/CalendarPanel$2.class differ diff --git a/bin/com/connor/jk/plm/report/CalendarPanel$3.class b/bin/com/connor/jk/plm/report/CalendarPanel$3.class new file mode 100644 index 0000000..fe82dc4 Binary files /dev/null and b/bin/com/connor/jk/plm/report/CalendarPanel$3.class differ diff --git a/bin/com/connor/jk/plm/report/CalendarPanel$4.class b/bin/com/connor/jk/plm/report/CalendarPanel$4.class new file mode 100644 index 0000000..38e17c9 Binary files /dev/null and b/bin/com/connor/jk/plm/report/CalendarPanel$4.class differ diff --git a/bin/com/connor/jk/plm/report/CalendarPanel$5.class b/bin/com/connor/jk/plm/report/CalendarPanel$5.class new file mode 100644 index 0000000..4ddc516 Binary files /dev/null and b/bin/com/connor/jk/plm/report/CalendarPanel$5.class differ diff --git a/bin/com/connor/jk/plm/report/CalendarPanel$6.class b/bin/com/connor/jk/plm/report/CalendarPanel$6.class new file mode 100644 index 0000000..af7d1d4 Binary files /dev/null and b/bin/com/connor/jk/plm/report/CalendarPanel$6.class differ diff --git a/bin/com/connor/jk/plm/report/CalendarPanel$7.class b/bin/com/connor/jk/plm/report/CalendarPanel$7.class new file mode 100644 index 0000000..bb9db91 Binary files /dev/null and b/bin/com/connor/jk/plm/report/CalendarPanel$7.class differ diff --git a/bin/com/connor/jk/plm/report/CalendarPanel.class b/bin/com/connor/jk/plm/report/CalendarPanel.class new file mode 100644 index 0000000..063d9b4 Binary files /dev/null and b/bin/com/connor/jk/plm/report/CalendarPanel.class differ diff --git a/bin/com/connor/jk/plm/report/DefaultTableCellRenderer2.class b/bin/com/connor/jk/plm/report/DefaultTableCellRenderer2.class new file mode 100644 index 0000000..605542f Binary files /dev/null and b/bin/com/connor/jk/plm/report/DefaultTableCellRenderer2.class differ diff --git a/bin/com/connor/jk/plm/report/GroupBean.class b/bin/com/connor/jk/plm/report/GroupBean.class new file mode 100644 index 0000000..e894e52 Binary files /dev/null and b/bin/com/connor/jk/plm/report/GroupBean.class differ diff --git a/bin/com/connor/jk/plm/report/JTable2.class b/bin/com/connor/jk/plm/report/JTable2.class new file mode 100644 index 0000000..e36d81f Binary files /dev/null and b/bin/com/connor/jk/plm/report/JTable2.class differ diff --git a/bin/com/connor/jk/plm/report/JTableModel2.class b/bin/com/connor/jk/plm/report/JTableModel2.class new file mode 100644 index 0000000..ba3a8c4 Binary files /dev/null and b/bin/com/connor/jk/plm/report/JTableModel2.class differ diff --git a/bin/com/connor/jk/plm/report/JspsReport_Action.class b/bin/com/connor/jk/plm/report/JspsReport_Action.class new file mode 100644 index 0000000..413b4c0 Binary files /dev/null and b/bin/com/connor/jk/plm/report/JspsReport_Action.class differ diff --git a/bin/com/connor/jk/plm/report/JspsReport_Dialog$1.class b/bin/com/connor/jk/plm/report/JspsReport_Dialog$1.class new file mode 100644 index 0000000..3662a13 Binary files /dev/null and b/bin/com/connor/jk/plm/report/JspsReport_Dialog$1.class differ diff --git a/bin/com/connor/jk/plm/report/JspsReport_Dialog$2.class b/bin/com/connor/jk/plm/report/JspsReport_Dialog$2.class new file mode 100644 index 0000000..e9c56f4 Binary files /dev/null and b/bin/com/connor/jk/plm/report/JspsReport_Dialog$2.class differ diff --git a/bin/com/connor/jk/plm/report/JspsReport_Dialog$3.class b/bin/com/connor/jk/plm/report/JspsReport_Dialog$3.class new file mode 100644 index 0000000..3d1fdcf Binary files /dev/null and b/bin/com/connor/jk/plm/report/JspsReport_Dialog$3.class differ diff --git a/bin/com/connor/jk/plm/report/JspsReport_Dialog.class b/bin/com/connor/jk/plm/report/JspsReport_Dialog.class new file mode 100644 index 0000000..c449212 Binary files /dev/null and b/bin/com/connor/jk/plm/report/JspsReport_Dialog.class differ diff --git a/bin/com/connor/jk/plm/report/JspsReport_Handler.class b/bin/com/connor/jk/plm/report/JspsReport_Handler.class new file mode 100644 index 0000000..f113f64 Binary files /dev/null and b/bin/com/connor/jk/plm/report/JspsReport_Handler.class differ diff --git a/bin/com/connor/jk/plm/report/JspsReport_Operation.class b/bin/com/connor/jk/plm/report/JspsReport_Operation.class new file mode 100644 index 0000000..2950219 Binary files /dev/null and b/bin/com/connor/jk/plm/report/JspsReport_Operation.class differ diff --git a/bin/com/connor/jk/plm/report/ProgressBar$1.class b/bin/com/connor/jk/plm/report/ProgressBar$1.class new file mode 100644 index 0000000..44e8075 Binary files /dev/null and b/bin/com/connor/jk/plm/report/ProgressBar$1.class differ diff --git a/bin/com/connor/jk/plm/report/ProgressBar$TaskThread.class b/bin/com/connor/jk/plm/report/ProgressBar$TaskThread.class new file mode 100644 index 0000000..d5ceb23 Binary files /dev/null and b/bin/com/connor/jk/plm/report/ProgressBar$TaskThread.class differ diff --git a/bin/com/connor/jk/plm/report/ProgressBar.class b/bin/com/connor/jk/plm/report/ProgressBar.class new file mode 100644 index 0000000..ad6602a Binary files /dev/null and b/bin/com/connor/jk/plm/report/ProgressBar.class differ diff --git a/bin/com/connor/jk/plm/report/ProgressBarThread.class b/bin/com/connor/jk/plm/report/ProgressBarThread.class new file mode 100644 index 0000000..251aed3 Binary files /dev/null and b/bin/com/connor/jk/plm/report/ProgressBarThread.class differ diff --git a/bin/com/connor/jk/plm/report/RolloverSpinnerListModel.class b/bin/com/connor/jk/plm/report/RolloverSpinnerListModel.class new file mode 100644 index 0000000..a6910cd Binary files /dev/null and b/bin/com/connor/jk/plm/report/RolloverSpinnerListModel.class differ diff --git a/bin/com/connor/jk/plm/report/SqlUtil.class b/bin/com/connor/jk/plm/report/SqlUtil.class new file mode 100644 index 0000000..f311014 Binary files /dev/null and b/bin/com/connor/jk/plm/report/SqlUtil.class differ diff --git a/bin/com/connor/jk/plm/report/WorkHour_Dialog$1.class b/bin/com/connor/jk/plm/report/WorkHour_Dialog$1.class new file mode 100644 index 0000000..7419d87 Binary files /dev/null and b/bin/com/connor/jk/plm/report/WorkHour_Dialog$1.class differ diff --git a/bin/com/connor/jk/plm/report/WorkHour_Dialog$2.class b/bin/com/connor/jk/plm/report/WorkHour_Dialog$2.class new file mode 100644 index 0000000..ea4065e Binary files /dev/null and b/bin/com/connor/jk/plm/report/WorkHour_Dialog$2.class differ diff --git a/bin/com/connor/jk/plm/report/WorkHour_Dialog.class b/bin/com/connor/jk/plm/report/WorkHour_Dialog.class new file mode 100644 index 0000000..2f54701 Binary files /dev/null and b/bin/com/connor/jk/plm/report/WorkHour_Dialog.class differ diff --git a/bin/com/connor/jk/plm/report/WorkHour_Operation.class b/bin/com/connor/jk/plm/report/WorkHour_Operation.class new file mode 100644 index 0000000..3d9a290 Binary files /dev/null and b/bin/com/connor/jk/plm/report/WorkHour_Operation.class differ diff --git a/bin/com/connor/jk/plm/report/WorkHoursBean.class b/bin/com/connor/jk/plm/report/WorkHoursBean.class new file mode 100644 index 0000000..0c73bae Binary files /dev/null and b/bin/com/connor/jk/plm/report/WorkHoursBean.class differ diff --git a/bin/com/connor/jk/plm/report/WorkHours_Action.class b/bin/com/connor/jk/plm/report/WorkHours_Action.class new file mode 100644 index 0000000..2b72358 Binary files /dev/null and b/bin/com/connor/jk/plm/report/WorkHours_Action.class differ diff --git a/bin/com/connor/jk/plm/report/WorkHours_Handler.class b/bin/com/connor/jk/plm/report/WorkHours_Handler.class new file mode 100644 index 0000000..3499861 Binary files /dev/null and b/bin/com/connor/jk/plm/report/WorkHours_Handler.class differ diff --git a/bin/com/connor/jk/plm/report/database.properties b/bin/com/connor/jk/plm/report/database.properties new file mode 100644 index 0000000..9222a25 --- /dev/null +++ b/bin/com/connor/jk/plm/report/database.properties @@ -0,0 +1,21 @@ + +#ORACEL_NAME=tc +# +#ORACEL_PASSWORD=Tc123456 +# +##ORACEL_URL=jdbc:oracle:thin:@192.168.1.248:1521:TOPPROD +# +#ORACEL_URL=jdbc:microsoft:sqlserver://10.200.1.33:1433;DatabaseName=ecology +# +#ORACEL_DRIVER=com.microsoft.jdbc.sqlserver.SQLServerDriver + +ORACEL_NAME=tc + +ORACEL_PASSWORD=Tc_1234 + +#ORACEL_URL=jdbc:oracle:thin:@192.168.1.248:1521:TOPPROD + +ORACEL_URL=jdbc:microsoft:sqlserver://10.200.1.66:1433;DatabaseName=ecology +#ORACEL_URL=jdbc:jtds:sqlserver://10.200.1.66:1433;DatabaseName=ecology + +ORACEL_DRIVER=com.microsoft.jdbc.sqlserver.SQLServerDriver \ No newline at end of file diff --git a/bin/com/connor/jk/plm/search/ExCPPZGZ_Dialog$1.class b/bin/com/connor/jk/plm/search/ExCPPZGZ_Dialog$1.class new file mode 100644 index 0000000..4d69cef Binary files /dev/null and b/bin/com/connor/jk/plm/search/ExCPPZGZ_Dialog$1.class differ diff --git a/bin/com/connor/jk/plm/search/ExCPPZGZ_Dialog$2.class b/bin/com/connor/jk/plm/search/ExCPPZGZ_Dialog$2.class new file mode 100644 index 0000000..d6ea544 Binary files /dev/null and b/bin/com/connor/jk/plm/search/ExCPPZGZ_Dialog$2.class differ diff --git a/bin/com/connor/jk/plm/search/ExCPPZGZ_Dialog$3.class b/bin/com/connor/jk/plm/search/ExCPPZGZ_Dialog$3.class new file mode 100644 index 0000000..e255587 Binary files /dev/null and b/bin/com/connor/jk/plm/search/ExCPPZGZ_Dialog$3.class differ diff --git a/bin/com/connor/jk/plm/search/ExCPPZGZ_Dialog.class b/bin/com/connor/jk/plm/search/ExCPPZGZ_Dialog.class new file mode 100644 index 0000000..4e541f8 Binary files /dev/null and b/bin/com/connor/jk/plm/search/ExCPPZGZ_Dialog.class differ diff --git a/bin/com/connor/jk/plm/search/ExCPPZGZ_Handler.class b/bin/com/connor/jk/plm/search/ExCPPZGZ_Handler.class new file mode 100644 index 0000000..b0af35c Binary files /dev/null and b/bin/com/connor/jk/plm/search/ExCPPZGZ_Handler.class differ diff --git a/bin/com/connor/jk/plm/search/ExCPPZGZ_Operation.class b/bin/com/connor/jk/plm/search/ExCPPZGZ_Operation.class new file mode 100644 index 0000000..2908f09 Binary files /dev/null and b/bin/com/connor/jk/plm/search/ExCPPZGZ_Operation.class differ diff --git a/bin/com/connor/jk/plm/search/ItemBean.class b/bin/com/connor/jk/plm/search/ItemBean.class new file mode 100644 index 0000000..f3bd85f Binary files /dev/null and b/bin/com/connor/jk/plm/search/ItemBean.class differ diff --git a/bin/com/connor/jk/plm/search/SearchSBH_Handler.class b/bin/com/connor/jk/plm/search/SearchSBH_Handler.class new file mode 100644 index 0000000..ea05b8c Binary files /dev/null and b/bin/com/connor/jk/plm/search/SearchSBH_Handler.class differ diff --git a/bin/com/connor/jk/plm/search/SearchSBH_Operation.class b/bin/com/connor/jk/plm/search/SearchSBH_Operation.class new file mode 100644 index 0000000..5b3f241 Binary files /dev/null and b/bin/com/connor/jk/plm/search/SearchSBH_Operation.class differ diff --git a/bin/com/connor/jk/plm/sendToClassification/ClassProperty.class b/bin/com/connor/jk/plm/sendToClassification/ClassProperty.class new file mode 100644 index 0000000..028d96e Binary files /dev/null and b/bin/com/connor/jk/plm/sendToClassification/ClassProperty.class differ diff --git a/bin/com/connor/jk/plm/sendToClassification/SendToClassification_Action.class b/bin/com/connor/jk/plm/sendToClassification/SendToClassification_Action.class new file mode 100644 index 0000000..e1b4e63 Binary files /dev/null and b/bin/com/connor/jk/plm/sendToClassification/SendToClassification_Action.class differ diff --git a/bin/com/connor/jk/plm/sendToClassification/SendToClassification_Handler.class b/bin/com/connor/jk/plm/sendToClassification/SendToClassification_Handler.class new file mode 100644 index 0000000..74bd745 Binary files /dev/null and b/bin/com/connor/jk/plm/sendToClassification/SendToClassification_Handler.class differ diff --git a/bin/com/connor/jk/plm/sendToClassification/SendToClassification_Operation.class b/bin/com/connor/jk/plm/sendToClassification/SendToClassification_Operation.class new file mode 100644 index 0000000..a868662 Binary files /dev/null and b/bin/com/connor/jk/plm/sendToClassification/SendToClassification_Operation.class differ diff --git a/bin/com/connor/jk/plm/sendToClassification/SoaServerUtil.class b/bin/com/connor/jk/plm/sendToClassification/SoaServerUtil.class new file mode 100644 index 0000000..084b30e Binary files /dev/null and b/bin/com/connor/jk/plm/sendToClassification/SoaServerUtil.class differ diff --git a/bin/com/connor/jk/plm/sendToClassification/Util.class b/bin/com/connor/jk/plm/sendToClassification/Util.class new file mode 100644 index 0000000..9dad0b8 Binary files /dev/null and b/bin/com/connor/jk/plm/sendToClassification/Util.class differ diff --git a/bin/com/connor/jk/plm/setBomline/AddCommand.class b/bin/com/connor/jk/plm/setBomline/AddCommand.class new file mode 100644 index 0000000..a2222f0 Binary files /dev/null and b/bin/com/connor/jk/plm/setBomline/AddCommand.class differ diff --git a/bin/com/connor/jk/plm/setBomline/AddDialog$1.class b/bin/com/connor/jk/plm/setBomline/AddDialog$1.class new file mode 100644 index 0000000..fdc49be Binary files /dev/null and b/bin/com/connor/jk/plm/setBomline/AddDialog$1.class differ diff --git a/bin/com/connor/jk/plm/setBomline/AddDialog$2.class b/bin/com/connor/jk/plm/setBomline/AddDialog$2.class new file mode 100644 index 0000000..8d29009 Binary files /dev/null and b/bin/com/connor/jk/plm/setBomline/AddDialog$2.class differ diff --git a/bin/com/connor/jk/plm/setBomline/AddDialog$3.class b/bin/com/connor/jk/plm/setBomline/AddDialog$3.class new file mode 100644 index 0000000..f88534b Binary files /dev/null and b/bin/com/connor/jk/plm/setBomline/AddDialog$3.class differ diff --git a/bin/com/connor/jk/plm/setBomline/AddDialog$4$1.class b/bin/com/connor/jk/plm/setBomline/AddDialog$4$1.class new file mode 100644 index 0000000..856d487 Binary files /dev/null and b/bin/com/connor/jk/plm/setBomline/AddDialog$4$1.class differ diff --git a/bin/com/connor/jk/plm/setBomline/AddDialog$4.class b/bin/com/connor/jk/plm/setBomline/AddDialog$4.class new file mode 100644 index 0000000..3c8a51e Binary files /dev/null and b/bin/com/connor/jk/plm/setBomline/AddDialog$4.class differ diff --git a/bin/com/connor/jk/plm/setBomline/AddDialog$5$1.class b/bin/com/connor/jk/plm/setBomline/AddDialog$5$1.class new file mode 100644 index 0000000..486bca8 Binary files /dev/null and b/bin/com/connor/jk/plm/setBomline/AddDialog$5$1.class differ diff --git a/bin/com/connor/jk/plm/setBomline/AddDialog$5.class b/bin/com/connor/jk/plm/setBomline/AddDialog$5.class new file mode 100644 index 0000000..d1ef791 Binary files /dev/null and b/bin/com/connor/jk/plm/setBomline/AddDialog$5.class differ diff --git a/bin/com/connor/jk/plm/setBomline/AddDialog$6$1.class b/bin/com/connor/jk/plm/setBomline/AddDialog$6$1.class new file mode 100644 index 0000000..bac4f2f Binary files /dev/null and b/bin/com/connor/jk/plm/setBomline/AddDialog$6$1.class differ diff --git a/bin/com/connor/jk/plm/setBomline/AddDialog$6.class b/bin/com/connor/jk/plm/setBomline/AddDialog$6.class new file mode 100644 index 0000000..e0e87f8 Binary files /dev/null and b/bin/com/connor/jk/plm/setBomline/AddDialog$6.class differ diff --git a/bin/com/connor/jk/plm/setBomline/AddDialog$7.class b/bin/com/connor/jk/plm/setBomline/AddDialog$7.class new file mode 100644 index 0000000..c0d8985 Binary files /dev/null and b/bin/com/connor/jk/plm/setBomline/AddDialog$7.class differ diff --git a/bin/com/connor/jk/plm/setBomline/AddDialog$8.class b/bin/com/connor/jk/plm/setBomline/AddDialog$8.class new file mode 100644 index 0000000..8b8e246 Binary files /dev/null and b/bin/com/connor/jk/plm/setBomline/AddDialog$8.class differ diff --git a/bin/com/connor/jk/plm/setBomline/AddDialog$ActionOption.class b/bin/com/connor/jk/plm/setBomline/AddDialog$ActionOption.class new file mode 100644 index 0000000..201e0d8 Binary files /dev/null and b/bin/com/connor/jk/plm/setBomline/AddDialog$ActionOption.class differ diff --git a/bin/com/connor/jk/plm/setBomline/AddDialog.class b/bin/com/connor/jk/plm/setBomline/AddDialog.class new file mode 100644 index 0000000..2fb8f07 Binary files /dev/null and b/bin/com/connor/jk/plm/setBomline/AddDialog.class differ diff --git a/bin/com/connor/jk/plm/setBomline/MyTable.class b/bin/com/connor/jk/plm/setBomline/MyTable.class new file mode 100644 index 0000000..543e50d Binary files /dev/null and b/bin/com/connor/jk/plm/setBomline/MyTable.class differ diff --git a/bin/com/connor/jk/plm/setBomline/SetBomline_Action.class b/bin/com/connor/jk/plm/setBomline/SetBomline_Action.class new file mode 100644 index 0000000..3a1ecad Binary files /dev/null and b/bin/com/connor/jk/plm/setBomline/SetBomline_Action.class differ diff --git a/bin/com/connor/jk/plm/setBomline/SetBomline_Command.class b/bin/com/connor/jk/plm/setBomline/SetBomline_Command.class new file mode 100644 index 0000000..aa92866 Binary files /dev/null and b/bin/com/connor/jk/plm/setBomline/SetBomline_Command.class differ diff --git a/bin/com/connor/jk/plm/setBomline/SetBomline_Dialog$1.class b/bin/com/connor/jk/plm/setBomline/SetBomline_Dialog$1.class new file mode 100644 index 0000000..8189031 Binary files /dev/null and b/bin/com/connor/jk/plm/setBomline/SetBomline_Dialog$1.class differ diff --git a/bin/com/connor/jk/plm/setBomline/SetBomline_Dialog$2.class b/bin/com/connor/jk/plm/setBomline/SetBomline_Dialog$2.class new file mode 100644 index 0000000..5bf65fc Binary files /dev/null and b/bin/com/connor/jk/plm/setBomline/SetBomline_Dialog$2.class differ diff --git a/bin/com/connor/jk/plm/setBomline/SetBomline_Dialog$3.class b/bin/com/connor/jk/plm/setBomline/SetBomline_Dialog$3.class new file mode 100644 index 0000000..de435c2 Binary files /dev/null and b/bin/com/connor/jk/plm/setBomline/SetBomline_Dialog$3.class differ diff --git a/bin/com/connor/jk/plm/setBomline/SetBomline_Dialog$4.class b/bin/com/connor/jk/plm/setBomline/SetBomline_Dialog$4.class new file mode 100644 index 0000000..1e58287 Binary files /dev/null and b/bin/com/connor/jk/plm/setBomline/SetBomline_Dialog$4.class differ diff --git a/bin/com/connor/jk/plm/setBomline/SetBomline_Dialog$5.class b/bin/com/connor/jk/plm/setBomline/SetBomline_Dialog$5.class new file mode 100644 index 0000000..aa51c99 Binary files /dev/null and b/bin/com/connor/jk/plm/setBomline/SetBomline_Dialog$5.class differ diff --git a/bin/com/connor/jk/plm/setBomline/SetBomline_Dialog.class b/bin/com/connor/jk/plm/setBomline/SetBomline_Dialog.class new file mode 100644 index 0000000..b2e4501 Binary files /dev/null and b/bin/com/connor/jk/plm/setBomline/SetBomline_Dialog.class differ diff --git a/bin/com/connor/jk/plm/setBomline/SetBomline_Handler.class b/bin/com/connor/jk/plm/setBomline/SetBomline_Handler.class new file mode 100644 index 0000000..1b3b1f0 Binary files /dev/null and b/bin/com/connor/jk/plm/setBomline/SetBomline_Handler.class differ diff --git a/bin/com/connor/jk/plm/setBomline/SubstituteBean.class b/bin/com/connor/jk/plm/setBomline/SubstituteBean.class new file mode 100644 index 0000000..73655e7 Binary files /dev/null and b/bin/com/connor/jk/plm/setBomline/SubstituteBean.class differ diff --git a/bin/com/connor/jk/plm/sign/JK8_JSPSPropBean.class b/bin/com/connor/jk/plm/sign/JK8_JSPSPropBean.class new file mode 100644 index 0000000..c27cc96 Binary files /dev/null and b/bin/com/connor/jk/plm/sign/JK8_JSPSPropBean.class differ diff --git a/bin/com/connor/jk/plm/sign/Sign_Action.class b/bin/com/connor/jk/plm/sign/Sign_Action.class new file mode 100644 index 0000000..78d9c80 Binary files /dev/null and b/bin/com/connor/jk/plm/sign/Sign_Action.class differ diff --git a/bin/com/connor/jk/plm/sign/Sign_Dialog$1.class b/bin/com/connor/jk/plm/sign/Sign_Dialog$1.class new file mode 100644 index 0000000..f0d2816 Binary files /dev/null and b/bin/com/connor/jk/plm/sign/Sign_Dialog$1.class differ diff --git a/bin/com/connor/jk/plm/sign/Sign_Dialog$2.class b/bin/com/connor/jk/plm/sign/Sign_Dialog$2.class new file mode 100644 index 0000000..5c635b7 Binary files /dev/null and b/bin/com/connor/jk/plm/sign/Sign_Dialog$2.class differ diff --git a/bin/com/connor/jk/plm/sign/Sign_Dialog$3.class b/bin/com/connor/jk/plm/sign/Sign_Dialog$3.class new file mode 100644 index 0000000..4cad0d5 Binary files /dev/null and b/bin/com/connor/jk/plm/sign/Sign_Dialog$3.class differ diff --git a/bin/com/connor/jk/plm/sign/Sign_Dialog$4.class b/bin/com/connor/jk/plm/sign/Sign_Dialog$4.class new file mode 100644 index 0000000..679ad59 Binary files /dev/null and b/bin/com/connor/jk/plm/sign/Sign_Dialog$4.class differ diff --git a/bin/com/connor/jk/plm/sign/Sign_Dialog.class b/bin/com/connor/jk/plm/sign/Sign_Dialog.class new file mode 100644 index 0000000..71e8265 Binary files /dev/null and b/bin/com/connor/jk/plm/sign/Sign_Dialog.class differ diff --git a/bin/com/connor/jk/plm/sign/Sign_Handler.class b/bin/com/connor/jk/plm/sign/Sign_Handler.class new file mode 100644 index 0000000..7a42d9a Binary files /dev/null and b/bin/com/connor/jk/plm/sign/Sign_Handler.class differ diff --git a/bin/com/connor/jk/plm/sign/TableComboxRender.class b/bin/com/connor/jk/plm/sign/TableComboxRender.class new file mode 100644 index 0000000..dacbf97 Binary files /dev/null and b/bin/com/connor/jk/plm/sign/TableComboxRender.class differ diff --git a/bin/com/connor/jk/plm/sqb/DataBaseControl.class b/bin/com/connor/jk/plm/sqb/DataBaseControl.class new file mode 100644 index 0000000..5fe6c1d Binary files /dev/null and b/bin/com/connor/jk/plm/sqb/DataBaseControl.class differ diff --git a/bin/com/connor/jk/plm/sqb/Generate_Action.class b/bin/com/connor/jk/plm/sqb/Generate_Action.class new file mode 100644 index 0000000..dd21cef Binary files /dev/null and b/bin/com/connor/jk/plm/sqb/Generate_Action.class differ diff --git a/bin/com/connor/jk/plm/sqb/Generate_Handler.class b/bin/com/connor/jk/plm/sqb/Generate_Handler.class new file mode 100644 index 0000000..8707ada Binary files /dev/null and b/bin/com/connor/jk/plm/sqb/Generate_Handler.class differ diff --git a/bin/com/connor/jk/plm/sqb/Generate_Operation.class b/bin/com/connor/jk/plm/sqb/Generate_Operation.class new file mode 100644 index 0000000..7d41ec1 Binary files /dev/null and b/bin/com/connor/jk/plm/sqb/Generate_Operation.class differ diff --git a/bin/com/connor/jk/plm/sqb/Generate_OperationNew.class b/bin/com/connor/jk/plm/sqb/Generate_OperationNew.class new file mode 100644 index 0000000..b44f36d Binary files /dev/null and b/bin/com/connor/jk/plm/sqb/Generate_OperationNew.class differ diff --git a/bin/com/connor/jk/plm/sqb/JK8_SBH_Action.class b/bin/com/connor/jk/plm/sqb/JK8_SBH_Action.class new file mode 100644 index 0000000..599b15d Binary files /dev/null and b/bin/com/connor/jk/plm/sqb/JK8_SBH_Action.class differ diff --git a/bin/com/connor/jk/plm/sqb/JK8_SBH_Command.class b/bin/com/connor/jk/plm/sqb/JK8_SBH_Command.class new file mode 100644 index 0000000..bc4cdf1 Binary files /dev/null and b/bin/com/connor/jk/plm/sqb/JK8_SBH_Command.class differ diff --git a/bin/com/connor/jk/plm/sqb/JK8_SBH_Operation.class b/bin/com/connor/jk/plm/sqb/JK8_SBH_Operation.class new file mode 100644 index 0000000..8a274d2 Binary files /dev/null and b/bin/com/connor/jk/plm/sqb/JK8_SBH_Operation.class differ diff --git a/bin/com/connor/jk/plm/sqb/Sethzbform_Handler.class b/bin/com/connor/jk/plm/sqb/Sethzbform_Handler.class new file mode 100644 index 0000000..b1b9fee Binary files /dev/null and b/bin/com/connor/jk/plm/sqb/Sethzbform_Handler.class differ diff --git a/bin/com/connor/jk/plm/tallySheet/CM-02 配置管理计划模板V1.5.xlsx b/bin/com/connor/jk/plm/tallySheet/CM-02 配置管理计划模板V1.5.xlsx new file mode 100644 index 0000000..01252a1 Binary files /dev/null and b/bin/com/connor/jk/plm/tallySheet/CM-02 配置管理计划模板V1.5.xlsx differ diff --git a/bin/com/connor/jk/plm/tallySheet/ProcessBarDialog.class b/bin/com/connor/jk/plm/tallySheet/ProcessBarDialog.class new file mode 100644 index 0000000..89ffa8b Binary files /dev/null and b/bin/com/connor/jk/plm/tallySheet/ProcessBarDialog.class differ diff --git a/bin/com/connor/jk/plm/tallySheet/ProgressBar$1.class b/bin/com/connor/jk/plm/tallySheet/ProgressBar$1.class new file mode 100644 index 0000000..8f15f3f Binary files /dev/null and b/bin/com/connor/jk/plm/tallySheet/ProgressBar$1.class differ diff --git a/bin/com/connor/jk/plm/tallySheet/ProgressBar$TaskThread.class b/bin/com/connor/jk/plm/tallySheet/ProgressBar$TaskThread.class new file mode 100644 index 0000000..7a0dff3 Binary files /dev/null and b/bin/com/connor/jk/plm/tallySheet/ProgressBar$TaskThread.class differ diff --git a/bin/com/connor/jk/plm/tallySheet/ProgressBar.class b/bin/com/connor/jk/plm/tallySheet/ProgressBar.class new file mode 100644 index 0000000..df6e290 Binary files /dev/null and b/bin/com/connor/jk/plm/tallySheet/ProgressBar.class differ diff --git a/bin/com/connor/jk/plm/tallySheet/ProgressBarThread.class b/bin/com/connor/jk/plm/tallySheet/ProgressBarThread.class new file mode 100644 index 0000000..31b1ac0 Binary files /dev/null and b/bin/com/connor/jk/plm/tallySheet/ProgressBarThread.class differ diff --git a/bin/com/connor/jk/plm/tallySheet/ScheduleReportAction.class b/bin/com/connor/jk/plm/tallySheet/ScheduleReportAction.class new file mode 100644 index 0000000..c367c12 Binary files /dev/null and b/bin/com/connor/jk/plm/tallySheet/ScheduleReportAction.class differ diff --git a/bin/com/connor/jk/plm/tallySheet/ScheduleReportHandler.class b/bin/com/connor/jk/plm/tallySheet/ScheduleReportHandler.class new file mode 100644 index 0000000..f749d9e Binary files /dev/null and b/bin/com/connor/jk/plm/tallySheet/ScheduleReportHandler.class differ diff --git a/bin/com/connor/jk/plm/tallySheet/TallySheetAction.class b/bin/com/connor/jk/plm/tallySheet/TallySheetAction.class new file mode 100644 index 0000000..f22328e Binary files /dev/null and b/bin/com/connor/jk/plm/tallySheet/TallySheetAction.class differ diff --git a/bin/com/connor/jk/plm/tallySheet/TallySheetBean.class b/bin/com/connor/jk/plm/tallySheet/TallySheetBean.class new file mode 100644 index 0000000..13bcde9 Binary files /dev/null and b/bin/com/connor/jk/plm/tallySheet/TallySheetBean.class differ diff --git a/bin/com/connor/jk/plm/tallySheet/TallySheetDialog$1.class b/bin/com/connor/jk/plm/tallySheet/TallySheetDialog$1.class new file mode 100644 index 0000000..77e85e5 Binary files /dev/null and b/bin/com/connor/jk/plm/tallySheet/TallySheetDialog$1.class differ diff --git a/bin/com/connor/jk/plm/tallySheet/TallySheetDialog$2.class b/bin/com/connor/jk/plm/tallySheet/TallySheetDialog$2.class new file mode 100644 index 0000000..3caa6ef Binary files /dev/null and b/bin/com/connor/jk/plm/tallySheet/TallySheetDialog$2.class differ diff --git a/bin/com/connor/jk/plm/tallySheet/TallySheetDialog.class b/bin/com/connor/jk/plm/tallySheet/TallySheetDialog.class new file mode 100644 index 0000000..1857386 Binary files /dev/null and b/bin/com/connor/jk/plm/tallySheet/TallySheetDialog.class differ diff --git a/bin/com/connor/jk/plm/tallySheet/TallySheetHandler.class b/bin/com/connor/jk/plm/tallySheet/TallySheetHandler.class new file mode 100644 index 0000000..e58db54 Binary files /dev/null and b/bin/com/connor/jk/plm/tallySheet/TallySheetHandler.class differ diff --git a/bin/com/connor/jk/plm/tallySheet/TallySheetOperation$1.class b/bin/com/connor/jk/plm/tallySheet/TallySheetOperation$1.class new file mode 100644 index 0000000..2c176f3 Binary files /dev/null and b/bin/com/connor/jk/plm/tallySheet/TallySheetOperation$1.class differ diff --git a/bin/com/connor/jk/plm/tallySheet/TallySheetOperation.class b/bin/com/connor/jk/plm/tallySheet/TallySheetOperation.class new file mode 100644 index 0000000..46b2d1a Binary files /dev/null and b/bin/com/connor/jk/plm/tallySheet/TallySheetOperation.class differ diff --git a/bin/com/connor/jk/plm/tallySheet/TallySheetUtil2.class b/bin/com/connor/jk/plm/tallySheet/TallySheetUtil2.class new file mode 100644 index 0000000..7096c2d Binary files /dev/null and b/bin/com/connor/jk/plm/tallySheet/TallySheetUtil2.class differ diff --git a/bin/com/connor/jk/plm/tallySheet/TallySheetUtil2_2.class b/bin/com/connor/jk/plm/tallySheet/TallySheetUtil2_2.class new file mode 100644 index 0000000..2ea330a Binary files /dev/null and b/bin/com/connor/jk/plm/tallySheet/TallySheetUtil2_2.class differ diff --git a/bin/com/connor/jk/plm/tempToFormal/ClassProperty.class b/bin/com/connor/jk/plm/tempToFormal/ClassProperty.class new file mode 100644 index 0000000..9a6e45a Binary files /dev/null and b/bin/com/connor/jk/plm/tempToFormal/ClassProperty.class differ diff --git a/bin/com/connor/jk/plm/tempToFormal/SoaServerUtil.class b/bin/com/connor/jk/plm/tempToFormal/SoaServerUtil.class new file mode 100644 index 0000000..7020d04 Binary files /dev/null and b/bin/com/connor/jk/plm/tempToFormal/SoaServerUtil.class differ diff --git a/bin/com/connor/jk/plm/tempToFormal/Util.class b/bin/com/connor/jk/plm/tempToFormal/Util.class new file mode 100644 index 0000000..5c51089 Binary files /dev/null and b/bin/com/connor/jk/plm/tempToFormal/Util.class differ diff --git a/bin/com/connor/jk/plm/tempToFormal/tempToFormal_Action.class b/bin/com/connor/jk/plm/tempToFormal/tempToFormal_Action.class new file mode 100644 index 0000000..892b574 Binary files /dev/null and b/bin/com/connor/jk/plm/tempToFormal/tempToFormal_Action.class differ diff --git a/bin/com/connor/jk/plm/tempToFormal/tempToFormal_Handler.class b/bin/com/connor/jk/plm/tempToFormal/tempToFormal_Handler.class new file mode 100644 index 0000000..1313e6d Binary files /dev/null and b/bin/com/connor/jk/plm/tempToFormal/tempToFormal_Handler.class differ diff --git a/bin/com/connor/jk/plm/tempToFormal/tempToFormal_Operation.class b/bin/com/connor/jk/plm/tempToFormal/tempToFormal_Operation.class new file mode 100644 index 0000000..f8f7a05 Binary files /dev/null and b/bin/com/connor/jk/plm/tempToFormal/tempToFormal_Operation.class differ diff --git a/bin/com/connor/jk/plm/test20200415/test20200415_Handler.class b/bin/com/connor/jk/plm/test20200415/test20200415_Handler.class new file mode 100644 index 0000000..a8d64eb Binary files /dev/null and b/bin/com/connor/jk/plm/test20200415/test20200415_Handler.class differ diff --git a/bin/com/connor/jk/plm/transfer/ProgressBar$1.class b/bin/com/connor/jk/plm/transfer/ProgressBar$1.class new file mode 100644 index 0000000..a8691eb Binary files /dev/null and b/bin/com/connor/jk/plm/transfer/ProgressBar$1.class differ diff --git a/bin/com/connor/jk/plm/transfer/ProgressBar$TaskThread.class b/bin/com/connor/jk/plm/transfer/ProgressBar$TaskThread.class new file mode 100644 index 0000000..a8787f6 Binary files /dev/null and b/bin/com/connor/jk/plm/transfer/ProgressBar$TaskThread.class differ diff --git a/bin/com/connor/jk/plm/transfer/ProgressBar.class b/bin/com/connor/jk/plm/transfer/ProgressBar.class new file mode 100644 index 0000000..a044995 Binary files /dev/null and b/bin/com/connor/jk/plm/transfer/ProgressBar.class differ diff --git a/bin/com/connor/jk/plm/transfer/ProgressBarThread.class b/bin/com/connor/jk/plm/transfer/ProgressBarThread.class new file mode 100644 index 0000000..4263c96 Binary files /dev/null and b/bin/com/connor/jk/plm/transfer/ProgressBarThread.class differ diff --git a/bin/com/connor/jk/plm/transfer/ProjBean.class b/bin/com/connor/jk/plm/transfer/ProjBean.class new file mode 100644 index 0000000..55f34ae Binary files /dev/null and b/bin/com/connor/jk/plm/transfer/ProjBean.class differ diff --git a/bin/com/connor/jk/plm/transfer/Util.class b/bin/com/connor/jk/plm/transfer/Util.class new file mode 100644 index 0000000..248433e Binary files /dev/null and b/bin/com/connor/jk/plm/transfer/Util.class differ diff --git a/bin/com/connor/jk/plm/transfer/transfer_Action.class b/bin/com/connor/jk/plm/transfer/transfer_Action.class new file mode 100644 index 0000000..28473df Binary files /dev/null and b/bin/com/connor/jk/plm/transfer/transfer_Action.class differ diff --git a/bin/com/connor/jk/plm/transfer/transfer_Dialog$1.class b/bin/com/connor/jk/plm/transfer/transfer_Dialog$1.class new file mode 100644 index 0000000..8019569 Binary files /dev/null and b/bin/com/connor/jk/plm/transfer/transfer_Dialog$1.class differ diff --git a/bin/com/connor/jk/plm/transfer/transfer_Dialog.class b/bin/com/connor/jk/plm/transfer/transfer_Dialog.class new file mode 100644 index 0000000..05bdd4e Binary files /dev/null and b/bin/com/connor/jk/plm/transfer/transfer_Dialog.class differ diff --git a/bin/com/connor/jk/plm/transfer/transfer_Handler.class b/bin/com/connor/jk/plm/transfer/transfer_Handler.class new file mode 100644 index 0000000..945f700 Binary files /dev/null and b/bin/com/connor/jk/plm/transfer/transfer_Handler.class differ diff --git a/bin/com/connor/jk/plm/transfer/transfer_Operation.class b/bin/com/connor/jk/plm/transfer/transfer_Operation.class new file mode 100644 index 0000000..8153d2a Binary files /dev/null and b/bin/com/connor/jk/plm/transfer/transfer_Operation.class differ diff --git a/bin/com/connor/jk/plm/util/JkomMethodUtil.class b/bin/com/connor/jk/plm/util/JkomMethodUtil.class new file mode 100644 index 0000000..f319632 Binary files /dev/null and b/bin/com/connor/jk/plm/util/JkomMethodUtil.class differ diff --git a/bin/com/connor/jk/plm/util/JkomStaticFinal.class b/bin/com/connor/jk/plm/util/JkomStaticFinal.class new file mode 100644 index 0000000..3681884 Binary files /dev/null and b/bin/com/connor/jk/plm/util/JkomStaticFinal.class differ diff --git a/bin/com/connor/jk/plm/view/MaterialStorageAction.class b/bin/com/connor/jk/plm/view/MaterialStorageAction.class new file mode 100644 index 0000000..c6b8c89 Binary files /dev/null and b/bin/com/connor/jk/plm/view/MaterialStorageAction.class differ diff --git a/bin/com/connor/jk/plm/view/MaterialStorageBean.class b/bin/com/connor/jk/plm/view/MaterialStorageBean.class new file mode 100644 index 0000000..7c622dc Binary files /dev/null and b/bin/com/connor/jk/plm/view/MaterialStorageBean.class differ diff --git a/bin/com/connor/jk/plm/view/MaterialStorageDialog$1.class b/bin/com/connor/jk/plm/view/MaterialStorageDialog$1.class new file mode 100644 index 0000000..baa3c9d Binary files /dev/null and b/bin/com/connor/jk/plm/view/MaterialStorageDialog$1.class differ diff --git a/bin/com/connor/jk/plm/view/MaterialStorageDialog$2.class b/bin/com/connor/jk/plm/view/MaterialStorageDialog$2.class new file mode 100644 index 0000000..5062bf1 Binary files /dev/null and b/bin/com/connor/jk/plm/view/MaterialStorageDialog$2.class differ diff --git a/bin/com/connor/jk/plm/view/MaterialStorageDialog.class b/bin/com/connor/jk/plm/view/MaterialStorageDialog.class new file mode 100644 index 0000000..1284b1b Binary files /dev/null and b/bin/com/connor/jk/plm/view/MaterialStorageDialog.class differ diff --git a/bin/com/connor/jk/plm/view/MaterielStorageHandler.class b/bin/com/connor/jk/plm/view/MaterielStorageHandler.class new file mode 100644 index 0000000..1e49922 Binary files /dev/null and b/bin/com/connor/jk/plm/view/MaterielStorageHandler.class differ diff --git a/bin/com/connor/jk/plm/view/Operation.class b/bin/com/connor/jk/plm/view/Operation.class new file mode 100644 index 0000000..9017335 Binary files /dev/null and b/bin/com/connor/jk/plm/view/Operation.class differ diff --git a/bin/com/connor/jk/plm/view/Operation2.class b/bin/com/connor/jk/plm/view/Operation2.class new file mode 100644 index 0000000..c69e78d Binary files /dev/null and b/bin/com/connor/jk/plm/view/Operation2.class differ diff --git a/bin/com/connor/jk/plm/view/ProgressBar$1.class b/bin/com/connor/jk/plm/view/ProgressBar$1.class new file mode 100644 index 0000000..c040a59 Binary files /dev/null and b/bin/com/connor/jk/plm/view/ProgressBar$1.class differ diff --git a/bin/com/connor/jk/plm/view/ProgressBar$TaskThread.class b/bin/com/connor/jk/plm/view/ProgressBar$TaskThread.class new file mode 100644 index 0000000..87a2f07 Binary files /dev/null and b/bin/com/connor/jk/plm/view/ProgressBar$TaskThread.class differ diff --git a/bin/com/connor/jk/plm/view/ProgressBar.class b/bin/com/connor/jk/plm/view/ProgressBar.class new file mode 100644 index 0000000..ad435db Binary files /dev/null and b/bin/com/connor/jk/plm/view/ProgressBar.class differ diff --git a/bin/com/connor/jk/plm/view/ProgressBarThread.class b/bin/com/connor/jk/plm/view/ProgressBarThread.class new file mode 100644 index 0000000..ac58644 Binary files /dev/null and b/bin/com/connor/jk/plm/view/ProgressBarThread.class differ diff --git a/bin/com/connor/jk/plm/view/ProjectCostAction.class b/bin/com/connor/jk/plm/view/ProjectCostAction.class new file mode 100644 index 0000000..f793af7 Binary files /dev/null and b/bin/com/connor/jk/plm/view/ProjectCostAction.class differ diff --git a/bin/com/connor/jk/plm/view/ProjectCostBean.class b/bin/com/connor/jk/plm/view/ProjectCostBean.class new file mode 100644 index 0000000..0931de6 Binary files /dev/null and b/bin/com/connor/jk/plm/view/ProjectCostBean.class differ diff --git a/bin/com/connor/jk/plm/view/ProjectCostDialog$1.class b/bin/com/connor/jk/plm/view/ProjectCostDialog$1.class new file mode 100644 index 0000000..f3e6c02 Binary files /dev/null and b/bin/com/connor/jk/plm/view/ProjectCostDialog$1.class differ diff --git a/bin/com/connor/jk/plm/view/ProjectCostDialog.class b/bin/com/connor/jk/plm/view/ProjectCostDialog.class new file mode 100644 index 0000000..1c8aaac Binary files /dev/null and b/bin/com/connor/jk/plm/view/ProjectCostDialog.class differ diff --git a/bin/com/connor/jk/plm/view/ProjectCostHandler.class b/bin/com/connor/jk/plm/view/ProjectCostHandler.class new file mode 100644 index 0000000..4c517e0 Binary files /dev/null and b/bin/com/connor/jk/plm/view/ProjectCostHandler.class differ diff --git a/bin/com/connor/jk/plm/view/ProjectCostTableComboxRender.class b/bin/com/connor/jk/plm/view/ProjectCostTableComboxRender.class new file mode 100644 index 0000000..56bb9ad Binary files /dev/null and b/bin/com/connor/jk/plm/view/ProjectCostTableComboxRender.class differ diff --git a/bin/com/connor/jk/plm/view/PurchasingCycleHandler.class b/bin/com/connor/jk/plm/view/PurchasingCycleHandler.class new file mode 100644 index 0000000..0b580bf Binary files /dev/null and b/bin/com/connor/jk/plm/view/PurchasingCycleHandler.class differ diff --git a/bin/com/connor/jk/plm/view/SearchUtil.class b/bin/com/connor/jk/plm/view/SearchUtil.class new file mode 100644 index 0000000..940064d Binary files /dev/null and b/bin/com/connor/jk/plm/view/SearchUtil.class differ diff --git a/bin/com/connor/jk/plm/view/SqlUtil.class b/bin/com/connor/jk/plm/view/SqlUtil.class new file mode 100644 index 0000000..266fd82 Binary files /dev/null and b/bin/com/connor/jk/plm/view/SqlUtil.class differ diff --git a/bin/com/connor/jk/plm/view/TableComboxRender.class b/bin/com/connor/jk/plm/view/TableComboxRender.class new file mode 100644 index 0000000..53c51dd Binary files /dev/null and b/bin/com/connor/jk/plm/view/TableComboxRender.class differ diff --git a/bin/com/connor/jk/plm/view/Util.class b/bin/com/connor/jk/plm/view/Util.class new file mode 100644 index 0000000..a92bb5a Binary files /dev/null and b/bin/com/connor/jk/plm/view/Util.class differ diff --git a/bin/com/connor/jk/plm/view/database.properties b/bin/com/connor/jk/plm/view/database.properties new file mode 100644 index 0000000..dd28fdf --- /dev/null +++ b/bin/com/connor/jk/plm/view/database.properties @@ -0,0 +1,20 @@ + +#ORACEL_NAME=tc +# +#ORACEL_PASSWORD=Tc123456 +# +##ORACEL_URL=jdbc:oracle:thin:@192.168.1.248:1521:TOPPROD +# +#ORACEL_URL=jdbc:microsoft:sqlserver://10.200.1.33:1433;DatabaseName=ecology +# +#ORACEL_DRIVER=com.microsoft.jdbc.sqlserver.SQLServerDriver + +ORACEL_NAME=sa + +ORACEL_PASSWORD=Gold123card + +#ORACEL_URL=jdbc:oracle:thin:@192.168.1.248:1521:TOPPROD + +ORACEL_URL=jdbc:microsoft:sqlserver://10.200.1.33:1433;DatabaseName=UFDATA_110_2014 + +ORACEL_DRIVER=com.microsoft.jdbc.sqlserver.SQLServerDriver \ No newline at end of file diff --git a/bin/com/connor/jk/plm/waterMeter/DataBaseControl.class b/bin/com/connor/jk/plm/waterMeter/DataBaseControl.class new file mode 100644 index 0000000..4b70cc9 Binary files /dev/null and b/bin/com/connor/jk/plm/waterMeter/DataBaseControl.class differ diff --git a/bin/com/connor/jk/plm/waterMeter/GenerateWater_Action.class b/bin/com/connor/jk/plm/waterMeter/GenerateWater_Action.class new file mode 100644 index 0000000..27d8ffd Binary files /dev/null and b/bin/com/connor/jk/plm/waterMeter/GenerateWater_Action.class differ diff --git a/bin/com/connor/jk/plm/waterMeter/GenerateWater_Handler.class b/bin/com/connor/jk/plm/waterMeter/GenerateWater_Handler.class new file mode 100644 index 0000000..00e2c6f Binary files /dev/null and b/bin/com/connor/jk/plm/waterMeter/GenerateWater_Handler.class differ diff --git a/bin/com/connor/jk/plm/waterMeter/GenerateWater_Operation.class b/bin/com/connor/jk/plm/waterMeter/GenerateWater_Operation.class new file mode 100644 index 0000000..ee7a045 Binary files /dev/null and b/bin/com/connor/jk/plm/waterMeter/GenerateWater_Operation.class differ diff --git a/bin/com/connor/jk/plm/waterMeter/GenerateWater_Operation_old.class b/bin/com/connor/jk/plm/waterMeter/GenerateWater_Operation_old.class new file mode 100644 index 0000000..0dfaefa Binary files /dev/null and b/bin/com/connor/jk/plm/waterMeter/GenerateWater_Operation_old.class differ diff --git a/bin/com/connor/jk/plm/waterMeter/JK8DWPIdenNOAppForm_Handler.class b/bin/com/connor/jk/plm/waterMeter/JK8DWPIdenNOAppForm_Handler.class new file mode 100644 index 0000000..c792aac Binary files /dev/null and b/bin/com/connor/jk/plm/waterMeter/JK8DWPIdenNOAppForm_Handler.class differ diff --git a/bin/com/connor/jk/plm/waterMeter/JK8NWPIdenNOAppForm_Handler.class b/bin/com/connor/jk/plm/waterMeter/JK8NWPIdenNOAppForm_Handler.class new file mode 100644 index 0000000..c36dbe7 Binary files /dev/null and b/bin/com/connor/jk/plm/waterMeter/JK8NWPIdenNOAppForm_Handler.class differ diff --git a/bin/com/connor/jk/plm/waterMeter/JK8WSpecPINOAppForm_Handler.class b/bin/com/connor/jk/plm/waterMeter/JK8WSpecPINOAppForm_Handler.class new file mode 100644 index 0000000..00cae5f Binary files /dev/null and b/bin/com/connor/jk/plm/waterMeter/JK8WSpecPINOAppForm_Handler.class differ diff --git a/bin/com/connor/jk/plm/waterMeter/JK8WaterPModAppForm_Handler.class b/bin/com/connor/jk/plm/waterMeter/JK8WaterPModAppForm_Handler.class new file mode 100644 index 0000000..5832511 Binary files /dev/null and b/bin/com/connor/jk/plm/waterMeter/JK8WaterPModAppForm_Handler.class differ diff --git a/bin/com/connor/jk/plm/waterMeter/JK8_water_Action.class b/bin/com/connor/jk/plm/waterMeter/JK8_water_Action.class new file mode 100644 index 0000000..f03d2fe Binary files /dev/null and b/bin/com/connor/jk/plm/waterMeter/JK8_water_Action.class differ diff --git a/bin/com/connor/jk/plm/waterMeter/JK8_water_Command.class b/bin/com/connor/jk/plm/waterMeter/JK8_water_Command.class new file mode 100644 index 0000000..35f85dc Binary files /dev/null and b/bin/com/connor/jk/plm/waterMeter/JK8_water_Command.class differ diff --git a/bin/com/connor/jk/plm/waterMeter/JK8_water_Operation.class b/bin/com/connor/jk/plm/waterMeter/JK8_water_Operation.class new file mode 100644 index 0000000..9efe5be Binary files /dev/null and b/bin/com/connor/jk/plm/waterMeter/JK8_water_Operation.class differ diff --git a/bin/com/connor/jk/plm/xmkb/ExportXMKB_Dialog$1.class b/bin/com/connor/jk/plm/xmkb/ExportXMKB_Dialog$1.class new file mode 100644 index 0000000..9b45c69 Binary files /dev/null and b/bin/com/connor/jk/plm/xmkb/ExportXMKB_Dialog$1.class differ diff --git a/bin/com/connor/jk/plm/xmkb/ExportXMKB_Dialog$2.class b/bin/com/connor/jk/plm/xmkb/ExportXMKB_Dialog$2.class new file mode 100644 index 0000000..2fb7a55 Binary files /dev/null and b/bin/com/connor/jk/plm/xmkb/ExportXMKB_Dialog$2.class differ diff --git a/bin/com/connor/jk/plm/xmkb/ExportXMKB_Dialog$3.class b/bin/com/connor/jk/plm/xmkb/ExportXMKB_Dialog$3.class new file mode 100644 index 0000000..fa491bd Binary files /dev/null and b/bin/com/connor/jk/plm/xmkb/ExportXMKB_Dialog$3.class differ diff --git a/bin/com/connor/jk/plm/xmkb/ExportXMKB_Dialog.class b/bin/com/connor/jk/plm/xmkb/ExportXMKB_Dialog.class new file mode 100644 index 0000000..c8e1cab Binary files /dev/null and b/bin/com/connor/jk/plm/xmkb/ExportXMKB_Dialog.class differ diff --git a/bin/com/connor/jk/plm/xmkb/ExportXMKB_Handler.class b/bin/com/connor/jk/plm/xmkb/ExportXMKB_Handler.class new file mode 100644 index 0000000..aa3f026 Binary files /dev/null and b/bin/com/connor/jk/plm/xmkb/ExportXMKB_Handler.class differ diff --git a/bin/com/connor/jk/plm/xmkb/ExportXMKB_Operation.class b/bin/com/connor/jk/plm/xmkb/ExportXMKB_Operation.class new file mode 100644 index 0000000..26aa1ec Binary files /dev/null and b/bin/com/connor/jk/plm/xmkb/ExportXMKB_Operation.class differ diff --git a/bin/com/teamcenter/rac/commands/cut/CutOperation.class b/bin/com/teamcenter/rac/commands/cut/CutOperation.class new file mode 100644 index 0000000..b461f7d Binary files /dev/null and b/bin/com/teamcenter/rac/commands/cut/CutOperation.class differ diff --git a/bin/com/teamcenter/rac/commands/cut/cut_user.properties b/bin/com/teamcenter/rac/commands/cut/cut_user.properties new file mode 100644 index 0000000..cec9003 --- /dev/null +++ b/bin/com/teamcenter/rac/commands/cut/cut_user.properties @@ -0,0 +1,2 @@ +cutOperation=com.connor.jk.plm.cut.JKCutOperation +\u8BE5\u6269\u5C55\u70B9\u5E76\u6CA1\u6709 \ No newline at end of file diff --git a/bin/com/teamcenter/rac/commands/paste/paste_user.properties b/bin/com/teamcenter/rac/commands/paste/paste_user.properties new file mode 100644 index 0000000..e0cf5b4 --- /dev/null +++ b/bin/com/teamcenter/rac/commands/paste/paste_user.properties @@ -0,0 +1,2 @@ +#import=com.teamcenter.rac.common.common,com.teamcenter.rac.kernel.kernel +pasteOperation=com.connor.jk.plm.paste.JKPasteOperation \ No newline at end of file diff --git a/bin/com/teamcenter/rac/commands/revise/ReviseCommand.class b/bin/com/teamcenter/rac/commands/revise/ReviseCommand.class new file mode 100644 index 0000000..7edfc38 Binary files /dev/null and b/bin/com/teamcenter/rac/commands/revise/ReviseCommand.class differ diff --git a/bin/com/teamcenter/rac/form/CalendarPanel$1.class b/bin/com/teamcenter/rac/form/CalendarPanel$1.class new file mode 100644 index 0000000..31cde95 Binary files /dev/null and b/bin/com/teamcenter/rac/form/CalendarPanel$1.class differ diff --git a/bin/com/teamcenter/rac/form/CalendarPanel$2.class b/bin/com/teamcenter/rac/form/CalendarPanel$2.class new file mode 100644 index 0000000..248f875 Binary files /dev/null and b/bin/com/teamcenter/rac/form/CalendarPanel$2.class differ diff --git a/bin/com/teamcenter/rac/form/CalendarPanel$3.class b/bin/com/teamcenter/rac/form/CalendarPanel$3.class new file mode 100644 index 0000000..ab0d0ea Binary files /dev/null and b/bin/com/teamcenter/rac/form/CalendarPanel$3.class differ diff --git a/bin/com/teamcenter/rac/form/CalendarPanel$4.class b/bin/com/teamcenter/rac/form/CalendarPanel$4.class new file mode 100644 index 0000000..f81cff2 Binary files /dev/null and b/bin/com/teamcenter/rac/form/CalendarPanel$4.class differ diff --git a/bin/com/teamcenter/rac/form/CalendarPanel$5.class b/bin/com/teamcenter/rac/form/CalendarPanel$5.class new file mode 100644 index 0000000..ee7930b Binary files /dev/null and b/bin/com/teamcenter/rac/form/CalendarPanel$5.class differ diff --git a/bin/com/teamcenter/rac/form/CalendarPanel$6.class b/bin/com/teamcenter/rac/form/CalendarPanel$6.class new file mode 100644 index 0000000..0a71f52 Binary files /dev/null and b/bin/com/teamcenter/rac/form/CalendarPanel$6.class differ diff --git a/bin/com/teamcenter/rac/form/CalendarPanel$7.class b/bin/com/teamcenter/rac/form/CalendarPanel$7.class new file mode 100644 index 0000000..8ca5e64 Binary files /dev/null and b/bin/com/teamcenter/rac/form/CalendarPanel$7.class differ diff --git a/bin/com/teamcenter/rac/form/CalendarPanel.class b/bin/com/teamcenter/rac/form/CalendarPanel.class new file mode 100644 index 0000000..ca3a15b Binary files /dev/null and b/bin/com/teamcenter/rac/form/CalendarPanel.class differ diff --git a/bin/com/teamcenter/rac/form/ConnorForm.class b/bin/com/teamcenter/rac/form/ConnorForm.class new file mode 100644 index 0000000..69b6b36 Binary files /dev/null and b/bin/com/teamcenter/rac/form/ConnorForm.class differ diff --git a/bin/com/teamcenter/rac/form/DefaultTableCellRenderer2.class b/bin/com/teamcenter/rac/form/DefaultTableCellRenderer2.class new file mode 100644 index 0000000..c322465 Binary files /dev/null and b/bin/com/teamcenter/rac/form/DefaultTableCellRenderer2.class differ diff --git a/bin/com/teamcenter/rac/form/FormPropBean.class b/bin/com/teamcenter/rac/form/FormPropBean.class new file mode 100644 index 0000000..328c3d3 Binary files /dev/null and b/bin/com/teamcenter/rac/form/FormPropBean.class differ diff --git a/bin/com/teamcenter/rac/form/JAutoCompleteComboBox$AutoCompleter$1.class b/bin/com/teamcenter/rac/form/JAutoCompleteComboBox$AutoCompleter$1.class new file mode 100644 index 0000000..578e678 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JAutoCompleteComboBox$AutoCompleter$1.class differ diff --git a/bin/com/teamcenter/rac/form/JAutoCompleteComboBox$AutoCompleter.class b/bin/com/teamcenter/rac/form/JAutoCompleteComboBox$AutoCompleter.class new file mode 100644 index 0000000..50eb14a Binary files /dev/null and b/bin/com/teamcenter/rac/form/JAutoCompleteComboBox$AutoCompleter.class differ diff --git a/bin/com/teamcenter/rac/form/JAutoCompleteComboBox.class b/bin/com/teamcenter/rac/form/JAutoCompleteComboBox.class new file mode 100644 index 0000000..a96025a Binary files /dev/null and b/bin/com/teamcenter/rac/form/JAutoCompleteComboBox.class differ diff --git a/bin/com/teamcenter/rac/form/JK3_XCPXHFormPropBean.class b/bin/com/teamcenter/rac/form/JK3_XCPXHFormPropBean.class new file mode 100644 index 0000000..70c198a Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK3_XCPXHFormPropBean.class differ diff --git a/bin/com/teamcenter/rac/form/JK8DerPCBNOAppForm$1.class b/bin/com/teamcenter/rac/form/JK8DerPCBNOAppForm$1.class new file mode 100644 index 0000000..ceeb02b Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8DerPCBNOAppForm$1.class differ diff --git a/bin/com/teamcenter/rac/form/JK8DerPCBNOAppForm$2.class b/bin/com/teamcenter/rac/form/JK8DerPCBNOAppForm$2.class new file mode 100644 index 0000000..ee6fe28 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8DerPCBNOAppForm$2.class differ diff --git a/bin/com/teamcenter/rac/form/JK8DerPCBNOAppForm.class b/bin/com/teamcenter/rac/form/JK8DerPCBNOAppForm.class new file mode 100644 index 0000000..4c827b9 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8DerPCBNOAppForm.class differ diff --git a/bin/com/teamcenter/rac/form/JK8MaterialRevisionMasterForm$1.class b/bin/com/teamcenter/rac/form/JK8MaterialRevisionMasterForm$1.class new file mode 100644 index 0000000..61d6292 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8MaterialRevisionMasterForm$1.class differ diff --git a/bin/com/teamcenter/rac/form/JK8MaterialRevisionMasterForm$10.class b/bin/com/teamcenter/rac/form/JK8MaterialRevisionMasterForm$10.class new file mode 100644 index 0000000..4a12087 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8MaterialRevisionMasterForm$10.class differ diff --git a/bin/com/teamcenter/rac/form/JK8MaterialRevisionMasterForm$11.class b/bin/com/teamcenter/rac/form/JK8MaterialRevisionMasterForm$11.class new file mode 100644 index 0000000..7456bff Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8MaterialRevisionMasterForm$11.class differ diff --git a/bin/com/teamcenter/rac/form/JK8MaterialRevisionMasterForm$12.class b/bin/com/teamcenter/rac/form/JK8MaterialRevisionMasterForm$12.class new file mode 100644 index 0000000..dd5cefe Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8MaterialRevisionMasterForm$12.class differ diff --git a/bin/com/teamcenter/rac/form/JK8MaterialRevisionMasterForm$2.class b/bin/com/teamcenter/rac/form/JK8MaterialRevisionMasterForm$2.class new file mode 100644 index 0000000..688124e Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8MaterialRevisionMasterForm$2.class differ diff --git a/bin/com/teamcenter/rac/form/JK8MaterialRevisionMasterForm$3.class b/bin/com/teamcenter/rac/form/JK8MaterialRevisionMasterForm$3.class new file mode 100644 index 0000000..f608509 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8MaterialRevisionMasterForm$3.class differ diff --git a/bin/com/teamcenter/rac/form/JK8MaterialRevisionMasterForm$4.class b/bin/com/teamcenter/rac/form/JK8MaterialRevisionMasterForm$4.class new file mode 100644 index 0000000..e4d7535 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8MaterialRevisionMasterForm$4.class differ diff --git a/bin/com/teamcenter/rac/form/JK8MaterialRevisionMasterForm$5.class b/bin/com/teamcenter/rac/form/JK8MaterialRevisionMasterForm$5.class new file mode 100644 index 0000000..69a7fae Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8MaterialRevisionMasterForm$5.class differ diff --git a/bin/com/teamcenter/rac/form/JK8MaterialRevisionMasterForm$6.class b/bin/com/teamcenter/rac/form/JK8MaterialRevisionMasterForm$6.class new file mode 100644 index 0000000..27a0dbd Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8MaterialRevisionMasterForm$6.class differ diff --git a/bin/com/teamcenter/rac/form/JK8MaterialRevisionMasterForm$7.class b/bin/com/teamcenter/rac/form/JK8MaterialRevisionMasterForm$7.class new file mode 100644 index 0000000..e7bed2c Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8MaterialRevisionMasterForm$7.class differ diff --git a/bin/com/teamcenter/rac/form/JK8MaterialRevisionMasterForm$8.class b/bin/com/teamcenter/rac/form/JK8MaterialRevisionMasterForm$8.class new file mode 100644 index 0000000..91b74c6 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8MaterialRevisionMasterForm$8.class differ diff --git a/bin/com/teamcenter/rac/form/JK8MaterialRevisionMasterForm$9.class b/bin/com/teamcenter/rac/form/JK8MaterialRevisionMasterForm$9.class new file mode 100644 index 0000000..3a54803 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8MaterialRevisionMasterForm$9.class differ diff --git a/bin/com/teamcenter/rac/form/JK8MaterialRevisionMasterForm.class b/bin/com/teamcenter/rac/form/JK8MaterialRevisionMasterForm.class new file mode 100644 index 0000000..fe62907 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8MaterialRevisionMasterForm.class differ diff --git a/bin/com/teamcenter/rac/form/JK8PCBNOAppForm$1.class b/bin/com/teamcenter/rac/form/JK8PCBNOAppForm$1.class new file mode 100644 index 0000000..16c4e3c Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8PCBNOAppForm$1.class differ diff --git a/bin/com/teamcenter/rac/form/JK8PCBNOAppForm.class b/bin/com/teamcenter/rac/form/JK8PCBNOAppForm.class new file mode 100644 index 0000000..69a1ccb Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8PCBNOAppForm.class differ diff --git a/bin/com/teamcenter/rac/form/JK8PCBNORegForm$1.class b/bin/com/teamcenter/rac/form/JK8PCBNORegForm$1.class new file mode 100644 index 0000000..29dd713 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8PCBNORegForm$1.class differ diff --git a/bin/com/teamcenter/rac/form/JK8PCBNORegForm$2.class b/bin/com/teamcenter/rac/form/JK8PCBNORegForm$2.class new file mode 100644 index 0000000..c9cae45 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8PCBNORegForm$2.class differ diff --git a/bin/com/teamcenter/rac/form/JK8PCBNORegForm.class b/bin/com/teamcenter/rac/form/JK8PCBNORegForm.class new file mode 100644 index 0000000..7bc83f4 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8PCBNORegForm.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_ALARM_DERIVATIVES_SBH_Form$1.class b/bin/com/teamcenter/rac/form/JK8_ALARM_DERIVATIVES_SBH_Form$1.class new file mode 100644 index 0000000..930bec3 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_ALARM_DERIVATIVES_SBH_Form$1.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_ALARM_DERIVATIVES_SBH_Form$2.class b/bin/com/teamcenter/rac/form/JK8_ALARM_DERIVATIVES_SBH_Form$2.class new file mode 100644 index 0000000..0d1099c Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_ALARM_DERIVATIVES_SBH_Form$2.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_ALARM_DERIVATIVES_SBH_Form.class b/bin/com/teamcenter/rac/form/JK8_ALARM_DERIVATIVES_SBH_Form.class new file mode 100644 index 0000000..9e3866a Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_ALARM_DERIVATIVES_SBH_Form.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_ALARM_PRODUCT_MODEL_Form$1.class b/bin/com/teamcenter/rac/form/JK8_ALARM_PRODUCT_MODEL_Form$1.class new file mode 100644 index 0000000..8edb5e2 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_ALARM_PRODUCT_MODEL_Form$1.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_ALARM_PRODUCT_MODEL_Form.class b/bin/com/teamcenter/rac/form/JK8_ALARM_PRODUCT_MODEL_Form.class new file mode 100644 index 0000000..c0ffb96 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_ALARM_PRODUCT_MODEL_Form.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_ALARM_SBH_Form$1.class b/bin/com/teamcenter/rac/form/JK8_ALARM_SBH_Form$1.class new file mode 100644 index 0000000..d42fb49 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_ALARM_SBH_Form$1.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_ALARM_SBH_Form$2.class b/bin/com/teamcenter/rac/form/JK8_ALARM_SBH_Form$2.class new file mode 100644 index 0000000..265fce1 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_ALARM_SBH_Form$2.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_ALARM_SBH_Form.class b/bin/com/teamcenter/rac/form/JK8_ALARM_SBH_Form.class new file mode 100644 index 0000000..e8bfb64 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_ALARM_SBH_Form.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_ALARM_SPECIAL_SBH_Form$1.class b/bin/com/teamcenter/rac/form/JK8_ALARM_SPECIAL_SBH_Form$1.class new file mode 100644 index 0000000..20f3cb2 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_ALARM_SPECIAL_SBH_Form$1.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_ALARM_SPECIAL_SBH_Form$2.class b/bin/com/teamcenter/rac/form/JK8_ALARM_SPECIAL_SBH_Form$2.class new file mode 100644 index 0000000..36490de Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_ALARM_SPECIAL_SBH_Form$2.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_ALARM_SPECIAL_SBH_Form.class b/bin/com/teamcenter/rac/form/JK8_ALARM_SPECIAL_SBH_Form.class new file mode 100644 index 0000000..dfd70d4 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_ALARM_SPECIAL_SBH_Form.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_ALARM_SUMMARY_Form$1.class b/bin/com/teamcenter/rac/form/JK8_ALARM_SUMMARY_Form$1.class new file mode 100644 index 0000000..8fb46b9 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_ALARM_SUMMARY_Form$1.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_ALARM_SUMMARY_Form$2.class b/bin/com/teamcenter/rac/form/JK8_ALARM_SUMMARY_Form$2.class new file mode 100644 index 0000000..fa732d2 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_ALARM_SUMMARY_Form$2.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_ALARM_SUMMARY_Form.class b/bin/com/teamcenter/rac/form/JK8_ALARM_SUMMARY_Form.class new file mode 100644 index 0000000..de90bb9 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_ALARM_SUMMARY_Form.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_CJQ_Form$1.class b/bin/com/teamcenter/rac/form/JK8_CJQ_Form$1.class new file mode 100644 index 0000000..821976f Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_CJQ_Form$1.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_CJQ_Form$2.class b/bin/com/teamcenter/rac/form/JK8_CJQ_Form$2.class new file mode 100644 index 0000000..8c752ee Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_CJQ_Form$2.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_CJQ_Form$3.class b/bin/com/teamcenter/rac/form/JK8_CJQ_Form$3.class new file mode 100644 index 0000000..36ee9c1 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_CJQ_Form$3.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_CJQ_Form$4.class b/bin/com/teamcenter/rac/form/JK8_CJQ_Form$4.class new file mode 100644 index 0000000..0c7dc9e Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_CJQ_Form$4.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_CJQ_Form.class b/bin/com/teamcenter/rac/form/JK8_CJQ_Form.class new file mode 100644 index 0000000..d99e74d Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_CJQ_Form.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_CPXH_Form$1.class b/bin/com/teamcenter/rac/form/JK8_CPXH_Form$1.class new file mode 100644 index 0000000..2e5c00d Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_CPXH_Form$1.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_CPXH_Form$2.class b/bin/com/teamcenter/rac/form/JK8_CPXH_Form$2.class new file mode 100644 index 0000000..dc5e2b4 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_CPXH_Form$2.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_CPXH_Form$3.class b/bin/com/teamcenter/rac/form/JK8_CPXH_Form$3.class new file mode 100644 index 0000000..64ff3bd Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_CPXH_Form$3.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_CPXH_Form$4.class b/bin/com/teamcenter/rac/form/JK8_CPXH_Form$4.class new file mode 100644 index 0000000..0b1c683 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_CPXH_Form$4.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_CPXH_Form$5.class b/bin/com/teamcenter/rac/form/JK8_CPXH_Form$5.class new file mode 100644 index 0000000..bb71101 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_CPXH_Form$5.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_CPXH_Form.class b/bin/com/teamcenter/rac/form/JK8_CPXH_Form.class new file mode 100644 index 0000000..0f9ff85 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_CPXH_Form.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_ColPIdenNOAppForm$1.class b/bin/com/teamcenter/rac/form/JK8_ColPIdenNOAppForm$1.class new file mode 100644 index 0000000..a7143e3 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_ColPIdenNOAppForm$1.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_ColPIdenNOAppForm$2.class b/bin/com/teamcenter/rac/form/JK8_ColPIdenNOAppForm$2.class new file mode 100644 index 0000000..4a2d676 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_ColPIdenNOAppForm$2.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_ColPIdenNOAppForm.class b/bin/com/teamcenter/rac/form/JK8_ColPIdenNOAppForm.class new file mode 100644 index 0000000..9bf7ef4 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_ColPIdenNOAppForm.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_CotlerPModApp_Form$1.class b/bin/com/teamcenter/rac/form/JK8_CotlerPModApp_Form$1.class new file mode 100644 index 0000000..85cd864 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_CotlerPModApp_Form$1.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_CotlerPModApp_Form.class b/bin/com/teamcenter/rac/form/JK8_CotlerPModApp_Form.class new file mode 100644 index 0000000..8453ffd Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_CotlerPModApp_Form.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_FXGL_Form$1.class b/bin/com/teamcenter/rac/form/JK8_FXGL_Form$1.class new file mode 100644 index 0000000..05c70f2 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_FXGL_Form$1.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_FXGL_Form$2.class b/bin/com/teamcenter/rac/form/JK8_FXGL_Form$2.class new file mode 100644 index 0000000..539df00 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_FXGL_Form$2.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_FXGL_Form.class b/bin/com/teamcenter/rac/form/JK8_FXGL_Form.class new file mode 100644 index 0000000..7c956b7 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_FXGL_Form.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_JSPSFormStyleSheet$1.class b/bin/com/teamcenter/rac/form/JK8_JSPSFormStyleSheet$1.class new file mode 100644 index 0000000..f9b61bd Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_JSPSFormStyleSheet$1.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_JSPSFormStyleSheet$2.class b/bin/com/teamcenter/rac/form/JK8_JSPSFormStyleSheet$2.class new file mode 100644 index 0000000..8071781 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_JSPSFormStyleSheet$2.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_JSPSFormStyleSheet$3.class b/bin/com/teamcenter/rac/form/JK8_JSPSFormStyleSheet$3.class new file mode 100644 index 0000000..080a40e Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_JSPSFormStyleSheet$3.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_JSPSFormStyleSheet$4.class b/bin/com/teamcenter/rac/form/JK8_JSPSFormStyleSheet$4.class new file mode 100644 index 0000000..dbf59dd Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_JSPSFormStyleSheet$4.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_JSPSFormStyleSheet$5.class b/bin/com/teamcenter/rac/form/JK8_JSPSFormStyleSheet$5.class new file mode 100644 index 0000000..63a9dd0 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_JSPSFormStyleSheet$5.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_JSPSFormStyleSheet$6$1.class b/bin/com/teamcenter/rac/form/JK8_JSPSFormStyleSheet$6$1.class new file mode 100644 index 0000000..32b262e Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_JSPSFormStyleSheet$6$1.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_JSPSFormStyleSheet$6.class b/bin/com/teamcenter/rac/form/JK8_JSPSFormStyleSheet$6.class new file mode 100644 index 0000000..0fe64be Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_JSPSFormStyleSheet$6.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_JSPSFormStyleSheet$TableCellTextAreaRenderer.class b/bin/com/teamcenter/rac/form/JK8_JSPSFormStyleSheet$TableCellTextAreaRenderer.class new file mode 100644 index 0000000..9045bf6 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_JSPSFormStyleSheet$TableCellTextAreaRenderer.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_JSPSFormStyleSheet.class b/bin/com/teamcenter/rac/form/JK8_JSPSFormStyleSheet.class new file mode 100644 index 0000000..a2fb46a Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_JSPSFormStyleSheet.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_JSPSPropBean.class b/bin/com/teamcenter/rac/form/JK8_JSPSPropBean.class new file mode 100644 index 0000000..2a3a1c5 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_JSPSPropBean.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_JSPS_Form$1.class b/bin/com/teamcenter/rac/form/JK8_JSPS_Form$1.class new file mode 100644 index 0000000..100f82a Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_JSPS_Form$1.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_JSPS_Form$2.class b/bin/com/teamcenter/rac/form/JK8_JSPS_Form$2.class new file mode 100644 index 0000000..ab66504 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_JSPS_Form$2.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_JSPS_Form$3.class b/bin/com/teamcenter/rac/form/JK8_JSPS_Form$3.class new file mode 100644 index 0000000..b0fae84 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_JSPS_Form$3.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_JSPS_Form$4.class b/bin/com/teamcenter/rac/form/JK8_JSPS_Form$4.class new file mode 100644 index 0000000..283dbc1 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_JSPS_Form$4.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_JSPS_Form.class b/bin/com/teamcenter/rac/form/JK8_JSPS_Form.class new file mode 100644 index 0000000..04bc90f Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_JSPS_Form.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_PCB_PropBean.class b/bin/com/teamcenter/rac/form/JK8_PCB_PropBean.class new file mode 100644 index 0000000..6808b48 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_PCB_PropBean.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_SBCPXH_Form$1.class b/bin/com/teamcenter/rac/form/JK8_SBCPXH_Form$1.class new file mode 100644 index 0000000..aa58b38 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_SBCPXH_Form$1.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_SBCPXH_Form$2.class b/bin/com/teamcenter/rac/form/JK8_SBCPXH_Form$2.class new file mode 100644 index 0000000..56b38e6 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_SBCPXH_Form$2.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_SBCPXH_Form$3.class b/bin/com/teamcenter/rac/form/JK8_SBCPXH_Form$3.class new file mode 100644 index 0000000..5fafabe Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_SBCPXH_Form$3.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_SBCPXH_Form$4.class b/bin/com/teamcenter/rac/form/JK8_SBCPXH_Form$4.class new file mode 100644 index 0000000..4264e84 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_SBCPXH_Form$4.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_SBCPXH_Form$5.class b/bin/com/teamcenter/rac/form/JK8_SBCPXH_Form$5.class new file mode 100644 index 0000000..5a1c06d Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_SBCPXH_Form$5.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_SBCPXH_Form$6.class b/bin/com/teamcenter/rac/form/JK8_SBCPXH_Form$6.class new file mode 100644 index 0000000..21fad62 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_SBCPXH_Form$6.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_SBCPXH_Form$7.class b/bin/com/teamcenter/rac/form/JK8_SBCPXH_Form$7.class new file mode 100644 index 0000000..7ad1ec8 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_SBCPXH_Form$7.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_SBCPXH_Form.class b/bin/com/teamcenter/rac/form/JK8_SBCPXH_Form.class new file mode 100644 index 0000000..4427380 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_SBCPXH_Form.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_SBH_Form$1.class b/bin/com/teamcenter/rac/form/JK8_SBH_Form$1.class new file mode 100644 index 0000000..c3e39de Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_SBH_Form$1.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_SBH_Form$2.class b/bin/com/teamcenter/rac/form/JK8_SBH_Form$2.class new file mode 100644 index 0000000..305847a Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_SBH_Form$2.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_SBH_Form$3.class b/bin/com/teamcenter/rac/form/JK8_SBH_Form$3.class new file mode 100644 index 0000000..68d50a6 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_SBH_Form$3.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_SBH_Form.class b/bin/com/teamcenter/rac/form/JK8_SBH_Form.class new file mode 100644 index 0000000..fbcf99a Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_SBH_Form.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_TSSBH_Form$1.class b/bin/com/teamcenter/rac/form/JK8_TSSBH_Form$1.class new file mode 100644 index 0000000..c4662e2 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_TSSBH_Form$1.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_TSSBH_Form$2.class b/bin/com/teamcenter/rac/form/JK8_TSSBH_Form$2.class new file mode 100644 index 0000000..55e477b Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_TSSBH_Form$2.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_TSSBH_Form$3.class b/bin/com/teamcenter/rac/form/JK8_TSSBH_Form$3.class new file mode 100644 index 0000000..dfc31d4 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_TSSBH_Form$3.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_TSSBH_Form$4.class b/bin/com/teamcenter/rac/form/JK8_TSSBH_Form$4.class new file mode 100644 index 0000000..f9c7c13 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_TSSBH_Form$4.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_TSSBH_Form.class b/bin/com/teamcenter/rac/form/JK8_TSSBH_Form.class new file mode 100644 index 0000000..ce7f6bc Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_TSSBH_Form.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_WATER_DERIVATIVES_SBH_Form$1.class b/bin/com/teamcenter/rac/form/JK8_WATER_DERIVATIVES_SBH_Form$1.class new file mode 100644 index 0000000..a9e5ce7 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_WATER_DERIVATIVES_SBH_Form$1.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_WATER_DERIVATIVES_SBH_Form$2.class b/bin/com/teamcenter/rac/form/JK8_WATER_DERIVATIVES_SBH_Form$2.class new file mode 100644 index 0000000..52f4433 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_WATER_DERIVATIVES_SBH_Form$2.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_WATER_DERIVATIVES_SBH_Form.class b/bin/com/teamcenter/rac/form/JK8_WATER_DERIVATIVES_SBH_Form.class new file mode 100644 index 0000000..0589ca6 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_WATER_DERIVATIVES_SBH_Form.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_WATER_PRODUCT_MODEL_Form$1.class b/bin/com/teamcenter/rac/form/JK8_WATER_PRODUCT_MODEL_Form$1.class new file mode 100644 index 0000000..0952b24 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_WATER_PRODUCT_MODEL_Form$1.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_WATER_PRODUCT_MODEL_Form$2.class b/bin/com/teamcenter/rac/form/JK8_WATER_PRODUCT_MODEL_Form$2.class new file mode 100644 index 0000000..48cf6c2 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_WATER_PRODUCT_MODEL_Form$2.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_WATER_PRODUCT_MODEL_Form.class b/bin/com/teamcenter/rac/form/JK8_WATER_PRODUCT_MODEL_Form.class new file mode 100644 index 0000000..5beb660 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_WATER_PRODUCT_MODEL_Form.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_WATER_PRODUCT_MODEL_Form_old$1.class b/bin/com/teamcenter/rac/form/JK8_WATER_PRODUCT_MODEL_Form_old$1.class new file mode 100644 index 0000000..9c7d9b3 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_WATER_PRODUCT_MODEL_Form_old$1.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_WATER_PRODUCT_MODEL_Form_old$2.class b/bin/com/teamcenter/rac/form/JK8_WATER_PRODUCT_MODEL_Form_old$2.class new file mode 100644 index 0000000..99131e3 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_WATER_PRODUCT_MODEL_Form_old$2.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_WATER_PRODUCT_MODEL_Form_old.class b/bin/com/teamcenter/rac/form/JK8_WATER_PRODUCT_MODEL_Form_old.class new file mode 100644 index 0000000..e37bfff Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_WATER_PRODUCT_MODEL_Form_old.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_WATER_SBH_Form$1.class b/bin/com/teamcenter/rac/form/JK8_WATER_SBH_Form$1.class new file mode 100644 index 0000000..e2d03ec Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_WATER_SBH_Form$1.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_WATER_SBH_Form$2.class b/bin/com/teamcenter/rac/form/JK8_WATER_SBH_Form$2.class new file mode 100644 index 0000000..b82c27f Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_WATER_SBH_Form$2.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_WATER_SBH_Form.class b/bin/com/teamcenter/rac/form/JK8_WATER_SBH_Form.class new file mode 100644 index 0000000..997f37b Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_WATER_SBH_Form.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_WATER_SBH_SUMMARY_Form$1.class b/bin/com/teamcenter/rac/form/JK8_WATER_SBH_SUMMARY_Form$1.class new file mode 100644 index 0000000..9696795 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_WATER_SBH_SUMMARY_Form$1.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_WATER_SBH_SUMMARY_Form$2.class b/bin/com/teamcenter/rac/form/JK8_WATER_SBH_SUMMARY_Form$2.class new file mode 100644 index 0000000..997232e Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_WATER_SBH_SUMMARY_Form$2.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_WATER_SBH_SUMMARY_Form.class b/bin/com/teamcenter/rac/form/JK8_WATER_SBH_SUMMARY_Form.class new file mode 100644 index 0000000..830b486 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_WATER_SBH_SUMMARY_Form.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_WATER_SBH_SUMMARY_Form_old$1.class b/bin/com/teamcenter/rac/form/JK8_WATER_SBH_SUMMARY_Form_old$1.class new file mode 100644 index 0000000..24530eb Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_WATER_SBH_SUMMARY_Form_old$1.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_WATER_SBH_SUMMARY_Form_old$2.class b/bin/com/teamcenter/rac/form/JK8_WATER_SBH_SUMMARY_Form_old$2.class new file mode 100644 index 0000000..eae2b6f Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_WATER_SBH_SUMMARY_Form_old$2.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_WATER_SBH_SUMMARY_Form_old.class b/bin/com/teamcenter/rac/form/JK8_WATER_SBH_SUMMARY_Form_old.class new file mode 100644 index 0000000..46be362 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_WATER_SBH_SUMMARY_Form_old.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_WATER_SPECIAL_SBH_Form$1.class b/bin/com/teamcenter/rac/form/JK8_WATER_SPECIAL_SBH_Form$1.class new file mode 100644 index 0000000..385c789 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_WATER_SPECIAL_SBH_Form$1.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_WATER_SPECIAL_SBH_Form$2.class b/bin/com/teamcenter/rac/form/JK8_WATER_SPECIAL_SBH_Form$2.class new file mode 100644 index 0000000..3eacf05 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_WATER_SPECIAL_SBH_Form$2.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_WATER_SPECIAL_SBH_Form.class b/bin/com/teamcenter/rac/form/JK8_WATER_SPECIAL_SBH_Form.class new file mode 100644 index 0000000..2b0b1e2 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_WATER_SPECIAL_SBH_Form.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_WarnrModINApp_Form$1.class b/bin/com/teamcenter/rac/form/JK8_WarnrModINApp_Form$1.class new file mode 100644 index 0000000..b7cc15f Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_WarnrModINApp_Form$1.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_WarnrModINApp_Form.class b/bin/com/teamcenter/rac/form/JK8_WarnrModINApp_Form.class new file mode 100644 index 0000000..0b800c7 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_WarnrModINApp_Form.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_WarnrNPINOApp_Form$1.class b/bin/com/teamcenter/rac/form/JK8_WarnrNPINOApp_Form$1.class new file mode 100644 index 0000000..7fb12e3 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_WarnrNPINOApp_Form$1.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_WarnrNPINOApp_Form$2.class b/bin/com/teamcenter/rac/form/JK8_WarnrNPINOApp_Form$2.class new file mode 100644 index 0000000..33d1808 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_WarnrNPINOApp_Form$2.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_WarnrNPINOApp_Form.class b/bin/com/teamcenter/rac/form/JK8_WarnrNPINOApp_Form.class new file mode 100644 index 0000000..606f66d Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_WarnrNPINOApp_Form.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_XCPXH_Form$1.class b/bin/com/teamcenter/rac/form/JK8_XCPXH_Form$1.class new file mode 100644 index 0000000..43fce8f Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_XCPXH_Form$1.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_XCPXH_Form$2.class b/bin/com/teamcenter/rac/form/JK8_XCPXH_Form$2.class new file mode 100644 index 0000000..5c9c913 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_XCPXH_Form$2.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_XCPXH_Form$3.class b/bin/com/teamcenter/rac/form/JK8_XCPXH_Form$3.class new file mode 100644 index 0000000..59b91ab Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_XCPXH_Form$3.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_XCPXH_Form.class b/bin/com/teamcenter/rac/form/JK8_XCPXH_Form.class new file mode 100644 index 0000000..5603173 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_XCPXH_Form.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_YSSBH_Form$1.class b/bin/com/teamcenter/rac/form/JK8_YSSBH_Form$1.class new file mode 100644 index 0000000..60247c1 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_YSSBH_Form$1.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_YSSBH_Form$2.class b/bin/com/teamcenter/rac/form/JK8_YSSBH_Form$2.class new file mode 100644 index 0000000..e0eeb65 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_YSSBH_Form$2.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_YSSBH_Form.class b/bin/com/teamcenter/rac/form/JK8_YSSBH_Form.class new file mode 100644 index 0000000..9104371 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_YSSBH_Form.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_YZCPXHSQB_Form$1.class b/bin/com/teamcenter/rac/form/JK8_YZCPXHSQB_Form$1.class new file mode 100644 index 0000000..8073eb9 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_YZCPXHSQB_Form$1.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_YZCPXHSQB_Form$2.class b/bin/com/teamcenter/rac/form/JK8_YZCPXHSQB_Form$2.class new file mode 100644 index 0000000..0e281a4 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_YZCPXHSQB_Form$2.class differ diff --git a/bin/com/teamcenter/rac/form/JK8_YZCPXHSQB_Form.class b/bin/com/teamcenter/rac/form/JK8_YZCPXHSQB_Form.class new file mode 100644 index 0000000..98c1d1f Binary files /dev/null and b/bin/com/teamcenter/rac/form/JK8_YZCPXHSQB_Form.class differ diff --git a/bin/com/teamcenter/rac/form/JSPS_Dialog.class b/bin/com/teamcenter/rac/form/JSPS_Dialog.class new file mode 100644 index 0000000..d595984 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JSPS_Dialog.class differ diff --git a/bin/com/teamcenter/rac/form/JTable2.class b/bin/com/teamcenter/rac/form/JTable2.class new file mode 100644 index 0000000..e020883 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JTable2.class differ diff --git a/bin/com/teamcenter/rac/form/JTableModel2.class b/bin/com/teamcenter/rac/form/JTableModel2.class new file mode 100644 index 0000000..8b35381 Binary files /dev/null and b/bin/com/teamcenter/rac/form/JTableModel2.class differ diff --git a/bin/com/teamcenter/rac/form/RolloverSpinnerListModel.class b/bin/com/teamcenter/rac/form/RolloverSpinnerListModel.class new file mode 100644 index 0000000..e22409b Binary files /dev/null and b/bin/com/teamcenter/rac/form/RolloverSpinnerListModel.class differ diff --git a/bin/com/teamcenter/rac/form/TableComboxRender.class b/bin/com/teamcenter/rac/form/TableComboxRender.class new file mode 100644 index 0000000..e4c7268 Binary files /dev/null and b/bin/com/teamcenter/rac/form/TableComboxRender.class differ diff --git a/bin/com/teamcenter/rac/form/TableWithRowHead$ButtonColumn.class b/bin/com/teamcenter/rac/form/TableWithRowHead$ButtonColumn.class new file mode 100644 index 0000000..69d788f Binary files /dev/null and b/bin/com/teamcenter/rac/form/TableWithRowHead$ButtonColumn.class differ diff --git a/bin/com/teamcenter/rac/form/TableWithRowHead.class b/bin/com/teamcenter/rac/form/TableWithRowHead.class new file mode 100644 index 0000000..fd79b5b Binary files /dev/null and b/bin/com/teamcenter/rac/form/TableWithRowHead.class differ diff --git a/bin/com/teamcenter/rac/form/Test.class b/bin/com/teamcenter/rac/form/Test.class new file mode 100644 index 0000000..5400e05 Binary files /dev/null and b/bin/com/teamcenter/rac/form/Test.class differ diff --git a/bin/com/teamcenter/rac/form/TextAreaRenderer.class b/bin/com/teamcenter/rac/form/TextAreaRenderer.class new file mode 100644 index 0000000..7bef110 Binary files /dev/null and b/bin/com/teamcenter/rac/form/TextAreaRenderer.class differ diff --git a/bin/com/teamcenter/rac/form/form_user.properties b/bin/com/teamcenter/rac/form/form_user.properties new file mode 100644 index 0000000..ce322d9 --- /dev/null +++ b/bin/com/teamcenter/rac/form/form_user.properties @@ -0,0 +1,63 @@ +JK8ALPModAppForm.FORMJAVARENDERING=com.teamcenter.rac.form.JK8_ALARM_PRODUCT_MODEL_Form + + +JK8WSpecPINOAppForm.FORMJAVARENDERING=com.teamcenter.rac.form.JK8_WATER_SPECIAL_SBH_Form +JK8NNWPModNORegForm.FORMJAVARENDERING=com.teamcenter.rac.form.JK8_WATER_SBH_SUMMARY_Form +JK8DWPIdenNOAppForm.FORMJAVARENDERING=com.teamcenter.rac.form.JK8_WATER_DERIVATIVES_SBH_Form +JK8NWPIdenNOAppForm.FORMJAVARENDERING=com.teamcenter.rac.form.JK8_WATER_SBH_Form +JK8WaterPModAppForm.FORMJAVARENDERING=com.teamcenter.rac.form.JK8_WATER_PRODUCT_MODEL_Form +#\u4EA7\u54C1\u578B\u53F7\u53CA\u8BC6\u522B\u53F7 +JK8NPModINOAppForm.FORMJAVARENDERING=com.teamcenter.rac.form.JK8_CPXH_Form +#\u65B0\u4EA7\u54C1\u8BC6\u522B\u53F7 +JK8NewPIdenNOAppForm.FORMJAVARENDERING=com.teamcenter.rac.form.JK8_SBH_Form +#\u7279\u6B8A\u8981\u6C42 +JK8SpecPINOAppForm.FORMJAVARENDERING=com.teamcenter.rac.form.JK8_TSSBH_Form +#\u884D\u751F\u4EA7\u54C1 +JK8DerPIdenNOAppForm.FORMJAVARENDERING=com.teamcenter.rac.form.JK8_YSSBH_Form + +JK8ExtPIdenNOAppForm.FORMJAVARENDERING=com.teamcenter.rac.form.JK8_YZCPXHSQB_Form + +#\u63A7\u5236\u5668\u4EA7\u54C1\u578B\u53F7 +JK8CotlerPModAppForm.FORMJAVARENDERING=com.teamcenter.rac.form.JK8_CotlerPModApp_Form +#\u63A7\u5236\u5668\u8BC6\u522B\u53F7 +JK8ColPIdenNOAppForm.FORMJAVARENDERING=com.teamcenter.rac.form.JK8_ColPIdenNOAppForm + +#\u4EA7\u54C1\u578B\u53F7\u8BC6\u522B\u53F7\u603B\u8868 +JK8NewPModNORegForm.FORMJAVARENDERING=com.teamcenter.rac.form.JK8_XCPXH_Form + +#\u98CE\u9669\u8868\u5355 +JK8ProjRiskRevisionMaster.FORMJAVARENDERING = com.teamcenter.rac.form.JK8_FXGL_Form + +#Item\ Master.FORMJAVARENDERING=com.teamcenter.rac.form.HX3_GYLXRevisionFormStyleSheet +#ItemMasterForm.FORMJAVARENDERING=com.teamcenter.rac.form.HX3_GYLXRevisionFormStyleSheet +JK8TecReviewRevisionMaster.FORMJAVARENDERING=com.teamcenter.rac.form.JK8_JSPS_Form + +JK8InitialReqRevisionMaster.FORMJAVARENDERING=com.connor.jk.plm.YSXQForm.JK8_YSXQ_Form + + +#JK8MaterialRevisionMaster.FORMJAVARENDERING=com.teamcenter.rac.form.JK8MaterialRevisionMasterForm + +JK8MaterialRevisionMaster.FORMJAVARENDERING=com.teamcenter.rac.form.ConnorForm +TX2FinalProductRevisionMaster.FORMJAVARENDERING=com.teamcenter.rac.form.ConnorForm +TX2ComponentRevisionMaster.FORMJAVARENDERING=com.teamcenter.rac.form.ConnorForm +TX2SemiProductRevisionMaster.FORMJAVARENDERING=com.teamcenter.rac.form.ConnorForm +TX2RawMaterialRevisionMaster.FORMJAVARENDERING=com.teamcenter.rac.form.ConnorForm + +#PCB\u7F16\u7801\u7533\u8BF7\u8868 +JK8PCBNOAppForm.FORMJAVARENDERING=com.teamcenter.rac.form.JK8PCBNOAppForm + +#\u884D\u751FPCB\u7F16\u7801\u7533\u8BF7\u8868 +JK8DerPCBNOAppForm.FORMJAVARENDERING=com.teamcenter.rac.form.JK8DerPCBNOAppForm + +#PCB\u7F16\u7801\u767B\u8BB0\u8868 +JK8PCBNORegForm.FORMJAVARENDERING=com.teamcenter.rac.form.JK8PCBNORegForm + + +#\u62A5\u8B66\u5668\u4EA7\u54C1\u578B\u53F7\u8BC6\u522B\u53F7\u7533\u8BF7\u8868 +JK8WarnrModINAppForm.FORMJAVARENDERING=com.teamcenter.rac.form.JK8_WarnrModINApp_Form +#\u62A5\u8B66\u5668\u4EA7\u54C1\u8BC6\u522B\u53F7\u7533\u8BF7\u8868 +JK8WarnrNPINOAppForm.FORMJAVARENDERING=com.teamcenter.rac.form.JK8_WarnrNPINOApp_Form + + +#\u91C7\u96C6\u5668\u8BC6\u522B\u53F7 +JK8CJQIdenNOAppForm.FORMJAVARENDERING=com.teamcenter.rac.form.JK8_CJQ_Form diff --git a/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$1.class b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$1.class new file mode 100644 index 0000000..dad5444 Binary files /dev/null and b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$1.class differ diff --git a/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$10.class b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$10.class new file mode 100644 index 0000000..b6e4434 Binary files /dev/null and b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$10.class differ diff --git a/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$11.class b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$11.class new file mode 100644 index 0000000..2ececca Binary files /dev/null and b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$11.class differ diff --git a/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$12.class b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$12.class new file mode 100644 index 0000000..69399d9 Binary files /dev/null and b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$12.class differ diff --git a/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$13.class b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$13.class new file mode 100644 index 0000000..3b535b3 Binary files /dev/null and b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$13.class differ diff --git a/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$14.class b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$14.class new file mode 100644 index 0000000..49f4bd3 Binary files /dev/null and b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$14.class differ diff --git a/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$15$1.class b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$15$1.class new file mode 100644 index 0000000..2992446 Binary files /dev/null and b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$15$1.class differ diff --git a/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$15$2.class b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$15$2.class new file mode 100644 index 0000000..f6b0bda Binary files /dev/null and b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$15$2.class differ diff --git a/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$15.class b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$15.class new file mode 100644 index 0000000..e9a97ac Binary files /dev/null and b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$15.class differ diff --git a/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$16.class b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$16.class new file mode 100644 index 0000000..9ed2a92 Binary files /dev/null and b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$16.class differ diff --git a/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$17$1.class b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$17$1.class new file mode 100644 index 0000000..78813b8 Binary files /dev/null and b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$17$1.class differ diff --git a/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$17$2$1.class b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$17$2$1.class new file mode 100644 index 0000000..e95a13a Binary files /dev/null and b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$17$2$1.class differ diff --git a/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$17$2$2.class b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$17$2$2.class new file mode 100644 index 0000000..ec341f6 Binary files /dev/null and b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$17$2$2.class differ diff --git a/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$17$2.class b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$17$2.class new file mode 100644 index 0000000..626f9be Binary files /dev/null and b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$17$2.class differ diff --git a/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$17$3.class b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$17$3.class new file mode 100644 index 0000000..6bf1f87 Binary files /dev/null and b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$17$3.class differ diff --git a/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$17.class b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$17.class new file mode 100644 index 0000000..cea58ca Binary files /dev/null and b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$17.class differ diff --git a/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$18$1.class b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$18$1.class new file mode 100644 index 0000000..4fc7250 Binary files /dev/null and b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$18$1.class differ diff --git a/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$18.class b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$18.class new file mode 100644 index 0000000..64b5a13 Binary files /dev/null and b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$18.class differ diff --git a/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$19.class b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$19.class new file mode 100644 index 0000000..9bda958 Binary files /dev/null and b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$19.class differ diff --git a/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$2.class b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$2.class new file mode 100644 index 0000000..626aaab Binary files /dev/null and b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$2.class differ diff --git a/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$20.class b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$20.class new file mode 100644 index 0000000..aee715d Binary files /dev/null and b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$20.class differ diff --git a/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$21.class b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$21.class new file mode 100644 index 0000000..1776bb1 Binary files /dev/null and b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$21.class differ diff --git a/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$22.class b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$22.class new file mode 100644 index 0000000..184fd84 Binary files /dev/null and b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$22.class differ diff --git a/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$23$1.class b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$23$1.class new file mode 100644 index 0000000..10d707c Binary files /dev/null and b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$23$1.class differ diff --git a/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$23.class b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$23.class new file mode 100644 index 0000000..684de1c Binary files /dev/null and b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$23.class differ diff --git a/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$24.class b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$24.class new file mode 100644 index 0000000..4fc15d1 Binary files /dev/null and b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$24.class differ diff --git a/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$25.class b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$25.class new file mode 100644 index 0000000..2711640 Binary files /dev/null and b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$25.class differ diff --git a/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$26$1.class b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$26$1.class new file mode 100644 index 0000000..08d2ca6 Binary files /dev/null and b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$26$1.class differ diff --git a/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$26.class b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$26.class new file mode 100644 index 0000000..5e4401d Binary files /dev/null and b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$26.class differ diff --git a/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$27.class b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$27.class new file mode 100644 index 0000000..8eaded4 Binary files /dev/null and b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$27.class differ diff --git a/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$3.class b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$3.class new file mode 100644 index 0000000..fff663b Binary files /dev/null and b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$3.class differ diff --git a/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$4.class b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$4.class new file mode 100644 index 0000000..7f3414f Binary files /dev/null and b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$4.class differ diff --git a/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$5.class b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$5.class new file mode 100644 index 0000000..ca768e4 Binary files /dev/null and b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$5.class differ diff --git a/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$6.class b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$6.class new file mode 100644 index 0000000..4c3315e Binary files /dev/null and b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$6.class differ diff --git a/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$7.class b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$7.class new file mode 100644 index 0000000..14d6aaf Binary files /dev/null and b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$7.class differ diff --git a/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$8.class b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$8.class new file mode 100644 index 0000000..ccf2f3b Binary files /dev/null and b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$8.class differ diff --git a/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$9.class b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$9.class new file mode 100644 index 0000000..52c8bfc Binary files /dev/null and b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$9.class differ diff --git a/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$LoadTeamInfoTask.class b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$LoadTeamInfoTask.class new file mode 100644 index 0000000..6799090 Binary files /dev/null and b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView$LoadTeamInfoTask.class differ diff --git a/bin/com/teamcenter/rac/project/views/ProjectDefinitionView.class b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView.class new file mode 100644 index 0000000..687e341 Binary files /dev/null and b/bin/com/teamcenter/rac/project/views/ProjectDefinitionView.class differ diff --git a/build.properties b/build.properties new file mode 100644 index 0000000..ba5e0f7 --- /dev/null +++ b/build.properties @@ -0,0 +1,108 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + icons/,\ + poilib/commons-codec-1.10.jar,\ + poilib/commons-logging-1.1.jar,\ + poilib/dom4j-1.6.1.jar,\ + poilib/geronimo-stax-api_1.0_spec-1.0.jar,\ + poilib/jacob.jar,\ + poilib/jcommon-1.0.12.jar,\ + poilib/jfreechart-1.0.9.jar,\ + poilib/jsr173_1.0_api.jar,\ + poilib/jxl_1.0.0.jar,\ + poilib/poi-3.9-20121203.jar,\ + poilib/poi-examples-3.9-20121203.jar,\ + poilib/poi-excelant-3.9-20121203.jar,\ + poilib/poi-ooxml-3.9-20121203.jar,\ + poilib/poi-ooxml-schemas-3.9-20121203.jar,\ + poilib/poi-scratchpad-3.9-20121203.jar,\ + poilib/xmlbeans-2.5.0.jar,\ + poilib/ojdbc6.jar,\ + poilib/msbase.jar,\ + poilib/mssqlserver.jar,\ + poilib/msutil.jar,\ + poilib/sqljdbc41.jar,\ + plugin.xml,\ + poilib/mailapi.jar,\ + poilib/smtp.jar,\ + axis2_1.6/activation-1.1.jar,\ + axis2_1.6/antlr-2.7.7.jar,\ + axis2_1.6/apache-mime4j-core-0.7.2.jar,\ + axis2_1.6/axiom-api-1.2.13.jar,\ + axis2_1.6/axiom-dom-1.2.13.jar,\ + axis2_1.6/axiom-impl-1.2.13.jar,\ + axis2_1.6/axis2-adb-1.6.2.jar,\ + axis2_1.6/axis2-adb-codegen-1.6.2.jar,\ + axis2_1.6/axis2-ant-plugin-1.6.2.jar,\ + axis2_1.6/axis2-clustering-1.6.2.jar,\ + axis2_1.6/axis2-codegen-1.6.2.jar,\ + axis2_1.6/axis2-corba-1.6.2.jar,\ + axis2_1.6/axis2-fastinfoset-1.6.2.jar,\ + axis2_1.6/axis2-java2wsdl-1.6.2.jar,\ + axis2_1.6/axis2-jaxbri-1.6.2.jar,\ + axis2_1.6/axis2-jaxws-1.6.2.jar,\ + axis2_1.6/axis2-jibx-1.6.2.jar,\ + axis2_1.6/axis2-json-1.6.2.jar,\ + axis2_1.6/axis2-kernel-1.6.2.jar,\ + axis2_1.6/axis2-metadata-1.6.2.jar,\ + axis2_1.6/axis2-mtompolicy-1.6.2.jar,\ + axis2_1.6/axis2-saaj-1.6.2.jar,\ + axis2_1.6/axis2-soapmonitor-servlet-1.6.2.jar,\ + axis2_1.6/axis2-spring-1.6.2.jar,\ + axis2_1.6/axis2-transport-http-1.6.2.jar,\ + axis2_1.6/axis2-transport-local-1.6.2.jar,\ + axis2_1.6/axis2-xmlbeans-1.6.2.jar,\ + axis2_1.6/bcel-5.1.jar,\ + axis2_1.6/commons-cli-1.2.jar,\ + axis2_1.6/commons-codec-1.3.jar,\ + axis2_1.6/commons-fileupload-1.2.jar,\ + axis2_1.6/commons-httpclient-3.1.jar,\ + axis2_1.6/commons-io-1.4.jar,\ + axis2_1.6/commons-logging-1.1.1.jar,\ + axis2_1.6/geronimo-annotation_1.0_spec-1.1.jar,\ + axis2_1.6/geronimo-jaxws_2.2_spec-1.0.jar,\ + axis2_1.6/geronimo-jta_1.1_spec-1.1.jar,\ + axis2_1.6/geronimo-saaj_1.3_spec-1.0.1.jar,\ + axis2_1.6/geronimo-stax-api_1.0_spec-1.0.1.jar,\ + axis2_1.6/geronimo-ws-metadata_2.0_spec-1.1.2.jar,\ + axis2_1.6/httpcore-4.0.jar,\ + axis2_1.6/jalopy-1.5rc3.jar,\ + axis2_1.6/jaxb-api-2.1.jar,\ + axis2_1.6/jaxb-impl-2.1.7.jar,\ + axis2_1.6/jaxb-xjc-2.1.7.jar,\ + axis2_1.6/jaxen-1.1.1.jar,\ + axis2_1.6/jaxws-tools-2.1.3.jar,\ + axis2_1.6/jettison-1.0-RC2.jar,\ + axis2_1.6/jibx-bind-1.2.jar,\ + axis2_1.6/jibx-run-1.2.jar,\ + axis2_1.6/jsr311-api-1.0.jar,\ + axis2_1.6/juli-6.0.16.jar,\ + axis2_1.6/log4j-1.2.15.jar,\ + axis2_1.6/mail-1.4.jar,\ + axis2_1.6/mex-1.6.2-impl.jar,\ + axis2_1.6/neethi-3.0.2.jar,\ + axis2_1.6/regexp-1.2.jar,\ + axis2_1.6/tribes-6.0.16.jar,\ + axis2_1.6/woden-api-1.0M9.jar,\ + axis2_1.6/woden-impl-commons-1.0M9.jar,\ + axis2_1.6/woden-impl-dom-1.0M9.jar,\ + axis2_1.6/wsdl4j-1.6.2.jar,\ + axis2_1.6/wstx-asl-3.2.9.jar,\ + axis2_1.6/xalan-2.7.0.jar,\ + axis2_1.6/xml-resolver-1.2.jar,\ + axis2_1.6/xmlbeans-2.3.0.jar,\ + axis2_1.6/XmlSchema-1.4.7.jar,\ + jason/commons-beanutils-1.7.0.jar,\ + jason/commons-collections-3.2.jar,\ + jason/commons-lang-2.4.jar,\ + jason/commons-logging-1.1.jar,\ + jason/ezmorph-1.0.4.jar,\ + jason/jdom.jar,\ + jason/json-lib-2.2.2-jdk15.jar,\ + jason/json-lib-2.2.3-jdk13.jar,\ + jason/itext-2.0.3.jar,\ + jason/okhttp-2.7.4.jar,\ + jason/okio-1.13.0.jar,\ + jason/fastjson-1.2.76.jar diff --git a/exportHardwareBOM_Operation.java b/exportHardwareBOM_Operation.java new file mode 100644 index 0000000..eefbf38 --- /dev/null +++ b/exportHardwareBOM_Operation.java @@ -0,0 +1,820 @@ +package com.connor.jk.plm.exportBOM; + +import java.awt.Color; +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.List; + +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.IndexedColors; +import org.apache.poi.ss.util.CellRangeAddress; +import org.apache.poi.xssf.usermodel.XSSFCell; +import org.apache.poi.xssf.usermodel.XSSFCellStyle; +import org.apache.poi.xssf.usermodel.XSSFFont; +import org.apache.poi.xssf.usermodel.XSSFRow; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + +import com.teamcenter.rac.aif.AbstractAIFOperation; +import com.teamcenter.rac.aif.kernel.AIFComponentContext; +import com.teamcenter.rac.form.ItemRevisionMasterForm; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentBOMLine; +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.TCComponentTcFile; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.kernel.ics.ICSProperty; +import com.teamcenter.rac.util.MessageBox; + +public class exportHardwareBOM_Operation extends AbstractAIFOperation { + private String text; + private String path; + private ProgressBarThread wait; + private TCSession session; + private TCComponentBOMLine comp; + private FileInputStream fis; + private XSSFWorkbook workbook; + private FileOutputStream out; + private TCPreferenceService preferenceService; + private List list = new ArrayList<>(); + private exportHardwareBOM_Bean bean; + private TCComponentBOMLine child; + private String jbName = "";// + private String SBH = "";// ʶ + + public exportHardwareBOM_Operation(String text, String path, ProgressBarThread wait, TCSession session, + TCComponentBOMLine comp) { + this.text = text; + this.path = path; + this.wait = wait; + this.session = session; + this.comp = comp; + } + + Integer[] keys = null; + String[] vals = null; + private String realNumber = ""; + @Override + public void executeOperation() throws Exception { + + //ץȡfnd0ActuatedInteractiveTsks fnd0Performer fnd0EndDate fnd0AliasTaskName + String name1="";// + String name2="";// + String name3="";//׼ + TCComponent[] component=comp.getItemRevision().getTCProperty("fnd0ActuatedInteractiveTsks").getReferenceValueArray(); +// System.out.println(component.length); + for (int i = 0; i < component.length; i++) { + // + if(component[i].getTCProperty("fnd0AliasTaskName").getStringValue().contains("")) { + name1=component[i].getTCProperty("fnd0Performer").getDisplayValue().split("\\(")[0]; + name1=name1+"/"+component[i].getTCProperty("fnd0EndDate").getDisplayValue(); + }else if(component[i].getTCProperty("fnd0AliasTaskName").getStringValue().contains("")) { + name2=component[i].getTCProperty("fnd0Performer").getDisplayValue().split("\\(")[0]; + name2=name2+"/"+component[i].getTCProperty("fnd0EndDate").getDisplayValue(); + }else if(component[i].getTCProperty("fnd0AliasTaskName").getStringValue().contains("׼")) { + name3=component[i].getTCProperty("fnd0Performer").getDisplayValue().split("\\(")[0]; + name3=name3+"/"+component[i].getTCProperty("fnd0EndDate").getDisplayValue(); + } + } + +// if(true) { +// return; +// } + long start = System.currentTimeMillis(); + int colsCount = 15;//2017.10.18һ + // ȡ + TCComponentItemRevision itemRevision = comp.getItemRevision(); + TCComponentICO[] icoS = itemRevision.getClassificationObjects(); + + int count = 0; + int count1 = 0; + for (int i = 0; i < icoS.length; i++) { + ICSProperty[] cPropS = icoS[i].getICSProperties(true); + for (int j = 0; j < cPropS.length; j++) { +// System.out.println(count); + count++; + } + keys = new Integer[count]; + vals = new String[count]; + for (int j = 0; j < cPropS.length; j++) { +// System.out.println(count); + keys[count1] = cPropS[j].getId(); +// System.out.println("keys[" + count1 + "]================>" + keys[count1]); + vals[count1] = cPropS[j].getValue(); +// System.out.println("vals[" + count1 + "]================>" + vals[count1]); + if (keys[count1] == -500293) { + jbName = vals[count1]; + + } else if (keys[count1] == -500301) { + SBH = vals[count1]; + + } + count1++; + } + + } + String sxx = "jk_bom2_uid";// G8TlM0X6YvbLjA G8TlM0X6YvbLjA TJXl8kmSYvbLjA + File file = getExcel(sxx); + if (file == null) { + return; + } + getBomline(comp,realNumber); + System.out.println("BOM" + list.size() + ""); + int rowCount = list.size(); + fis = new FileInputStream(file); + workbook = new XSSFWorkbook(fis); + //һе + XSSFFont font2 = workbook.createFont(); + font2.setFontName(""); + font2.setFontHeightInPoints((short) 11);// С + //ƣλŵȵʽ + XSSFFont font4 = workbook.createFont(); + font4.setFontName(""); + font4.setFontHeightInPoints((short) 10);// С + //Bŵ + XSSFFont font = workbook.createFont(); + font.setFontName("΢ź"); + font.setFontHeightInPoints((short) 9);// С + // +// XSSFFont font3 = workbook.createFont(); +// font3.setFontName("΢ź"); +// font3.setFontHeightInPoints((short) 10);// С + + XSSFSheet sheet = workbook.getSheet("Ӳ嵥"); + XSSFRow row = sheet.getRow(1); + XSSFCell cell_0 = row.getCell(3); + cell_0.setCellValue(comp.getItemRevision().getTCProperty("item_id").getStringValue()); + cell_0 = row.getCell(11); + cell_0.setCellValue(comp.getItemRevision().getTCProperty("item_revision_id").getStringValue()); + row = sheet.getRow(2); + cell_0 = row.getCell(3); + cell_0.setCellValue(jbName); + cell_0 = row.getCell(11); + cell_0.setCellValue(SBH); + row = sheet.getRow(4); + cell_0 = row.getCell(3); + Date date=new Date(); + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); + String time= sdf.format(date); + time=time.replace("-", "."); + cell_0.setCellValue(time);//Ч + int startRow = 6; + + XSSFCellStyle sty = workbook.createCellStyle();// ½Ԫĸʽ + XSSFCellStyle style = workbook.createCellStyle();// Cϱ뵥Ԫĸʽ +// XSSFCellStyle sty2 = sheet.getRow(7).getCell(1).getCellStyle(); + XSSFCellStyle sty2 = workbook.createCellStyle();//BеԪʽ + sty2.setBorderBottom((short) 1); + sty2.setBorderLeft((short) 2); + sty2.setBorderRight((short) 1); + sty2.setBorderTop((short) 1); + sty2.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER); + sty2.setFont(font); +// XSSFCellStyle sty3 = sheet.getRow(6).getCell(13).getCellStyle();// NеԪĸʽ + XSSFCellStyle sty3 = workbook.createCellStyle();// OбעԪĸʽ + XSSFCellStyle sty4 = workbook.createCellStyle();// кһеĸʽ + XSSFCellStyle sty5 = workbook.createCellStyle();// һעĸʽ + sty5.setBorderTop((short) 2); + sty5.setBorderRight((short) 2); + XSSFCellStyle sty6 = workbook.createCellStyle();// ˵Ԫĸʽ + XSSFCellStyle sty7 = workbook.createCellStyle();// /ڵԪĸʽ +// XSSFCellStyle sty8 = workbook.createCellStyle();// мĸʽ +// sty8.setBorderBottom((short) 2); +// sty8.setBorderLeft((short) 0); +// sty8.setBorderRight((short) 0); + + sty6.setBorderBottom((short) 2); + sty6.setBorderLeft((short) 2); + sty6.setBorderRight((short) 1); + + sty7.setBorderLeft((short) 1); + sty7.setBorderBottom((short) 2); + sty7.setBorderRight((short) 2); +// sty = sheet.getRow(7).getCell(11).getCellStyle(); +// sty.setBorderBottom(CellStyle.BORDER_THIN); + + sty.setBorderBottom((short) 1); + sty.setBorderLeft((short) 1); + sty.setBorderRight((short) 1); + sty.setBorderTop((short) 1); +// sty.setBottomBorderColor(IndexedColors.BLACK.getIndex()); + sty.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER);// ֱ + sty.setAlignment(XSSFCellStyle.ALIGN_LEFT);// ˮƽ + + style.setBorderBottom(CellStyle.BORDER_THIN); +// style.setBottomBorderColor(IndexedColors.BLACK.getIndex()); + style.setAlignment(XSSFCellStyle.ALIGN_CENTER); // + style.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER); // + style.setFont(font); +// sty2.setFont(font); + + sty3.setBorderBottom((short) 1); + sty3.setBorderLeft((short) 1); + sty3.setBorderRight((short) 2); +// sty3.setBottomBorderColor(IndexedColors.BLACK.getIndex()); + sty3.setBorderTop((short) 1); +// sty3.setTopBorderColor(IndexedColors.BLACK.getIndex()); + sty4.setBorderBottom((short)2); + sty4.setBorderLeft((short)1); + sty4.setBorderRight((short)1); +// sty4.setBottomBorderColor(IndexedColors.BLACK.getIndex()); +// sty4.setBorderTop(CellStyle.BORDER_THIN); +// sty4.setTopBorderColor(IndexedColors.BLACK.getIndex()); +// sty4.setBorderLeft(CellStyle.BORDER_THIN); +// sty4.setLeftBorderColor(IndexedColors.BLACK.getIndex()); +// sty4.setBorderRight(CellStyle.BORDER_THIN); +// sty4.setRightBorderColor(IndexedColors.BLACK.getIndex()); + + sty4.setFont(font2); + sty4.setAlignment(XSSFCellStyle.ALIGN_CENTER); + for (int i = 0; i < rowCount + 7; i++) { + XSSFRow r = null; + boolean isCreate = false; +// System.out.println("sheet.getLastRowNum()-------->" + sheet.getLastRowNum()); + if ((i + startRow) > sheet.getLastRowNum()) { + r = sheet.createRow(i + startRow); + isCreate = true; + } else { + r = sheet.getRow(i + startRow); + isCreate = false; + } + if (i < rowCount + 3 && isCreate) { + + CellRangeAddress cra = new CellRangeAddress(i + startRow, i + startRow, 8, 9); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(i + startRow, i + startRow, 6, 7); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(i + startRow, i + startRow, 4, 5); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(i + startRow, i + startRow, 2, 3); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(i + startRow, i + startRow, 11, 12); + sheet.addMergedRegion(cra); + } + + for (int cols = 1; cols < colsCount; cols++) { + XSSFCell cell = null; + if (isCreate) { + cell = r.createCell(cols); + + cell.setCellStyle(sty); + if (cols == 1) { + cell.setCellStyle(sty2); + } else if (cols == 14) { + cell.setCellStyle(sty3); + } + // TODO ʽ + } else { +// if (r == null) { +// r = sheet.createRow(i + startRow); +// System.out.println("ûд"); +// } + cell = r.getCell(cols); + } + if (cell == null) { + // cell = r.createCell(cols); + // cell.setCellStyle(sty); + } + + cell.setCellType(XSSFCell.CELL_TYPE_STRING);// ıʽ + + // XSSFCellStyle sty0=sheet.getRow(9).getCell(11).getCellStyle(); + //и + if (i < rowCount) { + + int rwsTemp = list.get(i).getSpecCode().length()/10+1; + int rwsTemp1 = list.get(i).getRef_designator().length()/10+1; + int rwsTemp2 = list.get(i).getPackaging().length()/10+1; + int rwsTemp3 = list.get(i).getBl_substitute_list().length()/10+1; + int temp; + + int a[]=new int[]{rwsTemp,rwsTemp1,rwsTemp2,rwsTemp3}; + Arrays.sort(a); + for(int i1=0;i1 0) { + cell.setCellStyle(sty2); + + } + cell.setCellValue(list.get(i).getNumber()); + break; + } + + case 2:// ϱ + // if(i>2) { + // sty0=sheet.getRow(9).getCell(cols).getCellStyle(); + // cell.setCellStyle(sty0); + // } + if (i >= 2) { + cell.setCellStyle(style); + + } + + cell.setCellValue(list.get(i).getMaterialCode());// д + break; + case 4:// + cell.getCellStyle().setFont(font4); + cell.getCellStyle().setAlignment(CellStyle.ALIGN_LEFT); + cell.setCellValue(list.get(i).getMaterialName()); + break; + case 6:// ͺ + cell.getCellStyle().setFont(font4); + cell.setCellValue(list.get(i).getRef_designator()); + System.out.println("λ-------------"+list.get(i).getRef_designator()); + break; + case 8:// ͺ + cell.getCellStyle().setFont(font4); + cell.setCellValue(list.get(i).getSpecCode()); + // cell.setCellStyle(styG); + break; + case 10:// + cell.getCellStyle().setFont(font4); + cell.setCellType(Cell.CELL_TYPE_STRING); + cell.setCellValue(list.get(i).getQuantity()); + System.out.println("--------------->"+list.get(i).getQuantity()); + break; + case 11:// װ + cell.getCellStyle().setFont(font4); + cell.getCellStyle().setAlignment(CellStyle.ALIGN_LEFT); + cell.setCellValue(list.get(i).getPackaging()); + break; + case 13:// + cell.setCellValue(list.get(i).getBl_substitute_list()); + break; + case 14:// ע + cell.setCellStyle(sty3); + break; + } + } + } + } + XSSFCell cell14=sheet.getRow(6).getCell(14); + cell14.setCellStyle(sty5); + + + // һеĵ±߿ + XSSFCell cellLast = null; + for (int cols = 1; cols < colsCount; cols++) { + cellLast = sheet.getRow(startRow + rowCount + 6).getCell(cols); + switch (cols) { + case 1:// + cellLast.setCellValue("/"); + cellLast.setCellStyle(sty2); + break; + case 2:// + + cellLast.setCellStyle(sty4); + break; + case 3:// + cellLast.setCellValue("/"); + cellLast.setCellStyle(sty4); + break; + case 4:// + + cellLast.setCellStyle(sty4); + break; + case 5:// + cellLast.setCellValue("׼/"); + cellLast.setCellStyle(sty4); + break; + case 6:// + + cellLast.setCellStyle(sty4); + break; + case 7:// + cellLast.setCellValue("ĵ"); + cellLast.setCellStyle(sty4); + break; + case 8:// + + cellLast.setCellStyle(sty4); + break; + case 9:// + cellLast.setCellValue(""); + cellLast.setCellStyle(sty4); + break; + case 10:// + cellLast.setCellValue(""); + cellLast.setCellStyle(sty4); + break; + case 11:// + cellLast.setCellValue("/"); + cellLast.setCellStyle(sty4); + break; + case 12:// + + cellLast.setCellStyle(sty4); + break; + case 13:// + + cellLast.setCellStyle(sty4); + break; + case 14:// ע + + cellLast.setCellStyle(sty3); + break; + } + } + // һеԪɫ߿ + for (int i = startRow + rowCount+6; i < startRow + rowCount + 7; i++) { + XSSFCell cell = null; + for (int cols = 1; cols < colsCount; cols++) { + cell = sheet.getRow(i).getCell(cols); + switch (cols) { + case 1:// + + cell.setCellStyle(sty6); + break; + + case 14:// ע + + if (i > 0) { + + cell.setCellStyle(sty7); + } + break; + } + } + } + // ϲǩĵԪ + CellRangeAddress cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + 5, 1, 2); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + 5, 3, 4); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + 5, 5, 6); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + 5, 7, 8); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + 5, 9, 9); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + 5, 10, 10); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + 5, 11, 14); + sheet.addMergedRegion(cra); + // ϲһ + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + 6, 1, 2); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + 6, 3, 4); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + 6, 5, 6); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + 6, 7, 8); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + 6, 11, 14); + sheet.addMergedRegion(cra); + // õеĵ±߿ + XSSFCell cell5 = null; + for (int cols = 1; cols < colsCount; cols++) { + cell5 = sheet.getRow(startRow + rowCount + 2).getCell(cols); + switch (cols) { + + case 1:// + + cell5.setCellStyle(sty4); + break; + case 2:// + + cell5.setCellStyle(sty4); + break; + case 3:// + + cell5.setCellStyle(sty4); + break; + case 4:// + + cell5.setCellStyle(sty4); + break; + case 5:// + + cell5.setCellStyle(sty4); + break; + case 6:// + + cell5.setCellStyle(sty4); + break; + case 7:// + + cell5.setCellStyle(sty4); + break; + case 8:// + + cell5.setCellStyle(sty4); + break; + case 9:// + + cell5.setCellStyle(sty4); + break; + case 10:// + + cell5.setCellStyle(sty4); + break; + case 11:// + + cell5.setCellStyle(sty4); + break; + case 12:// + + cell5.setCellStyle(sty4); + break; + case 13:// + + cell5.setCellStyle(sty4); + break; + case 14:// ע + + cell5.setCellStyle(sty4); + break; + } + } + + XSSFCell cell0=sheet.getRow(startRow + rowCount + 2).getCell(1); + cell0.setCellStyle(sty6);//5еԪA + + cell0=sheet.getRow(startRow + rowCount + 2).getCell(14); + cell0.setCellStyle(sty7);//5еԪO + + XSSFCell cell1=sheet.getRow(startRow + rowCount + 4).getCell(1); + cell1.setCellStyle(sty6); + cell1=sheet.getRow(startRow + rowCount + 4).getCell(14); + cell1.setCellStyle(sty7); + +// XSSFRow row1=sheet.getRow(startRow + rowCount + 3); +// row1.getCell(1).getCellStyle().getFont().setFontHeightInPoints((short) 10); +// row1.getCell(1).getCellStyle().getFont().setFontName("Tahoma"); + XSSFCell cell2=sheet.getRow(startRow + rowCount + 3).getCell(1);//4AԪĸʽ + cell2.getCellStyle().getFont().setFontHeightInPoints((short) 10); + cell2.getCellStyle().getFont().setFontName(""); + cell2.setCellValue(name1); + cell2=sheet.getRow(startRow + rowCount + 3).getCell(3); + cell2.setCellValue(name2); + cell2=sheet.getRow(startRow + rowCount + 3).getCell(5); + cell2.setCellValue(name3); + + + cell2 = sheet.getRow(startRow + rowCount + 3).getCell(1); + cell2.getCellStyle().setAlignment((short) 1); + cell2.getCellStyle().setVerticalAlignment((short) 1); + cell2.getCellStyle().setWrapText(true);//Զ +// cell2.getCellStyle().setFont(font3); + + + sheet.getRow(startRow + rowCount + 6).setHeight((short)402);//һеĸ߶ + cellLast = sheet.getRow(startRow + rowCount + 6).getCell(1); + cellLast.getCellStyle().setAlignment(CellStyle.ALIGN_LEFT); + cellLast.getCellStyle().setVerticalAlignment(CellStyle.VERTICAL_CENTER); + cellLast = sheet.getRow(startRow + rowCount + 6).getCell(3); + cellLast.getCellStyle().setAlignment(CellStyle.ALIGN_LEFT); + cellLast.getCellStyle().setVerticalAlignment(CellStyle.VERTICAL_CENTER); + + cellLast = sheet.getRow( 6).getCell(2); + cellLast.getCellStyle().setAlignment(CellStyle.ALIGN_CENTER); + cellLast = sheet.getRow( 7).getCell(2); + cellLast.getCellStyle().setAlignment(CellStyle.ALIGN_CENTER); + + + + File fileout = new File(path + "\\" + text + ".xlsx"); + try { + out = new FileOutputStream(fileout); + } catch (Exception e) { + this.wait.setBool(true); + this.wait.interrupt(); + MessageBox.post("ȹرͬļ","",MessageBox.INFORMATION); + return; + } + workbook.write(out); + long end = System.currentTimeMillis(); + float time2 = (end - start) / 1000.00f; + System.out.println("ʱ" + time2 + ""); +// System.out.println("汾----------------------->"+comp.getItemRevision().getTCProperty("item_revision_id").getStringValue()); + this.wait.setBool(true); + this.wait.interrupt(); + MessageBox.post("Ѿ", "ɹ", MessageBox.INFORMATION); + Runtime.getRuntime().exec(new String[] { "cmd.exe", "/c", path + "\\" + text + ".xlsx" });// + System.out.println("2017.10.26"); + } + + private File getExcel(String ssx) { + File file = null; + preferenceService = session.getPreferenceService(); + String puid = preferenceService.getStringValue(ssx); + if (puid == null) { + MessageBox.post("ϵԱѡ", "", MessageBox.ERROR); + return null; + } + TCComponentDataset dataset = null; + try { + dataset = (TCComponentDataset) session.stringToComponent(puid); + } catch (TCException e) { + e.printStackTrace(); + } + if (dataset == null) { + MessageBox.post("ݼڣϵԱѡ", "", MessageBox.ERROR); + return null; + } + try { + TCComponentTcFile[] files = dataset.getTcFiles(); + if (files.length == 0) { + MessageBox.post("ݼûõļ,", "", MessageBox.ERROR); + return null; + } else if (files.length > 1) { + MessageBox.post("ݼõļ", "", MessageBox.ERROR); + return null; + } else { + file = files[0].getFmsFile(); + } + } catch (TCException e) { + e.printStackTrace(); + } + + return file; + } + + private void getBomline(TCComponentBOMLine bomline, String realNumber_0) { + AIFComponentContext[] childline = null; + String materialCode = "";// ϱ + String materialName = "";// + String specCode = "";// ͺ + String quantity = "";// + String unit = "";// λ + String ref_designator = "";// λ + String packaging = "";// װ + String bl_substitute_list="";// + int number_0 = 0; + try { + childline = bomline.getChildren(); + for (int i = 0; i < childline.length; i++) { + + number_0++; + bean = new exportHardwareBOM_Bean(); + if (!bomline.getTCProperty("bl_formatted_parent_name").getStringValue().equals("")) { + if (i > 0) { + realNumber_0 = realNumber_0.substring(0, realNumber_0.lastIndexOf(".") + 1) + number_0; + + } else { + realNumber_0 = realNumber_0 + "." + number_0; + + } + } else { + realNumber_0 = number_0 + ""; + + } + bean.setNumber(realNumber_0); + + child = (TCComponentBOMLine) childline[i].getComponent(); + //2017.10.17ϱԸij"/汾" + materialCode = child.getItemRevision().getTCProperty("item_id").getStringValue()+"/"+ child.getItemRevision().getTCProperty("current_revision_id").getStringValue(); + bean.setMaterialCode(materialCode); + materialName = child.getItemRevision().getTCProperty("object_name").getStringValue(); + bean.setMaterialName(materialName); + packaging = ""; + TCComponentICO[] icoS = child.getItemRevision().getClassificationObjects(); + int count = 0; + int count1 = 0; + for (int j = 0; j < icoS.length; j++) { + ICSProperty[] cPropS = icoS[j].getICSProperties(true); + for (int k = 0; k < cPropS.length; k++) { +// System.out.println(count); + count++; + } + keys = new Integer[count]; + vals = new String[count]; + for (int k = 0; k < cPropS.length; k++) { +// System.out.println(count); + keys[count1] = cPropS[k].getId(); +// System.out.println("keys[" + count1 + "]================>" + keys[count1]); + vals[count1] = cPropS[k].getValue(); +// System.out.println("vals[" + count1 + "]================>" + vals[count1]); + if (keys[count1] == -500242) { + packaging = vals[count1]; + + } + count1++; + } + + } + + bean.setPackaging(packaging); + TCComponentForm form = (TCComponentForm) child.getItemRevision() + .getReferenceListProperty("IMAN_master_form_rev")[0]; + // techCode = form.getTCProperty("jk8TechModel").getStringValue(); + // bean.setTechCode(techCode); + specCode = form.getTCProperty("jk8SpecModel").getStringValue(); + bean.setSpecCode(specCode); + ref_designator = child.getTCProperty("bl_ref_designator").getStringValue(); + // + System.out.println("ָʾ------------------->" + ref_designator); + bean.setRef_designator(ref_designator); + //2017.10.26 C1-C3ijC1,C2,C3ĸʽ + String[] xx=ref_designator.split(","); + List ref_designator_list=new ArrayList<>(); + for (int k = 0; k < xx.length; k++) { + if(ref_designator_list.contains("-")) { + + String strings1=xx[k].split("-")[0];//Сֵ + String strings2=xx[k].split("-")[1];//ֵ + //ֵ + String up=""; + int up_num=0; + for (int j = strings2.length()-1;j>=0; j--) { + if(Character.isDigit(strings2.charAt(j))==true) { + up=strings2.charAt(j)+up; + }else { + break; + } + + } + up_num=Integer.valueOf(up); + //Сֵ + String down=""; + int down_num=0; + int mark=0; + for(int j = strings1.length()-1;j>=0; j--) { + if(Character.isDigit(strings1.charAt(j))==true) { + down=strings1.charAt(j)+down; + }else { + mark=j; + break; + } + } + down_num=Integer.valueOf(down); + //ͷλ + String wh=strings1.substring(0, mark+1); + for (int j = down_num; j <= up_num; j++) { + String aa=wh+j; + ref_designator_list.add(aa); + } + + + }else if(!ref_designator_list.contains("-")) { + ref_designator_list.add(xx[k]); + } + } + + + quantity = child.getTCProperty("bl_quantity").getStringValue().split(".")[0];//2017.10.26 ʾС +// if(Integer.valueOf(quantity)>3) { +// quantity=quantity+"-"; +// } + bean.setQuantity(quantity); + unit = child.getProperty("bl_uom"); + bean.setUnit(unit); + + //2017.10.18 + TCComponent[] components=child.getTCProperty("bl_substitute_list").getReferenceValueArray(); + if(components.length==0) { + bl_substitute_list=""; + }else if(components.length>0) { + for (int j = 0; j < components.length; j++) { + bl_substitute_list=bl_substitute_list+((TCComponentItem)components[j]).getTCProperty("item_id").getStringValue()+","; + } + } + if(bl_substitute_list.length()>=1) { + + bl_substitute_list=bl_substitute_list.trim(); + bl_substitute_list=bl_substitute_list.substring(0, bl_substitute_list.length()-1); + } + + bean.setBl_substitute_list(bl_substitute_list); + + list.add(bean); + if (child.getChildren().length > 0) { + getBomline(child,realNumber_0); + } + + } + } catch (TCException e) { + e.printStackTrace(); + } + + } +} diff --git a/icons/sample.gif b/icons/sample.gif new file mode 100644 index 0000000..34fb3c9 Binary files /dev/null and b/icons/sample.gif differ diff --git a/jason/commons-beanutils-1.7.0.jar b/jason/commons-beanutils-1.7.0.jar new file mode 100644 index 0000000..b1b89c9 Binary files /dev/null and b/jason/commons-beanutils-1.7.0.jar differ diff --git a/jason/commons-collections-3.2.jar b/jason/commons-collections-3.2.jar new file mode 100644 index 0000000..75580be Binary files /dev/null and b/jason/commons-collections-3.2.jar differ diff --git a/jason/commons-lang-2.4.jar b/jason/commons-lang-2.4.jar new file mode 100644 index 0000000..532939e Binary files /dev/null and b/jason/commons-lang-2.4.jar differ diff --git a/jason/commons-logging-1.1.jar b/jason/commons-logging-1.1.jar new file mode 100644 index 0000000..2ff9bbd Binary files /dev/null and b/jason/commons-logging-1.1.jar differ diff --git a/jason/ezmorph-1.0.4.jar b/jason/ezmorph-1.0.4.jar new file mode 100644 index 0000000..7625af6 Binary files /dev/null and b/jason/ezmorph-1.0.4.jar differ diff --git a/jason/fastjson-1.2.76.jar b/jason/fastjson-1.2.76.jar new file mode 100644 index 0000000..c241c1d Binary files /dev/null and b/jason/fastjson-1.2.76.jar differ diff --git a/jason/iText-5.0.2.jar b/jason/iText-5.0.2.jar new file mode 100644 index 0000000..ed95653 Binary files /dev/null and b/jason/iText-5.0.2.jar differ diff --git a/jason/iTextAsian.jar b/jason/iTextAsian.jar new file mode 100644 index 0000000..3fa2157 Binary files /dev/null and b/jason/iTextAsian.jar differ diff --git a/jason/itext-2.0.3.jar b/jason/itext-2.0.3.jar new file mode 100644 index 0000000..9c6179d Binary files /dev/null and b/jason/itext-2.0.3.jar differ diff --git a/jason/jdom.jar b/jason/jdom.jar new file mode 100644 index 0000000..65a1b3f Binary files /dev/null and b/jason/jdom.jar differ diff --git a/jason/json-lib-2.2.2-jdk15.jar b/jason/json-lib-2.2.2-jdk15.jar new file mode 100644 index 0000000..27e7c7c Binary files /dev/null and b/jason/json-lib-2.2.2-jdk15.jar differ diff --git a/jason/json-lib-2.2.3-jdk13.jar b/jason/json-lib-2.2.3-jdk13.jar new file mode 100644 index 0000000..a6513db Binary files /dev/null and b/jason/json-lib-2.2.3-jdk13.jar differ diff --git a/jason/okhttp-2.7.4.jar b/jason/okhttp-2.7.4.jar new file mode 100644 index 0000000..be7249f Binary files /dev/null and b/jason/okhttp-2.7.4.jar differ diff --git a/jason/okio-1.13.0.jar b/jason/okio-1.13.0.jar new file mode 100644 index 0000000..02c302f Binary files /dev/null and b/jason/okio-1.13.0.jar differ diff --git a/plugin.xml b/plugin.xml new file mode 100644 index 0000000..7aa39bf --- /dev/null +++ b/plugin.xml @@ -0,0 +1,1893 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/poilib/classes12.jar b/poilib/classes12.jar new file mode 100644 index 0000000..9eaf0b4 Binary files /dev/null and b/poilib/classes12.jar differ diff --git a/poilib/com.connor.getlsms_1.0.0.jar b/poilib/com.connor.getlsms_1.0.0.jar new file mode 100644 index 0000000..54c382c Binary files /dev/null and b/poilib/com.connor.getlsms_1.0.0.jar differ diff --git a/poilib/commons-codec-1.10.jar b/poilib/commons-codec-1.10.jar new file mode 100644 index 0000000..1d7417c Binary files /dev/null and b/poilib/commons-codec-1.10.jar differ diff --git a/poilib/commons-logging-1.1.jar b/poilib/commons-logging-1.1.jar new file mode 100644 index 0000000..2ff9bbd Binary files /dev/null and b/poilib/commons-logging-1.1.jar differ diff --git a/poilib/dom4j-1.6.1.jar b/poilib/dom4j-1.6.1.jar new file mode 100644 index 0000000..c8c4dbb Binary files /dev/null and b/poilib/dom4j-1.6.1.jar differ diff --git a/poilib/geronimo-stax-api_1.0_spec-1.0.jar b/poilib/geronimo-stax-api_1.0_spec-1.0.jar new file mode 100644 index 0000000..0d6d374 Binary files /dev/null and b/poilib/geronimo-stax-api_1.0_spec-1.0.jar differ diff --git a/poilib/jacob.jar b/poilib/jacob.jar new file mode 100644 index 0000000..6bdefa3 Binary files /dev/null and b/poilib/jacob.jar differ diff --git a/poilib/jcommon-1.0.12.jar b/poilib/jcommon-1.0.12.jar new file mode 100644 index 0000000..b46a2b6 Binary files /dev/null and b/poilib/jcommon-1.0.12.jar differ diff --git a/poilib/jfreechart-1.0.9.jar b/poilib/jfreechart-1.0.9.jar new file mode 100644 index 0000000..d1e2b74 Binary files /dev/null and b/poilib/jfreechart-1.0.9.jar differ diff --git a/poilib/jsr173_1.0_api.jar b/poilib/jsr173_1.0_api.jar new file mode 100644 index 0000000..fef9a9c Binary files /dev/null and b/poilib/jsr173_1.0_api.jar differ diff --git a/poilib/jxl_1.0.0.jar b/poilib/jxl_1.0.0.jar new file mode 100644 index 0000000..cb144e4 Binary files /dev/null and b/poilib/jxl_1.0.0.jar differ diff --git a/poilib/mailapi.jar b/poilib/mailapi.jar new file mode 100644 index 0000000..ab6365c Binary files /dev/null and b/poilib/mailapi.jar differ diff --git a/poilib/msbase.jar b/poilib/msbase.jar new file mode 100644 index 0000000..7d5f83e Binary files /dev/null and b/poilib/msbase.jar differ diff --git a/poilib/mssqlserver.jar b/poilib/mssqlserver.jar new file mode 100644 index 0000000..b14b1e2 Binary files /dev/null and b/poilib/mssqlserver.jar differ diff --git a/poilib/msutil.jar b/poilib/msutil.jar new file mode 100644 index 0000000..34c6ef1 Binary files /dev/null and b/poilib/msutil.jar differ diff --git a/poilib/ojdbc6.jar b/poilib/ojdbc6.jar new file mode 100644 index 0000000..ec3d6f1 Binary files /dev/null and b/poilib/ojdbc6.jar differ diff --git a/poilib/poi-3.9-20121203.jar b/poilib/poi-3.9-20121203.jar new file mode 100644 index 0000000..0f46288 Binary files /dev/null and b/poilib/poi-3.9-20121203.jar differ diff --git a/poilib/poi-examples-3.9-20121203.jar b/poilib/poi-examples-3.9-20121203.jar new file mode 100644 index 0000000..a364cc2 Binary files /dev/null and b/poilib/poi-examples-3.9-20121203.jar differ diff --git a/poilib/poi-excelant-3.9-20121203.jar b/poilib/poi-excelant-3.9-20121203.jar new file mode 100644 index 0000000..cb403fa Binary files /dev/null and b/poilib/poi-excelant-3.9-20121203.jar differ diff --git a/poilib/poi-ooxml-3.9-20121203.jar b/poilib/poi-ooxml-3.9-20121203.jar new file mode 100644 index 0000000..8792d46 Binary files /dev/null and b/poilib/poi-ooxml-3.9-20121203.jar differ diff --git a/poilib/poi-ooxml-schemas-3.9-20121203.jar b/poilib/poi-ooxml-schemas-3.9-20121203.jar new file mode 100644 index 0000000..eda4ef4 Binary files /dev/null and b/poilib/poi-ooxml-schemas-3.9-20121203.jar differ diff --git a/poilib/poi-scratchpad-3.9-20121203.jar b/poilib/poi-scratchpad-3.9-20121203.jar new file mode 100644 index 0000000..1520855 Binary files /dev/null and b/poilib/poi-scratchpad-3.9-20121203.jar differ diff --git a/poilib/smtp.jar b/poilib/smtp.jar new file mode 100644 index 0000000..2f4cec8 Binary files /dev/null and b/poilib/smtp.jar differ diff --git a/poilib/sqljdbc41.jar b/poilib/sqljdbc41.jar new file mode 100644 index 0000000..21d0d62 Binary files /dev/null and b/poilib/sqljdbc41.jar differ diff --git a/poilib/sqljdbc42.jar b/poilib/sqljdbc42.jar new file mode 100644 index 0000000..61b3463 Binary files /dev/null and b/poilib/sqljdbc42.jar differ diff --git a/poilib/xmlbeans-2.5.0.jar b/poilib/xmlbeans-2.5.0.jar new file mode 100644 index 0000000..c368fb2 Binary files /dev/null and b/poilib/xmlbeans-2.5.0.jar differ diff --git a/src/com/connor/jk/plm/Activator.java b/src/com/connor/jk/plm/Activator.java new file mode 100644 index 0000000..75a0372 --- /dev/null +++ b/src/com/connor/jk/plm/Activator.java @@ -0,0 +1,61 @@ +package com.connor.jk.plm; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "com.connor.jk.plm"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * Returns an image descriptor for the image file at the given + * plug-in relative path + * + * @param path the path + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } +} diff --git a/src/com/connor/jk/plm/Alarm/JK8WarnrNPINOAppForm_Action.java b/src/com/connor/jk/plm/Alarm/JK8WarnrNPINOAppForm_Action.java new file mode 100644 index 0000000..252b287 --- /dev/null +++ b/src/com/connor/jk/plm/Alarm/JK8WarnrNPINOAppForm_Action.java @@ -0,0 +1,28 @@ +package com.connor.jk.plm.Alarm; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.common.actions.AbstractAIFAction; + +public class JK8WarnrNPINOAppForm_Action extends AbstractAIFAction{ + + private AbstractAIFApplication app; + private String type; + public JK8WarnrNPINOAppForm_Action( AbstractAIFApplication arg0,String arg2) { + super(arg0, arg2); + this.type=arg2; + this.app=arg0; + + } + + @Override + public void run() { + + try { + JK8WarnrNPINOAppForm_Command command=new JK8WarnrNPINOAppForm_Command(type,app); + command.executeModal(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } +} diff --git a/src/com/connor/jk/plm/Alarm/JK8WarnrNPINOAppForm_Command.java b/src/com/connor/jk/plm/Alarm/JK8WarnrNPINOAppForm_Command.java new file mode 100644 index 0000000..c8815cd --- /dev/null +++ b/src/com/connor/jk/plm/Alarm/JK8WarnrNPINOAppForm_Command.java @@ -0,0 +1,37 @@ +package com.connor.jk.plm.Alarm; + +import java.text.SimpleDateFormat; +import java.util.Date; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.AbstractAIFCommand; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCSession; + +public class JK8WarnrNPINOAppForm_Command extends AbstractAIFCommand{ + + private AbstractAIFApplication app; + private InterfaceAIFComponent targetComp; + private TCSession session; + private String type; + + public JK8WarnrNPINOAppForm_Command(String type, AbstractAIFApplication app) { + this.app = app; + this.type=type; + this.targetComp = app.getTargetComponent(); + this.session = (TCSession) app.getSession(); + } + + @Override + public void executeModal() throws Exception { + super.executeModal(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss"); + String time=formatter.format(new Date()); + + System.out.println("------------------------------------"+time); + JK8WarnrNPINOAppForm_Operation operation = new JK8WarnrNPINOAppForm_Operation(type,time, session, + targetComp); + session.queueOperation(operation); + + } +} diff --git a/src/com/connor/jk/plm/Alarm/JK8WarnrNPINOAppForm_Handler.java b/src/com/connor/jk/plm/Alarm/JK8WarnrNPINOAppForm_Handler.java new file mode 100644 index 0000000..a8ec839 --- /dev/null +++ b/src/com/connor/jk/plm/Alarm/JK8WarnrNPINOAppForm_Handler.java @@ -0,0 +1,23 @@ +package com.connor.jk.plm.Alarm; + +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.aifrcp.AIFUtility; + +/** + * Ʒʶ + * */ +public class JK8WarnrNPINOAppForm_Handler extends AbstractHandler{ + + private String type="JK8WarnrNPINOAppForm"; + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + JK8WarnrNPINOAppForm_Action action=new JK8WarnrNPINOAppForm_Action(app, type); + new Thread(action).start(); + return null; + } +} diff --git a/src/com/connor/jk/plm/Alarm/JK8WarnrNPINOAppForm_Operation.java b/src/com/connor/jk/plm/Alarm/JK8WarnrNPINOAppForm_Operation.java new file mode 100644 index 0000000..cf73c06 --- /dev/null +++ b/src/com/connor/jk/plm/Alarm/JK8WarnrNPINOAppForm_Operation.java @@ -0,0 +1,55 @@ +package com.connor.jk.plm.Alarm; + +import com.teamcenter.rac.aif.AbstractAIFOperation; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponentFolder; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCComponentFormType; +import com.teamcenter.rac.kernel.TCComponentUser; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class JK8WarnrNPINOAppForm_Operation extends AbstractAIFOperation{ + + private String time; + private String type; + private TCSession session; + private InterfaceAIFComponent targetComp; + public JK8WarnrNPINOAppForm_Operation(String type,String time, TCSession session, + InterfaceAIFComponent targetComp) { + this.type=type; + this.time=time; + this.session=session; + this.targetComp = targetComp; + } + + @Override + public void executeOperation() throws Exception { + TCComponentFormType formType=(TCComponentFormType) session.getTypeComponent("Form"); + if(formType==null){ + System.out.println("formTypeΪ"); + } + String leiXin=""; + String name=""; + if("JK8WarnrNPINOAppForm".equals(type)){ + leiXin="Ʒʶɹ"; + name="Ʒʶ"; + } + + + + name=name+time; + TCComponentForm form=formType.create(name, "", type); + + if(targetComp instanceof TCComponentFolder){ + ((TCComponentFolder) targetComp).add("contents", form); + MessageBox.post(leiXin,"ɹ",MessageBox.INFORMATION); + }else{ + TCComponentUser user=this.session.getUser(); + TCComponentFolder newStuff=user.getNewStuffFolder(); + newStuff.add("contents", form); + MessageBox.post(leiXin+"\nNewStuffļ","ɹ",MessageBox.INFORMATION); + } + } + +} diff --git a/src/com/connor/jk/plm/Alarm/JK8_Alarm_Action.java b/src/com/connor/jk/plm/Alarm/JK8_Alarm_Action.java new file mode 100644 index 0000000..442071d --- /dev/null +++ b/src/com/connor/jk/plm/Alarm/JK8_Alarm_Action.java @@ -0,0 +1,29 @@ +package com.connor.jk.plm.Alarm; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.common.actions.AbstractAIFAction; +import com.teamcenter.rac.util.Registry; + +public class JK8_Alarm_Action extends AbstractAIFAction{ + private AbstractAIFApplication app; + private String type; + public JK8_Alarm_Action( AbstractAIFApplication arg0,String arg2) { + super(arg0, arg2); + this.type=arg2; + this.app=arg0; + + } + + @Override + public void run() { + + try { + JK8_Alarm_Command command=new JK8_Alarm_Command(type,app); + command.executeModal(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + +} diff --git a/src/com/connor/jk/plm/Alarm/JK8_Alarm_Command.java b/src/com/connor/jk/plm/Alarm/JK8_Alarm_Command.java new file mode 100644 index 0000000..ae83573 --- /dev/null +++ b/src/com/connor/jk/plm/Alarm/JK8_Alarm_Command.java @@ -0,0 +1,45 @@ +package com.connor.jk.plm.Alarm; + +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.AbstractAIFCommand; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCSession; + +public class JK8_Alarm_Command extends AbstractAIFCommand { + private AbstractAIFApplication app; + private InterfaceAIFComponent targetComp; + private TCSession session; + private String type; + + public JK8_Alarm_Command(String type, AbstractAIFApplication app) { + this.app = app; + this.type=type; + this.targetComp = app.getTargetComponent(); + this.session = (TCSession) app.getSession(); + } + + @Override + public void executeModal() throws Exception { + super.executeModal(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss"); + String time=formatter.format(new Date()); +// Calendar calendar = Calendar.getInstance(); +// String year = String.valueOf(calendar.get(Calendar.YEAR));// ȡ +// String month = String.valueOf(calendar.get(Calendar.MONTH) + 1);// ȡ· +// String day = String.valueOf(calendar.get(Calendar.DATE));// ȡ +// String time = String.valueOf(calendar.get(Calendar.HOUR_OF_DAY)) +// + String.valueOf(calendar.get(Calendar.MINUTE)) +// + String.valueOf(calendar.get(Calendar.SECOND));// ȡ + //String name ="Ʒͺʶ"+ time; + System.out.println("------------------------------------"+time); + JK8_Alarm_Operation operation = new JK8_Alarm_Operation(type,time, session, + targetComp); + session.queueOperation(operation); + + } + +} diff --git a/src/com/connor/jk/plm/Alarm/JK8_Alarm_Handler.java b/src/com/connor/jk/plm/Alarm/JK8_Alarm_Handler.java new file mode 100644 index 0000000..87c1eb5 --- /dev/null +++ b/src/com/connor/jk/plm/Alarm/JK8_Alarm_Handler.java @@ -0,0 +1,25 @@ +package com.connor.jk.plm.Alarm; + +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.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCSession; + +/* + * Ʒͺʶ + * */ +public class JK8_Alarm_Handler extends AbstractHandler { + + private String type="JK8WarnrModINAppForm"; // JK8ALPModAppForm JK8WarnerNPModINOAppForm + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + JK8_Alarm_Action action=new JK8_Alarm_Action(app, type); + new Thread(action).start(); + return null; + } + +} diff --git a/src/com/connor/jk/plm/Alarm/JK8_Alarm_Operation.java b/src/com/connor/jk/plm/Alarm/JK8_Alarm_Operation.java new file mode 100644 index 0000000..0a94ae8 --- /dev/null +++ b/src/com/connor/jk/plm/Alarm/JK8_Alarm_Operation.java @@ -0,0 +1,54 @@ +package com.connor.jk.plm.Alarm; + +import com.teamcenter.rac.aif.AbstractAIFOperation; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponentFolder; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCComponentFormType; +import com.teamcenter.rac.kernel.TCComponentUser; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class JK8_Alarm_Operation extends AbstractAIFOperation{ + private String time; + private String type; + private TCSession session; + private InterfaceAIFComponent targetComp; + public JK8_Alarm_Operation(String type,String time, TCSession session, + InterfaceAIFComponent targetComp) { + this.type=type; + this.time=time; + this.session=session; + this.targetComp = targetComp; + } + + @Override + public void executeOperation() throws Exception { + TCComponentFormType formType=(TCComponentFormType) session.getTypeComponent("Form"); + if(formType==null){ + System.out.println("formTypeΪ"); + } + String leiXin=""; + String name=""; + if("JK8WarnrModINAppForm".equals(type)){ + leiXin="²Ʒͺɹ"; + name="²Ʒͺ"; + } + + + + name=name+time; + TCComponentForm form=formType.create(name, "", type); + + if(targetComp instanceof TCComponentFolder){ + ((TCComponentFolder) targetComp).add("contents", form); + MessageBox.post(leiXin,"ɹ",MessageBox.INFORMATION); + }else{ + TCComponentUser user=this.session.getUser(); + TCComponentFolder newStuff=user.getNewStuffFolder(); + newStuff.add("contents", form); + MessageBox.post(leiXin+"\nNewStuffļ","ɹ",MessageBox.INFORMATION); + } + } + +} diff --git a/src/com/connor/jk/plm/DbomToEbom/ChangeDbomBean.java b/src/com/connor/jk/plm/DbomToEbom/ChangeDbomBean.java new file mode 100644 index 0000000..eb65eca --- /dev/null +++ b/src/com/connor/jk/plm/DbomToEbom/ChangeDbomBean.java @@ -0,0 +1,119 @@ +package com.connor.jk.plm.DbomToEbom; + +import java.util.List; + +import com.teamcenter.rac.kernel.TCComponentItemRevision; + +public class ChangeDbomBean { + + private ChangeDbomBean parentBean;// һ + private ChangeDbomBean designBean;// ͼֽ + private List materialRevS; + private List childBeanS; + private TCComponentItemRevision rev;// Ĭϵitemrevision汾 + private TCComponentItemRevision selectRev;// ѡеitemrevision汾 + private String DisplayName; + private String QTY;// + private String QUERY;// + + public String getQTY() { + return QTY; + } + + public void setQTY(String qTY) { + QTY = qTY; + } + + public String getQUERY() { + return QUERY; + } + + public void setQUERY(String qUERY) { + QUERY = qUERY; + } + + public TCComponentItemRevision getRev() { + return rev; + } + + /** + * + * + * @param rev + */ + public void setRev(TCComponentItemRevision rev) { + this.rev = rev; + if (rev != null) { + try { +// this.DisplayName = rev.getStringProperty("object_string")+"&"+rev.getStringProperty("object_desc"); + this.DisplayName = rev.getStringProperty("object_string"); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + public TCComponentItemRevision getSelectRev() { + return selectRev; + } + + public void setSelectRev(TCComponentItemRevision selectRev) { + this.selectRev = selectRev; + + } + + public List getMaterialRevS() { + return materialRevS; + } + + public void setMaterialRevS(List materialRevS) { + this.materialRevS = materialRevS; + if (materialRevS != null && materialRevS.size() > 0) { + this.selectRev = materialRevS.get(0).getRev(); + } + } + public List getChildBeanS() { + return childBeanS; + } + + public void setChildBeanS(List childBeanS) { + this.childBeanS = childBeanS; + } + + public String getDisplayName() { + return DisplayName; + } + + + public void setDisplayName(String displayName) { + DisplayName = displayName; + } + + public ChangeDbomBean getParentBean() { + return parentBean; + } + + public void setParentBean(ChangeDbomBean parentBean) { + this.parentBean = parentBean; + } + + public ChangeDbomBean getDesignBean() { + return designBean; + } + + public void setDesignBean(ChangeDbomBean designBean) { + this.designBean = designBean; + } + + public ChangeDbomBean() { + + } + + @Override + public String toString() { + // return "Joyoung011Bean [DisplayName=" + DisplayName + "]"; + return DisplayName; + } + +} + diff --git a/src/com/connor/jk/plm/DbomToEbom/ChangeDbomCommand.java b/src/com/connor/jk/plm/DbomToEbom/ChangeDbomCommand.java new file mode 100644 index 0000000..e96b39d --- /dev/null +++ b/src/com/connor/jk/plm/DbomToEbom/ChangeDbomCommand.java @@ -0,0 +1,306 @@ +package com.connor.jk.plm.DbomToEbom; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.AbstractAIFCommand; +import com.teamcenter.rac.aif.kernel.AIFComponentContext; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponentBOMLine; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class ChangeDbomCommand extends AbstractAIFCommand { + private AbstractAIFApplication app; + private TCSession session; + private ChangeDbomBean bean; + public static final String JY_BOM_QUERY_NO = "bl_sequence_no";// + public static final String JY_BOM_COUNT_NO = "bl_quantity";// + public static boolean isOk = false;// ж + private ProgressBarThread pro = null; + private boolean isRelease=true; + + public ChangeDbomCommand(AbstractAIFApplication app, TCSession session) { + this.app = app; + this.session = session; + this.bean = new ChangeDbomBean(); + } + + @Override + public void executeModal() throws Exception { + + execCommand(); + } + + String doesNotRelease=""; + private void execCommand() { + System.out.println("ʼ"); + InterfaceAIFComponent comp = this.app.getTargetComponent(); + // жѡеĶǷǶbomline + if (comp instanceof TCComponentBOMLine) { + checkWL((TCComponentBOMLine) comp); + if (mark == 1 & num_1 == 9) { + System.out.println("1˴˳"); + MessageBox.post("ȷBOMѾת","",MessageBox.INFORMATION); + return; + } + if (isRelease==false & num_1 == 9) { + MessageBox.post("ȷ\n"+doesNotRelease+"в㼶DBOMѾ","",MessageBox.ERROR); + return; + } +// if (!noSon.equals("")) { +// MessageBox.post("ȷͼֽ\n" + noSon, "ע", MessageBox.INFORMATION); +// return; +// } + pro = new ProgressBarThread("б", "ȡУԵ..."); + pro.start(); + ChangeDbomDialog dialog=null; + try { + dialog = new ChangeDbomDialog(this.bean, this.app, this.session, this.pro, this,((TCComponentBOMLine) comp).getItemRevision()); + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + new Thread(dialog).start(); + } else { + MessageBox.post("ͼѡbomline²", "", MessageBox.ERROR); + return; + } + } + + private void checkWL(TCComponentBOMLine line) { + if (line == null) { + System.out.println("2˴˳"); + return; + } + bean.setParentBean(null); + + checkBomLine(line, bean);// 顰ʾαļ޹ + if (mark == 1 & num_1 == 9) { + System.out.println("3˴˳"); + return; + } + if (isRelease==false & num_1 == 9) { +// MessageBox.post("DBOMǷѾ","",MessageBox.INFORMATION); + return; + } + } + + int mark = 0;// ,Ϊ1Ƕ + int num_1 = 0; + String noSon = ""; + boolean has = true;// ǵǰͼֽǷϣ + + private void checkBomLine(TCComponentBOMLine line, ChangeDbomBean bean) { + has = true; + //жdbomǷѾ + TCComponentItemRevision componentItemRevision; + try { + + componentItemRevision=line.getItemRevision(); + if(componentItemRevision.getReferenceListProperty("release_status_list").length==0){//ûз + num_1 = 9; + isRelease=false; + mark++; + doesNotRelease=doesNotRelease+componentItemRevision.getTCProperty("item_id").getStringValue()+"\n"; + return; + } + } catch (Exception e1) { + e1.printStackTrace(); + } + mark++; + try { + if (line == null) { + return; + } + // ϵԼϣJoyoung011Beanitemrevisiondesignbeanԣ + List materialList = new ArrayList<>(); + // bomlinelineļϣJoyoung011Beandesignbeanԣ + List childBeanS = new ArrayList<>(); + bean.setChildBeanS(childBeanS); + + bean.setRev(line.getItemRevision());// õǰ汾 + bean.setQTY(line.getProperty(JY_BOM_COUNT_NO));// + bean.setQUERY(line.getProperty(JY_BOM_QUERY_NO));// ñ + + // ȡǰµĹ +// if(line.getItemRevision().getTCProperty("item_id").getStringValue().equals("ASM00000165")) { +// AIFComponentContext[] aifContext1 = line.getItemRevision().whereReferencedByTypeRelation( +// new String[] { "JK8LSMaterialRevision", "JK8MaterialRevision" }, +// new String[] { "TC_Is_Represented_By" }); +// } + AIFComponentContext[] aifContext = line.getItemRevision().whereReferencedByTypeRelation( + new String[] { "JK8LSMaterialRevision", "JK8MaterialRevision" }, + new String[] { "TC_Is_Represented_By" }); +// AIFComponentContext[] newAifContext=null; + Map map=new HashMap<>(); + for (int i = 0; i < aifContext.length; i++) { + String key=((TCComponentItemRevision)aifContext[i].getComponent()).getTCProperty("item_id").getStringValue()+"/"+((TCComponentItemRevision)aifContext[i].getComponent()).getTCProperty("current_revision_id").getStringValue(); + System.out.println("key---->"+key); + AIFComponentContext value=aifContext[i]; + TCComponentItemRevision revision =(TCComponentItemRevision)aifContext[i].getComponent(); + if(map.containsKey(key)) { + int numNew=Integer.valueOf(revision.getProperty("sequence_id")); + int numOld=Integer.valueOf(((TCComponentItemRevision)map.get(key).getComponent()).getProperty("sequence_id")); + if(numNew>numOld) { + + map.put(key, value); + } + }else { + map.put(key, value); + } + + } + aifContext=new AIFComponentContext[map.size()]; + int num=0; + for(AIFComponentContext context:map.values()) { + aifContext[num]=context; + num++; + } + + // ûйϣϺΪգУͷitemrevisionϲbean + ChangeDbomBean beanT; + // BOMΪգͲ + if (mark == 1 & aifContext.length == 0) { + MessageBox.post("װͼǷ", "", MessageBox.ERROR); + num_1 = 9; + return; + } + // TODO 鶥BOMǷΪE-U8 +// for (int i = 0; i < aifContext.length; i++) { +// if(mark==1){ +// if(!((TCComponentItemRevision)aifContext[i].getComponent()).getTCProperty("item_id").getStringValue().startsWith("E-8")){ +// num_1 = 9; +// MessageBox.post("װͼǷE-U8룬ѡװͼDBOMתEBOM","",MessageBox.ERROR); +// return; +// } +// } +// } + if (aifContext == null || aifContext.length == 0) { + has = false; + } else { + List edition = new ArrayList<>();//еİ汾 + String[] edi; + + for (AIFComponentContext context : aifContext) { + edi = context.getComponent().toString().split(";"); + edition.add(edi[0]); + System.out.println("edition--------->"+edition); + } + + String edi2; + String edi3; + + int edi4; + int edi5; + HashSet edition_2 = new HashSet<>();//ͬһIJͬ汾 + if (edition.size() > 1) { + for (int i = 0; i < edition.size(); i++) { + edi2 = edition.get(i).split("/")[0];// ID + for (int j = 1; j < edition.size(); j++) { + edi3 = edition.get(j).split("/")[0]; + if (edi2.equals(edi3)) {//item_idͬȽϰ汾 + edi4 = Integer.valueOf(edition.get(i).split("/")[1]);// 汾 + edi5 = Integer.valueOf(edition.get(j).split("/")[1]); + if (edi4> edi5) {//ȡϵа汾 + edition_2.add(edition.get(j)); + } else if (edi4< edi5) { + edition_2.add(edition.get(i)); + } + + } + } + } + } +// String edi4; +// String edi5; +// +// HashSet edition_2 = new HashSet<>(); +// if (edition.size() > 1) { +// for (int i = 0; i < edition.size(); i++) { +// edi2 = edition.get(i).split("/")[0];// ID +// for (int j = 1; j < edition.size(); j++) { +// edi3 = edition.get(j).split("/")[0]; +// if (edi2.equals(edi3)) { +// edi4 = edition.get(i).split("/")[1];// 汾 +// edi5 = edition.get(j).split("/")[1]; +// if ((edi4.charAt(0) + 0) > (edi5.charAt(0) + 0)) { +// edition_2.add(edition.get(j)); +// } else if ((edi4.charAt(0) + 0) < (edi5.charAt(0) + 0)) { +// edition_2.add(edition.get(i)); +// } +// +// } +// } +// } +// } + + + + + String temp2 = null; + for (String string : edition_2) { + temp2 = string; + if (edition.contains(string)) { + edition.remove(temp2);//ȥͬһ汾еϰ汾 + } + } + + //ӽ˵汾ͬУ汾ֻͬµİ汾 + + for (AIFComponentContext context : aifContext) { + for (int i = 0; i < edition.size(); i++) { + String comp = edition.get(i); + String comp2 = context.getComponent().toString().split(";")[0]; + if (comp.equals(comp2)) { + beanT = new ChangeDbomBean(); + beanT.setRev((TCComponentItemRevision) context.getComponent()); + beanT.setDesignBean(bean);// ͼֽbean˵ϲbean + materialList.add(beanT); + } + } + } + // if (mark > 1) { + // beanT = new ChangeDbomBean();// һ + // beanT.setRev(null); + // beanT.setDesignBean(bean); + // materialList.add(beanT); + // } + + } +// if(has == false &&line.getItemRevision().getTCProperty("item_id").getStringValue().equals("ASM00000165")) { +// System.out.println("ASM00000165"+"has==false"); +// } + bean.setMaterialRevS(materialList);// õǰbomlineصϼ + // ǰbomlineµline + AIFComponentContext[] contexts = line.getChildren(); + // ǰbomline»²line,ȴûйϣ + if (has == false && contexts.length > 0) { + noSon = noSon + line.getItemRevision().getTCProperty("object_name")+"("+line.getItemRevision().getTCProperty("item_id")+")"+"\n"; + has = true; +// if(line.getItemRevision().getTCProperty("item_id").getStringValue().equals("ASM00000165")) { +// System.out.println("ASM00000165"); +// } + } + for (AIFComponentContext context : contexts) { + TCComponentBOMLine line2 = (TCComponentBOMLine) context.getComponent(); + + ChangeDbomBean childBean = new ChangeDbomBean(); + childBean.setParentBean(bean);// ϲʵ + childBeanS.add(childBean); + checkBomLine(line2, childBean); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + +} diff --git a/src/com/connor/jk/plm/DbomToEbom/ChangeDbomDialog.java b/src/com/connor/jk/plm/DbomToEbom/ChangeDbomDialog.java new file mode 100644 index 0000000..8e90cb2 --- /dev/null +++ b/src/com/connor/jk/plm/DbomToEbom/ChangeDbomDialog.java @@ -0,0 +1,332 @@ +package com.connor.jk.plm.DbomToEbom; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Toolkit; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.List; +import javax.swing.DefaultComboBoxModel; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.kernel.TCComponentBOMLine; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; + +public class ChangeDbomDialog extends AbstractAIFDialog implements + ActionListener, ItemListener { + public static ChangeDbomBean firstBean; + private AbstractAIFApplication app; + private TCSession session; + private int index; + private int fuliao; + + private JButton celBtn; + private JButton MBOMBtn; + private JButton inputBtn; + + private ProgressBarThread wait; + private ProgressBarThread pro; + private ChangeDbomCommand command; + private PropertyLayout pl; + private TCComponentItemRevision tcComponentItemRevision; + + public ChangeDbomDialog(ChangeDbomBean firstBean, + AbstractAIFApplication app, TCSession session, + ProgressBarThread pro, ChangeDbomCommand command, TCComponentItemRevision tcComponentItemRevision) { + super(false); + this.firstBean = firstBean; + this.app = app; + this.session = session; + this.pro = pro; + this.command = command; + this.index = 1; + this.fuliao = 0; + this.tcComponentItemRevision=tcComponentItemRevision; + } + + public ChangeDbomDialog() { + super(false); + } + + /** + * ť + */ + private void addActionListenEvent() { + celBtn.addActionListener(this); + inputBtn.addActionListener(this); + MBOMBtn.addActionListener(this); + + } + + @Override + public void run() { + initUI(); + this.pro.setBool(true); + } + + /** + * + */ + private JPanel bottomJPanel; + private JPanel midJPanel; +// private JPanel rootJPanel; + + public void initUI() { + this.setTitle("DBOMתEBOM"); + Dimension screensize = Toolkit.getDefaultToolkit().getScreenSize(); + int x = 1200; + int y = 500; + this.setBounds((int) screensize.getWidth() / 2 - x / 2, + (int) screensize.getHeight() / 2 - y / 2, x, y); + pl = new PropertyLayout(10, 1);// öԻм + pl.setRightMargin(0); + +// midJPanel = new JPanel(pl); + midJPanel = new JPanel(new PropertyLayout()); + setMidPanel(midJPanel, firstBean, 0);// BOMתľƷ + + MBOMBtn = new JButton("EBOM"); + celBtn = new JButton("ȡ"); + inputBtn = new JButton(""); + + bottomJPanel = new JPanel(new FlowLayout()); + bottomJPanel.add(new JLabel(" ")); + bottomJPanel.add(inputBtn); + bottomJPanel.add(new JLabel(" ")); + bottomJPanel.add(celBtn); + bottomJPanel.add(new JLabel(" ")); + bottomJPanel.add(MBOMBtn); + bottomJPanel.add(new JLabel(" ")); + + // rootJPanel = new JPanel(new BorderLayout()); + this.setLayout(new BorderLayout()); + // this.add(rootJPanel,BorderLayout.CENTER); + this.add(new JScrollPane(midJPanel), BorderLayout.CENTER); + this.add(bottomJPanel, BorderLayout.SOUTH); + + addActionListenEvent(); + + // this.setSize(new Dimension(500, 500)); + // this.centerToScreen(); + // this.setEnabled(true); + this.setFocusable(true); + // setAlwaysOnTop(true); + + // this.showDialog(); + setVisible(true); + } + + public void refreshUI() { + this.index = 1; + this.fuliao = 0; + setMidPanel(midJPanel, firstBean, 0);// BOMתľƷ + + } + + boolean isUniqle; + int hanzi = 0; + + public void setMidPanel(JPanel midJPanel, ChangeDbomBean bean, int index2) { + isUniqle = false; + // bomlineеΪգǾ˳ + if (bean == null) { + return; + } + if (index2 == 0) { + midJPanel.removeAll(); + } + // bomlineϼϲΪգϼԪظֹһ + // бԪ + if (bean.toString() != null && bean.getMaterialRevS().size() == 2 + && bean.getMaterialRevS().get(1).toString() == null) { + isUniqle = true;// ͼֻֽһϣҲһһĹϵ + } + // Էǿ + if (isUniqle == false && bean.getMaterialRevS().size() >= 1) { + midJPanel.add(this.index + ".1.left.top.preferred.preferred", + new JLabel(" ")); + midJPanel.add(this.index + ".1.left.top.preferred.preferred", + new JLabel(" ")); + if (bean.toString() == null) { + fuliao++; + String null_string = "-------------------------------" + + "--------------------------------------"; + midJPanel + .add(this.index + ".2.left.top.preferred.preferred", + new JLabel(" " + fuliao + )); + midJPanel.add(this.index + ".3.left.top.preferred.preferred", + new JLabel(null_string.substring(0, 40 - 1 * hanzi)+ "--------->" + )); + } else { + + midJPanel.add(this.index + ".2.left.top.preferred.preferred", + new JLabel("ͼֽ")); + String new_string = bean.toString().split("&")[0] + + "-------------------------------" + + "----------------------"; + char[] c = new_string.toCharArray(); + hanzi = 0; + for (int i = 0; i < c.length; i++) { + String len = Integer.toBinaryString(c[i]); + if (len.length() > 8) + hanzi++; + } + + midJPanel.add(this.index + ".3.left.top.preferred.preferred", + new JLabel(new_string.substring(0, 36) + + "--->")); + + } + midJPanel.add(this.index + ".4.left.top.preferred.preferred", + new JLabel("ϣ")); + + // б + JComboBox comBox = new JComboBox( + new DefaultComboBoxModel( + (bean.getMaterialRevS()) + .toArray(new ChangeDbomBean[bean + .getMaterialRevS().size()]))); + midJPanel.add(this.index + ".5.left.top.preferred.preferred", + comBox); + comBox.addItemListener(this); + + midJPanel.add(this.index + ".6.left.top.preferred.preferred", + new JLabel(" ")); + this.index++; + midJPanel.add(this.index + ".1.left.top.preferred.preferred", + new JLabel(" ")); + this.index++; + } + // Ϊ + else if (isUniqle == false && bean.getMaterialRevS().size() == 0) { + midJPanel.add(this.index + ".1.left.top.preferred.preferred", + new JLabel(" ")); + midJPanel.add(this.index + ".1.left.top.preferred.preferred", + new JLabel(" ")); + midJPanel.add(this.index + ".2.left.top.preferred.preferred", + new JLabel("ͼֽ")); + String new_string = bean.toString().split("&")[0] + + "-------------------------------" + + "----------------------"; + char[] c = new_string.toCharArray(); + hanzi = 0; + for (int i = 0; i < c.length; i++) { + String len = Integer.toBinaryString(c[i]); + if (len.length() > 8) + hanzi++; + } + midJPanel + .add(this.index + ".3.left.top.preferred.preferred", + new JLabel(new_string.substring(0, 40 - 2 * hanzi) + + "--->")); + midJPanel.add(this.index + ".4.left.top.preferred.preferred", + new JLabel("")); + midJPanel.add(this.index + ".5.left.top.preferred.preferred", + new JLabel(" ")); + midJPanel.add(this.index + ".6.left.top.preferred.preferred", + new JLabel(" ")); + this.index++; + midJPanel.add(this.index + ".1.left.top.preferred.preferred", + new JLabel(" ")); + this.index++; + } + + // ȡlineʵ༯ϣΪգ + // Ҳװͼıͼ + List beanList = bean.getChildBeanS(); + if (beanList != null) + for (int i = 0; i < beanList.size(); i++) { + ChangeDbomBean beanT = beanList.get(i); + + setMidPanel(midJPanel, beanT, 1); + } + } + + @Override + public void actionPerformed(ActionEvent arg0) { + Object sourceObj = arg0.getSource(); + if (sourceObj.equals(MBOMBtn)) { + try { + System.out.println(firstBean.getSelectRev().toString()); + System.out.println(firstBean.getRev().toString()); + if(firstBean.getSelectRev().getTCProperty("release_status_list").getReferenceValueArray().length>0) { + isOrNot=false; + System.out.println("EBOMѾ"); + } + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + if(isOrNot==false) { + this.setAlwaysOnTop(false); + MessageBox.post("DBOMEBOMѷ뽫EBOMͼֽٽת","",MessageBox.INFORMATION); + }else { + + this.setVisible(false); + this.wait = new ProgressBarThread("DBOMתMBOM", "תУԵ..."); + this.wait.start(); + + ChangeDbomOperation operation = new ChangeDbomOperation(firstBean, + this.wait, this); + this.session.queueOperation(operation); + } + } else if (sourceObj.equals(celBtn)) { + this.disposeDialog(); + this.dispose(); + } else if (sourceObj.equals(inputBtn)) { + ChangeDbomDialogInput input = new ChangeDbomDialogInput(session, + this); + new Thread(input).start(); + this.setVisible(false); + } + + } + + private boolean isOrNot=true; + @Override + public void itemStateChanged(ItemEvent arg0) { + this.setAlwaysOnTop(true); + System.out.println("ѡ" + arg0.getItem() + ""); + if (arg0.getStateChange() == ItemEvent.SELECTED) { + + ChangeDbomBean item = null; + if (arg0.getItem() != null) + item = (ChangeDbomBean) arg0.getItem(); + else + return; + item.getDesignBean().setSelectRev(item.getRev()); + //TODO EBOMѾͲҪת + try { + if(item.getDesignBean().getRev().getTCProperty("item_id").getStringValue().equals(tcComponentItemRevision.getTCProperty("item_id").getStringValue())) { + System.out.println("bongo"); + //ѾͲת + if(item.getDesignBean().getSelectRev().getTCProperty("release_status_list").getReferenceValueArray().length>0) { + + isOrNot=false; +// MessageBox.post("DBOMEBOMѷ뽫EBOMͼֽٽת","",MessageBox.INFORMATION); + }else { + isOrNot=true; + } + + } + } catch (TCException e) { + e.printStackTrace(); + } + + + } + } +} diff --git a/src/com/connor/jk/plm/DbomToEbom/ChangeDbomDialogInput.java b/src/com/connor/jk/plm/DbomToEbom/ChangeDbomDialogInput.java new file mode 100644 index 0000000..f84b335 --- /dev/null +++ b/src/com/connor/jk/plm/DbomToEbom/ChangeDbomDialogInput.java @@ -0,0 +1,389 @@ +package com.connor.jk.plm.DbomToEbom; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.util.ArrayList; +import java.util.List; + +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.JTextField; +import javax.swing.ListSelectionModel; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; +import javax.swing.table.DefaultTableModel; +import javax.swing.text.BadLocationException; +import javax.swing.text.Document; + +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; + +public class ChangeDbomDialogInput extends AbstractAIFDialog implements + ActionListener, DocumentListener { + public static final String JY_BOM_QUERY_NO = "bl_sequence_no";// + public static final String JY_BOM_COUNT_NO = "bl_quantity";// + private TCSession session; + private JLabel zero; + private JLabel ID; + private JTextField idField; + + private JButton queryButton; + private JButton celButton; + public static JButton inputButton; + + private TCComponentItemRevision itemRevision; + private TCComponentItemRevision selectedItemRevision; + public static String selectedId; + private List itemRevisionT = new ArrayList<>(); + + private JPanel upJPanel; + private JPanel downJPanel; + private JPanel centerJPanel; + private JTable dataTable; + + private int index2 = 0; + private int index3 = 0; + + private ChangeDbomDialog dbDialog; + + ProgressBarThread wait; + boolean isRefresh=false; + + public ChangeDbomDialogInput(TCSession session, ChangeDbomDialog dbDialog) { + this.session = session; + this.dbDialog = dbDialog; + } + + public ChangeDbomDialogInput(ChangeDbomDialog dbDialog, boolean isRefresh, TCSession session, List itemList, + InterfaceAIFComponent[] comps0, TCComponentItemRevision itemRevision, + List itemRevisionT) { + this.dbDialog=dbDialog; + this.isRefresh=isRefresh; + this.session=session; + this.itemList=itemList; + this.comps0=comps0; + this.itemRevision=itemRevision; + this.itemRevisionT=itemRevisionT; + + } + Document doc; + private void initUI() { + this.setTitle(""); + this.setSize(new Dimension(300, 300)); + zero = new JLabel(""); + ID = new JLabel(" ID "); + idField = new JTextField(12); + //Ƶı + this.addWindowListener( new WindowAdapter() { + public void windowOpened( WindowEvent e ){ + idField.requestFocus(); + } + }); + //ıݽм + //ȡ༭ģ + doc = idField.getDocument(); + //DocumentListener + doc.addDocumentListener(this); + + upJPanel = new JPanel(new PropertyLayout()); + upJPanel.add("1.1.left.top", this.zero); + upJPanel.add("2.1.left.top", this.ID); + upJPanel.add("2.2.left.top", this.idField); + upJPanel.add("3.1.left.top", this.zero); + + centerJPanel = new JPanel(new FlowLayout()); + setCenterJPanel(centerJPanel, itemList); + centerJPanel.add(new JScrollPane(this.dataTable), BorderLayout.CENTER); + + queryButton = new JButton("ѯ"); + queryButton.setEnabled(false); +// this.getRootPane().setDefaultButton(queryButton);//õǰĬѡаť + queryButton.addActionListener(this); + celButton = new JButton("ȡ"); + celButton.addActionListener(this); + inputButton = new JButton(""); + inputButton.setEnabled(false); + inputButton.addActionListener(this); + downJPanel = new JPanel(new FlowLayout()); + downJPanel.add(queryButton); + downJPanel.add(new JLabel(" ")); + downJPanel.add(celButton); + downJPanel.add(new JLabel(" ")); + downJPanel.add(inputButton); + JPanel rootJPanel = new JPanel(new BorderLayout()); + rootJPanel.add(upJPanel, BorderLayout.NORTH); + rootJPanel.add(new JScrollPane(centerJPanel), BorderLayout.CENTER); + rootJPanel.add(downJPanel, BorderLayout.SOUTH); + + this.add(rootJPanel); + this.pack(); + this.showDialog(); + + } + + @Override + public void run() { + this.setAlwaysOnTop(true); + initUI(); + } + String searchId=""; + @Override + public void actionPerformed(ActionEvent arg0) { + Object sourceObj = arg0.getSource(); + if (sourceObj.equals(queryButton)) { + if(idField.getText().trim().equals("")){ + inputButton.setEnabled(false); +// this.setAlwaysOnTop(false); + itemList = new ArrayList<>(); + itemList.add(null); + isRefresh=true; + setCenterJPanel(centerJPanel, itemList); +// MessageBox.post("","",MessageBox.ERROR); + }else{ + inputButton.setEnabled(false); + this.setVisible(false); + searchId=idField.getText().trim().equals("")?"*":idField.getText().trim(); + this.wait=new ProgressBarThread("ִ", "ݲѯУԵ..."); + InputOperation ope=new InputOperation(dbDialog,isRefresh,wait,itemList,comps0,session,itemRevision,itemRevisionT,searchId); + this.session.queueOperation(ope); +// search1(); +// setCenterJPanel(centerJPanel, itemList); + } + } else if (sourceObj.equals(celButton)) { + this.disposeDialog(); + this.dispose(); + this.dbDialog.refreshUI(); + this.dbDialog.setVisible(true); + } else if (sourceObj.equals(inputButton)) { + this.disposeDialog(); + this.dispose(); + inputbtn(); + } + + } + + public void inputbtn() { + try { + comps0 = ChangeDbomUtil.searchComponentsCollection(session, + " ID", new String[] { " ID" }, + new String[] { selectedId }); + selectedItemRevision = ((TCComponentItem) comps0[0]) + .getLatestItemRevision(); + ChangeDbomBean bean = new ChangeDbomBean(); + + ChangeDbomBean childBean = new ChangeDbomBean(); + childBean.setRev(selectedItemRevision); + childBean.setDesignBean(bean); + List materialRevS = new ArrayList<>(); + materialRevS.add(childBean); + + // һ +// ChangeDbomBean childBean_1 = new ChangeDbomBean(); +// childBean_1.setRev(null); +// childBean_1.setDesignBean(bean); +// materialRevS.add(childBean_1); + + bean.setMaterialRevS(materialRevS); + ChangeDbomDialog.firstBean.getChildBeanS().add(bean); + + this.dbDialog.refreshUI(); + this.dbDialog.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + + } + + private List itemList = new ArrayList<>(); + private InterfaceAIFComponent[] comps0 = null;// 븨ǰĸIDѯ + + + +// private void search1(){ +// inputButton.setEnabled(false); +// itemList = new ArrayList<>(); +// comps0 = ChangeDbomUtil.searchComponentsCollection(session, +// " ID", new String[] { " ID" }, +// new String[] { idField.getText().trim().equals("")?"*":idField.getText().trim() }); +// if(comps0.length > 0){ +// try { +// for (int j = 0; j < comps0.length; j++) { +// itemRevision = ((TCComponentItem) comps0[j]) +// .getLatestItemRevision(); +// +// itemList.add(itemRevision); +// itemRevisionT.add(itemRevision); +// } +// } catch (Exception e) { +// e.printStackTrace(); +// } +// } +// else { +// itemList.add(null); +// MessageBox.post("ûIJѯ", "ʾ", MessageBox.WARNING); +// } +// } + + + // JTable + DefaultTableModel model = new DefaultTableModel(); + + public void setCenterJPanel(JPanel centerJPanel, + List itemList) { + if (itemList == null&&isRefresh==true) { + return; + } + this.dataTable = new JTable() { + + @Override + public boolean isCellEditable(int row, int column) { + boolean isEditor = false;// òɱ༭ + return isEditor; + } + + }; + + dataTable.setEnabled(true); + dataTable.setModel(model); + dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);//Ŀֻܵѡ + if (index2 == 0) { + String[] columnNameS = new String[] { "ID", "汾", "", "" }; + for (String name : columnNameS) { + model.addColumn(name); + } + index2 = 1; + } + item_list(itemList); + + dataTable.setDefaultRenderer(Object.class, new TableComboxRender()); + + } + + private void item_list(List itemList) { + String[][] values = new String[1000][4]; + String Id; + String Bb; + String MCh; + String MSh; + System.out.println("itemList.size()------------------->"+itemList.size()); + if (index3 > 0) { + for (int i = index3 - 1; i >= 0; i--) {// ӴСʼɾ + model.removeRow(i); + } + } + + for (int i = 0; i < itemList.size(); i++) { + try { + System.out.println("***************"); + System.out.println(itemList.get(i) == null); + if (itemList.get(i) == null) { + index3 = 0; + break; + } + String object_string = itemList.get(i).getStringProperty( + "object_string"); + Id = object_string.split("/")[0]; + Bb = object_string.split("/")[1].split(";")[0]; + MCh = object_string.split("-")[1]; + MSh = itemList.get(i).getStringProperty("object_desc"); + values[i][0] = Id; + values[i][1] = Bb; + values[i][2] = MCh; + values[i][3] = MSh; + model.addRow(new Object[] { values[i][0], values[i][1], + values[i][2], values[i][3] }); + index3 = itemList.size(); + } catch (Exception e) { + e.printStackTrace(); + } + + } + System.out.println("itemList.size()------------------->"+itemList.size()); +// System.out.println(itemList.get(0)); + System.out.println("isRefresh-------------------------->"+isRefresh); + if(itemList.size()==1&isRefresh==true&&index3 == 0){ + Id = "޴˺,ȷݲΪջ߸ϺŴ"; + Bb = ""; + MCh = ""; + MSh = ""; + values[0][0] = Id; + values[0][1] = Bb; + values[0][2] = MCh; + values[0][3] = MSh; + model.addRow(new Object[] { values[0][0], values[0][1], + values[0][2], values[0][3] }); + index3 = 1; + } + + } + /** + * ʵDocumentListenerӿinsertUpdate + * ÷Ըı + */ + @Override + public void insertUpdate(DocumentEvent e) { + try { + searchId=doc.getText(0, doc.getLength()); + } catch (BadLocationException e1) { + e1.printStackTrace(); + } //ı + if(searchId.trim().equals("")){ + queryButton.setEnabled(false); + }else{ + queryButton.setEnabled(true); + this.getRootPane().setDefaultButton(queryButton);//õǰĬѡаť + + } + + } + /** + * ʵDocumentListenerӿremoveUpdate + * ÷ԸıƳݣ磺ıеBackspace + */ + @Override + public void removeUpdate(DocumentEvent e) { + try { + searchId=doc.getText(0, doc.getLength()); + } catch (BadLocationException e1) { + e1.printStackTrace(); + } //ı + if(searchId.trim().equals("")){ + queryButton.setEnabled(false); + }else{ + queryButton.setEnabled(true); + this.getRootPane().setDefaultButton(queryButton);//õǰĬѡаť + } + + } + /** + * ʵDocumentListenerӿchangedUpdate + * ÷ԸٵıѴڵݸıʱȡӦֵ + */ + @Override + public void changedUpdate(DocumentEvent e) { + try { + searchId=doc.getText(0, doc.getLength()); + } catch (BadLocationException e1) { + e1.printStackTrace(); + } //ı + if(searchId.trim().equals("")){ + queryButton.setEnabled(false); + }else{ + queryButton.setEnabled(true); + this.getRootPane().setDefaultButton(queryButton);//õǰĬѡаť + } + } + +} diff --git a/src/com/connor/jk/plm/DbomToEbom/ChangeDbomHandler.java b/src/com/connor/jk/plm/DbomToEbom/ChangeDbomHandler.java new file mode 100644 index 0000000..736e457 --- /dev/null +++ b/src/com/connor/jk/plm/DbomToEbom/ChangeDbomHandler.java @@ -0,0 +1,25 @@ +package com.connor.jk.plm.DbomToEbom; +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.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCSession; + +public class ChangeDbomHandler extends AbstractHandler { + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + try { + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + TCSession session=(TCSession) app.getSession(); + ChangeDbomCommand command=new ChangeDbomCommand(app,session); + command.executeModal(); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + +} diff --git a/src/com/connor/jk/plm/DbomToEbom/ChangeDbomOperation.java b/src/com/connor/jk/plm/DbomToEbom/ChangeDbomOperation.java new file mode 100644 index 0000000..657651d --- /dev/null +++ b/src/com/connor/jk/plm/DbomToEbom/ChangeDbomOperation.java @@ -0,0 +1,88 @@ +package com.connor.jk.plm.DbomToEbom; +import java.util.ArrayList; +import java.util.List; + +import com.teamcenter.rac.aif.AbstractAIFOperation; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.util.MessageBox; + +public class ChangeDbomOperation extends AbstractAIFOperation { + private ChangeDbomBean firstBean; + private ChangeDbomDialog dialog; + private ProgressBarThread wait; + public ChangeDbomOperation(ChangeDbomBean firstBean, + ProgressBarThread wait, ChangeDbomDialog dialog) { + this.firstBean=firstBean; + this.wait=wait; + this.dialog=dialog; + } + + @Override + public void executeOperation() throws Exception { + try { + ChangeDbomUtil.setByPass(true); + } catch (TCException e2) { + e2.printStackTrace(); + } + try { + createMaterialBom(this.firstBean); + this.wait.setBool(true); + this.wait.interrupt(); + MessageBox.post("BOMתɹ", "ɹ", MessageBox.INFORMATION); + dialog.disposeDialog(); + dialog.dispose(); + } catch (Exception e) { + e.printStackTrace(); + MessageBox.post("BOMתʧ:\n" + e.getLocalizedMessage(), "ʧ", + MessageBox.ERROR); + dialog.showDialog(); + + } + try { + ChangeDbomUtil.setByPass(false); + } catch (TCException e2) { + e2.printStackTrace(); + } + + + } + /** + * + *bom + * + */ + public void createMaterialBom(ChangeDbomBean bean) throws TCException { + if (bean == null) { + return; + } + // ȡѡеϵİ汾 + TCComponentItemRevision materialRev = bean.getSelectRev(); + + //lineʵļ + List childBeanS = bean.getChildBeanS(); + if (childBeanS == null) { + return; + } + List childrenList = new ArrayList<>(); + List queryNoList = new ArrayList<>(); + List countNoList = new ArrayList<>(); + // BOM + for (int i = 0; i < childBeanS.size(); i++) { + ChangeDbomBean childBean = childBeanS.get(i); + // ȡӵѡ + TCComponentItemRevision childSelectMaterialRev = childBean + .getSelectRev(); + childrenList.add(childSelectMaterialRev); + queryNoList.add(childBean.getQUERY()); + countNoList.add(childBean.getQTY()); + createMaterialBom(childBean); + } + + ChangeDbomUtil.createBom(materialRev, childrenList, queryNoList, + countNoList); + + + } + +} diff --git a/src/com/connor/jk/plm/DbomToEbom/ChangeDbomUtil.java b/src/com/connor/jk/plm/DbomToEbom/ChangeDbomUtil.java new file mode 100644 index 0000000..a52a4d6 --- /dev/null +++ b/src/com/connor/jk/plm/DbomToEbom/ChangeDbomUtil.java @@ -0,0 +1,198 @@ +package com.connor.jk.plm.DbomToEbom; +import java.util.List; + +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.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +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.TCUserService; +import com.teamcenter.rac.util.MessageBox; + +public class ChangeDbomUtil { + public static TCPreferenceService service; + public static TCSession session; + public static TCUserService userservice;; + + static { + if (session == null) { + session = (TCSession) (AIFUtility.getCurrentApplication() + .getSession()); + } + if (service == null) + service = session.getPreferenceService(); + } + + public static void setByPass(boolean val) throws TCException { + if (userservice == null) { + userservice = session.getUserService(); + } + Object[] obj = new Object[1]; + obj[0] = "origin"; + if (val) { + userservice.call("ORIGIN_set_bypass", obj); + } else { + userservice.call("ORIGIN_close_bypass", obj); + } + } + + /** + * bom + * + * @param selectIndex + * @throws TCException + */ + public static void createBom(TCComponentItemRevision parentRev, + List childRevList, + List queryNoList, List countNoList) + throws TCException { + if (childRevList == null || childRevList.size() == 0) { + return; + } + if (parentRev == null) + return; + String[] setProps = { JoyoungStaticFinal.JY_BOM_QUERY_NO, + JoyoungStaticFinal.JY_BOM_COUNT_NO }; + TCTypeService service = session.getTypeService(); + TCComponentBOMWindowType winType = (TCComponentBOMWindowType) service + .getTypeComponent("BOMWindow"); + TCComponentBOMWindow view = winType.create(null); + TCComponentBOMLine line = view.setWindowTopLine(parentRev.getItem(), + parentRev, null, null); + AIFComponentContext[] childrenContext = line.getChildren(); + + view.lock(); + // Ƴеbomline + if (childrenContext.length != 0) { + for (AIFComponentContext child : childrenContext) { + line.lock(); + line.remove("", (TCComponent) child.getComponent()); + line.save(); + line.unlock(); + } + + // return; + } +// setProperties +// Sets the property values associated with the real property names. +// Parameters: +// propNames - the string array of real property names. +// uifValues - the string array of values. + for (int i = 0; i < childRevList.size(); i++) { + TCComponentItemRevision rev = childRevList.get(i); + line.lock(); + if(rev==null){ + continue; + } + TCComponentBOMLine childBomLine = line.add(rev.getItem(), rev, + null, false, ""); + line.save(); + line.unlock(); + childBomLine.lock(); + // + if(childBomLine.getProperty("bl_uom").equals("ÿ")) { + childBomLine.setProperty("bl_uom", "ge"); + } + childBomLine.setProperties(setProps, + new String[] { queryNoList.get(i), countNoList.get(i) }); + childBomLine.save(); + childBomLine.unlock(); + + } + view.save(); + view.unlock(); + view.close(); + + } + public static InterfaceAIFComponent[] searchComponentsCollection( + TCSession session, String searchName, String[] keys, String[] values) { + // Ϣ + InterfaceAIFComponent[] result = new InterfaceAIFComponent[0]; + + try { + System.out.println("ʼִ"); + // õѯķ +// TCTextService textService = session.getTextService(); + // ȡquerytype + // ̶дImanQuery + TCComponentQueryType querytype = (TCComponentQueryType) session + .getTypeComponent("ImanQuery"); + // ͨquerytypeҵsearchNameIJѯ + TCComponentQuery query = (TCComponentQuery) querytype + .find(searchName); +// if (query == null) { +// MessageBox.post("ͨѯ" + searchName + "", "", 1); +// return null; +// }else{ +// MessageBox.post("ͨѯҵ" + searchName, "ɹ", 2); +// } + querytype.clearCache(); + String[] as = new String[keys.length]; + for (int i = 0; i < keys.length; i++) { +// as[i] = textService.getTextValue(keys[i]); + as[i] = keys[i]; + System.out.println("ûѯĿas["+i+"]="+as[i]); + } + + String[] as1 = new String[values.length]; + for (int i = 0; i < values.length; i++) { +// as1[i] = textService.getTextValue(values[i]); + as1[i] = values[i]; + System.out.println("ûѯĿӦֵas1["+i+"]="+as1[i]); + } + query.clearCache();//ҵջ + // ͨѯõѯϢ + TCQueryClause[] clauses = query.describe(); + + // ѯϢѯĿǷȷ + for (int i = 0; i < clauses.length; i++) { + // õѯ + clauses[i].getAttributeName();//item_id + // õûĿ + clauses[i].getUserEntryName();//ItemID + // õûػĿ + clauses[i].getUserEntryNameDisplay();// ID + System.out.println(clauses[i].getAttributeName()+"\t"+ + clauses[i].getUserEntryName()+"\t"+ + clauses[i].getUserEntryNameDisplay()); + + } + // ִвѯ +// TCComponentContextList list = query.getExecuteResultsList(as, as1); + TCComponentContextList list = query.getExecuteResultsList(keys, values); + if (list != null) { + // õѯĶ + int count = list.getListCount(); + // صγ + result = new InterfaceAIFComponent[count]; + // ѯĽص鸳ֵ + for (int i = 0; i < count; i++) { + // õѯ +// AIFComponentContext context = list.get(i); + // ͨĵõӦĶ󣬲ֵص + result[i] = list.get(i).getComponent(); + System.out.println("result["+i+"]="+result[i]); + } + } + } catch (TCException e) { + e.printStackTrace(); +// MessageBox.post("ͨѯ" + searchName + "ѯ.", "", 1); + } + + return result; + } + +} \ No newline at end of file diff --git a/src/com/connor/jk/plm/DbomToEbom/InputOperation.java b/src/com/connor/jk/plm/DbomToEbom/InputOperation.java new file mode 100644 index 0000000..07bdbb9 --- /dev/null +++ b/src/com/connor/jk/plm/DbomToEbom/InputOperation.java @@ -0,0 +1,72 @@ +package com.connor.jk.plm.DbomToEbom; + +import java.util.ArrayList; +import java.util.List; + +import com.teamcenter.rac.aif.AbstractAIFOperation; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +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 InputOperation extends AbstractAIFOperation { + List itemList; + InterfaceAIFComponent[] comps0; + TCSession session; + TCComponentItemRevision itemRevision; + List itemRevisionT; + String searchId; + ProgressBarThread wait; + boolean isRefresh; + ChangeDbomDialog dbDialog; + public InputOperation(ChangeDbomDialog dbDialog, boolean isRefresh, ProgressBarThread wait, List itemList, InterfaceAIFComponent[] comps0, TCSession session, + TCComponentItemRevision itemRevision, List itemRevisionT, String searchId) { + this.dbDialog=dbDialog; + this.isRefresh=isRefresh; + this.wait=wait; + this.itemList=itemList; + this.comps0=comps0; + this.session=session; + this.itemRevision=itemRevision; + this.itemRevisionT=itemRevisionT; + this.searchId=searchId; + + } + @Override + public void executeOperation() throws Exception { + this.wait.start(); + isRefresh=true; + search1(); + this.wait.setBool(true); + this.wait.interrupt(); + ChangeDbomDialogInput dialog=new ChangeDbomDialogInput(dbDialog,isRefresh,session, itemList,comps0,itemRevision,itemRevisionT); + new Thread(dialog).start(); + } + private void search1(){ + + itemList = new ArrayList<>(); + comps0 = ChangeDbomUtil.searchComponentsCollection(session, + " ID", new String[] { " ID" }, + new String[] { searchId }); + if(comps0.length > 0){ + try { + for (int j = 0; j < comps0.length; j++) { + itemRevision = ((TCComponentItem) comps0[j]) + .getLatestItemRevision(); + + itemList.add(itemRevision); + itemRevisionT.add(itemRevision); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + else { + itemList.add(null); +// MessageBox.post("ûIJѯ", "ʾ", MessageBox.WARNING); + } + } + + +} diff --git a/src/com/connor/jk/plm/DbomToEbom/JoyoungStaticFinal.java b/src/com/connor/jk/plm/DbomToEbom/JoyoungStaticFinal.java new file mode 100644 index 0000000..8b35351 --- /dev/null +++ b/src/com/connor/jk/plm/DbomToEbom/JoyoungStaticFinal.java @@ -0,0 +1,5 @@ +package com.connor.jk.plm.DbomToEbom; +public class JoyoungStaticFinal { + public static final String JY_BOM_QUERY_NO = "bl_sequence_no"; + public static final String JY_BOM_COUNT_NO = "bl_quantity"; +} diff --git a/src/com/connor/jk/plm/DbomToEbom/MyCellEditor.java b/src/com/connor/jk/plm/DbomToEbom/MyCellEditor.java new file mode 100644 index 0000000..f9e9049 --- /dev/null +++ b/src/com/connor/jk/plm/DbomToEbom/MyCellEditor.java @@ -0,0 +1,98 @@ +package com.connor.jk.plm.DbomToEbom; + +import java.awt.Component; +import java.util.EventObject; +import java.util.Hashtable; + +import javax.swing.JTable; +import javax.swing.event.CellEditorListener; +import javax.swing.table.TableCellEditor; + +public class MyCellEditor implements TableCellEditor { + /** 洢еı༭ */ + private Hashtable editors = null; + /** ÿԪı༭ */ + private TableCellEditor editor = null; + /** */ + private JTable table = null; + + /** + * ÿԪ༭Ĺ캯 + * + */ + public MyCellEditor(JTable table) { + this.table = table; + editors = new Hashtable(); + } + /** + * ָеı༭ + * + * @param row к + * @param editor ༭ + */ + public void setEditorAt(int row, TableCellEditor editor) { + //ָеļָı༭ + editors.put(new Integer(row), editor); + } + + /** + * Ϊ༭óʼֵ + * @param table JTable༭ǿ + * @param value ༭ֵ + * @param isSelected ѡʱ + * @param row ༭к + * @param column ༭ к + * @return ༭ + */ + + + + @Override + public Object getCellEditorValue() { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean isCellEditable(EventObject anEvent) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean shouldSelectCell(EventObject anEvent) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean stopCellEditing() { + // TODO Auto-generated method stub + return false; + } + + @Override + public void cancelCellEditing() { + // TODO Auto-generated method stub + + } + + @Override + public void addCellEditorListener(CellEditorListener l) { + // TODO Auto-generated method stub + + } + + @Override + public void removeCellEditorListener(CellEditorListener l) { + // TODO Auto-generated method stub + + } + + @Override + public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/src/com/connor/jk/plm/DbomToEbom/ProgressBar.java b/src/com/connor/jk/plm/DbomToEbom/ProgressBar.java new file mode 100644 index 0000000..78c2b0f --- /dev/null +++ b/src/com/connor/jk/plm/DbomToEbom/ProgressBar.java @@ -0,0 +1,171 @@ +/** + * @file ProgressBar.java + * + * @brief Create progress bar + * + * @author Yanghui + * + * @history + * ================================================================ + * Date Name Description of Change + * 25-July-2008 Yanghui this class is used to create + * progress bar. + */ +package com.connor.jk.plm.DbomToEbom; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JProgressBar; +import javax.swing.Timer; +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.util.PropertyLayout; +import com.teamcenter.rac.util.Registry; + +/** + * @class ProgressBar + * @brief Create progress bar + * @author Yanghui + */ +public class ProgressBar extends AbstractAIFDialog implements ActionListener { + /** + * @var ProgressBar.progressbar + * @brief JProgressBar + */ + private JProgressBar progressbar; + + /** + * @var ProgressBar.label + * @brief label used to tips + */ + private JLabel label; + + /** + * @var ProgressBar.timer + * @brief timer used to timing operation + */ + private Timer timer; + + /** + * @var ProgressBar.bool + * @brief bool used to flag thread return + */ + private boolean bool = false; + + /** + * @var Progressbar.registry + * @brief Registry + */ + private Registry registry; + + /** + * @fn public ProgressBar() + * @brief constructor + * @param[in] null + */ + private String showLable = null ; + public ProgressBar(String showlable) { + super(true); + showLable = showlable; + this.setAlwaysOnTop(true); + } + + /** + * @fn public void setBool(boolean bool) + * @brief set bool value + * @param[in] bool + * @param[out] null + */ + public void setBool(boolean bool) { + this.bool = bool; + } + + /** + * @fn private void initUI() + * @brief createDialog method + * @param[in] null + * @param[out] null + */ + public void initUI() { + Container container = getContentPane(); + JPanel mainPanel = new JPanel(new PropertyLayout()); + this.label = new JLabel(showLable, JLabel.CENTER); + this.progressbar = new JProgressBar(); + this.progressbar.setOrientation(JProgressBar.HORIZONTAL); + this.progressbar.setMinimum(0); + this.progressbar.setMaximum(100); + this.progressbar.setValue(0); + this.progressbar.setPreferredSize(new Dimension(200, 15)); + this.progressbar.setBorderPainted(true); + this.timer = new Timer(50, (ActionListener) this); + this.timer.setRepeats(false); + mainPanel.add("1.1.center", new JLabel(" ")); + mainPanel.add("2.1.center", label); + mainPanel.add("3.1.center", progressbar); + mainPanel.add("4.1.center", new JLabel(" ")); + container.add(mainPanel); + pack(); + setLocation(500, 200); + TaskThread thread = new TaskThread(this); + thread.start(); + addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + bool = true; + } + }); + this.setVisible(true); + } + + /** + * @class TaskThread + * @brief Create progressbar + * + */ + class TaskThread extends Thread { + private ProgressBar bar; + + public TaskThread(ProgressBar bar) { + this.bar = bar; + } + + public void run() { + if (bool == false) { + // Set Status is running. + // session.setStatus(registry.getString("export Running")); + } + for (int i = 0; i < i + 1; i++) { + timer.start(); + int value = progressbar.getValue(); + if (value < 100) { + value = value + 5; + progressbar.setValue(value); + } else { + timer.stop(); + progressbar.setValue(0); + } + try { + sleep(100); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + if (bool == true) { + bar.setVisible(false); + bar.dispose(); + return; + + } + + } + } + } + + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + + } +} diff --git a/src/com/connor/jk/plm/DbomToEbom/ProgressBarThread.java b/src/com/connor/jk/plm/DbomToEbom/ProgressBarThread.java new file mode 100644 index 0000000..95e2d59 --- /dev/null +++ b/src/com/connor/jk/plm/DbomToEbom/ProgressBarThread.java @@ -0,0 +1,41 @@ +/** + * @file ProgressBarThread.java + * + * @brief control progressBar. + * + * @author Yanghui + * + * @history + * ================================================================ + * Date Name Description of Change + * 08-Auguest-2008 Yanghui this class is used to control + * progress bar. + */ +package com.connor.jk.plm.DbomToEbom; + +/** + * @class ProgressBarThread + * @brief Create progress bar thread + * @author Yanghui + */ +public class ProgressBarThread extends Thread { + + private ProgressBar bar; + + private String title; + + public ProgressBarThread(String title,String showLable) { + this.title = title; + bar = new ProgressBar(showLable); + } + + public void run() { + bar.setTitle(title); + bar.initUI(); + } + + public void setBool(boolean bool) { + bar.setBool(true); + bar.setAlwaysOnTop(true); + } +} diff --git a/src/com/connor/jk/plm/DbomToEbom/TableComboxRender.java b/src/com/connor/jk/plm/DbomToEbom/TableComboxRender.java new file mode 100644 index 0000000..a7c7d15 --- /dev/null +++ b/src/com/connor/jk/plm/DbomToEbom/TableComboxRender.java @@ -0,0 +1,91 @@ +package com.connor.jk.plm.DbomToEbom; +import java.awt.Color; +import java.awt.Component; +import java.awt.Font; +//import java.awt.event.ItemListener; +//import java.awt.event.MouseAdapter; +//import java.awt.event.MouseEvent; +//import java.util.ArrayList; +//import java.util.HashMap; +//import java.util.Map; + +//import javax.swing.JComboBox; +import javax.swing.JComponent; +import javax.swing.JTable; +import javax.swing.JTextArea; +import javax.swing.table.TableCellRenderer; + +/** + * @author duchao + * + */ +class TableComboxRender extends JComponent implements TableCellRenderer { + /** + * + */ + private static final long serialVersionUID = 1L; +// private JComboBox combox = null; + private JTextArea text; + private JTextArea text1; +// private Map comboxMap = new HashMap<>(); + + public TableComboxRender() { + + } + + int index4 = 0; + + @Override + public Component getTableCellRendererComponent(final JTable jtable, + Object obj, boolean isSelected, boolean hasFocus, final int row, + final int column) { + JComponent component1 = null; +// JComponent component0 = null; + if (column == 0) { + text1 = new JTextArea(); + text1.setText(obj != null ? obj.toString() : ""); + text1.setEditable(false); + component1 = text1; + } + + text = new JTextArea(); + text.setText(obj != null ? obj.toString() : ""); + text.setEditable(false); + component1 = text; + // 趨 + Font fp = new Font("΢ź", Font.PLAIN, 10); + Font fb = new Font("΢ź", Font.BOLD, 11); + if (isSelected) { + // TODO ȡ + ChangeDbomDialogInput.inputButton.setEnabled(true); + ChangeDbomDialogInput.selectedId = text1.getText(); + component1.setFont(fb); + + } else { + component1.setFont(fp); + } + // 趨ɫ + if (isSelected) { + + // 2.õǰCellɫ + Color mycolor2 = new Color(10, 36, 106); + component1.setBackground(mycolor2);// ñɫ + // component1.setBackground(mycolor);// ñɫ + component1.setForeground(Color.WHITE);// ǰɫ + } else { + + // 3.õУżеɫ + Color mycolor = new Color(232, 242, 254); + if (row % 2 == 0) {// żʱɫ + component1.setBackground(mycolor); + component1.setForeground(Color.BLACK);// ǰɫ + } else if (row % 2 == 1) {// õеɫ + component1.setBackground(Color.WHITE); + component1.setForeground(Color.BLACK);// ǰɫ + } + } + + + return component1; + } +} \ No newline at end of file diff --git a/src/com/connor/jk/plm/E_U8ToEBOM_New/AutoCompleter.java b/src/com/connor/jk/plm/E_U8ToEBOM_New/AutoCompleter.java new file mode 100644 index 0000000..c8c1884 --- /dev/null +++ b/src/com/connor/jk/plm/E_U8ToEBOM_New/AutoCompleter.java @@ -0,0 +1,118 @@ +package com.connor.jk.plm.E_U8ToEBOM_New; + +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.util.List; +import java.util.Vector; + +import javax.swing.ComboBoxModel; +import javax.swing.DefaultComboBoxModel; +import javax.swing.JComboBox; +import javax.swing.JTextField; + +class AutoCompleter implements KeyListener, ItemListener { + + private JComboBox owner = null; + private JTextField editor = null; + + private ComboBoxModel model = null; + + public AutoCompleter(JComboBox comboBox) { + owner = comboBox; + editor = (JTextField) comboBox.getEditor().getEditorComponent(); + editor.addKeyListener(this); + model = comboBox.getModel(); + owner.addItemListener(this); + } + + public void keyTyped(KeyEvent e) { + } + + public void keyPressed(KeyEvent e) { + } + + public void keyReleased(KeyEvent e) { + char ch = e.getKeyChar(); + if (ch == KeyEvent.CHAR_UNDEFINED || Character.isISOControl(ch) || ch == KeyEvent.VK_DELETE) + return; + + int caretPosition = editor.getCaretPosition(); + String str = editor.getText(); + if (str.length() == 0) + return; + autoComplete(str, caretPosition); + } + + /** + * ԶɡݣбҵƵĿ. + */ + protected void autoComplete(String strf, int caretPosition) { + Object[] opts; + opts = getMatchingOptions(strf.substring(0, caretPosition)); + if (owner != null) { + model = new DefaultComboBoxModel(opts); + owner.setModel(model); + } + if (opts.length > 0) { + String str = opts[0].toString(); + editor.setCaretPosition(caretPosition); + if (owner != null) { + try { + owner.showPopup(); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + } + } + + /** + * + * ҵƵĿ, ҽ֮еǰ档 + * + * @param str + * @return Ŀб + */ + protected Object[] getMatchingOptions(String str) { + List v = new Vector(); + List v1 = new Vector(); + + for (int k = 0; k < model.getSize(); k++) { + Object itemObj = model.getElementAt(k); + if (itemObj != null) { + String item = itemObj.toString().toLowerCase(); + if (item.startsWith(str.toLowerCase())) + v.add(model.getElementAt(k)); + else + v1.add(model.getElementAt(k)); + } else + v1.add(model.getElementAt(k)); + } + for (int i = 0; i < v1.size(); i++) { + v.add(v1.get(i)); + } + if (v.isEmpty()) + v.add(str); + return v.toArray(); + } + @Override + public void itemStateChanged(ItemEvent event) { + System.out.println("1"); + if (event.getStateChange() == ItemEvent.SELECTED) { + System.out.println("2"); + int caretPosition = editor.getCaretPosition(); + if (caretPosition != -1) { + System.out.println("3"); + try { + editor.moveCaretPosition(caretPosition); + } catch (IllegalArgumentException ex) { + ex.printStackTrace(); + } + } + } + } + + +} \ No newline at end of file diff --git a/src/com/connor/jk/plm/E_U8ToEBOM_New/ClassProperty.java b/src/com/connor/jk/plm/E_U8ToEBOM_New/ClassProperty.java new file mode 100644 index 0000000..b15cd28 --- /dev/null +++ b/src/com/connor/jk/plm/E_U8ToEBOM_New/ClassProperty.java @@ -0,0 +1,42 @@ +package com.connor.jk.plm.E_U8ToEBOM_New; + +/** + * @copyRight 㽭տƼ޹˾ + * @author E-mail:hub@connor.net.cn + * @date ʱ䣺2017-7-3 11:47:03 + * @version v1.0 + * @parameter + * @since + * @return + */ + +public class ClassProperty { + private int propertyID; + private String value; + + public ClassProperty() { + + } + + public ClassProperty(int propertyID, String value) { + this.propertyID = propertyID; + this.value = value; + } + + public int getPropertyID() { + return propertyID; + } + + public void setPropertyID(int propertyID) { + this.propertyID = propertyID; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + +} diff --git a/src/com/connor/jk/plm/E_U8ToEBOM_New/E_U8T0U8_Operation20191227备份 b/src/com/connor/jk/plm/E_U8ToEBOM_New/E_U8T0U8_Operation20191227备份 new file mode 100644 index 0000000..36d6314 --- /dev/null +++ b/src/com/connor/jk/plm/E_U8ToEBOM_New/E_U8T0U8_Operation20191227备份 @@ -0,0 +1,501 @@ +package com.connor.jk.plm.E_U8ToEBOM_New; + +import java.util.ArrayList; +import java.util.List; + +import javax.swing.JTextField; + +//import com.connor.jk.plm.tempToFormal.ClassProperty; +//import com.connor.jk.plm.tempToFormal.SoaServerUtil; +import com.teamcenter.rac.aif.AbstractAIFApplication; +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.TCComponentBOMViewRevision; +import com.teamcenter.rac.kernel.TCComponentBOMWindow; +import com.teamcenter.rac.kernel.TCComponentBOMWindowType; +import com.teamcenter.rac.kernel.TCComponentFolder; +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.TCComponentItemType; +import com.teamcenter.rac.kernel.TCComponentUser; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.kernel.TCTypeService; +import com.teamcenter.rac.kernel.TCUserService; +import com.teamcenter.rac.kernel.ics.ICSApplicationObject; +import com.teamcenter.rac.kernel.ics.ICSProperty; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.schemas.soa._2006_03.exceptions.ServiceException; + +public class E_U8ToU8_Operation extends AbstractAIFOperation { + private AbstractAIFApplication app; + private TCSession session; + private InterfaceAIFComponent targetComp; + private AIFComponentContext aif; + private String[] prop; + private TCProperty[] props; + private TCUserService userService; + private TCPreferenceService service; + private TCComponentItem target; + private TCComponentBOMLine line = null; + private TCComponentBOMWindow window=null; + private TCComponentBOMWindow windowOld=null; + private List childRevList;//봴JListй + + public E_U8ToU8_Operation(AbstractAIFApplication app2, AIFComponentContext aif, InterfaceAIFComponent targetComp, + TCSession session2) { + this.app = app2; + this.targetComp = targetComp; + this.aif = aif; + this.session = session2; + } + + private String itemId;// ʽϵID + private String itemRev;// ʽϵİ汾 + private String itemName;// ʽϵ + + private TCComponentItemRevision itemRevision;// ʽϵİ汾 + + private TCComponentItemRevision rev; + private TCComponentBOMViewRevision bomViewRevision; + private AIFComponentContext[] Context2; + String class_id ; + Integer[] keys = null; + String[] vals = null; + String url=""; + String[] propertyValue=null; + String[] properties=null; + String[] values=null; + @Override + public void executeOperation() throws Exception { + service=session.getPreferenceService(); + url= service.getStringValue("Autocode_SendClassServer_URL"); + // TODO + // 1.ȡѷ°汾ķ + class_id = ((TCComponent) aif.getComponent()).getClassificationClass(); + if(class_id==""){ + MessageBox.post("δִ࣬д˲", "", MessageBox.ERROR); + return; + } +// int a=1; +// target = (TCComponentItem) targetComp; + // TODO ѡ +// service = session.getPreferenceService(); + // String class_id=service.getStringValue(""); + if (aif.getComponent() instanceof TCComponentItemRevision) { + rev = (TCComponentItemRevision) aif.getComponent(); + + +// AIFComponentd + // object_name + props = rev.getTCProperties(new String[] { "object_name" }); + itemName = props[0].getStringValue(); + + // ID + props = rev.getTCProperties(new String[] { "item_id" }); + itemId = props[0].getStringValue().substring(2); + + } + + //ֻתһ汾 + TCComponentItem newitem =null; + TCComponentItemRevision newrev=null; + boolean isExist=false; + try { + //ӦȲѯһ¿ǷѾitemû½оֱӻȡ + newitem = rev.saveAsItem(itemId, null); + newrev = newitem.getLatestItemRevision();//°汾 + + } catch (Exception e1) { +// TCComponent[] u8items=session.search("...", new String[] {" ID"}, new String[] {itemId}); + InterfaceAIFComponent[] comps = null; + comps = Util.searchComponentsCollection(session,"...", new String[] { " ID" },new String[] { itemId }); + +// newitem=(TCComponentItem) u8items[0]; + newitem=(TCComponentItem) comps[0]; + //ҪѾɵu8bomǷѾ + if(newitem.getLatestItemRevision().getProperty("release_status_list").length()>0) { + + try { + newrev=newitem.getLatestItemRevision().saveAs(newitem.getNewRev()); + } catch (Exception e) { +// e.printStackTrace(); + } + isExist=true; + }else { + MessageBox.post("ѾΪU8,U8°Ƿ񷢲","",MessageBox.ERROR); + return; + } + + } + + if(isExist==false) { + + TCComponentUser user = this.session.getUser(); + TCComponentFolder newStuff = user.getNewStuffFolder(); + newStuff.add("contents", newitem); + } + + newitem.refresh(); + propertyValue=service.getStringValues("jk_prop_value");//ַ֧͵Ըֵ + TCComponentForm form1=(TCComponentForm) rev.getReferenceListProperty("IMAN_master_form_rev")[0]; + TCComponentForm form2=(TCComponentForm) newitem.getLatestItemRevision().getReferenceListProperty("IMAN_master_form_rev")[0]; + if(propertyValue==null) { + MessageBox.post("ϵԱѡjk_prop_value","",MessageBox.ERROR); + return; + } + for(int i=0;i"+keys[count1]); + vals[count1] = cPropS[j].getValue(); + System.out.println("vals["+count1+"]================>"+vals[count1]); + count1++; + } + break; + } +// if(a==1){ +// return; +// } + // TODO 2.,°汾͵ + // class_id = "";// TODO дѡ + try { +// createICS(class_id, newrev, newrev.getTCProperty("item_id").getStringValue(), keys, vals); + sendObjToClassficationByWebService(newitem.getLatestItemRevision(),keys,vals); + } catch (Exception e) { + MessageBox.post("ʧ","",MessageBox.ERROR); + e.printStackTrace(); + return; + } + + if(isSucceed==false) { + MessageBox.post("ʧ","",MessageBox.ERROR); + return; + } + + if (isExist == false) { + + MessageBox.post("" + itemId + "ɹ\nNewStuffļ", "ɹ", MessageBox.INFORMATION); + }else { + MessageBox.post("" + itemId + "ɹ", "ɹ", MessageBox.INFORMATION); + } + + } + + // ϰ汾͵ + public void createICS(String class_id, TCComponentItemRevision target, String partid, Integer[] integers, + String[] vals) throws TCException { + TCClassificationService myService = session.getClassificationService(); + ICSApplicationObject icsAppObj = myService.newICSApplicationObject("ICM"); + icsAppObj.create(partid, target.getUid()); + icsAppObj.setView(class_id); +// // ɾʱ +// rev = (TCComponentItemRevision) aif.getComponent(); +// TCComponentICO[] ico = rev.getClassificationObjects(); +// for (int i = 0; i < ico.length; i++) { +// ico[0].delete(); +// } + ICSProperty icspro[] = new ICSProperty[integers.length]; + + for (int i = 0; i < icspro.length; i++) { + System.out.println(" CLASS ID = " + integers[i] + " =" + vals[i]); + icspro[i] = new ICSProperty(integers[i], vals[i]); + } + icsAppObj.setProperties(icspro); +// icsAppObj.save();TODO ʲôã + } + + + + public TCComponentBOMLine getTopLineByRev(TCComponentItemRevision rev) {//öbomline + try { + TCTypeService service = session.getTypeService(); + TCComponentBOMWindowType winType = (TCComponentBOMWindowType) service + .getTypeComponent("BOMWindow"); + window = winType.create(null); + line = window.setWindowTopLine(rev.getItem(), rev, null, null); +// window.close();//رգᵼBOMռãBOMİ汾ɾTC + } catch (TCException e) { + e.printStackTrace(); + } + + return line; + } + public TCComponentBOMLine getTopLineByRev2(TCComponentItemRevision rev,TCComponentBOMWindow window) {//öbomline + try { + + line = window.setWindowTopLine(rev.getItem(), rev, null, null); +// window.close();//رգᵼBOMռãBOMİ汾ɾTC + } catch (TCException e) { + e.printStackTrace(); + } + + return line; + } + + private void setbom(TCComponentBOMLine line ,TCComponentItemRevision rev) {//bom + + try { +// setGlxq(rev); +// System.out.println("lineddd=" + line.toString()); + AIFComponentContext[] lins = line.getChildren(); + if (lins == null || lins.length <= 0) { + return; + } + for (AIFComponentContext l : lins) { + TCComponent lt = (TCComponent) l.getComponent(); + //bl_substitute_listԣб + String bl_substitute_list=((TCComponentBOMLine) lt).getProperty("bl_substitute_list"); + System.out.println("bl_substitute_list---->"+bl_substitute_list); + String[] substitute_list=bl_substitute_list.split(","); + System.out.println("bl_substitute_list=========>"+substitute_list.length); + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------1----------"+substitute_list[i]); + } + TCProperty[] tcs = ((TCComponentBOMLine) lt) + .getTCProperties(new String[] { + "bl_quantity","bl_sequence_no", +// "jk8SubstitRatio", "jk8SubstitOrder","jk8EffectiveDate","jk8SubCompLossRate",//治˻ȡ +// "bl_item_uom_tag","jk8TechnicModel","jk8SpecificModel",// + "JK8Remark","JK8SupplyType","JK8Warehouse", + "JK8RemarkDesc","jk8SubCompLossRate" + + });//ֿ⡢Ӧͣbl_substituteȣjk8SubstitRatiojk8SubstitOrderЧڣjk8EffectiveDate + line.lock(); + line.remove("", lt); + +// TCComponentItem chitem = ((TCComponentBOMLine) lt).getItem() +// .getLatestItemRevision().saveAsItem(null, null); +// TCComponentItemRevision r = chitem.getLatestItemRevision(); +// TCComponentItemRevision r=((TCComponentBOMLine) lt).getItem().getLatestItemRevision(); + TCComponentItemRevision r=((TCComponentBOMLine) lt).getItemRevision();//BOMLineӦItemRevision + System.out.println(line==null); + System.out.println(r==null); + TCComponentBOMLine childBomLine = line.add(r.getItem(), r, + null, false, ""); + if(substitute_list.length>0&&!bl_substitute_list.trim().equals("")){ + + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------------"+substitute_list[i]+"----------"); + TCComponentItemRevision itemRevision=((TCComponentItem)(session.search(" ID",new String[]{ " ID"}, new String[]{substitute_list[i].trim()})[0])).getLatestItemRevision(); + childBomLine.add(null, itemRevision, null, true); + } + } + childBomLine.setTCProperties(tcs); + + setbom(childBomLine,r); + line.save(); + line.unlock(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + + private void setbom2(TCComponentBOMWindow window,TCComponentBOMLine line ,TCComponentBOMLine lineOld,int mark) {//bom + System.out.println("bom"); + if (mark == 0) { + try { + AIFComponentContext[] lins = line.getChildren(); + if (lins == null || lins.length <= 0) { +// return; + }else { + window.lock(); + // ɾӼbomline + for (AIFComponentContext l : lins) { + System.out.println("ɾbom"); + TCComponent lt = (TCComponent) l.getComponent(); + + line.lock(); + line.remove("", lt); + line.save(); + line.unlock(); + } + } + + // ٰebomԸƽbomlineӹ + lins = lineOld.getChildren(); + if (lins == null || lins.length <= 0) { + return; + } + for (AIFComponentContext l : lins) { + TCComponent lt = (TCComponent) l.getComponent(); + //bl_substitute_listԣб + String bl_substitute_list=((TCComponentBOMLine) lt).getProperty("bl_substitute_list"); + System.out.println("bl_substitute_list---->"+bl_substitute_list); + String[] substitute_list=bl_substitute_list.split(","); + System.out.println("bl_substitute_list=========>"+substitute_list.length); + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------1----------"+substitute_list[i]); + } + TCProperty[] tcs = ((TCComponentBOMLine) lt) + .getTCProperties(new String[] { + "bl_quantity","bl_sequence_no", + "JK8Remark","JK8SupplyType","JK8Warehouse", + "JK8RemarkDesc","jk8SubCompLossRate" + + });//ֿ⡢Ӧͣbl_substituteȣjk8SubstitRatiojk8SubstitOrderЧڣjk8EffectiveDate + line.lock(); + + + TCComponentItemRevision r=((TCComponentBOMLine) lt).getItemRevision();//BOMLineӦItemRevision + + TCComponentBOMLine childBomLine = line.add(r.getItem(), r, + null, false, ""); + if(substitute_list.length>0&&!bl_substitute_list.trim().equals("")){ + + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------------"+substitute_list[i]+"----------"); + TCComponentItemRevision itemRevision=((TCComponentItem)(session.search(" ID",new String[]{ " ID"}, new String[]{substitute_list[i].trim()})[0])).getLatestItemRevision(); + childBomLine.add(null, itemRevision, null, true); + } + } + childBomLine.setTCProperties(tcs); + +// setbom2(childBomLine,r,1); + line.save(); + line.unlock(); + } + window.save(); + window.unlock(); + ; + } catch (Exception e) { + e.printStackTrace(); + } + } + + } + //͵ class_id=codeRemarkˮ룿 + boolean isSucceed=true; + public void sendObjToClassficationByWebService(TCComponentItemRevision rev,Integer[] keys, + String[] vals){ + try { + System.out.println("class_id-----dddddd----->"+class_id); + if( !class_id.replace(" ", "").equals("") ){ + + List propList = new ArrayList<>(); + for(int i = 0; i < keys.length; i++){ + ClassProperty prop = new ClassProperty(keys[i], vals[i]);// + propList.add(prop); + } + String json = SoaServerUtil.objectToJson(propList);//JavaתΪjson + try { + SoaServerUtil.grantWritePrivilege(session, rev);//дȨ + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + try { + SoaServerUtil.sendToClass(rev.getUid(), class_id, json,url);//͵ + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + try { + SoaServerUtil.grantReadPrivilege(session, rev);//Ȩ + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + } catch (Exception e) { + isSucceed=false; + e.printStackTrace(); + } + + } + +} diff --git a/src/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToEBOMBean.java b/src/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToEBOMBean.java new file mode 100644 index 0000000..5a785f3 --- /dev/null +++ b/src/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToEBOMBean.java @@ -0,0 +1,91 @@ +package com.connor.jk.plm.E_U8ToEBOM_New; + +import java.util.List; + +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCProperty; + +public class E_U8ToEBOMBean { + + private List childBeanS; + private TCComponentItemRevision rev;// Ĭϵitemrevision汾 + private String bl_quantity; + private String bl_sequence_no; + private String JK8Remark; + private String JK8SupplyType; + private String JK8Warehouse; + private String JK8RemarkDesc; + private String jk8SubCompLossRate; + private TCProperty[] tcs; + private List sublist; + + public List getChildBeanS() { + return childBeanS; + } + public TCComponentItemRevision getRev() { + return rev; + } + + public void setChildBeanS(List childBeanS) { + this.childBeanS = childBeanS; + } + public void setRev(TCComponentItemRevision rev) { + this.rev = rev; + } + public String getBl_quantity() { + return bl_quantity; + } + public String getBl_sequence_no() { + return bl_sequence_no; + } + public String getJK8Remark() { + return JK8Remark; + } + public String getJK8SupplyType() { + return JK8SupplyType; + } + public String getJK8Warehouse() { + return JK8Warehouse; + } + public String getJK8RemarkDesc() { + return JK8RemarkDesc; + } + public String getJk8SubCompLossRate() { + return jk8SubCompLossRate; + } + public void setBl_quantity(String bl_quantity) { + this.bl_quantity = bl_quantity; + } + public void setBl_sequence_no(String bl_sequence_no) { + this.bl_sequence_no = bl_sequence_no; + } + public void setJK8Remark(String jK8Remark) { + JK8Remark = jK8Remark; + } + public void setJK8SupplyType(String jK8SupplyType) { + JK8SupplyType = jK8SupplyType; + } + public void setJK8Warehouse(String jK8Warehouse) { + JK8Warehouse = jK8Warehouse; + } + public void setJK8RemarkDesc(String jK8RemarkDesc) { + JK8RemarkDesc = jK8RemarkDesc; + } + public void setJk8SubCompLossRate(String jk8SubCompLossRate) { + this.jk8SubCompLossRate = jk8SubCompLossRate; + } + public TCProperty[] getTcs() { + return tcs; + } + public void setTcs(TCProperty[] tcs) { + this.tcs = tcs; + } + public List getSublist() { + return sublist; + } + public void setSublist(List sublist) { + this.sublist = sublist; + } + + +} diff --git a/src/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToEBOMUtil.java b/src/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToEBOMUtil.java new file mode 100644 index 0000000..8b559fa --- /dev/null +++ b/src/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToEBOMUtil.java @@ -0,0 +1,53 @@ +package com.connor.jk.plm.E_U8ToEBOM_New; +import java.util.List; + +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.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +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.TCUserService; +import com.teamcenter.rac.util.MessageBox; + +public class E_U8ToEBOMUtil { + public static TCPreferenceService service; + public static TCSession session; + public static TCUserService userservice;; + + static { + if (session == null) { + session = (TCSession) (AIFUtility.getCurrentApplication() + .getSession()); + } + if (service == null) + service = session.getPreferenceService(); + } + + public static void setByPass(boolean val) throws TCException { + if (userservice == null) { + userservice = session.getUserService(); + } + Object[] obj = new Object[1]; + obj[0] = "origin"; + if (val) { + userservice.call("ORIGIN_set_bypass", obj); + } else { + userservice.call("ORIGIN_close_bypass", obj); + } + } + + +} \ No newline at end of file diff --git a/src/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU820191210_Handler.java b/src/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU820191210_Handler.java new file mode 100644 index 0000000..e67580c --- /dev/null +++ b/src/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU820191210_Handler.java @@ -0,0 +1,21 @@ +package com.connor.jk.plm.E_U8ToEBOM_New; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.connor.jk.plm.sqb.Generate_Action; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aifrcp.AIFUtility; + +public class E_U8ToU820191210_Handler extends AbstractHandler{ + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + E_U8ToU8_Action20191210 action=new E_U8ToU8_Action20191210(app,null); + new Thread(action).start(); + return null; + } + +} diff --git a/src/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Action.java b/src/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Action.java new file mode 100644 index 0000000..49c2508 --- /dev/null +++ b/src/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Action.java @@ -0,0 +1,362 @@ +/** + * + */ +package com.connor.jk.plm.E_U8ToEBOM_New; + +import java.awt.event.ActionEvent; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.swing.AbstractAction; + +import org.eclipse.core.commands.AbstractHandler; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.common.actions.AbstractAIFAction; +import com.teamcenter.rac.aif.kernel.AIFComponentContext; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentBOMLine; +import com.teamcenter.rac.kernel.TCComponentBOMViewRevision; +import com.teamcenter.rac.kernel.TCComponentBOMWindow; +import com.teamcenter.rac.kernel.TCComponentBOMWindowType; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +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.util.MessageBox; + +/** + * @author Administrator + * + */ +public class E_U8ToU8_Action extends AbstractAIFAction { + private AbstractAIFApplication app; + private InterfaceAIFComponent targetComp; + private TCSession session; + + private TCProperty[] props; + private String[] prop = new String[8]; + private AIFComponentContext aif;// °汾 + private TCComponentBOMWindow window=null; + private TCComponentBOMLine line = null; + List virtualList=new ArrayList<>(); + boolean tc=false; + String message="·汾\n"; + public E_U8ToU8_Action(AbstractAIFApplication arg0, String arg1) { + super(arg0, arg1); + this.app = arg0; + this.session = (TCSession) app.getSession(); + this.targetComp = app.getTargetComponent(); + } + + + + @Override + public void run() { + //2017.8.17ѡǰ汾 + if(!targetComp.getType().equals("JK8MaterialRevision")&&!targetComp.getType().equals("JK8Material")) { + //2018.4.13 ޸ʾΪѡӦ϶ϰ汾ִд˲ +// MessageBox.post("ѡJK8MaterialRevisionJK8Material͵ִд˲", "", MessageBox.ERROR); + MessageBox.post("ѡӦ϶ϰ汾ִд˲", "", MessageBox.ERROR); + return; + }else if(targetComp.getType().equals("JK8MaterialRevision")) { + //TODO жѡеǷ°汾Լ + boolean tg=false; + TCComponentItemRevision rev1=(TCComponentItemRevision) targetComp; + try { + TCComponentItemRevision rev2=rev1.getItem().getLatestItemRevision(); + if(rev2.getProperty("release_status_list").length()>0) { + if(session.componentToString(rev2).equals(session.componentToString(rev1))) { + tg=true; + } + } + } catch (TCException e2) { + e2.printStackTrace(); + } + if(tg==false) { + MessageBox.post("ȷ°汾ѷѡ°汾в!", "", MessageBox.ERROR); + return; + } + try { + if(!targetComp.getProperty("item_id").startsWith("E-8")) { + MessageBox.post("ѡE-8ͷϽѡ", "", MessageBox.ERROR); + return; + } + } catch (Exception e1) { + e1.printStackTrace(); + } + try { + TCComponentItem componentItem=(TCComponentItem) session.search("...", new String[] {" ID"}, new String[] {((TCComponentItemRevision)targetComp).getTCProperty("item_id").getStringValue()})[0]; + + AIFComponentContext[] aifComponentContextsTemp = componentItem.getChildren(); + int num = 0; + for (int i = 0; i < aifComponentContextsTemp.length; i++) { + if (aifComponentContextsTemp[i].getComponent().getType().equals("JK8MaterialRevision")) { + if (aifComponentContextsTemp[i].getComponent().getProperty("release_status_list") != "") { + + num++; + } + + } + } + if (num == 0) { + MessageBox.post("δת", "", MessageBox.ERROR); + return; + } + // 汾ŵ + int k = 0; + AIFComponentContext[] aifComponentContexts = new AIFComponentContext[num]; + for (int i = 0; i < aifComponentContextsTemp.length; i++) { + if ((aifComponentContextsTemp[i].getComponent().getType().equals("JK8MaterialRevision")) + + && (aifComponentContextsTemp[i].getComponent().getProperty("release_status_list") != "")) { + aifComponentContexts[k] = aifComponentContextsTemp[i]; + if (k < num - 1) { + k++; + } else { + break; + } + } + } + // ȡ°汾(汾ΪABCD) + String revision = ""; + String rev[] = new String[num]; + AIFComponentContext aifComponentContext; + Map map = new HashMap(); + String temp = ""; + for (int i = 0; i < aifComponentContexts.length; i++) { + revision = aifComponentContexts[i].getComponent().getProperty("item_revision_id"); + aifComponentContext = aifComponentContexts[i]; + rev[i] = revision; + map.put(revision, aifComponentContext); + } + boolean isNum=false; + for (int i = 0; i < rev.length; i++) { + temp = rev[0]; +// System.out.println(rev[i]); + try{ + + //Ƚϣ汾01,02,03,04 + if(Integer.valueOf(temp)0) { + E_U8ToU8_Dialog dialog = new E_U8ToU8_Dialog(app, aif, targetComp, session,virtualList); + new Thread(dialog).run(); + }else { + + E_U8ToU8_Operation operation = new E_U8ToU8_Operation(app, aif, targetComp, session); + this.session.queueOperation(operation); + } + }else if (targetComp.getType().equals("JK8Material")) { + // ȡµķ汾Уȡԣûʾ + try { + AIFComponentContext[] aifComponentContextsTemp = targetComp.getChildren(); + int num = 0; + for (int i = 0; i < aifComponentContextsTemp.length; i++) { + if (aifComponentContextsTemp[i].getComponent().getType().equals("JK8MaterialRevision")) { + if (aifComponentContextsTemp[i].getComponent().getProperty("item_id").startsWith("E-")) { + if (aifComponentContextsTemp[i].getComponent().getProperty("release_status_list") != "") { + + num++; + } + } else if (!aifComponentContextsTemp[i].getComponent().getProperty("item_id") + .startsWith("E-")) { +// MessageBox.post("ѡϺΪ\"E-\"ͷִд˲", "", MessageBox.ERROR); +// return; + } + } + } + if (num == 0) { + MessageBox.post("δת", "", MessageBox.ERROR); + return; + } + // 汾ŵ + int k = 0; + AIFComponentContext[] aifComponentContexts = new AIFComponentContext[num]; + for (int i = 0; i < aifComponentContextsTemp.length; i++) { + if ((aifComponentContextsTemp[i].getComponent().getType().equals("JK8MaterialRevision")) + && (aifComponentContextsTemp[i].getComponent().getProperty("item_id").startsWith("E-")) + && (aifComponentContextsTemp[i].getComponent().getProperty("release_status_list") != "")) { + aifComponentContexts[k] = aifComponentContextsTemp[i]; + if (k < num - 1) { + k++; + } else { + break; + } + } + } + // ȡ°汾(汾ΪABCD) + String revision = ""; + String rev[] = new String[num]; + AIFComponentContext aifComponentContext; + Map map = new HashMap(); + String temp = ""; + for (int i = 0; i < aifComponentContexts.length; i++) { + revision = aifComponentContexts[i].getComponent().getProperty("item_revision_id"); + aifComponentContext = aifComponentContexts[i]; + rev[i] = revision; + map.put(revision, aifComponentContext); + } + boolean isNum=false; + for (int i = 0; i < rev.length; i++) { + temp = rev[0]; +// System.out.println(rev[i]); + try{ + + //Ƚϣ汾01,02,03,04 + if(Integer.valueOf(temp)0) { + tempRev=(TCComponentItemRevision) revs[j]; + } + } +// System.out.println(tempRev==null); + if(tempRev==null) { + tc=true; + message=message+rev.getProperty("object_string")+" "; + continue; + } + if(tempRev.getUid().equals(rev.getUid())) { +// System.out.println(rev.getProperty("object_string")); + virtualList.add(rev.getProperty("item_id")); + }else { + //δ˳ + tc=true; + message=message+rev.getProperty("object_string")+" "; + } + } + + } + } catch (TCException e) { + e.printStackTrace(); + } + } + +} diff --git a/src/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Action20191210.java b/src/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Action20191210.java new file mode 100644 index 0000000..6fd7401 --- /dev/null +++ b/src/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Action20191210.java @@ -0,0 +1,345 @@ +/** + * + */ +package com.connor.jk.plm.E_U8ToEBOM_New; + +import java.awt.event.ActionEvent; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.swing.AbstractAction; + +import org.eclipse.core.commands.AbstractHandler; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.common.actions.AbstractAIFAction; +import com.teamcenter.rac.aif.kernel.AIFComponentContext; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentBOMLine; +import com.teamcenter.rac.kernel.TCComponentBOMViewRevision; +import com.teamcenter.rac.kernel.TCComponentBOMWindow; +import com.teamcenter.rac.kernel.TCComponentBOMWindowType; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +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.util.MessageBox; + +/** + * @author Administrator + * + */ +public class E_U8ToU8_Action20191210 extends AbstractAIFAction { + private AbstractAIFApplication app; + private InterfaceAIFComponent targetComp; + private TCSession session; + + private TCProperty[] props; + private String[] prop = new String[8]; + private AIFComponentContext aif;// °汾 + private TCComponentBOMWindow window=null; + private TCComponentBOMLine line = null; + List virtualList=new ArrayList<>(); + boolean tc=false; + String message="·汾\n"; + public E_U8ToU8_Action20191210(AbstractAIFApplication arg0, String arg1) { + super(arg0, arg1); + this.app = arg0; + this.session = (TCSession) app.getSession(); + this.targetComp = app.getTargetComponent(); + } + + + + @Override + public void run() { + //2017.8.17ѡǰ汾 + if(!targetComp.getType().equals("JK8MaterialRevision")&&!targetComp.getType().equals("JK8Material")) { + //2018.4.13 ޸ʾΪѡӦ϶ϰ汾ִд˲ +// MessageBox.post("ѡJK8MaterialRevisionJK8Material͵ִд˲", "", MessageBox.ERROR); + MessageBox.post("ѡӦ϶ϰ汾ִд˲", "", MessageBox.ERROR); + return; + }else if(targetComp.getType().equals("JK8MaterialRevision")) { + try { + if(!targetComp.getProperty("item_id").startsWith("E-8")) { + MessageBox.post("ѡE-8ͷϽѡ", "", MessageBox.ERROR); + return; + } + } catch (Exception e1) { + e1.printStackTrace(); + } + try { + TCComponentItem componentItem=(TCComponentItem) session.search("...", new String[] {" ID"}, new String[] {((TCComponentItemRevision)targetComp).getTCProperty("item_id").getStringValue()})[0]; + + AIFComponentContext[] aifComponentContextsTemp = componentItem.getChildren(); + int num = 0; + for (int i = 0; i < aifComponentContextsTemp.length; i++) { + if (aifComponentContextsTemp[i].getComponent().getType().equals("JK8MaterialRevision")) { + if (aifComponentContextsTemp[i].getComponent().getProperty("release_status_list") != "") { + + num++; + } + + } + } + if (num == 0) { + MessageBox.post("δת", "", MessageBox.ERROR); + return; + } + // 汾ŵ + int k = 0; + AIFComponentContext[] aifComponentContexts = new AIFComponentContext[num]; + for (int i = 0; i < aifComponentContextsTemp.length; i++) { + if ((aifComponentContextsTemp[i].getComponent().getType().equals("JK8MaterialRevision")) + + && (aifComponentContextsTemp[i].getComponent().getProperty("release_status_list") != "")) { + aifComponentContexts[k] = aifComponentContextsTemp[i]; + if (k < num - 1) { + k++; + } else { + break; + } + } + } + // ȡ°汾(汾ΪABCD) + String revision = ""; + String rev[] = new String[num]; + AIFComponentContext aifComponentContext; + Map map = new HashMap(); + String temp = ""; + for (int i = 0; i < aifComponentContexts.length; i++) { + revision = aifComponentContexts[i].getComponent().getProperty("item_revision_id"); + aifComponentContext = aifComponentContexts[i]; + rev[i] = revision; + map.put(revision, aifComponentContext); + } + boolean isNum=false; + for (int i = 0; i < rev.length; i++) { + temp = rev[0]; +// System.out.println(rev[i]); + try{ + + //Ƚϣ汾01,02,03,04 + if(Integer.valueOf(temp)0) { + E_U8ToU8_Dialog dialog = new E_U8ToU8_Dialog(app, aif, targetComp, session,virtualList); + new Thread(dialog).run(); + }else { + + E_U8ToU8_Operation20191210 operation = new E_U8ToU8_Operation20191210(app, aif, targetComp, session); + this.session.queueOperation(operation); + } + }else if (targetComp.getType().equals("JK8Material")) { + // ȡµķ汾Уȡԣûʾ + try { + AIFComponentContext[] aifComponentContextsTemp = targetComp.getChildren(); + int num = 0; + for (int i = 0; i < aifComponentContextsTemp.length; i++) { + if (aifComponentContextsTemp[i].getComponent().getType().equals("JK8MaterialRevision")) { + if (aifComponentContextsTemp[i].getComponent().getProperty("item_id").startsWith("E-")) { + if (aifComponentContextsTemp[i].getComponent().getProperty("release_status_list") != "") { + + num++; + } + } else if (!aifComponentContextsTemp[i].getComponent().getProperty("item_id") + .startsWith("E-")) { +// MessageBox.post("ѡϺΪ\"E-\"ͷִд˲", "", MessageBox.ERROR); +// return; + } + } + } + if (num == 0) { + MessageBox.post("δת", "", MessageBox.ERROR); + return; + } + // 汾ŵ + int k = 0; + AIFComponentContext[] aifComponentContexts = new AIFComponentContext[num]; + for (int i = 0; i < aifComponentContextsTemp.length; i++) { + if ((aifComponentContextsTemp[i].getComponent().getType().equals("JK8MaterialRevision")) + && (aifComponentContextsTemp[i].getComponent().getProperty("item_id").startsWith("E-")) + && (aifComponentContextsTemp[i].getComponent().getProperty("release_status_list") != "")) { + aifComponentContexts[k] = aifComponentContextsTemp[i]; + if (k < num - 1) { + k++; + } else { + break; + } + } + } + // ȡ°汾(汾ΪABCD) + String revision = ""; + String rev[] = new String[num]; + AIFComponentContext aifComponentContext; + Map map = new HashMap(); + String temp = ""; + for (int i = 0; i < aifComponentContexts.length; i++) { + revision = aifComponentContexts[i].getComponent().getProperty("item_revision_id"); + aifComponentContext = aifComponentContexts[i]; + rev[i] = revision; + map.put(revision, aifComponentContext); + } + boolean isNum=false; + for (int i = 0; i < rev.length; i++) { + temp = rev[0]; +// System.out.println(rev[i]); + try{ + + //Ƚϣ汾01,02,03,04 + if(Integer.valueOf(temp)0) { + tempRev=(TCComponentItemRevision) revs[j]; + } + } +// System.out.println(tempRev==null); + if(tempRev==null) { + tc=true; + message=message+rev.getProperty("object_string")+" "; + continue; + } + if(tempRev.getUid().equals(rev.getUid())) { +// System.out.println(rev.getProperty("object_string")); + virtualList.add(rev.getProperty("item_id")); + }else { + //δ˳ + tc=true; + message=message+rev.getProperty("object_string")+" "; + } + } + + } + } catch (TCException e) { + e.printStackTrace(); + } + } + +} diff --git a/src/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Dialog.java b/src/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Dialog.java new file mode 100644 index 0000000..35831b7 --- /dev/null +++ b/src/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Dialog.java @@ -0,0 +1,782 @@ +package com.connor.jk.plm.E_U8ToEBOM_New; + +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Toolkit; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.swing.DefaultComboBoxModel; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextField; + +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.xssf.usermodel.XSSFWorkbook; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.aif.kernel.AIFComponentContext; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentBOMLine; +import com.teamcenter.rac.kernel.TCComponentBOMWindow; +import com.teamcenter.rac.kernel.TCComponentBOMWindowType; +import com.teamcenter.rac.kernel.TCComponentDataset; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCComponentScheduleTask; +import com.teamcenter.rac.kernel.TCComponentTcFile; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.kernel.TCTypeService; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; + + +public class E_U8ToU8_Dialog extends AbstractAIFDialog implements +ActionListener { + private AbstractAIFApplication app; + private TCSession session; + + private JButton celBtn; + private JButton OKBtn; + private ProgressBarThread wait; + private PropertyLayout pl; + private TCComponentItemRevision tcComponentItemRevision; + private AIFComponentContext aif; + private InterfaceAIFComponent targetComp; + private List virtualList; + private TCPreferenceService preferenceService; + private FileInputStream fis; + private HSSFWorkbook workbook; + private String message=" ñidͬĹͺŵʵ\n"; + private boolean tc=false; + Map> map=new HashMap<>();//Map>> + Map map2=new HashMap<>();//ID+ʵϵĹͺţʵID + private String[] statusType; + int count=1; + private String[] virtualKey; + JComboBox[] entityTechJbox; + JComboBox recogniseJbox; + JComboBox directionJbox; + private String[] Direction; + String[] infomation;//еѡϢ + JTextField[] virtualIDField; + JTextField[] virtualSpecField; + JTextField[] virtualTechField; + DefaultComboBoxModel model; + DefaultComboBoxModel directionModel; + TCComponentItemRevision topRev; + List selectDirection = new ArrayList<>(); + List actualIDList = new ArrayList<>();//Ŵӱлȡʵid + + + String CPSHH;//Ʒʶ +// String JSXH;//ͺ +// String GGXH;//ͺ +// String direction;// +// JTextField MBOMTech=new JTextField(16); +// JTextField MBOMSpec=new JTextField(16); + JTextField MBOMRecognize=new JTextField(16); + public E_U8ToU8_Dialog(AbstractAIFApplication app, AIFComponentContext aif, InterfaceAIFComponent targetComp, + TCSession session, List virtualList) { + topRev = (TCComponentItemRevision) aif.getComponent(); + + this.app=app; + this.aif=aif; + this.targetComp=targetComp; + this.session = session; + this.virtualList=virtualList; + } + + + /** + * ť + */ + private void addActionListenEvent() { +// inputBtn.addActionListener(this); + + } + + @Override + public void run() { + //2019.08.15 map2ȡеʵIDMBOMµÿBOMʵȡ + + // ȡñ + // жһ£ͬһǷͬĹͺţоͱ + //ȡEBOM + //TODO ȡеid + System.out.println("--------------"+virtualList.size()); + for (int i = 0; i < virtualList.size(); i++) { + System.out.println( virtualList.get(i)); + } + System.out.println("ʼ"); + String sxx = "jk_virtual_uid";// G8TlM0X6YvbLjA G8TlM0X6YvbLjA TJXl8kmSYvbLjA T1exiQYYYvbLjA + File file = getExcel(sxx); + if (file == null) { + return; + } + try { + fis = new FileInputStream(file); + workbook = new HSSFWorkbook(fis); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + + List virtualIDList=new ArrayList<>(); + HSSFSheet sheet = workbook.getSheetAt(0); + int lastRow = sheet.getLastRowNum(); + for (int i = 1; i <= lastRow; i++) { + HSSFRow row = sheet.getRow(i); + String virtualID=row.getCell(0).getStringCellValue();//ID + if(!virtualIDList.contains(virtualID)) { + virtualIDList.add(virtualID); + } + } + for (int i = 1; i <= lastRow; i++) { + System.out.println(""+i+""); + HSSFRow row = sheet.getRow(i); + System.out.println(row.getCell(3)==null); + String virtualID=row.getCell(0).getStringCellValue()==null?" ":row.getCell(0).getStringCellValue();//ID + System.out.println(virtualID); + String actualSpec=row.getCell(3)==null?" ":(row.getCell(3).getStringCellValue()==null?" ":row.getCell(3).getStringCellValue());//ʵϹͺ + + String actualID=row.getCell(4).getStringCellValue()==null?" ":row.getCell(4).getStringCellValue();//ʵID + actualIDList.add(actualID); + if(!virtualIDList.contains(virtualID+";"+actualSpec)) { + virtualIDList.add(virtualID+";"+actualSpec); + + }else { + message=message+virtualID+"-"+actualID+" "; + tc=true; + } + } + if(tc==true) { + MessageBox.post(message,"",MessageBox.INFORMATION); + return; + } + + //ûͬͺŵģ͵ + for (int i = 1; i <=lastRow; i++) { + HSSFRow row = sheet.getRow(i); + String virtualID=row.getCell(0).getStringCellValue();//ID + String virtualTech=row.getCell(1)==null?" ":(row.getCell(1).getStringCellValue()==null?" ":row.getCell(1).getStringCellValue());//ϵļͺ + String virtualSpec=row.getCell(2)==null?" ":(row.getCell(2).getStringCellValue()==null?" ":row.getCell(2).getStringCellValue());//ϵĹͺ + String actualSpec=row.getCell(3)==null?" ":(row.getCell(3).getStringCellValue()==null?" ":row.getCell(3).getStringCellValue());//ʵϵĹͺ + String actualID=row.getCell(4).getStringCellValue();//ʵϵID + map2.put(virtualID+" ID:"+actualSpec, actualID); + for (int j = 0; j < virtualList.size(); j++) { + if(virtualID.equals(virtualList.get(j))) { + if(map.containsKey(virtualID+"##"+virtualTech+"##"+virtualSpec)) { + List listTemp=map.get(virtualID+"##"+virtualTech+"##"+virtualSpec); + listTemp.add(actualSpec+" ID:"+actualID); + map.put(virtualID+"##"+virtualTech+"##"+virtualSpec, listTemp); + }else { + List listTemp=new ArrayList<>(); + listTemp.add(actualSpec+" ID:"+actualID); + map.put(virtualID+"##"+virtualTech+"##"+virtualSpec, listTemp); + } + } + + } + + } + initUI(); + } + + /** + * + */ + private JPanel midJPanel; + private JPanel topJPanel; + private JPanel rootJPanel; + + public void initUI() { + + this.setTitle("SIMICѡ"); + this.setLayout(new BorderLayout()); + Dimension screensize = Toolkit.getDefaultToolkit().getScreenSize(); + int x = 1300; + int y = 500; + this.setBounds((int) screensize.getWidth() / 2 - x / 2, + (int) screensize.getHeight() / 2 - y / 2, x, y); + pl = new PropertyLayout(10, 1);// öԻм +// pl.setRightMargin(0); + /*TCComponentForm form=null; + try { + form = (TCComponentForm) topRev.getTCProperty("IMAN_master_form_rev").getReferenceValueArray()[0]; + } catch (TCException e2) { + e2.printStackTrace(); + }*/ +// topJPanel = new JPanel(pl);//дMBOMļͺź͹ͺźͲƷʶ + /*//ȡEBOMĹͺ + try { + MBOMTech=new JTextField(16); + MBOMSpec=new JTextField(16); + System.out.println(form.getProperty("jk8TechModel")); + System.out.println(form.getProperty("jk8SpecModel")); + MBOMTech.setText(form.getProperty("jk8TechModel"));//ȡEBOMļͺ + MBOMSpec.setText(form.getProperty("jk8SpecModel")); + } catch (TCException e1) { + e1.printStackTrace(); + }*/ +// MBOMTech.setEditable(true); +// MBOMSpec.setEditable(true); + /*MBOMRecognize.setText(""); + MBOMRecognize.setEditable(true);*/ + /* topJPanel.add("1.1.left.top.preferred.preferred", new JLabel(" ͺ ")); + topJPanel.add("1.2.left.top.preferred.preferred", MBOMTech); + topJPanel.add("1.3.left.top.preferred.preferred", new JLabel(" ͺ ")); + topJPanel.add("1.4.left.top.preferred.preferred", MBOMSpec);*/ +// topJPanel.add("1.1.left.top.preferred.preferred", new JLabel(" Ʒʶ ")); + + String[] recognises; + // б + + /*selectDirection.add(" "); + selectDirection.add(""); + selectDirection.add(""); + directionModel=new DefaultComboBoxModel(selectDirection.toArray(new String[selectDirection.size()])); + directionJbox=new JComboBox(directionModel); +// directionJbox.setSelectedIndex(-1);//Ĭϲѡ + directionJbox.setSelectedIndex(1);//Ĭϲѡ + directionJbox.setEditable(false);*/ + + + //ȡʶ + try { + preferenceService = session.getPreferenceService(); + String puid = preferenceService.getStringValue("jk_sbh_puid"); + TCComponentForm tcom = (TCComponentForm) session.stringToComponent(puid);//kxQlGjU3YvbLjA + recognises = tcom.getTCProperty("jk8ProductIdentifyNO").getStringArrayValue();// ʶ + + model=new DefaultComboBoxModel<>(); + for (int j = 0; j < recognises.length; j++) { + model.addElement(recognises[j]); + } + recogniseJbox=new JAutoCompleteComboBox(model); + + } catch (TCException e1) { + e1.printStackTrace(); + } + + + /*topJPanel.add("1.6.left.top.preferred.preferred", recogniseJbox); + topJPanel.add("1.7.left.top.preferred.preferred", new JLabel(" ")); + topJPanel.add("1.8.left.top.preferred.preferred", directionJbox);*/ + topJPanel= new JPanel(new FlowLayout()); + /*topJPanel.add(new JLabel(" ͺ ")); + topJPanel.add(MBOMTech); + topJPanel.add(new JLabel(" ͺ ")); + topJPanel.add(MBOMSpec);*/ + topJPanel.add( new JLabel(" Ʒʶ ")); + topJPanel.add( recogniseJbox); + /*topJPanel.add(new JLabel(" ")); + topJPanel.add(directionJbox); + topJPanel.add(new JLabel(" "));*/ +// System.out.println("1-------"); + this.add(topJPanel, BorderLayout.NORTH); +// System.out.println("2-------"); + + + + +// midJPanel = new JPanel(pl); + midJPanel = new JPanel(new PropertyLayout()); + midJPanel.add("1.1.left.top.preferred.preferred",new JLabel("")); + midJPanel.add("1.2.left.top.preferred.preferred",new JLabel(" ")); + midJPanel.add("1.3.left.top.preferred.preferred",new JLabel(" ϼͺ ")); + midJPanel.add("1.4.left.top.preferred.preferred",new JLabel(" Ϲͺ ")); + midJPanel.add("1.5.left.top.preferred.preferred",new JLabel(" ʵϹͺ (ID) ")); + boolean hasCreat=setMidPanel(midJPanel, 0);// BOMתľƷ + + if(!hasCreat) { + MessageBox.post("ʵϾMBOMٽѡ","",MessageBox.INFORMATION); + } + + rootJPanel=new JPanel(new FlowLayout()); + OKBtn=new JButton("ȷ"); + celBtn=new JButton("ȡ"); + rootJPanel.add(OKBtn); + rootJPanel.add(celBtn); + OKBtn.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + //УʶǷ + + String[] regs=MBOMRecognize.getText().split(";"); + TCComponentForm tcom=null; + String[] recognises=null; + try { + preferenceService = session.getPreferenceService(); + String puid = preferenceService.getStringValue("jk_sbh_puid"); + tcom = (TCComponentForm) session.stringToComponent(puid);//kxQlGjU3YvbLjA + recognises = tcom.getTCProperty("jk8ProductIdentifyNO").getStringArrayValue(); + } catch (TCException e1) { + e1.printStackTrace(); + } + String errorReg=""; + boolean RRW=false; + for (int i = 0; i < regs .length; i++) { + RRW=false; + for (int j = 0; j < recognises.length; j++) { + if(regs[i].equals(recognises[j])) { + RRW=false; + break; + } + } + if(RRW==true) { + errorReg=errorReg+" "+regs[i]; + } + + } + if(errorReg.length()>0) { + MessageBox.post("ʶŲ"+errorReg,"",MessageBox.INFORMATION);// + }else { + boolean toOperation=true; + String item_id=""; + //жת֮ǰ + List entityList=new ArrayList<>(); + + infomation=new String[entityTechJbox.length]; + for (int i = 0; i childLineIDList=new ArrayList<>(); + try { + TCComponent[] mboms=tarRev.getTCProperty("JK8MBOMRelation").getReferenceValueArray(); + for (int i = 0; i < mboms.length; i++) { + TCComponentItem item=(TCComponentItem) mboms[i]; + TCComponentBOMLine line1=getTopLineByRev(item.getLatestItemRevision()); + + childLineIDList=getList(childLineIDList, line1); + + window.close(); + int x=0; + for (int j = 0; j < entityList.size(); j++) { + if(childLineIDList.contains(entityList.get(j))) { + x++; + } + } + if(x==entityList.size()) { + toOperation=false; + item_id=item.getProperty("item_id"); + break; + } + + + } + } catch (TCException e1) { + e1.printStackTrace(); + } + + if(!toOperation) { + MessageBox.post("ʵMBOM:"+item_id+",޷ٴ!","",MessageBox.INFORMATION); + }else { + disposeDialog(); + dispose(); + CPSHH=MBOMRecognize.getText(); +// JSXH=MBOMTech.getText(); +// GGXH=MBOMSpec.getText(); +// direction=(String) directionJbox.getSelectedItem(); + //תBOM + + CPSHH=(String) recogniseJbox.getSelectedItem();//Ʒʶ + //ȼEBOMMBOMϵǷMBOMİ汾ļͺź͹ͺͬҸMBOMѴѡʵϵģڣͽMBOM棬ھʹ + TCComponentItemRevision xxRev=null; + /*boolean isExists=false; + String countInfo=""; + int count=0; + TCComponentItemRevision tarRev=(TCComponentItemRevision) targetComp; + TCComponent[] mboms=null; + + try { + mboms=tarRev.getTCProperty("JK8MBOMRelation").getReferenceValueArray(); + for (int i = 0; i < mboms.length; i++) { + TCComponentItemRevision mbomRev=(TCComponentItemRevision) mboms[i]; + TCComponentForm mbomForm=null; + mbomForm=(TCComponentForm) mbomRev.getTCProperty("IMAN_master_form_rev").getReferenceValueArray()[0]; + String mbomJSXH=mbomForm.getProperty("jk8TechModel"); + String mbomGGXH=mbomForm.getProperty("jk8SpecModel"); + if(JSXH.equals(mbomJSXH)&&mbomGGXH.equals(GGXH)) { + System.out.println("1---------------"); + TCComponentBOMLine topline=getTopLineByRev(mbomRev); + Map virtualMap=new HashMap<>(); + virtualMap=getAllVirtlBomline(topline,virtualMap); + System.out.println("virtualMap.size()---------------"+virtualMap.size()); + window.close(); + for (int j = 0; j < infomation.length; j++) { + System.out.println("2---------------"); + String idString=infomation[j].split("@@")[3].split("ID:")[1]; + isExists=false; + for (TCComponentItemRevision key : virtualMap.keySet()) { + String compare = key.getProperty("item_id"); + if(idString.equals(compare)) { + isExists=true; + } + } + if(isExists==false) { + System.out.println("----------------"); + break; + } + } + + + } + if(isExists==true) { + System.out.println("-------------"); + xxRev=mbomRev; + count++; + countInfo=countInfo+mbomRev.getProperty("object_string")+";"; + }else { + System.out.println("½-----------------"); + } + } + } catch (TCException e1) { + e1.printStackTrace(); + } + if(count>1) { + MessageBox.post("ͬMBOM"+countInfo,"",MessageBox.INFORMATION); + return; + }*/ + wait = new ProgressBarThread("", "תУԵ..."); + wait.start(); + E_U8ToU8_Operation2 operation = new E_U8ToU8_Operation2(app, aif, targetComp, session,infomation,CPSHH,wait,xxRev); + session.queueOperation(operation); + } + } + } + }); + this.add(rootJPanel,BorderLayout.SOUTH); + celBtn.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + disposeDialog(); + dispose(); + + } + }); + if(hasCreat) { + + this.add(new JScrollPane(midJPanel), BorderLayout.CENTER); + this.setFocusable(true); + setAlwaysOnTop(true); + this.showDialog(); + this.setVisible(true); + } + } + private Map getAllVirtlBomline(TCComponentBOMLine line,Map virtualMap) {// bom + + try { + AIFComponentContext[] lins = line.getChildren(); + if (lins == null || lins.length <= 0) { + return virtualMap; + } + for (int i = 0; i < lins.length; i++) { + TCComponentBOMLine childLine = (TCComponentBOMLine) lins[i].getComponent(); +// System.out.println(childLine==null); +// System.out.println(childLine.getItemRevision()==null); +// System.out.println(virtualMap==null); + for (int j = 0; j < actualIDList.size(); j++) { + if(childLine.getItemRevision().getProperty("item_id").equals(actualIDList.get(j))) { + + virtualMap.put(childLine.getItemRevision(), ""); + } + } + + if (childLine.hasChildren()) { + virtualMap=getAllVirtlBomline(childLine,virtualMap); + } + + } + + } catch (Exception e) { + e.printStackTrace(); + } + return virtualMap; + } + private TCComponentBOMLine line = null; + private TCComponentBOMWindow window=null; + public TCComponentBOMLine getTopLineByRev(TCComponentItemRevision rev) {//öbomline + try { + TCTypeService service = session.getTypeService(); + TCComponentBOMWindowType winType = (TCComponentBOMWindowType) service + .getTypeComponent("BOMWindow"); + window = winType.create(null); + line = window.setWindowTopLine(rev.getItem(), rev, null, null); +// window.close();//رգᵼBOMռãBOMİ汾ɾTC + } catch (TCException e) { + e.printStackTrace(); + } + + return line; + } + + public boolean setMidPanel(JPanel midJPanel, int index2) { + System.out.println("м"); + for (String key : map.keySet()) { + System.out.println("Key = " + key); + List entity=map.get(key); +// count++; + } + virtualIDField=new JTextField[map.size()]; + virtualSpecField=new JTextField[map.size()]; + virtualTechField=new JTextField[map.size()]; + final JTextField[] entityIDField=new JTextField[map.size()]; + entityTechJbox=new JComboBox[map.size()]; + + /* recogniseJbox=new JComboBox[map.size()]; + String[] recognises; + model=new DefaultComboBoxModel[map.size()]; + + + //ȡʶ + try { + TCComponentForm tcom = (TCComponentForm) session.stringToComponent("kxQlGjU3YvbLjA"); + recognises = tcom.getTCProperty("jk8ProductIdentifyNO").getStringArrayValue();// ʶ + for (int i = 0; i < map.size(); i++) { + model[i]=new DefaultComboBoxModel<>(); + for (int j = 0; j < recognises.length; j++) { + model[i].addElement(recognises[j]); + } + } + for (int i = 0; i < map.size(); i++) { + recogniseJbox[i]=new JAutoCompleteComboBox(model[i]); + + } + } catch (TCException e1) { + e1.printStackTrace(); + }*/ + + virtualKey=new String[map.size()]; + statusType=new String[map.size()]; +// int directionCount=0; +// for (String key : map.keySet()) { +// if(key.split("##")[0].startsWith("7")) { +// directionCount++; +// } +// +// } +// directionJbox=new JComboBox[map.size()]; +// directionModel=new DefaultComboBoxModel[map.size()]; +// Direction=new String[map.size()]; +// for (int i = 0; i < map.size(); i++) { +// directionModel[i]=new DefaultComboBoxModel(selectDirection.toArray(new String[selectDirection.size()])); +// directionJbox[i] = new JComboBox(directionModel[i]); +// directionJbox[i].setSelectedIndex(-1); +// directionJbox[i].setEditable(false); +// +// } + for (String key : map.keySet()) { + count++; + System.out.println("count------------>"+count); + virtualKey[count-2]=key; + List entity=map.get(key); + System.out.println(count); + System.out.println(virtualIDField[count-2]==null); + virtualIDField[count-2]=new JTextField(15); + virtualSpecField[count-2]=new JTextField(30); + virtualTechField[count-2]=new JTextField(30); + midJPanel.add(count + ".1.left.top.preferred.preferred", new JLabel(" ")); + + + + midJPanel.add(count + ".2.left.top.preferred.preferred", virtualIDField[count-2]); + virtualIDField[count-2].setText(key.split("##")[0]); + virtualIDField[count-2].setEditable(false); + midJPanel.add(count + ".3.left.top.preferred.preferred", virtualTechField[count-2]); + virtualTechField[count-2].setText(key.split("##")[1]); + + virtualTechField[count-2].setEditable(false); + midJPanel.add(count + ".4.left.top.preferred.preferred", virtualSpecField[count-2]); + virtualSpecField[count-2].setText(key.split("##")[2]); + virtualSpecField[count-2].setEditable(false); + + List entityList=map.get(key); + List selectExportType = new ArrayList<>(); + for (int i = 0; i < entityList.size(); i++) { +// selectExportType.add(entityList.get(i).split("@@")[0]); + selectExportType.add(entityList.get(i)); + + } + //ֻһ + if(map.size()==1) { + selectExportType = new ArrayList<>(); + //ebomMBOMµitem + TCComponentItemRevision tarRev= (TCComponentItemRevision) targetComp; + List childLineIDList=new ArrayList<>(); + try { + TCComponent[] mboms=tarRev.getTCProperty("JK8MBOMRelation").getReferenceValueArray(); + for (int i = 0; i < mboms.length; i++) { + TCComponentItem item=(TCComponentItem) mboms[i]; + TCComponentBOMLine line1=getTopLineByRev(item.getLatestItemRevision()); + + childLineIDList=getList(childLineIDList, line1); + + + + + + window.close(); + } + } catch (TCException e1) { + e1.printStackTrace(); + } + for (int i = 0; i < entityList.size(); i++) { + String entityId=entityList.get(i).split("ID:")[1]; + if(!childLineIDList.contains(entityId)) { + + selectExportType.add(entityList.get(i)); + } + + } + if(selectExportType.size()==0) { + return false; + } + } + + + + entityTechJbox[count-2]= new JComboBox( + new DefaultComboBoxModel(selectExportType.toArray(new String[selectExportType.size()]))); + entityTechJbox[count-2].setSelectedIndex(-1); + entityTechJbox[count-2].setEditable(false); + entityTechJbox[count-2].addItemListener(new ItemListener() { + + @Override + public void itemStateChanged(ItemEvent e) { + // + System.out.println("rrererrere"); + System.out.println(e.getSource()); + System.out.println(e.getID()); + System.out.println(e.getItem()); + } + }); +// System.out.println("--------"+entityTechJbox[count-2].getSize().height); +// System.out.println("---------"+entityTechJbox[count-2].getSize().width); + entityTechJbox[count-2].setPreferredSize(new Dimension(280, 20)); + midJPanel.add(count + ".5.left.top.preferred.preferred", entityTechJbox[count-2]); +// if(key.split("##")[0].startsWith("7")) { +// midJPanel.add(count + ".5.left.top.preferred.preferred", directionJbox[count-2]); +// directionJbox[count-2].addItemListener(new ItemListener() { +// +// @Override +// public void itemStateChanged(ItemEvent e) { +// System.out.println("ѡ------------"); +// System.out.println(e.getSource()); +// System.out.println(e.getID()); +// System.out.println(e.getItem()); +// } +// }); +// } + +// entityIDField[count-2]=new JTextField(50); +// midJPanel.add(count + ".5.left.top.preferred.preferred", recogniseJbox[count-2]); +// recogniseJbox[count-2].setSelectedIndex(-1); + } + return true; + } + + @Override + public void actionPerformed(ActionEvent arg0) { + Object sourceObj = arg0.getSource(); + + + } + + public List getList(List childLineIDList,TCComponentBOMLine line1) { + + AIFComponentContext[] childlines=null; + try { + childlines = line1.getChildren(); + } catch (TCException e1) { + e1.printStackTrace(); + } + for (int j = 0; j < childlines.length; j++) { + TCComponentBOMLine childline=(TCComponentBOMLine) childlines[j].getComponent(); + if(!childline.hasChildren()) { + String childID=null; + try { + childID = childline.getItemRevision().getProperty("item_id"); + } catch (TCException e) { + e.printStackTrace(); + } + if(!childLineIDList.contains(childID)) { + childLineIDList.add(childID); + } + }else { + childLineIDList=getList(childLineIDList,childline); + } + } + return childLineIDList; + } + private File getExcel(String ssx) { + File file = null; + preferenceService = session.getPreferenceService(); + String puid = preferenceService.getStringValue(ssx); + if (puid == null) { + MessageBox.post("ϵԱѡ", "", MessageBox.ERROR); + return null; + } + TCComponentDataset dataset = null; + try { + dataset = (TCComponentDataset) session.stringToComponent(puid); + } catch (TCException e) { + e.printStackTrace(); + } + if (dataset == null) { + MessageBox.post("ݼڣϵԱѡ", "", MessageBox.ERROR); + return null; + } + try { + dataset.refresh(); + TCComponentTcFile[] files = dataset.getTcFiles(); + if (files.length == 0) { + MessageBox.post("ݼûõļ,", "", MessageBox.ERROR); + return null; + } else if (files.length > 1) { + MessageBox.post("ݼõļ", "", MessageBox.ERROR); + return null; + } else { + file = files[0].getFmsFile(); + } + } catch (TCException e) { + e.printStackTrace(); + } + + return file; + } + + + + +} diff --git a/src/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Dialog20190429 b/src/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Dialog20190429 new file mode 100644 index 0000000..e69de29 diff --git a/src/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Handler.java b/src/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Handler.java new file mode 100644 index 0000000..d67fcee --- /dev/null +++ b/src/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Handler.java @@ -0,0 +1,21 @@ +package com.connor.jk.plm.E_U8ToEBOM_New; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.connor.jk.plm.sqb.Generate_Action; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aifrcp.AIFUtility; + +public class E_U8ToU8_Handler extends AbstractHandler{ + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + E_U8ToU8_Action action=new E_U8ToU8_Action(app,null); + new Thread(action).start(); + return null; + } + +} diff --git a/src/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Operation.java b/src/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Operation.java new file mode 100644 index 0000000..1cd8aee --- /dev/null +++ b/src/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Operation.java @@ -0,0 +1,503 @@ +package com.connor.jk.plm.E_U8ToEBOM_New; + +import java.util.ArrayList; +import java.util.List; + +import javax.swing.JTextField; + +//import com.connor.jk.plm.tempToFormal.ClassProperty; +//import com.connor.jk.plm.tempToFormal.SoaServerUtil; +import com.teamcenter.rac.aif.AbstractAIFApplication; +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.TCComponentBOMViewRevision; +import com.teamcenter.rac.kernel.TCComponentBOMWindow; +import com.teamcenter.rac.kernel.TCComponentBOMWindowType; +import com.teamcenter.rac.kernel.TCComponentFolder; +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.TCComponentItemType; +import com.teamcenter.rac.kernel.TCComponentUser; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.kernel.TCTypeService; +import com.teamcenter.rac.kernel.TCUserService; +import com.teamcenter.rac.kernel.ics.ICSApplicationObject; +import com.teamcenter.rac.kernel.ics.ICSProperty; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.schemas.soa._2006_03.exceptions.ServiceException; + +public class E_U8ToU8_Operation extends AbstractAIFOperation { + private AbstractAIFApplication app; + private TCSession session; + private InterfaceAIFComponent targetComp; + private AIFComponentContext aif; + private String[] prop; + private TCProperty[] props; + private TCUserService userService; + private TCPreferenceService service; + private TCComponentItem target; + private TCComponentBOMLine line = null; + private TCComponentBOMWindow window=null; + private TCComponentBOMWindow windowOld=null; + private List childRevList;//봴JListй + + public E_U8ToU8_Operation(AbstractAIFApplication app2, AIFComponentContext aif, InterfaceAIFComponent targetComp, + TCSession session2) { + this.app = app2; + this.targetComp = targetComp; + this.aif = aif; + this.session = session2; + } + + private String itemId;// ʽϵID + private String itemRev;// ʽϵİ汾 + private String itemName;// ʽϵ + + private TCComponentItemRevision itemRevision;// ʽϵİ汾 + + private TCComponentItemRevision rev; + private TCComponentBOMViewRevision bomViewRevision; + private AIFComponentContext[] Context2; + String class_id ; + Integer[] keys = null; + String[] vals = null; + String url=""; + String[] propertyValue=null; + String[] properties=null; + String[] values=null; + @Override + public void executeOperation() throws Exception { + service=session.getPreferenceService(); + url= service.getStringValue("Autocode_SendClassServer_URL"); + // TODO + // 1.ȡѷ°汾ķ + class_id = ((TCComponent) aif.getComponent()).getClassificationClass(); + if(class_id==""){ + MessageBox.post("δִ࣬д˲", "", MessageBox.ERROR); + return; + } +// int a=1; +// target = (TCComponentItem) targetComp; + // TODO ѡ +// service = session.getPreferenceService(); + // String class_id=service.getStringValue(""); + if (aif.getComponent() instanceof TCComponentItemRevision) { + rev = (TCComponentItemRevision) aif.getComponent(); + + +// AIFComponentd + // object_name + props = rev.getTCProperties(new String[] { "object_name" }); + itemName = props[0].getStringValue(); + + // ID + props = rev.getTCProperties(new String[] { "item_id" }); + itemId = props[0].getStringValue().substring(2); + + } + + //ֻתһ汾 + TCComponentItem newitem =null; + TCComponentItemRevision newrev=null; + boolean isExist=false; + try { + //ӦȲѯһ¿ǷѾitemû½оֱӻȡ + newitem = rev.saveAsItem(itemId, null); + newrev = newitem.getLatestItemRevision();//°汾 + + } catch (Exception e1) { +// TCComponent[] u8items=session.search("...", new String[] {" ID"}, new String[] {itemId}); + InterfaceAIFComponent[] comps = null; + comps = Util.searchComponentsCollection(session,"...", new String[] { " ID" },new String[] { itemId }); + +// newitem=(TCComponentItem) u8items[0]; + newitem=(TCComponentItem) comps[0]; + //ҪѾɵu8bomǷѾ + if(newitem.getLatestItemRevision().getProperty("release_status_list").length()>0) { + //20200320 Ŀܺϰ治ͬһߣҪ· + Util.setByPass(true); + try { + newrev=newitem.getLatestItemRevision().saveAs(newitem.getNewRev()); + } catch (Exception e) { +// e.printStackTrace(); + } + Util.setByPass(false); + isExist=true; + }else { + MessageBox.post("ѾΪU8,U8°Ƿ񷢲","",MessageBox.ERROR); + return; + } + + } + + if(isExist==false) { + + TCComponentUser user = this.session.getUser(); + TCComponentFolder newStuff = user.getNewStuffFolder(); + newStuff.add("contents", newitem); + } + + newitem.refresh(); + propertyValue=service.getStringValues("jk_prop_value");//ַ֧͵Ըֵ + TCComponentForm form1=(TCComponentForm) rev.getReferenceListProperty("IMAN_master_form_rev")[0]; + TCComponentForm form2=(TCComponentForm) newitem.getLatestItemRevision().getReferenceListProperty("IMAN_master_form_rev")[0]; + if(propertyValue==null) { + MessageBox.post("ϵԱѡjk_prop_value","",MessageBox.ERROR); + return; + } + for(int i=0;i"+keys[count1]); + vals[count1] = cPropS[j].getValue(); + System.out.println("vals["+count1+"]================>"+vals[count1]); + count1++; + } + break; + } +// if(a==1){ +// return; +// } + // TODO 2.,°汾͵ + // class_id = "";// TODO дѡ + try { +// createICS(class_id, newrev, newrev.getTCProperty("item_id").getStringValue(), keys, vals); + sendObjToClassficationByWebService(newitem.getLatestItemRevision(),keys,vals); + } catch (Exception e) { + MessageBox.post("ʧ","",MessageBox.ERROR); + e.printStackTrace(); + return; + } + + if(isSucceed==false) { + MessageBox.post("ʧ","",MessageBox.ERROR); + return; + } + + if (isExist == false) { + + MessageBox.post("" + itemId + "ɹ\nNewStuffļ", "ɹ", MessageBox.INFORMATION); + }else { + MessageBox.post("" + itemId + "ɹ", "ɹ", MessageBox.INFORMATION); + } + + } + + // ϰ汾͵ + public void createICS(String class_id, TCComponentItemRevision target, String partid, Integer[] integers, + String[] vals) throws TCException { + TCClassificationService myService = session.getClassificationService(); + ICSApplicationObject icsAppObj = myService.newICSApplicationObject("ICM"); + icsAppObj.create(partid, target.getUid()); + icsAppObj.setView(class_id); +// // ɾʱ +// rev = (TCComponentItemRevision) aif.getComponent(); +// TCComponentICO[] ico = rev.getClassificationObjects(); +// for (int i = 0; i < ico.length; i++) { +// ico[0].delete(); +// } + ICSProperty icspro[] = new ICSProperty[integers.length]; + + for (int i = 0; i < icspro.length; i++) { + System.out.println(" CLASS ID = " + integers[i] + " =" + vals[i]); + icspro[i] = new ICSProperty(integers[i], vals[i]); + } + icsAppObj.setProperties(icspro); +// icsAppObj.save();TODO ʲôã + } + + + + public TCComponentBOMLine getTopLineByRev(TCComponentItemRevision rev) {//öbomline + try { + TCTypeService service = session.getTypeService(); + TCComponentBOMWindowType winType = (TCComponentBOMWindowType) service + .getTypeComponent("BOMWindow"); + window = winType.create(null); + line = window.setWindowTopLine(rev.getItem(), rev, null, null); +// window.close();//رգᵼBOMռãBOMİ汾ɾTC + } catch (TCException e) { + e.printStackTrace(); + } + + return line; + } + public TCComponentBOMLine getTopLineByRev2(TCComponentItemRevision rev,TCComponentBOMWindow window) {//öbomline + try { + + line = window.setWindowTopLine(rev.getItem(), rev, null, null); +// window.close();//رգᵼBOMռãBOMİ汾ɾTC + } catch (TCException e) { + e.printStackTrace(); + } + + return line; + } + + private void setbom(TCComponentBOMLine line ,TCComponentItemRevision rev) {//bom + + try { +// setGlxq(rev); +// System.out.println("lineddd=" + line.toString()); + AIFComponentContext[] lins = line.getChildren(); + if (lins == null || lins.length <= 0) { + return; + } + for (AIFComponentContext l : lins) { + TCComponent lt = (TCComponent) l.getComponent(); + //bl_substitute_listԣб + String bl_substitute_list=((TCComponentBOMLine) lt).getProperty("bl_substitute_list"); + System.out.println("bl_substitute_list---->"+bl_substitute_list); + String[] substitute_list=bl_substitute_list.split(","); + System.out.println("bl_substitute_list=========>"+substitute_list.length); + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------1----------"+substitute_list[i]); + } + TCProperty[] tcs = ((TCComponentBOMLine) lt) + .getTCProperties(new String[] { + "bl_quantity","bl_sequence_no", +// "jk8SubstitRatio", "jk8SubstitOrder","jk8EffectiveDate","jk8SubCompLossRate",//治˻ȡ +// "bl_item_uom_tag","jk8TechnicModel","jk8SpecificModel",// + "JK8Remark","JK8SupplyType","JK8Warehouse", + "JK8RemarkDesc","jk8SubCompLossRate" + + });//ֿ⡢Ӧͣbl_substituteȣjk8SubstitRatiojk8SubstitOrderЧڣjk8EffectiveDate + line.lock(); + line.remove("", lt); + +// TCComponentItem chitem = ((TCComponentBOMLine) lt).getItem() +// .getLatestItemRevision().saveAsItem(null, null); +// TCComponentItemRevision r = chitem.getLatestItemRevision(); +// TCComponentItemRevision r=((TCComponentBOMLine) lt).getItem().getLatestItemRevision(); + TCComponentItemRevision r=((TCComponentBOMLine) lt).getItemRevision();//BOMLineӦItemRevision + System.out.println(line==null); + System.out.println(r==null); + TCComponentBOMLine childBomLine = line.add(r.getItem(), r, + null, false, ""); + if(substitute_list.length>0&&!bl_substitute_list.trim().equals("")){ + + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------------"+substitute_list[i]+"----------"); + TCComponentItemRevision itemRevision=((TCComponentItem)(session.search(" ID",new String[]{ " ID"}, new String[]{substitute_list[i].trim()})[0])).getLatestItemRevision(); + childBomLine.add(null, itemRevision, null, true); + } + } + childBomLine.setTCProperties(tcs); + + setbom(childBomLine,r); + line.save(); + line.unlock(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + + private void setbom2(TCComponentBOMWindow window,TCComponentBOMLine line ,TCComponentBOMLine lineOld,int mark) {//bom + System.out.println("bom"); + if (mark == 0) { + try { + AIFComponentContext[] lins = line.getChildren(); + if (lins == null || lins.length <= 0) { +// return; + }else { + window.lock(); + // ɾӼbomline + for (AIFComponentContext l : lins) { + System.out.println("ɾbom"); + TCComponent lt = (TCComponent) l.getComponent(); + + line.lock(); + line.remove("", lt); + line.save(); + line.unlock(); + } + } + + // ٰebomԸƽbomlineӹ + lins = lineOld.getChildren(); + if (lins == null || lins.length <= 0) { + return; + } + for (AIFComponentContext l : lins) { + TCComponent lt = (TCComponent) l.getComponent(); + //bl_substitute_listԣб + String bl_substitute_list=((TCComponentBOMLine) lt).getProperty("bl_substitute_list"); + System.out.println("bl_substitute_list---->"+bl_substitute_list); + String[] substitute_list=bl_substitute_list.split(","); + System.out.println("bl_substitute_list=========>"+substitute_list.length); + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------1----------"+substitute_list[i]); + } + TCProperty[] tcs = ((TCComponentBOMLine) lt) + .getTCProperties(new String[] { + "bl_quantity","bl_sequence_no", + "JK8Remark","JK8SupplyType","JK8Warehouse", + "JK8RemarkDesc","jk8SubCompLossRate" + + });//ֿ⡢Ӧͣbl_substituteȣjk8SubstitRatiojk8SubstitOrderЧڣjk8EffectiveDate + line.lock(); + + + TCComponentItemRevision r=((TCComponentBOMLine) lt).getItemRevision();//BOMLineӦItemRevision + + TCComponentBOMLine childBomLine = line.add(r.getItem(), r, + null, false, ""); + if(substitute_list.length>0&&!bl_substitute_list.trim().equals("")){ + + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------------"+substitute_list[i]+"----------"); + TCComponentItemRevision itemRevision=((TCComponentItem)(session.search(" ID",new String[]{ " ID"}, new String[]{substitute_list[i].trim()})[0])).getLatestItemRevision(); + childBomLine.add(null, itemRevision, null, true); + } + } + childBomLine.setTCProperties(tcs); + +// setbom2(childBomLine,r,1); + line.save(); + line.unlock(); + } + window.save(); + window.unlock(); + ; + } catch (Exception e) { + e.printStackTrace(); + } + } + + } + //͵ class_id=codeRemarkˮ룿 + boolean isSucceed=true; + public void sendObjToClassficationByWebService(TCComponentItemRevision rev,Integer[] keys, + String[] vals){ + try { + System.out.println("class_id-----dddddd----->"+class_id); + if( !class_id.replace(" ", "").equals("") ){ + + List propList = new ArrayList<>(); + for(int i = 0; i < keys.length; i++){ + ClassProperty prop = new ClassProperty(keys[i], vals[i]);// + propList.add(prop); + } + String json = SoaServerUtil.objectToJson(propList);//JavaתΪjson + try { + SoaServerUtil.grantWritePrivilege(session, rev);//дȨ + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + try { + SoaServerUtil.sendToClass(rev.getUid(), class_id, json,url);//͵ + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + try { + SoaServerUtil.grantReadPrivilege(session, rev);//Ȩ + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + } catch (Exception e) { + isSucceed=false; + e.printStackTrace(); + } + + } + +} diff --git a/src/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Operation2 20190429 b/src/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Operation2 20190429 new file mode 100644 index 0000000..386b106 --- /dev/null +++ b/src/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Operation2 20190429 @@ -0,0 +1,532 @@ +package com.connor.jk.plm.E_U8ToEBOM_New; + +import java.util.ArrayList; +import java.util.List; + +import javax.swing.JTextField; + +//import com.connor.jk.plm.tempToFormal.ClassProperty; +//import com.connor.jk.plm.tempToFormal.SoaServerUtil; +import com.teamcenter.rac.aif.AbstractAIFApplication; +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.TCComponentBOMViewRevision; +import com.teamcenter.rac.kernel.TCComponentBOMWindow; +import com.teamcenter.rac.kernel.TCComponentBOMWindowType; +import com.teamcenter.rac.kernel.TCComponentFolder; +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.TCComponentItemType; +import com.teamcenter.rac.kernel.TCComponentUser; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.kernel.TCTypeService; +import com.teamcenter.rac.kernel.TCUserService; +import com.teamcenter.rac.kernel.ics.ICSApplicationObject; +import com.teamcenter.rac.kernel.ics.ICSProperty; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.schemas.soa._2006_03.exceptions.ServiceException; + +public class E_U8ToU8_Operation extends AbstractAIFOperation { + private AbstractAIFApplication app; + private TCSession session; + private InterfaceAIFComponent targetComp; + private AIFComponentContext aif; + private String[] prop; + private TCProperty[] props; + private TCUserService userService; + private TCPreferenceService service; + private TCComponentItem target; + private TCComponentBOMLine line = null; + private TCComponentBOMWindow window=null; + private TCComponentBOMWindow windowOld=null; + private List childRevList;//봴JListй + + public E_U8ToU8_Operation(AbstractAIFApplication app2, AIFComponentContext aif, InterfaceAIFComponent targetComp, + TCSession session2) { + this.app = app2; + this.targetComp = targetComp; + this.aif = aif; + this.session = session2; + } + + private String itemId;// ʽϵID + private String itemRev;// ʽϵİ汾 + private String itemName;// ʽϵ + + private TCComponentItemRevision itemRevision;// ʽϵİ汾 + + private TCComponentItemRevision rev; + private TCComponentBOMViewRevision bomViewRevision; + private AIFComponentContext[] Context2; + String class_id ; + Integer[] keys = null; + String[] vals = null; + String url=""; + String[] propertyValue=null; + String[] properties=null; + String[] values=null; + @Override + public void executeOperation() throws Exception { + service=session.getPreferenceService(); + url= service.getStringValue("Autocode_SendClassServer_URL"); + // TODO + // 1.ȡѷ°汾ķ + class_id = ((TCComponent) aif.getComponent()).getClassificationClass(); + if(class_id==""){ + MessageBox.post("δִ࣬д˲", "", MessageBox.ERROR); + return; + } +// int a=1; +// target = (TCComponentItem) targetComp; + // TODO ѡ +// service = session.getPreferenceService(); + // String class_id=service.getStringValue(""); + if (aif.getComponent() instanceof TCComponentItemRevision) { + rev = (TCComponentItemRevision) aif.getComponent(); + + +// AIFComponentd + // object_name + props = rev.getTCProperties(new String[] { "object_name" }); + itemName = props[0].getStringValue(); + + // ID + props = rev.getTCProperties(new String[] { "item_id" }); + itemId = props[0].getStringValue().substring(2); + + } + + //ֻתһ汾 + TCComponentItem newitem =null; + TCComponentItemRevision newrev=null; + boolean isExist=false; + try { + //ӦȲѯһ¿ǷѾitemû½оֱӻȡ + newitem = rev.saveAsItem(itemId, null); + newrev = newitem.getLatestItemRevision();//°汾 + + } catch (Exception e1) { +// TCComponent[] u8items=session.search("...", new String[] {" ID"}, new String[] {itemId}); + InterfaceAIFComponent[] comps = null; + comps = Util.searchComponentsCollection(session, + "...", new String[] { " ID" }, + new String[] { itemId }); + +// newitem=(TCComponentItem) u8items[0]; + newitem=(TCComponentItem) comps[0]; + //ҪѾɵu8bomǷѾ + if(newitem.getLatestItemRevision().getProperty("release_status_list").length()>0) { + + try { + newrev=newitem.getLatestItemRevision().saveAs(newitem.getNewRev()); + } catch (Exception e) { +// e.printStackTrace(); + } + isExist=true; + }else { + MessageBox.post("ѾΪU8,U8°Ƿ񷢲","",MessageBox.ERROR); + return; + } + + } + + if(isExist==false) { + + TCComponentUser user = this.session.getUser(); + TCComponentFolder newStuff = user.getNewStuffFolder(); + newStuff.add("contents", newitem); + } + + newitem.refresh(); + propertyValue=service.getStringValues("jk_prop_value");//ַ֧͵Ըֵ + TCComponentForm form1=(TCComponentForm) rev.getReferenceListProperty("IMAN_master_form_rev")[0]; + TCComponentForm form2=(TCComponentForm) newitem.getLatestItemRevision().getReferenceListProperty("IMAN_master_form_rev")[0]; + for(int i=0;i"+keys[count1]); + vals[count1] = cPropS[j].getValue(); + System.out.println("vals["+count1+"]================>"+vals[count1]); + count1++; + } + break; + } +// if(a==1){ +// return; +// } + // TODO 2.,°汾͵ + // class_id = "";// TODO дѡ + try { +// createICS(class_id, newrev, newrev.getTCProperty("item_id").getStringValue(), keys, vals); + sendObjToClassficationByWebService(newitem.getLatestItemRevision(),keys,vals); + } catch (Exception e) { + MessageBox.post("ʧ","",MessageBox.ERROR); + e.printStackTrace(); + return; + } + + if(isSucceed==false) { + MessageBox.post("ʧ","",MessageBox.ERROR); + return; + } + + if (isExist == false) { + + MessageBox.post("" + itemId + "ɹ\nNewStuffļ", "ɹ", MessageBox.INFORMATION); + }else { + MessageBox.post("" + itemId + "ɹ\nNewStuffļ", "ɹ", MessageBox.INFORMATION); + } + + } + + // ϰ汾͵ + public void createICS(String class_id, TCComponentItemRevision target, String partid, Integer[] integers, + String[] vals) throws TCException { + TCClassificationService myService = session.getClassificationService(); + ICSApplicationObject icsAppObj = myService.newICSApplicationObject("ICM"); + icsAppObj.create(partid, target.getUid()); + icsAppObj.setView(class_id); +// // ɾʱ +// rev = (TCComponentItemRevision) aif.getComponent(); +// TCComponentICO[] ico = rev.getClassificationObjects(); +// for (int i = 0; i < ico.length; i++) { +// ico[0].delete(); +// } + ICSProperty icspro[] = new ICSProperty[integers.length]; + + for (int i = 0; i < icspro.length; i++) { + System.out.println(" CLASS ID = " + integers[i] + " =" + vals[i]); + icspro[i] = new ICSProperty(integers[i], vals[i]); + } + icsAppObj.setProperties(icspro); +// icsAppObj.save();TODO ʲôã + } + + + + public TCComponentBOMLine getTopLineByRev(TCComponentItemRevision rev) {//öbomline + try { + TCTypeService service = session.getTypeService(); + TCComponentBOMWindowType winType = (TCComponentBOMWindowType) service + .getTypeComponent("BOMWindow"); + window = winType.create(null); + line = window.setWindowTopLine(rev.getItem(), rev, null, null); +// window.close();//رգᵼBOMռãBOMİ汾ɾTC + } catch (TCException e) { + e.printStackTrace(); + } + + return line; + } + public TCComponentBOMLine getTopLineByRev2(TCComponentItemRevision rev,TCComponentBOMWindow window) {//öbomline + try { + + line = window.setWindowTopLine(rev.getItem(), rev, null, null); +// window.close();//رգᵼBOMռãBOMİ汾ɾTC + } catch (TCException e) { + e.printStackTrace(); + } + + return line; + } + + private void setbom(TCComponentBOMLine line ,TCComponentItemRevision rev) {//bom + + try { +// setGlxq(rev); +// System.out.println("lineddd=" + line.toString()); + AIFComponentContext[] lins = line.getChildren(); + if (lins == null || lins.length <= 0) { + return; + } + for (AIFComponentContext l : lins) { + TCComponent lt = (TCComponent) l.getComponent(); + //bl_substitute_listԣб + String bl_substitute_list=((TCComponentBOMLine) lt).getProperty("bl_substitute_list"); + System.out.println("bl_substitute_list---->"+bl_substitute_list); + String[] substitute_list=bl_substitute_list.split(","); + System.out.println("bl_substitute_list=========>"+substitute_list.length); + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------1----------"+substitute_list[i]); + } + TCProperty[] tcs = ((TCComponentBOMLine) lt) + .getTCProperties(new String[] { + "bl_quantity","bl_sequence_no", +// "jk8SubstitRatio", "jk8SubstitOrder","jk8EffectiveDate","jk8SubCompLossRate",//治˻ȡ +// "bl_item_uom_tag","jk8TechnicModel","jk8SpecificModel",// + "JK8Remark","JK8SupplyType","JK8Warehouse", + "JK8RemarkDesc","jk8SubCompLossRate" + + });//ֿ⡢Ӧͣbl_substituteȣjk8SubstitRatiojk8SubstitOrderЧڣjk8EffectiveDate + line.lock(); + line.remove("", lt); + +// TCComponentItem chitem = ((TCComponentBOMLine) lt).getItem() +// .getLatestItemRevision().saveAsItem(null, null); +// TCComponentItemRevision r = chitem.getLatestItemRevision(); +// TCComponentItemRevision r=((TCComponentBOMLine) lt).getItem().getLatestItemRevision(); + TCComponentItemRevision r=((TCComponentBOMLine) lt).getItemRevision();//BOMLineӦItemRevision + + TCComponentBOMLine childBomLine = line.add(r.getItem(), r, + null, false, ""); + if(substitute_list.length>0&&!bl_substitute_list.trim().equals("")){ + + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------------"+substitute_list[i]+"----------"); + TCComponentItemRevision itemRevision=((TCComponentItem)(session.search(" ID",new String[]{ " ID"}, new String[]{substitute_list[i].trim()})[0])).getLatestItemRevision(); + childBomLine.add(null, itemRevision, null, true); + } + } + childBomLine.setTCProperties(tcs); + + setbom(childBomLine,r); + line.save(); + line.unlock(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + + private void setbom2(TCComponentBOMLine line ,TCComponentBOMLine lineOld,int mark) {//bom + + if (mark == 0) { + try { + AIFComponentContext[] lins = line.getChildren(); + if (lins == null || lins.length <= 0) { + return; + } + // ɾӼbomline + for (AIFComponentContext l : lins) { + TCComponent lt = (TCComponent) l.getComponent(); + + line.lock(); + line.remove("", lt); + line.save(); + line.unlock(); + } + // ٰebomԸƽbomlineӹ + lins = lineOld.getChildren(); + if (lins == null || lins.length <= 0) { + return; + } + for (AIFComponentContext l : lins) { + TCComponent lt = (TCComponent) l.getComponent(); + //bl_substitute_listԣб + String bl_substitute_list=((TCComponentBOMLine) lt).getProperty("bl_substitute_list"); + System.out.println("bl_substitute_list---->"+bl_substitute_list); + String[] substitute_list=bl_substitute_list.split(","); + System.out.println("bl_substitute_list=========>"+substitute_list.length); + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------1----------"+substitute_list[i]); + } + TCProperty[] tcs = ((TCComponentBOMLine) lt) + .getTCProperties(new String[] { + "bl_quantity","bl_sequence_no", + "JK8Remark","JK8SupplyType","JK8Warehouse", + "JK8RemarkDesc","jk8SubCompLossRate" + + });//ֿ⡢Ӧͣbl_substituteȣjk8SubstitRatiojk8SubstitOrderЧڣjk8EffectiveDate + line.lock(); + + + TCComponentItemRevision r=((TCComponentBOMLine) lt).getItemRevision();//BOMLineӦItemRevision + + TCComponentBOMLine childBomLine = line.add(r.getItem(), r, + null, false, ""); + if(substitute_list.length>0&&!bl_substitute_list.trim().equals("")){ + + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------------"+substitute_list[i]+"----------"); + TCComponentItemRevision itemRevision=((TCComponentItem)(session.search(" ID",new String[]{ " ID"}, new String[]{substitute_list[i].trim()})[0])).getLatestItemRevision(); + childBomLine.add(null, itemRevision, null, true); + } + } + childBomLine.setTCProperties(tcs); + +// setbom2(childBomLine,r,1); + line.save(); + line.unlock(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + /*try { + AIFComponentContext[] lins = line.getChildren(); + if (lins == null || lins.length <= 0) { + return; + } + for (AIFComponentContext l : lins) { + TCComponent lt = (TCComponent) l.getComponent(); + //bl_substitute_listԣб + String bl_substitute_list=((TCComponentBOMLine) lt).getProperty("bl_substitute_list"); + System.out.println("bl_substitute_list---->"+bl_substitute_list); + String[] substitute_list=bl_substitute_list.split(","); + System.out.println("bl_substitute_list=========>"+substitute_list.length); + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------1----------"+substitute_list[i]); + } + TCProperty[] tcs = ((TCComponentBOMLine) lt) + .getTCProperties(new String[] { + "bl_quantity","bl_sequence_no", + "JK8Remark","JK8SupplyType","JK8Warehouse", + "JK8RemarkDesc","jk8SubCompLossRate" + + });//ֿ⡢Ӧͣbl_substituteȣjk8SubstitRatiojk8SubstitOrderЧڣjk8EffectiveDate + line.lock(); + line.remove("", lt); + + + TCComponentItemRevision r=((TCComponentBOMLine) lt).getItemRevision();//BOMLineӦItemRevision + + TCComponentBOMLine childBomLine = line.add(r.getItem(), r, + null, false, ""); + if(substitute_list.length>0&&!bl_substitute_list.trim().equals("")){ + + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------------"+substitute_list[i]+"----------"); + TCComponentItemRevision itemRevision=((TCComponentItem)(session.search(" ID",new String[]{ " ID"}, new String[]{substitute_list[i].trim()})[0])).getLatestItemRevision(); + childBomLine.add(null, itemRevision, null, true); + } + } + childBomLine.setTCProperties(tcs); + + setbom2(childBomLine,r,1); + line.save(); + line.unlock(); + } + } catch (Exception e) { + e.printStackTrace(); + }*/ + } + //͵ class_id=codeRemarkˮ룿 + boolean isSucceed=true; + public void sendObjToClassficationByWebService(TCComponentItemRevision rev,Integer[] keys, + String[] vals){ + try { + System.out.println("class_id-----dddddd----->"+class_id); + if( !class_id.replace(" ", "").equals("") ){ + + List propList = new ArrayList<>(); + for(int i = 0; i < keys.length; i++){ + ClassProperty prop = new ClassProperty(keys[i], vals[i]);// + propList.add(prop); + } + String json = SoaServerUtil.objectToJson(propList);//JavaתΪjson + try { + SoaServerUtil.grantWritePrivilege(session, rev);//дȨ + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + try { + SoaServerUtil.sendToClass(rev.getUid(), class_id, json,url);//͵ + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + try { + SoaServerUtil.grantReadPrivilege(session, rev);//Ȩ + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + } catch (Exception e) { + isSucceed=false; + e.printStackTrace(); + } + + } + +} diff --git a/src/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Operation2.java b/src/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Operation2.java new file mode 100644 index 0000000..cab2caf --- /dev/null +++ b/src/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Operation2.java @@ -0,0 +1,1291 @@ +package com.connor.jk.plm.E_U8ToEBOM_New; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.swing.JTextField; + +import org.apache.axiom.om.OMAbstractFactory; +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.OMFactory; +import org.apache.axiom.om.OMNamespace; +import org.apache.axis2.AxisFault; +import org.apache.axis2.addressing.EndpointReference; +import org.apache.axis2.client.Options; +import org.apache.axis2.client.ServiceClient; +import org.apache.axis2.transport.http.HTTPConstants; + +//import com.connor.jk.plm.DbomToEbom.ChangeDbomBean; +//import com.connor.jk.plm.DbomToEbom.ChangeDbomUtil; +//import com.connor.jk.plm.addMark.Util; +//import com.connor.jk.plm.tempToFormal.ClassProperty; +//import com.connor.jk.plm.tempToFormal.SoaServerUtil; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.AbstractAIFOperation; +import com.teamcenter.rac.aif.kernel.AIFComponentContext; +import com.teamcenter.rac.aif.kernel.AbstractAIFSession; +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.TCComponentBOMViewRevision; +import com.teamcenter.rac.kernel.TCComponentBOMWindow; +import com.teamcenter.rac.kernel.TCComponentBOMWindowType; +import com.teamcenter.rac.kernel.TCComponentFolder; +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.TCComponentItemType; +import com.teamcenter.rac.kernel.TCComponentUser; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.kernel.TCTypeService; +import com.teamcenter.rac.kernel.TCUserService; +import com.teamcenter.rac.kernel.ics.ICSApplicationObject; +import com.teamcenter.rac.kernel.ics.ICSProperty; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.schemas.soa._2006_03.exceptions.ServiceException; +import com.teamcenter.soaictstubs.ICSProperty_s; +import com.teamcenter.soaictstubs.ico_s; + +public class E_U8ToU8_Operation2 extends AbstractAIFOperation { + private AbstractAIFApplication app; + private TCSession session; + private InterfaceAIFComponent targetComp; + private AIFComponentContext aif; + private String[] prop; + private TCProperty[] props; + private TCUserService userService; + private TCPreferenceService service; + private TCComponentItem target; + private TCComponentBOMLine line = null; + private TCComponentBOMWindow window=null; + private List childRevList;//봴JListй + private ProgressBarThread wait; + private String[] virtualIDentityID; + private Map revMap=new HashMap<>();//ŵеIDͶӦʵϰ汾 + private Map virtualMap=new HashMap<>();//ŵbomкϵİ汾 + private Map virtualMap2=new HashMap<>();//ŵbomкϵİ汾İ汾 + private Map hierarchyMap=new HashMap<>();//źϵϲBOMеIJ㼶 + String CPSHH; + private TCComponentItemRevision xxRev; + public E_U8ToU8_Operation2(AbstractAIFApplication app2, AIFComponentContext aif, InterfaceAIFComponent targetComp, + TCSession session2, String[] virtualIDentityID, String CPSHH, ProgressBarThread wait, TCComponentItemRevision xxRev) { + this.app = app2; + this.targetComp = targetComp; + this.aif = aif; + this.session = session2; + this.virtualIDentityID=virtualIDentityID; + this.CPSHH= CPSHH; + this.wait=wait; + this.xxRev=xxRev; + } + + private String itemId;// ʽϵID + private String itemRev;// ʽϵİ汾 + private String itemName;// ʽϵ + TCComponentItem newTopItem=null; + private TCComponentItemRevision itemRevision;// ʽϵİ汾 + List bomInfoList=new ArrayList<>(); + private TCComponentItemRevision rev; + private TCComponentBOMViewRevision bomViewRevision; +// private AIFComponentContext[] Context2; + String class_id ; + Integer[] keys = null; + String[] vals = null; + String url=""; + @Override + public void executeOperation() throws Exception { + long time1 = System.nanoTime(); + + TCComponentUser user = this.session.getUser(); + TCComponentFolder newStuff = user.getNewStuffFolder(); + service=session.getPreferenceService(); + url= service.getStringValue("Autocode_SendClassServer_URL"); + // TODO + // 1.ȡѷ°汾ķ + class_id = ((TCComponent) aif.getComponent()).getClassificationClass(); + if(class_id==""){ + MessageBox.post("δִ࣬д˲", "", MessageBox.ERROR); + this.wait.setBool(true); + this.wait.interrupt(); + return; + } +// int a=1; +// target = (TCComponentItem) targetComp; + // TODO ѡ +// service = session.getPreferenceService(); + // String class_id=service.getStringValue(""); + + if (aif.getComponent() instanceof TCComponentItemRevision) { + rev = (TCComponentItemRevision) aif.getComponent(); + + +// AIFComponentd + // object_name + props = rev.getTCProperties(new String[] { "object_name" }); + itemName = props[0].getStringValue(); + if(xxRev==null) { + // ID + props = rev.getTCProperties(new String[] { "item_id" }); + if(props[0].getStringValue().startsWith("E")) { + itemId = props[0].getStringValue().substring(2); + }else { + itemId = props[0].getStringValue(); + } + + //ȥE-ǰλ벻䣬7λˮ + itemId=itemId.substring(0,5); + //ݿнһм洢Ӧˮеλ +// itemId=createLSM(itemId,0); + itemId=createLSM2(itemId); + System.out.println("ID----------->"+itemId); + if(itemId.length()>=13) { + MessageBox.post("ˮѳ12λϵԱ","",MessageBox.INFORMATION); + } + try { + newTopItem=rev.saveAsItem(itemId, null); + } catch (Exception e) { + e.printStackTrace(); + } + try { + sendRevToClass(rev,newTopItem.getLatestItemRevision()); + } catch (Exception e1) { + e1.printStackTrace(); + } + //ͷ࣬޸ķ,޸ı + TCComponentForm oldForm=(TCComponentForm)((TCComponentItemRevision)aif.getComponent()).getTCProperty("IMAN_master_form_rev").getReferenceValueArray()[0]; + if(newTopItem==null){ + InterfaceAIFComponent[] comps = null; +// comps = Util.searchComponentsCollection(session,"...", new String[] { " ID" },new String[] { itemId }); + comps = Util.searchComponentsCollection(session,"Item...", new String[] { " ID" },new String[] { itemId }); + + newTopItem=(TCComponentItem) comps[0]; + } + TCComponentForm newForm=(TCComponentForm) newTopItem.getLatestItemRevision().getTCProperty("IMAN_master_form_rev").getReferenceValueArray()[0]; + setFormProperty(oldForm, newForm);//TODO ޸ıԣƷʶţͺţͺ + //TODO Ʒʶ + newForm.getTCProperty("jk8ProductIdentifyNO").setStringValue(CPSHH);//Ʒʶ + String OldJSXH=oldForm.getProperty("jk8TechModel"); + System.out.println("ԭź----------------"+OldJSXH); + String newJSXH=OldJSXH; + if(OldJSXH.startsWith("-")) { + if(OldJSXH.split("-").length==3) { + newJSXH="-"+CPSHH+"-"+OldJSXH.split("-")[2]; + } + }else { + if(OldJSXH.split("-").length==2) { + newJSXH="-"+CPSHH+"-"+OldJSXH.split("-")[1]; + } + } + System.out.println("±ź----------------"+newJSXH); + try { +// newForm.getTCProperty("jk8TechModel").setStringValue(newJSXH);//ͺ + newForm.getTCProperty("jk8TechModel").setStringValue(OldJSXH);//ͺ + } catch (Exception e) { + e.printStackTrace(); + } + /* + try { + newForm.getTCProperty("jk8SpecModel").setStringValue(GGXH);//ͺ + } catch (Exception e) { + e.printStackTrace(); + }*/ + newStuff.add("contents", newTopItem); + rev.add("JK8MBOMRelation",newTopItem); + } + + + } + long time2 = System.nanoTime(); + System.out.println("ʱ(ms) " + (time2 - time1) / 1000000);//39s + // TODO еʵϵĶӦϵmapںĴBOM + for (int i = 0; i < virtualIDentityID.length; i++) { + System.out.println(virtualIDentityID[i]); + String entityID=virtualIDentityID[i].split("ID:")[1]; + String virtualID=virtualIDentityID[i].split("@@")[0]; +// TCComponent[] item=session.search(" ID", new String[]{" ID"}, new String[]{entityID.split("@@")[0]}); + TCComponent[] item=session.search("Item ID", new String[]{" ID"}, new String[]{entityID.split("@@")[0]}); + TCComponent[] revs=((TCComponentItem)item[0]).getTCProperty("revision_list").getReferenceValueArray(); + TCComponentItemRevision rev=null; + + for (int j = 0; j < revs.length; j++) { + if(revs[j].getTCProperty("release_status_list").getReferenceValueArray().length>0) { + rev=(TCComponentItemRevision) revs[j]; + } + } + if(rev!=null) { +// System.out.println("virtualID===========>"+virtualID); +// System.out.println("ʵ==============="+rev.getProperty("object_string")); + revMap.put(virtualID, rev); + } + + } + long time3 = System.nanoTime(); + System.out.println("ʵӦϵʱ(ms) " + (time3 - time2) / 1000000);//0.1s + //TODO bomҵBOMϲ㣬ŵmapУΪ½һ󡣹id򣺻ȡԭ룬ټ7Ϊˮ + //TODO ͵ + //TODO ޸ķ + + //TODO еlineͰеİ汾ӵmap֮ҪΪһMBOM + TCComponentBOMLine TopLine = getTopLineByRev(rev);// öbomline + + if(TopLine!=null){ + virtualMap=getAllVirtlBomline(TopLine,virtualMap); //кϲԼϲ㣬ŵvirtualMap + } + long time4 = System.nanoTime(); + System.out.println("кϲԼϲӦϵʱ(ms) " + (time4 - time3) / 1000000);//2s + //TODO virtualMapеÿһ汾һڽһmapϵ + for (TCComponentItemRevision key : virtualMap.keySet()) { + if(!key.getType().equals("JK8VirtlMaterialRevision")) { + if(!key.getProperty("item_id").startsWith("E-8")) { + String originID=key.getProperty("item_id"); + String newID=originID.substring(0, 5); + newID=createLSM2(newID); + TCComponentItem item=null; + try { + item=key.saveAsItem(newID, null); + } catch (Exception e) { + try { +// item=(TCComponentItem) session.search(" ID", new String[]{" ID"}, new String[]{newID})[0]; + item=(TCComponentItem) session.search("Item ID", new String[]{" ID"}, new String[]{newID})[0]; + } catch (Exception e1) { + e1.printStackTrace(); + } +// e.printStackTrace(); + } + //ͷ࣬޸ķ,޸ı + try { + sendRevToClass(key,item.getLatestItemRevision()); + } catch (Exception e1) { + e1.printStackTrace(); + } + TCComponentForm oldForm=(TCComponentForm)key.getTCProperty("IMAN_master_form_rev").getReferenceValueArray()[0]; + TCComponentForm newForm=(TCComponentForm) item.getLatestItemRevision().getTCProperty("IMAN_master_form_rev").getReferenceValueArray()[0]; + //Ʒʶ + newForm.getTCProperty("jk8ProductIdentifyNO").setStringValue(CPSHH); + String OldJSXH=oldForm.getProperty("jk8TechModel"); + System.out.println("ԭź----------------"+OldJSXH); + String newJSXH=OldJSXH; + //2019.06.03 ɵĻͿӷ״̬ + setReleaseStatus(item.getLatestItemRevision(), "TCM Released");// ٷ + /*if(newID.startsWith("7")) { + try { + E_U8ToEBOMUtil.setByPass(true); + } catch (TCException e2) { + e2.printStackTrace(); + } + setIcoProperty(item.getLatestItemRevision(), session, CPSHH); + try { + E_U8ToEBOMUtil.setByPass(false); + } catch (TCException e2) { + e2.printStackTrace(); + } + }*/ + setFormProperty(oldForm, newForm); + //TODO Ӳ㼶»Ϳ߸Եļͺź͹ͺŸֵʽDzͬ + TCComponentItemRevision xRev=key; + + if(getLevel(xRev)==2) { + if(OldJSXH.split("-").length==3) { + newJSXH=OldJSXH.split("-")[0]+"-"+CPSHH+"-"+OldJSXH.split("-")[2]; + } + + + // + try { +// newForm.getTCProperty("jk8TechModel").setStringValue(newJSXH);//ͺ + newForm.getTCProperty("jk8TechModel").setStringValue(OldJSXH);//ͺ + } catch (Exception e) { + e.printStackTrace(); + } + /*try { + newForm.getTCProperty("jk8SpecModel").setStringValue(CPSHH+"-"+direction);//ͺ + } catch (Exception e) { + e.printStackTrace(); + }*/ + }else if(getLevel(xRev)==1) { + // + if(OldJSXH.contains(",")) { + newJSXH=CPSHH+","+OldJSXH.split(",")[1]; + } + try { +// newForm.getTCProperty("jk8TechModel").setStringValue(newJSXH);//ͺ + newForm.getTCProperty("jk8TechModel").setStringValue(OldJSXH);//ͺ + } catch (Exception e) { + e.printStackTrace(); + } + /*try { + newForm.getTCProperty("jk8SpecModel").setStringValue(CPSHH);//ͺ + } catch (Exception e) { + e.printStackTrace(); + }*/ + } + System.out.println("±ź----------------"+newJSXH); + + + + + newStuff.add("contents", item); +// class_id = key.getClassificationClass(); +// sendToClass(key,item.getLatestItemRevision()); + + virtualMap2.put(key, item.getLatestItemRevision()); + }else { + if(xxRev!=null) { + virtualMap2.put(key, xxRev.getItem().getLatestItemRevision()); + + }else { + + virtualMap2.put(key, newTopItem.getLatestItemRevision()); + } + } + + } + } + long time5 = System.nanoTime(); + System.out.println("ÿһ汾һڽһmapϵʱ(ms) " + (time5 - time4) / 1000000);//50s + //һbean,еĸӹϵӦλ滻ӦӼ + /*System.out.println("virtualMap2.size------------------>"+virtualMap2.size()); + System.out.println("virtualMap.size------------------>"+virtualMap.size()); + System.out.println("revMap.size------------------>"+revMap.size());*/ + E_U8ToEBOMBean bean=new E_U8ToEBOMBean(); + bean=getAllBean(TopLine,bean,true); + window.close(); + long time6 = System.nanoTime(); + System.out.println("ȡBOMϢʱ(ms) " + (time6 - time5) / 1000000);//40s + //ʼbom + try { + E_U8ToEBOMUtil.setByPass(true); + } catch (TCException e2) { + e2.printStackTrace(); + } + try { + creatDetailBom(bean); + this.wait.setBool(true); + this.wait.interrupt(); + MessageBox.post("תɹ", "ɹ", MessageBox.INFORMATION); + } catch (Exception e) { + e.printStackTrace(); + MessageBox.post("תʧ:\n" + e.getLocalizedMessage(), "ʧ", + MessageBox.ERROR); + } + + + try { + E_U8ToEBOMUtil.setByPass(false); + } catch (TCException e2) { + e2.printStackTrace(); + } + long time7 = System.nanoTime(); + System.out.println("BOMϢʱ(ms) " + (time7 - time6) / 1000000);//90s + System.out.println("ʱ(ms) " + (time7 - time1) / 1000000);//222s +// MessageBox.post(""+itemId+"ɹ\nNewStuffļ", "ɹ", MessageBox.INFORMATION); + + + } + + /** + * c÷״̬ + * + * @param item + * ҪĶ + * @param statusName + * ״̬ + * @throws TCException + */ + public void setReleaseStatus(TCComponent item, String statusName) throws TCException { + TCUserService userservice = this.session.getUserService(); + + Object[] obj = new Object[2]; + obj[0] = item; + obj[1] = statusName; + userservice.call("connor_set_release_status", obj); + + } + private int getLevel(TCComponentItemRevision xRev) { + int x=0; + try { + TCTypeService service = session.getTypeService(); + TCComponentBOMWindowType winTypeX = (TCComponentBOMWindowType) service + .getTypeComponent("BOMWindow"); + TCComponentBOMWindow windowX = winTypeX.create(null); + TCComponentBOMLine lineX = windowX.setWindowTopLine(xRev.getItem(), xRev, null, null); + AIFComponentContext[] childlines=lineX.getChildren(); + if(childlines.length>0) { + x=1; + for (int i = 0; i < childlines.length; i++) { + TCComponentBOMLine lineXX= (TCComponentBOMLine) childlines[i].getComponent(); + if(lineXX.getChildren().length>0) { + x=2; + break; + } + + + } + } + windowX.close();//رգᵼBOMռãBOMİ汾ɾTC + } catch (TCException e) { + e.printStackTrace(); + } + return x; + } + private void sendRevToClass(TCComponentItemRevision originRev,TCComponentItemRevision copyRev) throws TCException { + TCComponentICO[] icoS = originRev.getClassificationObjects(); + + int count = 0; + int count1 = 0; +// System.out.println("icoS.length---------------" + icoS.length); + for (int i = 0; i < icoS.length; i++) { + ICSProperty[] cPropS = icoS[i].getICSProperties(true); + for (int j = 0; j < cPropS.length; j++) { +// System.out.println(count); + count++; + } + keys = new Integer[count]; + vals = new String[count]; + for (int j = 0; j < cPropS.length; j++) { +// System.out.println(count); + keys[count1] = cPropS[j].getId(); +// System.out.println("keys[" + count1 + "]================>"+ keys[count1]); + vals[count1] = cPropS[j].getValue(); +// System.out.println("vals[" + count1 + "]================>" + vals[count1]); + count1++; + } + break; + } + + // TODO 2.,°汾͵ + // class_id = "";// TODO дѡ + try { + // createICS(class_id, newrev, + // newrev.getTCProperty("item_id").getStringValue(), keys, vals); + sendObjToClassficationByWebService(copyRev, keys, vals); + } catch (Exception e) { + MessageBox.post("ʧ", "", MessageBox.ERROR); + e.printStackTrace(); + return; + } + + if (isSucceed == false) { + MessageBox.post("ʧ", "", MessageBox.ERROR); + return; + } + + } + +private void setIcoProperty(TCComponentItemRevision oldRev,AbstractAIFSession session,String CPSBH) throws TCException { + + + System.out.println(oldRev.getProperty("object_string")); + String classificationId = oldRev.getClassificationClass(); + if(classificationId==null||classificationId.trim().length()<1){ + System.out.println("öûнз಻ܱ༭"); + return; + } + /*TCComponentICO[] icoS = oldRev.getClassificationObjects(); + System.out.println("icoS.length---------------" + icoS.length); + for (int i = 0; i < icoS.length; i++) { + System.out.println(icoS[i].getUid()); + ICSProperty[] cPropS = icoS[i].getICSProperties(true); + for (int j = 0; j < cPropS.length; j++) { + System.out.println(cPropS[j].getId()); + System.out.println(cPropS[j].getValue()); + } + }*/ + + + TCClassificationService tccs = ((TCSession) session).getClassificationService(); + + //ʼ + //浽 + String item_id = oldRev.getProperty("item_id"); + String item_rid = oldRev.getProperty("item_revision_id"); + String uid = oldRev.getUid(); + + + TCComponentICO[] icoS = oldRev.getClassificationObjects(); +// System.out.println("icoS.length---------------" + icoS.length); + for (int i = 0; i < icoS.length; i++) { + System.out.println(icoS[i].getUid()); + try { + String icoid=icoS[i].getProperty("id"); + if(icoid.split("\\/")[0].equals(item_id)&&icoid.split("\\/")[1].equals(item_rid)) { + ICSApplicationObject appObject = tccs.newICSApplicationObject("ICM"); + int ICOCount = appObject.searchById(item_id + "/"+ item_rid, uid); + if (ICOCount > 0) { + appObject.read(1); + } else { + appObject.create(item_id + "/" + item_rid, uid); + } + appObject.setView(classificationId); + appObject.edit(); + ICSProperty[] cPropS = icoS[i].getICSProperties(true); + for (int j = 0; j < cPropS.length; j++) { + System.out.println(cPropS[j].getId()); + System.out.println(cPropS[j].getValue()); + //71006-500301òƷʶ 71009-500258ʶ + if(cPropS[j].getId()==-500301||cPropS[j].getId()==-500258) { + cPropS[j].setValue(CPSBH); +// System.out.println("prop:" + cPropS[j]); + } + } + appObject.setProperties(cPropS); + appObject.save(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + +// System.out.println("ɹ"); + + } + + + + + private void creatDetailBom(E_U8ToEBOMBean bean) throws TCException { + TCComponentItemRevision rev=bean.getRev(); + + List childBeanS=bean.getChildBeanS(); + if (childBeanS == null) { + return; + } + List childrenList = new ArrayList<>(); + List tcpropertyList = new ArrayList<>(); + List bl_sequence_no_list=new ArrayList<>(); + List> sublistList= new ArrayList<>(); + // BOM + for (int i = 0; i < childBeanS.size(); i++) { + E_U8ToEBOMBean childBean = childBeanS.get(i); + // ȡӵѡ + TCComponentItemRevision childSelectRev = childBean.getRev(); + childrenList.add(childSelectRev); + tcpropertyList.add(childBean.getTcs()); + sublistList.add(childBean.getSublist()); + bl_sequence_no_list.add(childBean.getBl_sequence_no()); + creatDetailBom(childBean); + } + TCProperty[] tcp=bean.getTcs(); +// String bl_sequence_no=bean.getBl_sequence_no(); + createBom(rev,childrenList,tcpropertyList,sublistList,tcp,bl_sequence_no_list); + } + + private void createBom(TCComponentItemRevision rev,List childRevList,List tcpropertyList,List> sublistList,TCProperty[] tcp,List bl_sequence_no_list) throws TCException { + if (childRevList == null || childRevList.size() == 0) { + return; + } + if (rev == null) + return; + +// System.out.println("topline=======================>"+rev.getProperty("object_string")); + TCTypeService service = session.getTypeService(); + TCComponentBOMWindowType winType = (TCComponentBOMWindowType) service + .getTypeComponent("BOMWindow"); + TCComponentBOMWindow view = winType.create(null); + TCComponentBOMLine line = view.setWindowTopLine(rev.getItem(), + rev, null, null); + AIFComponentContext[] childrenContext = line.getChildren(); + + view.lock(); + // Ƴеbomline + if (childrenContext.length != 0) { +// System.out.println("Ƴԭbomline"); + for (AIFComponentContext child : childrenContext) { + line.lock(); + /*if(((TCComponent) child.getComponent()).getType().startsWith("JK8VirtlMaterial")) { + System.out.println("Ƴ"+((TCComponent) child.getComponent()).getProperty("object_string")); + } + if(rev.getProperty("object_string").startsWith("82001000")) { + System.out.println("Ƴ"+((TCComponent) child.getComponent()).getProperty("object_string")); + + }*/ + line.remove("", (TCComponent) child.getComponent()); + line.save(); + line.unlock(); + } + + } + // + line.lock(); + try { + line.setTCProperties(tcp); + } catch (Exception e) { +// System.out.println(line.getItemRevision().getProperty("object_string")); +// System.out.println("bomlineв޸"); +// e.printStackTrace(); + } + line.save(); + line.unlock(); +// System.out.println(childRevList.size()); + for (int i = 0; i < childRevList.size(); i++) { + TCComponentItemRevision childRev = childRevList.get(i); + line.lock(); + if(childRev==null){ + continue; + } + /*if(childRev.getType().startsWith("JK8VirtlMaterial")) { + System.out.println("-------"); + } + if(rev.getProperty("object_string").startsWith("71006")) { + System.out.println(""+childRev.getProperty("object_string")); + + }*/ + TCComponentBOMLine childBomLine = line.add(childRev.getItem(), childRev, + null, false, ""); + line.save(); + line.unlock(); + childBomLine.lock(); + + try { + childBomLine.setTCProperties(tcpropertyList.get(i)); + } catch (Exception e) { +// System.out.println(childBomLine.getItemRevision().getProperty("object_string")); +// System.out.println("쳣"); +// e.printStackTrace(); + } + try { +// System.out.println("----------------"+bl_sequence_no_list.get(i)); + childBomLine.getTCProperty("bl_sequence_no").setStringValue(bl_sequence_no_list.get(i)); + } catch (Exception e) { + e.printStackTrace(); + } + if(sublistList.get(i).size()>0) { +// System.out.println("µbomline"); + for(int j=0;j"+bl_substitute_list); + String[] substitute_list=bl_substitute_list.split(","); +// System.out.println("bl_substitute_list=========>"+substitute_list.length); + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------1----------"+substitute_list[i]); + } + TCProperty[] tcs = ((TCComponentBOMLine) lt) + .getTCProperties(new String[] { + "bl_quantity","bl_sequence_no", +// "jk8SubstitRatio", "jk8SubstitOrder","jk8EffectiveDate","jk8SubCompLossRate",//治˻ȡ +// "bl_item_uom_tag","jk8TechnicModel","jk8SpecificModel",// + "JK8Remark","JK8SupplyType","JK8Warehouse", + "JK8RemarkDesc","jk8SubCompLossRate" + + });//ֿ⡢Ӧͣbl_substituteȣjk8SubstitRatiojk8SubstitOrderЧڣjk8EffectiveDate + line.lock(); + line.remove("", lt); + +// TCComponentItem chitem = ((TCComponentBOMLine) lt).getItem() +// .getLatestItemRevision().saveAsItem(null, null); +// TCComponentItemRevision r = chitem.getLatestItemRevision(); +// TCComponentItemRevision r=((TCComponentBOMLine) lt).getItem().getLatestItemRevision(); + TCComponentItemRevision r=((TCComponentBOMLine) lt).getItemRevision();//BOMLineӦItemRevision + + //жһͻɶӦʵϴȥ +// if(r.getType().equals("JK8VirtlMaterialRevision")) { +// if(revMap.containsKey(r.getProperty("item_id"))) { +// r=revMap.get(r.getProperty("item_id")); +// } +// } + TCComponentBOMLine childBomLine = line.add(r.getItem(), r, + null, false, ""); + if(substitute_list.length>0&&!bl_substitute_list.trim().equals("")){ + + for (int i = 0; i < substitute_list.length; i++) { +// System.out.println("--------------"+substitute_list[i]+"----------"); +// TCComponentItemRevision itemRevision=((TCComponentItem)(session.search(" ID",new String[]{ " ID"}, new String[]{substitute_list[i].trim()})[0])).getLatestItemRevision(); + TCComponentItemRevision itemRevision=((TCComponentItem)(session.search("Item ID",new String[]{ " ID"}, new String[]{substitute_list[i].trim()})[0])).getLatestItemRevision(); + childBomLine.add(null, itemRevision, null, true); + } + } + childBomLine.setTCProperties(tcs); + + setbom(childBomLine,r); + line.save(); + line.unlock(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + //͵ class_id=codeRemarkˮ룿 + boolean isSucceed = true; + + public void sendObjToClassficationByWebService(TCComponentItemRevision rev, Integer[] keys, String[] vals) { + try { + class_id = rev.getClassificationClass(); +// System.out.println("class_id-----dddddd----->" + class_id); + if (!class_id.replace(" ", "").equals("")) { + + List propList = new ArrayList<>(); + for (int i = 0; i < keys.length; i++) { + ClassProperty prop = new ClassProperty(keys[i], vals[i]);// + propList.add(prop); + } + String json = SoaServerUtil.objectToJson(propList);// JavaתΪjson + SoaServerUtil.grantWritePrivilege(session, rev);// дȨ + SoaServerUtil.sendToClass(rev.getUid(), class_id, json, url);// ͵ + + SoaServerUtil.grantReadPrivilege(session, rev);// Ȩ + } + + } catch (Exception e) { + isSucceed = false; + e.printStackTrace(); + } + + } + + public String createLSM(String itemID0, int x) { + TCComponentItemType itemtype = null; + String newID = ""; + try { + itemtype = (TCComponentItemType) session.getTypeComponent("JK8Material"); + } catch (TCException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + if (x >= 10000) { + return itemID0 + "" + x; + } + if (x < 10) { + newID = itemID0 + "" + "000" + x; + } else if (x < 100) { + newID = itemID0 + "" + "00" + x; + } else if (x < 1000) { + newID = itemID0 + "" + "0" + x; + } else if (x <= 9999) { + newID = itemID0 + "" + x; + } + TCComponentItem item = null; + try { + item = itemtype.find(newID); + } catch (TCException e) { + e.printStackTrace(); + } + if (item != null) { + System.out.println("" + newID); + x++; + createLSM(itemID0, x); + } else { + + return newID; + + } + + return newID; + } + +// ˮ룬ID + public String createLSM2(String itemID0) { + String newID = ""; + String JdbcDriverClass = "oracle.jdbc.driver.OracleDriver"; + String strUrl = "jdbc:oracle:thin:@10.201.5.202:1521:jktc";// +// String strUrl = "jdbc:oracle:thin:@10.200.2.43:jktc";//ʽ + String strUserName = "infodba"; + String strPassword = "infodba"; + try { + try { + Class.forName(JdbcDriverClass); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } + Connection conn = DriverManager.getConnection(strUrl, strUserName, strPassword); + + String query = "select * from JK_FLM_TABLE where JK_FLM='" + itemID0 + "'"; + Statement stmt = conn.createStatement(); + + ResultSet rs_get = stmt.executeQuery(query); + int rowCount = 0; + if (rs_get.next()) { + rowCount++; + String FLM = rs_get.getString("JK_FLM");// ȡ + if (itemID0.equals(FLM)) { + int LSM =Integer.valueOf(rs_get.getString("JK_LSM")) ;// ȡˮ + String LSMString = rs_get.getString("JK_LSM"); + int length = LSMString.length(); + for (int i = 0; i < 7 - length; i++) { + LSMString = "0" + LSMString; + } + // ѯǰ+ˮ빹ɵidǷ + newID = FLM + LSMString; + TCComponentItemType itemtype = null; + try { + itemtype = (TCComponentItemType) session.getTypeComponent("JK8Material"); + } catch (TCException e1) { + e1.printStackTrace(); + } + + TCComponentItem item = null; + try { + item = itemtype.find(newID); + } catch (TCException e) { + e.printStackTrace(); + } + if (item != null) { + System.out.println("" + newID); + LSM++; + newID = searchFlmLsm(FLM, LSM); + int returnNum = Integer.valueOf(newID.substring(5, newID.length())); + query = "update JK_FLM_TABLE set JK_LSM='" + returnNum + "' where JK_FLM='" + FLM + "'"; + rs_get = stmt.executeQuery(query); + if (rs_get.next()) { + System.out.println("OK"); + } + if (rs_get != null) { + rs_get.close(); + } + } + + } + + } else { + if (rs_get != null) { + rs_get.close(); + } + query = "insert into JK_FLM_TABLE (JK_FLM,JK_LSM) values('" + itemID0 + "', '0')"; + System.out.println(query); + try { + rs_get = stmt.executeQuery(query); + } catch (Exception e) { + if (rs_get != null) { + rs_get.close(); + } + if (stmt != null) { + stmt.close(); + } + if (conn != null) { + } + e.printStackTrace(); + } + if (rs_get.next()) { + System.out.println("OK"); + } + newID = itemID0 + "0000000"; + if (rs_get != null) { + rs_get.close(); + } + } + System.out.println(rowCount); + if (rs_get != null) { + rs_get.close(); + } + if (stmt != null) { + stmt.close(); + } + if (conn != null) { + conn.close(); + } + } catch (SQLException e) { + e.printStackTrace(); + } + + // дмеˮ + return newID; + + } + + private String searchFlmLsm(String FLM, int LSM) { + String LSMString = String.valueOf(LSM); + int length = LSMString.length(); + for (int i = 0; i < 7 - length; i++) { + LSMString = "0" + LSMString; + } + // ѯǰ+ˮ빹ɵidǷ + String newID = FLM + LSMString; + TCComponentItemType itemtype = null; + try { + itemtype = (TCComponentItemType) session.getTypeComponent("JK8Material"); + } catch (TCException e1) { + e1.printStackTrace(); + } + + TCComponentItem item = null; + try { + item = itemtype.find(newID); + } catch (TCException e) { + e.printStackTrace(); + } + if (item != null) { + System.out.println("" + newID); + LSM++; + newID = searchFlmLsm(FLM, LSM); + } + return newID; + } + + private Map getAllVirtlBomline(TCComponentBOMLine line,Map virtualMap) {// bom + + try { + AIFComponentContext[] lins = line.getChildren(); + if (lins == null || lins.length <= 0) { + return virtualMap; + } + for (int i = 0; i < lins.length; i++) { + TCComponentBOMLine childLine = (TCComponentBOMLine) lins[i].getComponent(); + System.out.println(childLine.getItemRevision()==null); + System.out.println(childLine.getItem()==null); + if(childLine.getItem()!=null) { + System.out.println(childLine.getItem().getProperty("object_string")); + } + if (childLine.getItemRevision().getType().equals("JK8VirtlMaterialRevision")) { + virtualMap=getAllFather(childLine,virtualMap); + } + if (childLine.hasChildren()) { + virtualMap=getAllVirtlBomline(childLine,virtualMap); + } + + } + + } catch (Exception e) { + e.printStackTrace(); + } + return virtualMap; + } + + public Map getAllFather(TCComponentBOMLine childLine,Map virtualMap) { + TCComponentBOMLine fatherLine = null; + fatherLine = childLine.getCachedParent(); + if (fatherLine != null) { + try { + virtualMap.put(fatherLine.getItemRevision(), ""); + + } catch (TCException e) { + e.printStackTrace(); + } + virtualMap=getAllFather(fatherLine,virtualMap); + } + return virtualMap; + } + + public E_U8ToEBOMBean getAllBean(TCComponentBOMLine TopLine, E_U8ToEBOMBean bean,boolean isTop) throws Exception { + + AIFComponentContext[] lins = null; + try { + lins = TopLine.getChildren(); + } catch (TCException e) { + e.printStackTrace(); + } + if (lins == null || lins.length <= 0) { + return null; + } + List childBeanS = new ArrayList<>(); + for (int i = 0; i < lins.length; i++) { + E_U8ToEBOMBean childBean = new E_U8ToEBOMBean(); + TCComponentBOMLine childLine = (TCComponentBOMLine) lins[i].getComponent(); + childBean.setRev(childLine.getItemRevision()); + // ϲϾ滻ӦΪ + if (virtualMap2.containsKey(childLine.getItemRevision())) { +// System.out.println("滻ϲ"); + childBean.setRev(virtualMap2.get(childLine.getItemRevision())); + } + // 滻Ӧѡ˵ʵ + /*if(childLine.getItemRevision().getType().startsWith("JK8VirtlMaterial")) { + System.out.println(""); + }*/ + System.out.println(childLine.getItemRevision()==null); + System.out.println(childLine.getItem()==null); + if(childLine.getItem()!=null) { + System.out.println(childLine.getItem().getProperty("object_string")); + } + + if (revMap.containsKey(childLine.getItemRevision().getProperty("item_id"))) { +// System.out.println("滻"); + childBean.setRev(revMap.get(childLine.getItemRevision().getProperty("item_id"))); + } + TCProperty[] childTcs = ((TCComponentBOMLine) childLine) + .getTCProperties(new String[] { "bl_quantity", "bl_sequence_no", + "JK8Remark", "JK8SupplyType", "JK8Warehouse", "JK8RemarkDesc", "jk8SubCompLossRate" + }); + childBean.setTcs(childTcs); + childBean.setBl_sequence_no( ((TCComponentBOMLine) childLine).getProperty("bl_sequence_no")); + // + List sublist=Sublist(childLine); + childBean.setSublist(sublist); + + childBeanS.add(childBean); + + if (childLine.hasChildren()) { + // TODO ѭ + childBean = getAllBean(childLine, childBean,false); + } + } + bean.setChildBeanS(childBeanS); + //Ƕ㣬ҪӦ + if(isTop==true) { + if(xxRev!=null) { + bean.setRev(xxRev.getItem().getLatestItemRevision()); + }else { + + bean.setRev(newTopItem.getLatestItemRevision()); + } + }else { + bean.setRev(TopLine.getItemRevision()); + if (virtualMap2.containsKey(TopLine.getItemRevision())) { +// System.out.println("滻ϲ"); + bean.setRev(virtualMap2.get(TopLine.getItemRevision())); + } + System.out.println(TopLine.getItemRevision()==null); + System.out.println(TopLine.getItem()==null); + if(TopLine.getItem()!=null) { + System.out.println(TopLine.getItem().getProperty("object_string")); + } + // 滻Ӧѡ˵ʵ + if (revMap.containsKey(TopLine.getItemRevision().getProperty("item_id"))) { +// System.out.println("滻"); + bean.setRev(revMap.get(TopLine.getItemRevision().getProperty("item_id"))); + } + + } + TCProperty[] tcs = ((TCComponentBOMLine) TopLine) + .getTCProperties(new String[] { "bl_quantity", "bl_sequence_no","JK8Remark", + "JK8SupplyType", "JK8Warehouse", "JK8RemarkDesc", "jk8SubCompLossRate"}); + bean.setTcs(tcs); + + // + List sublist=Sublist(TopLine); + bean.setSublist(sublist); + return bean; + } + + + public List Sublist(TCComponentBOMLine TopLine) throws Exception { + // + String bl_substitute_list = ((TCComponentBOMLine) TopLine).getProperty("bl_substitute_list"); +// System.out.println("bl_substitute_list---->" + bl_substitute_list); + String[] substitute_list = bl_substitute_list.split(","); +// System.out.println("bl_substitute_list=========>" + substitute_list.length); + for (int i = 0; i < substitute_list.length; i++) { +// System.out.println("--------1----------" + substitute_list[i]); + } + List sublist = new ArrayList<>(); + if (substitute_list.length > 0 && !bl_substitute_list.trim().equals("")) { + + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------------" + substitute_list[i] + "----------"); +// TCComponentItemRevision itemRevision = ((TCComponentItem) (session.search(" ID", new String[] { " ID" }, new String[] { substitute_list[i].trim() })[0])).getLatestItemRevision(); + TCComponentItemRevision itemRevision = ((TCComponentItem) (session.search("Item ID", new String[] { " ID" }, new String[] { substitute_list[i].trim() })[0])).getLatestItemRevision(); + sublist.add(itemRevision); + } + } + return sublist; + } + // + public void sendToClass(TCComponentItemRevision oldRev,TCComponentItemRevision newRev) throws TCException { + TCComponentICO[] icoS = oldRev.getClassificationObjects(); + + int count = 0; + int count1 = 0; + System.out.println("icoS.length---------------" + icoS.length); + for (int i = 0; i < icoS.length; i++) { + ICSProperty[] cPropS = icoS[i].getICSProperties(true); + + for (int j = 0; j < cPropS.length; j++) { + System.out.println(count); + count++; + } + keys = new Integer[count]; + vals = new String[count]; + for (int j = 0; j < cPropS.length; j++) { + System.out.println(count); + keys[count1] = cPropS[j].getId(); + System.out.println("keys[" + count1 + "]================>" + keys[count1]); + vals[count1] = cPropS[j].getValue(); + System.out.println("vals[" + count1 + "]================>" + vals[count1]); + count1++; + } + break; + } + // TODO 2.,°汾͵ + try { + +// createICS(class_id, newrev, newrev.getTCProperty("item_id").getStringValue(), keys, vals); + sendObjToClassficationByWebService(newRev, keys, vals); + } catch (Exception e) { + MessageBox.post("ʧ", "", MessageBox.ERROR); + e.printStackTrace(); + return; + } + + if (isSucceed == false) { + MessageBox.post("ʧ", "", MessageBox.ERROR); + return; + } + + + } + // ɾʱ + public static void deleteClass(String icoPUID, String url) { + System.out.println("ɾ࿪ʼ"); + try { + ServiceClient sc = new ServiceClient(); + Options opts = new Options(); + // url = "http://10.201.5.203:19090/ErpWebService.asmx?WSDL";//TODO + // ѡAutocode_SendClassServer_URL + // url = preferenceService.getStringValue("Autocode_SendClassServer_URL");//TODO + // ѡAutocode_SendClassServer_URL + EndpointReference end = new EndpointReference(url); + opts.setTo(end); + opts.setAction("DeleteClass"); + opts.setProperty(HTTPConstants.CHUNKED, "false"); + sc.setOptions(opts); + + OMFactory fac = OMAbstractFactory.getOMFactory(); + OMNamespace omNs = fac.createOMNamespace("http://tempuri.org/", ""); + OMElement method = fac.createOMElement("DeleteClass", omNs); + OMElement value = fac.createOMElement("icoPuid", omNs); + value.setText(icoPUID); + // OMElement value1 = fac.createOMElement("classID", omNs); + //// value1.setText(classID); + // OMElement value2 = fac.createOMElement("JsonContainer", omNs); + // "[{\"value\":\"1\",\"propertyID\":-500003},{\"value\":\"1\",\"propertyID\":-500011}]" + // value2.setText(json); + + method.addChild(value); + // method.addChild(value1); + // method.addChild(value2); + + OMElement res = sc.sendReceive(method); + res.getFirstElement().getText(); + System.out.println(res.getFirstElement().getText()); + System.out.println("ɾɹ"); + } catch (AxisFault e) { + e.printStackTrace(); + System.out.println("ɾʧ"); + } + + } + + public void setFormProperty(TCComponentForm oldForm,TCComponentForm newForm) throws TCException { + + try { + newForm.setTCProperties(oldForm.getAllTCProperties()); + } catch (Exception e1) { +// e1.printStackTrace(); + } + + try { + TCComponentItemRevision itemRevision = (TCComponentItemRevision) ((TCComponentForm) newForm) + .whereReferenced()[0].getComponent(); + String objName=itemRevision.getProperty("item_id")+"/"+itemRevision.getProperty("item_revision_id"); + System.out.println("objName--------"+objName); + newForm.getTCProperty("object_name").setStringValue(objName); + } catch (TCException e) { +// e.printStackTrace(); + } + /*if(oldForm.getTCProperty("object_name").getStringValue().startsWith("E")) { + + //2018.5.7 û02ʱתʱ汾ͻʵʲӦ + String name=newForm.getTCProperty("object_name").getStringValue(); + System.out.println(name); + name=name.split("/")[0]+"/"+"01"; + newForm.getTCProperty("object_name").setStringValue(name); + }else { + newForm.getTCProperty("object_name").setStringValue(((TCComponentItemRevision)newForm.whereReferenced()[0].getComponent()).getProperty("item_id")+"/"+"01"); + }*/ + String objName2=""; + try { + objName2=newForm.getTCProperty("object_name").getStringValue(); + } catch (Exception e1) { +// e1.printStackTrace(); + } + if(objName2.startsWith("8")) { + try { + newForm.getTCProperty("jk8IsDomesticMarket").setStringValue(""); + } catch (Exception e) { +// e.printStackTrace(); + } + } + + } +} diff --git a/src/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Operation20191210.java b/src/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Operation20191210.java new file mode 100644 index 0000000..5a0cdc4 --- /dev/null +++ b/src/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_Operation20191210.java @@ -0,0 +1,765 @@ +package com.connor.jk.plm.E_U8ToEBOM_New; + +import java.util.ArrayList; +import java.util.List; + +import javax.swing.JTextField; + + +import com.teamcenter.rac.aif.AIFDesktop; +//import com.connor.jk.plm.tempToFormal.ClassProperty; +//import com.connor.jk.plm.tempToFormal.SoaServerUtil; +import com.teamcenter.rac.aif.AbstractAIFApplication; +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.TCComponentBOMViewRevision; +import com.teamcenter.rac.kernel.TCComponentBOMWindow; +import com.teamcenter.rac.kernel.TCComponentBOMWindowType; +import com.teamcenter.rac.kernel.TCComponentFolder; +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.TCComponentItemType; +import com.teamcenter.rac.kernel.TCComponentUser; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.kernel.TCTypeService; +import com.teamcenter.rac.kernel.TCUserService; +import com.teamcenter.rac.kernel.ics.ICSApplicationObject; +import com.teamcenter.rac.kernel.ics.ICSProperty; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.schemas.soa._2006_03.exceptions.ServiceException; + +public class E_U8ToU8_Operation20191210 extends AbstractAIFOperation { + private AbstractAIFApplication app; + private TCSession session; + private InterfaceAIFComponent targetComp; + private AIFComponentContext aif; + private String[] prop; + private TCProperty[] props; + private TCUserService userService; + private TCPreferenceService service; + private TCComponentItem target; + private TCComponentBOMLine line = null; + private TCComponentBOMWindow window=null; + private TCComponentBOMWindow windowOld=null; + private List childRevList;//봴JListй + private TCComponentItemType tccitemType; //Item + + public E_U8ToU8_Operation20191210(AbstractAIFApplication app2, AIFComponentContext aif, InterfaceAIFComponent targetComp, + TCSession session2) { + this.app = app2; + this.targetComp = targetComp; + this.aif = aif; + this.session = session2; + } + + private String itemId;// ʽϵID + private String itemRev;// ʽϵİ汾 + private String itemName;// ʽϵ + + private TCComponentItemRevision itemRevision;// ʽϵİ汾 + + private TCComponentItemRevision rev; + private TCComponentBOMViewRevision bomViewRevision; + private AIFComponentContext[] Context2; + String class_id ; + Integer[] keys = null; + String[] vals = null; + String url=""; + String[] propertyValue=null; + String[] properties=null; + String[] values=null; + @Override + public void executeOperation() throws Exception { + service=session.getPreferenceService(); + url= service.getStringValue("Autocode_SendClassServer_URL"); + // TODO + // 1.ȡѷ°汾ķ + class_id = ((TCComponent) aif.getComponent()).getClassificationClass(); + if(class_id==""){ + MessageBox.post("δִ࣬д˲", "", MessageBox.ERROR); + return; + } +// int a=1; +// target = (TCComponentItem) targetComp; + // TODO ѡ +// service = session.getPreferenceService(); + // String class_id=service.getStringValue(""); + if (aif.getComponent() instanceof TCComponentItemRevision) { + rev = (TCComponentItemRevision) aif.getComponent(); + + +// AIFComponentd + // object_name + props = rev.getTCProperties(new String[] { "object_name" }); + itemName = props[0].getStringValue(); + + // ID + props = rev.getTCProperties(new String[] { "item_id" }); + /**˴ȡitem_idλ󲿷 E-810000014 -- 810000014 ȥE-**/ + itemId = props[0].getStringValue().substring(2); + + } + + //ֻתһ汾 + TCComponentItem newitem =null; + TCComponentItemRevision newrev=null; + boolean isExist=false; + boolean saveDefault = false ; + try { + //ӦȲѯһ¿ǷѾitemû½оֱӻȡ + tccitemType =(TCComponentItemType) session.getTypeComponent("Item"); + newitem = tccitemType.find(itemId); + if(newitem == null){ + saveDefault = true ; + } + newitem = rev.saveAsItem(itemId, rev.getProperty("item_revision_id")); + newrev = newitem.getLatestItemRevision();//°汾 + } catch (Exception e1) { +// TCComponent[] u8items=session.search("...", new String[] {" ID"}, new String[] {itemId}); + InterfaceAIFComponent[] comps = null; + comps = Util.searchComponentsCollection(session,"...", new String[] { " ID" },new String[] { itemId }); + +// newitem=(TCComponentItem) u8items[0]; + newitem=(TCComponentItem) comps[0]; + /** newitemǷ **/ + if(saveDefault){ + + }else{ + //ҪѾɵu8bomǷѾ + if(newitem.getLatestItemRevision().getProperty("release_status_list").length()>0) { + + try { + newrev=newitem.getLatestItemRevision().saveAs(newitem.getNewRev()); + } catch (Exception e) { +// e.printStackTrace(); + } + isExist=true; + }else { + MessageBox.post("ѾΪU8,U8°Ƿ񷢲","",MessageBox.ERROR); + return; + } + } + } + if(saveDefault) { + + TCComponentUser user = this.session.getUser(); + TCComponentFolder newStuff = user.getNewStuffFolder(); + newStuff.add("contents", newitem); + //αļ + rev.add("JK8MBOMRelation", newitem); + }else{ + rev.add("JK8MBOMRelation", newitem); + } + /* if(isExist==false) { + TCComponentUser user = this.session.getUser(); + TCComponentFolder newStuff = user.getNewStuffFolder(); + newStuff.add("contents", newitem); + }*/ + + newitem.refresh(); + propertyValue=service.getStringValues("jk_prop_value");//ַ֧͵Ըֵ + TCComponentForm form1=(TCComponentForm) rev.getReferenceListProperty("IMAN_master_form_rev")[0]; + TCComponentForm form2=(TCComponentForm) newitem.getLatestItemRevision().getReferenceListProperty("IMAN_master_form_rev")[0]; + if(propertyValue==null) { + MessageBox.post("ϵԱѡjk_prop_value","",MessageBox.ERROR); + return; + } + for(int i=0;i"+keys[count1]); + vals[count1] = cPropS[j].getValue(); + System.out.println("vals["+count1+"]================>"+vals[count1]); + count1++; + } + break; + } +// if(a==1){ +// return; +// } + // TODO 2.,°汾͵ + // class_id = "";// TODO дѡ + try { +// createICS(class_id, newrev, newrev.getTCProperty("item_id").getStringValue(), keys, vals); + sendObjToClassficationByWebService(newitem.getLatestItemRevision(),keys,vals); + } catch (Exception e) { + MessageBox.post("ʧ","",MessageBox.ERROR); + e.printStackTrace(); + return; + } + + if(isSucceed==false) { + MessageBox.post("ʧ","",MessageBox.ERROR); + return; + } + + if (isExist == false) { + + // MessageBox.post("" + itemId + "ɹ\nNewStuffļ", "ɹ", MessageBox.INFORMATION); + MessageBox.post("" + itemId + "ɹ\nMBOMļ", "ɹ", MessageBox.INFORMATION); + }else { + // MessageBox.post("" + itemId + "ɹ\nNewStuffļ", "ɹ", MessageBox.INFORMATION); + MessageBox.post("" + itemId + "ɹ\nMBOMļ", "ɹ", MessageBox.INFORMATION); + } + + } + + // ϰ汾͵ + public void createICS(String class_id, TCComponentItemRevision target, String partid, Integer[] integers, + String[] vals) throws TCException { + TCClassificationService myService = session.getClassificationService(); + ICSApplicationObject icsAppObj = myService.newICSApplicationObject("ICM"); + icsAppObj.create(partid, target.getUid()); + icsAppObj.setView(class_id); +// // ɾʱ +// rev = (TCComponentItemRevision) aif.getComponent(); +// TCComponentICO[] ico = rev.getClassificationObjects(); +// for (int i = 0; i < ico.length; i++) { +// ico[0].delete(); +// } + ICSProperty icspro[] = new ICSProperty[integers.length]; + + for (int i = 0; i < icspro.length; i++) { + System.out.println(" CLASS ID = " + integers[i] + " =" + vals[i]); + icspro[i] = new ICSProperty(integers[i], vals[i]); + } + icsAppObj.setProperties(icspro); +// icsAppObj.save();TODO ʲôã + } + + + + public TCComponentBOMLine getTopLineByRev(TCComponentItemRevision rev) {//öbomline + try { + TCTypeService service = session.getTypeService(); + TCComponentBOMWindowType winType = (TCComponentBOMWindowType) service + .getTypeComponent("BOMWindow"); + window = winType.create(null); + line = window.setWindowTopLine(rev.getItem(), rev, null, null); + window.close();//رգᵼBOMռãBOMİ汾ɾTC + } catch (TCException e) { + e.printStackTrace(); + } + + return line; + } + public TCComponentBOMLine getTopLineByRev2(TCComponentItemRevision rev,TCComponentBOMWindow window) {//öbomline + try { + + line = window.setWindowTopLine(rev.getItem(), rev, null, null); + window.close();//رգᵼBOMռãBOMİ汾ɾTC + } catch (TCException e) { + e.printStackTrace(); + } + + return line; + } + + private void setbom(TCComponentBOMLine line ,TCComponentBOMLine oldline) {//bom + + try { +// setGlxq(rev); +// System.out.println("lineddd=" + line.toString()); + AIFComponentContext[] lins = line.getChildren(); + if (lins == null || lins.length <= 0) { + return; + } + window.lock(); + // ɾӼbomline + for (AIFComponentContext l : lins) { + System.out.println("ɾbom"); + TCComponent lt = (TCComponent) l.getComponent(); + + line.lock(); + line.remove("", lt); + line.save(); + line.unlock(); + } + lins = oldline.getChildren(); + + for (AIFComponentContext l : lins) { + TCComponent lt = (TCComponent) l.getComponent(); + //bl_substitute_listԣб + String bl_substitute_list=((TCComponentBOMLine) lt).getProperty("bl_substitute_list"); + System.out.println("bl_substitute_list---->"+bl_substitute_list); + String[] substitute_list = null ; + if(bl_substitute_list != null){ + bl_substitute_list.split(","); + } + /* System.out.println("bl_substitute_list=========>"+substitute_list.length); + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------1----------"+substitute_list[i]); + }*/ + TCProperty[] tcs = ((TCComponentBOMLine) lt).getTCProperties(new String[] { + "bl_quantity","bl_sequence_no", +// "jk8SubstitRatio", "jk8SubstitOrder","jk8EffectiveDate","jk8SubCompLossRate",//治˻ȡ +// "bl_item_uom_tag","jk8TechnicModel","jk8SpecificModel",// + "JK8Remark","JK8SupplyType","JK8Warehouse", + "JK8RemarkDesc","jk8SubCompLossRate" + + });//ֿ⡢Ӧͣbl_substituteȣjk8SubstitRatiojk8SubstitOrderЧڣjk8EffectiveDate + line.lock(); +// line.remove("", lt); + +// TCComponentItem chitem = ((TCComponentBOMLine) lt).getItem() +// .getLatestItemRevision().saveAsItem(null, null); +// TCComponentItemRevision r = chitem.getLatestItemRevision(); +// TCComponentItemRevision r=((TCComponentBOMLine) lt).getItem().getLatestItemRevision(); + TCComponentItemRevision r=((TCComponentBOMLine) lt).getItemRevision();//BOMLineӦItemRevision + System.out.println(line==null); + System.out.println(r==null); + /** start E-ͷ汾 ȥE- 2019-11-12 zmf **/ + //ȡidжǷΪE-ͷ + String r_item_id = r.getProperty("item_id"); + String r_rev = r.getProperty("item_revision_id"); + TCComponentItem new_item = null; + TCComponentItemRevision new_rev = null; + TCComponentBOMLine childBomLine = null; + boolean isexist = false ; + if(r_item_id.startsWith("E-")){ + String new_item_id = r_item_id.substring(2); + try { + //Ϊ Ѵcatch + new_item = tccitemType.find(new_item_id); + if(new_item == null){ + isexist = true ; + } + new_item = r.saveAsItem(new_item_id, null); + new_rev = new_item.getLatestItemRevision(); + childBomLine = line.add(new_item, new_rev, null, false, ""); + } catch (Exception e) { + /*tccitemType =(TCComponentItemType) session.getTypeComponent("Item"); + new_item = tccitemType.find(new_item_id);*/ + InterfaceAIFComponent[] itemComps = null; + itemComps = Util.searchComponentsCollection(session,"...", new String[] { " ID" },new String[] { new_item_id }); + new_item = (TCComponentItem) itemComps[0]; + TCComponentItemRevision lastRev = new_item.getLatestItemRevision(); + String lastRev_revision_id = lastRev.getProperty("item_revision_id"); + if(lastRev_revision_id.equals(r_rev)){ + new_rev = lastRev ; + childBomLine = line.add(new_item, new_rev, null, false, ""); + }else{ + /**ȡа汾 ҳĿǰ汾idӦİ汾 */ + AIFComponentContext[] children_Rev = new_item.getChildren(); + for (int i = 0; i < children_Rev.length; i++) { + String childRev_id = children_Rev[i].getComponent().getProperty("item_revision_id"); + if(childRev_id.equals(r_rev)){ + new_rev = (TCComponentItemRevision) children_Rev[i].getComponent() ; + + break; + } + } + childBomLine = line.add(new_item, new_rev, null, false, ""); + } + }finally{ + if(isexist){ + r.add("JK8MBOMRelation", new_item); + } + } + }else{ + childBomLine = line.add(r.getItem(), r, null, false, ""); + } + + // TCComponentBOMLine childBomLine = line.add(r.getItem(), r, null, false, ""); + /** end **/ + + if(substitute_list != null && substitute_list.length>0&&!bl_substitute_list.trim().equals("")){ + + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------------"+substitute_list[i]+"----------"); + TCComponentItemRevision itemRevision=((TCComponentItem)(session.search(" ID",new String[]{ " ID"}, new String[]{substitute_list[i].trim()})[0])).getLatestItemRevision(); + childBomLine.add(null, itemRevision, null, true); + } + } + childBomLine.setTCProperties(tcs); + + // setbom(childBomLine,r); + /** עϾ **/ + setChildBom(window, (TCComponentBOMLine)lt, childBomLine); + /** end **/ + line.save(); + line.unlock(); + } + window.save(); + window.unlock(); + MessageBox.post(AIFDesktop.getActiveDesktop(), "תɣ", "ʾ", MessageBox.INFORMATION); + } catch (Exception e) { + e.printStackTrace(); + } + } + + + private void setbom2(TCComponentBOMWindow window,TCComponentBOMLine line ,TCComponentBOMLine lineOld,int mark) {//bom + System.out.println("bom"); + if (mark == 0) { + try { + AIFComponentContext[] lins = line.getChildren(); + if (lins == null || lins.length <= 0) { + return; + } + window.lock(); + // ɾӼbomline + for (AIFComponentContext l : lins) { + System.out.println("ɾbom"); + TCComponent lt = (TCComponent) l.getComponent(); + + line.lock(); + line.remove("", lt); + line.save(); + line.unlock(); + } + // ٰebomԸƽbomlineӹ + lins = lineOld.getChildren(); + if (lins == null || lins.length <= 0) { + return; + } + for (AIFComponentContext l : lins) { + TCComponent lt = (TCComponent) l.getComponent(); + //bl_substitute_listԣб + String bl_substitute_list=((TCComponentBOMLine) lt).getProperty("bl_substitute_list"); + System.out.println("bl_substitute_list---->"+bl_substitute_list); + String[] substitute_list=bl_substitute_list.split(","); + System.out.println("bl_substitute_list=========>"+substitute_list.length); + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------1----------"+substitute_list[i]); + } + TCProperty[] tcs = ((TCComponentBOMLine) lt).getTCProperties(new String[] { + "bl_quantity","bl_sequence_no", + "JK8Remark","JK8SupplyType","JK8Warehouse", + "JK8RemarkDesc","jk8SubCompLossRate" + + });//ֿ⡢Ӧͣbl_substituteȣjk8SubstitRatiojk8SubstitOrderЧڣjk8EffectiveDate + line.lock(); + + + TCComponentItemRevision r =((TCComponentBOMLine) lt).getItemRevision();//BOMLineӦItemRevision + /** start E-ͷ汾 ȥE- 2019-11-12 zmf **/ + //ȡidжǷΪE-ͷ + String r_item_id = r.getProperty("item_id"); + String r_rev = r.getProperty("item_revision_id"); + TCComponentItem new_item = null; + TCComponentItemRevision new_rev = null; + TCComponentBOMLine childBomLine = null; + boolean isexist = false ; + if(r_item_id.startsWith("E-")){ + String new_item_id = r_item_id.substring(2); + try { + new_item = tccitemType.find(new_item_id); + if(new_item == null){ + isexist = true ; + } + new_item = r.saveAsItem(new_item_id, null); + new_rev = new_item.getLatestItemRevision(); + childBomLine = line.add(new_item, new_rev, null, false, ""); + } catch (Exception e) { + /*tccitemType =(TCComponentItemType) session.getTypeComponent("Item"); + new_item = tccitemType.find(new_item_id);*/ + InterfaceAIFComponent[] itemComps = null; + itemComps = Util.searchComponentsCollection(session,"...", new String[] { " ID" },new String[] { new_item_id }); + new_item = (TCComponentItem) itemComps[0]; + TCComponentItemRevision lastRev = new_item.getLatestItemRevision(); + String lastRev_revision_id = lastRev.getProperty("item_revision_id"); + if(lastRev_revision_id.equals(r_rev)){ + new_rev = lastRev ; + childBomLine = line.add(new_item, new_rev, null, false, ""); + }else{ + /**ȡа汾 ҳĿǰ汾idӦİ汾 */ + AIFComponentContext[] children_Rev = new_item.getChildren(); + for (int i = 0; i < children_Rev.length; i++) { + String childRev_id = children_Rev[i].getComponent().getProperty("item_revision_id"); + if(childRev_id.equals(r_rev)){ + new_rev = (TCComponentItemRevision) children_Rev[i].getComponent() ; + + break; + } + } + childBomLine = line.add(new_item, new_rev, null, false, ""); + } + }finally{ + if(isexist){ + r.add("JK8MBOMRelation", new_item); + } + } + }else{ + childBomLine = line.add(r.getItem(), r, null, false, ""); + } + + // TCComponentBOMLine childBomLine = line.add(r.getItem(), r, null, false, ""); + /** end **/ + if(substitute_list.length>0&&!bl_substitute_list.trim().equals("")){ + + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------------"+substitute_list[i]+"----------"); + TCComponentItemRevision itemRevision=((TCComponentItem)(session.search(" ID",new String[]{ " ID"}, new String[]{substitute_list[i].trim()})[0])).getLatestItemRevision(); + childBomLine.add(null, itemRevision, null, true); + } + } + childBomLine.setTCProperties(tcs); + + setChildBom(window, (TCComponentBOMLine)lt, childBomLine); + line.save(); + line.unlock(); + } + window.save(); + window.unlock(); + MessageBox.post(AIFDesktop.getActiveDesktop(), "תɣ", "ʾ", MessageBox.INFORMATION); + } catch (Exception e) { + e.printStackTrace(); + } + } + + } + + /** + * ݹв㼶 + */ + public void setChildBom(TCComponentBOMWindow window, TCComponentBOMLine oldLine, TCComponentBOMLine newLine){ + try { + AIFComponentContext[] lins = oldLine.getChildren(); + + if (lins == null || lins.length <= 0) { + return; + } + AIFComponentContext[] newLins = newLine.getChildren(); + window.lock(); + if(newLins != null && newLins.length > 0){ + for (AIFComponentContext l : newLins) { + System.out.println("ɾbom"); + TCComponent lt = (TCComponent) l.getComponent(); + + newLine.lock(); + newLine.remove("", lt); + newLine.save(); + newLine.unlock(); + } + } + + for (AIFComponentContext l : lins) { + TCComponent lt = (TCComponent) l.getComponent(); + //bl_substitute_listԣб + String bl_substitute_list=((TCComponentBOMLine) lt).getProperty("bl_substitute_list"); + System.out.println("bl_substitute_list---->"+bl_substitute_list); + String[] substitute_list=bl_substitute_list.split(","); + System.out.println("bl_substitute_list=========>"+substitute_list.length); + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------1----------"+substitute_list[i]); + } + TCProperty[] tcs = ((TCComponentBOMLine) lt).getTCProperties(new String[] { + "bl_quantity","bl_sequence_no", + "JK8Remark","JK8SupplyType","JK8Warehouse", + "JK8RemarkDesc","jk8SubCompLossRate" + + });//ֿ⡢Ӧͣbl_substituteȣjk8SubstitRatiojk8SubstitOrderЧڣjk8EffectiveDate + oldLine.lock(); + + + TCComponentItemRevision r =((TCComponentBOMLine) lt).getItemRevision();//BOMLineӦItemRevision + /** start E-ͷ汾 ȥE- 2019-11-12 zmf **/ + //ȡidжǷΪE-ͷ + String r_item_id = r.getProperty("item_id"); + String r_rev = r.getProperty("item_revision_id"); + TCComponentItem new_item = null; + TCComponentItemRevision new_rev = null; + TCComponentBOMLine childBomLine = null; + boolean isexist = false ; + if(r_item_id.startsWith("E-")){ + String new_item_id = r_item_id.substring(2); + try { + + new_item = tccitemType.find(new_item_id); + if(new_item == null){ + isexist = true ; + } + new_item = r.saveAsItem(new_item_id, null); + new_rev = new_item.getLatestItemRevision(); + childBomLine = newLine.add(new_item, new_rev, null, false, ""); + } catch (Exception e) { + /*tccitemType =(TCComponentItemType) session.getTypeComponent("Item"); + new_item = tccitemType.find(new_item_id);*/ + InterfaceAIFComponent[] itemComps = null; + itemComps = Util.searchComponentsCollection(session,"...", new String[] { " ID" },new String[] { new_item_id }); + new_item = (TCComponentItem) itemComps[0]; + TCComponentItemRevision lastRev = new_item.getLatestItemRevision(); + String lastRev_revision_id = lastRev.getProperty("item_revision_id"); + if(lastRev_revision_id.equals(r_rev)){ + new_rev = lastRev ; + childBomLine = newLine.add(new_item, new_rev, null, false, ""); + }else{ + /**ȡа汾 ҳĿǰ汾idӦİ汾 */ + AIFComponentContext[] children_Rev = new_item.getChildren(); + for (int i = 0; i < children_Rev.length; i++) { + String childRev_id = children_Rev[i].getComponent().getProperty("item_revision_id"); + if(childRev_id.equals(r_rev)){ + new_rev = (TCComponentItemRevision) children_Rev[i].getComponent() ; + + break; + } + } + childBomLine = newLine.add(new_item, new_rev, null, false, ""); + } + }finally{ + if(isexist){ + r.add("JK8MBOMRelation", new_item); + } + } + }else{ + childBomLine = newLine.add(r.getItem(), r, null, false, ""); + } + + /** end **/ + if(substitute_list.length>0&&!bl_substitute_list.trim().equals("")){ + + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------------"+substitute_list[i]+"----------"); + TCComponentItemRevision itemRevision=((TCComponentItem)(session.search(" ID",new String[]{ " ID"}, new String[]{substitute_list[i].trim()})[0])).getLatestItemRevision(); + childBomLine.add(null, itemRevision, null, true); + } + } + childBomLine.setTCProperties(tcs); + + setChildBom(window,(TCComponentBOMLine)lt,childBomLine); + oldLine.save(); + oldLine.unlock(); + } + window.save(); + window.unlock(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + //͵ class_id=codeRemarkˮ룿 + boolean isSucceed=true; + public void sendObjToClassficationByWebService(TCComponentItemRevision rev,Integer[] keys, + String[] vals){ + try { + System.out.println("class_id-----dddddd----->"+class_id); + if( !class_id.replace(" ", "").equals("") ){ + + List propList = new ArrayList<>(); + for(int i = 0; i < keys.length; i++){ + ClassProperty prop = new ClassProperty(keys[i], vals[i]);// + propList.add(prop); + } + String json = SoaServerUtil.objectToJson(propList);//JavaתΪjson + try { + SoaServerUtil.grantWritePrivilege(session, rev);//дȨ + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + try { + SoaServerUtil.sendToClass(rev.getUid(), class_id, json,url);//͵ + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + try { + SoaServerUtil.grantReadPrivilege(session, rev);//Ȩ + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + } catch (Exception e) { + isSucceed=false; + e.printStackTrace(); + } + + } + +} diff --git a/src/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_OperationBefore b/src/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_OperationBefore new file mode 100644 index 0000000..ab0958a --- /dev/null +++ b/src/com/connor/jk/plm/E_U8ToEBOM_New/E_U8ToU8_OperationBefore @@ -0,0 +1,319 @@ +package com.connor.jk.plm.E_U8ToEBOM_New; + +import java.util.ArrayList; +import java.util.List; + +import javax.swing.JTextField; + +//import com.connor.jk.plm.tempToFormal.ClassProperty; +//import com.connor.jk.plm.tempToFormal.SoaServerUtil; +import com.teamcenter.rac.aif.AbstractAIFApplication; +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.TCComponentBOMViewRevision; +import com.teamcenter.rac.kernel.TCComponentBOMWindow; +import com.teamcenter.rac.kernel.TCComponentBOMWindowType; +import com.teamcenter.rac.kernel.TCComponentFolder; +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.TCComponentItemType; +import com.teamcenter.rac.kernel.TCComponentUser; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.kernel.TCTypeService; +import com.teamcenter.rac.kernel.TCUserService; +import com.teamcenter.rac.kernel.ics.ICSApplicationObject; +import com.teamcenter.rac.kernel.ics.ICSProperty; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.schemas.soa._2006_03.exceptions.ServiceException; + +public class E_U8ToU8_Operation extends AbstractAIFOperation { + private AbstractAIFApplication app; + private TCSession session; + private InterfaceAIFComponent targetComp; + private AIFComponentContext aif; + private String[] prop; + private TCProperty[] props; + private TCUserService userService; + private TCPreferenceService service; + private TCComponentItem target; + private TCComponentBOMLine line = null; + private TCComponentBOMWindow window=null; + private List childRevList;//봴JListй + + public E_U8ToU8_Operation(AbstractAIFApplication app2, AIFComponentContext aif, InterfaceAIFComponent targetComp, + TCSession session2) { + this.app = app2; + this.targetComp = targetComp; + this.aif = aif; + this.session = session2; + } + + private String itemId;// ʽϵID + private String itemRev;// ʽϵİ汾 + private String itemName;// ʽϵ + + private TCComponentItemRevision itemRevision;// ʽϵİ汾 + + private TCComponentItemRevision rev; + private TCComponentBOMViewRevision bomViewRevision; + private AIFComponentContext[] Context2; + String class_id ; + Integer[] keys = null; + String[] vals = null; + String url=""; + @Override + public void executeOperation() throws Exception { + service=session.getPreferenceService(); + url= service.getStringValue("Autocode_SendClassServer_URL"); + // TODO + // 1.ȡѷ°汾ķ + class_id = ((TCComponent) aif.getComponent()).getClassificationClass(); + if(class_id==""){ + MessageBox.post("δִ࣬д˲", "", MessageBox.ERROR); + return; + } +// int a=1; +// target = (TCComponentItem) targetComp; + // TODO ѡ +// service = session.getPreferenceService(); + // String class_id=service.getStringValue(""); + if (aif.getComponent() instanceof TCComponentItemRevision) { + rev = (TCComponentItemRevision) aif.getComponent(); + + +// AIFComponentd + // object_name + props = rev.getTCProperties(new String[] { "object_name" }); + itemName = props[0].getStringValue(); + + // ID + props = rev.getTCProperties(new String[] { "item_id" }); + itemId = props[0].getStringValue().substring(2); + + + } + + //ֻתһ汾 + TCComponentItem newitem =null; + try { + //ӦȲѯһ¿ǷѾitemû½оֱӻȡ + newitem = rev.saveAsItem(itemId, null); + + } catch (Exception e1) { + e1.printStackTrace(); + MessageBox.post(e1.getMessage()+"\nϿѾΪU8,ϵͳ޸U8ϴڡ","",MessageBox.ERROR); + return; + } + TCComponentItemRevision newrev = newitem.getLatestItemRevision();//°汾 + + // newstuffļ + TCComponentUser user = this.session.getUser(); + TCComponentFolder newStuff = user.getNewStuffFolder(); + newStuff.add("contents", newitem); + + //2017.9.15 + TCComponentForm oldForm=(TCComponentForm)((TCComponentItemRevision)aif.getComponent()).getReferenceListProperty("IMAN_master_form_rev")[0]; + TCComponentForm newForm=(TCComponentForm) newrev.getReferenceListProperty("IMAN_master_form_rev")[0]; + try { + newForm.setTCProperties(oldForm.getAllTCProperties()); + } catch (Exception e1) { + e1.printStackTrace(); + } + + newForm.getTCProperty("object_name").setStringValue(oldForm.getTCProperty("object_name").getStringValue().split("E-")[1]); + if(newForm.getTCProperty("object_name").getStringValue().startsWith("8")) { + newForm.getTCProperty("jk8IsDomesticMarket").setStringValue(""); + } + //2018.5.7 û02ʱתʱ汾ͻʵʲӦ + String name=newForm.getTCProperty("object_name").getStringValue(); + System.out.println(name); + name=name.split("/")[0]+"/"+"01"; + newForm.getTCProperty("object_name").setStringValue(name); + //TODO ͼ + TCComponentBOMLine line = getTopLineByRev(newrev);//öbomline + if(line!=null){ + setbom(line,rev); + } + window.close(); + + rev = itemRevision; + TCComponentICO[] icoS = ((TCComponentItemRevision)aif.getComponent()).getClassificationObjects(); + + int count=0; + int count1=0; + System.out.println("icoS.length---------------"+icoS.length); + for (int i = 0; i < icoS.length; i++) { + ICSProperty[] cPropS = icoS[i].getICSProperties(true); + + for (int j = 0; j < cPropS.length; j++) { + System.out.println(count); + count++; + } + keys=new Integer[count]; + vals = new String[count]; + for (int j = 0; j < cPropS.length; j++) { + System.out.println(count); + keys[count1] = cPropS[j].getId(); + System.out.println("keys["+count1+"]================>"+keys[count1]); + vals[count1] = cPropS[j].getValue(); + System.out.println("vals["+count1+"]================>"+vals[count1]); + count1++; + } + break; + } +// if(a==1){ +// return; +// } + // TODO 2.,°汾͵ + // class_id = "";// TODO дѡ + try { +// createICS(class_id, newrev, newrev.getTCProperty("item_id").getStringValue(), keys, vals); + sendObjToClassficationByWebService(newrev,keys,vals); + } catch (Exception e) { + MessageBox.post("ʧ","",MessageBox.ERROR); + e.printStackTrace(); + return; + } + + if(isSucceed==false) { + MessageBox.post("ʧ","",MessageBox.ERROR); + return; + } + + + + MessageBox.post(""+itemId+"ɹ\nNewStuffļ", "ɹ", MessageBox.INFORMATION); + + } + + // ϰ汾͵ + public void createICS(String class_id, TCComponentItemRevision target, String partid, Integer[] integers, + String[] vals) throws TCException { + TCClassificationService myService = session.getClassificationService(); + ICSApplicationObject icsAppObj = myService.newICSApplicationObject("ICM"); + icsAppObj.create(partid, target.getUid()); + icsAppObj.setView(class_id); +// // ɾʱ +// rev = (TCComponentItemRevision) aif.getComponent(); +// TCComponentICO[] ico = rev.getClassificationObjects(); +// for (int i = 0; i < ico.length; i++) { +// ico[0].delete(); +// } + ICSProperty icspro[] = new ICSProperty[integers.length]; + + for (int i = 0; i < icspro.length; i++) { + System.out.println(" CLASS ID = " + integers[i] + " =" + vals[i]); + icspro[i] = new ICSProperty(integers[i], vals[i]); + } + icsAppObj.setProperties(icspro); +// icsAppObj.save();TODO ʲôã + } + + + + public TCComponentBOMLine getTopLineByRev(TCComponentItemRevision rev) {//öbomline + try { + TCTypeService service = session.getTypeService(); + TCComponentBOMWindowType winType = (TCComponentBOMWindowType) service + .getTypeComponent("BOMWindow"); + window = winType.create(null); + line = window.setWindowTopLine(rev.getItem(), rev, null, null); +// window.close();//رգᵼBOMռãBOMİ汾ɾTC + } catch (TCException e) { + e.printStackTrace(); + } + + return line; + } + + + private void setbom(TCComponentBOMLine line ,TCComponentItemRevision rev) {//bom + + try { +// setGlxq(rev); +// System.out.println("lineddd=" + line.toString()); + AIFComponentContext[] lins = line.getChildren(); + if (lins == null || lins.length <= 0) { + return; + } + for (AIFComponentContext l : lins) { + TCComponent lt = (TCComponent) l.getComponent(); + //bl_substitute_listԣб + String bl_substitute_list=((TCComponentBOMLine) lt).getProperty("bl_substitute_list"); + System.out.println("bl_substitute_list---->"+bl_substitute_list); + String[] substitute_list=bl_substitute_list.split(","); + System.out.println("bl_substitute_list=========>"+substitute_list.length); + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------1----------"+substitute_list[i]); + } + TCProperty[] tcs = ((TCComponentBOMLine) lt) + .getTCProperties(new String[] { + "bl_quantity","bl_sequence_no", +// "jk8SubstitRatio", "jk8SubstitOrder","jk8EffectiveDate","jk8SubCompLossRate",//治˻ȡ +// "bl_item_uom_tag","jk8TechnicModel","jk8SpecificModel",// + "JK8Remark","JK8SupplyType","JK8Warehouse", + "JK8RemarkDesc","jk8SubCompLossRate" + + });//ֿ⡢Ӧͣbl_substituteȣjk8SubstitRatiojk8SubstitOrderЧڣjk8EffectiveDate + line.lock(); + line.remove("", lt); + + TCComponentItemRevision r=((TCComponentBOMLine) lt).getItemRevision();//BOMLineӦItemRevision + + TCComponentBOMLine childBomLine = line.add(r.getItem(), r, + null, false, ""); + if(substitute_list.length>0&&!bl_substitute_list.trim().equals("")){ + + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------------"+substitute_list[i]+"----------"); + TCComponentItemRevision itemRevision=((TCComponentItem)(session.search(" ID",new String[]{ " ID"}, new String[]{substitute_list[i].trim()})[0])).getLatestItemRevision(); + childBomLine.add(null, itemRevision, null, true); + } + } + childBomLine.setTCProperties(tcs); + + setbom(childBomLine,r); + line.save(); + line.unlock(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + //͵ class_id=codeRemarkˮ룿 + boolean isSucceed=true; + public void sendObjToClassficationByWebService(TCComponentItemRevision rev,Integer[] keys, + String[] vals){ + try { + System.out.println("class_id-----dddddd----->"+class_id); + if( !class_id.replace(" ", "").equals("") ){ + + List propList = new ArrayList<>(); + for(int i = 0; i < keys.length; i++){ + ClassProperty prop = new ClassProperty(keys[i], vals[i]);// + propList.add(prop); + } + String json = SoaServerUtil.objectToJson(propList);//JavaתΪjson + SoaServerUtil.grantWritePrivilege(session, rev);//дȨ + SoaServerUtil.sendToClass(rev.getUid(), class_id, json,url);//͵ + + SoaServerUtil.grantReadPrivilege(session, rev);//Ȩ + } + + } catch (Exception e) { + isSucceed=false; + e.printStackTrace(); + } + + } + +} diff --git a/src/com/connor/jk/plm/E_U8ToEBOM_New/JAutoCompleteComboBox.java b/src/com/connor/jk/plm/E_U8ToEBOM_New/JAutoCompleteComboBox.java new file mode 100644 index 0000000..b1beb78 --- /dev/null +++ b/src/com/connor/jk/plm/E_U8ToEBOM_New/JAutoCompleteComboBox.java @@ -0,0 +1,83 @@ +package com.connor.jk.plm.E_U8ToEBOM_New; + +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.util.List; +import java.util.Vector; +import javax.swing.ComboBoxModel; +import javax.swing.DefaultComboBoxModel; +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.JTextField; + +public class JAutoCompleteComboBox extends JComboBox { + private AutoCompleter completer; + + public JAutoCompleteComboBox() + { + super(); + addCompleter(); + } + + public JAutoCompleteComboBox(ComboBoxModel cm) { + super(cm); + addCompleter(); + } + + public JAutoCompleteComboBox(Object[] items) { + super(items); + addCompleter(); + } + + public JAutoCompleteComboBox(List v) { + super((Vector) v); + addCompleter(); + } + + private void addCompleter() { + setEditable(true); + completer = new AutoCompleter(this); + } + + public void autoComplete(String str) { + this.completer.autoComplete(str,str.length()); + } + + public String getText() { + return ((JTextField) getEditor().getEditorComponent()).getText(); + } + + public void setText(String text) { + ((JTextField) getEditor().getEditorComponent()).setText(text); + } + + public boolean containsItem(String itemString) + { + for (int i = 0; i < this.getModel().getSize(); i++) { + String _item = " " + this.getModel().getElementAt(i); + if (_item.equals(itemString)) + return true; + } + return false; + } + + public static void main(String[] args) + { + JFrame frame = new JFrame(); + Object[] items = new Object[] + { "abc ", "aab ", "aba ", "hpp ", "pp ", "hlp " }; + DefaultComboBoxModel model = new DefaultComboBoxModel(); + JComboBox cmb = new JAutoCompleteComboBox(model); + model.addElement( "abc "); + model.addElement( "aab "); + model.addElement( "aba "); + model.addElement( "hpp "); + model.addElement( "pp "); + model.addElement( "hlp "); + frame.getContentPane().add(cmb); + frame.setSize(40, 80); + frame.setVisible(true); + } +} diff --git a/src/com/connor/jk/plm/E_U8ToEBOM_New/ProgressBar.java b/src/com/connor/jk/plm/E_U8ToEBOM_New/ProgressBar.java new file mode 100644 index 0000000..0af046c --- /dev/null +++ b/src/com/connor/jk/plm/E_U8ToEBOM_New/ProgressBar.java @@ -0,0 +1,171 @@ +/** + * @file ProgressBar.java + * + * @brief Create progress bar + * + * @author Yanghui + * + * @history + * ================================================================ + * Date Name Description of Change + * 25-July-2008 Yanghui this class is used to create + * progress bar. + */ +package com.connor.jk.plm.E_U8ToEBOM_New; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JProgressBar; +import javax.swing.Timer; +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.util.PropertyLayout; +import com.teamcenter.rac.util.Registry; + +/** + * @class ProgressBar + * @brief Create progress bar + * @author Yanghui + */ +public class ProgressBar extends AbstractAIFDialog implements ActionListener { + /** + * @var ProgressBar.progressbar + * @brief JProgressBar + */ + private JProgressBar progressbar; + + /** + * @var ProgressBar.label + * @brief label used to tips + */ + private JLabel label; + + /** + * @var ProgressBar.timer + * @brief timer used to timing operation + */ + private Timer timer; + + /** + * @var ProgressBar.bool + * @brief bool used to flag thread return + */ + private boolean bool = false; + + /** + * @var Progressbar.registry + * @brief Registry + */ + private Registry registry; + + /** + * @fn public ProgressBar() + * @brief constructor + * @param[in] null + */ + private String showLable = null ; + public ProgressBar(String showlable) { + super(true); + showLable = showlable; + this.setAlwaysOnTop(true); + } + + /** + * @fn public void setBool(boolean bool) + * @brief set bool value + * @param[in] bool + * @param[out] null + */ + public void setBool(boolean bool) { + this.bool = bool; + } + + /** + * @fn private void initUI() + * @brief createDialog method + * @param[in] null + * @param[out] null + */ + public void initUI() { + Container container = getContentPane(); + JPanel mainPanel = new JPanel(new PropertyLayout()); + this.label = new JLabel(showLable, JLabel.CENTER); + this.progressbar = new JProgressBar(); + this.progressbar.setOrientation(JProgressBar.HORIZONTAL); + this.progressbar.setMinimum(0); + this.progressbar.setMaximum(100); + this.progressbar.setValue(0); + this.progressbar.setPreferredSize(new Dimension(200, 15)); + this.progressbar.setBorderPainted(true); + this.timer = new Timer(50, (ActionListener) this); + this.timer.setRepeats(false); + mainPanel.add("1.1.center", new JLabel(" ")); + mainPanel.add("2.1.center", label); + mainPanel.add("3.1.center", progressbar); + mainPanel.add("4.1.center", new JLabel(" ")); + container.add(mainPanel); + pack(); + setLocation(500, 200); + TaskThread thread = new TaskThread(this); + thread.start(); + addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + bool = true; + } + }); + this.setVisible(true); + } + + /** + * @class TaskThread + * @brief Create progressbar + * + */ + class TaskThread extends Thread { + private ProgressBar bar; + + public TaskThread(ProgressBar bar) { + this.bar = bar; + } + + public void run() { + if (bool == false) { + // Set Status is running. + // session.setStatus(registry.getString("export Running")); + } + for (int i = 0; i < i + 1; i++) { + timer.start(); + int value = progressbar.getValue(); + if (value < 100) { + value = value + 5; + progressbar.setValue(value); + } else { + timer.stop(); + progressbar.setValue(0); + } + try { + sleep(100); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + if (bool == true) { + bar.setVisible(false); + bar.dispose(); + return; + + } + + } + } + } + + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + + } +} diff --git a/src/com/connor/jk/plm/E_U8ToEBOM_New/ProgressBarThread.java b/src/com/connor/jk/plm/E_U8ToEBOM_New/ProgressBarThread.java new file mode 100644 index 0000000..d2386e5 --- /dev/null +++ b/src/com/connor/jk/plm/E_U8ToEBOM_New/ProgressBarThread.java @@ -0,0 +1,41 @@ +/** + * @file ProgressBarThread.java + * + * @brief control progressBar. + * + * @author Yanghui + * + * @history + * ================================================================ + * Date Name Description of Change + * 08-Auguest-2008 Yanghui this class is used to control + * progress bar. + */ +package com.connor.jk.plm.E_U8ToEBOM_New; + +/** + * @class ProgressBarThread + * @brief Create progress bar thread + * @author Yanghui + */ +public class ProgressBarThread extends Thread { + + private ProgressBar bar; + + private String title; + + public ProgressBarThread(String title,String showLable) { + this.title = title; + bar = new ProgressBar(showLable); + } + + public void run() { + bar.setTitle(title); + bar.initUI(); + } + + public void setBool(boolean bool) { + bar.setBool(true); + bar.setAlwaysOnTop(true); + } +} diff --git a/src/com/connor/jk/plm/E_U8ToEBOM_New/SoaServerUtil.java b/src/com/connor/jk/plm/E_U8ToEBOM_New/SoaServerUtil.java new file mode 100644 index 0000000..0de289f --- /dev/null +++ b/src/com/connor/jk/plm/E_U8ToEBOM_New/SoaServerUtil.java @@ -0,0 +1,227 @@ +package com.connor.jk.plm.E_U8ToEBOM_New; + +import java.util.ArrayList; +import java.util.List; + +import net.sf.json.JSONArray; + +import org.apache.axiom.om.OMAbstractFactory; +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.OMFactory; +import org.apache.axiom.om.OMNamespace; +import org.apache.axis2.AxisFault; +import org.apache.axis2.addressing.EndpointReference; +import org.apache.axis2.client.Options; +import org.apache.axis2.client.ServiceClient; +import org.apache.axis2.transport.http.HTTPConstants; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCAccessControlService; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCComponentUser; +import com.teamcenter.rac.kernel.TCComponentUserType; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.kernel.TCUserService; + +public class SoaServerUtil { + + public static void sendToClass(String wsoPUID, String classID, String json, String url) { + // AbstractAIFApplication app; + // app=AIFUtility.getCurrentApplication(); + // TCSession session; + // session=(TCSession) app.getSession(); + // TCPreferenceService preferenceService; + // preferenceService=session.getPreferenceService(); + // String account=preferenceService.getStringValue("Autocode_PriverUser_ID"); + // String url; + // url = preferenceService.getStringValue("Autocode_SendClassServer_URL"); + try { + ServiceClient sc = new ServiceClient(); + Options opts = new Options(); + // url = "http://10.201.5.203:19090/ErpWebService.asmx?WSDL"; + EndpointReference end = new EndpointReference(url); + opts.setTo(end); + opts.setAction("SendToClass"); + sc.setOptions(opts); + + OMFactory fac = OMAbstractFactory.getOMFactory(); + OMNamespace omNs = fac.createOMNamespace("http://tempuri.org/", ""); + OMElement method = fac.createOMElement("SendToClass", omNs); + OMElement value = fac.createOMElement("wsoPuiid", omNs); + value.setText(wsoPUID); + OMElement value1 = fac.createOMElement("classID", omNs); + value1.setText(classID); + OMElement value2 = fac.createOMElement("JsonContainer", omNs); + // "[{\"value\":\"1\",\"propertyID\":-500003},{\"value\":\"1\",\"propertyID\":-500011}]" + value2.setText(json); + + method.addChild(value); + method.addChild(value1); + method.addChild(value2); + + OMElement res = sc.sendReceive(method); + res.getFirstElement().getText(); + System.out.println(res.getFirstElement().getText()); + } catch (AxisFault e) { + e.printStackTrace(); + } + + } + + // public static void main(String[] args) { + // deleteClass("1111", ""); + // } + // ɾʱ + public static void deleteClass(String icoPUID, String url) { + try { + ServiceClient sc = new ServiceClient(); + Options opts = new Options(); + // url = "http://10.201.5.203:19090/ErpWebService.asmx?WSDL";//TODO + // ѡAutocode_SendClassServer_URL + // url = preferenceService.getStringValue("Autocode_SendClassServer_URL");//TODO + // ѡAutocode_SendClassServer_URL + EndpointReference end = new EndpointReference(url); + opts.setTo(end); + opts.setAction("DeleteClass"); + opts.setProperty(HTTPConstants.CHUNKED, "false"); + sc.setOptions(opts); + + OMFactory fac = OMAbstractFactory.getOMFactory(); + OMNamespace omNs = fac.createOMNamespace("http://tempuri.org/", ""); + OMElement method = fac.createOMElement("DeleteClass", omNs); + OMElement value = fac.createOMElement("icoPuid", omNs); + value.setText(icoPUID); + // OMElement value1 = fac.createOMElement("classID", omNs); + //// value1.setText(classID); + // OMElement value2 = fac.createOMElement("JsonContainer", omNs); + // "[{\"value\":\"1\",\"propertyID\":-500003},{\"value\":\"1\",\"propertyID\":-500011}]" + // value2.setText(json); + + method.addChild(value); + // method.addChild(value1); + // method.addChild(value2); + + OMElement res = sc.sendReceive(method); + res.getFirstElement().getText(); + System.out.println(res.getFirstElement().getText()); + } catch (AxisFault e) { + e.printStackTrace(); + } + + } + + public static String objectToJson(List props) { + String str = null; + try { + JSONArray json = JSONArray.fromObject(props);// javaתΪjson + str = json.toString();// jsonתΪַ + } catch (Exception e) { + e.printStackTrace(); + } + System.out.println("JSON =>" + str); + return str; + } + + public static void grantReadPrivilege(TCSession tcSession, TCComponent tccomponent) { + AbstractAIFApplication app; + app = AIFUtility.getCurrentApplication(); + TCSession session; + session = (TCSession) app.getSession(); + TCPreferenceService preferenceService; + preferenceService = session.getPreferenceService(); + String account = preferenceService.getStringValue("Autocode_PriverUser_ID"); + try { + TCAccessControlService accessControlService = tcSession.getTCAccessControlService(); + TCComponentUserType type = (TCComponentUserType) tcSession.getTypeComponent("User"); + TCComponentUser user = type.find(account); + + if (user == null) { + return; + } + if (tcSession.getUser().equals(user)) { + return; + } + + String[] as2 = new String[] { "READ" }; + + if (tccomponent instanceof TCComponentItemRevision) { + TCComponentItem tempItem = ((TCComponentItemRevision) tccomponent).getItem(); + openByPass(tcSession); + accessControlService.grantPrivilege(tempItem, user, as2); + closeByPass(tcSession); + + openByPass(tcSession); + accessControlService.grantPrivilege(tccomponent, user, as2); + closeByPass(tcSession); + } else { + openByPass(tcSession); + accessControlService.grantPrivilege(tccomponent, user, as2); + closeByPass(tcSession); + } + } catch (TCException e) { + e.printStackTrace(); + } + } + + public static void grantWritePrivilege(TCSession tcSession, TCComponent tccomponent) { + AbstractAIFApplication app; + app = AIFUtility.getCurrentApplication(); + TCSession session; + session = (TCSession) app.getSession(); + TCPreferenceService preferenceService; + preferenceService = session.getPreferenceService(); + String account = preferenceService.getStringValue("Autocode_PriverUser_ID"); + try { + TCAccessControlService accessControlService = tcSession.getTCAccessControlService(); + TCComponentUserType type = (TCComponentUserType) tcSession.getTypeComponent("User"); + + TCComponentUser user = type.find(account); + if (user == null) { + return; + } + if (tcSession.getUser().equals(user)) { + return; + } + + String[] as2 = new String[] { "READ", "WRITE", "DELETE" }; + + if (tccomponent instanceof TCComponentItemRevision) { + TCComponentItem tempItem = ((TCComponentItemRevision) tccomponent).getItem(); + openByPass(tcSession); + accessControlService.grantPrivilege(tempItem, user, as2); + closeByPass(tcSession); + + openByPass(tcSession); + accessControlService.grantPrivilege(tccomponent, user, as2); + closeByPass(tcSession); + } else { + openByPass(tcSession); + accessControlService.grantPrivilege(tccomponent, user, as2); + closeByPass(tcSession); + } + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public static void openByPass(TCSession session) throws TCException { + TCUserService userservice = session.getUserService(); + Object[] obj = new Object[1]; + obj[0] = "origin"; + userservice.call("ORIGIN_set_bypass", obj); + } + + public static void closeByPass(TCSession session) throws TCException { + TCUserService userservice = session.getUserService(); + Object[] obj = new Object[1]; + obj[0] = "origin"; + userservice.call("ORIGIN_close_bypass", obj); + } + +} diff --git a/src/com/connor/jk/plm/E_U8ToEBOM_New/Util.java b/src/com/connor/jk/plm/E_U8ToEBOM_New/Util.java new file mode 100644 index 0000000..b06f158 --- /dev/null +++ b/src/com/connor/jk/plm/E_U8ToEBOM_New/Util.java @@ -0,0 +1,137 @@ +package com.connor.jk.plm.E_U8ToEBOM_New; +import java.util.List; + +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.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +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.TCUserService; +import com.teamcenter.rac.util.MessageBox; + +public class Util { + public static TCPreferenceService service; + public static TCSession session; + public static TCUserService userservice;; + + static { + if (session == null) { + session = (TCSession) (AIFUtility.getCurrentApplication() + .getSession()); + } + if (service == null) + service = session.getPreferenceService(); + } + + public static void setByPass(boolean val) throws TCException { + if (userservice == null) { + userservice = session.getUserService(); + } + Object[] obj = new Object[1]; + obj[0] = "origin"; + if (val) { + userservice.call("ORIGIN_set_bypass", obj); + } else { + userservice.call("ORIGIN_close_bypass", obj); + } + } + + /** + * bom + * + * @param selectIndex + * @throws TCException + */ + + public static InterfaceAIFComponent[] searchComponentsCollection( + TCSession session, String searchName, String[] keys, String[] values) { + // Ϣ + InterfaceAIFComponent[] result = new InterfaceAIFComponent[0]; + + try { + System.out.println("ʼִ"); + // õѯķ +// TCTextService textService = session.getTextService(); + // ȡquerytype + // ̶дImanQuery + TCComponentQueryType querytype = (TCComponentQueryType) session + .getTypeComponent("ImanQuery"); + // ͨquerytypeҵsearchNameIJѯ + TCComponentQuery query = (TCComponentQuery) querytype + .find(searchName); +// if (query == null) { +// MessageBox.post("ͨѯ" + searchName + "", "", 1); +// return null; +// }else{ +// MessageBox.post("ͨѯҵ" + searchName, "ɹ", 2); +// } + querytype.clearCache(); + String[] as = new String[keys.length]; + for (int i = 0; i < keys.length; i++) { +// as[i] = textService.getTextValue(keys[i]); + as[i] = keys[i]; + System.out.println("ûѯĿas["+i+"]="+as[i]); + } + + String[] as1 = new String[values.length]; + for (int i = 0; i < values.length; i++) { +// as1[i] = textService.getTextValue(values[i]); + as1[i] = values[i]; + System.out.println("ûѯĿӦֵas1["+i+"]="+as1[i]); + } + query.clearCache();//ҵջ + // ͨѯõѯϢ + TCQueryClause[] clauses = query.describe(); + + // ѯϢѯĿǷȷ + for (int i = 0; i < clauses.length; i++) { + // õѯ + clauses[i].getAttributeName();//item_id + // õûĿ + clauses[i].getUserEntryName();//ItemID + // õûػĿ + clauses[i].getUserEntryNameDisplay();// ID + System.out.println(clauses[i].getAttributeName()+"\t"+ + clauses[i].getUserEntryName()+"\t"+ + clauses[i].getUserEntryNameDisplay()); + + } + // ִвѯ +// TCComponentContextList list = query.getExecuteResultsList(as, as1); + TCComponentContextList list = query.getExecuteResultsList(keys, values); + if (list != null) { + // õѯĶ + int count = list.getListCount(); + // صγ + result = new InterfaceAIFComponent[count]; + // ѯĽص鸳ֵ + for (int i = 0; i < count; i++) { + // õѯ +// AIFComponentContext context = list.get(i); + // ͨĵõӦĶ󣬲ֵص + result[i] = list.get(i).getComponent(); + System.out.println("result["+i+"]="+result[i]); + } + } + } catch (TCException e) { + e.printStackTrace(); +// MessageBox.post("ͨѯ" + searchName + "ѯ.", "", 1); + } + + return result; + } + +} \ No newline at end of file diff --git a/src/com/connor/jk/plm/E_U8ToU8/ClassProperty.java b/src/com/connor/jk/plm/E_U8ToU8/ClassProperty.java new file mode 100644 index 0000000..63c1925 --- /dev/null +++ b/src/com/connor/jk/plm/E_U8ToU8/ClassProperty.java @@ -0,0 +1,42 @@ +package com.connor.jk.plm.E_U8ToU8; + +/** + * @copyRight 㽭տƼ޹˾ + * @author E-mail:hub@connor.net.cn + * @date ʱ䣺2017-7-3 11:47:03 + * @version v1.0 + * @parameter + * @since + * @return + */ + +public class ClassProperty { + private int propertyID; + private String value; + + public ClassProperty() { + + } + + public ClassProperty(int propertyID, String value) { + this.propertyID = propertyID; + this.value = value; + } + + public int getPropertyID() { + return propertyID; + } + + public void setPropertyID(int propertyID) { + this.propertyID = propertyID; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + +} diff --git a/src/com/connor/jk/plm/E_U8ToU8/E_U8ToU8_Action.java b/src/com/connor/jk/plm/E_U8ToU8/E_U8ToU8_Action.java new file mode 100644 index 0000000..e5c75e6 --- /dev/null +++ b/src/com/connor/jk/plm/E_U8ToU8/E_U8ToU8_Action.java @@ -0,0 +1,359 @@ +/** + * + */ +package com.connor.jk.plm.E_U8ToU8; + +import java.awt.event.ActionEvent; +import java.util.HashMap; +import java.util.Map; + +import javax.swing.AbstractAction; + +import org.eclipse.core.commands.AbstractHandler; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.common.actions.AbstractAIFAction; +import com.teamcenter.rac.aif.kernel.AIFComponentContext; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentBOMLine; +import com.teamcenter.rac.kernel.TCComponentBOMViewRevision; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +/** + * @author Administrator + * + */ +public class E_U8ToU8_Action extends AbstractAIFAction { + private AbstractAIFApplication app; + private InterfaceAIFComponent targetComp; + private TCSession session; + + private TCProperty[] props; + private String[] prop = new String[8]; + private AIFComponentContext aif;// °汾 + + public E_U8ToU8_Action(AbstractAIFApplication arg0, String arg1) { + super(arg0, arg1); + this.app = arg0; + this.session = (TCSession) app.getSession(); + this.targetComp = app.getTargetComponent(); + } + + // public void getPropMsg(AIFComponentContext aif2) throws Exception { + // if (aif2.getComponent() instanceof TCComponentItemRevision) { + // TCComponentItemRevision rev = (TCComponentItemRevision) + // aif2.getComponent(); + // // ȡһ + // props = rev.getTCProperties(new String[] { "cd9_codeDesc", "cd9_codeId", + // "cd9_codePattern", + // "cd9_codeRuleName", "cd9_codeStyle", "cd9_codeValue1", + // "cd9_codeValueDesc1", "cd9_generateID" }); + // for (int i = 0; i < prop.length; i++) { + // prop[i] = props[i].getStringValue(); + // + // } + // } + // } + + @Override + public void run() { + //2017.8.17ѡǰ汾 + if(!targetComp.getType().equals("JK8MaterialRevision")&&!targetComp.getType().equals("JK8Material")) { + //2018.4.13 ޸ʾΪѡӦ϶ϰ汾ִд˲ +// MessageBox.post("ѡJK8MaterialRevisionJK8Material͵ִд˲", "", MessageBox.ERROR); + MessageBox.post("ѡӦ϶ϰ汾ִд˲", "", MessageBox.ERROR); + return; + }else if(targetComp.getType().equals("JK8MaterialRevision")) { + try { + TCComponentItem componentItem=(TCComponentItem) session.search("...", new String[] {" ID"}, new String[] {((TCComponentItemRevision)targetComp).getTCProperty("item_id").getStringValue()})[0]; + + AIFComponentContext[] aifComponentContextsTemp = componentItem.getChildren(); + int num = 0; + for (int i = 0; i < aifComponentContextsTemp.length; i++) { + if (aifComponentContextsTemp[i].getComponent().getType().equals("JK8MaterialRevision")) { + if (aifComponentContextsTemp[i].getComponent().getProperty("item_id").startsWith("E-")) { + if (aifComponentContextsTemp[i].getComponent().getProperty("release_status_list") != "") { + + num++; + } + } else if (!aifComponentContextsTemp[i].getComponent().getProperty("item_id") + .startsWith("E-")) { + MessageBox.post("ѡϺΪ\"E-\"ͷִд˲", "", MessageBox.ERROR); + return; + } + } + } + if (num == 0) { + MessageBox.post("δת", "", MessageBox.ERROR); + return; + } + // 汾ŵ + int k = 0; + AIFComponentContext[] aifComponentContexts = new AIFComponentContext[num]; + for (int i = 0; i < aifComponentContextsTemp.length; i++) { + if ((aifComponentContextsTemp[i].getComponent().getType().equals("JK8MaterialRevision")) + && (aifComponentContextsTemp[i].getComponent().getProperty("item_id").startsWith("E-")) + && (aifComponentContextsTemp[i].getComponent().getProperty("release_status_list") != "")) { + aifComponentContexts[k] = aifComponentContextsTemp[i]; + if (k < num - 1) { + k++; + } else { + break; + } + } + } + // ȡ°汾(汾ΪABCD) + String revision = ""; + String rev[] = new String[num]; + AIFComponentContext aifComponentContext; + Map map = new HashMap(); + String temp = ""; + for (int i = 0; i < aifComponentContexts.length; i++) { + revision = aifComponentContexts[i].getComponent().getProperty("item_revision_id"); + aifComponentContext = aifComponentContexts[i]; + rev[i] = revision; + map.put(revision, aifComponentContext); + } + boolean isNum=false; + for (int i = 0; i < rev.length; i++) { + temp = rev[0]; +// System.out.println(rev[i]); + try{ + + //Ƚϣ汾01,02,03,04 + if(Integer.valueOf(temp) map = new HashMap(); + String temp = ""; + for (int i = 0; i < aifComponentContexts.length; i++) { + revision = aifComponentContexts[i].getComponent().getProperty("item_revision_id"); + aifComponentContext = aifComponentContexts[i]; + rev[i] = revision; + map.put(revision, aifComponentContext); + } + boolean isNum=false; + for (int i = 0; i < rev.length; i++) { + temp = rev[0]; +// System.out.println(rev[i]); + try{ + + //Ƚϣ汾01,02,03,04 + if(Integer.valueOf(temp) map = new HashMap(); +// String temp = ""; +// for (int i = 0; i < aifComponentContexts.length; i++) { +// revision = aifComponentContexts[i].getComponent().getProperty("item_revision_id"); +// aifComponentContext = aifComponentContexts[i]; +// rev[i] = revision; +// map.put(revision, aifComponentContext); +// } +// boolean isNum=false; +// for (int i = 0; i < rev.length; i++) { +// temp = rev[0]; +//// System.out.println(rev[i]); +// try{ +// +// //Ƚϣ汾01,02,03,04 +// if(Integer.valueOf(temp) childRevList;//봴JListй + + public E_U8ToU8_Operation(AbstractAIFApplication app2, AIFComponentContext aif, InterfaceAIFComponent targetComp, + TCSession session2) { + this.app = app2; + this.targetComp = targetComp; + this.aif = aif; + this.session = session2; + } + + private String itemId;// ʽϵID + private String itemRev;// ʽϵİ汾 + private String itemName;// ʽϵ + + private TCComponentItemRevision itemRevision;// ʽϵİ汾 + + private TCComponentItemRevision rev; + private TCComponentBOMViewRevision bomViewRevision; + private AIFComponentContext[] Context2; + String class_id ; + Integer[] keys = null; + String[] vals = null; + String url=""; + String[] propertyValue=null; + String[] properties=null; + String[] values=null; + @Override + public void executeOperation() throws Exception { + service=session.getPreferenceService(); + url= service.getStringValue("Autocode_SendClassServer_URL"); + // TODO + // 1.ȡѷ°汾ķ + class_id = ((TCComponent) aif.getComponent()).getClassificationClass(); + if(class_id==""){ + MessageBox.post("δִ࣬д˲", "", MessageBox.ERROR); + return; + } +// int a=1; +// target = (TCComponentItem) targetComp; + // TODO ѡ +// service = session.getPreferenceService(); + // String class_id=service.getStringValue(""); + if (aif.getComponent() instanceof TCComponentItemRevision) { + rev = (TCComponentItemRevision) aif.getComponent(); + + +// AIFComponentd + // object_name + props = rev.getTCProperties(new String[] { "object_name" }); + itemName = props[0].getStringValue(); + + // ID + props = rev.getTCProperties(new String[] { "item_id" }); + itemId = props[0].getStringValue().substring(2); + + } + + //ֻתһ汾 + TCComponentItem newitem =null; + TCComponentItemRevision newrev=null; + boolean isExist=false; + try { + //ӦȲѯһ¿ǷѾitemû½оֱӻȡ + newitem = rev.saveAsItem(itemId, null); + newrev = newitem.getLatestItemRevision();//°汾 + + } catch (Exception e1) { +// e1.printStackTrace(); +// MessageBox.post(e1.getMessage()+"\nϿѾΪU8,ϵͳ޸U8ϴڡ","",MessageBox.ERROR); +// return; + TCComponent[] u8item=session.search("...", new String[] {" ID"}, new String[] {itemId}); + //ҪѾɵu8bomǷѾ + if(((TCComponentItem) u8item[0]).getLatestItemRevision().getProperty("release_status_list").length()>0) { + + newrev=((TCComponentItem) u8item[0]).getLatestItemRevision().saveAs(((TCComponentItem) u8item[0]).getNewRev()); + isExist=true; + }else { + MessageBox.post("ѾΪU8,U8°Ƿ񷢲","",MessageBox.ERROR); + return; + } + + } + +// //2017.10.16汾 +// TCComponentItem newitem=null; +// boolean isExists=false; +// try { +// //ӦȲѯһ¿ǷѾitemû½оֱӻȡ +// TCComponent[] components=session.search("...", new String[] {" ID"}, new String[] {itemId}); +// if(components.length>0) { +// newitem=(TCComponentItem)components[0]; +// isExists=true; +// }else if(components.length==0) { +// isExists=false; +// newitem = rev.saveAsItem(itemId, null); +// } +// +// } catch (Exception e1) { +// e1.printStackTrace(); +// MessageBox.post(e1.getMessage()+"\nϿѾΪU8,ϵͳ޸U8ϴڡ","",MessageBox.ERROR); +// return; +// } +// TCComponentItemRevision newrev = null; +// if(isExists==false) { +// newrev = newitem.getLatestItemRevision();//°汾 +// }else { +// newrev = newitem.getLatestItemRevision();//°汾 +// } + // newstuffļ + if(isExist==false) { + + TCComponentUser user = this.session.getUser(); + TCComponentFolder newStuff = user.getNewStuffFolder(); + newStuff.add("contents", newitem); + } + + + propertyValue=service.getStringValues("jk_prop_value");//ַ֧͵Ըֵ + TCComponentForm form1=(TCComponentForm) rev.getReferenceListProperty("IMAN_master_form_rev")[0]; + TCComponentForm form2=(TCComponentForm) newrev.getReferenceListProperty("IMAN_master_form_rev")[0]; + for(int i=0;i"+keys[count1]); + vals[count1] = cPropS[j].getValue(); + System.out.println("vals["+count1+"]================>"+vals[count1]); + count1++; + } + break; + } +// if(a==1){ +// return; +// } + // TODO 2.,°汾͵ + // class_id = "";// TODO дѡ + try { +// createICS(class_id, newrev, newrev.getTCProperty("item_id").getStringValue(), keys, vals); + sendObjToClassficationByWebService(newrev,keys,vals); + } catch (Exception e) { + MessageBox.post("ʧ","",MessageBox.ERROR); + e.printStackTrace(); + return; + } + + if(isSucceed==false) { + MessageBox.post("ʧ","",MessageBox.ERROR); + return; + } + + + + MessageBox.post(""+itemId+"ɹ\nNewStuffļ", "ɹ", MessageBox.INFORMATION); + + } + + // ϰ汾͵ + public void createICS(String class_id, TCComponentItemRevision target, String partid, Integer[] integers, + String[] vals) throws TCException { + TCClassificationService myService = session.getClassificationService(); + ICSApplicationObject icsAppObj = myService.newICSApplicationObject("ICM"); + icsAppObj.create(partid, target.getUid()); + icsAppObj.setView(class_id); +// // ɾʱ +// rev = (TCComponentItemRevision) aif.getComponent(); +// TCComponentICO[] ico = rev.getClassificationObjects(); +// for (int i = 0; i < ico.length; i++) { +// ico[0].delete(); +// } + ICSProperty icspro[] = new ICSProperty[integers.length]; + + for (int i = 0; i < icspro.length; i++) { + System.out.println(" CLASS ID = " + integers[i] + " =" + vals[i]); + icspro[i] = new ICSProperty(integers[i], vals[i]); + } + icsAppObj.setProperties(icspro); +// icsAppObj.save();TODO ʲôã + } + + + + public TCComponentBOMLine getTopLineByRev(TCComponentItemRevision rev) {//öbomline + try { + TCTypeService service = session.getTypeService(); + TCComponentBOMWindowType winType = (TCComponentBOMWindowType) service + .getTypeComponent("BOMWindow"); + window = winType.create(null); + line = window.setWindowTopLine(rev.getItem(), rev, null, null); +// window.close();//رգᵼBOMռãBOMİ汾ɾTC + } catch (TCException e) { + e.printStackTrace(); + } + + return line; + } + public TCComponentBOMLine getTopLineByRev2(TCComponentItemRevision rev,TCComponentBOMWindow window) {//öbomline + try { + TCTypeService service = session.getTypeService(); + TCComponentBOMWindowType winType = (TCComponentBOMWindowType) service + .getTypeComponent("BOMWindow"); + window = winType.create(null); + line = window.setWindowTopLine(rev.getItem(), rev, null, null); +// window.close();//رգᵼBOMռãBOMİ汾ɾTC + } catch (TCException e) { + e.printStackTrace(); + } + + return line; + } + + private void setbom(TCComponentBOMLine line ,TCComponentItemRevision rev) {//bom + + try { +// setGlxq(rev); +// System.out.println("lineddd=" + line.toString()); + AIFComponentContext[] lins = line.getChildren(); + if (lins == null || lins.length <= 0) { + return; + } + for (AIFComponentContext l : lins) { + TCComponent lt = (TCComponent) l.getComponent(); + //bl_substitute_listԣб + String bl_substitute_list=((TCComponentBOMLine) lt).getProperty("bl_substitute_list"); + System.out.println("bl_substitute_list---->"+bl_substitute_list); + String[] substitute_list=bl_substitute_list.split(","); + System.out.println("bl_substitute_list=========>"+substitute_list.length); + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------1----------"+substitute_list[i]); + } + TCProperty[] tcs = ((TCComponentBOMLine) lt) + .getTCProperties(new String[] { + "bl_quantity","bl_sequence_no", +// "jk8SubstitRatio", "jk8SubstitOrder","jk8EffectiveDate","jk8SubCompLossRate",//治˻ȡ +// "bl_item_uom_tag","jk8TechnicModel","jk8SpecificModel",// + "JK8Remark","JK8SupplyType","JK8Warehouse", + "JK8RemarkDesc","jk8SubCompLossRate" + + });//ֿ⡢Ӧͣbl_substituteȣjk8SubstitRatiojk8SubstitOrderЧڣjk8EffectiveDate + line.lock(); + line.remove("", lt); + +// TCComponentItem chitem = ((TCComponentBOMLine) lt).getItem() +// .getLatestItemRevision().saveAsItem(null, null); +// TCComponentItemRevision r = chitem.getLatestItemRevision(); +// TCComponentItemRevision r=((TCComponentBOMLine) lt).getItem().getLatestItemRevision(); + TCComponentItemRevision r=((TCComponentBOMLine) lt).getItemRevision();//BOMLineӦItemRevision + + TCComponentBOMLine childBomLine = line.add(r.getItem(), r, + null, false, ""); + if(substitute_list.length>0&&!bl_substitute_list.trim().equals("")){ + + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------------"+substitute_list[i]+"----------"); + TCComponentItemRevision itemRevision=((TCComponentItem)(session.search(" ID",new String[]{ " ID"}, new String[]{substitute_list[i].trim()})[0])).getLatestItemRevision(); + childBomLine.add(null, itemRevision, null, true); + } + } + childBomLine.setTCProperties(tcs); + + setbom(childBomLine,r); + line.save(); + line.unlock(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + + private void setbom2(TCComponentBOMLine line ,TCComponentBOMLine lineOld,int mark) {//bom + + if (mark == 0) { + try { + AIFComponentContext[] lins = line.getChildren(); + if (lins == null || lins.length <= 0) { + return; + } + // ɾӼbomline + for (AIFComponentContext l : lins) { + TCComponent lt = (TCComponent) l.getComponent(); + + line.lock(); + line.remove("", lt); + line.save(); + line.unlock(); + } + // ٰebomԸƽbomlineӹ + lins = lineOld.getChildren(); + if (lins == null || lins.length <= 0) { + return; + } + for (AIFComponentContext l : lins) { + TCComponent lt = (TCComponent) l.getComponent(); + //bl_substitute_listԣб + String bl_substitute_list=((TCComponentBOMLine) lt).getProperty("bl_substitute_list"); + System.out.println("bl_substitute_list---->"+bl_substitute_list); + String[] substitute_list=bl_substitute_list.split(","); + System.out.println("bl_substitute_list=========>"+substitute_list.length); + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------1----------"+substitute_list[i]); + } + TCProperty[] tcs = ((TCComponentBOMLine) lt) + .getTCProperties(new String[] { + "bl_quantity","bl_sequence_no", + "JK8Remark","JK8SupplyType","JK8Warehouse", + "JK8RemarkDesc","jk8SubCompLossRate" + + });//ֿ⡢Ӧͣbl_substituteȣjk8SubstitRatiojk8SubstitOrderЧڣjk8EffectiveDate + line.lock(); + + + TCComponentItemRevision r=((TCComponentBOMLine) lt).getItemRevision();//BOMLineӦItemRevision + + TCComponentBOMLine childBomLine = line.add(r.getItem(), r, + null, false, ""); + if(substitute_list.length>0&&!bl_substitute_list.trim().equals("")){ + + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------------"+substitute_list[i]+"----------"); + TCComponentItemRevision itemRevision=((TCComponentItem)(session.search(" ID",new String[]{ " ID"}, new String[]{substitute_list[i].trim()})[0])).getLatestItemRevision(); + childBomLine.add(null, itemRevision, null, true); + } + } + childBomLine.setTCProperties(tcs); + +// setbom2(childBomLine,r,1); + line.save(); + line.unlock(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + /*try { + AIFComponentContext[] lins = line.getChildren(); + if (lins == null || lins.length <= 0) { + return; + } + for (AIFComponentContext l : lins) { + TCComponent lt = (TCComponent) l.getComponent(); + //bl_substitute_listԣб + String bl_substitute_list=((TCComponentBOMLine) lt).getProperty("bl_substitute_list"); + System.out.println("bl_substitute_list---->"+bl_substitute_list); + String[] substitute_list=bl_substitute_list.split(","); + System.out.println("bl_substitute_list=========>"+substitute_list.length); + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------1----------"+substitute_list[i]); + } + TCProperty[] tcs = ((TCComponentBOMLine) lt) + .getTCProperties(new String[] { + "bl_quantity","bl_sequence_no", + "JK8Remark","JK8SupplyType","JK8Warehouse", + "JK8RemarkDesc","jk8SubCompLossRate" + + });//ֿ⡢Ӧͣbl_substituteȣjk8SubstitRatiojk8SubstitOrderЧڣjk8EffectiveDate + line.lock(); + line.remove("", lt); + + + TCComponentItemRevision r=((TCComponentBOMLine) lt).getItemRevision();//BOMLineӦItemRevision + + TCComponentBOMLine childBomLine = line.add(r.getItem(), r, + null, false, ""); + if(substitute_list.length>0&&!bl_substitute_list.trim().equals("")){ + + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------------"+substitute_list[i]+"----------"); + TCComponentItemRevision itemRevision=((TCComponentItem)(session.search(" ID",new String[]{ " ID"}, new String[]{substitute_list[i].trim()})[0])).getLatestItemRevision(); + childBomLine.add(null, itemRevision, null, true); + } + } + childBomLine.setTCProperties(tcs); + + setbom2(childBomLine,r,1); + line.save(); + line.unlock(); + } + } catch (Exception e) { + e.printStackTrace(); + }*/ + } + //͵ class_id=codeRemarkˮ룿 + boolean isSucceed=true; + public void sendObjToClassficationByWebService(TCComponentItemRevision rev,Integer[] keys, + String[] vals){ + try { + System.out.println("class_id-----dddddd----->"+class_id); + if( !class_id.replace(" ", "").equals("") ){ + + List propList = new ArrayList<>(); + for(int i = 0; i < keys.length; i++){ + ClassProperty prop = new ClassProperty(keys[i], vals[i]);// + propList.add(prop); + } + String json = SoaServerUtil.objectToJson(propList);//JavaתΪjson + SoaServerUtil.grantWritePrivilege(session, rev);//дȨ + SoaServerUtil.sendToClass(rev.getUid(), class_id, json,url);//͵ + + SoaServerUtil.grantReadPrivilege(session, rev);//Ȩ + } + + } catch (Exception e) { + isSucceed=false; + e.printStackTrace(); + } + + } + +} diff --git a/src/com/connor/jk/plm/E_U8ToU8/SoaServerUtil.java b/src/com/connor/jk/plm/E_U8ToU8/SoaServerUtil.java new file mode 100644 index 0000000..5de57c6 --- /dev/null +++ b/src/com/connor/jk/plm/E_U8ToU8/SoaServerUtil.java @@ -0,0 +1,227 @@ +package com.connor.jk.plm.E_U8ToU8; + +import java.util.ArrayList; +import java.util.List; + +import net.sf.json.JSONArray; + +import org.apache.axiom.om.OMAbstractFactory; +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.OMFactory; +import org.apache.axiom.om.OMNamespace; +import org.apache.axis2.AxisFault; +import org.apache.axis2.addressing.EndpointReference; +import org.apache.axis2.client.Options; +import org.apache.axis2.client.ServiceClient; +import org.apache.axis2.transport.http.HTTPConstants; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCAccessControlService; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCComponentUser; +import com.teamcenter.rac.kernel.TCComponentUserType; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.kernel.TCUserService; + +public class SoaServerUtil { + + public static void sendToClass(String wsoPUID, String classID, String json, String url) { + // AbstractAIFApplication app; + // app=AIFUtility.getCurrentApplication(); + // TCSession session; + // session=(TCSession) app.getSession(); + // TCPreferenceService preferenceService; + // preferenceService=session.getPreferenceService(); + // String account=preferenceService.getStringValue("Autocode_PriverUser_ID"); + // String url; + // url = preferenceService.getStringValue("Autocode_SendClassServer_URL"); + try { + ServiceClient sc = new ServiceClient(); + Options opts = new Options(); + // url = "http://10.201.5.203:19090/ErpWebService.asmx?WSDL"; + EndpointReference end = new EndpointReference(url); + opts.setTo(end); + opts.setAction("SendToClass"); + sc.setOptions(opts); + + OMFactory fac = OMAbstractFactory.getOMFactory(); + OMNamespace omNs = fac.createOMNamespace("http://tempuri.org/", ""); + OMElement method = fac.createOMElement("SendToClass", omNs); + OMElement value = fac.createOMElement("wsoPuiid", omNs); + value.setText(wsoPUID); + OMElement value1 = fac.createOMElement("classID", omNs); + value1.setText(classID); + OMElement value2 = fac.createOMElement("JsonContainer", omNs); + // "[{\"value\":\"1\",\"propertyID\":-500003},{\"value\":\"1\",\"propertyID\":-500011}]" + value2.setText(json); + + method.addChild(value); + method.addChild(value1); + method.addChild(value2); + + OMElement res = sc.sendReceive(method); + res.getFirstElement().getText(); + System.out.println(res.getFirstElement().getText()); + } catch (AxisFault e) { + e.printStackTrace(); + } + + } + + // public static void main(String[] args) { + // deleteClass("1111", ""); + // } + // ɾʱ + public static void deleteClass(String icoPUID, String url) { + try { + ServiceClient sc = new ServiceClient(); + Options opts = new Options(); + // url = "http://10.201.5.203:19090/ErpWebService.asmx?WSDL";//TODO + // ѡAutocode_SendClassServer_URL + // url = preferenceService.getStringValue("Autocode_SendClassServer_URL");//TODO + // ѡAutocode_SendClassServer_URL + EndpointReference end = new EndpointReference(url); + opts.setTo(end); + opts.setAction("DeleteClass"); + opts.setProperty(HTTPConstants.CHUNKED, "false"); + sc.setOptions(opts); + + OMFactory fac = OMAbstractFactory.getOMFactory(); + OMNamespace omNs = fac.createOMNamespace("http://tempuri.org/", ""); + OMElement method = fac.createOMElement("DeleteClass", omNs); + OMElement value = fac.createOMElement("icoPuid", omNs); + value.setText(icoPUID); + // OMElement value1 = fac.createOMElement("classID", omNs); + //// value1.setText(classID); + // OMElement value2 = fac.createOMElement("JsonContainer", omNs); + // "[{\"value\":\"1\",\"propertyID\":-500003},{\"value\":\"1\",\"propertyID\":-500011}]" + // value2.setText(json); + + method.addChild(value); + // method.addChild(value1); + // method.addChild(value2); + + OMElement res = sc.sendReceive(method); + res.getFirstElement().getText(); + System.out.println(res.getFirstElement().getText()); + } catch (AxisFault e) { + e.printStackTrace(); + } + + } + + public static String objectToJson(List props) { + String str = null; + try { + JSONArray json = JSONArray.fromObject(props);// javaתΪjson + str = json.toString();// jsonתΪַ + } catch (Exception e) { + e.printStackTrace(); + } + System.out.println("JSON =>" + str); + return str; + } + + public static void grantReadPrivilege(TCSession tcSession, TCComponent tccomponent) { + AbstractAIFApplication app; + app = AIFUtility.getCurrentApplication(); + TCSession session; + session = (TCSession) app.getSession(); + TCPreferenceService preferenceService; + preferenceService = session.getPreferenceService(); + String account = preferenceService.getStringValue("Autocode_PriverUser_ID"); + try { + TCAccessControlService accessControlService = tcSession.getTCAccessControlService(); + TCComponentUserType type = (TCComponentUserType) tcSession.getTypeComponent("User"); + TCComponentUser user = type.find(account); + + if (user == null) { + return; + } + if (tcSession.getUser().equals(user)) { + return; + } + + String[] as2 = new String[] { "READ" }; + + if (tccomponent instanceof TCComponentItemRevision) { + TCComponentItem tempItem = ((TCComponentItemRevision) tccomponent).getItem(); + openByPass(tcSession); + accessControlService.grantPrivilege(tempItem, user, as2); + closeByPass(tcSession); + + openByPass(tcSession); + accessControlService.grantPrivilege(tccomponent, user, as2); + closeByPass(tcSession); + } else { + openByPass(tcSession); + accessControlService.grantPrivilege(tccomponent, user, as2); + closeByPass(tcSession); + } + } catch (TCException e) { + e.printStackTrace(); + } + } + + public static void grantWritePrivilege(TCSession tcSession, TCComponent tccomponent) { + AbstractAIFApplication app; + app = AIFUtility.getCurrentApplication(); + TCSession session; + session = (TCSession) app.getSession(); + TCPreferenceService preferenceService; + preferenceService = session.getPreferenceService(); + String account = preferenceService.getStringValue("Autocode_PriverUser_ID"); + try { + TCAccessControlService accessControlService = tcSession.getTCAccessControlService(); + TCComponentUserType type = (TCComponentUserType) tcSession.getTypeComponent("User"); + + TCComponentUser user = type.find(account); + if (user == null) { + return; + } + if (tcSession.getUser().equals(user)) { + return; + } + + String[] as2 = new String[] { "READ", "WRITE", "DELETE" }; + + if (tccomponent instanceof TCComponentItemRevision) { + TCComponentItem tempItem = ((TCComponentItemRevision) tccomponent).getItem(); + openByPass(tcSession); + accessControlService.grantPrivilege(tempItem, user, as2); + closeByPass(tcSession); + + openByPass(tcSession); + accessControlService.grantPrivilege(tccomponent, user, as2); + closeByPass(tcSession); + } else { + openByPass(tcSession); + accessControlService.grantPrivilege(tccomponent, user, as2); + closeByPass(tcSession); + } + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public static void openByPass(TCSession session) throws TCException { + TCUserService userservice = session.getUserService(); + Object[] obj = new Object[1]; + obj[0] = "origin"; + userservice.call("ORIGIN_set_bypass", obj); + } + + public static void closeByPass(TCSession session) throws TCException { + TCUserService userservice = session.getUserService(); + Object[] obj = new Object[1]; + obj[0] = "origin"; + userservice.call("ORIGIN_close_bypass", obj); + } + +} diff --git a/src/com/connor/jk/plm/EdaBomline/BomlineBean.java b/src/com/connor/jk/plm/EdaBomline/BomlineBean.java new file mode 100644 index 0000000..b21ac3f --- /dev/null +++ b/src/com/connor/jk/plm/EdaBomline/BomlineBean.java @@ -0,0 +1,118 @@ +package com.connor.jk.plm.EdaBomline; + +import java.util.List; + +import com.teamcenter.rac.kernel.TCComponent; + +public class BomlineBean { + private String lev;// 㼶 + private String id;// id + private String revid;// 汾 + private String name;// + private String sulines;// б + private String tdsx;// ˳ + private String sxsj;// Чʱ + private String tdbl;// + private String allsulines;// ȫб + + private List allTccoms; + private List suTccoms; + + public String getLev() { + return lev; + } + + public void setLev(String lev) { + this.lev = lev; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getRevid() { + return revid; + } + + public void setRevid(String revid) { + this.revid = revid; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getSulines() { + return sulines; + } + + public void setSulines(String sulines) { + this.sulines = sulines; + } + + public String getTdsx() { + return tdsx; + } + + public void setTdsx(String tdsx) { + this.tdsx = tdsx; + } + + public String getSxsj() { + return sxsj; + } + + public void setSxsj(String sxsj) { + this.sxsj = sxsj; + } + + public String getTdbl() { + return tdbl; + } + + public void setTdbl(String tdbl) { + this.tdbl = tdbl; + } + + public String getAllsulines() { + return allsulines; + } + + public void setAllsulines(String allsulines) { + this.allsulines = allsulines; + } + + + public List getAllTccoms() { + return allTccoms; + } + + public void setAllTccoms(List allTccoms) { + this.allTccoms = allTccoms; + } + + public List getSuTccoms() { + return suTccoms; + } + + public void setSuTccoms(List suTccoms) { + this.suTccoms = suTccoms; + } + + @Override + public String toString() { + return "BomlineBean [lev=" + lev + ", id=" + id + ", revid=" + revid + + ", name=" + name + ", sulines=" + sulines + ", tdsx=" + tdsx + + ", sxsj=" + sxsj + ", tdbl=" + tdbl + ", allsulines=" + + allsulines + "]"; + } + +} diff --git a/src/com/connor/jk/plm/EdaBomline/EdaBomline_Action.java b/src/com/connor/jk/plm/EdaBomline/EdaBomline_Action.java new file mode 100644 index 0000000..e2a10d3 --- /dev/null +++ b/src/com/connor/jk/plm/EdaBomline/EdaBomline_Action.java @@ -0,0 +1,103 @@ +package com.connor.jk.plm.EdaBomline; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.common.actions.AbstractAIFAction; +import com.teamcenter.rac.aif.kernel.AIFComponentContext; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentBOMLine; +import com.teamcenter.rac.kernel.TCComponentBOMViewRevision; +import com.teamcenter.rac.kernel.TCComponentBOMWindow; +import com.teamcenter.rac.kernel.TCComponentBOMWindowType; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class EdaBomline_Action extends AbstractAIFAction { + private AbstractAIFApplication app; + private InterfaceAIFComponent targetComp; + private TCSession session; + + public EdaBomline_Action(AbstractAIFApplication arg0, String arg1) { + super(arg0, arg1); + // TODO Auto-generated constructor stub + this.app = arg0; + this.session = (TCSession) app.getSession(); + this.targetComp = app.getTargetComponent(); + } + + @Override + public void run() { + // TODO Auto-generated method stub + if (targetComp == null) { + MessageBox.post("ѡͼ汾ڽṹѡжBOMLineٽв!!", "", + MessageBox.ERROR); + return; + } + + System.out.println(targetComp.getType()); + TCComponentBOMLine topline = null; + if (targetComp instanceof TCComponentBOMViewRevision) { + try { + TCComponent comp = (TCComponent) targetComp; + AIFComponentContext[] context = comp.whereReferenced(); + TCComponentItemRevision rev = null; + for (int i = 0; i < context.length; i++) { + System.out.println("i:" + i); + if (context[i].getComponent() instanceof TCComponentItemRevision) { + rev = (TCComponentItemRevision) context[i] + .getComponent(); + break; + } + } + + TCComponentBOMWindowType type = (TCComponentBOMWindowType) session + .getTypeComponent("BOMWindow"); + TCComponentBOMWindow win = type.create(null); + topline = win.setWindowTopLine(rev.getItem(), rev, null, null); + EdaBomline_Command com = new EdaBomline_Command(topline, + session); + try { + com.executeModal(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } catch (Exception e) { + e.printStackTrace(); + } + + } else if (targetComp instanceof TCComponentBOMLine) { + + System.out.println("bingo"); + try { + if (((TCComponentBOMLine) targetComp) + .getTCProperty("bl_formatted_parent_name") + .getStringValue().equals("")) { + System.out.println("bingooooooo"); + } else { + MessageBox.post("ѡжBOMLineٵ", "", + MessageBox.INFORMATION); + return; + } + } catch (TCException e) { + e.printStackTrace(); + } + EdaBomline_Command com = new EdaBomline_Command((TCComponentBOMLine)targetComp, session); + try { + com.executeModal(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } else { + MessageBox.post("ǰѡе" + targetComp.getType() + + ",ѡͼ汾ڽṹѡжBOMLineٽв", "", + MessageBox.INFORMATION); + return; + } + + } + +} diff --git a/src/com/connor/jk/plm/EdaBomline/EdaBomline_Command.java b/src/com/connor/jk/plm/EdaBomline/EdaBomline_Command.java new file mode 100644 index 0000000..7b84847 --- /dev/null +++ b/src/com/connor/jk/plm/EdaBomline/EdaBomline_Command.java @@ -0,0 +1,39 @@ +package com.connor.jk.plm.EdaBomline; + +import com.teamcenter.rac.aif.AIFDesktop; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.AbstractAIFCommand; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentBOMLine; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCComponentItemType; +import com.teamcenter.rac.kernel.TCSession; + +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.Registry; + +public class EdaBomline_Command extends AbstractAIFCommand { + + private InterfaceAIFComponent targetComp; + private TCSession session; + + public EdaBomline_Command(TCComponentBOMLine line, TCSession session) { + // TODO Auto-generated constructor stub + this.targetComp = line; + this.session = session; + } + + public void executeModal() throws Exception { + // TODO Auto-generated method stub + super.executeModal(); + + System.out.println("aaa"); + + EdaBomline_Dialog dialog = new EdaBomline_Dialog(targetComp, session); + new Thread(dialog).start(); + + } + +} diff --git a/src/com/connor/jk/plm/EdaBomline/EdaBomline_Dialog.java b/src/com/connor/jk/plm/EdaBomline/EdaBomline_Dialog.java new file mode 100644 index 0000000..d5222f8 --- /dev/null +++ b/src/com/connor/jk/plm/EdaBomline/EdaBomline_Dialog.java @@ -0,0 +1,61 @@ +package com.connor.jk.plm.EdaBomline; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.swing.CellEditor; +import javax.swing.JButton; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.table.DefaultTableModel; +import javax.swing.table.TableColumn; + +import com.connor.jk.plm.setBomline.MyTable; +import com.connor.jk.plm.setBomline.SubstituteBean; +import com.teamcenter.rac.aif.AbstractAIFCommand; +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponentBOMLine; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; + +public class EdaBomline_Dialog extends AbstractAIFDialog { + private InterfaceAIFComponent targetComp; + private TCSession session; + + private TCComponentBOMLine bomline; + + + public EdaBomline_Dialog(InterfaceAIFComponent targetComp, TCSession session) { + this.targetComp = targetComp; + this.session = session; + this.bomline = (TCComponentBOMLine) targetComp; + } + + @Override + public void run() { + // super.run(); + System.out.println("run"); + EdaBomline_Operation op=new EdaBomline_Operation(bomline,session); + try { + op.executeOperation(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + //load(); + //init(); + } + + +} diff --git a/src/com/connor/jk/plm/EdaBomline/EdaBomline_Handler.java b/src/com/connor/jk/plm/EdaBomline/EdaBomline_Handler.java new file mode 100644 index 0000000..eeb4abe --- /dev/null +++ b/src/com/connor/jk/plm/EdaBomline/EdaBomline_Handler.java @@ -0,0 +1,21 @@ +package com.connor.jk.plm.EdaBomline; + +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.aifrcp.AIFUtility; + +public class EdaBomline_Handler extends AbstractHandler { + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + // TODO Auto-generated method stub + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + EdaBomline_Action action=new EdaBomline_Action(app,null); + new Thread(action).start(); + return null; + } + +} diff --git a/src/com/connor/jk/plm/EdaBomline/EdaBomline_Operation.java b/src/com/connor/jk/plm/EdaBomline/EdaBomline_Operation.java new file mode 100644 index 0000000..0d6a80c --- /dev/null +++ b/src/com/connor/jk/plm/EdaBomline/EdaBomline_Operation.java @@ -0,0 +1,385 @@ +package com.connor.jk.plm.EdaBomline; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.swing.JOptionPane; + +import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.Color; +import org.apache.poi.ss.usermodel.Font; +import org.apache.poi.xssf.usermodel.XSSFCell; +import org.apache.poi.xssf.usermodel.XSSFCellStyle; +import org.apache.poi.xssf.usermodel.XSSFFont; +import org.apache.poi.xssf.usermodel.XSSFRow; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + +import com.teamcenter.rac.aif.AbstractAIFOperation; +import com.teamcenter.rac.aif.kernel.AIFComponentContext; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentBOMLine; +import com.teamcenter.rac.kernel.TCComponentDataset; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentTcFile; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.services.internal.rac.structuremanagement.GlobalAlternateService; + +public class EdaBomline_Operation extends AbstractAIFOperation { + + private TCSession session; + private TCComponentBOMLine comp; + private List listbean = new ArrayList(); + private String username; + private String fustr; + private File file; + private XSSFWorkbook wb; + private XSSFSheet sheet; + private int rowlen = 0; + private int strrow = -1; + private int endrow = -1; + private String outpath=""; + private TCComponentDataset dataset; + + public EdaBomline_Operation(TCComponentBOMLine comp, TCSession session) { + // TODO Auto-generated constructor stub + this.session = session; + this.comp = comp; + } + + @Override + public void executeOperation() throws Exception { + // TODO Auto-generated method stub + username = session.getUserName(); + System.out.println("name=" + username); + String id = comp.getTCProperty("bl_item_item_id").getStringValue(); + String rev_id = comp.getTCProperty("bl_rev_item_revision_id") + .getStringValue(); + String name = comp.getTCProperty("bl_item_object_name") + .getStringValue(); + fustr = id + "/" + rev_id + ";" + name; + + file = getfile(); + if (file == null) { + System.out.println("ļ˳"); + return; + } + wb = new XSSFWorkbook(new FileInputStream(file)); + + int sheetlength = wb.getNumberOfSheets(); + + for (int i = 0; i < sheetlength; i++) { + String sheetname = wb.getSheetName(i); + if (username.equals(sheetname)) { + sheet = wb.getSheet(sheetname); + break; + } + } + if (sheet == null) { + sheet = wb.createSheet(username); + } + rowlen = sheet.getLastRowNum(); + if (rowlen > 0) { + + // øbomlineexcelλ + int jl = 0; + int strjl = 0; + for (int i = 0; i < rowlen; i++) { + XSSFRow row = sheet.getRow(i); + String xh = row.getCell(0).getStringCellValue(); + if ("0".equals(xh)) { + jl++; + String fubom = row.getCell(1).getStringCellValue(); + if (fubom.equals(fustr) && strrow < 0) { + strrow = i; + strjl = jl; + } + if (strjl > 0 && jl == (strjl + 1)) { + endrow = i - 1; + } + } + } + if (strrow > 0 && endrow < 0) { + endrow = rowlen; + } + + } + SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss"); + String time=formatter.format(new Date()); + + outpath= System.getenv("TEMP")+ File.separator+"ģ"+time+".xlsx"; + + System.out.println("ʼbomline"); + getchline(comp, 0); + + if (listbean != null && listbean.size() > 0) { + try { + if (rowlen == 0) { + XSSFFont font = wb.createFont(); + font.setFontName(""); + font.setFontHeightInPoints((short) 11);// С + font.setBold(true);// ô + XSSFCellStyle sty = wb.createCellStyle(); + sty.setFont(font); + XSSFRow row = sheet.createRow(0); + for (int i = 0; i < 7; i++) { + XSSFCell cell = row.createCell(i); + cell.setCellStyle(sty); + } + row.getCell(0).setCellValue(""); + row.getCell(1).setCellValue("BOM "); + row.getCell(2).setCellValue("б"); + row.getCell(3).setCellValue(""); + row.getCell(4).setCellValue(""); + row.getCell(5).setCellValue("Ч"); + row.getCell(6).setCellValue("ȫֱѡб"); + + XSSFRow row1 = sheet.createRow(1); + XSSFCell cell = row1.createCell(0); + XSSFCell cell2 = row1.createCell(1); + cell.setCellStyle(wb.createCellStyle()); + cell2.setCellStyle(wb.createCellStyle()); + row1.getCell(0).setCellValue("0"); // öbomline + row1.getCell(1).setCellValue(fustr); // öbomline + + for (int r = 0; r < listbean.size(); r++) { + XSSFRow row_r = sheet.createRow(r + 2); + for (int i = 0; i < 7; i++) { + XSSFCell cell_a = row_r.createCell(i); + cell_a.setCellStyle(wb.createCellStyle()); + } + row_r.getCell(0).setCellValue(listbean.get(r).getLev()); + row_r.getCell(1).setCellValue( + listbean.get(r).getId() + "/" + + listbean.get(r).getRevid()); + row_r.getCell(2).setCellValue( + listbean.get(r).getSulines()); + row_r.getCell(3) + .setCellValue(listbean.get(r).getTdbl()); + row_r.getCell(4) + .setCellValue(listbean.get(r).getTdsx()); + row_r.getCell(5) + .setCellValue(listbean.get(r).getSxsj()); + row_r.getCell(6).setCellValue( + listbean.get(r).getAllsulines()); + } + + } else if (strrow > 0) { + for (int i = endrow; i > strrow-1; i--) { + sheet.removeRow(sheet.getRow(i)); + } + + int larow = sheet.getLastRowNum(); + XSSFRow row1 = sheet.createRow(larow+1); + XSSFCell cell = row1.createCell(0); + XSSFCell cell2 = row1.createCell(1); + cell.setCellStyle(wb.createCellStyle()); + cell2.setCellStyle(wb.createCellStyle()); + row1.getCell(0).setCellValue("0"); // öbomline + row1.getCell(1).setCellValue(fustr); // öbomline + + for (int r = 0; r < listbean.size(); r++) { + XSSFRow row_r = sheet.createRow(r + larow+2); + for (int i = 0; i < 7; i++) { + XSSFCell cell_a = row_r.createCell(i); + cell_a.setCellStyle(wb.createCellStyle()); + } + row_r.getCell(0).setCellValue(listbean.get(r).getLev()); + row_r.getCell(1).setCellValue( + listbean.get(r).getId() + "/" + + listbean.get(r).getRevid()); + row_r.getCell(2).setCellValue( + listbean.get(r).getSulines()); + row_r.getCell(3) + .setCellValue(listbean.get(r).getTdbl()); + row_r.getCell(4) + .setCellValue(listbean.get(r).getTdsx()); + row_r.getCell(5) + .setCellValue(listbean.get(r).getSxsj()); + row_r.getCell(6).setCellValue( + listbean.get(r).getAllsulines()); + } + } + FileOutputStream fileOut = new FileOutputStream(outpath); + System.out.println(outpath); + wb.write(fileOut); + + dataset.setFiles(new String[] {outpath}, new String[] {"excel"});//ֱ滻ݼ + + + MessageBox.post("ȡϢɹEDAģв鿴", "ʾ", + MessageBox.INFORMATION); + } catch (Exception e) { + // TODO: handle exception + e.printStackTrace(); + MessageBox.post(":" + e.getMessage(), "", + MessageBox.ERROR); + } + + } else { + MessageBox.post("BOMϢ,ȡ", "ʾ", MessageBox.INFORMATION); + } + + } + + private File getfile() { + // TODO Auto-generated method stub + TCPreferenceService pref = session.getPreferenceService(); + String puid = pref.getStringValue("JK_EDA_Dataset_Puid");// ѡpuid + // txVld3uJYvbLjA + if (puid != null) { + try { + dataset = (TCComponentDataset) session + .stringToComponent(puid); + if (dataset == null) { + MessageBox.post("ûҵݼ,!", "WARNING", + MessageBox.WARNING); + return null; + } + TCComponentTcFile[] files = dataset.getTcFiles(); + if (files.length == 0 || files.length != 1) { + MessageBox.post("ݼûõļļ࣬飡", "WARNING", + MessageBox.WARNING); + } else { + File fmsFile = files[0].getFmsFile(); + return fmsFile; + } + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } else { + MessageBox.post("δҵѡ[JK_EDA_Dataset_Puid]ѡô", "", + MessageBox.ERROR); + return null; + } + return null; + + } + + public void getchline(TCComponentBOMLine line, int lev) { + // TODO Auto-generated method stub + try { + lev++; + AIFComponentContext[] chlines = line.getChildren(); + if (chlines != null && chlines.length > 0) { + for (int i = 0; i < chlines.length; i++) { + TCComponentBOMLine chline = (TCComponentBOMLine) chlines[i] + .getComponent(); + TCComponentBOMLine[] sulines = chline.listSubstitutes(); + TCComponent[] glitems = chline.getItem() + .getTCProperty("global_alt_list") + .getReferenceValueArray(); + TCComponentItem[] glits; + if ((sulines == null || sulines.length <= 0) + && (glitems == null || glitems.length <= 0)) { + System.out.println("ֲȫֱѡ"); + + } else { + + String sustrs = ""; + String glstrs = ""; + if (sulines.length > 0) { + for (TCComponentBOMLine suline : sulines) { + String suid = suline.getTCProperty( + "bl_item_item_id").getStringValue(); + if (sustrs.equals("")) { + sustrs = sustrs + suid; + } else { + sustrs = sustrs + "," + suid; + } + suline.cut();// ɾ + } + } + if (glitems.length > 0) { + glits = new TCComponentItem[glitems.length]; + for (int glen = 0; glen < glitems.length; glen++) { + glits[glen] = (TCComponentItem) glitems[glen]; + String glid = glitems[glen].getTCProperty( + "item_id").getStringValue(); + if (glstrs.equals("")) { + glstrs = glstrs + glid; + } else { + glstrs = glstrs + ","; + glstrs = glstrs + glid; + } + + } + removeGlobalAlternates(chline.getItem(), glits); + } + + BomlineBean bean = new BomlineBean(); + + String id = chline.getTCProperty("bl_item_item_id") + .getStringValue(); + String rev_id = chline.getTCProperty( + "bl_rev_item_revision_id").getStringValue(); + String name = chline.getTCProperty( + "bl_item_object_name").getStringValue(); + String leven = "" + lev; // 㼶 + String tdsx = chline.getTCProperty("JK8SubstitOrder") + .getStringValue();// ˳ + String sxsj = chline.getTCProperty("JK8EffectiveDate") + .getStringValue();// Чʱ + String tdbl = chline.getTCProperty("JK8SubstitRatio") + .getStringValue();// + + bean.setId(id); + bean.setRevid(rev_id); + bean.setName(name); + bean.setLev(leven); + bean.setSulines(sustrs); + bean.setAllsulines(glstrs); + bean.setSxsj(sxsj); + bean.setTdbl(tdbl); + bean.setTdsx(tdsx); + listbean.add(bean); + System.out.println(bean); + chline.getTCProperty("JK8SubstitOrder").setStringValue( + "");// ˳Чʱ + chline.getTCProperty("JK8EffectiveDate") + .setStringValue(""); + chline.getTCProperty("JK8SubstitRatio").setStringValue( + ""); + + } + getchline(chline, lev); + } + + } + + } catch (TCException e) { + // TODO Auto-generated catch block + + e.printStackTrace(); + MessageBox.post(":" + e.getMessage(), "", MessageBox.ERROR); + } + } + + // Ƴȫ + public void removeGlobalAlternates(TCComponentItem item, + TCComponentItem[] items) { + System.out.println("removeGlobalAlternates"); + + com.teamcenter.services.internal.rac.structuremanagement._2007_06.GlobalAlternate.GlobalAlternateListInput localGlobalAlternateListInput = new com.teamcenter.services.internal.rac.structuremanagement._2007_06.GlobalAlternate.GlobalAlternateListInput(); + localGlobalAlternateListInput.item = item; + localGlobalAlternateListInput.gAltItems = items; + com.teamcenter.services.internal.rac.structuremanagement._2007_06.GlobalAlternate.GlobalAlternateListInput[] arrayOfGlobalAlternateListInput = new com.teamcenter.services.internal.rac.structuremanagement._2007_06.GlobalAlternate.GlobalAlternateListInput[1]; + arrayOfGlobalAlternateListInput[0] = localGlobalAlternateListInput; + GlobalAlternateService localGlobalAlternateService = GlobalAlternateService + .getService(this.session); + com.teamcenter.services.internal.rac.structuremanagement._2007_06.GlobalAlternate.GlobalAlternateResponse localGlobalAlternateResponse = localGlobalAlternateService + .removeRelatedGlobalAlternates(arrayOfGlobalAlternateListInput); + + } + +} diff --git a/src/com/connor/jk/plm/EdaBomline/EdaInBomline_Action.java b/src/com/connor/jk/plm/EdaBomline/EdaInBomline_Action.java new file mode 100644 index 0000000..8ae4f05 --- /dev/null +++ b/src/com/connor/jk/plm/EdaBomline/EdaInBomline_Action.java @@ -0,0 +1,103 @@ +package com.connor.jk.plm.EdaBomline; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.common.actions.AbstractAIFAction; +import com.teamcenter.rac.aif.kernel.AIFComponentContext; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentBOMLine; +import com.teamcenter.rac.kernel.TCComponentBOMViewRevision; +import com.teamcenter.rac.kernel.TCComponentBOMWindow; +import com.teamcenter.rac.kernel.TCComponentBOMWindowType; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class EdaInBomline_Action extends AbstractAIFAction { + private AbstractAIFApplication app; + private InterfaceAIFComponent targetComp; + private TCSession session; + + public EdaInBomline_Action(AbstractAIFApplication arg0, String arg1) { + super(arg0, arg1); + // TODO Auto-generated constructor stub + this.app = arg0; + this.session = (TCSession) app.getSession(); + this.targetComp = app.getTargetComponent(); + } + + @Override + public void run() { + // TODO Auto-generated method stub + if (targetComp == null) { + MessageBox.post("ѡͼ汾ڽṹѡжBOMLineٽв!!", "", + MessageBox.ERROR); + return; + } + + System.out.println(targetComp.getType()); + TCComponentBOMLine topline = null; + if (targetComp instanceof TCComponentBOMViewRevision) { + try { + TCComponent comp = (TCComponent) targetComp; + AIFComponentContext[] context = comp.whereReferenced(); + TCComponentItemRevision rev = null; + for (int i = 0; i < context.length; i++) { + System.out.println("i:" + i); + if (context[i].getComponent() instanceof TCComponentItemRevision) { + rev = (TCComponentItemRevision) context[i] + .getComponent(); + break; + } + } + + TCComponentBOMWindowType type = (TCComponentBOMWindowType) session + .getTypeComponent("BOMWindow"); + TCComponentBOMWindow win = type.create(null); + topline = win.setWindowTopLine(rev.getItem(), rev, null, null); + EdaInBomline_Command com = new EdaInBomline_Command(topline, + session); + try { + com.executeModal(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } catch (Exception e) { + e.printStackTrace(); + } + + } else if (targetComp instanceof TCComponentBOMLine) { + + System.out.println("bingo"); + try { + if (((TCComponentBOMLine) targetComp) + .getTCProperty("bl_formatted_parent_name") + .getStringValue().equals("")) { + System.out.println("bingooooooo"); + } else { + MessageBox.post("ѡжBOMLineٵ", "", + MessageBox.INFORMATION); + return; + } + } catch (TCException e) { + e.printStackTrace(); + } + EdaInBomline_Command com = new EdaInBomline_Command((TCComponentBOMLine)targetComp, session); + try { + com.executeModal(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } else { + MessageBox.post("ǰѡе" + targetComp.getType() + + ",ѡͼ汾ڽṹѡжBOMLineٽв", "", + MessageBox.INFORMATION); + return; + } + + } + +} diff --git a/src/com/connor/jk/plm/EdaBomline/EdaInBomline_Command.java b/src/com/connor/jk/plm/EdaBomline/EdaInBomline_Command.java new file mode 100644 index 0000000..79f7918 --- /dev/null +++ b/src/com/connor/jk/plm/EdaBomline/EdaInBomline_Command.java @@ -0,0 +1,38 @@ +package com.connor.jk.plm.EdaBomline; + +import com.teamcenter.rac.aif.AIFDesktop; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.AbstractAIFCommand; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentBOMLine; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCComponentItemType; +import com.teamcenter.rac.kernel.TCSession; + +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.Registry; + +public class EdaInBomline_Command extends AbstractAIFCommand { + private TCComponentBOMLine targetComp; + private TCSession session; + + public EdaInBomline_Command(TCComponentBOMLine line, TCSession session) { + // TODO Auto-generated constructor stub + this.targetComp = line; + this.session = session; + } + + public void executeModal() throws Exception { + // TODO Auto-generated method stub + super.executeModal(); + + System.out.println("aaa"); + + EdaInBomline_Dialog dialog = new EdaInBomline_Dialog(targetComp, session); + new Thread(dialog).start(); + + } + +} diff --git a/src/com/connor/jk/plm/EdaBomline/EdaInBomline_Dialog.java b/src/com/connor/jk/plm/EdaBomline/EdaInBomline_Dialog.java new file mode 100644 index 0000000..8895e36 --- /dev/null +++ b/src/com/connor/jk/plm/EdaBomline/EdaInBomline_Dialog.java @@ -0,0 +1,35 @@ +package com.connor.jk.plm.EdaBomline; + +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponentBOMLine; +import com.teamcenter.rac.kernel.TCSession; + +public class EdaInBomline_Dialog extends AbstractAIFDialog { + private InterfaceAIFComponent targetComp; + private TCSession session; + + private TCComponentBOMLine bomline; + + public EdaInBomline_Dialog(InterfaceAIFComponent targetComp, + TCSession session) { + this.targetComp = targetComp; + this.session = session; + this.bomline = (TCComponentBOMLine) targetComp; + } + + @Override + public void run() { + // super.run(); + System.out.println("run"); + EdaInBomline_Operation op = new EdaInBomline_Operation(bomline, session); + try { + op.executeOperation(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + +} diff --git a/src/com/connor/jk/plm/EdaBomline/EdaInBomline_Handler.java b/src/com/connor/jk/plm/EdaBomline/EdaInBomline_Handler.java new file mode 100644 index 0000000..6c9bec3 --- /dev/null +++ b/src/com/connor/jk/plm/EdaBomline/EdaInBomline_Handler.java @@ -0,0 +1,21 @@ +package com.connor.jk.plm.EdaBomline; + +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.aifrcp.AIFUtility; + +public class EdaInBomline_Handler extends AbstractHandler { + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + // TODO Auto-generated method stub + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + EdaInBomline_Action action=new EdaInBomline_Action(app,null); + new Thread(action).start(); + return null; + } + +} diff --git a/src/com/connor/jk/plm/EdaBomline/EdaInBomline_Operation.java b/src/com/connor/jk/plm/EdaBomline/EdaInBomline_Operation.java new file mode 100644 index 0000000..9c0643f --- /dev/null +++ b/src/com/connor/jk/plm/EdaBomline/EdaInBomline_Operation.java @@ -0,0 +1,453 @@ +package com.connor.jk.plm.EdaBomline; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.util.ArrayList; +import java.util.List; + +import javax.swing.JOptionPane; + +import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.Color; +import org.apache.poi.ss.usermodel.Font; +import org.apache.poi.xssf.usermodel.XSSFCell; +import org.apache.poi.xssf.usermodel.XSSFCellStyle; +import org.apache.poi.xssf.usermodel.XSSFFont; +import org.apache.poi.xssf.usermodel.XSSFRow; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + +import com.teamcenter.rac.aif.AbstractAIFOperation; +import com.teamcenter.rac.aif.kernel.AIFComponentContext; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentBOMLine; +import com.teamcenter.rac.kernel.TCComponentDataset; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCComponentItemType; +import com.teamcenter.rac.kernel.TCComponentTcFile; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.services.internal.rac.structuremanagement.GlobalAlternateService; +import com.teamcenter.services.internal.rac.structuremanagement._2007_06.GlobalAlternate; + +public class EdaInBomline_Operation extends AbstractAIFOperation { + + private TCSession session; + private TCComponentBOMLine comp; + private List listbean = new ArrayList(); + private String username; + private String fustr; + private File file; + private XSSFWorkbook wb; + private XSSFSheet sheet; + private int rowlen = 0; + private int strrow = -1; + private int endrow = -1; + private boolean isUpRev = false; + private String upRevStr = ""; + private List listid = new ArrayList(); + private TCComponentItemType type; + + public EdaInBomline_Operation(TCComponentBOMLine comp, TCSession session) { + // TODO Auto-generated constructor stub + this.session = session; + this.comp = comp; + } + + @Override + public void executeOperation() throws Exception { + // TODO Auto-generated method stub + username = session.getUserName(); + System.out.println("name=" + username); + String id = comp.getTCProperty("bl_item_item_id").getStringValue(); + String rev_id = comp.getTCProperty("bl_rev_item_revision_id") + .getStringValue(); + String name = comp.getTCProperty("bl_item_object_name") + .getStringValue(); + fustr = id + "/" + rev_id + ";" + name; + + file = getfile(); + if (file == null) { + + System.out.println("ļ˳"); + return; + } + type = (TCComponentItemType) session.getTypeService().getTypeComponent( + "Item"); + wb = new XSSFWorkbook(new FileInputStream(file)); + + int sheetlength = wb.getNumberOfSheets(); + + for (int i = 0; i < sheetlength; i++) { + String sheetname = wb.getSheetName(i); + if (username.equals(sheetname)) { + sheet = wb.getSheet(sheetname); + break; + } + } + if (sheet == null) { + MessageBox.post("ûbomϢ,ȷ!!", "", MessageBox.ERROR); + return; + } + rowlen = sheet.getLastRowNum(); + if (rowlen > 0) { + + // øbomlineexcelλ + int jl = 0; + int strjl = 0; + for (int i = 0; i < rowlen; i++) { + XSSFRow row = sheet.getRow(i); + String xh = row.getCell(0).getStringCellValue(); + if ("0".equals(xh)) { + jl++; + String fubom = row.getCell(1).getStringCellValue(); + String fubomid = ""; + if (fubom.contains("/")) { + fubomid = fubom.split("/")[0]; + } + + if (fubom.equals(fustr) && strrow < 0) { + strrow = i; + strjl = jl; + } else if (fubomid.equals(id) && strrow < 0) { + strrow = i; + strjl = jl; + isUpRev = true; + upRevStr = fubom; + } + if (strjl > 0 && jl == (strjl + 1)) { + endrow = i - 1; + } + } + } + if (strrow > 0 && endrow < 0) { + endrow = rowlen; + } + + } + + if (strrow <= 0) { + MessageBox.post("bomģȡϢ,޷!!", "", MessageBox.ERROR); + return; + } else if (isUpRev) { + int yn = JOptionPane.showConfirmDialog(null, "bomģдڶ汾" + + upRevStr + "һ,Ƿ?", "ȡȷ϶Ի", 0, 2); + if (yn == 0) { + System.out.println(""); + + } else { + System.out.println("ȡ"); + return; + } + + } + System.out.println("ʼbomline"); + + BomlineBean bean = new BomlineBean(); + for (int i = strrow + 1; i < endrow + 1; i++) { + XSSFRow row = sheet.getRow(i); + + String object_string = row.getCell(1).getStringCellValue(); + String outid = ""; + String outrev_id = ""; + String outname = ""; + if (object_string.contains("/")) { + outid = object_string.split("/")[0]; + if (object_string.split("/")[1].contains(";")) { + String[] ss = object_string.split("/")[1].split(";"); + if (ss != null && ss.length > 1) { + outrev_id = ss[0]; + outname = ss[1]; + } + + } + } + + String leven = row.getCell(0).getStringCellValue(); + String tdsx = row.getCell(5).getStringCellValue(); + String sxsj = row.getCell(4).getStringCellValue(); + String tdbl = row.getCell(3).getStringCellValue(); + String sulist = row.getCell(2).getStringCellValue(); + String alllist = row.getCell(6).getStringCellValue(); + + List alllists = new ArrayList<>(); + List sulists = new ArrayList<>(); + if (!alllist.equals("")) { + + String[] ids = alllist.split(","); + for (String s : ids) { + TCComponentItem item = type.find(s); + if (item == null) { + MessageBox.post("δϵͳв鵽ȫid=" + s + ",е!!", + "WARNING", MessageBox.WARNING); + } else { + alllists.add(item); + } + } + + } + + if (!sulist.equals("")) { + + String[] idrevs = alllist.split(","); + // for (String ss : idrevs) { + // String sid=ss.split("/")[0]; + // String srev=ss.split("/")[1]; + // TCComponentItem item = type.find(sid); + // if (item == null) { + // MessageBox.post("δϵͳв鵽" + ss+ ",ʧ!!", + // "ERROR", MessageBox.ERROR); + // return; + // + // } else { + // TCComponentItemRevision[] + // revs=item.getReleasedItemRevisions(); + // boolean ishave=false; + // for(TCComponentItemRevision rev1: revs){ + // if(srev.equals(rev1.getTCProperty("item_revision_id").getStringValue())){ + // sulists.add(rev1); + // ishave=true; + // break; + // } + // } + // if(!ishave){ + // sulists.add(item.getLatestItemRevision()); + // } + // + // } + // + // } + + for (String ss : idrevs) { + TCComponentItem item = type.find(ss); + if (item == null) { + MessageBox.post("δϵͳв鵽id:" + ss + ",ʧ!!", + "ERROR", MessageBox.ERROR); + return; + + } else { + + sulists.add(item.getLatestItemRevision()); + + } + + } + + } + + bean.setSuTccoms(sulists); + bean.setAllTccoms(alllists); + bean.setAllsulines(alllist); + bean.setId(outid); + bean.setLev(leven); + bean.setName(outname); + bean.setRevid(outrev_id); + bean.setSulines(sulist); + bean.setSxsj(sxsj); + bean.setTdbl(tdbl); + bean.setTdsx(tdsx); + listid.add(outid); + listbean.add(bean); + System.out.println(bean); + } + String mm=""; + if (listid.size() > 0) { + getchline(comp, 0); + System.out.println("ʣ:"+listid.size()); + if(listid.size()>0){ + + for(String sssid:listid){ + TCComponentItem item = type.find(sssid); + if(mm.equals("")){ + mm=sssid+"-"+item.getTCProperty("object_name"); + }else{ + mm=mm+","+sssid+"-"+item.getTCProperty("object_name"); + } + + } + + } + } else { + MessageBox.post("ģ巢!!", "", MessageBox.ERROR); + } + if(!mm.equals("")){ + MessageBox.post("Ϣɹ"+mm+"BOMѱƳBOMв鿴!!", "ʾ", MessageBox.INFORMATION); + }else{ + MessageBox.post("ϢɹBOMв鿴", "ʾ", + MessageBox.INFORMATION); + } + + + } + + private File getfile() { + // TODO Auto-generated method stub + TCPreferenceService pref = session.getPreferenceService(); + String puid = pref.getStringValue("JK_EDA_Dataset_Puid");// ѡpuid + // txVld3uJYvbLjA + if (puid != null) { + try { + TCComponentDataset dataset = (TCComponentDataset) session + .stringToComponent(puid); + if (dataset == null) { + MessageBox.post("ûҵģ,!", "WARNING", + MessageBox.WARNING); + return null; + } + TCComponentTcFile[] files = dataset.getTcFiles(); + if (files.length == 0 || files.length != 1) { + MessageBox.post("ݼûõļļ࣬飡", "WARNING", + MessageBox.WARNING); + } else { + File fmsFile = files[0].getFmsFile(); + return fmsFile; + } + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } else { + MessageBox.post("δҵѡ[JK_EDA_Dataset_Puid]ѡô", "", + MessageBox.ERROR); + return null; + } + return null; + + } + + public void getchline(TCComponentBOMLine line, int lev) { + // TODO Auto-generated method stub + try { + lev++; + AIFComponentContext[] chlines = line.getChildren(); + if (chlines != null && chlines.length > 0) { + for (int i = 0; i < chlines.length; i++) { + TCComponentBOMLine chline = (TCComponentBOMLine) chlines[i] + .getComponent(); + String id = chline.getTCProperty("bl_item_item_id") + .getStringValue(); + if (listid.contains(id)) { + listid.remove(id);//id + TCComponentBOMLine[] sulines = chline.listSubstitutes(); + TCComponent[] glitems = chline.getItem() + .getTCProperty("global_alt_list") + .getReferenceValueArray(); + + if ((sulines == null || sulines.length <= 0) + || (glitems == null || glitems.length <= 0)) { + + for (BomlineBean bean : listbean) { + if (bean.getId().equals(id)) { + List sutcs = bean + .getSuTccoms(); + List alltcs = bean + .getAllTccoms(); + + if (sutcs != null && sutcs.size() > 0) { + for (int s = 0; s < sutcs.size(); s++) { + TCComponent[] boms = sutcs + .get(s) + .getTCProperty( + "structure_revisions") + .getReferenceValueArray(); + TCComponent bomviwe = null; + if (boms != null && boms.length > 0) { + bomviwe = boms[0]; + } + chline.add( + null, + (TCComponentItemRevision) sutcs + .get(s), bomviwe, + true); + } + + String tdsx = bean.getTdsx();// ˳ + String sxsj = bean.getSxsj();// Чʱ + String tdbl = bean.getTdbl();// + + chline.getTCProperty("JK8SubstitOrder") + .setStringValue(tdsx);// ˳Чʱ + chline.getTCProperty("JK8EffectiveDate") + .setStringValue(sxsj); + chline.getTCProperty("JK8SubstitRatio") + .setStringValue(tdbl); + } + + if (alltcs != null && alltcs.size() > 0) { + TCComponentItem[] glits = new TCComponentItem[alltcs + .size()]; + for (int m = 0; m < alltcs.size(); m++) { + glits[m] = (TCComponentItem) alltcs + .get(m); + } + addSelectedGlobalAlternates( + chline.getItem(), glits);// ȫ + + } + + } + + } + + } else { + System.out.println(id + "ֲȫֱѡѴ,"); + + } + + } else { + System.out.println("bomline:" + id + ","); + + } + + getchline(chline, lev); + } + + } + + } catch (TCException e) { + // TODO Auto-generated catch block + + e.printStackTrace(); + MessageBox.post(":" + e.getMessage(), "", MessageBox.ERROR); + } + } + + // Ƴȫ + public void removeGlobalAlternates(TCComponentItem item, + TCComponentItem[] items) { + System.out.println("removeGlobalAlternates"); + + com.teamcenter.services.internal.rac.structuremanagement._2007_06.GlobalAlternate.GlobalAlternateListInput localGlobalAlternateListInput = new com.teamcenter.services.internal.rac.structuremanagement._2007_06.GlobalAlternate.GlobalAlternateListInput(); + localGlobalAlternateListInput.item = item; + localGlobalAlternateListInput.gAltItems = items; + com.teamcenter.services.internal.rac.structuremanagement._2007_06.GlobalAlternate.GlobalAlternateListInput[] arrayOfGlobalAlternateListInput = new com.teamcenter.services.internal.rac.structuremanagement._2007_06.GlobalAlternate.GlobalAlternateListInput[1]; + arrayOfGlobalAlternateListInput[0] = localGlobalAlternateListInput; + GlobalAlternateService localGlobalAlternateService = GlobalAlternateService + .getService(this.session); + com.teamcenter.services.internal.rac.structuremanagement._2007_06.GlobalAlternate.GlobalAlternateResponse localGlobalAlternateResponse = localGlobalAlternateService + .removeRelatedGlobalAlternates(arrayOfGlobalAlternateListInput); + + } + + // ȫ + private void addSelectedGlobalAlternates(TCComponentItem item, + TCComponentItem[] paramTCComponentItem) { + TCComponentItem[] arrayOfTCComponentItem = paramTCComponentItem; + GlobalAlternate.GlobalAlternateListInput globalAlternateListInput = new GlobalAlternate.GlobalAlternateListInput(); + globalAlternateListInput.item = item; + globalAlternateListInput.gAltItems = arrayOfTCComponentItem; + GlobalAlternate.GlobalAlternateListInput[] arrayOfGlobalAlternateListInput = new GlobalAlternate.GlobalAlternateListInput[1]; + arrayOfGlobalAlternateListInput[0] = globalAlternateListInput; + GlobalAlternateService globalAlternateService = GlobalAlternateService + .getService(this.session); + GlobalAlternate.GlobalAlternateResponse globalAlternateResponse = globalAlternateService + .addRelatedGlobalAlternates(arrayOfGlobalAlternateListInput); + + } + +} diff --git a/src/com/connor/jk/plm/MESreport/DataBaseControl.java b/src/com/connor/jk/plm/MESreport/DataBaseControl.java new file mode 100644 index 0000000..985be84 --- /dev/null +++ b/src/com/connor/jk/plm/MESreport/DataBaseControl.java @@ -0,0 +1,190 @@ +package com.connor.jk.plm.MESreport; + +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Vector; + +import com.teamcenter.rac.util.MessageBox; + +public class DataBaseControl { + + /** ************************ݿ:*********************************** */ + /** + * kelsen .... + */ + Connection conn; + + ResultSet rs; + + PreparedStatement pstmt; + + Statement stmt; + + String strUrl, strUserName, strPassword, strSQLQuery, strDriver; + + public String str_Information = ""; + + /** + * + */ + public DataBaseControl(String strDriver, String strUrl, String strUserName, + String strPassword) { + this.strDriver = strDriver; // "oracle.jdbc.driver.OracleDriver";// + this.strUrl = strUrl; // "jdbc:oracle:thin:@127.0.0.1:1521:tceng";//· + this.strUserName = strUserName; // "infodba";//ݿû + this.strPassword = strPassword; // "infodba";//ݿ + // strSQLQuery="select * from LABELID";//ѯ + + // + try { + Class.forName(strDriver);// ͨڴ + } catch (ClassNotFoundException cnfe) { + cnfe.printStackTrace(); + } + // try { + // Class.forName("org.objectweb.rmijdbc.Driver").newInstance(); + // } catch (InstantiationException e) { + // + // e.printStackTrace(); + // } catch (IllegalAccessException e) { + // + // e.printStackTrace(); + // } catch (ClassNotFoundException e) { + // + // e.printStackTrace(); + // } + } + + /** + * + * + * @param strSQLQuery + */ + public void dbModify(String strSQLQuery) throws Exception{ + + openDataBase(); + +// try { + stmt = conn.createStatement(); + stmt.executeUpdate(strSQLQuery); +// } catch (SQLException sqle2) { +// sqle2.printStackTrace(); +// } + + closeDataBase(); + } + + /** + * ѯ + * + * @param strSQLQuery + * @return + */ + public ResultSet dbQuery(String strSQLQuery) throws Exception{ + ResultSet rs_result = null; +// try { + if (conn == null) { + openDataBase(); + } + stmt = conn.createStatement(); + rs_result = stmt.executeQuery(strSQLQuery); + +// } catch (SQLException sqle2) { +// sqle2.printStackTrace(); +// } + return rs_result; + } + + /** + * list + */ + public List doQuery2(String strSQLQuery,int count) throws Exception{ + List list = new ArrayList(); + openDataBase(); + try { + rs = dbQuery(strSQLQuery); + if(rs!=null) { + while(rs.next()) { + String [] arr = new String[count]; + for(int i = 1;i<=count;i++) { + arr[i-1] = rs.getString(i); + } + list.add(arr); + } + } + + }finally { + closeDataBase(); + } + + return list; + } + + + /** + * + * + */ + public void openDataBase() throws Exception{ +// try { + // this.strUrl="jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.29)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=tcprod)))"; + if (conn == null || conn.isClosed()) + conn = DriverManager.getConnection(strUrl, strUserName, + strPassword); +// }catch (SQLException sqle) { +// sqle.printStackTrace(); +//// ByteArrayOutputStream baos = new ByteArrayOutputStream(); +//// sqle.printStackTrace(new PrintStream(baos)); +//// String exception = baos.toString(); +//// MessageBox.post(exception,"",MessageBox.INFORMATION); +// } + } + + /** + * رݿ + * + */ + public void closeDataBase() { + try { + if (rs != null) { + try { + rs.close(); + } catch (SQLException sqlec) { + sqlec.printStackTrace(); + } + } + if (stmt != null) { + try { + stmt.close(); + } catch (SQLException sqlec) { + sqlec.printStackTrace(); + } + } + if (conn != null && !conn.isClosed()) { + try { + conn.close(); + } catch (SQLException sqlecon) { + sqlecon.printStackTrace(); + } + + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + + + +} diff --git a/src/com/connor/jk/plm/MESreport/DateChooser.java b/src/com/connor/jk/plm/MESreport/DateChooser.java new file mode 100644 index 0000000..acdd324 --- /dev/null +++ b/src/com/connor/jk/plm/MESreport/DateChooser.java @@ -0,0 +1,1391 @@ +package com.connor.jk.plm.MESreport; + +import java.awt.BasicStroke; + +import java.awt.BorderLayout; + +import java.awt.Color; + +import java.awt.Component; + +import java.awt.Cursor; + +import java.awt.Dimension; + +import java.awt.Font; + +import java.awt.Graphics; + +import java.awt.Graphics2D; + +import java.awt.GridLayout; + +import java.awt.Point; + +import java.awt.Polygon; + +import java.awt.Stroke; + +import java.awt.Toolkit; + +import java.awt.event.FocusEvent; + +import java.awt.event.FocusListener; + +import java.awt.event.MouseAdapter; + +import java.awt.event.MouseEvent; + +import java.awt.event.MouseListener; + +import java.awt.event.MouseMotionListener; + +import java.text.SimpleDateFormat; + +import java.util.ArrayList; + +import java.util.Calendar; + +import java.util.Comparator; + +import java.util.Date; + +import java.util.List; + + + +import javax.swing.BorderFactory; + +import javax.swing.JComponent; + +import javax.swing.JFrame; + +import javax.swing.JLabel; + +import javax.swing.JPanel; + +import javax.swing.JTextField; + +import javax.swing.Popup; + +import javax.swing.PopupFactory; + +import javax.swing.SwingUtilities; + +import javax.swing.event.AncestorEvent; + +import javax.swing.event.AncestorListener; + + + +/** + + * ѡָڵʾʽ + + */ + +public class DateChooser extends JPanel { + + + + private static final long serialVersionUID = 4529266044762990227L; + + + + private Date initDate; + + private Calendar now = Calendar.getInstance(); + + private Calendar select; + + private JPanel monthPanel;// + + private JP1 jp1;//Ŀ, + + private JP2 jp2; + + private JP3 jp3; + + private JP4 jp4; + + private Font font = new Font("", Font.PLAIN, 12); + + private final LabelManager lm = new LabelManager(); + + private SimpleDateFormat sdf; + + private boolean isShow = false; + + private Popup pop; + + + + private JComponent showDate; + + + + public static DateChooser getInstance() { + + return new DateChooser(); + + } + + + + public static DateChooser getInstance(Date date) { + + return new DateChooser(date); + + } + + + + public static DateChooser getInstance(String format) { + + return new DateChooser(format); + + } + + + + public static DateChooser getInstance(Date date, String format) { + + return new DateChooser(date, format); + + } + + + + /** + + * Creates a new instance of DateChooser + + */ + + private DateChooser() { + + this(new Date()); + + } + + + + private DateChooser(Date date) { + + this(date, "yyyyMMdd"); + + } + + + + private DateChooser(String format) { + + this(new Date(), format); + + } + + + + private DateChooser(Date date, String format) { + + initDate = date; + + sdf = new SimpleDateFormat(format); + + select = Calendar.getInstance(); + + select.setTime(initDate); + + initPanel(); + + } + + + + /** + + * Ƿûѡ + + */ + + public void setEnabled(boolean b) { + + super.setEnabled(b); + + showDate.setEnabled(b); + + } + + + + /** + + *õǰѡ + + */ + + public Date getDate() { + + return select.getTime(); + + } + + + + public String getStrDate() { + + return sdf.format(select.getTime()); + + } + + + + public String getStrDate(String format) { + + sdf = new SimpleDateFormat(format); + + return sdf.format(select.getTime()); + + } + + + + //ݳʼ,ʼ + + private void initPanel() { + + monthPanel = new JPanel(new BorderLayout()); + + monthPanel.setBorder(BorderFactory.createLineBorder(Color.BLUE)); + + JPanel up = new JPanel(new BorderLayout()); + + up.add(jp1 = new JP1(), BorderLayout.NORTH); + + up.add(jp2 = new JP2(), BorderLayout.CENTER); + + monthPanel.add(jp3 = new JP3(), BorderLayout.CENTER); + + monthPanel.add(up, BorderLayout.NORTH); + + monthPanel.add(jp4 = new JP4(), BorderLayout.SOUTH); + + this.addAncestorListener(new AncestorListener() { + + public void ancestorAdded(AncestorEvent event) { + + + + } + + + + public void ancestorRemoved(AncestorEvent event) { + + + + } + + + + //ֻҪһƶ,Ͼpopupʧ + + public void ancestorMoved(AncestorEvent event) { + + hidePanel(); + + } + + }); + + } + + + + public void register(final JComponent showDate) { + + this.showDate = showDate; + + + + showDate.setRequestFocusEnabled(true); + + showDate.addMouseListener(new MouseAdapter() { + + public void mousePressed(MouseEvent me) { + + showDate.requestFocusInWindow(); + + } + + }); + + this.setBackground(Color.WHITE); + + this.add(showDate, BorderLayout.CENTER); + + this.setPreferredSize(new Dimension(90, 25)); + + this.setBorder(BorderFactory.createLineBorder(Color.GRAY)); + + showDate.addMouseListener(new MouseAdapter() { + + public void mouseEntered(MouseEvent me) { + + if (showDate.isEnabled()) { + + showDate.setCursor(new Cursor(Cursor.HAND_CURSOR)); + + showDate.setForeground(Color.RED); + + } + + } + + + + public void mouseExited(MouseEvent me) { + + if (showDate.isEnabled()) { + + showDate.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); + + showDate.setForeground(Color.BLACK); + + } + + } + + + + public void mousePressed(MouseEvent me) { + + if (showDate.isEnabled()) { + + showDate.setForeground(Color.CYAN); + + if (isShow) { + + hidePanel(); + + } else { + + showPanel(showDate); + + } + + } + + } + + + + public void mouseReleased(MouseEvent me) { + + if (showDate.isEnabled()) { + + showDate.setForeground(Color.BLACK); + + } + + } + + }); + + showDate.addFocusListener(new FocusListener() { + + public void focusLost(FocusEvent e) { + + hidePanel(); + + } + + + + public void focusGained(FocusEvent e) { + + + + } + + }); + + } + + + + //µˢ + + private void refresh() { + + jp1.updateDate(); + + jp2.updateDate(); + + jp3.updateDate(); + + jp4.updateDate(); + + SwingUtilities.updateComponentTreeUI(this); + + } + + + + //ύ + + private void commit() { + + //TODO add other components here + + if (showDate instanceof JTextField) { + + ((JTextField) showDate).setText(sdf.format(select.getTime())); + + }else if (showDate instanceof JLabel) { + + ((JLabel) showDate).setText(sdf.format(select.getTime())); + + } + + + + hidePanel(); + + } + + + + //ѡ + + private void hidePanel() { + + if (pop != null) { + + isShow = false; + + pop.hide(); + + pop = null; + + } + + } + + + + //ʾѡ + + private void showPanel(Component owner) { + + if (pop != null) { + + pop.hide(); + + } + + Point show = new Point(0, showDate.getHeight()); + + SwingUtilities.convertPointToScreen(show, showDate); + + Dimension size = Toolkit.getDefaultToolkit().getScreenSize(); + + int x = show.x; + + int y = show.y; + + if (x < 0) { + + x = 0; + + } + + if (x > size.width - 295) { + + x = size.width - 295; + + } + + if (y < size.height - 170) { + + } else { + + y -= 188; + + } + + pop = PopupFactory.getSharedInstance().getPopup(owner, monthPanel, x, y); + + pop.show(); + + isShow = true; + + } + + + + /** + + * ʾ·ݵ + + */ + + private class JP1 extends JPanel { + + private static final long serialVersionUID = -5638853772805561174L; + + JLabel yearleft, yearright, monthleft, monthright, center, centercontainer; + + + + public JP1() { + + super(new BorderLayout()); + + this.setBackground(new Color(160, 185, 215)); + + initJP1(); + + } + + + + private void initJP1() { + + yearleft = new JLabel(" <<", JLabel.CENTER); + + yearleft.setToolTipText("һ"); + + yearright = new JLabel(">> ", JLabel.CENTER); + + yearright.setToolTipText("һ"); + + yearleft.setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0)); + + yearright.setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0)); + + + + monthleft = new JLabel(" <", JLabel.RIGHT); + + monthleft.setToolTipText("һ"); + + monthright = new JLabel("> ", JLabel.LEFT); + + monthright.setToolTipText("һ"); + + monthleft.setBorder(BorderFactory.createEmptyBorder(2, 30, 0, 0)); + + monthright.setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 30)); + + + + centercontainer = new JLabel("", JLabel.CENTER); + + centercontainer.setLayout(new BorderLayout()); + + center = new JLabel("", JLabel.CENTER); + + + + centercontainer.add(monthleft, BorderLayout.WEST); + + centercontainer.add(center, BorderLayout.CENTER); + + centercontainer.add(monthright, BorderLayout.EAST); + + + + this.add(yearleft, BorderLayout.WEST); + + this.add(centercontainer, BorderLayout.CENTER); + + this.add(yearright, BorderLayout.EAST); + + this.setPreferredSize(new Dimension(295, 25)); + + + + updateDate(); + + + + yearleft.addMouseListener(new MouseAdapter() { + + public void mouseEntered(MouseEvent me) { + + yearleft.setCursor(new Cursor(Cursor.HAND_CURSOR)); + + yearleft.setForeground(Color.RED); + + } + + + + public void mouseExited(MouseEvent me) { + + yearleft.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); + + yearleft.setForeground(Color.BLACK); + + } + + + + public void mousePressed(MouseEvent me) { + + select.add(Calendar.YEAR, -1); + + yearleft.setForeground(Color.WHITE); + + refresh(); + + } + + + + public void mouseReleased(MouseEvent me) { + + yearleft.setForeground(Color.BLACK); + + } + + }); + + yearright.addMouseListener(new MouseAdapter() { + + public void mouseEntered(MouseEvent me) { + + yearright.setCursor(new Cursor(Cursor.HAND_CURSOR)); + + yearright.setForeground(Color.RED); + + } + + + + public void mouseExited(MouseEvent me) { + + yearright.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); + + yearright.setForeground(Color.BLACK); + + } + + + + public void mousePressed(MouseEvent me) { + + select.add(Calendar.YEAR, 1); + + yearright.setForeground(Color.WHITE); + + refresh(); + + } + + + + public void mouseReleased(MouseEvent me) { + + yearright.setForeground(Color.BLACK); + + } + + }); + + monthleft.addMouseListener(new MouseAdapter() { + + public void mouseEntered(MouseEvent me) { + + monthleft.setCursor(new Cursor(Cursor.HAND_CURSOR)); + + monthleft.setForeground(Color.RED); + + } + + + + public void mouseExited(MouseEvent me) { + + monthleft.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); + + monthleft.setForeground(Color.BLACK); + + } + + + + public void mousePressed(MouseEvent me) { + + select.add(Calendar.MONTH, -1); + + monthleft.setForeground(Color.WHITE); + + refresh(); + + } + + + + public void mouseReleased(MouseEvent me) { + + monthleft.setForeground(Color.BLACK); + + } + + }); + + monthright.addMouseListener(new MouseAdapter() { + + public void mouseEntered(MouseEvent me) { + + monthright.setCursor(new Cursor(Cursor.HAND_CURSOR)); + + monthright.setForeground(Color.RED); + + } + + + + public void mouseExited(MouseEvent me) { + + monthright.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); + + monthright.setForeground(Color.BLACK); + + } + + + + public void mousePressed(MouseEvent me) { + + select.add(Calendar.MONTH, 1); + + monthright.setForeground(Color.WHITE); + + refresh(); + + } + + + + public void mouseReleased(MouseEvent me) { + + monthright.setForeground(Color.BLACK); + + } + + }); + + } + + + + private void updateDate() { + + center.setText(select.get(Calendar.YEAR) + "" + (select.get(Calendar.MONTH) + 1) + ""); + + } + + } + + + + private class JP2 extends JPanel { + + private static final long serialVersionUID = -8176264838786175724L; + + + + public JP2() { + + this.setPreferredSize(new Dimension(295, 20)); + + } + + + + protected void paintComponent(Graphics g) { + + g.setFont(font); + + g.drawString(" һ ڶ ", 5, 10); + + g.drawLine(0, 15, getWidth(), 15); + + } + + + + private void updateDate() { + + + + } + + } + + + + private class JP3 extends JPanel { + + private static final long serialVersionUID = 43157272447522985L; + + + + public JP3() { + + super(new GridLayout(6, 7)); + + this.setPreferredSize(new Dimension(295, 100)); + + initJP3(); + + } + + + + private void initJP3() { + + updateDate(); + + } + + + + public void updateDate() { + + this.removeAll(); + + lm.clear(); + + Date temp = select.getTime(); + + Calendar select = Calendar.getInstance(); + + select.setTime(temp); + + select.set(Calendar.DAY_OF_MONTH, 1); + + int index = select.get(Calendar.DAY_OF_WEEK); + + int sum = (index == 1 ? 8 : index); + + select.add(Calendar.DAY_OF_MONTH, 0 - sum); + + for (int i = 0; i < 42; i++) { + + select.add(Calendar.DAY_OF_MONTH, 1); + + lm.addLabel(new MyLabel(select.get(Calendar.YEAR), select.get(Calendar.MONTH), select.get(Calendar.DAY_OF_MONTH))); + + } + + for (MyLabel my : lm.getLabels()) { + + this.add(my); + + } + + select.setTime(temp); + + } + + } + + + + private class MyLabel extends JLabel implements Comparator, MouseListener, MouseMotionListener { + + private static final long serialVersionUID = 3668734399227577214L; + + private int year, month, day; + + private boolean isSelected; + + + + public MyLabel(int year, int month, int day) { + + super("" + day, JLabel.CENTER); + + this.year = year; + + this.day = day; + + this.month = month; + + this.addMouseListener(this); + + this.addMouseMotionListener(this); + + this.setFont(font); + + if (month == select.get(Calendar.MONTH)) { + + this.setForeground(Color.BLACK); + + } else { + + this.setForeground(Color.LIGHT_GRAY); + + } + + if (day == select.get(Calendar.DAY_OF_MONTH)) { + + this.setBackground(new Color(160, 185, 215)); + + } else { + + this.setBackground(Color.WHITE); + + } + + } + + + + public boolean getIsSelected() { + + return isSelected; + + } + + + + public void setSelected(boolean b, boolean isDrag) { + + isSelected = b; + + if (b && !isDrag) { + + int temp = select.get(Calendar.MONTH); + + select.set(year, month, day); + + if (temp == month) { + + SwingUtilities.updateComponentTreeUI(jp3); + + } else { + + refresh(); + + } + + } + + this.repaint(); + + } + + + + protected void paintComponent(Graphics g) { + + if (day == select.get(Calendar.DAY_OF_MONTH) && month == select.get(Calendar.MONTH)) { + + //ǰѡ,ʾ + + g.setColor(new Color(160, 185, 215)); + + g.fillRect(0, 0, getWidth(), getHeight()); + + } + + if (year == now.get(Calendar.YEAR) && month == now.get(Calendar.MONTH) && day == now.get(Calendar.DAY_OF_MONTH)) { + + //ں͵ǰһ,ú + + Graphics2D gd = (Graphics2D) g; + + gd.setColor(Color.RED); + + Polygon p = new Polygon(); + + p.addPoint(0, 0); + + p.addPoint(getWidth() - 1, 0); + + p.addPoint(getWidth() - 1, getHeight() - 1); + + p.addPoint(0, getHeight() - 1); + + gd.drawPolygon(p); + + } + + if (isSelected) {//ѡ˾ͻһ߿ + + Stroke s = new BasicStroke(1.0f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_BEVEL, 1.0f, new float[] { 2.0f, 2.0f }, 1.0f); + + Graphics2D gd = (Graphics2D) g; + + gd.setStroke(s); + + gd.setColor(Color.BLACK); + + Polygon p = new Polygon(); + + p.addPoint(0, 0); + + p.addPoint(getWidth() - 1, 0); + + p.addPoint(getWidth() - 1, getHeight() - 1); + + p.addPoint(0, getHeight() - 1); + + gd.drawPolygon(p); + + } + + super.paintComponent(g); + + } + + + + public boolean contains(Point p) { + + return this.getBounds().contains(p); + + } + + + + private void update() { + + repaint(); + + } + + + + public void mouseClicked(MouseEvent e) { + + } + + + + public void mousePressed(MouseEvent e) { + + isSelected = true; + + update(); + + } + + + + public void mouseReleased(MouseEvent e) { + + Point p = SwingUtilities.convertPoint(this, e.getPoint(), jp3); + + lm.setSelect(p, false); + + commit(); + + } + + + + public void mouseEntered(MouseEvent e) { + + } + + + + public void mouseExited(MouseEvent e) { + + } + + + + public void mouseDragged(MouseEvent e) { + + Point p = SwingUtilities.convertPoint(this, e.getPoint(), jp3); + + lm.setSelect(p, true); + + } + + + + public void mouseMoved(MouseEvent e) { + + } + + + + public int compare(MyLabel o1, MyLabel o2) { + + Calendar c1 = Calendar.getInstance(); + + c1.set(o1.year, o2.month, o1.day); + + Calendar c2 = Calendar.getInstance(); + + c2.set(o2.year, o2.month, o2.day); + + return c1.compareTo(c2); + + } + + } + + + + private class LabelManager { + + private List list; + + + + public LabelManager() { + + list = new ArrayList(); + + } + + + + public List getLabels() { + + return list; + + } + + + + public void addLabel(MyLabel my) { + + list.add(my); + + } + + + + public void clear() { + + list.clear(); + + } + + + + @SuppressWarnings("unused") + + public void setSelect(MyLabel my, boolean b) { + + for (MyLabel m : list) { + + if (m.equals(my)) { + + m.setSelected(true, b); + + } else { + + m.setSelected(false, b); + + } + + } + + } + + + + public void setSelect(Point p, boolean b) { + + //϶,ҪŻһ,Ч + + if (b) { + + //ʾǷܷ,ñȽеıǩ,ܷصı־ǰһǩ + + //Ҫʾıǩҵ˾Ϳ + + boolean findPrevious = false, findNext = false; + + for (MyLabel m : list) { + + if (m.contains(p)) { + + findNext = true; + + if (m.getIsSelected()) { + + findPrevious = true; + + } else { + + m.setSelected(true, b); + + } + + } else if (m.getIsSelected()) { + + findPrevious = true; + + m.setSelected(false, b); + + } + + if (findPrevious && findNext) { + + return; + + } + + } + + } else { + + MyLabel temp = null; + + for (MyLabel m : list) { + + if (m.contains(p)) { + + temp = m; + + } else if (m.getIsSelected()) { + + m.setSelected(false, b); + + } + + } + + if (temp != null) { + + temp.setSelected(true, b); + + } + + } + + } + + + + } + + + + private class JP4 extends JPanel { + + private static final long serialVersionUID = -6391305687575714469L; + + + + public JP4() { + + super(new BorderLayout()); + + this.setPreferredSize(new Dimension(295, 20)); + + this.setBackground(new Color(160, 185, 215)); + + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); + + final JLabel jl = new JLabel(": " + sdf.format(new Date())); + + jl.setToolTipText("ѡ"); + + this.add(jl, BorderLayout.CENTER); + + jl.addMouseListener(new MouseAdapter() { + + public void mouseEntered(MouseEvent me) { + + jl.setCursor(new Cursor(Cursor.HAND_CURSOR)); + + jl.setForeground(Color.RED); + + } + + + + public void mouseExited(MouseEvent me) { + + jl.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); + + jl.setForeground(Color.BLACK); + + } + + + + public void mousePressed(MouseEvent me) { + + jl.setForeground(Color.WHITE); + + select.setTime(new Date()); + + refresh(); + + commit(); + + } + + + + public void mouseReleased(MouseEvent me) { + + jl.setForeground(Color.BLACK); + + } + + }); + + } + + + + private void updateDate() { + + + + } + + } + + + + public static void main(String[] args) { + + DateChooser dateChooser1 = DateChooser.getInstance("yyyy-MM-dd"); + + DateChooser dateChooser2 = DateChooser.getInstance("yyyy-MM-dd"); + + JTextField showDate1 = new JTextField("ѡ"); + + JLabel showDate2 = new JLabel("ѡ"); + + + + dateChooser1.register(showDate1); + + dateChooser2.register(showDate2); + + + + JFrame jf = new JFrame("ѡ"); + + jf.add(showDate1, BorderLayout.NORTH); + + jf.add(showDate2, BorderLayout.SOUTH); + + jf.pack(); + + jf.setLocationRelativeTo(null); + + jf.setVisible(true); + + jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + } + +} \ No newline at end of file diff --git a/src/com/connor/jk/plm/MESreport/MESreportDialog.java b/src/com/connor/jk/plm/MESreport/MESreportDialog.java new file mode 100644 index 0000000..a29fc81 --- /dev/null +++ b/src/com/connor/jk/plm/MESreport/MESreportDialog.java @@ -0,0 +1,345 @@ +package com.connor.jk.plm.MESreport; + +import java.awt.BorderLayout; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.PrintStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Vector; + +import javax.swing.JButton; +import javax.swing.JFileChooser; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.JTextField; +import javax.swing.filechooser.FileSystemView; +import javax.swing.table.DefaultTableModel; + +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.ss.usermodel.Workbook; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.aif.AbstractAIFUIApplication; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; + +public class MESreportDialog extends AbstractAIFDialog implements ActionListener{ + private AbstractAIFUIApplication app; + private TCSession session; + private JTable table; + private DefaultTableModel model; + private JButton exportButton; + private JButton closeButton; + private final static String PREF = "TX_MESReport"; + private JButton searchButton; + private JTextField from_date; + private JTextField to_date; + private JTextField th_text; + private JTextField jsy_text; + private JTextField dth_text; + private JTextField dxlx_text; + private List colomuns = new ArrayList(); + private Map map = new HashMap(); + private DataBaseControl databaseControl; + private String export_path =""; + private DateChooser dateChooser1 = DateChooser.getInstance("yyyy-MM-dd"); + private DateChooser dateChooser2 = DateChooser.getInstance("yyyy-MM-dd"); + private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + + public MESreportDialog(AbstractAIFUIApplication app){ + this.app = app; + session = (TCSession) app.getSession(); + } + + @Override + public void run() { + try { + init(); + String[] stringValues = session.getPreferenceService().getStringValues("TX_DATABASE"); + if(stringValues == null || stringValues.length<1) { + MessageBox.post("δѡTX_DATABASE","",MessageBox.INFORMATION); + throw new Exception("δѡTX_DATABASE"); + } + databaseControl = new DataBaseControl("oracle.jdbc.driver.OracleDriver", "jdbc:oracle:thin:@"+stringValues[0], stringValues[1], stringValues[2]); + + } catch (Exception e) { + e.printStackTrace(); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + e.printStackTrace(new PrintStream(baos)); + String exception = baos.toString(); + MessageBox.post(exception,"",MessageBox.INFORMATION); + } + } + + private void init() throws Exception{ + setTitle("MESм"); + JPanel mainPanel = new JPanel(new BorderLayout()); + mainPanel.add(getConditionPanel(),BorderLayout.NORTH); + mainPanel.add(getTablePanel(),BorderLayout.CENTER); + mainPanel.add(getButtonPanel(),BorderLayout.SOUTH); + + add(mainPanel); + pack(); + setAlwaysOnTop(true); + setLocationRelativeTo(null); + setVisible(true); + } + + + private JPanel getConditionPanel() { + JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEADING)); + + from_date = new JTextField(20); + to_date = new JTextField(20); + dateChooser1.register(from_date); + dateChooser2.register(to_date); + JPanel panel1 = new JPanel(); + panel1.add(new JLabel("")); + panel1.add(from_date); + panel1.add(new JLabel("-")); + panel1.add(to_date); + + JPanel panel2 = new JPanel(); + panel2.add(new JLabel("ͼ")); + th_text = new JTextField(10); + panel2.add(th_text); + + JPanel panel3 = new JPanel(); + panel3.add(new JLabel("Ա")); + jsy_text = new JTextField(10); + panel3.add(jsy_text); + + JPanel panel4 = new JPanel(); + panel4.add(new JLabel("ͼ")); + dth_text = new JTextField(10); + panel4.add(dth_text); + + JPanel panel5 = new JPanel(); + panel5.add(new JLabel("")); + dxlx_text = new JTextField(10); + panel5.add(dxlx_text); + + + panel.add(panel1); + panel.add(panel2); + panel.add(panel3); + panel.add(panel4); + panel.add(panel5); + + return panel; + } + + private JScrollPane getTablePanel() throws Exception { + JScrollPane panel = new JScrollPane(); + table = new JTable() { + @Override + public boolean isCellEditable(int row, int column) { + return false; + } + }; + String[] stringValues = session.getPreferenceService().getStringValues(PREF); + if(stringValues == null || stringValues.length<1) { + MessageBox.post("δѡ"+PREF,"",MessageBox.INFORMATION); + throw new Exception("δѡ"+PREF); + } + for(String s:stringValues) { + String[] split = s.split(":"); + colomuns.add(split[0]); + map.put(split[0], split[1]); + } + model = new DefaultTableModel(null,colomuns.toArray(new String[colomuns.size()])); + table.setModel(model); + table.getTableHeader().setReorderingAllowed(false);//ñͷ̶ + model.addRow((Vector)null); + panel.setViewportView(table); + return panel; + } + + private JPanel getButtonPanel() { + JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER)); + exportButton = new JButton(""); + searchButton = new JButton("ѯ"); + closeButton = new JButton("ر"); + exportButton.addActionListener(this); + searchButton.addActionListener(this); + closeButton.addActionListener(this); + panel.add(searchButton); + panel.add(new JLabel(" ")); + panel.add(exportButton); + panel.add(new JLabel(" ")); + panel.add(closeButton); + return panel; + } + + public void search() throws Exception { + System.out.println("ʼѯ"); + System.out.println("ձ"); + updateTable(null); + StringBuffer sb = new StringBuffer(); + System.out.println("ƴsql"); + sb.append("Select "); + for(int i = 0;i0) { + if(isfirst) { + sb.append("WHERE PTYPE1 like '%"); + sb.append(dxlx_text.getText()); + sb.append("%' "); + } + isfirst = false; + } + if(th_text.getText()!=null&&th_text.getText().trim().length()>0) { + if(isfirst) { + sb.append("WHERE PCODE1 like '%"); + sb.append(th_text.getText()); + sb.append("%' "); + }else { + sb.append("AND PCODE1 like '%"); + sb.append(th_text.getText()); + sb.append("%' "); + } + isfirst = false; + } + if(dth_text.getText()!=null&&dth_text.getText().trim().length()>0) { + if(isfirst) { + sb.append("WHERE PITEMID1 like '%"); + sb.append(dth_text.getText()); + sb.append("%' "); + }else { + sb.append("AND PITEMID1 like '%"); + sb.append(dth_text.getText()); + sb.append("%' "); + } + isfirst = false; + } + if(jsy_text.getText()!=null&&jsy_text.getText().trim().length()>0) { + if(isfirst) { + sb.append("WHERE POWNER1 like '%"); + sb.append(jsy_text.getText()); + sb.append("%' "); + }else { + sb.append("AND POWNER1 like '%"); + sb.append(jsy_text.getText()); + sb.append("%' "); + } + isfirst = false; + } + if (from_date.getText() != null && from_date.getText().trim().length() > 0) { + if (isfirst) { + sb.append("WHERE PDATE >= to_date('"); + sb.append(sdf.format(dateChooser1.getDate()).trim()); + sb.append("','yyyy-MM-dd')"); + } else { + sb.append("AND PDATE >= to_date('"); + sb.append(sdf.format(dateChooser1.getDate()).trim()); + sb.append("','yyyy-MM-dd')"); + } + isfirst = false; + } + if (to_date.getText() != null && to_date.getText().trim().length() > 0) { + if (isfirst) { + sb.append("WHERE PDATE <= to_date('"); + sb.append(sdf.format(dateChooser2.getDate()).trim()); + sb.append("','yyyy-MM-dd')"); + } else { + sb.append("AND PDATE <= to_date('"); + sb.append(sdf.format(dateChooser2.getDate()).trim()); + sb.append("','yyyy-MM-dd')"); + } + isfirst = false; + } + String sql = sb.toString(); + System.out.println("sql:"+sql); +// MessageBox.post("sql:"+sql,"",MessageBox.INFORMATION); + List result = databaseControl.doQuery2(sql, colomuns.size()); + System.out.println("ʼ±"); + updateTable(result.toArray(new String[result.size()][colomuns.size()])); + } + + public void export() throws Exception{ + Workbook wb = new XSSFWorkbook(); + Sheet sheet = wb.createSheet(); + FileOutputStream out = null; + try { + out = new FileOutputStream(export_path); + int rowCount = model.getRowCount(); + Row toprow = sheet.createRow(0); + for(int i = 0;i 0) { + appObject.read(1); + } else { + appObject.create(item_id + "/" + item_rid, uid); + } + appObject.setView(classificationId); + appObject.edit(); + ICSProperty[] cPropS = icoS[i].getICSProperties(true); + for (int j = 0; j < cPropS.length; j++) { + System.out.println(cPropS[j].getId()); + System.out.println(cPropS[j].getValue()); + if(cPropS[j].getId()==-500301) { + cPropS[j].setValue("Ʒʶ"); + System.out.println("prop:" + cPropS[j]); + } + } + appObject.setProperties(cPropS); + appObject.save(); + } + } + + System.out.println("ɹ"); + + } + + + + +} diff --git a/src/com/connor/jk/plm/TC_OA_Integration/IntegrationBean.java b/src/com/connor/jk/plm/TC_OA_Integration/IntegrationBean.java new file mode 100644 index 0000000..e87805b --- /dev/null +++ b/src/com/connor/jk/plm/TC_OA_Integration/IntegrationBean.java @@ -0,0 +1,364 @@ +package com.connor.jk.plm.TC_OA_Integration; + +public class IntegrationBean { + private long oa_id;// ĿOAе + private long identity;// ĿidתΪһΪOAid + private String Project_id;// Ŀid + private String project_name;// Ŀ + private String Jk8ProjApproveDate;// ʱ + private String Jk8ProjEndDate;// ʱ + private String Jk8ProjectState;// Ŀ׶ + private String Jk8ProjectManager;// Ŀ + private String Jk8ProductManager;// Ʒ + private String Jk8ProductDirector;// Ʒܼ + private String Jk8ProjectLevel;// Ŀȼ + private String Jk8ProjectType;// Ŀ + private String Jk8BussinessUnit;// ҵ + private String Jk8IsResearchProj;// ǷзĿ + private String SystemTime;// ϵͳͬʱ + + // ʱ + private int is_effective;// ǷЧ + private String task_id;// ʱid + private String schedualTask;// ʱ + + // 2017.9.26 ӵ + private String object_desc;// + private String jk8ProductLine;// Ʒ + private String jk8EstStartDate;// Ԥƿʼʱ + private String jk8EstCompleteDate;// Ԥƽʱ + private String jk8ProjBudget;// Ԥ + private String jk8PhaseBudget;// ׶Ԥ + private String jk8ImplementBudget;// ִ + private String jk8ProjBudgetRatio;//ִ + private String jk8PhaseBudgetRatio;// ׶ִ + private String jk8HumanCost;//Ԥ + private String jk8ProjCoopForm;//Ŀʽ + private String jk8ProjSource;//ĿԴ + private String jk8ProjResForm;//Ŀɹʽ + private String jk8ExtExplain;//⹫ + + private String owning_user;// + private String owning_group;//ID + private String last_mod_user;//ϴ޸û + + //2017.10.10ӵ + private String JK8SubProject;//ĿĿ + private String jk8Phaseovertime;//׶Թرʱ + + //2018.2.28ӵ + private String jk8SystemEngineer;//ϵͳʦ + + + + public String getJk8SystemEngineer() { + return jk8SystemEngineer; + } + + public void setJk8SystemEngineer(String jk8SystemEngineer) { + this.jk8SystemEngineer = jk8SystemEngineer; + } + + public String getJk8Phaseovertime() { + return jk8Phaseovertime; + } + + public void setJk8Phaseovertime(String jk8Phasedovertime) { + this.jk8Phaseovertime = jk8Phasedovertime; + } + + public String getJK8SubProject() { + return JK8SubProject; + } + + public void setJK8SubProject(String jK8SubProject) { + JK8SubProject = jK8SubProject; + } + + public String getJk8ProjBudgetRatio() { + return jk8ProjBudgetRatio; + } + + public void setJk8ProjBudgetRatio(String jk8ProjBudgetRatio) { + this.jk8ProjBudgetRatio = jk8ProjBudgetRatio; + } + + public String getLast_mod_user() { + return last_mod_user; + } + + public void setLast_mod_user(String last_mod_user) { + this.last_mod_user = last_mod_user; + } + + public String getOwning_group() { + return owning_group; + } + + public void setOwning_group(String owning_group) { + this.owning_group = owning_group; + } + + public String getOwning_user() { + return owning_user; + } + + public void setOwning_user(String owning_user) { + this.owning_user = owning_user; + } + + public String getJk8ExtExplain() { + return jk8ExtExplain; + } + + public void setJk8ExtExplain(String jk8ExtExplain) { + this.jk8ExtExplain = jk8ExtExplain; + } + + public String getJk8ProjResForm() { + return jk8ProjResForm; + } + + public void setJk8ProjResForm(String jk8ProjResForm) { + this.jk8ProjResForm = jk8ProjResForm; + } + + public String getJk8ProjSource() { + return jk8ProjSource; + } + + public void setJk8ProjSource(String jk8ProjSource) { + this.jk8ProjSource = jk8ProjSource; + } + + public String getJk8ProjCoopForm() { + return jk8ProjCoopForm; + } + + public void setJk8ProjCoopForm(String jk8ProjCoopForm) { + this.jk8ProjCoopForm = jk8ProjCoopForm; + } + + public String getJk8HumanCost() { + return jk8HumanCost; + } + + public void setJk8HumanCost(String jk8HumanCost) { + this.jk8HumanCost = jk8HumanCost; + } + + public String getJk8PhaseBudgetRatio() { + return jk8PhaseBudgetRatio; + } + + public void setJk8PhaseBudgetRatio(String jk8PhaseBudgetRatio) { + this.jk8PhaseBudgetRatio = jk8PhaseBudgetRatio; + } + + public String getJk8ImplementBudget() { + return jk8ImplementBudget; + } + + public void setJk8ImplementBudget(String jk8ImplementBudget) { + this.jk8ImplementBudget = jk8ImplementBudget; + } + + public String getJk8PhaseBudget() { + return jk8PhaseBudget; + } + + public void setJk8PhaseBudget(String jk8PhaseBudget) { + this.jk8PhaseBudget = jk8PhaseBudget; + } + + public String getJk8ProjBudget() { + return jk8ProjBudget; + } + + public void setJk8ProjBudget(String jk8ProjBudget) { + this.jk8ProjBudget = jk8ProjBudget; + } + + public String getJk8EstCompleteDate() { + return jk8EstCompleteDate; + } + + public void setJk8EstCompleteDate(String jk8EstCompleteDate) { + this.jk8EstCompleteDate = jk8EstCompleteDate; + } + + public String getJk8EstStartDate() { + return jk8EstStartDate; + } + + public void setJk8EstStartDate(String jk8EstStartDate) { + this.jk8EstStartDate = jk8EstStartDate; + } + + public String getJk8ProductLine() { + return jk8ProductLine; + } + + public void setJk8ProductLine(String jk8ProductLine) { + this.jk8ProductLine = jk8ProductLine; + } + + public String getObject_desc() { + return object_desc; + } + + public void setObject_desc(String object_desc) { + this.object_desc = object_desc; + } + + public long getOa_id() { + return oa_id; + } + + public void setOa_id(long oa_id) { + this.oa_id = oa_id; + } + + public String getJk8ProjEndDate() { + return Jk8ProjEndDate; + } + + public void setJk8ProjEndDate(String jk8ProjEndDate) { + Jk8ProjEndDate = jk8ProjEndDate; + } + + public long getIdentity() { + return identity; + } + + public void setIdentity(long identity) { + this.identity = identity; + } + + public int getIs_effective() { + return is_effective; + } + + public void setIs_effective(int is_effective) { + this.is_effective = is_effective; + } + + public String getSystemTime() { + return SystemTime; + } + + public void setSystemTime(String systemTime) { + SystemTime = systemTime; + } + + public String getProject_id() { + return Project_id; + } + + public void setProject_id(String project_id) { + Project_id = project_id; + } + + public String getProject_name() { + return project_name; + } + + public void setProject_name(String project_name) { + this.project_name = project_name; + } + + public String getJk8ProjApproveDate() { + return Jk8ProjApproveDate; + } + + public void setJk8ProjApproveDate(String jk8ProjApproveDate) { + Jk8ProjApproveDate = jk8ProjApproveDate; + } + + public String getJk8ProjectState() { + return Jk8ProjectState; + } + + public void setJk8ProjectState(String jk8ProjectState) { + Jk8ProjectState = jk8ProjectState; + } + + public String getJk8ProjectManager() { + return Jk8ProjectManager; + } + + public void setJk8ProjectManager(String jk8ProjectManager) { + Jk8ProjectManager = jk8ProjectManager; + } + + public String getJk8ProductManager() { + return Jk8ProductManager; + } + + public void setJk8ProductManager(String jk8ProductManager) { + Jk8ProductManager = jk8ProductManager; + } + + public String getJk8ProductDirector() { + return Jk8ProductDirector; + } + + public void setJk8ProductDirector(String jk8ProductDirector) { + Jk8ProductDirector = jk8ProductDirector; + } + + public String getJk8ProjectLevel() { + return Jk8ProjectLevel; + } + + public void setJk8ProjectLevel(String jk8ProjectLevel) { + Jk8ProjectLevel = jk8ProjectLevel; + } + + public String getJk8ProjectType() { + return Jk8ProjectType; + } + + public void setJk8ProjectType(String jk8ProjectType) { + Jk8ProjectType = jk8ProjectType; + } + + public String getJk8BussinessUnit() { + return Jk8BussinessUnit; + } + + public void setJk8BussinessUnit(String jk8BussinessUnit) { + Jk8BussinessUnit = jk8BussinessUnit; + } + + public String getJk8IsResearchProj() { + return Jk8IsResearchProj; + } + + public void setJk8IsResearchProj(String jk8IsResearchProj) { + Jk8IsResearchProj = jk8IsResearchProj; + } + + // public int getTask_id() { + // return task_id; + // } + // public void setTask_id(int task_id) { + // this.task_id = task_id; + // } + public String getTask_id() { + return task_id; + } + + public void setTask_id(String task_id) { + this.task_id = task_id; + } + + public String getSchedualTask() { + return schedualTask; + } + + public void setSchedualTask(String schedualTask) { + this.schedualTask = schedualTask; + } + +} diff --git a/src/com/connor/jk/plm/TC_OA_Integration/Integration_Action.java b/src/com/connor/jk/plm/TC_OA_Integration/Integration_Action.java new file mode 100644 index 0000000..9b836ae --- /dev/null +++ b/src/com/connor/jk/plm/TC_OA_Integration/Integration_Action.java @@ -0,0 +1,1490 @@ +package com.connor.jk.plm.TC_OA_Integration; + +import java.io.IOException; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.text.DateFormat; +import java.text.DecimalFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +//import java.util.HashMap; +import java.util.List; +//import java.util.Map; +import java.util.Map; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.connor.jk.plm.DbomToEbom.ChangeDbomUtil; +import com.squareup.okhttp.MediaType; +import com.squareup.okhttp.OkHttpClient; +import com.squareup.okhttp.Request; +import com.squareup.okhttp.RequestBody; +import com.squareup.okhttp.Response; +//import com.connor.jk.plm.report.SqlUtil; +//import com.connor.jk.plm.view.MaterialStorageBean; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.common.actions.AbstractAIFAction; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponent; +//import com.teamcenter.rac.kernel.TCComponentGroup; +//import com.teamcenter.rac.kernel.TCComponentGroupMember; +//import com.teamcenter.rac.kernel.TCComponentGroupType; +import com.teamcenter.rac.kernel.TCComponentProject; +import com.teamcenter.rac.kernel.TCComponentProjectSmartFolder; +import com.teamcenter.rac.kernel.TCComponentSchedule; +import com.teamcenter.rac.kernel.TCComponentUser; +//import com.teamcenter.rac.kernel.TCComponentUserType; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.stylesheet.PropertyDateButton; +//import com.teamcenter.rac.kernel.UserList; +import com.teamcenter.rac.util.MessageBox; + +import oracle.jdbc.driver.Message; + +public class Integration_Action extends AbstractAIFAction { + private AbstractAIFApplication arg0; + private TCSession session; + private TCPreferenceService preferenceService; + private InterfaceAIFComponent target; + private IntegrationBean proBean; + private IntegrationBean schBean; + private List projectLIst = new ArrayList(); + private List schedualLIst = new ArrayList(); + TCComponentProject project = null; + private String systemTime; + ProgressBarThread wait; + SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm"); + private Map userid_nameMap=new HashMap<>(); + //2018.5.21 + private Map productManager_name_idMap=new HashMap<>(); + private Map systemEngineer_name_idMap=new HashMap<>(); + private Map productDirector_name_idMap=new HashMap<>(); + //2020.03.03 + private Map projectManager_name_idMap=new HashMap<>(); + + public Integration_Action(AbstractAIFApplication arg0, String arg2) { + super(arg0, arg2); + this.arg0 = arg0; + this.session = (TCSession) arg0.getSession(); + target = arg0.getTargetComponent(); + userid_nameMap=findPeople3(userid_nameMap); + } + + String jk8ProjectManager = ""; + String jk8ProductManager = ""; + String jk8ProductDirector = ""; + String jk8SystemEngineer=""; + + @Override + public void run() { + + // findPeople1(); + // if(true){ + // return; + // } + + + + preferenceService = session.getPreferenceService(); + String[] connect = preferenceService.getStringValue("jk_tc_oa_integration").split("&"); + String[] Jk8ProjectStatus = preferenceService.getStringValue("jk_ Jk8ProjectState").split(",");// Ŀ״̬ + String[] Jk8ProjectLevel = preferenceService.getStringValue("jk_ Jk8ProjectLevel").split(";");// Ŀȼ + String[] Jk8ProjectType = preferenceService.getStringValue("jk_ Jk8ProjectType").split(",");// Ŀ + String[] Jk8BussinessUnit = preferenceService.getStringValue("jk_ Jk8BussinessUnit").split(",");// ҵ + String[] Jk8IsResearchProj = preferenceService.getStringValue("jk_ Jk8IsResearchProj").split(",");// ǷзĿ + String[] Jk8ProductorDirector = preferenceService.getStringValue("jk8ProductDirector").split(",");// Ʒܼѡ + for (int i = 0; i < Jk8ProductorDirector.length; i++) { + String name=Jk8ProductorDirector[i].split("-")[1]; + String id=Jk8ProductorDirector[i].split("-")[0]; + productDirector_name_idMap.put(name, id); + + } + String[] Jk8ProductorManager = preferenceService.getStringValue("jk8ProductManager").split(",");// Ʒѡ + for (int i = 0; i < Jk8ProductorManager.length; i++) { + String name=Jk8ProductorManager[i].split("-")[1]; + String id=Jk8ProductorManager[i].split("-")[0]; + productManager_name_idMap.put(name, id); + } + //2019.07.08ϵͳʦ + String[] JK8SystemEngineer = preferenceService.getStringValue("jk8SystemEngineer").split(",");// Ʒѡ + for (int i = 0; i < JK8SystemEngineer.length; i++) { + String name=JK8SystemEngineer[i].split("-")[1]; + String id=JK8SystemEngineer[i].split("-")[0]; + systemEngineer_name_idMap.put(name, id); + } + //2020.03.03ĿprojectManager_name_idMap + String[] JK8ProjectManager=preferenceService.getStringValue("jk8ProjectManager").split(",");// Ŀѡ + for (int i = 0; i < JK8ProjectManager.length; i++) { + String name=JK8ProjectManager[i].split("-")[1]; + String id=JK8ProjectManager[i].split("-")[0]; + projectManager_name_idMap.put(name, id); + } + String driver_temp = ""; + String url = ""; + String dbName = ""; + String dbPassword = ""; + dbName = connect[0]; + dbPassword = connect[1]; + url = connect[2]; + driver_temp = connect[3]; + systemTime = sdf1.format(new Date()); + + + + + try { + project = (TCComponentProject) target; + System.out.println(project.getTCProperty("jk8ProjectState").getDisplayValue()); + project.refresh();//ˢһ£debugģʽʱļָɻƳʱܸ + } catch (Exception e2) { + MessageBox.post("ѡĿв", "", MessageBox.INFORMATION); + return; + } + if (project == null) { + MessageBox.post("ѡĿв", "", MessageBox.INFORMATION); + return; + } + + //TODO ڴ֮ǰж֣оͲͬ +// 1.ǷǶʱ +// 2һʱǷָɶĿ +// 3.ݿĿʱϢǰ£ĿµʱDzDZƳˣĿĿûиĿϢͬĿûиĿͬĿĿĿ񣬵ûʱͲͬ + //֮ͬǰУ + boolean isSynchronize=true; + isSynchronize=check(isSynchronize,project,dbName, dbPassword, url, driver_temp); + System.out.println("------------------------"+isSynchronize); + if(isSynchronize==false) { + return; + } +// if(true) { +// return; +// } + + wait = new ProgressBarThread("ͬ", "ִУԵ..."); + wait.start(); + try { + proBean = new IntegrationBean(); + + DecimalFormat df = new DecimalFormat("#.00"); + if (project.getTCProperty("project_id").getStringValue() != null) { + long identity_1 = 0; + String identity = project.getTCProperty("project_id").getStringValue(); + if (identity.contains("-")) { + identity = identity.replaceAll("-", ""); + } + if (identity.contains("A")) { + identity = identity.replaceAll("A", "65"); + } + if (identity.contains("B")) { + identity = identity.replaceAll("B", "66"); + } + if (identity.contains("C")) { + identity = identity.replaceAll("C", "67"); + } + if (identity.contains("D")) { + identity = identity.replaceAll("D", "68"); + } + if (identity.contains("E")) { + identity = identity.replaceAll("E", "69"); + } + if (identity.contains("F")) { + identity = identity.replaceAll("F", "70"); + } + if (identity.contains("G")) { + identity = identity.replaceAll("G", "71"); + } + if (identity.contains("H")) { + identity = identity.replaceAll("H", "72"); + } + if (identity.contains("I")) { + identity = identity.replaceAll("I", "73"); + } + if (identity.contains("J")) { + identity = identity.replaceAll("J", "74"); + } + if (identity.contains("K")) { + identity = identity.replaceAll("K", "75"); + } + if (identity.contains("L")) { + identity = identity.replaceAll("L", "76"); + } + if (identity.contains("M")) { + identity = identity.replaceAll("M", "77"); + } + if (identity.contains("N")) { + identity = identity.replaceAll("N", "78"); + } + if (identity.contains("O")) { + identity = identity.replaceAll("O", "79"); + } + if (identity.contains("P")) { + identity = identity.replaceAll("P", "80"); + } + if (identity.contains("Q")) { + identity = identity.replaceAll("Q", "81"); + } + if (identity.contains("R")) { + identity = identity.replaceAll("R", "82"); + } + if (identity.contains("S")) { + identity = identity.replaceAll("S", "83"); + } + if (identity.contains("T")) { + identity = identity.replaceAll("T", "84"); + } + if (identity.contains("U")) { + identity = identity.replaceAll("U", "85"); + } + if (identity.contains("V")) { + identity = identity.replaceAll("V", "86"); + } + if (identity.contains("W")) { + identity = identity.replaceAll("W", "87"); + } + if (identity.contains("X")) { + identity = identity.replaceAll("X", "88"); + } + if (identity.contains("Y")) { + identity = identity.replaceAll("Y", "89"); + } + if (identity.contains("Z")) { + identity = identity.replaceAll("Z", "90"); + } + identity_1 =Long.parseLong(identity.trim()); + // if (identity.contains("-")) { + // identity_1 = Integer.valueOf(identity.replaceAll("-", "")); + // } else { + // identity_1 = Integer.valueOf(identity.trim()); + // } + System.out.println("identity_1--------------->" + identity_1); + proBean.setIdentity(identity_1);// Ŀʶ + //2017.9.15 ¼oa_id + + proBean.setOa_id(identity_1); + } else { + MessageBox.post("project_idԲΪ", "", MessageBox.INFORMATION); + return; + } + + //2017.9.26 ӣƷߡԤƿʼʱ䡢Ԥƽʱ䡢Ԥ㡢׶Ԥ㡢ִСִʡ׶ִʡԤĿ״̬ + // + if(project.getTCProperty("object_desc").getStringValue() != null) { + proBean.setObject_desc(project.getTCProperty("object_desc").getStringValue()); + }else { + proBean.setObject_desc(""); + } + //Ʒ + if (project.getTCProperty("jk8ProductLine").getDisplayValue() != null) { + proBean.setJk8ProductLine(project.getTCProperty("jk8ProductLine").getDisplayValue()); + }else { + proBean.setJk8ProductLine(""); + } + //Ԥƿʼʱ + if (project.getTCProperty("jk8EstStartDate").getDateValue() != null) { + Date date = project.getTCProperty("jk8EstStartDate").getDateValue(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + proBean.setJk8EstStartDate(sdf.format(date));// + } else { + proBean.setJk8EstStartDate("");// + } + //׶ʱ + if (project.getTCProperty("jk8Phaseovertime").getDateValue() != null) { + Date date = project.getTCProperty("jk8Phaseovertime").getDateValue(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + proBean.setJk8Phaseovertime(sdf.format(date));// + } else { + proBean.setJk8Phaseovertime("");// + } + System.out.println(proBean.getObject_desc()+"\n"+proBean.getJk8ProductLine()+"\n"+proBean.getJk8EstStartDate()); + //Ԥƽʱ + if (project.getTCProperty("jk8EstCompleteDate").getDateValue() != null) { + Date date = project.getTCProperty("jk8EstCompleteDate").getDateValue(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + proBean.setJk8EstCompleteDate(sdf.format(date));// + } else { + proBean.setJk8EstCompleteDate("");// + } + try { + //Ԥ + if (project.getTCProperty("jk8ProjBudget").getDoubleValue() != 0) { + proBean.setJk8ProjBudget(df.format(project.getTCProperty("jk8ProjBudget").getDoubleValue())+""); + }else { + proBean.setJk8ProjBudget(""); + } + } catch (Exception e1) { + e1.printStackTrace(); + } + //׶Ԥ + if (project.getTCProperty("jk8PhaseBudget").getDoubleValue() != 0) { + proBean.setJk8PhaseBudget(df.format(project.getTCProperty("jk8PhaseBudget").getDoubleValue())+""); + }else { + proBean.setJk8PhaseBudget(""); + } + System.out.println(proBean.getJk8EstCompleteDate()+"\n"+proBean.getJk8ProjBudget()+"\n"+proBean.getJk8PhaseBudget()); + //ִ + if (project.getTCProperty("jk8ImplementBudget").getDoubleValue() != 0) { + proBean.setJk8ImplementBudget(df.format(project.getTCProperty("jk8ImplementBudget").getDoubleValue())+""); + }else { + proBean.setJk8ImplementBudget(""); + } + //ִ + + if (project.getTCProperty("jk8ProjBudgetRatio").getDoubleValue() != 0) { + proBean.setJk8ProjBudgetRatio(df.format(project.getTCProperty("jk8ProjBudgetRatio").getDoubleValue())+""); + }else { + proBean.setJk8ProjBudgetRatio(""); + } + //׶ִ + if (project.getTCProperty("jk8PhaseBudgetRatio").getDoubleValue() != 0) { + proBean.setJk8PhaseBudgetRatio(df.format(project.getTCProperty("jk8PhaseBudgetRatio").getDoubleValue())+""); + }else { + proBean.setJk8PhaseBudgetRatio(""); + } + //Ԥ + if (project.getTCProperty("jk8HumanCost").getDoubleValue() != 0) { + proBean.setJk8HumanCost(df.format(project.getTCProperty("jk8HumanCost").getDoubleValue())+""); + }else { + proBean.setJk8HumanCost(""); + } + System.out.println(proBean.getJk8ImplementBudget()+"\n"+proBean.getJk8PhaseBudgetRatio()+"\n"+proBean.getJk8HumanCost()); + System.out.println(proBean.getJk8ProjBudgetRatio()); + //Ŀ״̬ + if (project.getTCProperty("jk8ProjectState").getDisplayValue() != null) { + proBean.setJk8ProjectState(project.getTCProperty("jk8ProjectState").getDisplayValue()); + }else { + proBean.setJk8ProjectState(""); + } + System.out.println(proBean.getJk8ProjectState()); + //2017.9.26ӣĿʽĿԴĿɹʽ⹫ + //Ŀʽ + if (project.getTCProperty("jk8ProjCoopForm").getDisplayValue() != null) { + proBean.setJk8ProjCoopForm(project.getTCProperty("jk8ProjCoopForm").getDisplayValue()); + }else { + proBean.setJk8ProjCoopForm(""); + } + //ĿԴ + if (project.getTCProperty("jk8ProjSource").getDisplayValue() != null) { + proBean.setJk8ProjSource(project.getTCProperty("jk8ProjSource").getDisplayValue()); + }else { + proBean.setJk8ProjSource(""); + } + //Ŀɹʽ + if (project.getTCProperty("jk8ProjResForm").getDisplayValue() != null) { + proBean.setJk8ProjResForm(project.getTCProperty("jk8ProjResForm").getDisplayValue()); + }else { + proBean.setJk8ProjResForm(""); + } + //⹫ + if (project.getTCProperty("jk8ExtExplain").getStringValue() != null) { + proBean.setJk8ExtExplain(project.getTCProperty("jk8ExtExplain").getStringValue()); + }else { + proBean.setJk8ExtExplain(""); + } + System.out.println(proBean.getJk8ProjCoopForm()+"\n"+proBean.getJk8ProjSource()+"\n"+proBean.getJk8ProjResForm()+"\n"+proBean.getJk8ExtExplain()); + + //2017.9.26 ӣߡIDϴ޸û + //ߡ + if (project.getTCProperty("owning_user").getDisplayValue() != null) { + proBean.setOwning_user(project.getTCProperty("owning_user").getDisplayValue()); + }else { + proBean.setOwning_user(""); + } + //ID + if (project.getTCProperty("owning_group").getDisplayValue() != null) { + proBean.setOwning_group(project.getTCProperty("owning_group").getDisplayValue()); + }else { + proBean.setOwning_group(""); + } + //ϴ޸û + if (project.getTCProperty("last_mod_user").getDisplayValue() != null) { + proBean.setLast_mod_user(project.getTCProperty("last_mod_user").getDisplayValue()); + }else { + proBean.setLast_mod_user(""); + } + + //2017.10.10ӣĿĿ׶ʱ(jk8Phaseovertime) + if (project.getTCProperty("JK8SubProject").getReferenceValueArray().length>0) { + TCComponent[] component=project.getTCProperty("JK8SubProject").getReferenceValueArray(); + String SubProject=""; + if(component.length>0) { + //ݿ + SqlUtil.getConnection(dbName, dbPassword, url, driver_temp); + String searchQuestion = ""; + + for (int i = 0; i < component.length; i++) { + String SubProjectId=((TCComponentProject)component[i]).getTCProperty("project_id").getStringValue(); + System.out.println("ĿID------------------"+SubProjectId); + searchQuestion =SqlUtil.getSelectSql_1("TC_project_info", "PROJECT_ID", SubProjectId); + ResultSet set = SqlUtil.read(searchQuestion);// ִ + System.out.println(searchQuestion); + set = SqlUtil.read(searchQuestion);// ִ + if (set.next()) { + SubProject=SubProject+SubProjectId+","; + } + + } + //رݿ + SqlUtil.freeAll();// TODO ͷԴǷҪ + } + if(SubProject.length()>0) { + SubProject=SubProject.substring(0, SubProject.length()-1); + System.out.println("Ŀ------------------"+SubProject); + } + proBean.setJK8SubProject(SubProject); + System.out.println("Ŀ2------------------"+SubProject); + }else { + proBean.setJK8SubProject(""); + } + System.out.println(proBean.getOwning_user()+"\n"+proBean.getOwning_group()+"\n"+proBean.getLast_mod_user()); +// if(true) { +// return; +// } + if (project.getTCProperty("project_id").getStringValue() != null) { + proBean.setProject_id(project.getTCProperty("project_id").getStringValue());// Ŀ + } else { + proBean.setProject_id("");// Ŀ + } + if (project.getTCProperty("object_name").getStringValue() != null) { + proBean.setProject_name(project.getTCProperty("object_name").getStringValue());// Ŀproject_name//object_name + } else { + proBean.setProject_name("");// Ŀproject_name//object_name + } + if (project.getTCProperty("jk8ProjApproveDate").getDateValue() != null) { + Date date = project.getTCProperty("jk8ProjApproveDate").getDateValue(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + proBean.setJk8ProjApproveDate(sdf.format(date));// ʱ + } else { + proBean.setJk8ProjApproveDate("");// ʱ + } + if (project.getTCProperty("jk8ProjEndDate").getDateValue() != null) { + Date date = project.getTCProperty("jk8ProjEndDate").getDateValue(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + proBean.setJk8ProjEndDate(sdf.format(date));// ʱ + } else { + proBean.setJk8ProjEndDate("");// ʱ + } + + if (project.getTCProperty("jk8ProjectState").getDisplayValue() != null) { + String jk8ProjectState = project.getTCProperty("jk8ProjectState").getDisplayValue(); + for (int i = 0; i < Jk8ProjectStatus.length; i++) { + if (Jk8ProjectStatus[i].split("-")[1].equals(jk8ProjectState)) { + jk8ProjectState = Jk8ProjectStatus[i].split("-")[0]; + } + } + proBean.setJk8ProjectState(jk8ProjectState);// ״̬ + } else { + proBean.setJk8ProjectState("");// ״̬ + } + //2020.03.03 projectManager_name_idMap + if (project.getTCProperty("jk8ProjectManager").getStringValue() != null) { + // TODO ȡlovֵӦ֯гԱڴŵOA + jk8ProjectManager = project.getTCProperty("jk8ProjectManager").getStringValue(); +// jk8ProjectManager = findPeople1(jk8ProjectManager); + jk8ProjectManager = findPeople2("jk8ProjectManager",jk8ProjectManager,projectManager_name_idMap); + proBean.setJk8ProjectManager(jk8ProjectManager);// Ŀ + } else { + proBean.setJk8ProjectManager("");// Ŀ + + } + //2018.5.21 ƷܼͲƷдʽı + if (project.getTCProperty("jk8ProductManager").getStringValue() != null) { + jk8ProductManager = project.getTCProperty("jk8ProductManager").getStringValue(); +// jk8ProductManager = findPeople1(jk8ProductManager); + jk8ProductManager = findPeople2("jk8ProductManager",jk8ProductManager,productManager_name_idMap); + + proBean.setJk8ProductManager(jk8ProductManager);// Ʒ + } else { + proBean.setJk8ProductManager("");// Ʒ + } + //2018.2.28 ϵͳʦjk8SystemEngineer + //2019.7.8ϵͳʦijѡõķʽ + if (project.getTCProperty("jk8SystemEngineer").getStringValue() != null) { + jk8SystemEngineer = project.getTCProperty("jk8SystemEngineer").getStringValue(); +// jk8SystemEngineer = findPeople1(jk8SystemEngineer); + /*if(userid_nameMap.containsKey(jk8SystemEngineer)) { + jk8SystemEngineer=userid_nameMap.get(jk8SystemEngineer); + }*/ + jk8SystemEngineer = findPeople2("jk8SystemEngineer",jk8SystemEngineer,systemEngineer_name_idMap); + proBean.setJk8SystemEngineer(jk8SystemEngineer);// ϵͳʦ + } else { + proBean.setJk8SystemEngineer("");// ϵͳʦ + } + if (project.getTCProperty("jk8ProductDirector").getStringValue() != null) { + jk8ProductDirector = project.getTCProperty("jk8ProductDirector").getStringValue(); +// jk8ProductDirector = findPeople1(jk8ProductDirector); + jk8ProductDirector = findPeople2("jk8ProductDirector",jk8ProductDirector,productDirector_name_idMap); + proBean.setJk8ProductDirector(jk8ProductDirector);// Ʒܼ + } else { + proBean.setJk8ProductDirector("");// Ʒܼ + } + if (project.getTCProperty("jk8ProjectLevel").getDisplayValue() != null) { + String jk8ProjectLevel = project.getTCProperty("jk8ProjectLevel").getDisplayValue(); + System.out.println("jk8ProjectLevel-------------->" + jk8ProjectLevel); + for (int i = 0; i < Jk8ProjectLevel.length; i++) { + if (Jk8ProjectLevel[i].split("-")[1].equals(jk8ProjectLevel)) { + jk8ProjectLevel = Jk8ProjectLevel[i].split("-")[0]; + } + } + proBean.setJk8ProjectLevel(jk8ProjectLevel);// Ŀȼ + + } else { + proBean.setJk8ProjectLevel("");// Ŀȼ + } + if (project.getTCProperty("jk8ProjectType").getDisplayValue() != null) { + String jk8ProjectType = project.getTCProperty("jk8ProjectType").getDisplayValue(); + for (int i = 0; i < Jk8ProjectType.length; i++) { + if (Jk8ProjectType[i].split("-")[1].equals(jk8ProjectType)) { + jk8ProjectType = Jk8ProjectType[i].split("-")[0]; + } + } + proBean.setJk8ProjectType(jk8ProjectType);// Ŀ + } else { + proBean.setJk8ProjectType("");// Ŀ + + } + if (project.getTCProperty("jk8BusinessUnit").getDisplayValue() != null) { + String jk8BusinessUnit = project.getTCProperty("jk8BusinessUnit").getDisplayValue(); + for (int i = 0; i < Jk8BussinessUnit.length; i++) { + if (Jk8BussinessUnit[i].split("-")[1].equals(jk8BusinessUnit)) { + jk8BusinessUnit = Jk8BussinessUnit[i].split("-")[0]; + } + } + proBean.setJk8BussinessUnit(jk8BusinessUnit);// ҵ + } else { + proBean.setJk8BussinessUnit("");// ҵ + + } + if (project.getTCProperty("jk8IsResearchProj").getDisplayValue() != null) { + String jk8IsResearchProj = project.getTCProperty("jk8IsResearchProj").getDisplayValue(); + for (int i = 0; i < Jk8IsResearchProj.length; i++) { + if (Jk8IsResearchProj[i].split("-")[1].equals(jk8IsResearchProj)) { + jk8IsResearchProj = Jk8IsResearchProj[i].split("-")[0]; + } + } + proBean.setJk8IsResearchProj(jk8IsResearchProj);// ǷĿ + } else { + proBean.setJk8IsResearchProj("");// ǷĿ + } + proBean.setSystemTime(systemTime);// ϵͳʱ + System.out.println(proBean.getJk8BussinessUnit() + "\n" + proBean.getJk8IsResearchProj() + "\n" + + proBean.getJk8ProductDirector() + "\n" + proBean.getJk8ProductManager() + "\n" + + proBean.getJk8ProjApproveDate() + "\n" + proBean.getJk8ProjectLevel() + "\n" + + proBean.getJk8ProjectManager() + "\n" + proBean.getJk8ProjectState() + "\n" + + proBean.getJk8ProjectType() + "\n" + proBean.getProject_id() + "\n" + proBean.getProject_name() + + "\n" + proBean.getSystemTime() + "\n"); + projectLIst.add(proBean); + + // TODO УǷѾд + if (proBean.getJk8IsResearchProj().trim().equals("0")) { + if (proBean.getJk8BussinessUnit().trim().equals("") + // ||proBean.getJk8ProjEndDate().trim().equals("") + // || proBean.getJk8IsResearchProj().trim().equals("") + || proBean.getJk8ProductDirector().trim().equals("") + || proBean.getJk8SystemEngineer().trim().equals("") + || proBean.getJk8ProductManager().trim().equals("") + || proBean.getJk8ProjApproveDate().trim().equals("") + || proBean.getJk8ProjectLevel().trim().equals("") + || proBean.getJk8ProjectManager().trim().equals("") + || proBean.getJk8ProjectState().trim().equals("") + || proBean.getJk8ProjectType().trim().equals("") || proBean.getProject_id().trim().equals("") + || proBean.getProject_name().trim().equals("") || proBean.getSystemTime().trim().equals("") + || project.getProperty("jk8EstCompleteDate").equals("") + || project.getProperty("jk8ProductLine").equals("")) { + + MessageBox.post("ȷҪݵϢΪ", "", MessageBox.INFORMATION); + wait.setBool(true); + wait.interrupt(); + return; + } + } else if (proBean.getJk8IsResearchProj().trim().equals("1")) { + if (proBean.getJk8BussinessUnit().trim().equals("") + // ||proBean.getJk8ProjEndDate().trim().equals("") + || proBean.getJk8IsResearchProj().trim().equals("") + // ||proBean.getJk8ProductDirector().trim().equals("") + // ||proBean.getJk8ProductManager().trim().equals("") + || proBean.getJk8ProjApproveDate().trim().equals("") + || proBean.getJk8ProjectLevel().trim().equals("") + || proBean.getJk8ProjectManager().trim().equals("") + || proBean.getJk8ProjectState().trim().equals("") + || proBean.getJk8ProjectType().trim().equals("") || proBean.getProject_id().trim().equals("") + || proBean.getProject_name().trim().equals("") || proBean.getSystemTime().trim().equals("")) { + wait.setBool(true); + wait.interrupt(); + MessageBox.post("ȷҪݵϢΪ", "", MessageBox.INFORMATION); + return; + } + } + if (proBean.getJk8IsResearchProj().trim().equals("")) { + wait.setBool(true); + wait.interrupt(); + MessageBox.post("ȷҪݵϢΪ", "", MessageBox.INFORMATION); + return; + } + if (proBean.getJk8ProductDirector().trim().equals("TC޴˹")) { + MessageBox.post("ƷܼûTC˺ţĿͬʧ", "", MessageBox.INFORMATION); + wait.setBool(true); + wait.interrupt(); + return; + } + if (proBean.getJk8ProductManager().trim().equals("TC޴˹")) { + System.out.println("Ʒ޹"); + MessageBox.post("ƷûTC˺ţĿͬʧ", "", MessageBox.INFORMATION); + wait.setBool(true); + wait.interrupt(); + return; + } + //2018.2.28 + if (proBean.getJk8SystemEngineer().trim().equals("TC޴˹")) { + System.out.println("ϵͳʦ޹"); + MessageBox.post("ϵͳʦûTC˺ţĿͬʧ", "", MessageBox.INFORMATION); + wait.setBool(true); + wait.interrupt(); + return; + } + if (proBean.getJk8ProjectManager().trim().equals("TC޴˹")) { + MessageBox.post("ĿûTC˺ţĿͬʧ", "", MessageBox.INFORMATION); + wait.setBool(true); + wait.interrupt(); + return; + } + + // TODO ĿͬҪݿѯǷѴڸü¼Dzڣ¼ڣ + // һǣĿʱӽôһʱͬ + SqlUtil.getConnection(dbName, dbPassword, url, driver_temp); + +// //2017.10.18 Ҫ鿴мԹж +// String searchQuestion_TC_project_info="select * from TC_project_info "; +// ResultSet set_TC_project_info = SqlUtil.read(searchQuestion_TC_project_info);// ִ +// set_TC_project_info.last(); // ƶһ +// int rowCount = set_TC_project_info.getRow(); // õǰкţ¼ +// +// String searchQuestion_TC_project_taskinfo="select * from TC_project_taskinfo "; +// ResultSet set_TC_project_taskinfo = SqlUtil.read(searchQuestion_TC_project_taskinfo);// ִ +// set_TC_project_taskinfo.last(); // ƶһ +// int rowCount1 = set_TC_project_taskinfo.getRow(); // õǰкţ¼ +// +// System.out.println("**********************************************************"); +// System.out.println("**********************************************************"); +// System.out.println("**********************************************************"); +// System.out.println("һͬ"+rowCount+"ݵTC_project_info"); +// System.out.println("һͬ"+rowCount1+"ݵTC_project_taskinfo"); +// System.out.println("**********************************************************"); +// System.out.println("**********************************************************"); +// System.out.println("**********************************************************"); + + String searchQuestion = ""; + + searchQuestion = SqlUtil.getSelectSql_1("TC_project_info", "PROJECT_ID", + projectLIst.get(0).getProject_id() == "" ? null : projectLIst.get(0).getProject_id()); + ResultSet set = SqlUtil.read(searchQuestion);// ִ + System.out.println(searchQuestion); + + try { + set = SqlUtil.read(searchQuestion);// ִ + + if (set.next()) { + String[] columns = new String[] { "PROJECT_NAME", "JK8PROJAPPROVEDATE", "jk8ProjEndDate", + "JK8PROJECTSTATE", "JK8PROJECTMANAGER", "JK8PRODUCTMANAGER", + //2018.2.28ϵͳʦ + "Jk8SYSTEMENGINEER", + "JK8PRODUCTDIRECTOR", + "JK8PROJECTLEVEL", "JK8PROJECTTYPE", "JK8BUSSINESSUNIT", "JK8ISRESEARCHPROJ", + "System_time","object_desc","jk8ProductLine","jk8EstStartDate", + "jk8EstCompleteDate","jk8ProjBudget","jk8PhaseBudget","jk8ImplementBudget","jk8ProjBudgetRatio", + "jk8PhaseBudgetRatio","jk8HumanCost","jk8ProjCoopForm","jk8ProjSource","jk8ProjResForm", + "jk8ExtExplain","owning_user","owning_group","last_mod_user","JK8SubProject","jk8Phaseovertime" }; + Object[] values = new Object[] { projectLIst.get(0).getProject_name(), + projectLIst.get(0).getJk8ProjApproveDate(), projectLIst.get(0).getJk8ProjEndDate(), + projectLIst.get(0).getJk8ProjectState(), projectLIst.get(0).getJk8ProjectManager(), + projectLIst.get(0).getJk8ProductManager(), + //2018.2.28ϵͳʦ + projectLIst.get(0).getJk8SystemEngineer(), + projectLIst.get(0).getJk8ProductDirector(), + projectLIst.get(0).getJk8ProjectLevel(), projectLIst.get(0).getJk8ProjectType(), + projectLIst.get(0).getJk8BussinessUnit(), projectLIst.get(0).getJk8IsResearchProj(), + projectLIst.get(0).getSystemTime(),projectLIst.get(0).getObject_desc(), + projectLIst.get(0).getJk8ProductLine(), + projectLIst.get(0).getJk8EstStartDate(), + projectLIst.get(0).getJk8EstCompleteDate(), + projectLIst.get(0).getJk8ProjBudget(), + projectLIst.get(0).getJk8PhaseBudget(), + projectLIst.get(0).getJk8ImplementBudget(), + projectLIst.get(0).getJk8ProjBudgetRatio(), + projectLIst.get(0).getJk8PhaseBudgetRatio(), + projectLIst.get(0).getJk8HumanCost(), + projectLIst.get(0).getJk8ProjCoopForm(), + projectLIst.get(0).getJk8ProjSource(), + projectLIst.get(0).getJk8ProjResForm(), + projectLIst.get(0).getJk8ExtExplain(), + projectLIst.get(0).getOwning_user(), + projectLIst.get(0).getOwning_group(), + projectLIst.get(0).getLast_mod_user(), + projectLIst.get(0).getJK8SubProject(), + projectLIst.get(0).getJk8Phaseovertime() + }; + searchQuestion = SqlUtil.getUpdate("TC_project_info", new String[] {"PROJECT_ID"}, + new String[] {projectLIst.get(0).getProject_id() == "" ? null : projectLIst.get(0).getProject_id()}, + columns, values); + System.out.println(searchQuestion); + try { + int num = SqlUtil.update(searchQuestion);// ִи + } catch (Exception e) { + MessageBox.post(e.getMessage(),"",MessageBox.INFORMATION); + return; + } + System.out.println("³ɹ"); + } else { + String[] column = new String[] { "oa_id","M_ID", "PROJECT_ID", "PROJECT_NAME", "JK8PROJAPPROVEDATE", + "jk8ProjEndDate", "JK8PROJECTSTATE", "JK8PROJECTMANAGER", "JK8PRODUCTMANAGER", + //2018.2.28ϵͳʦ + "Jk8SYSTEMENGINEER", + "JK8PRODUCTDIRECTOR", "JK8PROJECTLEVEL", "JK8PROJECTTYPE", "JK8BUSSINESSUNIT", + "JK8ISRESEARCHPROJ", "System_time","object_desc","jk8ProductLine","jk8EstStartDate", + "jk8EstCompleteDate","jk8ProjBudget","jk8PhaseBudget","jk8ImplementBudget","jk8ProjBudgetRatio", + "jk8PhaseBudgetRatio","jk8HumanCost","jk8ProjCoopForm","jk8ProjSource","jk8ProjResForm", + "jk8ExtExplain","owning_user","owning_group","last_mod_user","JK8SubProject","jk8Phaseovertime"}; + Object[] values = new Object[] { + projectLIst.get(0).getOa_id(),//2017.9.15 + projectLIst.get(0).getIdentity(), + projectLIst.get(0).getProject_id(), projectLIst.get(0).getProject_name(), + projectLIst.get(0).getJk8ProjApproveDate(), projectLIst.get(0).getJk8ProjEndDate(), + projectLIst.get(0).getJk8ProjectState(), projectLIst.get(0).getJk8ProjectManager(), + projectLIst.get(0).getJk8ProductManager(), + //2018.2.28ϵͳʦ + projectLIst.get(0).getJk8SystemEngineer(), + projectLIst.get(0).getJk8ProductDirector(), + projectLIst.get(0).getJk8ProjectLevel(), projectLIst.get(0).getJk8ProjectType(), + projectLIst.get(0).getJk8BussinessUnit(), projectLIst.get(0).getJk8IsResearchProj(), + projectLIst.get(0).getSystemTime(), + projectLIst.get(0).getObject_desc(), + projectLIst.get(0).getJk8ProductLine(), + projectLIst.get(0).getJk8EstStartDate(), + projectLIst.get(0).getJk8EstCompleteDate(), + projectLIst.get(0).getJk8ProjBudget(), + projectLIst.get(0).getJk8PhaseBudget(), + projectLIst.get(0).getJk8ImplementBudget(), + projectLIst.get(0).getJk8ProjBudgetRatio(), + projectLIst.get(0).getJk8PhaseBudgetRatio(), + projectLIst.get(0).getJk8HumanCost(), + projectLIst.get(0).getJk8ProjCoopForm(), + projectLIst.get(0).getJk8ProjSource(), + projectLIst.get(0).getJk8ProjResForm(), + projectLIst.get(0).getJk8ExtExplain(), + projectLIst.get(0).getOwning_user(), + projectLIst.get(0).getOwning_group(), + projectLIst.get(0).getLast_mod_user(), + projectLIst.get(0).getJK8SubProject(), + projectLIst.get(0).getJk8Phaseovertime() + }; + searchQuestion = SqlUtil.getInsertSql_1("TC_project_info", column, values); + System.out.println("--------------->"+searchQuestion); + int num = SqlUtil.update(searchQuestion);// ִ + System.out.println(num); + if (num > 0) { + System.out.println("ɹ"); + } + } + } catch (SQLException e) { + e.printStackTrace(); + } + + } catch (Exception e1) { + e1.printStackTrace(); + } + // System.out.println(project.getType()); + if (project.getType().equals("TC_Project")) { + // ĿµļУʱļ + TCProperty obj = null; + try { + obj = project.getTCProperty("project_data"); + System.out.println(obj == null); + // ȡĿµļ + TCComponent[] compS = obj.getReferenceValueArray();// Զɶ飬Ҳǻȡļ + // System.out.println("compS.length------>" + compS.length); + for (int i = 0; i < compS.length; i++) { + TCComponentProjectSmartFolder SmartFolder = (TCComponentProjectSmartFolder) compS[i]; + String name = SmartFolder.getTCProperty("folder_name").toString(); + if ((name.equals("ʱ")) || (name.contains("ʱ"))) { + // System.out.println("-------------3"); + TCProperty obj2 = SmartFolder.getTCProperty("project_data");// + TCComponent[] compS2 = obj2.getReferenceValueArray();// ʱļеʱ + if (compS2.length == 0) { + System.out.println("--------------------ûʱ-----------------------"); + schBean = new IntegrationBean(); + if (project.getTCProperty("project_id").getStringValue() != null) { + schBean.setProject_id(project.getTCProperty("project_id").getStringValue()); + } else { + schBean.setProject_id(""); + } + schBean.setSchedualTask(""); + //2018.1.26 +// schBean.setSchedualTask("1Ŀ2Ŀ3QAռ4QA"); + schBean.setTask_id("1"); + schBean.setSystemTime(systemTime); + schBean.setIs_effective(0);// TODO + // ûЧЧ߲Ҫȷ + schedualLIst.add(schBean); + + } else { + System.out.println("-----------------------ʱ------------------------------"); + for (int j = 0; j < compS2.length; j++) { + if (compS2[j].getType().equals("Schedule")) { + TCComponentSchedule Schedule = (TCComponentSchedule) compS2[j]; + TCComponent compS3 = Schedule.getReferenceProperty("fnd0SummaryTask");// ʱĻ + if (compS3 != null) { + cycle(compS3); + } + + } + } + } + compS2 = null; + } + } + } catch (Exception e) { + e.printStackTrace(); + } + // TODO ʱͬҪݿѯǷѴЩ¼Dzڣ¼ڣ + String[] columns = new String[] { "SCHEDUALTASK", "TASK_ID", "PROJECT_ID", "is_effective", "System_time" }; + Object[] values = null; + ResultSet set_0; + // SqlUtil.getConnection(); + String searchQuestion_0; + String searchQuestion; + try { + searchQuestion_0 = SqlUtil.getSelectSql_3("TC_project_taskinfo", "PROJECT_ID", + project.getTCProperty("project_id").getStringValue()); + System.out.println("------------------0000000000>" + searchQuestion_0); + set_0 = SqlUtil.read(searchQuestion_0); + String storeTaskidProject_Id = ""; + // TC_project_taskinfoдЩ + while (set_0.next()) { + // set.getInt("TASK_ID");//TC_project_taskinfoTASK_IDΪvalueͣintͻȡȡõݾͻȥ0 + storeTaskidProject_Id = storeTaskidProject_Id + set_0.getString("TASK_ID")+","+project.getTCProperty("project_id").getStringValue()+ ";" ; +// System.out.println("set_0.getString(\"PROJECT_ID\")----------->"+set_0.getString("PROJECT_ID")); + } + if(storeTaskidProject_Id.length()>2) {//ΪգͰһ;ȥ + storeTaskidProject_Id=storeTaskidProject_Id.substring(0, storeTaskidProject_Id.length()-1); + System.out.println("storeTaskidProject_Id------wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww--------->"+storeTaskidProject_Id); + } + String[] store=storeTaskidProject_Id.split(";"); + + // TODO ˣô죿ȶһڼдڣǷݿҲ,ھinsert + System.out.println("schedualLIst.size()------------->" + schedualLIst.size()); + for (int j = 0; j < schedualLIst.size(); j++) { + columns = new String[] { "SCHEDUALTASK", "TASK_ID", "PROJECT_ID", "is_effective", "System_time" }; + //һͬĿ(ܴʱҲܲʱ) + if (storeTaskidProject_Id == "" || store.length == 0) { + // ʱûģжһǷڣٴ + + for (int i = 0; i < schedualLIst.size(); i++) { + try { + // TODO ϣڲȥ֮ǰȲһûIDĿIDһµļ¼оûٲ + columns = new String[] { "TASK_ID", "PROJECT_ID" }; + values = new Object[] { schedualLIst.get(i).getTask_id(), + schedualLIst.get(i).getProject_id() }; + searchQuestion = SqlUtil.getSelectSql_2("TC_project_taskinfo", columns, values); + System.out.println(searchQuestion); + set_0 = SqlUtil.read(searchQuestion); + + if (!set_0.next()) { + System.out.println("---------------bingo-------------------"); + //idΪ1ֱӲ + if(schedualLIst.get(i).getTask_id().equals("1")) { + + columns = new String[] { "SCHEDUALTASK", "TASK_ID", "PROJECT_ID", "is_effective", + "System_time" }; + values = new Object[] { schedualLIst.get(i).getSchedualTask(), + schedualLIst.get(i).getTask_id(), schedualLIst.get(i).getProject_id(), + schedualLIst.get(i).getIs_effective(), + schedualLIst.get(i).getSystemTime() }; + searchQuestion = SqlUtil.getInsertSql_3("TC_project_taskinfo", columns, values); + System.out.println("----------111----->"+searchQuestion); + int num = SqlUtil.update(searchQuestion); + if (num > 0) { + System.out.println( + "ʱ:\"" + schedualLIst.get(i).getSchedualTask() + "\"Ѿӡͬ"); + } + } + //idΪ1ҪжһڵʱǷѾָɸĿʱͬ + else if(!schedualLIst.get(i).getTask_id().equals("1")) { + searchQuestion_0 = SqlUtil.getSelectSql_3("TC_project_taskinfo", "TASK_ID", + schedualLIst.get(i).getTask_id()+""); + System.out.println("----------------" + searchQuestion_0); + set_0 = SqlUtil.read(searchQuestion_0); + if(set_0.next()) { + wait.setBool(true); + wait.interrupt(); + String projectid=set_0.getString("project_id"); + MessageBox.post("ĿµʱĿ"+projectid+"ͬͬ˳","",MessageBox.INFORMATION); + return; + }else { + columns = new String[] { "SCHEDUALTASK", "TASK_ID", "PROJECT_ID", "is_effective", + "System_time" }; + values = new Object[] { schedualLIst.get(i).getSchedualTask(), + schedualLIst.get(i).getTask_id(), schedualLIst.get(i).getProject_id(), + schedualLIst.get(i).getIs_effective(), + schedualLIst.get(i).getSystemTime() }; + searchQuestion = SqlUtil.getInsertSql_3("TC_project_taskinfo", columns, values); + System.out.println("----------111----->"+searchQuestion); + int num = SqlUtil.update(searchQuestion); + if (num > 0) { + System.out.println( + "ʱ:\"" + schedualLIst.get(i).getSchedualTask() + "\"Ѿӡͬ"); + } + + } + } + + } + + } catch (Exception e) { + MessageBox.post("ͬʧܣͬ!", "", MessageBox.INFORMATION); + e.printStackTrace(); + return; + } // ִ + } + break; + } + } + + + int count1 = 1;// + String[] splitTaskIdProjectId=null; + String taskIdString=""; + String projectIdString=""; + for (int j = 0; j < schedualLIst.size(); j++) { + if(store.length>0&&!storeTaskidProject_Id.equals("")) { + + for (int i = 0; i < store.length; i++) { +// System.out.println("store.length---->"+store.length); +// System.out.println("store[" + i + "]------>" + store[i]); + splitTaskIdProjectId=store[i].split(","); + taskIdString=splitTaskIdProjectId[0]; +// System.out.println("taskIdString--------------"+taskIdString); + projectIdString=splitTaskIdProjectId[1]; + // ,¸¼гidֶεֵ + if (taskIdString.equals(schedualLIst.get(j).getTask_id() + "")) { + columns = new String[] { "SCHEDUALTASK", "TASK_ID", "PROJECT_ID", "is_effective", + "System_time" }; + values = new Object[] { schedualLIst.get(j).getSchedualTask(), + schedualLIst.get(j).getTask_id(), schedualLIst.get(j).getProject_id(), + schedualLIst.get(j).getIs_effective(), schedualLIst.get(j).getSystemTime() }; + searchQuestion = SqlUtil.getUpdate("TC_project_taskinfo", new String[] {"TASK_ID","PROJECT_ID"}, new String[] {schedualLIst.get(j).getTask_id() +"",schedualLIst.get(j).getProject_id()}, columns, + values); + System.out.println("----------------22222>"+searchQuestion); + int num = SqlUtil.update(searchQuestion);// ִ + if (num > 0) { + } else { + MessageBox.post( + schedualLIst.get(j).getTask_id() + "" + + schedualLIst.get(j).getSchedualTask() + "ͬʧܣ", + "", MessageBox.ERROR); + return; + } + break; + } + count1++; + } + // ǰʱеݿûУǾͲ,󣬰ĬϵġġǷЧΪ1 + if (count1 > store.length) { + + // ʱûģжһǷڣٴ + + + // TODO ڲȥ֮ǰȲһûIDĿIDһµļ¼оûٲ + columns = new String[] { "TASK_ID", "PROJECT_ID" }; + values = new Object[] { schedualLIst.get(j).getTask_id(), + schedualLIst.get(j).getProject_id() }; + searchQuestion = SqlUtil.getSelectSql_2("TC_project_taskinfo", columns, values); + System.out.println(searchQuestion); + set_0 = SqlUtil.read(searchQuestion); + + + if (!set_0.next()) { + System.out.println("---------------bingo-------------------"); + //idΪ1ֱӲ + if(schedualLIst.get(j).getTask_id().equals("1")) { + + columns = new String[] { "SCHEDUALTASK", "TASK_ID", "PROJECT_ID", "is_effective", + "System_time" }; + values = new Object[] { schedualLIst.get(j).getSchedualTask(), + schedualLIst.get(j).getTask_id(), schedualLIst.get(j).getProject_id(), + schedualLIst.get(j).getIs_effective(), + schedualLIst.get(j).getSystemTime() }; + searchQuestion = SqlUtil.getInsertSql_3("TC_project_taskinfo", columns, values); + System.out.println("----------111----->"+searchQuestion); + int num = SqlUtil.update(searchQuestion); + if (num > 0) { + System.out.println( + "ʱ:\"" + schedualLIst.get(j).getSchedualTask() + "\"Ѿӡͬ"); + } + } + //idΪ1ҪжһڵʱǷѾָɸĿʱͬ + else if(!schedualLIst.get(j).getTask_id().equals("1")) { + searchQuestion_0 = SqlUtil.getSelectSql_3("TC_project_taskinfo", "TASK_ID", + schedualLIst.get(j).getTask_id()+""); + System.out.println("----------------" + searchQuestion_0); + set_0 = SqlUtil.read(searchQuestion_0); + if(set_0.next()) { + wait.setBool(true); + wait.interrupt(); + String projectid=set_0.getString("project_id"); + MessageBox.post("ĿµʱĿ"+projectid+"ͬͬ˳","",MessageBox.INFORMATION); + return; + }else { + columns = new String[] { "SCHEDUALTASK", "TASK_ID", "PROJECT_ID", "is_effective", + "System_time" }; + values = new Object[] { schedualLIst.get(j).getSchedualTask(), + schedualLIst.get(j).getTask_id(), schedualLIst.get(j).getProject_id(), + schedualLIst.get(j).getIs_effective(), + schedualLIst.get(j).getSystemTime() }; + searchQuestion = SqlUtil.getInsertSql_3("TC_project_taskinfo", columns, values); + System.out.println("----------111----->"+searchQuestion); + int num = SqlUtil.update(searchQuestion); + if (num > 0) { + System.out.println( + "ʱ:\"" + schedualLIst.get(j).getSchedualTask() + "\"Ѿӡͬ"); + } + + } + } + + } + +// if (!set_0.next()) { +// +// columns = new String[] { "SCHEDDULETASK", "TASK_ID", "PROJECT_ID", "is_effective", +// "System_time" }; +// values = new Object[] { schedualLIst.get(j).getSchedualTask(), schedualLIst.get(j).getTask_id(), +// schedualLIst.get(j).getProject_id(), schedualLIst.get(j).getIs_effective(), +// schedualLIst.get(j).getSystemTime() }; +// searchQuestion = SqlUtil.getInsertSql_3("TC_project_taskinfo", columns, values); +// int num = SqlUtil.update(searchQuestion); +// if (num > 0) { +// // System.out.println("ʱ:\""+schedualLIst.get(j).getSchedualTask()+"\"Ѿӡͬ"); +// } +// } + } + } + } + //TODO ݿеڵǰʱﲻڣǾ͸Ϊ1 + //1.ûʱ + //2.ʱ +// boolean DoesDatabaseContainNewTaskId = true;// ԣжݿдڵʱʱǷڣĬϴڣ + if(store.length>0&&!storeTaskidProject_Id.equals("")) { + + for(int i = 0; i < store.length; i++) { + splitTaskIdProjectId=store[i].split(","); + taskIdString=splitTaskIdProjectId[0]; + projectIdString=splitTaskIdProjectId[1]; + int count2=1; + for (int j = 0; j < schedualLIst.size(); j++) { + if(taskIdString.equals(schedualLIst.get(j).getTask_id() + "")&&projectIdString.equals(schedualLIst.get(j).getProject_id() )) { + break; + } + count2++; + } + System.out.println("count2---------------->"+count2); + System.out.println("schedualLIst.size---------------->"+schedualLIst.size()); + if(count2>schedualLIst.size()) { + + columns = new String[] { "is_effective", "System_time" }; + values = new Object[] { 1, systemTime }; + searchQuestion = SqlUtil.getUpdate("TC_project_taskinfo", new String[] {"TASK_ID","PROJECT_ID"}, new String[] {taskIdString,projectIdString}, columns, + values); + System.out.println("䣺"+searchQuestion); + int num = SqlUtil.update(searchQuestion); + } + } + } + + + } catch (Exception e1) { + wait.setBool(true); + wait.interrupt(); + e1.printStackTrace(); + MessageBox.post("ʱͬʧ", "", MessageBox.ERROR); + return; + } + sendYQ(); + + SqlUtil.freeAll();// TODO ͷԴǷҪ + wait.setBool(true); + wait.interrupt(); + MessageBox.post("ͬ", "ɹ", MessageBox.INFORMATION); + return; + + } else { + MessageBox.post("ѡĿִв", "", MessageBox.ERROR); + return; + } + + } + private void sendYQ() { + // TODO Auto-generated method stub + try { + + String project_id = project.getStringProperty("project_id"); + if(project_id.startsWith("RJ")) { +// MessageBox.post("ѡĿִͬĿϢ.","ʾ",2); + return; + } + + TCPreferenceService service = session.getPreferenceService(); + String[] urls = service.getStringValues("JK_YQ_Url");//token ȡ + if(urls ==null || urls.length<2) { + MessageBox.post("JK_YQ_Urlѡд,.","ʾ",2); + return; + } + String[] values2 = service.getStringValues("JK_YQ_ProjectInfo_Mapping"); + if(values2 ==null || values2.length==0) { + MessageBox.post("JK_YQ_ProjectInfo_Mappingѡд,.","ʾ",2); + return; + } + Map propMap = new HashMap<>(); + for(String value:values2) { + String[] split = value.split("="); + propMap.put(split[0], split[1]); + } + DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + System.out.println(propMap); + for(String name : propMap.keySet()) { + String string = propMap.get(name); + if(string.startsWith("MRZ:")) { + String val = string.replaceAll("MRZ:", ""); + propMap.put(name, val); + }else { + String val = project.getProperty(string); + + try { + Date parse = sdf.parse(val); + String format = new SimpleDateFormat("yyyy-MM-dd").format(parse); + System.out.println(format); + val = format; + } catch (ParseException e) { + // TODO Auto-generated catch block + } + if(projectManager_name_idMap.containsKey(val)) { + val = projectManager_name_idMap.get(val); + } + if(name.equals("sys03")) { + if(val.contains("-") && val.split("-").length>=2) { + val = val.split("-")[1]; + } + } + propMap.put(name, val); + } + + } + String jsonString = JSON.toJSONString(propMap); + System.out.println(jsonString); + String token = getToken(urls[0]); + String send = send(jsonString,token,urls[1]); + if(!send.equals("success")) { + MessageBox.post(send,"ʾ",2); + } +// else { +// MessageBox.post("ͬɹ","ʾ",2); +// } +// + } catch (Exception e) { + // TODO: handle exception + e.printStackTrace(); + } + } + public static String getDate1() { + + SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss"); + Date nowDate=new Date(); + String format = formatter.format(nowDate); + return format; + } + private static String send(String json,String token,String url) throws IOException { + OkHttpClient client = new OkHttpClient(); +// MediaType mediaType = MediaType.parse("application/json"); + MediaType mediaType = MediaType.parse("application/json;charset=UTF-8"); + RequestBody body = RequestBody.create(mediaType,json); + System.out.println("token==>"+token); + Request request = new Request.Builder().url(url) + .method("POST", body) +// .addHeader("Authorization", "Bearer "+token) + .addHeader("send", "PLM") + .addHeader("ET_AUTH_TYPE", "JWT") + .addHeader("ET_AUTH_TOKEN", token) + .addHeader("transID", getDate1()) + .addHeader("Content-Type", "application/json") + .build(); + Response response = client.newCall(request).execute(); +// response.body().byteStream() +// System.out.println(response.body().string()); + JSONObject parseObject = JSON.parseObject(response.body().string()); + System.out.println("result2==>"+parseObject); + Boolean bool = parseObject.getString("code").equals("success"); + if(!bool) { + String msg = parseObject.getString("msg"); + return msg; + }else { + return "success"; + } + } + + private static String getToken(String urlString) { + // TODO Auto-generated method stub + +// String query = "?appKey=yunpaiyayaka3x0k0cc13h&appSecret=CDyYwRW44xZ7qrt0YxwHYL-vy-Z5U1NceUNiVkyEBxv-trQmZaaTw47_e4X_eBgH"; +// +// String urlString = "http://10.0.14.5:31465/api/open/oauth/token/"+userName+query; + + OkHttpClient client = new OkHttpClient(); + MediaType mediaType = MediaType.parse("text/plain"); + RequestBody body = RequestBody.create(mediaType, ""); + Request request = new Request.Builder() + .url(urlString) + .method("POST", body) + .build(); + try { + Response response = client.newCall(request).execute(); +// String token = response.body().string(); + JSONObject parseObject = JSON.parseObject(response.body().string()); + System.out.println("result==>"+parseObject); +// System.out.println(parseObject.toJSONString()); + Boolean bool = parseObject.getString("code").equals("success"); + String token = ""; + if(!bool) { + String msg = parseObject.getString("msg"); + System.out.println(msg); + }else { + + JSONObject jsonObject = parseObject.getJSONObject("data"); + + token = jsonObject.getString("jwt"); + + } + return token; + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + return ""; + + } + + public boolean check(boolean isSynchronize, TCComponentProject project, String dbName, String dbPassword, String url, String driver_temp) { + if (project.getType().equals("TC_Project")) { + // ĿµļУʱļ + TCProperty obj = null; + try { + obj = project.getTCProperty("project_data");//Ŀ + // ȡĿµļ + TCComponent[] compS = obj.getReferenceValueArray();// Զɶ飬Ҳǻȡļ + for (int i = 0; i < compS.length; i++) { + TCComponentProjectSmartFolder SmartFolder = (TCComponentProjectSmartFolder) compS[i]; + String name = SmartFolder.getTCProperty("folder_name").toString(); + if ((name.equals("ʱ")) || (name.contains("ʱ"))) { + TCProperty obj2 = SmartFolder.getTCProperty("project_data");// + TCComponent[] compS2 = obj2.getReferenceValueArray();// ʱļеʱ + int count=0; + if(compS2.length>0) { + for(TCComponent schedule: compS2) { + schedule.refresh(); + if(schedule.getType().equals("Schedule")) { + count++; + } + } + if(count>1) { + isSynchronize=false; + MessageBox.post("ǰĿжʱȷĿֻһʱͬ","",MessageBox.INFORMATION); +// System.out.println("------11111111111--------"+isSynchronize); + return isSynchronize; + } + if(count==1) { + TCComponentSchedule schedule=(TCComponentSchedule) compS2[0]; + if(schedule.getTCProperty("project_ids").getStringValue().split(",").length>1) { + System.out.println(schedule.getTCProperty("project_ids").getStringValue()); + isSynchronize=false; +// System.out.println("------11111111111--------"+isSynchronize); + MessageBox.post("ǰĿָɵʱͬʱָɸ"+schedule.getTCProperty("project_ids").getStringValue().split(",").length+"Ŀ\nȷһʱָɸһĿͬ","",MessageBox.INFORMATION); + return isSynchronize; + }; + } + } + //ûʱݿű + if(count==0) { + SqlUtil.getConnection(dbName, dbPassword, url, driver_temp); + String searchQuestion = ""; + String projectID=project.getTCProperty("project_id").getStringValue(); + searchQuestion = SqlUtil.getSelectSql_1("TC_project_info", "PROJECT_ID",projectID); + ResultSet set=null; + try { + set = SqlUtil.read(searchQuestion); + System.out.println(searchQuestion); + if(set.next()) { + searchQuestion = SqlUtil.getSelectSql_1("TC_project_taskinfo", "PROJECT_ID",projectID); + set = SqlUtil.read(searchQuestion); + System.out.println(searchQuestion); + int taskId=1; + while(set.next()) { + taskId=set.getInt("TASK_ID"); + if(taskId!=1) { + isSynchronize=false; + MessageBox.post("ĿµʱƳͬ","",MessageBox.INFORMATION); +// System.out.println("------11111111111--------"+isSynchronize); + SqlUtil.freeAll();// TODO ͷԴǷҪ + return isSynchronize; + } + } + } + SqlUtil.freeAll();// TODO ͷԴǷҪ + } catch (SQLException e) { + e.printStackTrace(); + }// ִ + } + + } + } + } catch (TCException e) { + e.printStackTrace(); + } + } +// System.out.println("------2222222222222222222--------"+isSynchronize); + return isSynchronize; + } + TCComponentUser user; + + /*//ͨԱԱID + private String findPeople1(String name) { + String id = "TC޴˹"; + try { + user = (TCComponentUser) session.search(" - ԱϢ", new String[] { "Ա" }, new String[] { name })[0]; + id = user.getTCProperty("user_id").getStringValue(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + if (id.length() < 4) { + MessageBox.post("", "", MessageBox.ERROR); + id = "TC޴˹"; + } + return id; + }*/ + //ͨѡƥԱid + private String findPeople2(String type,String name,Map map) { + String id="֪ͨԱѡ޴Ա"; + if(name.contains("")){ + name=name.replace("", ""); + } + if(map.containsKey(name)) { + id=map.get(name); + }else { + MessageBox.post("ϵϵͳԱѡ"+type+"ûû"+name, "", MessageBox.ERROR); + id = "ѡ޴˹"; + } + return id; + } + + public void cycle(TCComponent component) { + TCComponent[] compSAll; + try { + compSAll = component.getReferenceListProperty("child_task_taglist"); + if (compSAll.length > 0) { + for (int i = 0; i < compSAll.length; i++) { + //ֻһʱͬ + if(compSAll[i].getReferenceListProperty("child_task_taglist").length==0) { + + schBean = new IntegrationBean(); + if (project.getTCProperty("project_id").getStringValue() != null) { + + schBean.setProject_id(project.getTCProperty("project_id").getStringValue()); + } else { + schBean.setProject_id(""); + + } + if (compSAll[i].getTCProperty("object_name").getStringValue() != null) { + + schBean.setSchedualTask(compSAll[i].getTCProperty("object_name").getStringValue()); + } else { + schBean.setSchedualTask(""); + + } + if (compSAll[i].getTCProperty("item_id").getStringValue() != null) { + +// schBean.setTask_id(Integer.valueOf(compSAll[i].getTCProperty("item_id").getStringValue())); + schBean.setTask_id(compSAll[i].getTCProperty("item_id").getStringValue()); + } else { + schBean.setTask_id("1"); + + } + schBean.setIs_effective(0);// 0Ч1Ч + schBean.setSystemTime(systemTime); + + schedualLIst.add(schBean); + } + cycle(compSAll[i]); + + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + //ͨݿѯΪòѯˣԡuser_projectsֵ޷á ֵЧ ֵЧ ֵЧ ָûڷǻ״̬ + private Map findPeople3(Map userid_nameMap) { + String JdbcDriverClass = "oracle.jdbc.driver.OracleDriver"; + String strUrl = "jdbc:oracle:thin:@10.200.2.43:1521:jktc"; + String strUserName = "infodba"; + String strPassword = "infodba"; + + try { + try { + Class.forName(JdbcDriverClass); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } + Connection conn = DriverManager.getConnection(strUrl, strUserName, + strPassword); + + String query = "select puser_id,puser_name from ppom_user"; + Statement stmt = conn.createStatement(); + + ResultSet rs_get = stmt.executeQuery(query); + int rowCount = 0; + while (rs_get.next()) { + rowCount++; + String puser_id=rs_get.getString("puser_id");//ȡֵֶ + String puser_name=rs_get.getString("puser_name");//ȡֵֶ + userid_nameMap.put(puser_name,puser_id); + } + System.out.println(rowCount); +// stmt.executeUpdate(upin); + if (rs_get != null) { + rs_get.close(); + } + if (stmt != null) { + stmt.close(); + } + if (conn != null) { + conn.close(); + } + } catch (SQLException e) { + e.printStackTrace(); + } + + return userid_nameMap; + + } + + + +} diff --git a/src/com/connor/jk/plm/TC_OA_Integration/Integration_Handler.java b/src/com/connor/jk/plm/TC_OA_Integration/Integration_Handler.java new file mode 100644 index 0000000..b577cd2 --- /dev/null +++ b/src/com/connor/jk/plm/TC_OA_Integration/Integration_Handler.java @@ -0,0 +1,20 @@ +package com.connor.jk.plm.TC_OA_Integration; + +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.aifrcp.AIFUtility; + +public class Integration_Handler extends AbstractHandler { + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + // TODO Auto-generated method stub + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + new Thread(new Integration_Action(app, null)).start(); + return null; + } + +} diff --git a/src/com/connor/jk/plm/TC_OA_Integration/ProgressBar.java b/src/com/connor/jk/plm/TC_OA_Integration/ProgressBar.java new file mode 100644 index 0000000..28a0459 --- /dev/null +++ b/src/com/connor/jk/plm/TC_OA_Integration/ProgressBar.java @@ -0,0 +1,171 @@ +/** + * @file ProgressBar.java + * + * @brief Create progress bar + * + * @author Yanghui + * + * @history + * ================================================================ + * Date Name Description of Change + * 25-July-2008 Yanghui this class is used to create + * progress bar. + */ +package com.connor.jk.plm.TC_OA_Integration; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JProgressBar; +import javax.swing.Timer; +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.util.PropertyLayout; +import com.teamcenter.rac.util.Registry; + +/** + * @class ProgressBar + * @brief Create progress bar + * @author Yanghui + */ +public class ProgressBar extends AbstractAIFDialog implements ActionListener { + /** + * @var ProgressBar.progressbar + * @brief JProgressBar + */ + private JProgressBar progressbar; + + /** + * @var ProgressBar.label + * @brief label used to tips + */ + private JLabel label; + + /** + * @var ProgressBar.timer + * @brief timer used to timing operation + */ + private Timer timer; + + /** + * @var ProgressBar.bool + * @brief bool used to flag thread return + */ + private boolean bool = false; + + /** + * @var Progressbar.registry + * @brief Registry + */ + private Registry registry; + + /** + * @fn public ProgressBar() + * @brief constructor + * @param[in] null + */ + private String showLable = null ; + public ProgressBar(String showlable) { + super(true); + showLable = showlable; + this.setAlwaysOnTop(true); + } + + /** + * @fn public void setBool(boolean bool) + * @brief set bool value + * @param[in] bool + * @param[out] null + */ + public void setBool(boolean bool) { + this.bool = bool; + } + + /** + * @fn private void initUI() + * @brief createDialog method + * @param[in] null + * @param[out] null + */ + public void initUI() { + Container container = getContentPane(); + JPanel mainPanel = new JPanel(new PropertyLayout()); + this.label = new JLabel(showLable, JLabel.CENTER); + this.progressbar = new JProgressBar(); + this.progressbar.setOrientation(JProgressBar.HORIZONTAL); + this.progressbar.setMinimum(0); + this.progressbar.setMaximum(100); + this.progressbar.setValue(0); + this.progressbar.setPreferredSize(new Dimension(200, 15)); + this.progressbar.setBorderPainted(true); + this.timer = new Timer(50, (ActionListener) this); + this.timer.setRepeats(false); + mainPanel.add("1.1.center", new JLabel(" ")); + mainPanel.add("2.1.center", label); + mainPanel.add("3.1.center", progressbar); + mainPanel.add("4.1.center", new JLabel(" ")); + container.add(mainPanel); + pack(); + setLocation(500, 200); + TaskThread thread = new TaskThread(this); + thread.start(); + addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + bool = true; + } + }); + this.setVisible(true); + } + + /** + * @class TaskThread + * @brief Create progressbar + * + */ + class TaskThread extends Thread { + private ProgressBar bar; + + public TaskThread(ProgressBar bar) { + this.bar = bar; + } + + public void run() { + if (bool == false) { + // Set Status is running. + // session.setStatus(registry.getString("export Running")); + } + for (int i = 0; i < i + 1; i++) { + timer.start(); + int value = progressbar.getValue(); + if (value < 100) { + value = value + 5; + progressbar.setValue(value); + } else { + timer.stop(); + progressbar.setValue(0); + } + try { + sleep(100); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + if (bool == true) { + bar.setVisible(false); + bar.dispose(); + return; + + } + + } + } + } + + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + + } +} diff --git a/src/com/connor/jk/plm/TC_OA_Integration/ProgressBarThread.java b/src/com/connor/jk/plm/TC_OA_Integration/ProgressBarThread.java new file mode 100644 index 0000000..05d3bd3 --- /dev/null +++ b/src/com/connor/jk/plm/TC_OA_Integration/ProgressBarThread.java @@ -0,0 +1,41 @@ +/** + * @file ProgressBarThread.java + * + * @brief control progressBar. + * + * @author Yanghui + * + * @history + * ================================================================ + * Date Name Description of Change + * 08-Auguest-2008 Yanghui this class is used to control + * progress bar. + */ +package com.connor.jk.plm.TC_OA_Integration; + +/** + * @class ProgressBarThread + * @brief Create progress bar thread + * @author Yanghui + */ +public class ProgressBarThread extends Thread { + + private ProgressBar bar; + + private String title; + + public ProgressBarThread(String title,String showLable) { + this.title = title; + bar = new ProgressBar(showLable); + } + + public void run() { + bar.setTitle(title); + bar.initUI(); + } + + public void setBool(boolean bool) { + bar.setBool(true); + bar.setAlwaysOnTop(true); + } +} diff --git a/src/com/connor/jk/plm/TC_OA_Integration/ProjTestHandler.java b/src/com/connor/jk/plm/TC_OA_Integration/ProjTestHandler.java new file mode 100644 index 0000000..e3943a1 --- /dev/null +++ b/src/com/connor/jk/plm/TC_OA_Integration/ProjTestHandler.java @@ -0,0 +1,217 @@ +package com.connor.jk.plm.TC_OA_Integration; + +import java.io.IOException; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.squareup.okhttp.MediaType; +import com.squareup.okhttp.OkHttpClient; +import com.squareup.okhttp.Request; +import com.squareup.okhttp.RequestBody; +import com.squareup.okhttp.Response; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCComponentProject; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class ProjTestHandler extends AbstractHandler{ + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + new Thread() { + @Override + public void run() { + + AbstractAIFApplication app = AIFUtility.getCurrentApplication(); + TCSession session = (TCSession) app.getSession(); + try { + + + InterfaceAIFComponent targetComponent = app.getTargetComponent(); + if(targetComponent instanceof TCComponentProject) { + + TCComponentProject project = (TCComponentProject)targetComponent; + + String project_id = project.getStringProperty("project_id"); + if(project_id.startsWith("RJ")) { + MessageBox.post("ѡĿִͬĿϢ.","ʾ",2); + return; + } + + TCPreferenceService service = session.getPreferenceService(); + String[] urls = service.getStringValues("JK_YQ_Url");//token ȡ + if(urls ==null || urls.length<2) { + MessageBox.post("JK_YQ_Urlѡд,.","ʾ",2); + return; + } + String[] values = service.getStringValues("JK_YQ_ProjectInfo_Mapping"); + if(values ==null || values.length==0) { + MessageBox.post("JK_YQ_ProjectInfo_Mappingѡд,.","ʾ",2); + return; + } + if(project.getProperty("jk8EstCompleteDate").equals("") + || project.getProperty("jk8ProductLine").equals("")) { + MessageBox.post("ȷҪݵϢΪ", "", MessageBox.INFORMATION); + return; + } + Map name_idMap=new HashMap<>(); + String[] JK8ProjectManager=service.getStringValue("jk8ProjectManager").split(",");// Ŀѡ + for (int i = 0; i < JK8ProjectManager.length; i++) { + String name=JK8ProjectManager[i].split("-")[1]; + String id=JK8ProjectManager[i].split("-")[0]; + name_idMap.put(name, id); + } + Map propMap = new HashMap<>(); + for(String value:values) { + String[] split = value.split("="); + propMap.put(split[0], split[1]); + } + DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + System.out.println(propMap); + for(String name : propMap.keySet()) { + String string = propMap.get(name); + if(string.startsWith("MRZ:")) { + String val = string.replaceAll("MRZ:", ""); + propMap.put(name, val); + }else { + String val = project.getProperty(string); + System.out.println(val); + try { + Date parse = sdf.parse(val); + String format = new SimpleDateFormat("yyyy-MM-dd").format(parse); + System.out.println(format); + val = format; + System.out.println(val); + } catch (ParseException e) { + // TODO Auto-generated catch block + } + if(name_idMap.containsKey(val)) { + val = name_idMap.get(val); + } + if(name.equals("sys03")) { + if(val.contains("-") && val.split("-").length>=2) { + val = val.split("-")[1]; + } + + } + propMap.put(name, val); + } + + } + String jsonString = JSON.toJSONString(propMap); + System.out.println(jsonString); + String token = getToken(urls[0]); + String send = send(jsonString,token,urls[1]); + if(!send.equals("success")) { + MessageBox.post(send,"ʾ",2); + }else { + MessageBox.post("ͬɹ","ʾ",2); + } +// code=project_id + + }else{ + MessageBox.post("ѡĿִͬĿϢ.","ʾ",2); + } + + } catch (Exception e) { + // TODO: handle exception + e.printStackTrace(); + } + + } + }.start(); + + + return null; + } + public static String getDate1() { + + SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss"); + Date nowDate=new Date(); + String format = formatter.format(nowDate); + return format; + } + private static String send(String json,String token,String url) throws IOException { + OkHttpClient client = new OkHttpClient(); +// MediaType mediaType = MediaType.parse("application/json"); + MediaType mediaType = MediaType.parse("application/json;charset=UTF-8"); + RequestBody body = RequestBody.create(mediaType,json); + System.out.println("token==>"+token); + Request request = new Request.Builder().url(url) + .method("POST", body) +// .addHeader("Authorization", "Bearer "+token) + .addHeader("send", "PLM") + .addHeader("ET_AUTH_TYPE", "JWT") + .addHeader("ET_AUTH_TOKEN", token) + .addHeader("transID", getDate1()) + .addHeader("Content-Type", "application/json") + .build(); + Response response = client.newCall(request).execute(); +// response.body().byteStream() +// System.out.println(response.body().string()); + JSONObject parseObject = JSON.parseObject(response.body().string()); + System.out.println("result2==>"+parseObject); + Boolean bool = parseObject.getString("code").equals("success"); + if(!bool) { + String msg = parseObject.getString("msg"); + return msg; + }else { + return "success"; + } + } + + private static String getToken(String urlString) { + // TODO Auto-generated method stub + +// String query = "?appKey=yunpaiyayaka3x0k0cc13h&appSecret=CDyYwRW44xZ7qrt0YxwHYL-vy-Z5U1NceUNiVkyEBxv-trQmZaaTw47_e4X_eBgH"; +// +// String urlString = "http://10.0.14.5:31465/api/open/oauth/token/"+userName+query; + + OkHttpClient client = new OkHttpClient(); + MediaType mediaType = MediaType.parse("text/plain"); + RequestBody body = RequestBody.create(mediaType, ""); + Request request = new Request.Builder() + .url(urlString) + .method("POST", body) + .build(); + try { + Response response = client.newCall(request).execute(); +// String token = response.body().string(); + JSONObject parseObject = JSON.parseObject(response.body().string()); + System.out.println("result==>"+parseObject); +// System.out.println(parseObject.toJSONString()); + Boolean bool = parseObject.getString("code").equals("success"); + String token = ""; + if(!bool) { + String msg = parseObject.getString("msg"); + System.out.println(msg); + }else { + + JSONObject jsonObject = parseObject.getJSONObject("data"); + + token = jsonObject.getString("jwt"); + + } + return token; + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + return ""; + + } +} \ No newline at end of file diff --git a/src/com/connor/jk/plm/TC_OA_Integration/SqlUtil.java b/src/com/connor/jk/plm/TC_OA_Integration/SqlUtil.java new file mode 100644 index 0000000..8c70283 --- /dev/null +++ b/src/com/connor/jk/plm/TC_OA_Integration/SqlUtil.java @@ -0,0 +1,819 @@ +package com.connor.jk.plm.TC_OA_Integration; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; + +import javax.print.DocFlavor.STRING; + +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.Registry; + +/** + * ֹ̳final,ֹ󽨶˽й췽,ΪʹС PreparedStatementResultSetС + * + * @author hub 2015-02-06 + */ +public final class SqlUtil { + public static Connection connection = null; + public static PreparedStatement ps = null; + public static ResultSet rs = null; + private static Registry reg = Registry.getRegistry("com.connor.jk.plm.TC_OA_Integration.database"); + + /** + * ˽йnew󣬷ֹö + */ + private SqlUtil() { + + } + + static { + String driver = reg.getString("ORACEL_DRIVER"); // Util.getProperties("DRIVER"); + if (driver == null) { + driver = "oracle.jdbc.driver.OracleDriver"; + } + + System.out.println("driver " + driver); + try { + Class.forName(driver); + } catch (ClassNotFoundException e) { + System.out.println("ORACEL DRIVER IS EXCEPTION"); + e.printStackTrace(); + } + } + + /** + * ݿ + */ + public static Connection getConnection() { + try { + String driver_temp = reg.getString("ORACEL_DRIVER"); + String url = reg.getString("ORACEL_URL");// getProperties("URL"); + String dbName = reg.getString("ORACEL_NAME");// Util.getProperties("dbName"); + String dbPassword = reg.getString("ORACEL_PASSWORD");// Util.getProperties("dbPassword"); + // String driver_temp = + // "com.microsoft.jdbc.sqlserver.SQLServerDriver"; + // String url = + // "jdbc:microsoft:sqlserver://10.200.1.33:1433;DatabaseName=ecology";// + // getProperties("URL"); + // String dbName = "tc";// Util.getProperties("dbName"); + // String dbPassword = "Tc123456";// + // Util.getProperties("dbPassword"); + System.out.println("SQLSERVER_DRIVER:" + driver_temp); + System.out.println("SQLSERVER_URL:" + url); + System.out.println("SQLSERVER_NAME:" + dbName); + System.out.println("SQLSERVER_PASSWORD:" + dbPassword); + // int a=1; + // if(a==1){ + // return connection; + // } + + if (driver_temp == null || url == null || dbName == null || dbPassword == null) { + + MessageBox.post("ݿѡǷȷ", "ʾ", MessageBox.ERROR); + + } + // else{ + // MessageBox.post(driver_temp+" | "+url+" | "+dbName+" | + // "+dbPassword,"ʾ",MessageBox.ERROR); + // + // } + System.out.println(url + dbName + dbPassword); + connection = DriverManager.getConnection(url, dbName, dbPassword); + // connection.setAutoCommit(false);//sqlserverݿʱע + } catch (SQLException e) { + System.out.println(" CONNECT EXCEPTION"); + e.printStackTrace(); + return null; + // MessageBox.post("ORACEL CONNECT EXCEPTION + // \n"+e.getMessage(),"ERROR",MessageBox.ERROR); + } + return connection; + } + /** + * ݿ + */ + public static Connection getConnection(String dbName,String dbPassword,String url,String driver_temp) { + try { + + if (driver_temp == null || url == null || dbName == null + || dbPassword == null) { + + MessageBox.post("ݿѡǷȷ", "ʾ", MessageBox.ERROR); + + } + // else{ + // MessageBox.post(driver_temp+" | "+url+" | "+dbName+" | "+dbPassword,"ʾ",MessageBox.ERROR); + // + // } + System.out.println(url + dbName + dbPassword); + connection = DriverManager.getConnection(url, dbName, dbPassword); +// connection.setAutoCommit(false); + } catch (SQLException e) { + System.out.println("ORACEL CONNECT EXCEPTION"); + e.printStackTrace(); + return null; + // MessageBox.post("ORACEL CONNECT EXCEPTION \n"+e.getMessage(),"ERROR",MessageBox.ERROR); + } + return connection; + } + + /** + * ݿ + */ + public static Connection getConnection(String url, String dbName, String dbPassword) { + try { + String driver_temp = reg.getString("ORACEL_DRIVER"); + + System.out.println(url + dbName + dbPassword); + connection = DriverManager.getConnection(url, dbName, dbPassword); + connection.setAutoCommit(false); + } catch (SQLException e) { + System.out.println("ORACEL CONNECT EXCEPTION"); + e.printStackTrace(); + // MessageBox.post("ORACEL CONNECT EXCEPTION + // \n"+e.getMessage(),"ERROR",MessageBox.ERROR); + return null; + } + return connection; + } + + /** + * ƴSELECT + * + * @param tableName + * @param selectElement + * @param args + * @return + */ + public static String getSelectSql(String tableName, String[] selectElement, String... args) { + StringBuffer valuesSB = new StringBuffer("SELECT "); + if (selectElement != null) { + for (String element : selectElement) { + valuesSB.append(element).append(","); + } + valuesSB.delete(valuesSB.length() - 1, valuesSB.length()); + } + valuesSB.append(" FROM "); + valuesSB.append(tableName); + valuesSB.append(" WHERE"); + for (int i = 0; i < args.length; i++) { + valuesSB.append(" "); + valuesSB.append(args[i]); + valuesSB.append("=? "); + valuesSB.append("AND"); + } + + valuesSB.delete(valuesSB.length() - 3, valuesSB.length()); + return valuesSB.toString(); + } + + /** + * ƴSELECT + * + * @param tableName + * @param selectElement + * @param args + * @return + */ + public static String getSelectSql_1(String tableName, String selectElement, String keyword) { + StringBuffer valuesSB = new StringBuffer("SELECT *"); + + valuesSB.append(" FROM "); + valuesSB.append(tableName); + valuesSB.append(" WHERE "); + valuesSB.append(selectElement); + valuesSB.append(" = '"); + valuesSB.append(keyword); + valuesSB.append("'"); + return valuesSB.toString(); + } + + /** + * ƴSELECT + * + * @param tableName + * @param selectElement + * @param args + * @return + */ + public static String getSelectSql_2(String tableName, String[] selectElement, Object[] keyword) { + StringBuffer valuesSB = new StringBuffer("SELECT *"); + + valuesSB.append(" FROM "); + valuesSB.append(tableName); + valuesSB.append(" WHERE "); + for (int i = 0; i < keyword.length; i++) { + valuesSB.append(selectElement[i]); + valuesSB.append(" = '"); + valuesSB.append(keyword[i]); + valuesSB.append("'"); + if (i < keyword.length - 1) { + valuesSB.append(" and "); + } + + } + return valuesSB.toString(); + } + + /** + * ƴSELECT + * + * @param tableName + * @param selectElement + * @param args + * @return + */ + public static String getSelectSql_3(String tableName, String selectElement, String keyword) { + StringBuffer valuesSB = new StringBuffer("SELECT *"); + + valuesSB.append(" FROM "); + valuesSB.append(tableName); + valuesSB.append(" WHERE "); + valuesSB.append(selectElement); + valuesSB.append(" = '"); + valuesSB.append(keyword); + valuesSB.append("'"); + return valuesSB.toString(); + } + + /** + * ƴSELECT + * + * @param tableName + * @param args + * @return + */ + public static String getSelectSql(String tableName, String... args) { + StringBuffer valuesSB = new StringBuffer("SELECT * FROM "); + valuesSB.append(tableName); + valuesSB.append(" WHERE"); + for (int i = 0; i < args.length; i++) { + valuesSB.append(" "); + valuesSB.append(args[i]); + valuesSB.append("=? "); + valuesSB.append("AND"); + } + + valuesSB.delete(valuesSB.length() - 3, valuesSB.length()); + return valuesSB.toString(); + } + + /** + * ƴӸ + * + * @param tableName + * @param args + * @param args2 + * @return + */ + public static String getUpdataSQL(String tableName, String[] args, String[] args2) { + StringBuffer updateSB = new StringBuffer("UPDATE "); + updateSB.append(tableName); + updateSB.append(" SET "); + // ƴӸ + for (int i = 0; i < args.length; i++) { + if (args[i].toUpperCase().equals("OPERATE_TIME") || args[i].toUpperCase().equals("LAST_UPDATE_DATE")) { + updateSB.append(args[i]).append("=to_date(?,'yyyy-MM-dd HH24:mi:ss') ,"); + } else { + updateSB.append(args[i]).append("=? ,"); + } + } + updateSB.delete(updateSB.length() - 2, updateSB.length()); + ; + updateSB.append(" WHERE "); + for (int i = 0; i < args2.length; i++) { + updateSB.append(args2[i]).append("=? AND "); + } + updateSB.delete(updateSB.length() - 4, updateSB.length()); + return updateSB.toString(); + } + + /** + * ƴSQLinsert + * + * @param tableName + * @param args + * @return + */ + public static String getInsertSql_1(String tableName, String[] column, Object[] value) { + StringBuffer insertSql = new StringBuffer("insert into "); + StringBuffer values = new StringBuffer("values("); + + if (tableName != null && column != null && column.length > 0) { + insertSql.append(tableName); + insertSql.append("("); + for (int i = 0; i < column.length; i++) { + insertSql.append(column[i]); + if (i < column.length - 1) { + insertSql.append(", "); + } + } + } else { + return null; + } + if (tableName != null && value != null && value.length > 0) { + System.out.println(value.length); + for (int i = 0; i < value.length; i++) { + if ((value[i] + "").trim().equals("")) { + value[i] = ""; + } + if (i == 0) { + values.append(value[i]); + } else { + + values.append("'" + value[i] + "'"); + } + if (i < value.length - 1) { + values.append(","); + } + } + } + // insertSql.delete(insertSql.length() - 2, insertSql.length()); + // values.delete(values.length() - 2, values.length()); + insertSql.append(") ").append(values).append(")"); + return insertSql.toString(); + } + + /** + * ƴSQLinsert + * + * @param tableName + * @param args + * @return + */ + public static String getInsertSql_2(String tableName, String[] column, Object[] value) { + StringBuffer insertSql = new StringBuffer("insert into "); + StringBuffer values = new StringBuffer("values("); + + if (tableName != null && column != null && column.length > 0) { + insertSql.append(tableName); + insertSql.append("("); + for (int i = 0; i < column.length; i++) { + insertSql.append(column[i]); + if (i < column.length - 1) { + insertSql.append(", "); + } + } + } else { + return null; + } + if (tableName != null && value != null && value.length > 0) { + System.out.println(value.length); + for (int i = 0; i < value.length; i++) { + if ((value[i] + "").trim().equals("")) { + value[i] = ""; + } + if (i == 1) { + values.append(value[i]); + } else { + + values.append("'" + value[i] + "'"); + } + if (i < value.length - 1) { + values.append(","); + } + } + } + // insertSql.delete(insertSql.length() - 2, insertSql.length()); + // values.delete(values.length() - 2, values.length()); + insertSql.append(") ").append(values).append(")"); + return insertSql.toString(); + } + + /** + * ƴSQLinsert + * + * @param tableName + * @param args + * @return + */ + public static String getInsertSql_3(String tableName, String[] column, Object[] value) { + StringBuffer insertSql = new StringBuffer("insert into "); + StringBuffer values = new StringBuffer("values("); + + if (tableName != null && column != null && column.length > 0) { + insertSql.append(tableName); + insertSql.append("("); + for (int i = 0; i < column.length; i++) { + insertSql.append(column[i]); + if (i < column.length - 1) { + insertSql.append(", "); + } + } + } else { + return null; + } + if (tableName != null && value != null && value.length > 0) { +// System.out.println(value.length); + for (int i = 0; i < value.length; i++) { + if ((value[i] + "").trim().equals("")) { + value[i] = ""; + } + if ( i == 3) { + values.append(value[i]); + } else { + + values.append("'" + value[i] + "'"); + } + if (i < value.length - 1) { + values.append(","); + } + } + } + // insertSql.delete(insertSql.length() - 2, insertSql.length()); + // values.delete(values.length() - 2, values.length()); + insertSql.append(") ").append(values).append(")"); + return insertSql.toString(); + } + + /** + * ƴSQLdelete + * + * @param tableName + * @param args + * @return + */ + public static String getDelete(String tableName, String column, String value) { + StringBuffer deleteSql = new StringBuffer("delete from "); + deleteSql.append(tableName); + deleteSql.append(" where "); + deleteSql.append(column); + deleteSql.append("='"); + deleteSql.append(value); + deleteSql.append("'"); + + return deleteSql.toString(); + } + + /** + * ƴSQLupdate + * + * @param tableName + * @param args + * @return + */ + public static String getUpdate(String tableName, String[] column, String[] value, String[] columns, Object[] values) { + StringBuffer updateSql = new StringBuffer("update "); + updateSql.append(tableName); + updateSql.append(" set "); + // TODO ʣֶ + System.out.println("columns.length---->"+columns.length); + System.out.println("values.length---->"+values.length); + for (int i = 0; i < columns.length; i++) { + updateSql.append(""); + updateSql.append(columns[i]); + updateSql.append("="); + updateSql.append("'"); + updateSql.append(values[i]); + if (i == values.length - 1) { + updateSql.append("' "); + } else { + updateSql.append("', "); + } + } + + updateSql.append(" where "); + for (int i = 0; i < column.length; i++) { + updateSql.append(column[i]); + updateSql.append("='"); + updateSql.append(value[i]); + updateSql.append("'"); + if(i < column.length-1) { + updateSql.append(" and "); + } + + } +// updateSql.append(column); +// updateSql.append("='"); +// updateSql.append(value); +// updateSql.append("'"); + + return updateSql.toString(); + } + + /** + * ƴSQLinsert + * + * @param tableName + * @param args + * @return + */ + public static String getInsertSql(String tableName, String... args) { + StringBuffer insertSql = new StringBuffer("insert into "); + StringBuffer values = new StringBuffer("values("); + + if (tableName != null && args != null && args.length > 0) { + insertSql.append(tableName); + insertSql.append("("); + for (int i = 0; i < args.length; i++) { + insertSql.append(args[i]); + insertSql.append(", "); + if (args[i].toUpperCase().equals("COMMIT_TIME") || args[i].toUpperCase().equals("CREATE_DATE") + || args[i].toUpperCase().equals("INVALID_DATE")) { + values.append("to_date(?,'yyyy-MM-dd HH24:mi:ss'), "); + } else { + values.append("?, "); + } + + } + } else { + return null; + } + insertSql.delete(insertSql.length() - 2, insertSql.length()); + values.delete(values.length() - 2, values.length()); + insertSql.append(") ").append(values).append(")"); + return insertSql.toString(); + } + + /** + * õݿ + * + * @param tableName + * @param args + * + * @param args2 + * + * @return ƴӺĴݿ + */ + public final static String GetCreateTableSQL(String tableName, String[] args, String[] args2) { + + if (args == null || args2 == null || args.length != args2.length) { + System.out.println("THE INPUT PRAGREMS IS ERROR"); + return null; + } + StringBuffer createSQL = new StringBuffer("create table "); + createSQL.append(tableName); + createSQL.append("("); + for (int i = 0; i < args.length; i++) { + createSQL.append(args[i] + " "); + createSQL.append(args2[i] + ", "); + } + createSQL.delete(createSQL.length() - 2, createSQL.length()); + createSQL.append(")"); + return createSQL.toString(); + } + + /** + * õStatement + */ + public final static PreparedStatement getPs(String sql) throws SQLException { + return getPs(sql, null); + } + + /** + * õStatement + */ + public final static PreparedStatement getPs(Object[] argments, String sql) throws SQLException { + // System.out.println("PreparedStatement getPs"); + return getPs(sql, argments); + } + + /** + * õStatement + */ + public final static PreparedStatement getPs(String sql, Object[] argments) throws SQLException { + // System.out.println("PreparedStatement getPs2"); + SqlUtil.ps = SqlUtil.connection.prepareStatement(sql); + if (argments != null) { + for (int i = 0; i < argments.length; i++) { + SqlUtil.ps.setObject(i + 1, argments[i]); + } + } + return SqlUtil.ps; + } + + /** + * + */ + public final static int write(String sql) { + return write(sql, null); + } + + /** + * + */ + public final static int write(Object[] argments, String sql) { + return write(sql, argments); + } + + /** + * + */ + public final static int write(String sql, Object[] argments) { + + return update(sql, argments); + } + + /** + * ɾ + */ + public final static int delete(String sql) { + return delete(sql, null); + } + + /** + * ɾ + */ + public final static int delete(Object[] argments, String sql) { + return delete(sql, argments); + } + + /** + * ɾ + */ + public final static int delete(String sql, Object[] argments) { + return update(sql, argments); + } + + /** + * ޸ + */ + public final static int update(String sql) { + return update(sql, null); + } + + /** + * ޸ + */ + public final static int update(String[] argments, String sql) { + return update(sql, argments); + } + + /** + * ޸(ɾնҪô˷˴쳣رճConnectionΪĶ) + */ + public final static int update(String sql, Object[] argments) { + int i = -1; + try { + PreparedStatement ps = SqlUtil.getPs(argments, sql); + i = ps.executeUpdate(); + // 2015-11-19 + SqlUtil.connection.commit(); + } catch (SQLException e) { + e.printStackTrace(); + } catch (Exception e1) { + e1.printStackTrace(); + } finally { + free(SqlUtil.rs, SqlUtil.ps); + } + return i; + } + + /** + * ѯ + */ + public final static ResultSet read(String sql) throws SQLException { + // System.out.println("ResultSet read"); + return read(sql, null); + } + + /** + * ѯ + */ + public final static ResultSet read(Object[] argments, String sql) throws SQLException { + return read(sql, argments); + } + + /** + * ѯ(вѯնҪô˷治쳣׳ɵߴfinallyͷԴ) + * + * @throws SQLException + */ + public final static ResultSet read(String sql, Object[] argments) throws SQLException { + // System.out.println("ResultSet read2"); + return SqlUtil.rs = SqlUtil.getPs(argments, sql).executeQuery(); + } + + /** + * + */ + public final static boolean createTable(String sql) { + return go(sql, null); + } + + /** + * ɾ + */ + public final static boolean dropTable(String sql) { + return go(sql, null); + } + + /** + * ޸ı + */ + public final static boolean alterTable(String sql) { + return go(sql, null); + } + + /** + * ˷ִDDL(,޸ı,ɾ) + */ + private final static boolean go(String sql, Object[] argments) { + boolean flag = false; + try { + flag = SqlUtil.getPs(sql, argments).execute(); + } catch (SQLException e) { + e.printStackTrace(); + } finally { + free(SqlUtil.rs, SqlUtil.ps); + } + if (flag) { + try { + SqlUtil.connection.commit(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return flag; + } + + /** + * ͷԴ + */ + public final static void free(ResultSet resultSet) { + free(resultSet, null, null); + } + + /** + * ͷԴ + */ + public final static void free(Statement statement) { + free(null, statement, null); + } + + /** + * ͷԴ + */ + public final static void free(Connection connection) { + free(null, null, connection); + } + + /** + * ͷԴ + */ + public final static void free(ResultSet resultSet, Statement statement) { + free(resultSet, statement, null); + } + + /** + * ͷԴ + */ + public final static void free(Statement statement, Connection connection) { + free(null, statement, connection); + } + + /** + * ͷԴ(Ĭϲ) + */ + public final static void free() { + free(SqlUtil.rs, SqlUtil.ps); + } + + /** + * ͷԴ(ȫͷ) + */ + public final static void freeAll() { + free(SqlUtil.rs, SqlUtil.ps, SqlUtil.connection); + } + + /** + * ͷԴ(ҲҪȫͷ) + */ + public final static void free(ResultSet resultSet, Statement statement, Connection connection) { + try { + if (resultSet != null) { + try { + resultSet.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } finally { + try { + if (statement != null) { + try { + statement.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } finally { + if (connection != null) { + try { + connection.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + } + } + + // public void findsth(String searchpart){ + // + // } +} diff --git a/src/com/connor/jk/plm/TC_OA_Integration/TEST.java b/src/com/connor/jk/plm/TC_OA_Integration/TEST.java new file mode 100644 index 0000000..069c42e --- /dev/null +++ b/src/com/connor/jk/plm/TC_OA_Integration/TEST.java @@ -0,0 +1,39 @@ +package com.connor.jk.plm.TC_OA_Integration; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; + +import com.teamcenter.rac.util.MessageBox; + +public class TEST { + public static void main(String[] args) throws ClassNotFoundException { + + + + try { + + String driver_temp = "com.microsoft.jdbc.sqlserver.SQLServerDriver"; + String url = "jdbc:microsoft:sqlserver://10.200.1.33:1433;DatabaseName=ecology";// getProperties("URL"); + String dbName = "tc";// Util.getProperties("dbName"); + String dbPassword = "Tc123456";// Util.getProperties("dbPassword"); + + try { + Class.forName(driver_temp); + } catch (ClassNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + System.out.println(url + dbName + dbPassword); + Connection connection = null; + connection = DriverManager.getConnection(url, dbName, dbPassword); + connection.setAutoCommit(false); + } catch (SQLException e) { + System.out.println(" CONNECT EXCEPTION"); + e.printStackTrace(); + } + + + } + +} diff --git a/src/com/connor/jk/plm/TC_OA_Integration/database.properties b/src/com/connor/jk/plm/TC_OA_Integration/database.properties new file mode 100644 index 0000000..8ce8340 --- /dev/null +++ b/src/com/connor/jk/plm/TC_OA_Integration/database.properties @@ -0,0 +1,20 @@ +# +#ORACEL_NAME=tc +# +#ORACEL_PASSWORD=Tc123456 +# +##ORACEL_URL=jdbc:oracle:thin:@192.168.1.248:1521:TOPPROD +# +#ORACEL_URL=jdbc:microsoft:sqlserver://10.200.1.33:1433;DatabaseName=ecology +# +#ORACEL_DRIVER=com.microsoft.jdbc.sqlserver.SQLServerDriver + +ORACEL_NAME=tc + +ORACEL_PASSWORD=Tc_1234 + +#ORACEL_URL=jdbc:oracle:thin:@192.168.1.248:1521:TOPPROD + +ORACEL_URL=jdbc:microsoft:sqlserver://10.200.1.66:1433;DatabaseName=ecology + +ORACEL_DRIVER=com.microsoft.jdbc.sqlserver.SQLServerDriver \ No newline at end of file diff --git a/src/com/connor/jk/plm/Testlog.java b/src/com/connor/jk/plm/Testlog.java new file mode 100644 index 0000000..c3309c2 --- /dev/null +++ b/src/com/connor/jk/plm/Testlog.java @@ -0,0 +1,30 @@ +package com.connor.jk.plm; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; + +public class Testlog { + + /** + * @param args + */ + public static void main(String[] args) { + // TODO Auto-generated method stub + try { + File file = new File(System.getenv("TEMP") + "\\" +"a.log"); + if (!file.exists()) + file.createNewFile(); + + FileOutputStream out = new FileOutputStream(file, true); + StringBuffer sb = new StringBuffer("szldddddddddz "); + //System.out.println("־"+sb.toString()); + out.write(sb.toString().getBytes("gb2312")); + out.close(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + +} diff --git a/src/com/connor/jk/plm/YSXQForm/CalendarPanel.java b/src/com/connor/jk/plm/YSXQForm/CalendarPanel.java new file mode 100644 index 0000000..bff1801 --- /dev/null +++ b/src/com/connor/jk/plm/YSXQForm/CalendarPanel.java @@ -0,0 +1,613 @@ +package com.connor.jk.plm.YSXQForm; +/** + + * Calender + + * @author BAOMH www.hotheme.com + + */ + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Toolkit; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.util.Calendar; +import java.util.Date; +import javax.swing.AbstractAction; +import javax.swing.InputMap; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JComponent; +import javax.swing.JDialog; +import javax.swing.JFrame; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JSpinner; +import javax.swing.JTable; +import javax.swing.KeyStroke; +import javax.swing.ListSelectionModel; +import javax.swing.SpinnerNumberModel; +import javax.swing.SwingConstants; +import javax.swing.UIManager; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import javax.swing.table.DefaultTableCellRenderer; +import javax.swing.table.DefaultTableModel; + +public class CalendarPanel extends JDialog { + private JComboBox comboBoxMonth; + private JSpinner spinnerYear; + private JTable2 table; + private JTableModel2 tableModel; + private Calendar calendar; + public Date selecttime; + private String[] days = { "", "һ", "ڶ", "", "", "", "" }; + private String[] months = { "һ", + "", + "", + "", + "", + "", + "", + "", + "", + "ʮ", + "ʮһ", + "ʮ" + }; + private int year = -1; + private int month = -1; + private int date = -1; + private int oldYear = -1; + private int oldMonth = -1; + private int oldDate = -1; + private boolean flag = true; + private JButton okButton; + private JButton cancelButton; + private TableWithRowHead twrh; + private boolean bo; + public Date getSelecttime() { + return selecttime; +} + +public void setSelecttime(Date selecttime) { + this.selecttime = selecttime; +} + +public CalendarPanel(JFrame frame) { + + super(frame, true); + this.setTitle("ѡ"); + calendar = Calendar.getInstance(); + initComponent(); + setSize(350, 300); + center(); + setVisible(true); + } +public CalendarPanel(TableWithRowHead twrh,boolean bo) { + this.twrh = twrh; + this.bo=bo; + this.setTitle("ѡ"); + calendar = Calendar.getInstance(); + initComponent(); + setSize(350, 300); + center(); + setAlwaysOnTop(true); + setVisible(true); +} +public CalendarPanel() { + this.setTitle("ѡ"); + calendar = Calendar.getInstance(); + initComponent(); + setSize(350, 300); + center(); + setVisible(true); +} + public CalendarPanel(Calendar calendar) { + + super(); + this.calendar = calendar; + initComponent(); + setSize(350, 300); + center(); + setVisible(true); + } + + public CalendarPanel(Date date) { + + super(); + this.calendar = Calendar.getInstance(); + this.calendar.setTime(date); + initComponent(); + setSize(350, 300); + center(); + setVisible(true); + } + + public CalendarPanel(int year, int month, int date) { + + super(); + this.calendar = Calendar.getInstance(); + calendar.set(Calendar.YEAR, year); + calendar.set(Calendar.MONTH, month - 1); + calendar.set(Calendar.DATE, date); + oldYear = calendar.get(Calendar.YEAR); + oldMonth = calendar.get(Calendar.MONTH); + oldDate = calendar.get(Calendar.DATE); + initComponent(); + setSize(350, 300); + center(); + setVisible(true); + } + + public void center() { + + Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); + Dimension frameSize = getSize(); + + if (frameSize.height > screenSize.height) { + frameSize.height = screenSize.height; + } + if (frameSize.width > screenSize.width) { + frameSize.width = screenSize.width; + } + + super.setLocation( + (screenSize.width - frameSize.width) / 2, + (screenSize.height - frameSize.height) / 2 + ); + } + + public Calendar getCalendar() { + return calendar; + } + + public String getCalendarByDate(String tag) { + + StringBuffer strRet = new StringBuffer(); + if (calendar != null) { + oldYear = calendar.get(Calendar.YEAR); + oldMonth = calendar.get(Calendar.MONTH)+1; + oldDate = calendar.get(Calendar.DATE); + + strRet.append(oldYear); + strRet.append(tag); + if (oldMonth < 10) + strRet.append("0" + oldMonth); + else + strRet.append(oldMonth); + strRet.append(tag); + if (oldDate < 10) + strRet.append("0" + oldDate); + else + strRet.append(oldDate); + + return strRet.toString(); + } + return null; + } + + public Date getCalendarByDate() { + if (calendar != null) + return calendar.getTime(); + return null; + } + //ʼpanel + private void initComponent() { + oldYear = calendar.get(Calendar.YEAR); + oldMonth = calendar.get(Calendar.MONTH); + oldDate = calendar.get(Calendar.DATE); + // this.setBorder(new TitledBorder("Date")); + this.getContentPane().setLayout(new BorderLayout()); + setNorthPanel(); + setCenterPanel(); + setSouthPanel(); + eventListenter(); + setData(); + } + //Ĭϵʱ伴Ϊǰʱ + private void setData() { + + year = calendar.get(Calendar.YEAR); + month = calendar.get(Calendar.MONTH); + date = calendar.get(Calendar.DATE); + comboBoxMonth.setSelectedIndex(month); + spinnerYear.setValue(new Integer(year)); + } + + private void eventListenter() { + + spinnerYear.addChangeListener(new ChangeListener() { + public void stateChanged(ChangeEvent e) { + year = Integer.parseInt(String.valueOf(spinnerYear.getValue())); + refreshTable(); + } + }); + + comboBoxMonth.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + month = comboBoxMonth.getSelectedIndex(); + refreshTable(); + } + }); + + table.getSelectionModel().addListSelectionListener( + new ListSelectionListener() { + public void valueChanged(ListSelectionEvent e) { + if (table.getSelectedRow()>-1&&table.getSelectedColumn()>-1) { + date = Integer.parseInt( + String.valueOf( + table.getValueAt( + table.getSelectedRow(), + table.getSelectedColumn() + ) + ) + ); + calendar.set(Calendar.YEAR, year); + calendar.set(Calendar.MONTH, month); + calendar.set(Calendar.DATE, date); + } + } + } + ); + + AbstractAction right = (new AbstractAction() { + private static final long serialVersionUID = -3429888240127305492L; + public void actionPerformed(ActionEvent e) { + if (table.getColumnCount() == table.getSelectedColumn() + 1) { + table.changeSelection( + table.getSelectedRow() + 1, + 0, + false, + false + ); + } else { + table.changeSelection( + table.getSelectedRow(), + table.getSelectedColumn() + 1, + false, + false + ); + } + } + }); + + AbstractAction left = (new AbstractAction() { + private static final long serialVersionUID = -2487040789339112435L; + public void actionPerformed(ActionEvent e) { + if (0 > table.getSelectedColumn() - 1) { + table.changeSelection( + table.getSelectedRow() - 1, + table.getColumnCount() - 1, + false, + false + ); + } else { + table.changeSelection( + table.getSelectedRow(), + table.getSelectedColumn() - 1, + false, + false + ); + } + } + }); + + InputMap inputMap = table.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); + KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0); + table.getActionMap().put(inputMap.get(keyStroke), right); + keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0); + table.getActionMap().put(inputMap.get(keyStroke), left); + okButton.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) { + calendar.set( + Calendar.YEAR, + Integer.parseInt( + String.valueOf(spinnerYear.getValue()) + ) + ); + calendar.set( + Calendar.MONTH, + comboBoxMonth.getSelectedIndex() + ); + calendar.set( + Calendar.DATE, + Integer.parseInt( + String.valueOf( + table.getValueAt( + table.getSelectedRow(), + table.getSelectedColumn() + ) + ) + ) + ); + + oldYear = calendar.get(Calendar.YEAR); + oldMonth = calendar.get(Calendar.MONTH); + oldDate = calendar.get(Calendar.DATE); + selecttime = CalendarPanel.this.getCalendarByDate(); + TableWithRowHead tw = new TableWithRowHead(twrh,selecttime); + setVisible(false); + } + + }); + + cancelButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + setVisible(false); + } + }); + /* + addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + calendar = null; + super.windowClosing(e); + } + }); + */ + + } + + private void refreshTable() { + for (int i = tableModel.getRowCount() - 1; i > 0; i--) { + tableModel.removeRow(i); + } + calendar.set(Calendar.YEAR, year); + calendar.set(Calendar.MONTH, month); + int maxDate = calendar.getActualMaximum(Calendar.DATE); + calendar.set(Calendar.DATE, 1); + int startDay = calendar.get(Calendar.DAY_OF_WEEK); + for (int i = 0; i < 6; i++) { + tableModel.addRow(new Object[7]); + } + int selectRow = -1; + int selectColumn = -1; + for (int i = 0; i < maxDate; i++) { + int m = (int) ((startDay - 1) / 7) + 1; + int n = (startDay - 1) % 7; + tableModel.setValueAt(String.valueOf(i + 1), m, n); + startDay = startDay + 1; + if (date != -1 && date == i + 1) { + selectRow = m; + selectColumn = n; + } + } + table.changeSelection(selectRow, selectColumn, false, false); + } + + + + private void setSouthPanel() { + + JPanel panel = new JPanel(); + panel.setLayout(new FlowLayout(FlowLayout.RIGHT)); + okButton = new JButton("OK"); + panel.add(okButton); + cancelButton = new JButton("Cancel"); + panel.add(cancelButton); + this.getContentPane().add(panel, BorderLayout.SOUTH); + } + + + private void setCenterPanel() { + + table = new JTable2(); + tableModel = new JTableModel2(); + tableModel.setColumnIdentifiers(days); + tableModel.addRow(days); + table.setModel(tableModel); + for (int i = 0; i < 7; i++) { + table.getColumnModel().getColumn(i).setCellRenderer( + new DefaultTableCellRenderer2() + ); + } + this.getContentPane().add(table, BorderLayout.CENTER); + } + + private void setNorthPanel() { + JPanel panel = new JPanel(); + panel.setLayout(new FlowLayout()); + comboBoxMonth = new JComboBox(); + for (int i = 0; i < months.length; i++) { + comboBoxMonth.addItem(months[i]); + } + comboBoxMonth.setSelectedIndex(-1); + panel.add(comboBoxMonth); + RolloverSpinnerListModel numberModel = new RolloverSpinnerListModel( + 1980, 1980, 2099, 1); + spinnerYear = new JSpinner(numberModel); + JSpinner.NumberEditor numberEditor = new JSpinner.NumberEditor( + spinnerYear, ""); + spinnerYear.setEditor(numberEditor); + panel.add(spinnerYear); + this.getContentPane().add(panel, BorderLayout.NORTH); + } + + public static void main(String[] args) { + + JFrame frame = new JFrame(); + frame.setDefaultCloseOperation(EXIT_ON_CLOSE); + CalendarPanel calendarPanel = new CalendarPanel(frame); + // frame.getContentPane().add(calendarPanel, BorderLayout.CENTER); + // calendarPanel.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + calendarPanel.setVisible(true); + } + + protected void validateTree() { + + super.validateTree(); + if (flag) { + table.requestFocus(); + flag = false; + } + } +} + +class RolloverSpinnerListModel extends SpinnerNumberModel { + + private static final long serialVersionUID = 7366455425120197392L; + + public RolloverSpinnerListModel( + int value, + int minimum, + int maximum, + int stepSize + ) { + super(value, minimum, maximum, stepSize); + } + + public Object getNextValue() { + + Object returnValue = super.getNextValue(); + if (returnValue == null) { + returnValue = super.getMinimum(); + } + return returnValue; + } + + public Object getPreviousValue() { + + Object returnValue = super.getPreviousValue(); + if (returnValue == null) { + returnValue = super.getMaximum(); + } + return returnValue; + } +} + +class JTable2 extends JTable { + + private static final long serialVersionUID = 2092799354481792367L; + + public JTable2() { + this.getTableHeader().setReorderingAllowed(false); + this.getTableHeader().setResizingAllowed(false); + this.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + this.setCellSelectionEnabled(true); + this.setGridColor(Color.white); + } + + public void changeSelection( + int rowIndex, + int columnIndex, + boolean toggle, + boolean extend + ) { + + if (this.getValueAt(rowIndex, columnIndex) == null) { + return; + } + + if (rowIndex == 0) { + return; + } + super.changeSelection(rowIndex, columnIndex, toggle, extend); + } + + public void repaint(int x, int y, int width, int height) { + + super.repaint(x, y, width, height); + if (height > 0) { + makeTableRowHeight(); + } + } + + protected void validateTree() { + super.validateTree(); + makeTableRowHeight(); + } + + private void makeTableRowHeight() { + + int rowHeight = (int) ((this.getHeight() / 7) * 0.6); + if (rowHeight > 0) { + this.setRowHeight(0, rowHeight); + } + + rowHeight = (int) ((this.getHeight() - rowHeight) / 6); + if (rowHeight > 0) { + for (int i = 1; i < 8; i++) { + this.setRowHeight(i, rowHeight); + } + } + } +} + + + +class JTableModel2 extends DefaultTableModel { + + private static final long serialVersionUID = 3655520869200784738L; + public boolean isCellEditable(int row, int column) { + return false; + } +} + +class DefaultTableCellRenderer2 extends DefaultTableCellRenderer { + + private static final long serialVersionUID = -8779549993366848535L; + public Component getTableCellRendererComponent( + JTable table, + Object value, + boolean isSelected, + boolean hasFocus, + int row, + int column + ) { + Component component = + super.getTableCellRendererComponent( + table, + value, + isSelected, + hasFocus, + row, + column + ); + + this.setHorizontalAlignment(SwingConstants.CENTER); + + if (row == 0) { + component.setBackground( + UIManager.getColor("Table.focusCellForeground") + ); + + component.setForeground( + UIManager.getColor("Table.focusCellBackground") + ); + return component; + } else { + if (isSelected) { + component.setBackground( + UIManager.getColor("Table.focusCellForeground") + ); + component.setForeground( + UIManager.getColor("Table.focusCellBackground") + ); + } else { + component.setBackground( + UIManager.getColor("Table.focusCellBackground") + ); + component.setForeground( + UIManager.getColor("Table.focusCellForeground") + ); + } + + if (column == 0 || column == 6) { + component.setForeground(Color.red); + } + } + return component; + } +} + + diff --git a/src/com/connor/jk/plm/YSXQForm/JK8_YSXQ_Form.java b/src/com/connor/jk/plm/YSXQForm/JK8_YSXQ_Form.java new file mode 100644 index 0000000..f5f577a --- /dev/null +++ b/src/com/connor/jk/plm/YSXQForm/JK8_YSXQ_Form.java @@ -0,0 +1,362 @@ +package com.connor.jk.plm.YSXQForm; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import javax.swing.JButton; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.table.DefaultTableModel; +import javax.swing.table.TableColumnModel; + + +import com.teamcenter.rac.form.TextAreaRenderer; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.stylesheet.AbstractRendering; +import com.teamcenter.rac.util.MessageBox; + +public class JK8_YSXQ_Form extends AbstractRendering { + private TCComponentForm form; + private TCSession session; + private Date getdate; + private String[] names = { "jk8CustomerInfo", "jk8CollectWay", + "jk8TargetCustomerOrMarket", "jk8CustomerProbDesp", + "jk8SuggestSolutionDesp", "jk8AppealsType", "jk8Urgency", + "jk8Importance", "jk8ForwardDepartment", "jk8Presenter", + "jk8ContactInfo", "jk8PresentDate", "jk8TargetProduct", + "jk8RealizeOrNot", "jk8ImplementPath" }; + private String[] tit; + private Object[][] obj; + private Map map = new HashMap(); + + private DefaultTableModel tableModel; // TableModel + private TableWithRowHead table = null; + + private JButton addBut; + private JButton delBut; + private JButton outBut; + private JScrollPane scr; + private TCProperty[] pros; + private int row = 0; + + public JK8_YSXQ_Form(TCComponentForm arg0) throws Exception { + super(arg0); + // TODO Auto-generated constructor stub + System.out.println("aaa"); + form = arg0; + session = arg0.getSession(); + loadRendering(); + } + + public JK8_YSXQ_Form(TableWithRowHead table, Date selecttime) + throws Exception { + // TODO Auto-generated constructor stub + this.table = table; + this.getdate = selecttime; + setDateValue(selecttime); + + } + + public void init() { + System.out.println("init"); + setLayout(new BorderLayout()); + JPanel jpbut = new JPanel(); + addBut = new JButton(""); + delBut = new JButton("ɾ"); + outBut = new JButton("ǰ"); + jpbut.add(addBut); + jpbut.add(delBut); + jpbut.add(outBut); + TableColumnModel cmodel = table.getColumnModel(); + TextAreaRenderer textAreaRenderer = new TextAreaRenderer(); + for (int i = 1; i < names.length+1; i++) { + cmodel.getColumn(i).setCellRenderer(textAreaRenderer); + } + + // + scr = new JScrollPane(table); + scr.setPreferredSize(new Dimension(1000, 400)); + + add(jpbut, BorderLayout.NORTH); + // formв˹ + add(scr, BorderLayout.CENTER); + setPreferredSize(new Dimension(1200, 400)); + // formΪɼ + setVisible(true); + outBut.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + int rowCount = table.getRowCount(); + int couCount = table.getColumnCount(); + String[][] strss=new String[rowCount][couCount]; + for(int i=0;i= 0) { + int yn = JOptionPane.showConfirmDialog(null, "ǷɾѡУ", + "ɾȷ", 0, 2); + if (yn == 0) { + int cow = 0; + // System.out.println("rc="+rc); + + int[] rows = table.getSelectedRows(); + int count = tableModel.getRowCount(); + for (int i = rows.length - 1; i >= 0; i--) { + tableModel.removeRow(rows[i]); + cow++; + } + + tableModel.setRowCount(count - cow); + setxh(); + } + } else { + MessageBox.post("ѡҪɾ", "ʾ", MessageBox.INFORMATION); + } + + } + }); + } + + @Override + public void loadRendering() throws TCException { + // TODO Auto-generated method stub + System.out.println("load"); + pros = form.getAllFormProperties(); + tit = new String[names.length+1]; + tit[0]=""; + for (int i = 0; i < names.length; i++) { + for (TCProperty p : pros) { + if (p.getPropertyName().equals(names[i])) { + tit[i+1] = p.getName(); + if (names[i].equals("jk8PresentDate")) { + String[] ss = null; + if (p.getDateValueArray() != null) { + SimpleDateFormat formatter = new SimpleDateFormat( + "yyyy-MM-dd"); + ss = new String[p.getDateValueArray().length]; + for (int j = 0; j < p.getDateValueArray().length; j++) { + if(p.getDateValueArray()[j]!=null) + ss[j] = formatter.format(p.getDateValueArray()[j]); + } + } + + map.put(p.getName(), ss); + } else { + map.put(p.getName(), p.getStringArrayValue()); + + row = p.getStringArrayValue() != null ? p + .getStringArrayValue().length : 0; + } + break; + } + } + } + obj = new Object[row][names.length+1]; + for(int i = 0; i < row; i++){ + obj[i][0]=i+1+""; + for (int j = 0; j < tit.length-1; j++) { + obj[i][j+1]=map.get(tit[j+1])[i]; + } + } + + tableModel = new DefaultTableModel(obj, tit); + table = new TableWithRowHead(tableModel, session); + init(); + } + + + public boolean isRenderingModified() { + System.out.println("isRenderingModified"); + + int rowCount = table.getRowCount(); + int couCount = table.getColumnCount(); + for(int i=0;i"+column_index); + } + + /** + * set the table header height + */ + public void setTableHeadHeight(int height) { + this.table.getTableHeader().setPreferredSize(new Dimension(0, height)); + } + + /** + * һ࣬ʵJTableϵһťһʱؼͻѡ + */ + class ButtonColumn extends AbstractCellEditor implements TableCellRenderer, + TableCellEditor, ActionListener { + TableWithRowHead table; + + JButton renderButton; + + JButton editButton; + + String text; + + TCSession session; + + int column; + + public ButtonColumn(TableWithRowHead table, int column) { + super(); + this.table = table; + renderButton = new JButton(); + this.column = column; + editButton = new JButton(); + editButton.setFocusPainted(false); + editButton.addActionListener(this); + + TableColumnModel columnModel = table.getColumnModel(); + columnModel.getColumn(column).setCellRenderer(this); + columnModel.getColumn(column).setCellEditor(this); + } + + public ButtonColumn(TCSession session, TableWithRowHead table, + int column) { + super(); + this.table = table; + this.session = session; + this.column = column; + renderButton = new JButton(); + + editButton = new JButton(); + editButton.setFocusPainted(false); + editButton.addActionListener(this); + + TableColumnModel columnModel = table.getColumnModel(); + columnModel.getColumn(column).setCellRenderer(this); + columnModel.getColumn(column).setCellEditor(this); + } + + public Component getTableCellRendererComponent(JTable table, + Object value, boolean isSelected, boolean hasFocus, int row, + int column) { + + if (hasFocus) { + renderButton.setForeground(table.getForeground()); + renderButton.setBackground(UIManager + .getColor("Button.background")); + } else if (isSelected) { + renderButton.setForeground(table.getSelectionForeground()); + renderButton.setBackground(table.getSelectionBackground()); + } else { + renderButton.setForeground(table.getForeground()); + renderButton.setBackground(UIManager + .getColor("Button.background")); + } + + renderButton.setText((value == null) ? "" : value.toString()); + return renderButton; + } + + // Ȼֵ + public Component getTableCellEditorComponent(JTable table, + Object value, boolean isSelected, int row, int column) { + text = (value == null) ? "" : value.toString(); + editButton.setText(text); + return editButton; + } + + public Object getCellEditorValue() { + return text; + } + + + public void actionPerformed(ActionEvent e) { + fireEditingStopped(); + if (this.column == 12) { + CalendarPanel calendarPanel = new CalendarPanel(table,true);//ʱģ + } + + } + + } + + /** + * + */ + public void setSelected(int row) { + + } + + /** + * ѡ(this method is for TableWithRowHead) + * + * @param rows + */ + public void setSelected(int[] rows) { + for (int i = 0; i < rows.length; i++) { + this.setSelected(rows[i]); + } + } + + /** + * ѡе(this method is for TableWithRowHead) + */ + public int[] getRealRows() { + int[] selectedRows = this.getSelectedRows(); // õѡе + int[] realRows = new int[selectedRows.length]; + for (int i = 0; i < realRows.length; i++) { + // realRows[i] = this.convertRowIndexToModel(selectedRows[i]); + realRows[i] = this.convertColumnIndexToModel(selectedRows[i]); + } + return realRows; + } + + /** + * ij + * + * @param col + */ + public void hideColumn(int col) { + JTableHeader tableHeader = this.getTableHeader(); + tableHeader.getColumnModel().getColumn(col).setPreferredWidth(0); + tableHeader.getColumnModel().getColumn(col).setMaxWidth(0); + tableHeader.getColumnModel().getColumn(col).setMinWidth(0); + table.getColumnModel().getColumn(col).setPreferredWidth(0); + table.getColumnModel().getColumn(col).setMaxWidth(0); + table.getColumnModel().getColumn(col).setMinWidth(0); + } + + public void setTableRowHeight(int height) { + this.table.setRowHeight(height); + } + + public void setTableRowHeight(int row, int height) { + this.table.setRowHeight(row, height); + } + + + /** + * Զп resize column width automatically + */ + public void fitTableColumns(JTable myTable) { + myTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + JTableHeader header = myTable.getTableHeader(); + int rowCount = myTable.getRowCount(); + Enumeration columns = myTable.getColumnModel().getColumns(); + while (columns.hasMoreElements()) { + TableColumn column = (TableColumn) columns.nextElement(); + int col = header.getColumnModel().getColumnIndex( + column.getIdentifier()); + int width = (int) header.getDefaultRenderer() + .getTableCellRendererComponent(myTable, + column.getIdentifier(), false, false, -1, col) + .getPreferredSize().getWidth(); + for (int row = 0; row < rowCount; row++) { + int preferedWidth = (int) myTable.getCellRenderer(row, col) + .getTableCellRendererComponent(myTable, + myTable.getValueAt(row, col), false, false, + row, col).getPreferredSize().getWidth(); + width = Math.max(width, preferedWidth); + } + header.setResizingColumn(column); // кҪ + column.setWidth(width + myTable.getIntercellSpacing().width); + } + } + /** + * Ϊ̶ȡ//fix table column width + */ + public void setFixColumnWidth(JTable table) { + //this.setRowHeight(30); + TableColumnModel tcm = table.getTableHeader().getColumnModel(); + for (int i = 0; i < tcm.getColumnCount(); i++) { + TableColumn tc = tcm.getColumn(i); +// if(i==0){ +// tc.setMaxWidth(35); +// tc.setMinWidth(35); +// }else if(i==2 ||i==1||i==7||i==8||i==13){ +// tc.setMaxWidth(200); +// }else if( i == 6||i == 11){ +// tc.setMaxWidth(100); +// }else if(i == 3||i == 4||i == 5||i == 10||i == 2){ +// tc.setMaxWidth(35); +// tc.setMinWidth(35); +// }else{ +// tc.setMaxWidth(100); +// } + if (i == 0) { + tc.setMaxWidth(35); + tc.setMinWidth(35); + } else { + tc.setMinWidth(20); + tc.setMaxWidth(200); + } + } + } +} + diff --git a/src/com/connor/jk/plm/addMark/ProgressBar.java b/src/com/connor/jk/plm/addMark/ProgressBar.java new file mode 100644 index 0000000..854d49b --- /dev/null +++ b/src/com/connor/jk/plm/addMark/ProgressBar.java @@ -0,0 +1,171 @@ +/** + * @file ProgressBar.java + * + * @brief Create progress bar + * + * @author Yanghui + * + * @history + * ================================================================ + * Date Name Description of Change + * 25-July-2008 Yanghui this class is used to create + * progress bar. + */ +package com.connor.jk.plm.addMark; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JProgressBar; +import javax.swing.Timer; +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.util.PropertyLayout; +import com.teamcenter.rac.util.Registry; + +/** + * @class ProgressBar + * @brief Create progress bar + * @author Yanghui + */ +public class ProgressBar extends AbstractAIFDialog implements ActionListener { + /** + * @var ProgressBar.progressbar + * @brief JProgressBar + */ + private JProgressBar progressbar; + + /** + * @var ProgressBar.label + * @brief label used to tips + */ + private JLabel label; + + /** + * @var ProgressBar.timer + * @brief timer used to timing operation + */ + private Timer timer; + + /** + * @var ProgressBar.bool + * @brief bool used to flag thread return + */ + private boolean bool = false; + + /** + * @var Progressbar.registry + * @brief Registry + */ + private Registry registry; + + /** + * @fn public ProgressBar() + * @brief constructor + * @param[in] null + */ + private String showLable = null ; + public ProgressBar(String showlable) { + super(true); + showLable = showlable; + this.setAlwaysOnTop(true); + } + + /** + * @fn public void setBool(boolean bool) + * @brief set bool value + * @param[in] bool + * @param[out] null + */ + public void setBool(boolean bool) { + this.bool = bool; + } + + /** + * @fn private void initUI() + * @brief createDialog method + * @param[in] null + * @param[out] null + */ + public void initUI() { + Container container = getContentPane(); + JPanel mainPanel = new JPanel(new PropertyLayout()); + this.label = new JLabel(showLable, JLabel.CENTER); + this.progressbar = new JProgressBar(); + this.progressbar.setOrientation(JProgressBar.HORIZONTAL); + this.progressbar.setMinimum(0); + this.progressbar.setMaximum(100); + this.progressbar.setValue(0); + this.progressbar.setPreferredSize(new Dimension(200, 15)); + this.progressbar.setBorderPainted(true); + this.timer = new Timer(50, (ActionListener) this); + this.timer.setRepeats(false); + mainPanel.add("1.1.center", new JLabel(" ")); + mainPanel.add("2.1.center", label); + mainPanel.add("3.1.center", progressbar); + mainPanel.add("4.1.center", new JLabel(" ")); + container.add(mainPanel); + pack(); + setLocation(500, 200); + TaskThread thread = new TaskThread(this); + thread.start(); + addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + bool = true; + } + }); + this.setVisible(true); + } + + /** + * @class TaskThread + * @brief Create progressbar + * + */ + class TaskThread extends Thread { + private ProgressBar bar; + + public TaskThread(ProgressBar bar) { + this.bar = bar; + } + + public void run() { + if (bool == false) { + // Set Status is running. + // session.setStatus(registry.getString("export Running")); + } + for (int i = 0; i < i + 1; i++) { + timer.start(); + int value = progressbar.getValue(); + if (value < 100) { + value = value + 5; + progressbar.setValue(value); + } else { + timer.stop(); + progressbar.setValue(0); + } + try { + sleep(100); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + if (bool == true) { + bar.setVisible(false); + bar.dispose(); + return; + + } + + } + } + } + + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + + } +} diff --git a/src/com/connor/jk/plm/addMark/ProgressBarThread.java b/src/com/connor/jk/plm/addMark/ProgressBarThread.java new file mode 100644 index 0000000..5d12595 --- /dev/null +++ b/src/com/connor/jk/plm/addMark/ProgressBarThread.java @@ -0,0 +1,41 @@ +/** + * @file ProgressBarThread.java + * + * @brief control progressBar. + * + * @author Yanghui + * + * @history + * ================================================================ + * Date Name Description of Change + * 08-Auguest-2008 Yanghui this class is used to control + * progress bar. + */ +package com.connor.jk.plm.addMark; + +/** + * @class ProgressBarThread + * @brief Create progress bar thread + * @author Yanghui + */ +public class ProgressBarThread extends Thread { + + private ProgressBar bar; + + private String title; + + public ProgressBarThread(String title,String showLable) { + this.title = title; + bar = new ProgressBar(showLable); + } + + public void run() { + bar.setTitle(title); + bar.initUI(); + } + + public void setBool(boolean bool) { + bar.setBool(true); + bar.setAlwaysOnTop(false); + } +} diff --git a/src/com/connor/jk/plm/addMark/Util.java b/src/com/connor/jk/plm/addMark/Util.java new file mode 100644 index 0000000..6c2ec63 --- /dev/null +++ b/src/com/connor/jk/plm/addMark/Util.java @@ -0,0 +1,53 @@ +package com.connor.jk.plm.addMark; +import java.util.List; + +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.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +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.TCUserService; +import com.teamcenter.rac.util.MessageBox; + +public class Util { + public static TCPreferenceService service; + public static TCSession session; + public static TCUserService userservice;; + + static { + if (session == null) { + session = (TCSession) (AIFUtility.getCurrentApplication() + .getSession()); + } + if (service == null) + service = session.getPreferenceService(); + } + + public static void setByPass(boolean val) throws TCException { + if (userservice == null) { + userservice = session.getUserService(); + } + Object[] obj = new Object[1]; + obj[0] = "origin"; + if (val) { + userservice.call("ORIGIN_set_bypass", obj); + } else { + userservice.call("ORIGIN_close_bypass", obj); + } + } + + +} diff --git a/src/com/connor/jk/plm/addMark/addMark_Action.java b/src/com/connor/jk/plm/addMark/addMark_Action.java new file mode 100644 index 0000000..39bc74e --- /dev/null +++ b/src/com/connor/jk/plm/addMark/addMark_Action.java @@ -0,0 +1,55 @@ +/** + * + */ +package com.connor.jk.plm.addMark; + +import java.awt.event.ActionEvent; +import java.util.HashMap; +import java.util.Map; + +import javax.swing.AbstractAction; + +import org.eclipse.core.commands.AbstractHandler; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.common.actions.AbstractAIFAction; +import com.teamcenter.rac.aif.kernel.AIFComponentContext; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentBOMLine; +import com.teamcenter.rac.kernel.TCComponentBOMViewRevision; +import com.teamcenter.rac.kernel.TCComponentBOMWindow; +import com.teamcenter.rac.kernel.TCComponentBOMWindowType; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +/** + * @author Administrator + * + */ +public class addMark_Action extends AbstractAIFAction { + private AbstractAIFApplication app; + private InterfaceAIFComponent targetComp; + private TCSession session; + + + public addMark_Action(AbstractAIFApplication arg0, String arg1) { + super(arg0, arg1); + this.app = arg0; + this.session = (TCSession) app.getSession(); + this.targetComp = app.getTargetComponent(); + } + + + @Override + public void run() { + addMark_Dialog dialog=new addMark_Dialog(session); + new Thread(dialog).run(); + + } + +} diff --git a/src/com/connor/jk/plm/addMark/addMark_Bean.java b/src/com/connor/jk/plm/addMark/addMark_Bean.java new file mode 100644 index 0000000..d636f96 --- /dev/null +++ b/src/com/connor/jk/plm/addMark/addMark_Bean.java @@ -0,0 +1,80 @@ +package com.connor.jk.plm.addMark; + +public class addMark_Bean { + + private String number;//ţ + private String materialCode;//ϱ룻 + private String materialName;// + private String techCode;//ͺ + private String specCode;//ͺ + private String quantity;// + private String unit;//λ + private String drawID;//ͼ + + //ȫ + private String global_list; + //ֲ + private String local_list; + + public String getGlobal_list() { + return global_list; + } + public void setGlobal_list(String global_list) { + this.global_list = global_list; + } + public String getLocal_list() { + return local_list; + } + public void setLocal_list(String local_list) { + this.local_list = local_list; + } + public String getNumber() { + return number; + } + public void setNumber(String number) { + this.number = number; + } + public String getMaterialCode() { + return materialCode; + } + public void setMaterialCode(String materialCode) { + this.materialCode = materialCode; + } + public String getMaterialName() { + return materialName; + } + public void setMaterialName(String materialName) { + this.materialName = materialName; + } + public String getTechCode() { + return techCode; + } + public void setTechCode(String techCode) { + this.techCode = techCode; + } + public String getSpecCode() { + return specCode; + } + public void setSpecCode(String specCode) { + this.specCode = specCode; + } + public String getQuantity() { + return quantity; + } + public void setQuantity(String quantity) { + this.quantity = quantity; + } + public String getUnit() { + return unit; + } + public void setUnit(String unit) { + this.unit = unit; + } + public String getDrawID() { + return drawID; + } + public void setDrawID(String drawID) { + this.drawID = drawID; + } + +} diff --git a/src/com/connor/jk/plm/addMark/addMark_Dialog.java b/src/com/connor/jk/plm/addMark/addMark_Dialog.java new file mode 100644 index 0000000..43a07ad --- /dev/null +++ b/src/com/connor/jk/plm/addMark/addMark_Dialog.java @@ -0,0 +1,137 @@ +package com.connor.jk.plm.addMark; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.io.File; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.swing.BorderFactory; +import javax.swing.DefaultComboBoxModel; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JFileChooser; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; +import javax.swing.border.TitledBorder; +import javax.swing.filechooser.FileSystemView; + +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.aif.kernel.AIFComponentContext; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentBOMLine; +import com.teamcenter.rac.kernel.TCComponentBOMViewRevision; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCComponentICO; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.kernel.ics.ICSProperty; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; + +public class addMark_Dialog extends AbstractAIFDialog { + + private TCSession session; + private JLabel pathLabel; + private JTextField pathField; + private JButton celButton; + private String selectExportFileType = "Excel"; + + private JButton pathButton; + private JFileChooser jFileChooser; + private JButton okButton; + ProgressBarThread wait; + InterfaceAIFComponent comp; + + + public addMark_Dialog(TCSession session) { + this.session = session; + } + + @Override + public void run() { + initUI(); + + } + + + private void initUI() { + + this.setTitle("ʷ״̬"); + this.setSize(new Dimension(300, 300)); + this.setLayout(new BorderLayout()); + this.setAlwaysOnTop(true); + setLayout(new BorderLayout()); + JPanel mainPanel = new JPanel(new PropertyLayout()); + + + + pathLabel = new JLabel("ļ·"); + pathField = new JTextField(20);// ǰû· + pathField.setEditable(false); + pathButton = new JButton("ѡļ"); + okButton = new JButton("ȷ"); + jFileChooser = new JFileChooser(); + jFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); + // + pathButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent actionevent) { + setAlwaysOnTop(false); + if (jFileChooser.showOpenDialog(null) != 1) + pathField.setText(jFileChooser.getSelectedFile().getAbsolutePath()); + setAlwaysOnTop(true); + } + }); + + okButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent arg0) { + disposeDialog(); + dispose(); + String filePath=jFileChooser.getSelectedFile().getAbsolutePath(); + wait = new ProgressBarThread(" ", "ִУԵ..."); + wait.start(); + addMark_Operation operation = new addMark_Operation( filePath, wait,session); + session.queueOperation(operation); + } + }); + + mainPanel.add("1.1.left.top", pathLabel); + mainPanel.add("1.2.left.top", pathField); + mainPanel.add("1.3.left.top", pathButton); + add(mainPanel, BorderLayout.CENTER); + JPanel buttonPanel = new JPanel(new FlowLayout()); + buttonPanel.add(okButton); + celButton = new JButton("ȡ"); + celButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent arg0) { + disposeDialog(); + dispose(); + + } + }); + buttonPanel.add(celButton); + add(buttonPanel, BorderLayout.SOUTH); + centerToScreen(); + pack(); + showDialog(); + + } + +} diff --git a/src/com/connor/jk/plm/addMark/addMark_Handler.java b/src/com/connor/jk/plm/addMark/addMark_Handler.java new file mode 100644 index 0000000..ac117e7 --- /dev/null +++ b/src/com/connor/jk/plm/addMark/addMark_Handler.java @@ -0,0 +1,21 @@ +package com.connor.jk.plm.addMark; + +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.aifrcp.AIFUtility; + +public class addMark_Handler extends AbstractHandler{ + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + // TODO Auto-generated method stub + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + addMark_Action action=new addMark_Action(app,null); + new Thread(action).start(); + return null; + } + +} diff --git a/src/com/connor/jk/plm/addMark/addMark_Operation.java b/src/com/connor/jk/plm/addMark/addMark_Operation.java new file mode 100644 index 0000000..3c23583 --- /dev/null +++ b/src/com/connor/jk/plm/addMark/addMark_Operation.java @@ -0,0 +1,559 @@ +package com.connor.jk.plm.addMark; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.List; +import org.apache.poi.hssf.usermodel.HSSFCellStyle; +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.IndexedColors; +import org.apache.poi.ss.util.CellRangeAddress; +import org.apache.poi.xssf.usermodel.XSSFCell; +import org.apache.poi.xssf.usermodel.XSSFCellStyle; +import org.apache.poi.xssf.usermodel.XSSFFont; +import org.apache.poi.xssf.usermodel.XSSFRow; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + +import com.jacob.activeX.ActiveXComponent; +import com.jacob.com.ComThread; +import com.jacob.com.Dispatch; +import com.jacob.com.Variant; +import com.teamcenter.rac.aif.AbstractAIFOperation; +import com.teamcenter.rac.aif.kernel.AIFComponentContext; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentBOMLine; +import com.teamcenter.rac.kernel.TCComponentBOMView; +import com.teamcenter.rac.kernel.TCComponentDataset; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCComponentTcFile; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.kernel.TCUserService; +import com.teamcenter.rac.util.MessageBox; + +import jxl.CellType; + +public class addMark_Operation extends AbstractAIFOperation { + private String type; + private String path; + private ProgressBarThread wait; + private TCSession session; + private TCComponentBOMLine comp; + private FileInputStream fis; + private XSSFWorkbook workbook; + private HSSFWorkbook workbook2; + private FileOutputStream out; + boolean right=true; + public addMark_Operation(String path, + ProgressBarThread wait, TCSession session) { + this.path = path; + this.wait = wait; + this.session = session; + this.comp = comp; + } + + @Override + public void executeOperation() throws Exception { + long start = System.currentTimeMillis(); + File file = new File(path.trim()); + if (file == null) { + return; + } + + fis = new FileInputStream(file); + TCComponent[] component=null; + if(path.trim().endsWith("xls")) { + workbook2=new HSSFWorkbook(fis); + HSSFSheet sheet=workbook2.getSheetAt(0); + int lastRow=sheet.getLastRowNum(); + HSSFRow row; + HSSFCellStyle sty2 = workbook2.createCellStyle(); + sty2.setBorderBottom((short) 1); + sty2.setBorderTop((short) 1); + sty2.setBorderLeft((short) 1); + sty2.setBorderRight((short) 1); + sty2.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER);// ֱ + sty2.setAlignment(XSSFCellStyle.ALIGN_CENTER);// ˮƽ + sty2.setFillPattern(XSSFCellStyle.SOLID_FOREGROUND); + sty2.setFillForegroundColor(IndexedColors.YELLOW.getIndex());// + for (int i = 1; i < lastRow; i++) { + + row = sheet.getRow(i); + for(int j=0;j<6;j++) { + if(row.getCell(j)==null) { + row.createCell(j); + } + } + row.getCell(0).setCellType(Cell.CELL_TYPE_STRING); + row.getCell(1).setCellType(Cell.CELL_TYPE_STRING); + row.getCell(2).setCellType(Cell.CELL_TYPE_STRING); + row.getCell(3).setCellType(Cell.CELL_TYPE_STRING); + row.getCell(4).setCellType(Cell.CELL_TYPE_STRING); + row.getCell(5).setCellType(Cell.CELL_TYPE_STRING); + String rev = row.getCell(1).getStringCellValue().trim(); + String item = row.getCell(0).getStringCellValue().trim(); + String master = row.getCell(2).getStringCellValue().trim(); + String property = row.getCell(3).getStringCellValue().trim(); + String value = row.getCell(4).getStringCellValue().trim(); + String statusMark=row.getCell(5).getStringCellValue().trim(); + TCComponent itemOrRev=null; + if(property.length()==0) { + if(item.length()>0) { + row.getCell(3).setCellStyle(sty2); + right=false; + } + }else { + + if(rev.length()>0) { + try { + component = session.search("汾...", new String[] { " ID", "汾" }, new String[] { item, rev }); + } catch (Exception e1) { + e1.printStackTrace(); + } + if(component.length==0) { + right=false; + row.getCell(0).setCellStyle(sty2); + row.getCell(1).setCellStyle(sty2); + continue; + }else { + + itemOrRev = (TCComponentItemRevision) component[0]; + } + //DZ޸ıԣǾ޸İ汾 + if(master.length()>0&&master.equals("master")) { + TCComponentForm form=(TCComponentForm) itemOrRev.getTCProperty("IMAN_master_form_rev").getReferenceValueArray()[0]; + right=setXlsProperty(form,property,value,row,sty2); + }else { + right=setXlsProperty(itemOrRev,property,value,row,sty2); + + } + + }else { + //ûа汾ö + try { + component = session.search("...", new String[] { " ID" }, new String[] { item }); + } catch (Exception e1) { + e1.printStackTrace(); + } + if(component.length==0) { + right=false; + row.getCell(0).setCellStyle(sty2); + continue; + }else { + + itemOrRev = (TCComponentItem) component[0]; + } + + right=setXlsItemProperty(itemOrRev,property,value,row,sty2); + + + } + } + try { + Util.setByPass(true); + } catch (TCException e2) { + e2.printStackTrace(); + } + if(statusMark.length()>0) { + + try { + setReleaseStatus(itemOrRev, statusMark);// + } catch (Exception e) { + right=false; + row.getCell(5).setCellStyle(sty2); + } + } + try { + Util.setByPass(false); + } catch (TCException e2) { + e2.printStackTrace(); + } + } + + }else if(path.trim().endsWith("xlsx")) { + workbook=new XSSFWorkbook(fis); + XSSFSheet sheet=workbook.getSheetAt(0); + int lastRow=sheet.getLastRowNum(); + XSSFRow row; + XSSFCellStyle sty2 = workbook.createCellStyle(); + sty2.setBorderBottom((short) 1); + sty2.setBorderTop((short) 1); + sty2.setBorderLeft((short) 1); + sty2.setBorderRight((short) 1); + sty2.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER);// ֱ + sty2.setAlignment(XSSFCellStyle.ALIGN_CENTER);// ˮƽ + sty2.setFillPattern(XSSFCellStyle.SOLID_FOREGROUND); + sty2.setFillForegroundColor(IndexedColors.YELLOW.getIndex());// + for (int i = 1; i < lastRow; i++) { + + row = sheet.getRow(i); + for(int j=0;j<6;j++) { + if(row.getCell(j)==null) { + row.createCell(j); + } + } + row.getCell(0).setCellType(Cell.CELL_TYPE_STRING); + row.getCell(1).setCellType(Cell.CELL_TYPE_STRING); + row.getCell(2).setCellType(Cell.CELL_TYPE_STRING); + row.getCell(3).setCellType(Cell.CELL_TYPE_STRING); + row.getCell(4).setCellType(Cell.CELL_TYPE_STRING); + row.getCell(5).setCellType(Cell.CELL_TYPE_STRING); + + if(row.getCell(0).getStringCellValue().trim().length()<4) { + continue; + } + + String item = row.getCell(0).getStringCellValue().trim(); + String rev = row.getCell(1).getStringCellValue().trim(); + String master=row.getCell(2).getStringCellValue().trim(); + String property = row.getCell(3).getStringCellValue().trim(); + String value = row.getCell(4).getStringCellValue().trim(); + String statusMark=row.getCell(5).getStringCellValue().trim(); + TCComponent itemOrRev=null; + + // + if(property.length()==0) { + if(item.length()>0) { + row.getCell(3).setCellStyle(sty2); + right=false; + } + }else { + + if(rev.length()>0) { + try { + component = session.search("汾...", new String[] { " ID", "汾" }, new String[] { item, rev }); + } catch (Exception e1) { + e1.printStackTrace(); + } + if(component.length==0) { + right=false; + row.getCell(0).setCellStyle(sty2); + row.getCell(1).setCellStyle(sty2); + continue; + }else { + + itemOrRev = (TCComponentItemRevision) component[0]; + } + //DZ޸ıԣǾ޸İ汾 + if(master.length()>0&&master.equals("master")) { + TCComponentForm form=(TCComponentForm) itemOrRev.getTCProperty("IMAN_master_form_rev").getReferenceValueArray()[0]; + right=setProperty(form,property,value,row,sty2); + }else { + right=setProperty(itemOrRev,property,value,row,sty2); + + } + }else { + //ûа汾ö + try { + component = session.search("...", new String[] { " ID" }, new String[] { item }); + } catch (Exception e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + if(component.length==0) { + right=false; + row.getCell(0).setCellStyle(sty2); + continue; + }else { + + itemOrRev = (TCComponentItem) component[0]; + } + + right=setItemProperty(itemOrRev,property,value,row,sty2); + + + } + } + // ·Ժ״̬ + try { + Util.setByPass(true); + } catch (TCException e2) { + e2.printStackTrace(); + } + if(statusMark.length()>0) { + + try { + setReleaseStatus(itemOrRev, statusMark);// + } catch (Exception e) { + e.printStackTrace(); + right=false; + row.getCell(5).setCellStyle(sty2); + } + } + try { + Util.setByPass(false); + } catch (TCException e2) { + e2.printStackTrace(); + } + } + + } + + //д± + if(right==false) { + File fileout; + String timeNow=GetNowDate(); + String fileOutPath=path.trim().split(".xls")[0]+timeNow+".xls"; + if(path.endsWith(".xlsx")) { + fileOutPath=path.trim().split(".xlsx")[0]+timeNow+".xlsx"; + } + + fileout = new File(fileOutPath); + out = new FileOutputStream(fileout); + if(path.endsWith(".xlsx")) { + workbook.write(out); + }else { + + workbook2.write(out); + } + MessageBox.post( + "ʧܣǷǩǷڻֵǷȷ"+fileOutPath, + "", + MessageBox.INFORMATION); + Runtime.getRuntime().exec( + new String[] { "cmd.exe", "/c", fileOutPath });// + }else { + MessageBox.post( + "ɹ", + "", + MessageBox.INFORMATION); + } + long end = System.currentTimeMillis(); + float time2 = (end - start) / 1000.00f; + System.out.println("ʱ" + time2 + ""); + this.wait.setBool(true); + this.wait.interrupt(); + + } + public String GetNowDate(){ + String temp_str=""; + Date dt = new Date(); + //aaʾ硱硱 HHʾ24Сʱ hhʾ12Сʱ "yyyy-MM-ddHH:mm:ss aa" + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd-HH-mm"); + temp_str=sdf.format(dt); + return temp_str; + } + + public boolean setProperty(TCComponent object,String property,String value,XSSFRow row,XSSFCellStyle sty) { + // ·Ժ״̬ + try { + Util.setByPass(true); + } catch (TCException e2) { + e2.printStackTrace(); + } + try { + //Կܲ + TCProperty pro=object.getTCProperty(property); + if(pro==null) { + + right=false; + row.getCell(3).setCellStyle(sty); + }else { + //ֵΪգ + if(value.length()==0) { + right=false; + row.getCell(4).setCellStyle(sty); + }else { + //lovõĿܲʵֵ + object.setStringProperty(property, value); + } + } + } catch (Exception e) { + right=false; + row.getCell(4).setCellStyle(sty); + e.printStackTrace(); + } + + try { + Util.setByPass(false); + } catch (TCException e2) { + e2.printStackTrace(); + } + return right; + } + + public boolean setXlsProperty(TCComponent object,String property,String value,HSSFRow row,HSSFCellStyle sty) { + // ·Ժ״̬ + // · + try { + Util.setByPass(true); + } catch (TCException e2) { + e2.printStackTrace(); + } + try { + TCProperty pro=object.getTCProperty(property); + if(pro==null) { + + right=false; + row.getCell(3).setCellStyle(sty); + }else { + //ֵΪգ + if(value.length()==0) { + right=false; + row.getCell(4).setCellStyle(sty); + }else { + //lovõĿܲʵֵ + object.setStringProperty(property, value); + } + } + } catch (Exception e) { + right=false; + row.getCell(4).setCellStyle(sty); + } + + try { + Util.setByPass(false); + } catch (TCException e2) { + e2.printStackTrace(); + } + return right; + } + + public boolean setItemProperty(TCComponent object,String property,String value,XSSFRow row,XSSFCellStyle sty) { + // ·Ժ״̬ + try { + Util.setByPass(true); + } catch (TCException e2) { + e2.printStackTrace(); + } + if(property.length()>0) { + if(value.length()>0) { + try { + + //Կܲ + TCProperty pro=object.getTCProperty(property); + if(pro==null) { + + right=false; + row.getCell(3).setCellStyle(sty); + }else { + //ֵΪգ + if(value.length()==0) { + right=false; + row.getCell(4).setCellStyle(sty); + }else { + //lovõĿܲʵֵ + object.setStringProperty(property, value); + } + } + } catch (Exception e) { + right=false; + row.getCell(4).setCellStyle(sty); + e.printStackTrace(); + } + }else { + right=false; + row.getCell(4).setCellStyle(sty); + } + + }else { + right=false; + row.getCell(3).setCellStyle(sty); + } + + try { + Util.setByPass(false); + } catch (TCException e2) { + e2.printStackTrace(); + } + return right; + } + + + public boolean setXlsItemProperty(TCComponent object,String property,String value,HSSFRow row,HSSFCellStyle sty) { + // ·Ժ״̬ + try { + Util.setByPass(true); + } catch (TCException e2) { + e2.printStackTrace(); + } + if(property.length()>0) { + if(value.length()>0) { + try { + TCProperty pro=object.getTCProperty(property); + if(pro==null) { + right=false; + row.getCell(3).setCellStyle(sty); + }else { + //ֵΪգ + if(value.length()==0) { + right=false; + row.getCell(4).setCellStyle(sty); + }else { + + //ֵΪգ + if(value.length()==0) { + right=false; + row.getCell(4).setCellStyle(sty); + }else { + //lovõĿܲʵֵ + object.setStringProperty(property, value); + } + } + } + + } catch (Exception e) { + right=false; + row.getCell(4).setCellStyle(sty); + } + }else { + right=false; + row.getCell(4).setCellStyle(sty); + } + + }else { + right=false; + row.getCell(3).setCellStyle(sty); + } + + + try { + Util.setByPass(false); + } catch (TCException e2) { + e2.printStackTrace(); + } + + + return right; + } + + + /** + * c÷״̬ + * + * @param item + * ҪĶ + * @param statusName + * ״̬ + * @throws TCException + */ + public void setReleaseStatus(TCComponent item, String statusName) throws TCException { + if(statusName.equals("delete")) { + item.setRelated("statusName", null); + }else { + TCUserService userservice = this.session.getUserService(); + Object[] obj = new Object[2]; + obj[0] = item; + obj[1] = statusName; + userservice.call("connor_set_release_status", obj); + } + + } + + + +} diff --git a/src/com/connor/jk/plm/allBomline/Dialog.java b/src/com/connor/jk/plm/allBomline/Dialog.java new file mode 100644 index 0000000..fe0e57a --- /dev/null +++ b/src/com/connor/jk/plm/allBomline/Dialog.java @@ -0,0 +1,137 @@ +package com.connor.jk.plm.allBomline; + +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.text.SimpleDateFormat; +import java.util.Date; + +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JPanel; + +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.common.genericselection.SelectComponentEvent; +import com.teamcenter.rac.common.openbyname.OpenByNameButton; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; +import com.teamcenter.rac.util.iTextField; + +public class Dialog extends AbstractAIFDialog { + + private JPanel jpnew; + private TCSession session; + private InterfaceAIFComponent targetComp; + private iTextField text; + private iTextField tdsxText; + private iTextField tdblText; + private JLabel sxsjText; + private OpenByNameButton addBut; + + private JPanel butJp; + private JButton okBut; + private JButton cleBut; + + private TCComponentItem item; + private int len; + + public Dialog(InterfaceAIFComponent targetComp,TCSession session,int len) { + this.targetComp=targetComp; + this.session=session; + this.len=len; + init(); + } + + public void init() { + // TODO Auto-generated method stub + setSize(new Dimension(500, 300)); + setLayout(new BorderLayout()); + text =new iTextField(20); + text.setEnabled(false); + tdsxText = new iTextField(20); + tdblText = new iTextField(20); + sxsjText = new JLabel(""); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + String time = formatter.format(new Date()); + sxsjText.setText(time); + tdblText.setText("1"); + int strlen=len+1; + tdsxText.setText(strlen+""); + addBut = createAddButton(); + jpnew = new JPanel(new PropertyLayout()); + jpnew.add("1.1.left", new JLabel(" :")); + jpnew.add("2.1.left", new JLabel(" ˳:")); + jpnew.add("3.1.left", new JLabel(" :")); + jpnew.add("4.1.left", new JLabel(" Чʱ:")); + jpnew.add("1.2.left", text); + jpnew.add("2.2.left", tdsxText); + jpnew.add("3.2.left", tdblText); + jpnew.add("4.2.left", sxsjText); + jpnew.add("1.3.left", addBut); + okBut=new JButton("ȷ"); + okBut.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + setVisible(false); + String tdsx=tdsxText.getText(); + String tdbl=tdblText.getText(); + if(tdsx.trim().equals("")){ + int strlen=len+1; + tdsx=strlen+""; + } + if(tdbl.trim().equals("")){ + tdbl="1"; + } + Global_Dialog d=new Global_Dialog(targetComp, session, item,tdsx,sxsjText.getText(),tdbl); + + } + }); + cleBut=new JButton("ȡ"); + cleBut.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + setVisible(false); + } + }); + butJp=new JPanel(new PropertyLayout()); + butJp.add("1.1.center.top",okBut); + butJp.add("1.2.center.top",cleBut); + this.add(jpnew,BorderLayout.CENTER); + this.add(butJp,BorderLayout.SOUTH); + setVisible(true); + setLocationRelativeTo(null); + setAlwaysOnTop(true); + } + + private OpenByNameButton createAddButton() { + OpenByNameButton local4 = new OpenByNameButton(session, "Item", + new String[] { "object_name", "item_id" }) { + public void processSelectComponent( + SelectComponentEvent paramSelectComponentEvent) { + item= (TCComponentItem) paramSelectComponentEvent + .getComponent(); + System.out.println("item="+item); + if (item != null){ + text.setText(item.toString()); + System.out.println(item.toString()); + } + + postDown(); + } + }; + local4.setFocusPainted(false); + local4.setText("ѡ"); + local4.allowTearoff(true); + return local4; + } + +} diff --git a/src/com/connor/jk/plm/allBomline/Global_Action.java b/src/com/connor/jk/plm/allBomline/Global_Action.java new file mode 100644 index 0000000..25bded1 --- /dev/null +++ b/src/com/connor/jk/plm/allBomline/Global_Action.java @@ -0,0 +1,26 @@ +package com.connor.jk.plm.allBomline; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.common.actions.AbstractAIFAction; + +public class Global_Action extends AbstractAIFAction { + private AbstractAIFApplication app; + public Global_Action(AbstractAIFApplication arg0, String arg1) { + super(arg0, arg1); + // TODO Auto-generated constructor stub + this.app=arg0; + } + + @Override + public void run() { + // TODO Auto-generated method stub + Global_Command com=new Global_Command(app); + try { + com.executeModal(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + +} diff --git a/src/com/connor/jk/plm/allBomline/Global_Command.java b/src/com/connor/jk/plm/allBomline/Global_Command.java new file mode 100644 index 0000000..9e3bdd4 --- /dev/null +++ b/src/com/connor/jk/plm/allBomline/Global_Command.java @@ -0,0 +1,116 @@ +package com.connor.jk.plm.allBomline; + +import java.util.ArrayList; +import java.util.List; + +import com.connor.jk.plm.setBomline.SetBomline_Dialog; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.AbstractAIFCommand; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentBOMLine; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class Global_Command extends AbstractAIFCommand { + private AbstractAIFApplication app; + private InterfaceAIFComponent targetComp; + private TCSession session; + private TCComponentItem item; + private TCComponent[] globals;// ȫּ + private TCComponent preferredGAlt;// ѡ + private List globallist = new ArrayList<>(); + private int len = 0; + public Global_Command(AbstractAIFApplication app) { + // TODO Auto-generated constructor stub + this.app=app; + this.targetComp = app.getTargetComponent(); + this.session = (TCSession) app.getSession(); + } + + public void executeModal() throws Exception { + // TODO Auto-generated method stub + //super.executeModal(); + if(targetComp==null){ + MessageBox.post("ѡִв","",MessageBox.ERROR); + return; + } + + + + + if((targetComp instanceof TCComponentBOMLine)||(targetComp instanceof TCComponentItemRevision)||(targetComp instanceof TCComponentItem)){ + System.out.println("aaa"); + + if (targetComp instanceof TCComponentItem) { + item = (TCComponentItem) targetComp; + + + TCComponent[] relatedComponents = item.getRelatedComponents("release_status_list"); + System.out.println("relatedComponents1="+relatedComponents); + if(relatedComponents != null && relatedComponents.length > 0) { + MessageBox.post("ѡеĿѷ!","",MessageBox.ERROR); + return; + } + + + } else if (targetComp instanceof TCComponentBOMLine) { + item = ((TCComponentBOMLine) targetComp).getItem(); + + + TCComponent[] relatedComponents = ((TCComponentBOMLine) targetComp).getRelatedComponents("release_status_list"); + System.out.println("relatedComponents2="+relatedComponents); + if(relatedComponents != null && relatedComponents.length > 0) { + MessageBox.post("ѡеĿѷ!","",MessageBox.ERROR); + return; + } + + + } else if (targetComp instanceof TCComponentItemRevision) { + item = ((TCComponentItemRevision) targetComp).getItem(); + + + TCComponent[] relatedComponents = ((TCComponentItemRevision) targetComp).getRelatedComponents("release_status_list"); + System.out.println("relatedComponents3="+relatedComponents); + if(relatedComponents != null && relatedComponents.length > 0) { + MessageBox.post("ѡеĿѷ!","",MessageBox.ERROR); + return; + } + + } + globals = item.getReferenceListProperty("global_alt_list"); + for (TCComponent t : globals) { + globallist.add(t); + } + + String[] tdsx =item.getTCProperty("jk8OvrlSubstitOrder").getStringArrayValue(); + String[] sxsj =item.getTCProperty("jk8OvrlSubstitTime").getStringArrayValue(); + String[] tdbl =item.getTCProperty("jk8OvrlSubstitRatio").getStringArrayValue(); + preferredGAlt = item.getReferenceProperty("preferred_global_alt"); + + len = globallist == null ? 0 : globallist.size(); + int tdsxlen = tdsx == null ? 0 : tdsx.length; + int sxsjlen = sxsj == null ? 0 : sxsj.length; + int tdbllen = tdbl == null ? 0 : tdbl.length; + + if (len == tdsxlen && len == sxsjlen && len == tdbllen) { + + }else{ + MessageBox.post("ȫڴ,޷!!","",MessageBox.ERROR); + return; + } + + Global_Dialog dialog = new Global_Dialog(targetComp, + session); + new Thread(dialog).start(); + + + }else{ + MessageBox.post("ѡʹ","",MessageBox.ERROR); + return; + } + + } +} diff --git a/src/com/connor/jk/plm/allBomline/Global_Dialog.java b/src/com/connor/jk/plm/allBomline/Global_Dialog.java new file mode 100644 index 0000000..29f24a7 --- /dev/null +++ b/src/com/connor/jk/plm/allBomline/Global_Dialog.java @@ -0,0 +1,387 @@ +package com.connor.jk.plm.allBomline; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.List; + +import javax.swing.JButton; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.table.DefaultTableModel; +import javax.swing.table.TableColumn; + +import com.connor.jk.plm.setBomline.MyTable; +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.common.genericselection.SelectComponentEvent; +import com.teamcenter.rac.common.openbyname.OpenByNameButton; +import com.teamcenter.rac.kernel.ServiceData; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentBOMLine; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; +import com.teamcenter.services.internal.rac.structuremanagement.GlobalAlternateService; +import com.teamcenter.services.internal.rac.structuremanagement._2007_06.GlobalAlternate; + +public class Global_Dialog extends AbstractAIFDialog { + private InterfaceAIFComponent targetComp; + private TCSession session; + private TCComponentBOMLine bomline; + private TCComponentItem item; + private TCComponent preferredGAlt;// ѡ + private TCComponent[] globals;// ȫּ + private String[] title = { "", "б", "˳", "Чʱ", "" }; + private Object[][] obj; + private DefaultTableModel tableModel; + private List globallist = new ArrayList<>(); + + private JPanel jp1; + private JPanel jp2; + private JTable jtable; + private JScrollPane jsp; + private JButton addBut = new JButton(""); + private JButton clBut = new JButton(""); + private JButton canBut = new JButton("ȡ"); + private JButton preferBut = new JButton("ѡ"); + private int len = 0; + + public Global_Dialog(InterfaceAIFComponent targetComp, TCSession session) { + this.targetComp = targetComp; + this.session = session; + // this.bomline = (TCComponentBOMLine) targetComp; + load(); + + } + + public Global_Dialog(InterfaceAIFComponent targetComp, TCSession session, + TCComponentItem retItem, String tdsx, String sxsj, String tdbl) { + this.targetComp = targetComp; + this.session = session; + // this.bomline = (TCComponentBOMLine) targetComp; + + load(); + add(retItem, tdsx, sxsj, tdbl); + } + + private void add(TCComponentItem retItem, String tdsx, String sxsj, + String tdbl) { + if (retItem != null) { + addSelectedGlobalAlternates(retItem); + try { + String[] oldtdsx =item.getTCProperty("jk8OvrlSubstitOrder").getStringArrayValue(); + String[] oldsxsj = item.getTCProperty("jk8OvrlSubstitTime").getStringArrayValue(); + String[] oldtdbl = item.getTCProperty("jk8OvrlSubstitRatio").getStringArrayValue(); + int tdsxlen = tdsx == null ? 0 : oldtdsx.length; + String[] newtdsx=new String[tdsxlen+1]; + String[] newsxsj=new String[tdsxlen+1]; + String[] newtdbl=new String[tdsxlen+1]; + if(tdsxlen>0){ + for(int i=0;i 0) { + // String id = item.getTCProperty("item_id").getDisplayValue(); + + obj = new Object[len][5]; + for (int i = 0; i < len; i++) { + if (globallist.get(i) != null + && globallist.get(i).equals(preferredGAlt)) { + obj[i][0] = i + 1 + ""; + } else { + obj[i][0] = i + 1 + ""; + } + + obj[i][1] = globallist.get(i); + obj[i][2] = tdsxlen > i ? tdsx[i] : ""; + obj[i][3] = sxsjlen > i ? sxsj[i] : ""; + obj[i][4] = tdbllen > i ? tdbl[i] : ""; + } + } else { + obj = new Object[0][5]; + } + + tableModel = new DefaultTableModel(obj, title); + jtable = new MyTable(tableModel); + }else{ + MessageBox.post("ȫڴ,޷!!","",MessageBox.ERROR); + setVisible(false); + return; + } + + + + } catch (TCException e) { + e.printStackTrace(); + } + init(); + } + + public void init() { + setTitle("б"); + setSize(new Dimension(800, 300)); + setLayout(new BorderLayout()); + jp1 = new JPanel(new PropertyLayout()); + jsp = new JScrollPane(jtable);// + jsp.setPreferredSize(new Dimension(800, 300)); + jp1.add("1.1.left.top", jsp); + jp2 = new JPanel(); + addBut.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent arg0) { + setVisible(false); + doAdd(); + + } + }); + clBut.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + setAlwaysOnTop(false); + removeSelectedGlobalAlternates(); + setAlwaysOnTop(true); + } + }); + canBut.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + setVisible(false); + } + }); + preferBut.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent arg0) { + preferSelected(); + } + }); + jp2.add(preferBut); + jp2.add(addBut); + jp2.add(clBut); + jp2.add(canBut); + add(jsp, BorderLayout.CENTER); + add(jp2, BorderLayout.SOUTH); + setAlwaysOnTop(true); + setLocationRelativeTo(null); + setVisible(true); + TableColumn firsetColumn = jtable.getColumnModel().getColumn(0); + firsetColumn.setMaxWidth(50); + + } + + protected void doAdd() { + Dialog d = new Dialog(targetComp, session, len); + + } + + // private OpenByNameButton createAddButton() { + // OpenByNameButton local4 = new OpenByNameButton(this.session, "Item", + // new String[] { "object_name", "item_id" }) { + // public void processSelectComponent( + // SelectComponentEvent paramSelectComponentEvent) { + // TCComponentItem localTCComponentItem = (TCComponentItem) + // paramSelectComponentEvent + // .getComponent(); + // if (localTCComponentItem != null) + // try { + // if (localTCComponentItem != item) { + // addSelectedGlobalAlternates(localTCComponentItem); + // int in = tableModel.getRowCount(); + // Object[] rowData = new Object[] { in + 1 + "", + // localTCComponentItem, "", "", "" }; + // tableModel.addRow(rowData); + // } + // + // } catch (Exception localException) { + // MessageBox.post(localException); + // } + // postDown(); + // } + // }; + // local4.setFocusPainted(false); + // local4.setText(""); + // local4.allowTearoff(true); + // return local4; + // } + + protected void preferSelected() { + System.out.println("preferSelected"); + int i = jtable.getSelectedRowCount(); + if (i < 1 || i > 1) { + MessageBox.post("ѡһٽв", "Error", 1); + return; + + } + int row = jtable.getSelectedRow(); + TCComponentItem item1 = (TCComponentItem) tableModel.getValueAt(row, 1); + com.teamcenter.services.internal.rac.structuremanagement._2007_06.GlobalAlternate.PreferredGlobalAlternateInput[] arrayOfPreferredGlobalAlternateInput = new com.teamcenter.services.internal.rac.structuremanagement._2007_06.GlobalAlternate.PreferredGlobalAlternateInput[1]; + arrayOfPreferredGlobalAlternateInput[0] = new com.teamcenter.services.internal.rac.structuremanagement._2007_06.GlobalAlternate.PreferredGlobalAlternateInput(); + arrayOfPreferredGlobalAlternateInput[0].item = this.item; + arrayOfPreferredGlobalAlternateInput[0].gAltItem = item1; + GlobalAlternateService localGlobalAlternateService = GlobalAlternateService + .getService(this.session); + ServiceData localServiceData = localGlobalAlternateService + .setPreferredGlobalAlternate(arrayOfPreferredGlobalAlternateInput); + + int col = jtable.getRowCount(); + for (int j = 0; j < col; j++) { + if (j == row) { + String obj = (String) tableModel.getValueAt(j, 0); + if (obj != null && obj.contains("")) { + tableModel.setValueAt(j + 1 + "", j, 0); + } else { + tableModel.setValueAt(j + 1 + "", j, 0); + } + + } else { + tableModel.setValueAt(j + 1 + "", j, 0); + } + } + + } + + private void addSelectedGlobalAlternates( + TCComponentItem paramTCComponentItem) { + TCComponentItem[] arrayOfTCComponentItem = { paramTCComponentItem }; + GlobalAlternate.GlobalAlternateListInput globalAlternateListInput = new GlobalAlternate.GlobalAlternateListInput(); + globalAlternateListInput.item = this.item; + globalAlternateListInput.gAltItems = arrayOfTCComponentItem; + GlobalAlternate.GlobalAlternateListInput[] arrayOfGlobalAlternateListInput = new GlobalAlternate.GlobalAlternateListInput[1]; + arrayOfGlobalAlternateListInput[0] = globalAlternateListInput; + GlobalAlternateService globalAlternateService = GlobalAlternateService + .getService(this.session); + GlobalAlternate.GlobalAlternateResponse globalAlternateResponse = globalAlternateService + .addRelatedGlobalAlternates(arrayOfGlobalAlternateListInput); + + } + + public void removeSelectedGlobalAlternates() { + System.out.println("removeSelectedGlobalAlternates"); + int i = jtable.getSelectedRowCount(); + if (i < 1) { + MessageBox.post("ѡ", "Error", 1); + return; + } + int[] row = jtable.getSelectedRows(); + TCComponentItem[] items = new TCComponentItem[i]; + int yn = JOptionPane.showConfirmDialog(null, "ǷɾѡУ", "ɾȷ϶Ի", 0, + 2); + if (yn == 0) { + for (int j = i - 1; j >= 0; j--) { + + TCComponent tccomponent = (TCComponent) tableModel.getValueAt( + row[j], 1); + items[j] = (TCComponentItem) tccomponent; + tableModel.removeRow(row[j]);// ɾѡ + } + if(tableModel.getRowCount()>0){ + String[] newtdsx=new String[tableModel.getRowCount()]; + String[] newsxsj=new String[tableModel.getRowCount()]; + String[] newtdbl=new String[tableModel.getRowCount()]; + for(int m=0;m errCodes = new ArrayList(0); + private JPanel buttonPanel; + private JButton closeButton; + private JLabel itemLabel; + private ArrayList globalAlternateList = new ArrayList(0); + + public ManageGlobalAlternatesPanel(Frame paramFrame, InterfaceAIFComponent paramInterfaceAIFComponent) + { + this.parent = paramFrame; + this.session = ((TCSession)paramInterfaceAIFComponent.getSession()); + getItemFromUI(paramInterfaceAIFComponent); + initializeDialog(); + } + + public void getItemFromUI(InterfaceAIFComponent paramInterfaceAIFComponent) + { + if ((paramInterfaceAIFComponent instanceof TCComponentItem)) + { + this.item = ((TCComponentItem)paramInterfaceAIFComponent); + } + else if ((paramInterfaceAIFComponent instanceof TCComponentItemRevision)) + { + try + { + this.item = ((TCComponentItemRevision)paramInterfaceAIFComponent).getItem(); + } + catch (Exception localException1) + { + MessageBox.post(this.parent, localException1); + } + } + else if (((paramInterfaceAIFComponent instanceof TCComponentBOMLine)) && (!(paramInterfaceAIFComponent instanceof TCComponentGDELine))) + { + try + { + this.bomLine = ((TCComponentBOMLine)paramInterfaceAIFComponent); + this.item = this.bomLine.getItem(); + } + catch (Exception localException2) + { + MessageBox.post(this.parent, localException2); + } + } + else + { + MessageBox.post(this.parent, this.reg.getString("invalidObjects"), this.reg.getString("error.TITLE"), 1); + return; + } + if (this.item == null) + { + MessageBox.post(this.parent, this.reg.getString("noObjectsSelected"), this.reg.getString("error.TITLE"), 1); + return; + } + try + { + this.preferredGAlt = this.item.getReferenceProperty("preferred_global_alt"); + } + catch (Exception localException3) + { + MessageBox.post(this.parent, localException3); + } + } + + private void initializeDialog() + { + this.reg = Registry.getRegistry(com.teamcenter.rac.common.ManageGlobalAlternatesPanel.class); + this.itemLabel = new JLabel(); + initTCTable(); + setLayout(new VerticalLayout(5, 2, 2, 2, 2)); + JScrollPane localJScrollPane = new JScrollPane(this.tcTable); + localJScrollPane.setPreferredSize(new Dimension(295, 125)); + this.buttonPanel = new JPanel(new ButtonLayout()); + this.preferButton = createPreferButton(); + this.removeButton = createRemoveButton(); + this.addButton = createAddButton(); + this.closeButton = createCloseButton(); + add("top.bind", new Separator()); + this.buttonPanel.add(this.preferButton); + this.buttonPanel.add(this.removeButton); + this.buttonPanel.add(this.addButton); + this.buttonPanel.add(this.closeButton); + add("top.nobind.left.top", this.itemLabel); + add("unbound.bind.center.top", localJScrollPane); + add("bottom.bind.center.top", this.buttonPanel); + add("bottom.bind", new Separator()); + update(); + } + + private JButton createCloseButton() + { + JButton localJButton = new JButton(this.reg.getString("close")); + localJButton.setMnemonic(this.reg.getString("close.MNEMONIC").charAt(0)); + return localJButton; + } + + public JButton getCloseButton() + { + return this.closeButton; + } + + private void initTCTable() + { + this.tcTable = new TCTable(this.session, this.reg.getStringArray("manageGlobalAlternates.columnsShown", ",")); + String str = this.reg.getString("global_alt.RENDERER"); + this.cellRenderer = ((GlobalAltRenderer)Instancer.newInstance(str)); + if (this.cellRenderer != null) + { + this.cellRenderer.setPreferredAlternate(this.preferredGAlt); + this.tcTable.getColumnModel().getColumn(0).setCellRenderer(this.cellRenderer); + } + String[] arrayOfString = this.reg.getStringArray("manageGlobalAlternates.columnWidths", ","); + if (arrayOfString != null) + this.tcTable.setColumnWidths(arrayOfString); + this.tcTable.setPreferredScrollableViewportSize(new Dimension(320, 200)); + this.tcTable.addMouseListener(new MouseAdapter() + { + public void mouseReleased(MouseEvent paramMouseEvent) + { + int i = ManageGlobalAlternatesPanel.this.tcTable.getSelectedRowCount(); + InterfaceAIFComponent[] arrayOfInterfaceAIFComponent = ManageGlobalAlternatesPanel.this.tcTable.getSelectedComponents(); + if (arrayOfInterfaceAIFComponent.length != 0) + { + ManageGlobalAlternatesPanel.this.preferButton.setEnabled(i == 1); + ManageGlobalAlternatesPanel.this.removeButton.setEnabled(i > 0); + if (paramMouseEvent.getClickCount() == 2) + ManageGlobalAlternatesPanel.this.preferSelectedGlobalAlternate(); + } + else + { + ManageGlobalAlternatesPanel.this.preferButton.setEnabled(false); + ManageGlobalAlternatesPanel.this.removeButton.setEnabled(false); + } + } + }); + } + + private JButton createPreferButton() + { + JButton localJButton = new JButton(this.reg.getString("manageGlobalAlternates.preferButton.LABEL")); + localJButton.setMargin(new Insets(0, 0, 0, 0)); + localJButton.setFocusPainted(false); + localJButton.setToolTipText(this.reg.getString("manageGlobalAlternates.preferButton.TIP")); + localJButton.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent paramActionEvent) + { + ManageGlobalAlternatesPanel.this.preferSelectedGlobalAlternate(); + } + }); + return localJButton; + } + + private JButton createRemoveButton() + { + JButton localJButton = new JButton(this.reg.getString("manageGlobalAlternates.removeButton.LABEL")); + localJButton.setMargin(new Insets(0, 0, 0, 0)); + localJButton.setFocusPainted(false); + localJButton.setToolTipText(this.reg.getString("manageGlobalAlternates.removeButton.TIP")); + localJButton.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent paramActionEvent) + { + ManageGlobalAlternatesPanel.this.removeSelectedGlobalAlternates(); + } + }); + return localJButton; + } + + private OpenByNameButton createAddButton() + { + OpenByNameButton local4 = new OpenByNameButton(this.session, "Item", new String[] { "object_name", "item_id" }) + { + public void processSelectComponent(SelectComponentEvent paramSelectComponentEvent) + { + TCComponentItem localTCComponentItem = (TCComponentItem)paramSelectComponentEvent.getComponent(); + if (localTCComponentItem != null) + try + { + if (localTCComponentItem != ManageGlobalAlternatesPanel.this.item) + ManageGlobalAlternatesPanel.this.addSelectedGlobalAlternates(localTCComponentItem); + else + MessageBox.post(ManageGlobalAlternatesPanel.this.reg.getString("addGlobalAlternates.cantAddItself.MSG"), ManageGlobalAlternatesPanel.this.reg.getString("addGlobalAlternates.cantAddGlobalAlt.TITLE"), 1); + } + catch (Exception localException) + { + MessageBox.post(localException); + } + postDown(); + } + }; + local4.setFocusPainted(false); + local4.setPopupTitle(this.reg.getString("addGlobalAlternates.TITLE")); + local4.setToolTipText(this.reg.getString("manageGlobalAlternates.addButton.TIP")); + local4.allowTearoff(true); + return local4; + } + + private void repaintList() + { + this.tcTable.removeAllRows(); + try + { + if ((this.globalAlternateList != null) && (this.globalAlternateList.size() > 0)) + for (int i = 0; i < this.globalAlternateList.size(); i++) + if (((GlobalAlternates)this.globalAlternateList.get(i)).getUnderlyingComponent() == null) + { + this.tcTable.addEmptyRow(); + this.tcTable.setValueAt(((GlobalAlternates)this.globalAlternateList.get(i)).getDisplayString(), i, 0); + } + else + { + this.tcTable.addRow(((GlobalAlternates)this.globalAlternateList.get(i)).getUnderlyingComponent()); + } + } + catch (Exception localException) + { + MessageBox.post(localException); + } + this.preferButton.setEnabled(false); + this.removeButton.setEnabled(false); + this.cellRenderer.setPreferredAlternate(this.preferredGAlt); + } + + private boolean getGlobalAlternates() + { + GlobalAlternateService localGlobalAlternateService = GlobalAlternateService.getService(this.session); + TCComponentItem[] arrayOfTCComponentItem = new TCComponentItem[1]; + arrayOfTCComponentItem[0] = this.item; + com.teamcenter.services.internal.rac.structuremanagement._2007_06.GlobalAlternate.GlobalAlternateResponse localGlobalAlternateResponse = localGlobalAlternateService.listGlobalAlternates(arrayOfTCComponentItem); + if (!handlePartialErrors(localGlobalAlternateResponse.serviceData, this)) + return false; + com.teamcenter.services.internal.rac.structuremanagement._2007_06.GlobalAlternate.GlobalAlternateList[] arrayOfGlobalAlternateList = localGlobalAlternateResponse.globalAlternateLists; + populateGlobalAlternates(arrayOfGlobalAlternateList[0].globalAlternates); + return true; + } + + private void refreshItem() + { + try + { + this.item.fireComponentChangeEvent(); + } + catch (Exception localException) + { + MessageBox.post(localException); + } + } + + private void preferSelectedGlobalAlternate() + { + int i = this.tcTable.getSelectedRowCount(); + if (i < 1) + { + MessageBox.post(this.reg.getString("noObjectsSelected"), this.reg.getString("error.TITLE"), 1); + return; + } + if (i > 1) + { + MessageBox.post(this.reg.getString("tooManyObjects"), this.reg.getString("error.TITLE"), 1); + return; + } + int j = this.tcTable.getSelectedRow(); + TCComponentItem localTCComponentItem = (TCComponentItem)this.tcTable.getRowComponent(j); + if (localTCComponentItem != null) + { + com.teamcenter.services.internal.rac.structuremanagement._2007_06.GlobalAlternate.PreferredGlobalAlternateInput[] arrayOfPreferredGlobalAlternateInput = new com.teamcenter.services.internal.rac.structuremanagement._2007_06.GlobalAlternate.PreferredGlobalAlternateInput[1]; + arrayOfPreferredGlobalAlternateInput[0] = new com.teamcenter.services.internal.rac.structuremanagement._2007_06.GlobalAlternate.PreferredGlobalAlternateInput(); + arrayOfPreferredGlobalAlternateInput[0].item = this.item; + arrayOfPreferredGlobalAlternateInput[0].gAltItem = localTCComponentItem; + GlobalAlternateService localGlobalAlternateService = GlobalAlternateService.getService(this.session); + ServiceData localServiceData = localGlobalAlternateService.setPreferredGlobalAlternate(arrayOfPreferredGlobalAlternateInput); + if (!SoaUtil.handlePartialErrors(localServiceData, this)) + return; + if (localTCComponentItem.equals(this.preferredGAlt)) + this.preferredGAlt = null; + else + this.preferredGAlt = localTCComponentItem; + this.cellRenderer.setPreferredAlternate(this.preferredGAlt); + refreshItem(); + repaintList(); + } + else + { + MessageBox.post(this.reg.getString("noObjectsSelected"), this.reg.getString("error.TITLE"), 1); + } + } + + private void addSelectedGlobalAlternates(TCComponentItem paramTCComponentItem) + { + TCComponentItem[] arrayOfTCComponentItem = { paramTCComponentItem }; + com.teamcenter.services.internal.rac.structuremanagement._2007_06.GlobalAlternate.GlobalAlternateListInput localGlobalAlternateListInput = new com.teamcenter.services.internal.rac.structuremanagement._2007_06.GlobalAlternate.GlobalAlternateListInput(); + localGlobalAlternateListInput.item = this.item; + localGlobalAlternateListInput.gAltItems = arrayOfTCComponentItem; + com.teamcenter.services.internal.rac.structuremanagement._2007_06.GlobalAlternate.GlobalAlternateListInput[] arrayOfGlobalAlternateListInput = new com.teamcenter.services.internal.rac.structuremanagement._2007_06.GlobalAlternate.GlobalAlternateListInput[1]; + arrayOfGlobalAlternateListInput[0] = localGlobalAlternateListInput; + GlobalAlternateService localGlobalAlternateService = GlobalAlternateService.getService(this.session); + com.teamcenter.services.internal.rac.structuremanagement._2007_06.GlobalAlternate.GlobalAlternateResponse localGlobalAlternateResponse = localGlobalAlternateService.addRelatedGlobalAlternates(arrayOfGlobalAlternateListInput); + if (!handlePartialErrors(localGlobalAlternateResponse.serviceData, this)) + return; + com.teamcenter.services.internal.rac.structuremanagement._2007_06.GlobalAlternate.GlobalAlternateList[] arrayOfGlobalAlternateList = localGlobalAlternateResponse.globalAlternateLists; + populateGlobalAlternates(arrayOfGlobalAlternateList[0].globalAlternates); + refreshItem(); + repaintList(); + } + + private void removeSelectedGlobalAlternates() + { + int i = this.tcTable.getSelectedRowCount(); + if (i < 1) + { + MessageBox.post(this.reg.getString("noObjectsSelected"), this.reg.getString("error.TITLE"), 1); + return; + } + InterfaceAIFComponent[] arrayOfInterfaceAIFComponent = this.tcTable.getSelectedComponents(); + TCComponentItem[] arrayOfTCComponentItem = new TCComponentItem[i]; + Boolean localBoolean = Boolean.valueOf(false); + for (int j = 0; j < i; j++) + { + arrayOfTCComponentItem[j] = ((TCComponentItem)arrayOfInterfaceAIFComponent[j]); + if (!arrayOfTCComponentItem[j].equals(this.preferredGAlt)) + continue; + localBoolean = Boolean.valueOf(true); + } + com.teamcenter.services.internal.rac.structuremanagement._2007_06.GlobalAlternate.GlobalAlternateListInput localGlobalAlternateListInput = new com.teamcenter.services.internal.rac.structuremanagement._2007_06.GlobalAlternate.GlobalAlternateListInput(); + localGlobalAlternateListInput.item = this.item; + localGlobalAlternateListInput.gAltItems = arrayOfTCComponentItem; + com.teamcenter.services.internal.rac.structuremanagement._2007_06.GlobalAlternate.GlobalAlternateListInput[] arrayOfGlobalAlternateListInput = new com.teamcenter.services.internal.rac.structuremanagement._2007_06.GlobalAlternate.GlobalAlternateListInput[1]; + arrayOfGlobalAlternateListInput[0] = localGlobalAlternateListInput; + GlobalAlternateService localGlobalAlternateService = GlobalAlternateService.getService(this.session); + com.teamcenter.services.internal.rac.structuremanagement._2007_06.GlobalAlternate.GlobalAlternateResponse localGlobalAlternateResponse = localGlobalAlternateService.removeRelatedGlobalAlternates(arrayOfGlobalAlternateListInput); + if (!handlePartialErrors(localGlobalAlternateResponse.serviceData, this)) + return; + com.teamcenter.services.internal.rac.structuremanagement._2007_06.GlobalAlternate.GlobalAlternateList[] arrayOfGlobalAlternateList = localGlobalAlternateResponse.globalAlternateLists; + populateGlobalAlternates(arrayOfGlobalAlternateList[0].globalAlternates); + if (localBoolean.booleanValue()) + { + this.preferredGAlt = null; + this.cellRenderer.setPreferredAlternate(this.preferredGAlt); + } + refreshItem(); + repaintList(); + } + + public void update() + { + this.itemLabel.setText(MessageFormat.format(this.reg.getString("manageGlobalAlternates.INFO"), new Object[] { this.item.toString() })); + getGlobalAlternates(); + repaintList(); + } + + private boolean handlePartialErrors(ServiceData paramServiceData, Object paramObject) + { + Registry localRegistry = Registry.getRegistry(paramObject); + boolean i = false; + String str = ""; + this.errCodes.clear(); + StringBuilder localStringBuilder = new StringBuilder(); + for (int j = 0; j < paramServiceData.sizeOfPartialErrors(); j++) + { + i = false; + ErrorStack localErrorStack = paramServiceData.getPartialError(j); + String[] arrayOfString = localErrorStack.getMessages(); + int[] arrayOfInt1 = paramServiceData.getPartialError(j).getCodes(); + for (int k : arrayOfInt1) + this.errCodes.add(Integer.valueOf(k)); + for (int k = 0; (arrayOfString != null) && (k < arrayOfString.length); k++) + { + localStringBuilder.append(arrayOfString[k]); + localStringBuilder.append("\n"); + } + for (int k = 0; k < arrayOfInt1.length; k++) + { + if ((arrayOfInt1[k] != 515177) && (arrayOfInt1[k] != 214000)) + continue; + i = true; + break; + } + } + str = localStringBuilder.toString(); + if ((paramServiceData.sizeOfPartialErrors() > 0) && (!i)) + { + if ((paramObject instanceof Window)) + MessageBox.post((Window)paramObject, str, localRegistry.getString("ErrorFromSOACall.TITLE"), 1); + else if ((paramObject instanceof Component)) + MessageBox.post(Utilities.getParentFrame((Component)paramObject), str, localRegistry.getString("ErrorFromSOACall.TITLE"), 1); + else + MessageBox.post(str, localRegistry.getString("ErrorFromSOACall.TITLE"), 1); + return i; + } + return true; + } + + private void populateGlobalAlternates(TCComponentItem[] paramArrayOfTCComponentItem) + { + this.globalAlternateList.clear(); + Iterator localIterator = this.errCodes.iterator(); + for (int i = 0; i < paramArrayOfTCComponentItem.length; i++) + if (paramArrayOfTCComponentItem[i] == null) + { + if (!localIterator.hasNext()) + continue; + Integer localInteger = (Integer)localIterator.next(); + if (localInteger.intValue() == 515177) + { + this.globalAlternateList.add(new GlobalAlternates(null, Messages.getString("Remote_Object.NAME"))); + } + else + { + if (localInteger.intValue() != 214000) + continue; + this.globalAlternateList.add(new GlobalAlternates(null, Messages.getString("Unreadable_Object.NAME"))); + } + } + else + { + this.globalAlternateList.add(new GlobalAlternates(paramArrayOfTCComponentItem[i], "")); + } + } + + private static class GlobalAlternates + { + private TCComponentItem component; + private String displayString; + + GlobalAlternates(TCComponentItem paramTCComponentItem, String paramString) + { + this.component = paramTCComponentItem; + this.displayString = paramString; + } + + public TCComponentItem getUnderlyingComponent() + { + return this.component; + } + + public String getDisplayString() + { + return this.displayString; + } + } +} \ No newline at end of file diff --git a/src/com/connor/jk/plm/bom/until/ExcelUtil.java b/src/com/connor/jk/plm/bom/until/ExcelUtil.java new file mode 100644 index 0000000..a728a7d --- /dev/null +++ b/src/com/connor/jk/plm/bom/until/ExcelUtil.java @@ -0,0 +1,675 @@ +package com.connor.jk.plm.bom.until; + +import java.awt.image.BufferedImage; +import java.io.BufferedInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.text.DecimalFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.List; + +import javax.imageio.ImageIO; + +import org.apache.poi.hssf.usermodel.HSSFCell; +import org.apache.poi.hssf.usermodel.HSSFClientAnchor; +import org.apache.poi.hssf.usermodel.HSSFDateUtil; +import org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator; +import org.apache.poi.hssf.usermodel.HSSFName; +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.poifs.filesystem.POIFSFileSystem; +import org.apache.poi.ss.usermodel.CellValue; +import org.apache.poi.ss.util.AreaReference; +import org.apache.poi.ss.util.CellRangeAddress; +import org.apache.poi.ss.util.CellReference; + +/** + * Excel ǩ + * + * @author hub 2015-09-06 + */ +public class ExcelUtil { + // private static Registry reg = Registry.getRegistry(this); + // private static HSSFSheet sheet; + // private static final int MY_ROWS = 46; + + /** + * ȡEXCEL + * + * @param File + * excel_file + * @return List> صϢ + * @throws IOException + * @throws FileNotFoundException + */ + public static List> readExcel(File excel_file) + throws FileNotFoundException, IOException { + if (excel_file == null || !excel_file.exists()) { + return null; + } + // صееϢ + List> lines_msg = new ArrayList>(); + HSSFWorkbook workBook = new HSSFWorkbook( + new FileInputStream(excel_file)); + HSSFFormulaEvaluator evaluator = new HSSFFormulaEvaluator(workBook); + HSSFSheet sheet = workBook.getSheetAt(0); + HSSFRow title_row = sheet.getRow(0); + // õеĿ + int col_count = title_row.getPhysicalNumberOfCells(); + System.out.println(" SHEET COL COUNT " + col_count); + // õеĿ + int row_count = sheet.getLastRowNum(); + + System.out.println(" SHEET ROW COUNT " + row_count); + for (int j = 1; j < row_count + 1; j++) { + // صеϢ + HSSFRow row = sheet.getRow(j); + List line_msg = new ArrayList(); + for (int i = 0; i < col_count; i++) { + String value = getStringCellValue(evaluator, + row.getCell((short) i)); + line_msg.add(value); + } + lines_msg.add(line_msg); + } + // insertRow(sheet,4,1); + return lines_msg; + } + + public void writeSignName(String intExcelFilePath, String outExcelFilePath, + String signName, String msgValue, int sheetIndex, int rowIndex, + int cellIndex) throws IOException { + // ļ· + FileOutputStream outPut = new FileOutputStream(new File( + outExcelFilePath)); + // ļ· + FileInputStream inPut = new FileInputStream(new File(intExcelFilePath)); + HSSFWorkbook wb = new HSSFWorkbook(inPut); + wb.getName(""); + AreaReference[] areaR2 = AreaReference.generateContiguous(wb + .getName("").getRefersToFormula()); + AreaReference areaR = null; + CellReference[] cellR = areaR.getAllReferencedCells(); + cellR[0].getSheetName();// s + cellR[0].getCol();// + cellR[0].getRow();// + HSSFFormulaEvaluator evaluator = new HSSFFormulaEvaluator(wb); + HSSFSheet sheet = wb.getSheetAt(sheetIndex); + HSSFRow row = sheet.getRow(rowIndex); + + HSSFCell cell = row.getCell(cellIndex); + String value = getStringCellValue(evaluator, cell); + if (value.startsWith(signName)) { + value = value.substring(0, signName.length()); + } + + cell.setCellValue(value + msgValue); + wb.write(outPut); + inPut.close(); + outPut.close(); + } + + + /** + * ȡԪ + * + * @param wb + * @param cellName + * @return + * @throws IOException + */ + public static String getNamedCellValue(HSSFWorkbook wb, String cellName) + throws IOException { + String value = null; + HSSFFormulaEvaluator evaluator = new HSSFFormulaEvaluator(wb); + HSSFName name = wb.getName(cellName); + AreaReference[] areaRs = AreaReference.generateContiguous(name + .getRefersToFormula()); + if (areaRs != null) + for (AreaReference areaR : areaRs) { + CellReference[] cellRs = areaR.getAllReferencedCells(); + if (cellRs != null) { + for (CellReference cellR : cellRs) { + String sheetName = cellR.getSheetName(); + short colIndex = cellR.getCol(); + int rowIndex = cellR.getRow(); + HSSFSheet sheet = wb.getSheet(sheetName); + HSSFRow row = sheet.getRow(rowIndex); + HSSFCell cell = row.getCell(colIndex); + value = getStringCellValue(evaluator, cell); + } + } + } + return value; + } + + /*** + * д뵽EXCEL д뵥ݣ + * + * @param xls_write_Address + * @param ls + * @param sheetnames + * @throws IOException + */ + public void writeExcel(String xls_write_Address, ArrayList ls, + String[] sheetnames) throws IOException { + FileOutputStream output = new FileOutputStream(new File( + xls_write_Address)); // ȡļ· + HSSFWorkbook wb = new HSSFWorkbook();// (new + // BufferedInputStream(output)); + for (int sn = 0; sn < ls.size(); sn++) { + HSSFSheet sheet = wb.createSheet(String.valueOf(sn)); + wb.setSheetName(sn, sheetnames[sn]); + ArrayList ls2 = ls.get(sn); + for (int i = 0; i < ls2.size(); i++) { + HSSFRow row = sheet.createRow(i); + String[] s = ls2.get(i); + for (int cols = 0; cols < s.length; cols++) { + HSSFCell cell = row.createCell(cols); + cell.setCellType(HSSFCell.CELL_TYPE_STRING);// ıʽ + cell.setCellValue(s[cols]);// д + } + } + } + wb.write(output); + output.close(); + System.out.println("-------WRITE EXCEL OVER-------"); + } + + /** + * ݵԪҵԪ + * + * @param inputFilePath + * @param cellName + * @return + */ + public static List getExcelNamedCellValue(String inputFilePath, + String[] cellNames) { + List valueList = new ArrayList(); + try { + FileInputStream is = new FileInputStream(new File(inputFilePath)); + HSSFWorkbook wb = new HSSFWorkbook(is); + for (String name : cellNames) + valueList.add(getNamedCellValue(wb, name)); + is.close(); + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return valueList; + } + + + public void insertPicture(HSSFWorkbook wb, HSSFSheet sheet1, + String picPath, short colIndex, int rowIndex) { + + // FileOutputStream fileOut = null; + BufferedImage bufferImg = null; + // ȰѶͼƬŵһByteArrayOutputStreamУԱByteArray + try { + if (!new File(picPath).exists()) { + return; + } + String dexStr = picPath.substring(picPath.lastIndexOf(".") + 1, + picPath.length()); + + ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream(); + System.out.println(picPath); + bufferImg = ImageIO.read(new File(picPath)); + ImageIO.write(bufferImg, dexStr, byteArrayOut); + // HSSFWorkbook wb = new HSSFWorkbook(); + // HSSFSheet sheet1 = wb.createSheet("test picture"); + // ͼĶһsheetֻܻȡһһҪע㣩 + HSSFPatriarch patriarch = sheet1.createDrawingPatriarch(); + // anchorҪͼƬ + HSSFClientAnchor anchor = new HSSFClientAnchor(13, 13, 0, 0, + (short) colIndex, rowIndex, (short) (colIndex + 1), + rowIndex + 1); + anchor.setAnchorType(3); + // ͼƬ + patriarch + .createPicture(anchor, wb.addPicture( + byteArrayOut.toByteArray(), + HSSFWorkbook.PICTURE_TYPE_JPEG)); + + } catch (Exception e) { + e.printStackTrace(); + } + + } + + /** + * ƳϲĵԪ + * + * @param startRow + * @param endRow + * @return + */ + public static boolean removeMergen(HSSFSheet sheet, int startRow, int endRow) { + boolean isOK = false; + int count = sheet.getNumMergedRegions(); + for (int i = 0; i < count; i++) { + CellRangeAddress address = sheet.getMergedRegion(i); + System.out.println(address.getFirstRow() + "|" + + address.getLastRow()); + if (address.getFirstRow() == startRow + && address.getLastRow() == endRow) { + sheet.removeMergedRegion(i); + isOK = true; + break; + } + } + return isOK; + } + + /** + * ȡַ + * + * @param inStr + * @return + */ + public static String changeStringToInt(String inStr) { + int index = inStr.indexOf("."); + System.out.println(index); + String outStr = null; + if (index != -1) { + + outStr = inStr.substring(0, index); + } else { + outStr = inStr; + + } + // System.out.println(outStr); + return outStr; + } + + /** + * ȡһȵַ + * + * @param inStr + * @param inLen + * @return + */ + public static String changeStringToInt(String inStr, int inLen) { + int index = inStr.indexOf("."); + inLen++; + System.out.println(index); + String outStr = null; + if (index != -1 && (inStr.length() - index) >= inLen) { + + outStr = inStr.substring(0, index + inLen); + } else { + outStr = inStr; + + } + // System.out.println(outStr); + return outStr; + } + + /** + * floatתɱλַ + * + * @param f + * Ҫתfloat + * @return + */ + public static String changeFloatToStr(float f) { + DecimalFormat decimalFormat = new DecimalFormat(".0");// 췽ַʽС2λ,0. + String str = decimalFormat.format(f);// format صַ + return str; + } + + /** + * ַתint + * + * @param str + * @return + */ + public static float changeStrToFloat(String str) { + float temp_int = 0; + try { + temp_int = Float.parseFloat(str.trim()); + return temp_int; + } catch (NumberFormatException e) { + System.out.println(e.getMessage()); + return -1; + } + } + + /** + * formualʱ滻ԭеĵԪŵµĵԪ + * + * @param originStr + * @param subStr + * @param index + * @param index2 + * @return + */ + public static String replaceSubString(String originStr, String subStr, + int index, int index2) { + StringBuffer sbO = new StringBuffer(); + sbO.append(subStr); + sbO.append(index); + StringBuffer sbR = new StringBuffer(); + sbR.append(subStr); + sbR.append(index2); + String resultStr = originStr.replace(sbO.toString(), sbR.toString()); + return resultStr; + } + + /** + * ȡEXCELϢ + * + * @param String + * excel_file + * @return List> Ϣ + * @throws IOException + * @throws FileNotFoundException + */ + public static List> readExcel(String excel_file) + throws FileNotFoundException, IOException { + if (excel_file == null) { + return null; + } + File file = new File(excel_file); + return readExcel(file); + } + + /** + * ȡԪΪַ͵ + * + * @param cell + * ExcelԪ + * @return String Ԫ + */ + private static String getStringCellValue(HSSFFormulaEvaluator evaluator, + HSSFCell cell) { + if (cell == null) { + return ""; + } + String strCell = ""; + switch (cell.getCellType()) { + case HSSFCell.CELL_TYPE_STRING: + strCell = cell.getStringCellValue(); + break; + case HSSFCell.CELL_TYPE_NUMERIC: + strCell = "" + cell.getNumericCellValue(); + if (strCell.endsWith(".0")) { + strCell = strCell.substring(0, strCell.indexOf(".0")); + } + break; + case HSSFCell.CELL_TYPE_BOOLEAN: + strCell = String.valueOf(cell.getBooleanCellValue()); + break; + case HSSFCell.CELL_TYPE_BLANK: + strCell = ""; + break; + case HSSFCell.CELL_TYPE_ERROR: + strCell = String.valueOf(cell.getErrorCellValue()); + break; + case HSSFCell.CELL_TYPE_FORMULA: + CellValue value = evaluator.evaluate(cell); + try { + strCell = value.getStringValue(); + if (strCell == null) { + strCell = "" + value.getNumberValue(); + if (strCell.endsWith(".0")) { + strCell = strCell.substring(0, strCell.indexOf(".0")); + } + } + } catch (Exception e) { + + strCell = "" + value.getNumberValue(); + if (strCell.endsWith(".0")) { + strCell = strCell.substring(0, strCell.indexOf(".0")); + } + } + break; + default: + strCell = ""; + break; + } + if (strCell.equals("") || strCell == null) { + return ""; + } + return strCell; + } + + /** + * ȡExcelݣһά洢һиеֵά洢Ƕٸ + * @param file ȡݵԴExcel + * @param ignoreRows ȡݺԵͷҪ ԵΪ1 + * @return Excelݵ + * @throws FileNotFoundException + * @throws IOException + */ + public static String[][] getData(File file, int ignoreRows) + throws FileNotFoundException, IOException { + List result = new ArrayList(); + int rowSize = 0; + BufferedInputStream in = new BufferedInputStream(new FileInputStream( + file)); + // HSSFWorkbook + POIFSFileSystem fs = new POIFSFileSystem(in); + HSSFWorkbook wb = new HSSFWorkbook(fs); + HSSFCell cell = null; + for (int sheetIndex = 0; sheetIndex < wb.getNumberOfSheets(); sheetIndex++) { + HSSFSheet st = wb.getSheetAt(sheetIndex); + // һΪ⣬ȡ + for (int rowIndex = ignoreRows; rowIndex <= st.getLastRowNum(); rowIndex++) { + HSSFRow row = st.getRow(rowIndex); + if (row == null) { + continue; + } + int tempRowSize = row.getLastCellNum() + 1; + if (tempRowSize > rowSize) { + rowSize = tempRowSize; + } + String[] values = new String[rowSize]; + Arrays.fill(values, ""); + boolean hasValue = false; + for (short columnIndex = 0; columnIndex <= row.getLastCellNum(); columnIndex++) { + String value = ""; + cell = row.getCell(columnIndex); + if (cell != null) { + + switch (cell.getCellType()) { + case HSSFCell.CELL_TYPE_STRING: + value = cell.getStringCellValue(); + break; + case HSSFCell.CELL_TYPE_NUMERIC: + if (HSSFDateUtil.isCellDateFormatted(cell)) { + Date date = cell.getDateCellValue(); + if (date != null) { + value = new SimpleDateFormat("yyyy-MM-dd") + .format(date); + } else { + value = ""; + } + } else { + value = new DecimalFormat("0").format(cell + .getNumericCellValue()); + } + break; + case HSSFCell.CELL_TYPE_FORMULA: + // ʱΪʽɵֵ + if (!cell.getStringCellValue().equals("")) { + value = cell.getStringCellValue(); + } else { + value = cell.getNumericCellValue() + ""; + } + break; + case HSSFCell.CELL_TYPE_BLANK: + break; + case HSSFCell.CELL_TYPE_ERROR: + value = ""; + break; + case HSSFCell.CELL_TYPE_BOOLEAN: + value = (cell.getBooleanCellValue() == true ? "Y" + : "N"); + break; + default: + value = ""; + } + } + if (columnIndex == 0 && value.trim().equals("")) { + break; + } + values[columnIndex] = rightTrim(value); + hasValue = true; + } + + if (hasValue) { + result.add(values); + } + } + } + in.close(); + String[][] returnArray = new String[result.size()][rowSize]; + for (int i = 0; i < returnArray.length; i++) { + returnArray[i] = (String[]) result.get(i); + } + return returnArray; + } + + /** + * ȥַұߵĿո + * @param str Ҫַ + * @return ַ + */ + public static String rightTrim(String str) { + if (str == null) { + return ""; + } + int length = str.length(); + for (int i = length - 1; i >= 0; i--) { + if (str.charAt(i) != 0x20) { + break; + } + length--; + } + return str.substring(0, length); + } + + // public static void insertRow(HSSFSheet sheet, int starRow, int rows) { + // HSSFRow sourceRow = sheet.getRow(starRow); + // sheet.shiftRows(starRow + 1, sheet.getLastRowNum(), rows, true, false); + // // starRow = starRow -1; + // for (int i = 0; i < rows; i++) { + // // sheet.shiftRows(starRow + i, sheet.getLastRowNum(), 1, true, + // // false); + // HSSFRow targetRow = null; + // HSSFCell sourceCell = null; + // HSSFCell targetCell = null; + // short m; + // targetRow = sheet.createRow(starRow + 1); + // targetRow.setHeight(sourceRow.getHeight()); + // System.out.println(sourceRow.getLastCellNum()); + // for (m = sourceRow.getFirstCellNum(); m < sourceRow + // .getLastCellNum(); m++) { + // System.out.println(m); + // sourceCell = sourceRow.getCell(m); + // targetCell = targetRow.createCell(m); + // // System.out.println(" ===== " + sourceCell + " " + + // // targetCell); + // // targetCell.setEncoding(sourceCell.get); + // targetCell.setCellStyle(sourceCell.getCellStyle()); + // targetCell.setCellType(sourceCell.getCellType()); + // // targetCell.setCellValue("11111"); + // } + // } + // } + + /** + * + * + * @param starRow + * @param rows + */ + public static void insertRow(HSSFSheet sheet, int starRow, int rows) { + HSSFRow sourceRow = sheet.getRow(starRow); + sheet.shiftRows(starRow + 1, sheet.getLastRowNum(), rows, true, false); + for (int i = 0; i < rows; i++) { + HSSFRow targetRow = null; + HSSFCell sourceCell = null; + HSSFCell targetCell = null; + short m; + targetRow = sheet.createRow(starRow + 1); + targetRow.setHeight(sourceRow.getHeight()); + System.out.println(sourceRow.getLastCellNum()); + for (m = sourceRow.getFirstCellNum(); m < sourceRow + .getLastCellNum(); m++) { + System.out.println(m); + sourceCell = sourceRow.getCell(m); + targetCell = targetRow.createCell(m); + targetCell.setCellStyle(sourceCell.getCellStyle()); + targetCell.setCellType(sourceCell.getCellType()); + } + } + } + + /*** + * sheetвһ + * + * @param sheet + * @param startRow + * @param rows + * @return + */ + public static HSSFSheet insertRows(HSSFSheet sheet, int startRow, int rows) { + HSSFRow sourceRow = sheet.getRow(startRow); + sheet.shiftRows(startRow + 1, sheet.getLastRowNum(), rows, true, false); + for (int i = 0; i < rows; i++) { + HSSFRow targetRow = null; + HSSFCell sourceCell = null; + HSSFCell targetCell = null; + short m; + targetRow = sheet.createRow(startRow + 1); + targetRow.setHeight(sourceRow.getHeight()); + System.out.println(sourceRow.getLastCellNum()); + for (m = sourceRow.getFirstCellNum(); m < sourceRow + .getLastCellNum(); m++) { + System.out.println(m); + sourceCell = sourceRow.getCell(m); + targetCell = targetRow.createCell(m); + targetCell.setCellStyle(sourceCell.getCellStyle()); + targetCell.setCellType(sourceCell.getCellType()); + } + } + return sheet; + } + + /** + * 鵥ԪǷ + * + * @param value + * @return + */ + public static boolean CheckCellValueIsNumber(String value) { + boolean is_ok = false; + if (value.equals("")) { + return false; + } + try { + Float.parseFloat(value); + } catch (NumberFormatException e) { + e.printStackTrace(); + System.out.println("===>" + value); + is_ok = true; + } + return is_ok; + } +} diff --git a/src/com/connor/jk/plm/bom/until/ExcelUtil07.java b/src/com/connor/jk/plm/bom/until/ExcelUtil07.java new file mode 100644 index 0000000..69b1ca3 --- /dev/null +++ b/src/com/connor/jk/plm/bom/until/ExcelUtil07.java @@ -0,0 +1,551 @@ +package com.connor.jk.plm.bom.until; + +import java.awt.image.BufferedImage; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.List; + +import javax.imageio.ImageIO; + +import org.apache.poi.ss.usermodel.CellValue; +import org.apache.poi.ss.util.AreaReference; +import org.apache.poi.ss.util.CellRangeAddress; +import org.apache.poi.ss.util.CellReference; +import org.apache.poi.xssf.usermodel.XSSFCell; +import org.apache.poi.xssf.usermodel.XSSFClientAnchor; +import org.apache.poi.xssf.usermodel.XSSFDrawing; +import org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator; +import org.apache.poi.xssf.usermodel.XSSFName; +import org.apache.poi.xssf.usermodel.XSSFRow; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + + + + +/** + * Excel Toolling + * + */ +public class ExcelUtil07 { + + + /** + * ȡEXCEL + * + * @param File + * excel_file + * @return List> صϢ + * @throws IOException + * @throws FileNotFoundException + */ + public static List> readExcel(File excel_file) + throws FileNotFoundException, IOException { + if (excel_file == null || !excel_file.exists()) { + return null; + } + // صееϢ + List> lines_msg = new ArrayList>(); + XSSFWorkbook workBook = new XSSFWorkbook( + new FileInputStream(excel_file)); + XSSFFormulaEvaluator evaluator = new XSSFFormulaEvaluator(workBook); + XSSFSheet sheet = workBook.getSheetAt(0); + XSSFRow title_row = sheet.getRow(0); + // õеĿ + int col_count = title_row.getPhysicalNumberOfCells(); + System.out.println(" SHEET COL COUNT " + col_count); + // õеĿ + int row_count = sheet.getLastRowNum(); + + System.out.println(" SHEET ROW COUNT " + row_count); + for (int j = 1; j < row_count + 1; j++) { + // صеϢ + XSSFRow row = sheet.getRow(j); + List line_msg = new ArrayList(); + for (int i = 0; i < col_count; i++) { + String value = getStringCellValue(evaluator, + row.getCell((short) i)); + line_msg.add(value); + } + lines_msg.add(line_msg); + } + // insertRow(sheet,4,1); + return lines_msg; + } + + + + public void writeSignName(String intExcelFilePath, String outExcelFilePath, + String signName, String msgValue, int sheetIndex, int rowIndex, + int cellIndex) throws IOException { + // ļ· + FileOutputStream outPut = new FileOutputStream(new File( + outExcelFilePath)); + // ļ· + FileInputStream inPut = new FileInputStream(new File(intExcelFilePath)); + XSSFWorkbook wb = new XSSFWorkbook(inPut); + wb.getName(""); + AreaReference[] areaR2 = AreaReference.generateContiguous(wb + .getName("").getRefersToFormula()); + AreaReference areaR = null; + CellReference[] cellR = areaR.getAllReferencedCells(); + cellR[0].getSheetName();// s + cellR[0].getCol();// + cellR[0].getRow();// + XSSFFormulaEvaluator evaluator = new XSSFFormulaEvaluator(wb); + XSSFSheet sheet = wb.getSheetAt(sheetIndex); + XSSFRow row = sheet.getRow(rowIndex); + + XSSFCell cell = row.getCell(cellIndex); + String value = getStringCellValue(evaluator, cell); + if (value.startsWith(signName)) { + value = value.substring(0, signName.length()); + } + + cell.setCellValue(value + msgValue); + wb.write(outPut); + inPut.close(); + outPut.close(); + } + + + /** + * ȡԪ + * + * @param wb + * @param cellName + * @return + * @throws IOException + */ + public static String getNamedCellValue(XSSFWorkbook wb, String cellName) + throws IOException { + String value = null; + XSSFFormulaEvaluator evaluator = new XSSFFormulaEvaluator(wb); + XSSFName name = wb.getName(cellName); + if (name == null) { + return ""; + } + AreaReference[] areaRs = AreaReference.generateContiguous(name + .getRefersToFormula()); + if (areaRs != null) + for (AreaReference areaR : areaRs) { + CellReference[] cellRs = areaR.getAllReferencedCells(); + if (cellRs != null) { + for (CellReference cellR : cellRs) { + String sheetName = cellR.getSheetName(); + short colIndex = cellR.getCol(); + int rowIndex = cellR.getRow(); + XSSFSheet sheet = wb.getSheet(sheetName); + XSSFRow row = sheet.getRow(rowIndex); + XSSFCell cell = row.getCell(colIndex); + value = getStringCellValue(evaluator, cell); + } + } + } + return value; + } + + + + /*** + * д뵽EXCEL д뵥ݣ + * + * @param xls_write_Address + * @param ls + * @param sheetnames + * @throws IOException + */ + public void writeExcel(String xls_write_Address, ArrayList ls, + String[] sheetnames) throws IOException { + FileOutputStream output = new FileOutputStream(new File( + xls_write_Address)); // ȡļ· + XSSFWorkbook wb = new XSSFWorkbook();// (new + // BufferedInputStream(output)); + for (int sn = 0; sn < ls.size(); sn++) { + XSSFSheet sheet = wb.createSheet(String.valueOf(sn)); + wb.setSheetName(sn, sheetnames[sn]); + ArrayList ls2 = ls.get(sn); + for (int i = 0; i < ls2.size(); i++) { + XSSFRow row = sheet.createRow(i); + String[] s = ls2.get(i); + for (int cols = 0; cols < s.length; cols++) { + XSSFCell cell = row.createCell(cols); + cell.setCellType(XSSFCell.CELL_TYPE_STRING);// ıʽ + cell.setCellValue(s[cols]);// д + } + } + } + wb.write(output); + output.close(); + System.out.println("-------WRITE EXCEL OVER-------"); + } + + /** + * ݵԪҵԪ + * + * @param inputFilePath + * @param cellName + * @return + */ + public static List getExcelNamedCellValue(String inputFilePath, + String[] cellNames) { + List valueList = new ArrayList(); + if (!new File(inputFilePath).exists()) { + for (int i = 0; i < cellNames.length; i++) + valueList.add(""); + return valueList; + } + try { + FileInputStream is = new FileInputStream(new File(inputFilePath)); + XSSFWorkbook wb = new XSSFWorkbook(is); + for (String name : cellNames) + valueList.add(getNamedCellValue(wb, name)); + is.close(); + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return valueList; + } + + + + /** + * õԪ + * + * @param row1 + * @param index + * @param str + */ + public static void setCellValue(XSSFRow row1, int index, String str) { + XSSFCell cell = row1.getCell(index); + cell.setCellType(XSSFCell.CELL_TYPE_STRING); + cell.setCellValue(str); + } + + public static void insertPicture(XSSFWorkbook wb, XSSFSheet sheet1, + String picPath, short colIndex, int rowIndex) { + + // FileOutputStream fileOut = null; + BufferedImage bufferImg = null; + // ȰѶͼƬŵһByteArrayOutputStreamУԱByteArray + try { + if (!new File(picPath).exists()) { + return; + } + String dexStr = picPath.substring(picPath.lastIndexOf(".") + 1, + picPath.length()); + ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream(); + System.out.println(picPath); + bufferImg = ImageIO.read(new File(picPath)); + ImageIO.write(bufferImg, dexStr, byteArrayOut); + // XSSFWorkbook wb = new XSSFWorkbook(); + // XSSFSheet sheet1 = wb.createSheet("test picture"); + // ͼĶһsheetֻܻȡһһҪע㣩 + XSSFDrawing patriarch = sheet1.createDrawingPatriarch(); + // anchorҪͼƬ + XSSFClientAnchor anchor = new XSSFClientAnchor(13, 13, 0, 0, + (short) colIndex, rowIndex, (short) (colIndex + 1), + rowIndex + 1); + anchor.setAnchorType(3); + // ͼƬ + patriarch + .createPicture(anchor, wb.addPicture( + byteArrayOut.toByteArray(), + XSSFWorkbook.PICTURE_TYPE_JPEG)); + + } catch (Exception e) { + e.printStackTrace(); + } + + } + + /** + * ƳϲĵԪ + * + * @param startRow + * @param endRow + * @return + */ + public static boolean removeMergen(XSSFSheet sheet, int startRow, int endRow) { + boolean isOK = false; + int count = sheet.getNumMergedRegions(); + for (int i = 0; i < count; i++) { + CellRangeAddress address = sheet.getMergedRegion(i); + System.out.println(address.getFirstRow() + "|" + + address.getLastRow()); + if (address.getFirstRow() == startRow + && address.getLastRow() == endRow) { + sheet.removeMergedRegion(i); + isOK = true; + break; + } + } + return isOK; + } + + /** + * ȡַ + * + * @param inStr + * @return + */ + public static String changeStringToInt(String inStr) { + int index = inStr.indexOf("."); + System.out.println(index); + String outStr = null; + if (index != -1) { + + outStr = inStr.substring(0, index); + } else { + outStr = inStr; + + } + // System.out.println(outStr); + return outStr; + } + + /** + * ȡһȵַ + * + * @param inStr + * @param inLen + * @return + */ + public static String changeStringToInt(String inStr, int inLen) { + int index = inStr.indexOf("."); + inLen++; + System.out.println(index); + String outStr = null; + if (index != -1 && (inStr.length() - index) >= inLen) { + + outStr = inStr.substring(0, index + inLen); + } else { + outStr = inStr; + + } + // System.out.println(outStr); + return outStr; + } + + /** + * floatתɱλַ + * + * @param f + * Ҫתfloat + * @return + */ + public static String changeFloatToStr(float f) { + DecimalFormat decimalFormat = new DecimalFormat(".0");// 췽ַʽС2λ,0. + String str = decimalFormat.format(f);// format صַ + return str; + } + + /** + * ַתint + * + * @param str + * @return + */ + public static float changeStrToFloat(String str) { + float temp_int = 0; + try { + temp_int = Float.parseFloat(str.trim()); + return temp_int; + } catch (NumberFormatException e) { + System.out.println(e.getMessage()); + return -1; + } + } + + /** + * formualʱ滻ԭеĵԪŵµĵԪ + * + * @param originStr + * @param subStr + * @param index + * @param index2 + * @return + */ + public static String replaceSubString(String originStr, String subStr, + int index, int index2) { + StringBuffer sbO = new StringBuffer(); + sbO.append(subStr); + sbO.append(index); + StringBuffer sbR = new StringBuffer(); + sbR.append(subStr); + sbR.append(index2); + String resultStr = originStr.replace(sbO.toString(), sbR.toString()); + return resultStr; + } + + /** + * ȡEXCELϢ + * + * @param String + * excel_file + * @return List> Ϣ + * @throws IOException + * @throws FileNotFoundException + */ + public static List> readExcel(String excel_file) + throws FileNotFoundException, IOException { + if (excel_file == null) { + return null; + } + File file = new File(excel_file); + return readExcel(file); + } + + /** + * ȡԪΪַ͵ + * + * @param cell + * ExcelԪ + * @return String Ԫ + */ + private static String getStringCellValue(XSSFFormulaEvaluator evaluator, + XSSFCell cell) { + if (cell == null) { + return ""; + } + String strCell = ""; + switch (cell.getCellType()) { + case XSSFCell.CELL_TYPE_STRING: + strCell = cell.getStringCellValue(); + break; + case XSSFCell.CELL_TYPE_NUMERIC: + strCell = "" + cell.getNumericCellValue(); + if (strCell.endsWith(".0")) { + strCell = strCell.substring(0, strCell.indexOf(".0")); + } + break; + case XSSFCell.CELL_TYPE_BOOLEAN: + strCell = String.valueOf(cell.getBooleanCellValue()); + break; + case XSSFCell.CELL_TYPE_BLANK: + strCell = ""; + break; + case XSSFCell.CELL_TYPE_ERROR: + strCell = String.valueOf(cell.getErrorCellValue()); + break; + case XSSFCell.CELL_TYPE_FORMULA: + CellValue value = evaluator.evaluate(cell); + try { + strCell = value.getStringValue(); + if (strCell == null) { + strCell = "" + value.getNumberValue(); + if (strCell.endsWith(".0")) { + strCell = strCell.substring(0, strCell.indexOf(".0")); + } + } + } catch (Exception e) { + + strCell = "" + value.getNumberValue(); + if (strCell.endsWith(".0")) { + strCell = strCell.substring(0, strCell.indexOf(".0")); + } + } + break; + default: + strCell = ""; + break; + } + if (strCell.equals("") || strCell == null) { + return ""; + } + return strCell; + } + + + + + /** + * + * + * @param starRow + * @param rows + */ + public static void insertRow(XSSFSheet sheet, int starRow, int rows) { + XSSFRow sourceRow = sheet.getRow(starRow); + sheet.shiftRows(starRow + 1, sheet.getLastRowNum(), rows, true, false); + for (int i = 0; i < rows; i++) { + XSSFRow targetRow = null; + XSSFCell sourceCell = null; + XSSFCell targetCell = null; + short m; + targetRow = sheet.createRow(starRow + 1); + targetRow.setHeight(sourceRow.getHeight()); + System.out.println(sourceRow.getLastCellNum()); + for (m = sourceRow.getFirstCellNum(); m < sourceRow + .getLastCellNum(); m++) { + System.out.println(m); + sourceCell = sourceRow.getCell(m); + targetCell = targetRow.createCell(m); + targetCell.setCellStyle(sourceCell.getCellStyle()); + targetCell.setCellType(sourceCell.getCellType()); + } + } + } + + /*** + * sheetвһ + * + * @param sheet + * @param startRow + * @param rows + * @return + */ + public static XSSFSheet insertRows(XSSFSheet sheet, int startRow, int rows) { + XSSFRow sourceRow = sheet.getRow(startRow); + sheet.shiftRows(startRow + 1, sheet.getLastRowNum(), rows, true, false); + for (int i = 0; i < rows; i++) { + XSSFRow targetRow = null; + XSSFCell sourceCell = null; + XSSFCell targetCell = null; + short m; + targetRow = sheet.createRow(startRow + 1); + targetRow.setHeight(sourceRow.getHeight()); + System.out.println(sourceRow.getLastCellNum()); + for (m = sourceRow.getFirstCellNum(); m < sourceRow + .getLastCellNum(); m++) { + System.out.println(m); + sourceCell = sourceRow.getCell(m); + targetCell = targetRow.createCell(m); + targetCell.setCellStyle(sourceCell.getCellStyle()); + targetCell.setCellType(sourceCell.getCellType()); + } + } + return sheet; + } + + /** + * 鵥ԪǷ + * + * @param value + * @return + */ + public static boolean CheckCellValueIsNumber(String value) { + boolean is_ok = false; + if (value.equals("")) { + return false; + } + try { + Float.parseFloat(value); + } catch (NumberFormatException e) { + e.printStackTrace(); + System.out.println("===>" + value); + is_ok = true; + } + return is_ok; + } +} diff --git a/src/com/connor/jk/plm/bom/until/Logger.java b/src/com/connor/jk/plm/bom/until/Logger.java new file mode 100644 index 0000000..e8946e7 --- /dev/null +++ b/src/com/connor/jk/plm/bom/until/Logger.java @@ -0,0 +1,24 @@ +package com.connor.jk.plm.bom.until; + +public class Logger +{ + public void debug(String message) + { + System.out.println("debug" + message); + } + + public void error(String message) + { + System.out.println("error" + message); + } + + public void info(String message) + { + System.out.println("info" + message); + } + + public void warn(String message) + { + System.out.println("warn" + message); + } +} diff --git a/src/com/connor/jk/plm/bom/until/ProgressBar.java b/src/com/connor/jk/plm/bom/until/ProgressBar.java new file mode 100644 index 0000000..8ab2412 --- /dev/null +++ b/src/com/connor/jk/plm/bom/until/ProgressBar.java @@ -0,0 +1,174 @@ +/** + * @file ProgressBar.java + * + * @brief Create progress bar + * + * @author Yanghui + * + * @history + * ================================================================ + * Date Name Description of Change + * 25-July-2008 Yanghui this class is used to create + * progress bar. + */ +package com.connor.jk.plm.bom.until; + +import java.awt.Container; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JProgressBar; +import javax.swing.Timer; +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.util.PropertyLayout; +import com.teamcenter.rac.util.Registry; + +/** + * @class ProgressBar + * @brief Create progress bar + * @author Yanghui + */ +public class ProgressBar extends AbstractAIFDialog implements ActionListener { + /** + * @var ProgressBar.progressbar + * @brief JProgressBar + */ + private JProgressBar progressbar; + + /** + * @var ProgressBar.label + * @brief label used to tips + */ + private JLabel label; + + /** + * @var ProgressBar.timer + * @brief timer used to timing operation + */ + private Timer timer; + + /** + * @var ProgressBar.bool + * @brief bool used to flag thread return + */ + private boolean bool = false; + + /** + * @var Progressbar.registry + * @brief Registry + */ + private Registry registry; + + /** + * @fn public ProgressBar() + * @brief constructor + * @param[in] null + */ + private String showLable = null ; + public ProgressBar(String showlable) { + super(true); + showLable = showlable; + this.setAlwaysOnTop(true); + } + + /** + * @fn public void setBool(boolean bool) + * @brief set bool value + * @param[in] bool + * @param[out] null + */ + public void setBool(boolean bool) { + this.bool = bool; + } + + /** + * @fn private void initUI() + * @brief createDialog method + * @param[in] null + * @param[out] null + */ + public void initUI() { + Container container = getContentPane(); + JPanel mainPanel = new JPanel(new PropertyLayout()); + this.label = new JLabel(showLable, JLabel.CENTER); + this.progressbar = new JProgressBar(); + this.progressbar.setOrientation(JProgressBar.HORIZONTAL); + this.progressbar.setMinimum(0); + this.progressbar.setMaximum(100); + this.progressbar.setValue(0); + this.progressbar.setPreferredSize(new Dimension(200, 15)); + this.progressbar.setBorderPainted(true); + this.timer = new Timer(50, (ActionListener) this); + this.timer.setRepeats(false); + mainPanel.add("1.1.center", new JLabel(" ")); + mainPanel.add("2.1.center", label); + mainPanel.add("3.1.center", progressbar); + mainPanel.add("4.1.center", new JLabel(" ")); + container.add(mainPanel); + pack(); + setLocation(500, 200); + TaskThread thread = new TaskThread(this); + thread.start(); + addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + bool = true; + } + }); + this.setVisible(true); + } + + /** + * @class TaskThread + * @brief Create progressbar + * + */ + class TaskThread extends Thread { + private ProgressBar bar; + + public TaskThread(ProgressBar bar) { + this.bar = bar; + } + + public void run() { + if (bool == false) { + // Set Status is running. + // session.setStatus(registry.getString("export Running")); + } + for (int i = 0; i < i + 1; i++) { + timer.start(); + int value = progressbar.getValue(); + if (value < 100) { + value = value + 5; + progressbar.setValue(value); + } else { + timer.stop(); + progressbar.setValue(0); + } + try { + sleep(100); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + if (bool == true) { + this.bar.setVisible(false); + this.bar.disposeDialog(); + this.bar.dispose(); + this.interrupt(); + return; + + } + + } + } + } + + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + + } +} diff --git a/src/com/connor/jk/plm/bom/until/ProgressBarThread.java b/src/com/connor/jk/plm/bom/until/ProgressBarThread.java new file mode 100644 index 0000000..b55e7b7 --- /dev/null +++ b/src/com/connor/jk/plm/bom/until/ProgressBarThread.java @@ -0,0 +1,42 @@ +/** + * @file ProgressBarThread.java + * + * @brief control progressBar. + * + * @author Yanghui + * + * @history + * ================================================================ + * Date Name Description of Change + * 08-Auguest-2008 Yanghui this class is used to control + * progress bar. + */ +package com.connor.jk.plm.bom.until; + + +/** + * @class ProgressBarThread + * @brief Create progress bar thread + * @author Yanghui + */ +public class ProgressBarThread extends Thread { + + private ProgressBar bar; + + private String title; + + public ProgressBarThread(String title,String showLable) { + this.title = title; + bar = new ProgressBar(showLable); + } + + public void run() { + bar.setTitle(title); + bar.initUI(); + } + + public void setBool(boolean bool) { + bar.setBool(true); + bar.setAlwaysOnTop(false); + } +} diff --git a/src/com/connor/jk/plm/bom/until/SearchUtility.java b/src/com/connor/jk/plm/bom/until/SearchUtility.java new file mode 100644 index 0000000..7d3c7e9 --- /dev/null +++ b/src/com/connor/jk/plm/bom/until/SearchUtility.java @@ -0,0 +1,62 @@ +package com.connor.jk.plm.bom.until; + +import com.teamcenter.rac.aif.AIFDesktop; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentContextList; +import com.teamcenter.rac.kernel.TCComponentQuery; +import com.teamcenter.rac.kernel.TCComponentQueryType; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.kernel.TCTextService; +import com.teamcenter.rac.util.MessageBox; + +public class SearchUtility { + + public static InterfaceAIFComponent[] searchComponentsCollection( + TCSession session, String searchName, String[] keys, String[] values) { + // Ϣ + InterfaceAIFComponent[] result = new InterfaceAIFComponent[0]; + + try { + TCTextService textService = session.getTextService(); + TCComponentQueryType querytype = (TCComponentQueryType) session + .getTypeComponent("ImanQuery"); + TCComponentQuery query = (TCComponentQuery) querytype + .find(searchName); + querytype.clearCache(); + // String[] as = new String[keys.length]; + // for (int i = 0; i < keys.length; i++) { + // as[i] = textService.getTextValue(keys[i]); + // } + + // String[] as1 = new String[values.length]; + // for (int i = 0; i < values.length; i++) { + // as1[i] = textService.getTextValue(values[i]); + // } + if (query == null) { + MessageBox.post("ûвҵ" + searchName + "ѯ", "", 0); + return null; + } + query.clearCache(); + TCComponentContextList list = query.getExecuteResultsList(keys, + values); + if (list != null) { + int count = list.getListCount(); + result = new InterfaceAIFComponent[count]; + + for (int i = 0; i < count; i++) { + result[i] = list.get(i).getComponent(); + } + } + } catch (TCException e) { + + e.printStackTrace(); + MessageBox.post(AIFDesktop.getActiveDesktop().getShell(), "ͨѯ" + + searchName + "ѯ.", "", 1); + + } + + return result; + } +} diff --git a/src/com/connor/jk/plm/classify/ClassifyDialog.java b/src/com/connor/jk/plm/classify/ClassifyDialog.java new file mode 100644 index 0000000..43381d7 --- /dev/null +++ b/src/com/connor/jk/plm/classify/ClassifyDialog.java @@ -0,0 +1,86 @@ +package com.connor.jk.plm.classify; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JPanel; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.PropertyLayout; + +public class ClassifyDialog extends AbstractAIFDialog { + + private TCSession session; + private AbstractAIFApplication app; + private JButton okButton1; + private JButton okButton2; + private JButton celButton; + private JPanel jpanel; + + + public ClassifyDialog(TCSession session, AbstractAIFApplication app ){ + this.session = session; + this.app = app; + } + + @Override + public void run() { + // TODO Auto-generated method stub + super.run(); + initUI(); + } + + private void initUI() { + // TODO Auto-generated method stub + setLayout(new BorderLayout()); + this.setSize( new Dimension(190, 100)); + this.setTitle("ͬѡ.."); + jpanel = new JPanel(new PropertyLayout()); + okButton1=new JButton("ͨͬ"); + okButton2=new JButton("ǿͬ"); + celButton=new JButton("ȡͬ"); + jpanel.add("1.1.left.top",okButton1); + jpanel.add("1.2.left.top",okButton2); + jpanel.add("2.1.left.top",new JLabel("")); + jpanel.add("3.1.left.top",new JLabel("")); + jpanel.add("3.2.left.top",celButton); + this.add(jpanel, BorderLayout.CENTER); + this.setVisible(true); + this.setAlwaysOnTop(true); + okButton1.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + setVisible(false); + ClassifyOperation operation = new ClassifyOperation(session, app,false); + session.queueOperation(operation); + } + }); + okButton2.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + setVisible(false); + ClassifyOperation operation = new ClassifyOperation(session, app,true); + session.queueOperation(operation); + + } + }); + celButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + setVisible(false); + } + }); + + } + +} diff --git a/src/com/connor/jk/plm/classify/ClassifyHandler.java b/src/com/connor/jk/plm/classify/ClassifyHandler.java new file mode 100644 index 0000000..02292cb --- /dev/null +++ b/src/com/connor/jk/plm/classify/ClassifyHandler.java @@ -0,0 +1,30 @@ +package com.connor.jk.plm.classify; + +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.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCSession; + +public class ClassifyHandler extends AbstractHandler { + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + // TODO Auto-generated method stub + AbstractAIFApplication app = AIFUtility.getCurrentApplication(); + TCSession session =(TCSession) app.getSession(); + +// ClassifyDialog log=new ClassifyDialog(session, app); +// new Thread(log).start(); + ClassifyOperation operation = new ClassifyOperation(session, app,false); + session.queueOperation(operation); +// ClassifyOperation operation = new ClassifyOperation(session, app); +// +// session.queueOperation(operation); + return null; + } + +} diff --git a/src/com/connor/jk/plm/classify/ClassifyHandler_2.java b/src/com/connor/jk/plm/classify/ClassifyHandler_2.java new file mode 100644 index 0000000..6b6de46 --- /dev/null +++ b/src/com/connor/jk/plm/classify/ClassifyHandler_2.java @@ -0,0 +1,29 @@ +package com.connor.jk.plm.classify; + +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.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCSession; + +public class ClassifyHandler_2 extends AbstractHandler { + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + // TODO Auto-generated method stub + AbstractAIFApplication app = AIFUtility.getCurrentApplication(); + TCSession session =(TCSession) app.getSession(); + + ClassifyOperation operation = new ClassifyOperation(session, app,true); + session.queueOperation(operation); + +// ClassifyOperation operation = new ClassifyOperation(session, app); +// +// session.queueOperation(operation); + return null; + } + +} diff --git a/src/com/connor/jk/plm/classify/ClassifyHandler_3.java b/src/com/connor/jk/plm/classify/ClassifyHandler_3.java new file mode 100644 index 0000000..65c23ad --- /dev/null +++ b/src/com/connor/jk/plm/classify/ClassifyHandler_3.java @@ -0,0 +1,84 @@ +package com.connor.jk.plm.classify; + +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.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCSession; + +public class ClassifyHandler_3 extends AbstractHandler { + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + // TODO Auto-generated method stub + AbstractAIFApplication app = AIFUtility.getCurrentApplication(); + TCSession session = (TCSession) app.getSession(); + System.out.println("ͬ"); + ClassifyOperation_3 operation = new ClassifyOperation_3(session, app, + true); + session.queueOperation(operation); + + // ClassifyOperation operation = new ClassifyOperation(session, app); + // + // session.queueOperation(operation); + return null; + } + + // жǷ·汾δ汾(е) + private boolean isLastRelease(TCComponentItemRevision itemrev, + boolean isrelease) { + boolean isLast = false; + + try { + TCComponentItem item = itemrev.getItem(); + if (isrelease) { + TCComponentItemRevision[] revs = item + .getReleasedItemRevisions();// 汾 + if (revs != null && revs.length > 0) { + for (int i = 0; i < revs.length; i++) { + String class_name = revs[i].getClassificationClass(); + if (class_name == null || class_name.equals("")) { + continue; + } + if (revs[i].equals(itemrev)) { + isLast = true; + } else { + isLast = false; + } + break; + } + + } + } else { + TCComponentItemRevision[] revs = item.getWorkingItemRevisions();// δ汾 + if (revs != null && revs.length > 0) { + for (int i = 0; i < revs.length; i++) { + String class_name = revs[i].getClassificationClass(); + if (class_name == null || class_name.equals("")) { + continue; + } + if (revs[i].equals(itemrev)) { + isLast = true; + } else { + isLast = false; + } + break; + } + } + } + + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + return isLast; + + } + +} diff --git a/src/com/connor/jk/plm/classify/ClassifyOperation.java b/src/com/connor/jk/plm/classify/ClassifyOperation.java new file mode 100644 index 0000000..eeb0fae --- /dev/null +++ b/src/com/connor/jk/plm/classify/ClassifyOperation.java @@ -0,0 +1,554 @@ +package com.connor.jk.plm.classify; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.connor.jk.plm.bom.until.ProgressBarThread; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.AbstractAIFOperation; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCClassificationService; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentICO; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.kernel.ics.ICSAdminClass; +import com.teamcenter.rac.kernel.ics.ICSKeyLov; +import com.teamcenter.rac.kernel.ics.ICSProperty; +import com.teamcenter.rac.kernel.ics.ICSSearchResult; +import com.teamcenter.rac.util.MessageBox; + +public class ClassifyOperation extends AbstractAIFOperation { + private TCSession session; + private AbstractAIFApplication app; + // mapӿлȡֵ + private Map>> map = new HashMap>>(); + // maptableѡлõıֶ + private Map> maptable = new HashMap>(); + private final String OP_NAME = "jkClassifyForm";// ѡ + private final String AP_NAME = "jkClassifyClass";// ѡ + private final String Path_NAME = "jkClassifyPath";// ͨԼjdbaѡ + private final String status_Name = "jk8MaterialStatus";// ״̬ + private List classifyRelname;// ѡȡƺͱ + private DataBaseControl dbc = null; + private String[] paths;// · + private String JdbcDriverClass; + private String ConnectionString; + private String DbUser; + private String DbPass; + private boolean isqz = false; + private String nametable; + private List> classlist = new ArrayList>(); + // 洢״̬ + private HashMap statusMap = new HashMap(); + + public ClassifyOperation(TCSession session, AbstractAIFApplication app, boolean is) { + + this.session = session; + this.app = app; + this.isqz = is; + System.out.println("+++++++++++is=" + is + "+++++++++"); + } + + @Override + public void executeOperation() throws Exception { + + System.out.println("ʼ+++++++++++++++++++++++++++++"); + ProgressBarThread wait = new ProgressBarThread("ͬ", "ͬУԵ..."); + wait.start();// + getInfo(); + jdbc(); + wait.setBool(true);// رս + wait.interrupt(); + + } + + // lovidkeyöӦval + private String getKeylov(int id, String val) { + + ICSKeyLov lov = ICSKeyLov.getICSKeyLov(id); + String s = val; + if (lov != null) { + s = lov.getValueOfKey(val); + } + return s; + } + + // ݿ⣬ͬ + public void jdbc() { + dbc = new DataBaseControl(JdbcDriverClass, ConnectionString, DbUser, DbPass); + + boolean is = false; + if (map != null && map.size() > 0) { + if (isqz) { + is = dbc.update1(map, maptable);// ǿͬݣɾ + } else { + is = dbc.update(map, maptable);// ͨͬݣɾݣ + } + + } + if (is) { + MessageBox.post("ͬɣ", "", 2); + } else { + MessageBox.post("ͬʧܣ", "ʧ", 1); + } + } + + // ȡѡ + public void getInfo() { + + try { + TCPreferenceService service = this.session.getPreferenceService(); + String[] pathValueS = service.getStringValues(this.Path_NAME); + // oracle.jdbc.driver.OracleDriver,jdbc:oracle:thin:@10.200.2.43:1521:ad15,adlibrary,adlibrary + if (pathValueS != null && pathValueS.length > 0) { +// String path = pathValueS[1]; +// System.out.println("path=" + path); +// paths = path.split(","); +// System.out.println("paths.length=" + paths.length);//·ȡ + String[] jdbc = pathValueS[0].split(","); + JdbcDriverClass = jdbc[0]; + ConnectionString = jdbc[1]; + if (jdbc.length == 4) { + DbUser = jdbc[2].trim(); + DbPass = jdbc[3].trim(); + } + + System.out.println("dba=" + JdbcDriverClass + ",ConnectionString=" + ConnectionString + ",DbUser=" + + DbUser + ",DbPass=" + DbPass); + } else { + MessageBox.post("δҵѡ" + this.Path_NAME + "ʵ", "", 1); + } + + String opValue = service.getStringValue(this.AP_NAME); + // adlib&U8,-500235:Supplier,-500292:Part_Number,-500239:Comment,-500240:Soldering:-300071,-500241:Library_Ref,-500242:Footprint_Ref + if (opValue != null) { + String[] vals = opValue.split("&"); + nametable = vals[0];// + String[] valname = vals[1].split(",");// :lovid + classifyRelname = new ArrayList(); + for (String e : valname) { + classifyRelname.add(e); + } + + } else { + MessageBox.post("δҵѡ" + this.AP_NAME + "ʵ", "", 1); + return; + } + + String[] statusList = service.getStringValues(this.status_Name); + + if (statusList != null && statusList.length > 0) { + for (String value : statusList) { + + String statusValue[] = value.split("=");// + + statusMap.put(statusValue[0], statusValue[1]); + } + } else { + MessageBox.post("δҵѡ" + this.status_Name + "ʵ", "", 1); + } + + List li = new ArrayList(); + for (int j = 0; j < classifyRelname.size(); j++) { + if (j == 0) { + String s = classifyRelname.get(j); + li.add(s); + } + String[] names = classifyRelname.get(j).split(":"); + if (names != null && names.length >= 2) { + li.add(names[1]);// li = U8,Supplier,Part_Number,.... + } + } + if (paths != null && paths.length > 0) { + for (int t = 0; t < paths.length; t++) { + String s = paths[t].split("=")[0]; + li.add(s); + } + } + li.add("rev_id"); // 2018.3.22 2汾idǷ񷢲 + li.add("is_release"); + + maptable.put(nametable, li); // nametable = adlib + + String[] apValueS = service.getStringValues(this.OP_NAME); + // prt6400613 prt6400614 + if (apValueS != null && apValueS.length > 0) { + for (String value : apValueS) { + + String classNametable = value;// class + + try { + putMap(classNametable); + + } catch (TCException e1) { + + e1.printStackTrace(); + } + + } + } else { + MessageBox.post("δҵѡ" + this.OP_NAME + "ʵ", "", 1); + } + + } catch (Exception e1) { + + MessageBox.post("ͬʧݣϵԱ", "", 1); + e1.printStackTrace(); + } + + } + + // ȡԵֵ + public void putMap(String classNametable) throws TCException { + TCClassificationService classificationService = this.session.getClassificationService(); + + ICSAdminClass c = classificationService.newICSAdminClass(); + String classname = classNametable; + // String tablename = classNametable.split(":")[1]; + + System.out.println("classname=" + classname); + c.load(classname); + + ICSSearchResult[] results = classificationService.searchICOs(classname, null, 0); + if (results == null || results.length == 0) { + System.out.println(" [" + classname + "]õĽΪ0"); + } else { + System.out.println("results.length=" + results.length); + + for (int i = 0; i < results.length; i++) { + + String icoUid = results[i].getIcoUid(); + String wsoUid = results[i].getWsoUid(); + String icoid = results[i].getIcoId(); + String classid = results[i].getClassId(); + // System.out.println("icoid"+i+"======>"+icoid); + // System.out.println("classid"+i+"======>"+classid); + // System.out.println("icoUid"+i+"="+icoUid); + // System.out.println("wsoUid"+i+"="+wsoUid); + InterfaceAIFComponent comp = this.session.stringToComponent(wsoUid); + // TCComponentItemRevision lastRev = null; + // if (comp instanceof TCComponentItemRevision) { + // + // lastRev = (TCComponentItemRevision) comp; + // + // } else if (comp instanceof TCComponentItem) { + // lastRev = ((TCComponentItem) comp).getLatestItemRevision(); + // } + + List valBeanList = new ArrayList();// һԭ + + if (paths != null && paths.length > 0) { + for (int t = 0; t < paths.length; t++) { + ClassifyValBean cb = new ClassifyValBean(); + cb.colname = paths[t].split("=")[0]; + cb.value = paths[t].split("=")[1]; + System.out.println("colname1=" + cb.colname + "value1=" + cb.value); + valBeanList.add(cb);// ̶path + } + } + if (comp != null) { + + System.out.println("classifyRelname.get(0)=" + classifyRelname.get(0)); + String name = classifyRelname.get(0); + String id = ""; + try { + id = comp.getProperty("item_id") == null ? "" : comp.getProperty("item_id").toString(); + System.out.println("id=" + id); + } catch (Exception e) { + + e.printStackTrace(); + } + ClassifyValBean ib = new ClassifyValBean(); + ib.colname = name; + ib.value = id; + + valBeanList.add(ib);// "id" + + // } + +// String[] refs = classifyRelname.get(1).split(":"); +// if (refs != null && refs.length >= 2) { +// +// ClassifyValBean ref = new ClassifyValBean(); +// ref.colname = refs[0]; +// ref.value = refs[1]; +// +// valBeanList.add(ref);// ڶ +// +// // } +// } + + } + + InterfaceAIFComponent comp2 = this.session.stringToComponent(icoUid); + ICSProperty[] icsProps = ((TCComponentICO) comp2).getICSProperties(true); + Map idValueMap = new HashMap<>(); + for (int w = 0; w < icsProps.length; w++) { + // System.out.println("zzzzz="+icsProps[w].getId()); + // System.out.println("xxxxx="+icsProps[w].getValue()); + // + idValueMap.put((icsProps[w].getId() + "").trim(), icsProps[w].getValue()); + // System.out.println((icsProps[w].getId() + + // "").trim()+"====="+icsProps[w].getValue()); + + } + + + boolean fhkmcisnotnull = true; + + + for (int j = 1; j < classifyRelname.size(); j++) { + String[] names = classifyRelname.get(j).split(":"); + if (names != null && names.length >= 2) { + String disValue = idValueMap.get(names[0]); + if (disValue != null && disValue.length() > 0) { + disValue = getRevZore(disValue); + } + if (names[0].equals("1044")&&(disValue==null||disValue.equals(""))) { + fhkmcisnotnull=false; //2021/01/05 ſΪվͲͬ + } + String lovid = ""; + if (names.length > 2) { + lovid = names[2]; + } + if (idValueMap.containsKey(names[0])) { + ClassifyValBean ib = new ClassifyValBean(); + ib.colname = names[1]; + if (!lovid.equals("")) { + ib.value = getKeylov(Integer.parseInt(lovid), disValue); + } else { + ib.value = disValue; + } + + System.out.println("colname2=" + names[1] + "--value2=" + ib.value); + valBeanList.add(ib);// + } + } + + } + + boolean isok = false; + + if (comp instanceof TCComponentItemRevision) { // 2018-3-22 + TCComponentItemRevision rev_com = (TCComponentItemRevision) comp; + String rev_id = rev_com.getTCProperty("item_revision_id").getStringValue(); + // 20200318 + String is_release = ""; + // String is_release=""; + boolean is_rele_bool = false; + TCComponent[] releases = rev_com.getTCProperty("release_status_list").getReferenceValueArray(); + String releaseStatusList = rev_com.getProperty("release_status_list") == null ? "" + : rev_com.getProperty("release_status_list").toString(); + + String releaseStatusLength[] = releaseStatusList.split(",", -1); + releaseStatusList = releaseStatusLength[releaseStatusLength.length - 1]; + if (releases != null && releases.length > 0) { + if (statusMap.containsKey(releaseStatusList)) { + + is_release = statusMap.get(releaseStatusList); + } else { + is_release = releaseStatusList; + } + + is_rele_bool = true; + // 2019.8.29 ͣ״̬ͬʾ + boolean isPause = false; + TCComponent lastreleas=releases[releases.length-1]; + if (lastreleas!=null) {//2021/0517ж״̬ + String property = lastreleas.getProperty("object_name"); + if (property.equals("ͣ")|| property.equals("JK8Pause")|| property.equals("Pause")|| property.equals("ʧЧ") + || property.equals("Disabled")|| property.equals("JK8Disabled")) { + isPause = true; + } + } +// for (TCComponent releas : releases) { +// String property = releas.getProperty("object_name"); +// if (property.equals("ͣ")|| property.equals("JK8Pause")|| property.equals("Pause")|| property.equals("ʧЧ") +// || property.equals("Disabled")|| property.equals("JK8Disabled")) { +// isPause = true; +// } +// } + if (isPause) { + continue; + } + } + + ClassifyValBean ibrev = new ClassifyValBean(); + ibrev.colname = "rev_id"; + ibrev.value = rev_id; + + ClassifyValBean ibisrea = new ClassifyValBean(); + ibisrea.colname = "is_release"; + ibisrea.value = is_release; + + valBeanList.add(ibrev);// 汾 + valBeanList.add(ibisrea);// Ƿ񷢲 + + // 2019.8.29 ijֻͬ״̬ + if (isLastRelease2(rev_com, is_rele_bool)) { + isok = true; + } + + } + + if (valBeanList != null && isok&&fhkmcisnotnull) + classlist.add(valBeanList); + + } + map.put(nametable, classlist); + } + } + + // ȥǰ0 + private String getRevZore(String val) { + int le = val.indexOf("."); + int lx1 = val.indexOf(""); + int lx2 = val.indexOf("x"); + int lt = val.length(); + if (le > -1 && lx1 < 0 && lx2 < 0) { + for (int i = 0; i < le - 1; i++) { + if (val.startsWith("0")) { + val = val.substring(1); + } else { + break; + } + + } + for (int i = 0; i < lt - le - 1; i++) { + if (val.endsWith("0")) { + val = val.substring(0, val.length() - 1); + } else { + break; + } + } + if (val.endsWith(".")) { + val = val.substring(0, val.length() - 1); + } + } + + return val; + + } + + // жǷ·汾δ汾(е) + private boolean isLastRelease(TCComponentItemRevision itemrev, boolean isrelease) { + boolean isLast = false; + + try { + TCComponentItem item = itemrev.getItem(); + if (isrelease) { + TCComponentItemRevision[] revs = item.getReleasedItemRevisions();// 汾 + if (revs != null && revs.length > 0) { + for (int i = 0; i < revs.length; i++) { + String class_name = revs[i].getClassificationClass(); + if (class_name == null || class_name.equals("")) { + continue; + } + if (revs[i].equals(itemrev)) { + isLast = true; + } else { + isLast = false; + } + break; + } + + } + } else { + TCComponent[] revs = item.getReferenceListProperty("revision_list");// а汾 + if (revs != null && revs.length > 0) { + + for (int i = 0; i < revs.length; i++) { + System.out.println("rev=" + i + "=" + revs[i] + "=" + itemrev); + String class_name = revs[i].getClassificationClass(); + if (class_name == null || class_name.equals("")) { + continue; + } + TCComponent[] releases = revs[i].getTCProperty("release_status_list").getReferenceValueArray(); + if (releases != null && releases.length > 0) { + System.out.println(","); + continue; + } + if (revs[i].equals(itemrev)) { + isLast = true; + } else { + isLast = false; + } + } + } else { + System.out.println("ް汾"); + } + } + + } catch (TCException e) { + + e.printStackTrace(); + } + + return isLast; + + } + + // жǷ·汾(е) + private boolean isLastRelease2(TCComponentItemRevision itemrev, boolean isrelease) { + boolean isLast = false; + + try { + TCComponentItem item = itemrev.getItem(); + if (isrelease) { + TCComponentItemRevision[] revs = item.getReleasedItemRevisions();// 汾һ + if (revs != null && revs.length > 0) { + for (int i = 0; i < revs.length; i++) { + String class_name = revs[i].getClassificationClass(); + if (class_name == null || class_name.equals("")) { + continue; + } + // жǷ°汾Dzͣ + TCComponent[] releases = revs[i].getTCProperty("release_status_list").getReferenceValueArray(); + if (releases != null && releases.length > 0) { + + boolean isPause = false; + TCComponent lastreleas=releases[releases.length-1]; + if (lastreleas!=null) {//2021/0517ж״̬ + String property = lastreleas.getProperty("object_name"); + if (property.equals("ͣ")|| property.equals("JK8Pause")|| property.equals("Pause")) { + isPause = true; + } + } +// for (TCComponent releas : releases) { +// if (releas.getProperty("object_name").equals("ͣ") +// || releas.getProperty("object_name").equals("JK8Pause")) { +// isPause = true; +// } +// } + if (isPause) { + continue; + } + } + + if (revs[i].equals(itemrev)) { + isLast = true; + } else { + isLast = false; + } + break; + } + + } + } + + } catch (TCException e) { + + e.printStackTrace(); + } + + return isLast; + + } + +} diff --git a/src/com/connor/jk/plm/classify/ClassifyOperation_3.java b/src/com/connor/jk/plm/classify/ClassifyOperation_3.java new file mode 100644 index 0000000..60b0140 --- /dev/null +++ b/src/com/connor/jk/plm/classify/ClassifyOperation_3.java @@ -0,0 +1,539 @@ +package com.connor.jk.plm.classify; + +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 com.connor.jk.plm.bom.until.ProgressBarThread; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.AbstractAIFOperation; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCClassificationService; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentICO; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.kernel.ics.ICSAdminClass; +import com.teamcenter.rac.kernel.ics.ICSKeyLov; +import com.teamcenter.rac.kernel.ics.ICSProperty; +import com.teamcenter.rac.kernel.ics.ICSSearchResult; +import com.teamcenter.rac.util.MessageBox; + +public class ClassifyOperation_3 extends AbstractAIFOperation { + private TCSession session; + private AbstractAIFApplication app; + // mapӿлȡֵ + private Map>> map = new HashMap>>(); + // maptableѡлõıֶ + private Map> maptable = new HashMap>(); + private final String OP_NAME = "jkClassifyForm";// ѡ + private final String AP_NAME = "jkClassifyClass";// ѡ + private final String Path_NAME = "jkClassifyPath";// ͨԼjdbaѡ + private final String status_Name = "jk8MaterialStatus";// ״̬ + private List classifyRelname;// ѡȡƺͱ + private DataBaseControl dbc = null; + private String[] paths;// · + private String JdbcDriverClass; + private String ConnectionString; + private String DbUser; + private String DbPass; + private boolean isqz = false; + private String nametable; + private InterfaceAIFComponent[] targetComps; + private List> classlist = new ArrayList>(); + private TCPreferenceService service; + private List classidlist = new ArrayList<>();// ѡõclassid + private List listtccom = new ArrayList<>();// ѡеĶ + private String idname; + private String err = "";// δ + private String err2 = "";// ·汾 2019-9-16ж쳣廯 + private String errzt = "";// ͣ + private String errisnull = "";// 20210105жԪǷΪ + // 洢״̬ + private HashMap statusMap = new HashMap(); + + public ClassifyOperation_3(TCSession session, AbstractAIFApplication app, boolean is) { + + this.session = session; + this.app = app; + targetComps = app.getTargetComponents(); + this.isqz = is; + System.out.println("+++++++++++is=" + is + "+++++++++"); + } + + @Override + public void executeOperation() throws Exception { + + System.out.println("ʼ+++++++++++++++++++++++++++++"); + service = this.session.getPreferenceService(); + String[] apValueS = service.getStringValues(this.OP_NAME); + if (apValueS != null && apValueS.length > 0) { + for (String value : apValueS) { + + classidlist.add(value);// class + + } + } else { + MessageBox.post("δҵѡ" + this.OP_NAME + "ʵ", "", 1); + } + + if (targetComps != null && targetComps.length > 0) { + for (InterfaceAIFComponent aifcom : targetComps) { + System.out.println("type=" + aifcom.getType()); + if (aifcom.getType().equals("icm0")) { + String classname = ((TCComponentICO) aifcom).getClassId(); + System.out.println("classname=" + classname); + if (classidlist.contains(classname)) { + listtccom.add((TCComponent) aifcom); + } else { + MessageBox.post("ѡждڲҪͬĶ,ȷѡ񣡣", "", MessageBox.ERROR); + return; + } + } else { + String classname = ((TCComponent) aifcom).getClassificationClass(); + System.out.println("classname=" + classname); + if (classidlist.contains(classname)) { + listtccom.add((TCComponent) aifcom); + } else { + MessageBox.post("ѡждڲͬĶ,ȷѡ񣡣", "", MessageBox.ERROR); + return; + } + + } + } + } else { + MessageBox.post("ѡȷİ汾ڷѡз󣡣", "", MessageBox.ERROR); + return; + } + ProgressBarThread wait = new ProgressBarThread("ͬ", "ͬУԵ..."); + wait.start(); // + getInfo(); + // update23(map, idname); + jdbc(); + wait.setBool(true);// رս + wait.interrupt(); + + } + + // lovidkeyöӦval + private String getKeylov(int id, String val) { + + ICSKeyLov lov = ICSKeyLov.getICSKeyLov(id); + String s = val; + if (lov != null) { + s = lov.getValueOfKey(val); + } + return s; + } + + // ݿ⣬ͬ + public void jdbc() { + dbc = new DataBaseControl(JdbcDriverClass, ConnectionString, DbUser, DbPass); + + boolean is = false; + if (map != null && map.size() > 0) { + + is = dbc.update2(map, idname);// ͨͬݣɾݣ + + } + String errAll = ""; + if ((!err.equals(""))) { + errAll = errAll + "汾" + err + "δ!"; + } + if ((!errzt.equals(""))) { + errAll = errAll + "汾" + errzt + "ͣͣ״̬!"; + } + if ((!err2.equals(""))) { + errAll = errAll + "汾" + err2 + "°汾!"; + } + if ((!errisnull.equals(""))) { + errAll = errAll + "" + err2 + "ſΪ!"; + } + if (!errAll.equals("")) { + MessageBox.post(errAll + "ͬ!", "", MessageBox.INFORMATION); + return; + } + + if (is) { + MessageBox.post("ͬɣ", "", 2); + } else { + MessageBox.post("ͬʧܣ", "ʧ", 1); + } + } + + // ȡѡ + public void getInfo() { + + try { + String[] pathValueS = service.getStringValues(this.Path_NAME); + if (pathValueS != null && pathValueS.length > 0) { + String[] jdbc = pathValueS[0].split(","); + JdbcDriverClass = jdbc[0]; + ConnectionString = jdbc[1]; + if (jdbc.length == 4) { + DbUser = jdbc[2].trim(); + DbPass = jdbc[3].trim(); + } + + System.out.println("dba=" + JdbcDriverClass + ",ConnectionString=" + ConnectionString + ",DbUser=" + + DbUser + ",DbPass=" + DbPass); + } else { + MessageBox.post("δҵѡ" + this.Path_NAME + "ʵ", "", 1); + } + + String opValue = service.getStringValue(this.AP_NAME); + if (opValue != null) { + String[] vals = opValue.split("&"); + nametable = vals[0];// + String[] valname = vals[1].split(",");// :lovid + classifyRelname = new ArrayList(); + for (String e : valname) { + classifyRelname.add(e); + } + + } else { + MessageBox.post("δҵѡ" + this.AP_NAME + "ʵ", "", 1); + return; + } + + String[] statusList = service.getStringValues(this.status_Name); + + if (statusList != null && statusList.length > 0) { + for (String value : statusList) { + + String statusValue[] = value.split("=");// + + statusMap.put(statusValue[0], statusValue[1]); + } + } else { + MessageBox.post("δҵѡ" + this.status_Name + "ʵ", "", 1); + } + + putMap(listtccom); + + } catch (Exception e1) { + + MessageBox.post("ͬʧݣϵԱ", "", 1); + e1.printStackTrace(); + } + + } + + // ȡԵֵ + public void putMap(List lists) { + try { + + for (TCComponent com : lists) { + TCComponent comp = null; + TCComponent comp2 = null; + if (com instanceof TCComponentICO) { + comp = ((TCComponentICO) com).getClassifiedObject(); + comp2 = (TCComponentICO) com; + } else if (com instanceof TCComponentItemRevision) { + comp = com; + + TCComponentICO[] icos = com.getClassificationObjects(); + comp2 = icos[icos.length-1]; + + } + + List valBeanList = new ArrayList();// һԭ + + if (paths != null && paths.length > 0) { + for (int t = 0; t < paths.length; t++) { + ClassifyValBean cb = new ClassifyValBean(); + cb.colname = paths[t].split("=")[0]; + cb.value = paths[t].split("=")[1]; + System.out.println("colname1=" + cb.colname + "value1=" + cb.value); + valBeanList.add(cb);// ̶path + } + } + String id = ""; + if (comp != null) { + + System.out.println("classifyRelname.get(0)=" + classifyRelname.get(0)); + String name = classifyRelname.get(0); + + try { + id = comp.getProperty("item_id") == null ? "" : comp.getProperty("item_id").toString(); + System.out.println("id=" + id); + } catch (Exception e) { + + e.printStackTrace(); + } + ClassifyValBean ib = new ClassifyValBean(); + ib.colname = name; + ib.value = id; + idname = name; + valBeanList.add(ib);// "id" + + } + ICSProperty[] icsProps = ((TCComponentICO) comp2).getICSProperties(true); + Map idValueMap = new HashMap<>(); + for (int w = 0; w < icsProps.length; w++) { + + idValueMap.put((icsProps[w].getId() + "").trim(), icsProps[w].getValue()); + System.out.println((icsProps[w].getId() + "").trim() + "=====" + icsProps[w].getValue()); + + } + boolean fhkmcisnotnull = true; + for (int j = 1; j < classifyRelname.size(); j++) { + String[] names = classifyRelname.get(j).split(":"); + if (names != null && names.length >= 2) { + String disValue = idValueMap.get(names[0]); + String lovid = ""; + if (names[0].equals("1044")&&(disValue==null||disValue.equals(""))) { + fhkmcisnotnull=false; //2021/01/05 ſΪվͲͬ + errisnull=errisnull+"[" + id+ "]"; + } + if (names.length > 2) { + lovid = names[2]; + } + if (idValueMap.containsKey(names[0])) { + ClassifyValBean ib = new ClassifyValBean(); + ib.colname = names[1]; + if (!lovid.equals("")) { + ib.value = getKeylov(Integer.parseInt(lovid), disValue); + } else { + ib.value = disValue; + } + + System.out.println("colname2=" + names[1] + "--value2=" + ib.value); + valBeanList.add(ib);// + } + } + + } + + boolean isok = false; + if (comp instanceof TCComponentItemRevision) { // 2018-3-22 + TCComponentItemRevision rev_com = (TCComponentItemRevision) comp; + String rev_id = rev_com.getTCProperty("item_revision_id").getStringValue(); + String is_release = ""; + boolean is_rele_bool = false; + TCComponent[] releases = rev_com.getTCProperty("release_status_list").getReferenceValueArray(); + String releaseStatusList = rev_com.getProperty("release_status_list") == null ? "" + : rev_com.getProperty("release_status_list").toString(); + + String releaseStatusLength[] = releaseStatusList.split(",", -1); + releaseStatusList = releaseStatusLength[releaseStatusLength.length - 1]; + + if (releases != null && releases.length > 0) { + if (statusMap.containsKey(releaseStatusList)) { + is_release = statusMap.get(releaseStatusList); + } else { + is_release = releaseStatusList; + } + + is_rele_bool = true; + // 2019.8.29 ͣ״̬ͬʾ + boolean isPause = false;//JK8Disabled + TCComponent lastreleas=releases[releases.length-1]; + if (lastreleas!=null) {//2021/0517ж״̬ + String property = lastreleas.getProperty("object_name"); + if (property.equals("ͣ")|| property.equals("JK8Pause")|| property.equals("Pause")|| property.equals("ʧЧ") + || property.equals("Disabled")|| property.equals("JK8Disabled")) { + isPause = true; + } + } +// for (TCComponent releas : releases) { +// String property = releas.getProperty("object_name"); +// if (property.equals("ͣ")|| property.equals("JK8Pause")|| property.equals("Pause")|| property.equals("ʧЧ") +// || property.equals("Disabled")|| property.equals("JK8Disabled")) { +// isPause = true; +// } +// } + if (isPause) { + errzt = errzt + "[" + rev_com.toString() + "]"; + continue; + } + } + + ClassifyValBean ibrev = new ClassifyValBean(); + ibrev.colname = "rev_id"; + ibrev.value = rev_id; + + ClassifyValBean ibisrea = new ClassifyValBean(); + ibisrea.colname = "is_release"; + ibisrea.value = is_release; + + valBeanList.add(ibrev);// 汾 + valBeanList.add(ibisrea);// Ƿ񷢲 + + // 2019.8.29 ijֻͬ״̬ + if (isLastRelease2(rev_com, is_rele_bool)) { + isok = true; + } else { + if (is_rele_bool) { + err2 = err2 + "[" + rev_com.toString() + "]"; + } else { + err = err + "[" + rev_com.toString() + "]"; + + } + + } + + } + + if (valBeanList != null && isok&& fhkmcisnotnull) + classlist.add(valBeanList); + + } + if (classlist != null || classlist.size() > 0) { + map.put(nametable, classlist); + } + + } catch (TCException e) { + + e.printStackTrace(); + } + + } + + // ȥǰ0 + private String getRevZore(String val) { + int le = val.indexOf("."); + int lx1 = val.indexOf(""); + int lx2 = val.indexOf("x"); + int lt = val.length(); + if (le > -1 && lx1 < 0 && lx2 < 0) { + for (int i = 0; i < le - 1; i++) { + if (val.startsWith("0")) { + val = val.substring(1); + } else { + break; + } + + } + for (int i = 0; i < lt - le - 1; i++) { + if (val.endsWith("0")) { + val = val.substring(0, val.length() - 1); + } else { + break; + } + } + if (val.endsWith(".")) { + val = val.substring(0, val.length() - 1); + } + } + + return val; + + } + + // жǷ·汾δ汾(е) + private boolean isLastRelease(TCComponentItemRevision itemrev, boolean isrelease) { + boolean isLast = false; + + try { + TCComponentItem item = itemrev.getItem(); + if (isrelease) { + TCComponentItemRevision[] revs = item.getReleasedItemRevisions();// 汾һ + if (revs != null && revs.length > 0) { + for (int i = 0; i < revs.length; i++) { + String class_name = revs[i].getClassificationClass(); + if (class_name == null || class_name.equals("")) { + continue; + } + if (revs[i].equals(itemrev)) { + isLast = true; + } else { + isLast = false; + } + break; + } + + } + } else { + TCComponent[] revs = item.getReferenceListProperty("revision_list");// а汾 + if (revs != null && revs.length > 0) { + + for (int i = 0; i < revs.length; i++) { + System.out.println("rev=" + i + "=" + revs[i] + "=" + itemrev); + String class_name = revs[i].getClassificationClass(); + if (class_name == null || class_name.equals("")) { + continue; + } + TCComponent[] releases = revs[i].getTCProperty("release_status_list").getReferenceValueArray(); + if (releases != null && releases.length > 0) { + System.out.println(","); + continue; + } + if (revs[i].equals(itemrev)) { + isLast = true; + } else { + isLast = false; + } + } + } else { + System.out.println("ް汾"); + } + } + + } catch (TCException e) { + + e.printStackTrace(); + } + + return isLast; + + } + + // жǷ·汾(е) + private boolean isLastRelease2(TCComponentItemRevision itemrev, boolean isrelease) { + boolean isLast = false; + + try { + TCComponentItem item = itemrev.getItem(); + if (isrelease) { + TCComponentItemRevision[] revs = item.getReleasedItemRevisions();// 汾һ + if (revs != null && revs.length > 0) { + for (int i = 0; i < revs.length; i++) { + String class_name = revs[i].getClassificationClass(); + if (class_name == null || class_name.equals("")) { + continue; + } + // жǷ°汾Dzͣ + TCComponent[] releases = revs[i].getTCProperty("release_status_list").getReferenceValueArray(); + if (releases != null && releases.length > 0) { + + boolean isPause = false; + TCComponent lastreleas=releases[releases.length-1]; + if (lastreleas!=null) {//2021/0517ж״̬ + String property = lastreleas.getProperty("object_name"); + if (property.equals("ͣ")|| property.equals("JK8Pause")|| property.equals("Pause")) { + isPause = true; + } + } + if (isPause) { + continue; + } + } + + if (revs[i].equals(itemrev)) { + isLast = true; + } else { + isLast = false; + } + break; + } + + } + } + + } catch (TCException e) { + + e.printStackTrace(); + } + + return isLast; + + } + +} diff --git a/src/com/connor/jk/plm/classify/ClassifyValBean.java b/src/com/connor/jk/plm/classify/ClassifyValBean.java new file mode 100644 index 0000000..b766ebc --- /dev/null +++ b/src/com/connor/jk/plm/classify/ClassifyValBean.java @@ -0,0 +1,9 @@ +package com.connor.jk.plm.classify; + +public class ClassifyValBean { + public String colname;//ݿ + public String relName;// + public String value;//ֵ + public String lovid;//lovֵ + +} diff --git a/src/com/connor/jk/plm/classify/DataBaseControl.java b/src/com/connor/jk/plm/classify/DataBaseControl.java new file mode 100644 index 0000000..663e212 --- /dev/null +++ b/src/com/connor/jk/plm/classify/DataBaseControl.java @@ -0,0 +1,624 @@ +package com.connor.jk.plm.classify; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Vector; + +import com.teamcenter.rac.util.MessageBox; + +public class DataBaseControl { + + /** ************************ݿ:*********************************** */ + /** + * kelsen .... + */ + Connection conn; + + ResultSet rs; + + PreparedStatement pstmt; + + Statement stmt; + + String strUrl, strUserName, strPassword, strSQLQuery, strDriver; + + public String str_Information = ""; + + /** + * + */ + public DataBaseControl(String strDriver, String strUrl, String strUserName, + String strPassword) { + this.strDriver = strDriver; // "oracle.jdbc.driver.OracleDriver";// + this.strUrl = strUrl; // "jdbc:oracle:thin:@127.0.0.1:1521:tceng";//· + this.strUserName = strUserName; // "infodba";//ݿû + this.strPassword = strPassword; // "infodba";//ݿ + // strSQLQuery="select * from LABELID";//ѯ + + // + try { + Class.forName(strDriver);// ͨڴ + } catch (ClassNotFoundException cnfe) { + cnfe.printStackTrace(); + } + // try { + // Class.forName("org.objectweb.rmijdbc.Driver").newInstance(); + // } catch (InstantiationException e) { + // + // e.printStackTrace(); + // } catch (IllegalAccessException e) { + // + // e.printStackTrace(); + // } catch (ClassNotFoundException e) { + // + // e.printStackTrace(); + // } + } + + /** + * + * + * @param strSQLQuery + */ + public void dbModify(String strSQLQuery) { + + openDataBase(); + + try { + stmt = conn.createStatement(); + stmt.executeUpdate(strSQLQuery); + } catch (SQLException sqle2) { + sqle2.printStackTrace(); + } + + closeDataBase(); + } + + /** + * ѯ + * + * @param strSQLQuery + * @return + */ + public ResultSet dbQuery(String strSQLQuery) { + ResultSet rs_result = null; + if (conn == null) + openDataBase(); + try { + stmt = conn.createStatement(); + rs_result = stmt.executeQuery(strSQLQuery); + + } catch (SQLException sqle2) { + sqle2.printStackTrace(); + } + return rs_result; + } + + /** + * + * + */ + public void openDataBase() { + try { + // this.strUrl="jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.29)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=tcprod)))"; + if (conn == null || conn.isClosed()) + conn = DriverManager.getConnection(strUrl, strUserName, + strPassword); + } catch (SQLException sqle) { + sqle.printStackTrace(); + } + } + + /** + * رݿ + * + */ + public void closeDataBase() { + try { + if (rs != null) { + try { + rs.close(); + } catch (SQLException sqlec) { + sqlec.printStackTrace(); + } + } + if (stmt != null) { + try { + stmt.close(); + } catch (SQLException sqlec) { + sqlec.printStackTrace(); + } + } + if (conn != null && !conn.isClosed()) { + try { + conn.close(); + } catch (SQLException sqlecon) { + sqlecon.printStackTrace(); + } + + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * 䴫ݿвѯ ѯõĽÿһ¼װһHashMap,keyԱֶ + * ѯ¼VectorжٸHasnMapԪ + * + * @param strSQLQuery + * @return + * @author xuk + */ + public Vector orgQuery(String strSQLQuery) { + openDataBase(); + Vector v_result = new Vector(); + try { + ResultSet rs_get = dbQuery(strSQLQuery); + // System.out.println("RS_GET:"+rs_get); + if (rs_get != null) { + ResultSetMetaData metaData = rs_get.getMetaData(); + + int i_ColumnCount = metaData.getColumnCount(); + // System.out.println("i_ColumnCount:"+i_ColumnCount); + while (rs_get.next()) { + // System.out.println("BJZJ2"+rs_get.getString("BJZJ2"));; + HashMap hm_unit = new HashMap(); + for (int i = 1; i <= i_ColumnCount; i++) { + hm_unit.put(metaData.getColumnName(i), + rs_get.getString(i)); + // System.out.println("metaData.getColumnName(i):"+metaData.getColumnName(i)); + // System.out.println("rs_get.getString(i):"+rs_get.getString(i)); + } + v_result.add(hm_unit); + } + } else { + str_Information = "" + strSQLQuery + "" + "ѯĽΪ\n"; + } + } catch (Exception e) { + e.printStackTrace(); + } + return v_result; + } + + /** + * ɾԭб,ͬ + * + * @param update + * @return + * @author + */ + public Boolean update1(Map>> map,Map> maptable) { + + openDataBase();// + System.out.println("ӳɹoracle"); + try { + boolean in = true; + stmt = conn.createStatement(); + for (String tableName : maptable.keySet()) { + String dorpsql = "drop table " + tableName; + try { + stmt.executeUpdate(dorpsql);// ɾ + System.out.println("ɾ" + tableName); + } catch (SQLException e) { + + System.out.println("ɾ" + tableName + "ʧ"); + } + List list1 = new ArrayList(); + list1 = maptable.get(tableName); + StringBuffer cre = new StringBuffer(); + cre.append("NO number(8) NOT NULL PRIMARY KEY,"); + for (String s : list1) { + cre.append("\"" + s + "\" varchar2(128),"); + } + + String col = cre.toString().substring(0, + cre.toString().length() - 1); + String cresql = "Create TABLE " + tableName + "(" + col + + ")"; + System.out.println(cresql); + try { + int into = stmt.executeUpdate(cresql);// + } catch (SQLException e) { + // TODO Auto-generated catch block + System.out.println("" + tableName + "ʧ"); + continue; + } + } + for (String tableName : maptable.keySet()) { +// String dorpsql = "drop table " + tableName; +// try { +// stmt.executeUpdate(dorpsql);// ɾ +// System.out.println("ɾ" + tableName); +// } catch (SQLException e) { +// +// System.out.println("ɾ" + tableName + "ʧ"); +// } +// StringBuffer cre = new StringBuffer(); +// List> list1 = new ArrayList>(); +// list1 = maptable.get(tableName); +// if (list1 != null && list1.size() > 0) { +// for (int i = 0; i < 1; i++) { +// for (ClassifyValBean bean : list1.get(i)) { +// cre.append("\"" + bean.colname + "\" varchar2(50),"); +// } +// String col = cre.toString().substring(0, +// cre.toString().length() - 1); +// String cresql = "Create TABLE " + tableName + "(" + col +// + ")"; +// System.out.println(cresql); +// try { +// int into = stmt.executeUpdate(cresql);// +// } catch (SQLException e) { +// +// System.out.println("" + tableName + "ʧ"); +// continue; +// } +// } +// } + + String delsql = "delete from " + tableName;// ɾ + List> list = new ArrayList>(); + list = map.get(tableName); + if (list != null && list.size() > 0) { + System.out.println("delsql=" + delsql); + int indel = stmt.executeUpdate(delsql);// ɾ + System.out.println("ɾ" + tableName + "ݳɹ"); + // if (indel<=0){ + // in=false; + // } + int index=0; + for (List list2 : list) { + index++; + StringBuffer colnames = new StringBuffer(); + StringBuffer vals = new StringBuffer(); + System.out.println("list2=" + list2.size()); + colnames.append("\"NO\","); + vals.append(index+","); + for (ClassifyValBean bean : list2) { + String val; + if (bean.value == null || bean.value.equals("")) { + val = " "; + } else { + val = bean.value; + } + vals.append("\'" + val + "\',"); + colnames.append("\"" + bean.colname + "\","); + } + String col = colnames.toString().substring(0, + colnames.toString().length() - 1); + String val = vals.toString().substring(0, + vals.toString().length() - 1); + String intosql = "insert into " + tableName + "(" + col + + ") values(" + val + ")";// д + System.out.println("intosql=" + intosql); + int into = stmt.executeUpdate(intosql);// ݵݿ + System.out.println("ӳɹ"); + if (into <= 0) { + in = false; + } + } + + } + + } + if (in) { + return true; + } else { + System.out.println("ɾʧ!!"); + } + + } catch (SQLException e) { + + e.printStackTrace(); + return false; + } finally { + closeDataBase(); + } + return false; + + } + + /** + * ɾԭбݣͬ oracle + * + * @param update + * @return + * @author + */ + public Boolean update(Map>> map,Map> maptable) { + + openDataBase();// + System.out.println("ӳɹoracle"); + try { + boolean in = true; + stmt = conn.createStatement(); + for (String tableName : map.keySet()) { + +// StringBuffer cre = new StringBuffer(); +// List> list1 = new ArrayList>(); +// list1 = map.get(tableName); +// if (list1 != null && list1.size() > 0) { +// for (int i = 0; i < 1; i++) { +// for (ClassifyValBean bean : list1.get(i)) { +// cre.append("\"" + bean.colname + "\" varchar2(50),"); +// } +// String col = cre.toString().substring(0, +// cre.toString().length() - 1); +// String cresql = "Create TABLE " + tableName + "(" + col +// + ")"; +// try { +// int into = stmt.executeUpdate(cresql);// +// } catch (SQLException e) { +// +// System.out.println("" + tableName + "ʧ"); +// continue; +// } +// } +// } + + String delsql = "delete from " + tableName;// ɾ + List> list = new ArrayList>(); + list = map.get(tableName); + if (list != null && list.size() > 0) { + System.out.println("delsql=" + delsql); + int indel = stmt.executeUpdate(delsql);// ɾ + System.out.println("ɾ" + tableName + "ݳɹ"); + // if (indel<=0){ + // in=false; + // } + int index=0; + for (List list2 : list) { + index++; + StringBuffer colnames = new StringBuffer(); + StringBuffer vals = new StringBuffer(); + System.out.println("list2=" + list2.size()); + colnames.append("\"NO\","); + vals.append(index+","); + for (ClassifyValBean bean : list2) { + String val; + if (bean.value == null || bean.value.equals("")) { + val = " "; + } else { + val = bean.value; + } + vals.append("\'" + val + "\',"); + colnames.append("\"" + bean.colname + "\","); + } + String col = colnames.toString().substring(0, + colnames.toString().length() - 1); + String val = vals.toString().substring(0, + vals.toString().length() - 1); + String intosql = "insert into " + tableName + "(" + col + + ") values(" + val + ")";// д + System.out.println("intosql=" + intosql); + int into = stmt.executeUpdate(intosql);// ݵݿ + System.out.println("ӳɹ"); + if (into <= 0) { + in = false; + } + } + + } + + } + if (in) { + return true; + } else { + System.out.println("ɾʧ!!"); + } + + } catch (SQLException e) { + + e.printStackTrace(); + return false; + } finally { + closeDataBase(); + } + return false; + + } + + + /** + * ֻ޸ݻ + * + * @param update + * @return + * @author + */ + public Boolean update2(Map>> map,String idname) { + + openDataBase();// + System.out.println("ӳɹoracle"); + try { + boolean in = true; + stmt = conn.createStatement(); + for (String tableName : map.keySet()) { + + List> list = new ArrayList>(); + list = map.get(tableName); + if (list != null && list.size() > 0) { + + for (List list2 : list) { + + String query2 = "select NO from "+tableName; + // ѯñݿе + + ResultSet rs_get2 = stmt.executeQuery(query2);// ѯñ + int rowCount2 = 0; + while (rs_get2.next()) { + rowCount2++;// ݵ + } + + String item_id=idname; + String item_idval=""; + String rev_id="rev_id"; + String rev_idval=""; + + StringBuffer updstr = new StringBuffer(); + //StringBuffer vals = new StringBuffer(); + StringBuffer colnames = new StringBuffer(); + StringBuffer vals = new StringBuffer(); + System.out.println("list2=" + list2.size()); + colnames.append("\"NO\","); + vals.append((rowCount2+1)+","); + System.out.println("list2=" + list2.size()); + + for (ClassifyValBean bean : list2) { + String val; + if (bean.value == null || bean.value.equals("")) { + val = " "; + } else { + val = bean.value; + } + + if(bean.colname.equals(item_id)){ + item_idval=val; + } + if(bean.colname.equals(rev_id)){ + rev_idval=val; + } + updstr.append("\"" + bean.colname + "\"=\'" + val + "\',"); + vals.append("\'" + val + "\',"); + colnames.append("\"" + bean.colname + "\","); + } + + + String query = "select NO from "+tableName+" where \""+item_id+"\"='" +item_idval+"\' and \""+rev_id+"\"='" +rev_idval+"\'"; + // ѯidݿе + + ResultSet rs_get = stmt.executeQuery(query);// ѯID + int rowCount = 0; + while (rs_get.next()) { + rowCount++;// ݵ + } + if(rowCount!=0){ + String col = updstr.toString().substring(0, + updstr.toString().length() - 1); + String update = "update " + tableName + " set " + col + + " where \""+item_id+"\"=\'"+item_idval+"\' and \""+rev_id+"\"='" +rev_idval+"\'";// д + System.out.println("update=" + update); + int into = stmt.executeUpdate(update);// ޸ݵݿ + System.out.println("޸"); + if (into <= 0) { + in = false; + } + }else{ + String col = colnames.toString().substring(0, + colnames.toString().length() - 1); + String val = vals.toString().substring(0, + vals.toString().length() - 1); + String intosql = "insert into " + tableName + "(" + col + + ") values(" + val + ")";// д + System.out.println("intosql=" + intosql); + int into = stmt.executeUpdate(intosql);// ݵݿ + System.out.println(""); + if (into <= 0) { + in = false; + } + + } + + if (rs_get != null) { + rs_get.close(); + } + if (rs_get2 != null) { + rs_get2.close(); + } + } + + } + + } + if (stmt != null) { + stmt.close(); + } + if (conn != null) { + conn.close(); + } + if (in) { + return true; + } else { + System.out.println("޸ʧ!!"); + } + + } catch (SQLException e) { + + e.printStackTrace(); + return false; + } finally { + closeDataBase(); + } + return false; + + } + + + /** + * + * + * @param args + */ +// public static void main(String args[]) { +// try { +// /* +// * String str_DataBaseDriver = "oracle.jdbc.driver.OracleDriver"; +// * String str_URL = "jdbc:oracle:thin:@origin-667aaf64:1521:TCENG"; +// * String str_UserName = "kelsen"; String str_Password = "kelsen"; +// * DataBaseControl dbc = new DataBaseControl(str_DataBaseDriver, +// * str_URL, str_UserName, str_Password); String str_Query= +// * " select * from YLCSB where YLZCID='000001' and YLZCBBH='A'"; +// * Vector v_get=dbc.orgQuery(str_Query); +// * System.out.println("v_get:"+v_get.size()); for(int +// * i=0;i>" + sp[0]); + try { + registry = Registry.getRegistry(this); + + String JdbcDriverClass = registry.getString("JdbcDriverClass");// "oracle.jdbc.driver.OracleDriver"; + String strUrl = registry.getString("ConnectionString"); // "jdbc:oracle:thin:@10.200.2.43:1521:jktc"; + String strUserName = registry.getString("DbUser");// "serial_number"; + String strPassword = registry.getString("DbPass");// "serial_number"; + + Class.forName(JdbcDriverClass); + Connection conn = DriverManager.getConnection(strUrl, strUserName, strPassword);// ݿ + // String car="Create TABLE LSHTABLE( TYPE varchar2(80), ID varchar2(80))"; + String query = "select type,id from LSHTABLE where TYPE='" + type + "' and ID='" + sp[0] + "'"; + // ѯidݿе + String upin = "insert into LSHTABLE(TYPE,ID) values('" + type + "','" + sp[0] + "')"; + // ݿһidϢ + Statement stmt = conn.createStatement(); + // stmt.executeUpdate(car);//ʼ + ResultSet rs_get = stmt.executeQuery(query);// ѯID + int rowCount = 0; + while (rs_get.next()) { + rowCount++;// ݵ + } + stmt.executeUpdate(upin); + if (rs_get != null) { + rs_get.close(); + } + if (stmt != null) { + stmt.close(); + } + if (conn != null) { + conn.close(); + } + int ls = rowCount + 1;// µˮ + + if (col != null) { + DecimalFormat df = new DecimalFormat(col); + lsh = df.format(ls); + } else { + lsh = ls + ""; + } + + } catch (Exception e) { + e.printStackTrace(); + } + String newId = sp[0] +"." + lsh; + return newId; + + } + // ͨݿˮ(,ˮǰ̶ֵ,"000"ˮλ) + public String getLsm01(String type, String oldId, String col) { + String lsh = ""; + try { + registry = Registry.getRegistry(this); + + String JdbcDriverClass = registry.getString("JdbcDriverClass");// "oracle.jdbc.driver.OracleDriver"; + String strUrl = registry.getString("ConnectionString"); // "jdbc:oracle:thin:@10.200.2.43:1521:jktc"; + String strUserName = registry.getString("DbUser");// "serial_number"; + String strPassword = registry.getString("DbPass");// "serial_number"; + + Class.forName(JdbcDriverClass); + Connection conn = DriverManager.getConnection(strUrl, strUserName, strPassword);// ݿ + // String car="Create TABLE LSHTABLE( TYPE varchar2(80), ID varchar2(80))"; + String query = "select type,id from LSHTABLE where TYPE='" + type + "' and ID='" + oldId + "'"; + // ѯidݿе +// String upin = "insert into LSHTABLE(TYPE,ID) values('" + type + "','" + oldId + "')"; + // ݿһidϢ + Statement stmt = conn.createStatement(); + // stmt.executeUpdate(car);//ʼ + ResultSet rs_get = stmt.executeQuery(query);// ѯID + int rowCount = 0; + while (rs_get.next()) { + rowCount++;// ݵ + } +// stmt.executeUpdate(upin); + if (rs_get != null) { + rs_get.close(); + } + if (stmt != null) { + stmt.close(); + } + if (conn != null) { + conn.close(); + } + int ls = rowCount + 1;// µˮ + + if (col != null) { + DecimalFormat df = new DecimalFormat(col); + lsh = df.format(ls); + } else { + lsh = ls + ""; + } + + } catch (Exception e) { + e.printStackTrace(); + } + String newId = oldId + lsh; + return newId; + + } + + public void setLsm(String type, String oldId, String col) { +// String lsh = ""; + try { + registry = Registry.getRegistry(this); + + String JdbcDriverClass = registry.getString("JdbcDriverClass");// "oracle.jdbc.driver.OracleDriver"; + String strUrl = registry.getString("ConnectionString"); // "jdbc:oracle:thin:@10.200.2.43:1521:jktc"; + String strUserName = registry.getString("DbUser");// "serial_number"; + String strPassword = registry.getString("DbPass");// "serial_number"; + + Class.forName(JdbcDriverClass); + Connection conn = DriverManager.getConnection(strUrl, strUserName, strPassword);// ݿ + // String car="Create TABLE LSHTABLE( TYPE varchar2(80), ID varchar2(80))"; +// String query = "select type,id from LSHTABLE where TYPE='" + type + "' and ID='" + oldId + "'"; + // ѯidݿе + String upin = "insert into LSHTABLE(TYPE,ID) values('" + type + "','" + oldId + "')"; + // ݿһidϢ + Statement stmt = conn.createStatement(); + // stmt.executeUpdate(car);//ʼ +// ResultSet rs_get = stmt.executeQuery(query);// ѯID +// int rowCount = 0; +// while (rs_get.next()) { +// rowCount++;// ݵ +// } + stmt.executeUpdate(upin); +// if (rs_get != null) { +// rs_get.close(); +// } + if (stmt != null) { + stmt.close(); + } + if (conn != null) { + conn.close(); + } +// int ls = rowCount + 1;// µˮ + +// if (col != null) { +// DecimalFormat df = new DecimalFormat(col); +// lsh = df.format(ls); +// } else { +// lsh = ls + ""; +// } + + } catch (Exception e) { + e.printStackTrace(); + } +// String newId = oldId + lsh; + } + + public String getLsm2(String type, String oldId, String col) { + String lsh = ""; + try { + registry = Registry.getRegistry(this); + + String JdbcDriverClass = registry.getString("JdbcDriverClass");// "oracle.jdbc.driver.OracleDriver"; + String strUrl = registry.getString("ConnectionString"); // "jdbc:oracle:thin:@10.200.2.43:1521:jktc"; + String strUserName = registry.getString("DbUser");// "serial_number"; + String strPassword = registry.getString("DbPass");// "serial_number"; + + Class.forName(JdbcDriverClass); + Connection conn = DriverManager.getConnection(strUrl, strUserName, strPassword);// ݿ + // String car="Create TABLE LSHTABLE( TYPE varchar2(80), ID varchar2(80))"; + String query = "select type,id from LSHTABLE where TYPE='" + type + "' and ID='" + oldId + "'"; + // ѯidݿе + String upin = "insert into LSHTABLE(TYPE,ID) values('" + type + "','" + oldId + "')"; + // ݿһidϢ + Statement stmt = conn.createStatement(); + // stmt.executeUpdate(car);//ʼ + ResultSet rs_get = stmt.executeQuery(query);// ѯID + int rowCount = 0; + while (rs_get.next()) { + rowCount++;// ݵ + } + stmt.executeUpdate(upin); + if (rs_get != null) { + rs_get.close(); + } + if (stmt != null) { + stmt.close(); + } + if (conn != null) { + conn.close(); + } + int ls = rowCount + 1;// µˮ + + DecimalFormat df = new DecimalFormat(col); + lsh = df.format(ls); + + } catch (SQLException | ClassNotFoundException e) { + e.printStackTrace(); + } + return lsh; + + } + + public int getLsm3(String type, String oldId, String col) { + + int ls = 0; + try { + registry = Registry.getRegistry(this); + + String JdbcDriverClass = registry.getString("JdbcDriverClass");// "oracle.jdbc.driver.OracleDriver"; + String strUrl = registry.getString("ConnectionString"); // "jdbc:oracle:thin:@10.200.2.43:1521:jktc"; + String strUserName = registry.getString("DbUser");// "serial_number"; + String strPassword = registry.getString("DbPass");// "serial_number"; + + Class.forName(JdbcDriverClass); + Connection conn = DriverManager.getConnection(strUrl, strUserName, strPassword);// ݿ + // String car="Create TABLE LSHTABLE( TYPE varchar2(80), ID varchar2(80))"; + String query = "select type,id from LSHTABLE where TYPE='" + type + "' and ID='" + oldId + "'"; + // ѯidݿе + String upin = "insert into LSHTABLE(TYPE,ID) values('" + type + "','" + oldId + "')"; + // ݿһidϢ + Statement stmt = conn.createStatement(); + // stmt.executeUpdate(car);//ʼ + ResultSet rs_get = stmt.executeQuery(query);// ѯID + int rowCount = 0; + while (rs_get.next()) { + rowCount++;// ݵ + } + stmt.executeUpdate(upin); + if (rs_get != null) { + rs_get.close(); + } + if (stmt != null) { + stmt.close(); + } + if (conn != null) { + conn.close(); + } + ls = rowCount + 1;// µˮ + +// DecimalFormat df=new DecimalFormat(col); +// lsh=df.format(ls); + + } catch (SQLException | ClassNotFoundException e) { + e.printStackTrace(); + } + // String newId=oldId+lsh; + return ls; + + } + + // ͨݿˮ(,ˮǰ̶ֵ,"000"ˮλ) + public String getLsm4(String type, String oldId, String col) { + String lsh = ""; + int ls = 0; + try { + registry = Registry.getRegistry(this); + + String JdbcDriverClass = registry.getString("JdbcDriverClass");// "oracle.jdbc.driver.OracleDriver"; + String strUrl = registry.getString("ConnectionString"); // "jdbc:oracle:thin:@10.200.2.43:1521:jktc"; + String strUserName = registry.getString("DbUser");// "serial_number"; + String strPassword = registry.getString("DbPass");// "serial_number"; + + Class.forName(JdbcDriverClass); + Connection conn = DriverManager.getConnection(strUrl, strUserName, strPassword);// ݿ + // String car="Create TABLE LSHTABLE( TYPE varchar2(80), ID varchar2(80))"; + String query = "select type,id from LSHTABLE where TYPE='" + type + "' and ID='" + oldId + "'"; + // ѯidݿе + String upin = "insert into LSHTABLE(TYPE,ID) values('" + type + "','" + oldId + "')"; + // ݿһidϢ + Statement stmt = conn.createStatement(); + // stmt.executeUpdate(car);//ʼ + ResultSet rs_get = stmt.executeQuery(query);// ѯID + int rowCount = 0; + while (rs_get.next()) { + rowCount++;// ݵ + } + stmt.executeUpdate(upin); + if (rs_get != null) { + rs_get.close(); + } + if (stmt != null) { + stmt.close(); + } + if (conn != null) { + conn.close(); + } + ls = rowCount;// µˮ + + if (col != null) { + DecimalFormat df = new DecimalFormat(col); + lsh = df.format(ls); + } else { + lsh = ls + ""; + } + + } catch (SQLException | ClassNotFoundException e) { + e.printStackTrace(); + } + if (ls == 0) { + String newId = oldId; + return newId; + } else { + String newId = oldId + "-" + lsh; + return newId; + } + + } + + public String getLsm5(String type, String oldId, String col) { + String lsh = ""; + try { + registry = Registry.getRegistry(this); + + String JdbcDriverClass = registry.getString("JdbcDriverClass");// "oracle.jdbc.driver.OracleDriver"; + String strUrl = registry.getString("ConnectionString"); // "jdbc:oracle:thin:@10.200.2.43:1521:jktc"; + String strUserName = registry.getString("DbUser");// "serial_number"; + String strPassword = registry.getString("DbPass");// "serial_number"; + + Class.forName(JdbcDriverClass); + Connection conn = DriverManager.getConnection(strUrl, strUserName, strPassword);// ݿ + // String car="Create TABLE LSHTABLE( TYPE varchar2(80), ID varchar2(80))"; + String query = "select type,id from LSHTABLE where TYPE='" + type + "' and ID='" + oldId + "'"; + // ѯidݿе + String upin = "insert into LSHTABLE(TYPE,ID) values('" + type + "','" + oldId + "')"; + // ݿһidϢ + Statement stmt = conn.createStatement(); + // stmt.executeUpdate(car);//ʼ + ResultSet rs_get = stmt.executeQuery(query);// ѯID + int rowCount = 0; + while (rs_get.next()) { + rowCount++;// ݵ + } + stmt.executeUpdate(upin); + if (rs_get != null) { + rs_get.close(); + } + if (stmt != null) { + stmt.close(); + } + if (conn != null) { + conn.close(); + } + int ls = rowCount + 1;// µˮ + + if (col != null) { + DecimalFormat df = new DecimalFormat(col); + lsh = df.format(ls); + } else { + lsh = ls + ""; + } + + } catch (SQLException | ClassNotFoundException e) { + e.printStackTrace(); + } + if ("00".equals(lsh)) { + return oldId; + } else { + String newId = oldId + lsh; + return newId; + } + + } + + // ͨݿˮ(,ˮǰ̶ֵ,"000"ˮλ) + public String getLsm6(String type, String oldId, String col) { + String lsh = ""; + int ls = 0; + try { + registry = Registry.getRegistry(this); + + String JdbcDriverClass = registry.getString("JdbcDriverClass");// "oracle.jdbc.driver.OracleDriver"; + String strUrl = registry.getString("ConnectionString"); // "jdbc:oracle:thin:@10.200.2.43:1521:jktc"; + String strUserName = registry.getString("DbUser");// "serial_number"; + String strPassword = registry.getString("DbPass");// "serial_number"; + + Class.forName(JdbcDriverClass); + Connection conn = DriverManager.getConnection(strUrl, strUserName, strPassword);// ݿ + // String car="Create TABLE LSHTABLE( TYPE varchar2(80), ID varchar2(80))"; + String query = "select type,id from LSHTABLE where TYPE='" + type + "' and ID='" + oldId + "'"; + // ѯidݿе + String upin = "insert into LSHTABLE(TYPE,ID) values('" + type + "','" + oldId + "')"; + // ݿһidϢ + Statement stmt = conn.createStatement(); + // stmt.executeUpdate(car);//ʼ + ResultSet rs_get = stmt.executeQuery(query);// ѯID + int rowCount = 0; + while (rs_get.next()) { + rowCount++;// ݵ + } + stmt.executeUpdate(upin); + if (rs_get != null) { + rs_get.close(); + } + if (stmt != null) { + stmt.close(); + } + if (conn != null) { + conn.close(); + } + ls = rowCount;// µˮ + + if (col != null) { + DecimalFormat df = new DecimalFormat(col); + lsh = df.format(ls); + } else { + lsh = ls + ""; + } + + } catch (SQLException | ClassNotFoundException e) { + e.printStackTrace(); + } + if (ls == 0) { + String newId = oldId; + return newId; + } else { + String newId = oldId + lsh; + return newId; + } + + } +} diff --git a/src/com/connor/jk/plm/createproject/createproject_locale.properties b/src/com/connor/jk/plm/createproject/createproject_locale.properties new file mode 100644 index 0000000..960b080 --- /dev/null +++ b/src/com/connor/jk/plm/createproject/createproject_locale.properties @@ -0,0 +1,5 @@ +JdbcDriverClass=oracle.jdbc.driver.OracleDriver +ConnectionString=jdbc:oracle:thin:@10.200.2.43:1521:jktc +DbUser=serial_number +DbPass=serial_number + diff --git a/src/com/connor/jk/plm/downloadDS/DownloadDSDialog.java b/src/com/connor/jk/plm/downloadDS/DownloadDSDialog.java new file mode 100644 index 0000000..5e28878 --- /dev/null +++ b/src/com/connor/jk/plm/downloadDS/DownloadDSDialog.java @@ -0,0 +1,173 @@ +package com.connor.jk.plm.downloadDS; + +import java.awt.BorderLayout; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.IOException; +import java.util.LinkedList; + +import javax.swing.JButton; +import javax.swing.JFileChooser; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; +import javax.swing.filechooser.FileSystemView; + +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.aif.AbstractAIFUIApplication; +import com.teamcenter.rac.kernel.TCComponentDataset; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class DownloadDSDialog extends AbstractAIFDialog implements ActionListener{ + private AbstractAIFUIApplication app; + private TCSession session; + private TCComponentDataset target; + + private JButton okButton; + private JButton cancelButton; + private JButton pathButton; + private JPanel mainPanel; + private JTextField field; + public DownloadDSDialog(AbstractAIFUIApplication app, TCComponentDataset target) { + this.app = app; + session = (TCSession)app.getSession(); + this.target = target; + } + + @Override + public void run() { + try { + init(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + private void init()throws Exception{ + mainPanel = new JPanel(new BorderLayout()); + mainPanel.add(getCenterPanel(),BorderLayout.CENTER); + mainPanel.add(getButtonPanel(),BorderLayout.SOUTH); + addListeners(); + add(mainPanel); + setAlwaysOnTop(true); + showDialog(); + } + + private JPanel getCenterPanel() { + JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER)); + field = new JTextField(30); + pathButton = new JButton("..."); + panel.add(new JLabel("·")); + panel.add(field); + panel.add(pathButton); + + + return panel; + } + private JPanel getButtonPanel() { + JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER)); + okButton = new JButton(""); + cancelButton = new JButton("ȡ"); + panel.add(okButton); + panel.add(new JLabel(" ")); + panel.add(cancelButton); + + return panel; + } + + private void addListeners() { + okButton.addActionListener(this); + cancelButton.addActionListener(this); + pathButton.addActionListener(this); + } + + @Override + public void actionPerformed(ActionEvent e) { + Object source = e.getSource(); + if(source == okButton) { + if(field.getText()==null||field.getText().trim().equals("")) { + MessageBox.post(DownloadDSDialog.this,"ѡ·","",MessageBox.INFORMATION); + return; + } + DownloadDSOperation operation = new DownloadDSOperation(app, session, target,field.getText()); + session.queueOperation(operation); + DownloadDSDialog.this.dispose(); + }else if(source == cancelButton) { + DownloadDSDialog.this.dispose(); + }else if(source == pathButton) { + JFileChooser jfc = new JFileChooser(); + FileSystemView fsv = FileSystemView.getFileSystemView(); + String tempPath = System.getProperty("java.io.tmpdir"); + String tempFilePath = tempPath + File.separator +"ݼ·.txt"; + File exportFileTxt = new File(tempFilePath); + if(exportFileTxt.exists()) { + String[] openTextFile = openTextFile(tempFilePath); + System.out.println("ϴα·"+openTextFile[0]); + jfc.setCurrentDirectory(new File(openTextFile[0])); + }else { + jfc.setCurrentDirectory(fsv.getHomeDirectory()); + } + + jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + jfc.showOpenDialog(DownloadDSDialog.this); + File f = jfc.getSelectedFile(); + if (f != null) { + System.out.println("->" + f.getAbsolutePath()); + field.setText(f.getAbsolutePath()); + try { + writeFile(tempFilePath,f.getAbsolutePath()); + } catch (IOException e1) { + e1.printStackTrace(); + } + } + } + } + public static String[] openTextFile(String path){ + File source = new File(path); + System.out.println("ȡļ·"+path); + LinkedList arr = new LinkedList(); + BufferedReader br = null; + try{ + br = new BufferedReader( + new FileReader(source)); + String info = null; + while((info = br.readLine()) != null){ + arr.add(info); + } + }catch(FileNotFoundException e){ + System.err.println("ļδҵ"); + }catch(IOException e){ + System.err.println("ļȡ"); + }catch(Exception e){ + System.err.println(e.getMessage()); + }finally{ + try{ + br.close(); + }catch(IOException e){ + System.err.println(e.getMessage()); + } + } + String[] results = new String[arr.size()]; + arr.toArray(results); + return results; + } + public static void writeFile(String filePath, String context) throws IOException { + FileOutputStream fileOutputStream = null; + File file = new File(filePath); + if(!file.exists()){ + file.createNewFile(); + } + fileOutputStream = new FileOutputStream(file); + fileOutputStream.write(context.getBytes("utf-8")); + fileOutputStream.flush(); + fileOutputStream.close(); + + } +} diff --git a/src/com/connor/jk/plm/downloadDS/DownloadDSHandler.java b/src/com/connor/jk/plm/downloadDS/DownloadDSHandler.java new file mode 100644 index 0000000..9c76384 --- /dev/null +++ b/src/com/connor/jk/plm/downloadDS/DownloadDSHandler.java @@ -0,0 +1,28 @@ +package com.connor.jk.plm.downloadDS; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.teamcenter.rac.aif.AbstractAIFUIApplication; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCComponentDataset; +import com.teamcenter.rac.util.MessageBox; + +public class DownloadDSHandler extends AbstractHandler{ + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + AbstractAIFUIApplication app = AIFUtility.getCurrentApplication(); + InterfaceAIFComponent targetComponent = app.getTargetComponent(); + if(targetComponent instanceof TCComponentDataset) { + DownloadDSDialog dialog = new DownloadDSDialog(app, (TCComponentDataset) targetComponent); + new Thread(dialog).start(); + }else { + MessageBox.post("ѡݼ","",MessageBox.INFORMATION); + } + return null; + } + +} diff --git a/src/com/connor/jk/plm/downloadDS/DownloadDSOperation.java b/src/com/connor/jk/plm/downloadDS/DownloadDSOperation.java new file mode 100644 index 0000000..8dfd5ee --- /dev/null +++ b/src/com/connor/jk/plm/downloadDS/DownloadDSOperation.java @@ -0,0 +1,136 @@ +package com.connor.jk.plm.downloadDS; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.Label; +import java.io.File; + +import javax.swing.JPanel; +import javax.swing.JProgressBar; +import javax.swing.SwingConstants; + +import com.teamcenter.rac.aif.AbstractAIFOperation; +import com.teamcenter.rac.aif.AbstractAIFUIApplication; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentDataset; +import com.teamcenter.rac.kernel.TCComponentTcFile; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + + +public class DownloadDSOperation extends AbstractAIFOperation{ + private AbstractAIFUIApplication app; + private TCSession session; + private TCComponentDataset target; + private String errInfo = ""; + private String path; + public DownloadDSOperation(AbstractAIFUIApplication app, TCSession session, TCComponentDataset target,String path) { + this.app = app; + this.session = session; + this.target = target; + this.path = path; + } + + @Override + public void executeOperation() throws Exception { + new Thread() { + public void run() { + WaitingDialog dia = new WaitingDialog(app.getDesktop(), "INFOMATION", "......"); + dia.setVisible(true); + boolean flag = false; + try { + flag = download(); + } catch (Exception e) { + e.printStackTrace(); + flag = false; + }finally { + if (flag) { + dia.setVisible(false); + MessageBox.post("سɹ", "", MessageBox.INFORMATION); + } else { + dia.setVisible(false); + MessageBox.post(errInfo+"ʧܣ", "", MessageBox.INFORMATION); + } + } + }; + }.start(); + } + + private boolean download() { + try { + String object_name = target.getProperty("object_name"); + TCComponent[] ref_list = target.getReferenceListProperty("ref_list"); + if(ref_list==null || ref_list.length!=1) { + throw new Exception("ݼļǷΪ1"); + } + String string = ref_list[0].toString(); + String tempstr = string.substring(string.lastIndexOf("."),string.length()); + String filename = object_name+ tempstr; + exportFileToDir(target,filename,path); + }catch (Exception e) { + e.printStackTrace(); + errInfo+=e.getMessage()+"\n"; + return false; + } + return true; + } + + /** + * ݼļָ· + * @param dataset ݼ + * @param filename ļ + * @param dir · + * @return ļ + */ + public File exportFileToDir(TCComponentDataset dataset, String filename, String dir) throws Exception{ + File exportFile = null; + String workdir = dir; + File tFile = new File(workdir, filename); + if (tFile.exists()) + tFile.delete(); + TCComponentTcFile files[] = dataset.getTcFiles(); + if (files.length != 1) { + MessageBox.post("ݼļǷΪ1", "", MessageBox.WARNING); + return null; + } +// for (int i = 0; i < files.length; i++) { + exportFile = files[0].getFile(workdir, filename); +// } + return exportFile; + } + + class WaitingDialog extends com.teamcenter.rac.aif.AbstractAIFDialog { + private static final long serialVersionUID = 1L; + public JPanel panel; + JProgressBar progressBar = null; + + public WaitingDialog(Frame arg0, String title, String message) { + super(arg0, title); + this.setModal(false); + + panel = new JPanel(new BorderLayout()); + + /* + * JLabel label = new JLabel(message); System.out.println("message:"+message); + * System.out.println("label:"+label); panel.add(label); + */ + + progressBar = new JProgressBar(SwingConstants.HORIZONTAL); + progressBar.setVisible(true); + progressBar.setIndeterminate(true); + + panel.add(BorderLayout.CENTER, new Label(message)); + panel.add(BorderLayout.SOUTH, progressBar); + + panel.setPreferredSize(new Dimension(350, 60)); + + this.getContentPane().add(panel); + + centerToScreen(); + + pack(); + + } + } +} diff --git a/src/com/connor/jk/plm/exportBOM/ProgressBar.java b/src/com/connor/jk/plm/exportBOM/ProgressBar.java new file mode 100644 index 0000000..e921727 --- /dev/null +++ b/src/com/connor/jk/plm/exportBOM/ProgressBar.java @@ -0,0 +1,171 @@ +/** + * @file ProgressBar.java + * + * @brief Create progress bar + * + * @author Yanghui + * + * @history + * ================================================================ + * Date Name Description of Change + * 25-July-2008 Yanghui this class is used to create + * progress bar. + */ +package com.connor.jk.plm.exportBOM; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JProgressBar; +import javax.swing.Timer; +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.util.PropertyLayout; +import com.teamcenter.rac.util.Registry; + +/** + * @class ProgressBar + * @brief Create progress bar + * @author Yanghui + */ +public class ProgressBar extends AbstractAIFDialog implements ActionListener { + /** + * @var ProgressBar.progressbar + * @brief JProgressBar + */ + private JProgressBar progressbar; + + /** + * @var ProgressBar.label + * @brief label used to tips + */ + private JLabel label; + + /** + * @var ProgressBar.timer + * @brief timer used to timing operation + */ + private Timer timer; + + /** + * @var ProgressBar.bool + * @brief bool used to flag thread return + */ + private boolean bool = false; + + /** + * @var Progressbar.registry + * @brief Registry + */ + private Registry registry; + + /** + * @fn public ProgressBar() + * @brief constructor + * @param[in] null + */ + private String showLable = null ; + public ProgressBar(String showlable) { + super(true); + showLable = showlable; + this.setAlwaysOnTop(true); + } + + /** + * @fn public void setBool(boolean bool) + * @brief set bool value + * @param[in] bool + * @param[out] null + */ + public void setBool(boolean bool) { + this.bool = bool; + } + + /** + * @fn private void initUI() + * @brief createDialog method + * @param[in] null + * @param[out] null + */ + public void initUI() { + Container container = getContentPane(); + JPanel mainPanel = new JPanel(new PropertyLayout()); + this.label = new JLabel(showLable, JLabel.CENTER); + this.progressbar = new JProgressBar(); + this.progressbar.setOrientation(JProgressBar.HORIZONTAL); + this.progressbar.setMinimum(0); + this.progressbar.setMaximum(100); + this.progressbar.setValue(0); + this.progressbar.setPreferredSize(new Dimension(200, 15)); + this.progressbar.setBorderPainted(true); + this.timer = new Timer(50, (ActionListener) this); + this.timer.setRepeats(false); + mainPanel.add("1.1.center", new JLabel(" ")); + mainPanel.add("2.1.center", label); + mainPanel.add("3.1.center", progressbar); + mainPanel.add("4.1.center", new JLabel(" ")); + container.add(mainPanel); + pack(); + setLocation(500, 200); + TaskThread thread = new TaskThread(this); + thread.start(); + addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + bool = true; + } + }); + this.setVisible(true); + } + + /** + * @class TaskThread + * @brief Create progressbar + * + */ + class TaskThread extends Thread { + private ProgressBar bar; + + public TaskThread(ProgressBar bar) { + this.bar = bar; + } + + public void run() { + if (bool == false) { + // Set Status is running. + // session.setStatus(registry.getString("export Running")); + } + for (int i = 0; i < i + 1; i++) { + timer.start(); + int value = progressbar.getValue(); + if (value < 100) { + value = value + 5; + progressbar.setValue(value); + } else { + timer.stop(); + progressbar.setValue(0); + } + try { + sleep(100); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + if (bool == true) { + bar.setVisible(false); + bar.dispose(); + return; + + } + + } + } + } + + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + + } +} diff --git a/src/com/connor/jk/plm/exportBOM/ProgressBarThread.java b/src/com/connor/jk/plm/exportBOM/ProgressBarThread.java new file mode 100644 index 0000000..6d8774f --- /dev/null +++ b/src/com/connor/jk/plm/exportBOM/ProgressBarThread.java @@ -0,0 +1,41 @@ +/** + * @file ProgressBarThread.java + * + * @brief control progressBar. + * + * @author Yanghui + * + * @history + * ================================================================ + * Date Name Description of Change + * 08-Auguest-2008 Yanghui this class is used to control + * progress bar. + */ +package com.connor.jk.plm.exportBOM; + +/** + * @class ProgressBarThread + * @brief Create progress bar thread + * @author Yanghui + */ +public class ProgressBarThread extends Thread { + + private ProgressBar bar; + + private String title; + + public ProgressBarThread(String title,String showLable) { + this.title = title; + bar = new ProgressBar(showLable); + } + + public void run() { + bar.setTitle(title); + bar.initUI(); + } + + public void setBool(boolean bool) { + bar.setBool(true); + bar.setAlwaysOnTop(false); + } +} diff --git a/src/com/connor/jk/plm/exportBOM/exportBOM_Action.java b/src/com/connor/jk/plm/exportBOM/exportBOM_Action.java new file mode 100644 index 0000000..cb71956 --- /dev/null +++ b/src/com/connor/jk/plm/exportBOM/exportBOM_Action.java @@ -0,0 +1,139 @@ +/** + * + */ +package com.connor.jk.plm.exportBOM; + +import java.awt.event.ActionEvent; +import java.util.HashMap; +import java.util.Map; + +import javax.swing.AbstractAction; + +import org.eclipse.core.commands.AbstractHandler; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.AbstractAIFUIApplication; +import com.teamcenter.rac.aif.common.actions.AbstractAIFAction; +import com.teamcenter.rac.aif.kernel.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.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +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.MessageBox; + +/** + * @author Administrator + * + */ +public class exportBOM_Action extends AbstractAIFAction { + private AbstractAIFApplication app; + private InterfaceAIFComponent targetComp; + private TCSession session; + + + public exportBOM_Action(AbstractAIFApplication arg0, String arg1) { + super(arg0, arg1); + this.app = arg0; + this.session = (TCSession) app.getSession(); + this.targetComp = app.getTargetComponent(); + } + + + @Override + public void run() { + System.out.println(targetComp.getType()); + TCComponentBOMLine topline=null; + if (targetComp instanceof TCComponentBOMViewRevision) { + try { + TCComponent comp = (TCComponent) targetComp; + AIFComponentContext[] context = comp.whereReferenced(); + TCComponentItemRevision rev = null; + for (int i = 0; i < context.length; i++) { + System.out.println("i:" + i); + if (context[i].getComponent() instanceof TCComponentItemRevision) { + rev = (TCComponentItemRevision) context[i].getComponent(); + break; + } + } + System.out.println("͵ṹ"); + com.teamcenter.rac.common.Activator.getDefault() + .openPerspective("com.teamcenter.rac.pse.PSEPerspective"); + com.teamcenter.rac.common.Activator.getDefault().openComponents( + "com.teamcenter.rac.pse.PSEPerspective", + new InterfaceAIFComponent[] { rev.getItem() }); + + System.out.println("͵ṹ"); + Thread.sleep(1*1000); +// AbstractBOMLineViewerApplication bomapp = (AbstractBOMLineViewerApplication) AIFUtility +// .getCurrentApplication(); +// AbstractViewableTreeTable m_tree = null; +// // ȡBOM +// if (m_tree == null) { +// m_tree = bomapp.getAbstractViewableTreeTable(); +// } else { +// m_tree = bomapp.getAbstractViewableTreeTable(); +// +// } +// +// // չBOM +// ExpandBelowOperation operation = new ExpandBelowOperation(m_tree); +// // session.queueOperation(operation); +// session.queueOperation(operation, true); + + TCComponentBOMWindowType type = (TCComponentBOMWindowType) session.getTypeComponent("BOMWindow"); + TCComponentBOMWindow win = type.create(null); + topline = win.setWindowTopLine(rev.getItem(), rev, null, null); + exportBOM_Dialog dialog=new exportBOM_Dialog(session,topline); + new Thread(dialog).run(); + } catch (Exception e) { + e.printStackTrace(); + } + + } + else if(targetComp instanceof TCComponentBOMLine) { +// AbstractBOMLineViewerApplication bomapp = (AbstractBOMLineViewerApplication) AIFUtility +// .getCurrentApplication(); +// AbstractViewableTreeTable m_tree = null; +// // ȡBOM +// if (m_tree == null) { +// m_tree = bomapp.getAbstractViewableTreeTable(); +// } else { +// m_tree = bomapp.getAbstractViewableTreeTable(); +// +// } +// +// // չBOM +// ExpandBelowOperation operation = new ExpandBelowOperation(m_tree); +// // session.queueOperation(operation); +// session.queueOperation(operation, true); + System.out.println("bingo"); + try { + if(((TCComponentBOMLine)targetComp).getTCProperty("bl_formatted_parent_name").getStringValue().equals("")) { + System.out.println("bingooooooo"); + }else { + MessageBox.post("ѡжBOMLineٵ","",MessageBox.INFORMATION); + return; + } + } catch (TCException e) { + e.printStackTrace(); + } + exportBOM_Dialog dialog=new exportBOM_Dialog(session,targetComp); + new Thread(dialog).run(); + }else { + MessageBox.post("ǰѡе"+targetComp.getType()+",ѡͼ汾ڽṹѡжBOMLineٵ","",MessageBox.INFORMATION); + return; + } + } + +} diff --git a/src/com/connor/jk/plm/exportBOM/exportBOM_Bean.java b/src/com/connor/jk/plm/exportBOM/exportBOM_Bean.java new file mode 100644 index 0000000..50dcd15 --- /dev/null +++ b/src/com/connor/jk/plm/exportBOM/exportBOM_Bean.java @@ -0,0 +1,80 @@ +package com.connor.jk.plm.exportBOM; + +public class exportBOM_Bean { + + private String number;//ţ + private String materialCode;//ϱ룻 + private String materialName;// + private String techCode;//ͺ + private String specCode;//ͺ + private String quantity;// + private String unit;//λ + private String drawID;//ͼ + + //ȫ + private String global_list; + //ֲ + private String local_list; + + public String getGlobal_list() { + return global_list; + } + public void setGlobal_list(String global_list) { + this.global_list = global_list; + } + public String getLocal_list() { + return local_list; + } + public void setLocal_list(String local_list) { + this.local_list = local_list; + } + public String getNumber() { + return number; + } + public void setNumber(String number) { + this.number = number; + } + public String getMaterialCode() { + return materialCode; + } + public void setMaterialCode(String materialCode) { + this.materialCode = materialCode; + } + public String getMaterialName() { + return materialName; + } + public void setMaterialName(String materialName) { + this.materialName = materialName; + } + public String getTechCode() { + return techCode; + } + public void setTechCode(String techCode) { + this.techCode = techCode; + } + public String getSpecCode() { + return specCode; + } + public void setSpecCode(String specCode) { + this.specCode = specCode; + } + public String getQuantity() { + return quantity; + } + public void setQuantity(String quantity) { + this.quantity = quantity; + } + public String getUnit() { + return unit; + } + public void setUnit(String unit) { + this.unit = unit; + } + public String getDrawID() { + return drawID; + } + public void setDrawID(String drawID) { + this.drawID = drawID; + } + +} diff --git a/src/com/connor/jk/plm/exportBOM/exportBOM_Dialog.java b/src/com/connor/jk/plm/exportBOM/exportBOM_Dialog.java new file mode 100644 index 0000000..7102961 --- /dev/null +++ b/src/com/connor/jk/plm/exportBOM/exportBOM_Dialog.java @@ -0,0 +1,435 @@ +package com.connor.jk.plm.exportBOM; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.io.File; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.swing.BorderFactory; +import javax.swing.DefaultComboBoxModel; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JFileChooser; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; +import javax.swing.border.TitledBorder; +import javax.swing.filechooser.FileSystemView; + +import com.teamcenter.rac.aif.AbstractAIFDialog; +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.TCComponentForm; +import com.teamcenter.rac.kernel.TCComponentICO; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.kernel.ics.ICSProperty; +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.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; + +public class exportBOM_Dialog extends AbstractAIFDialog { + + private TCSession session; + private InterfaceAIFComponent targetComp; + private JLabel pathLabel; + private JTextField pathField; + private JLabel nameLabel;// + private JTextField nameField;// ĬΪ嵥 + private JLabel selectLabel;// ͣṹ嵥Ӳ嵥 + private String selectWhichType = "ṹ嵥"; + private JButton celButton; + private JLabel exportType;// + private JComboBox comBox_selectExportType; + private String selectExportFileType = "Excel"; + + private JButton pathButton; + private JFileChooser jFileChooser; + private JButton okButton; + ProgressBarThread wait; + InterfaceAIFComponent comp; + private String BOMName = "ṹ嵥"; + + private JComboBox comBox_selectType; + private JComboBox single_or_not;// + private JComboBox model_combo;//ģ + + public exportBOM_Dialog(TCSession session, InterfaceAIFComponent targetComp) { + this.session = session; + this.targetComp = targetComp; + } + + @Override + public void run() { + initUI(); + + } + + private String recognise = ""; + private String baseBoardComponentName = " ";// 2017.11.10 + private String specModel = " ";// ͺ2017.11.10 + private String tecModel = " ";// ͺ2017.11.10 + + private void initUI() { + + this.setTitle("BOM嵥"); + this.setSize(new Dimension(300, 300)); + this.setLayout(new BorderLayout()); + this.setAlwaysOnTop(true); + setLayout(new BorderLayout()); + JPanel mainPanel = new JPanel(new PropertyLayout()); + + nameLabel = new JLabel(""); + nameField = new JTextField(50); + // 2017.10.27ļƶΪid--ͺ + // Ӳ嵥BOM嵥-u8--Ʒʶ-RD-ĵ-汾 + // ṹ嵥BOM嵥-u8(item_id)-Ʒʶ(jk8ProductIdentifyNO)-RD-ĵ(date_released)-汾ţitem_revision_id + // 2017.11.10ļƶΪ + // Ӳ嵥BOM嵥-u8-ƣԴԣ-ƷʶţԴԡʹòƷʶš޸öΪգ-RD-ĵڣBOM׼绹δ׼öΪգ-汾 + // ṹ嵥BOM嵥-u8-Ʒ-ƷʶţԴԡͺš-L/RԴԡͺš޸öΪգ-RD-ĵڣBOM׼绹δ׼öΪգ-汾 + try { + TCComponentItemRevision child = ((TCComponentBOMLine) targetComp).getItemRevision(); + // ڷеIJƷʶ + TCComponent[] forms = child.getTCProperty("IMAN_master_form_rev").getReferenceValueArray(); + specModel = ((TCComponentForm) forms[0]).getTCProperty("jk8SpecModel").getStringValue(); + tecModel = ((TCComponentForm) forms[0]).getTCProperty("jk8TechModel").getStringValue(); + TCComponentICO[] icoS = child.getClassificationObjects(); + Integer[] keys = null; + String[] vals = null; + int count = 0; + int count1 = 0; + for (int i = 0; i < icoS.length; i++) { + ICSProperty[] cPropS = icoS[i].getICSProperties(true); + for (int j = 0; j < cPropS.length; j++) { + // System.out.println(count); + count++; + } + keys = new Integer[count]; + vals = new String[count]; + for (int j = 0; j < cPropS.length; j++) { + // System.out.println(count); + keys[count1] = cPropS[j].getId();// Ǵ + // System.out.println("keys[" + count1 + "]================>" + keys[count1]); + vals[count1] = cPropS[j].getValue(); + // System.out.println("vals[" + count1 + "]================>" + vals[count1]); + if (keys[count1] == 1050) {// Ʒʶ keys[count1] == -500301 2021/1/5Ǩƺid + recognise = vals[count1]; + // break; + } + if (keys[count1] == 50205015) {// keys[count1] == -500293 2021/1/5Ǩƺid + baseBoardComponentName = vals[count1]; + } + + count1++; + } + + } + // if(child.getTCProperty("jk8ProductIdentifyNO")==null) { + // MessageBox.post("汾 Ʒʶţjk8ProductIdentifyNO + // δ","",MessageBox.INFORMATION); + // recognise="޲Ʒʶ"; + // }else { + // + // recognise=child.getTCProperty("jk8ProductIdentifyNO").getStringValue(); + // } + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); + Date date_released = child.getTCProperty("date_released").getDateValue(); + String time = ""; + if (recognise == null || recognise.equals("")) { + recognise = " "; + } + if (baseBoardComponentName == null || baseBoardComponentName.equals("")) { + baseBoardComponentName = " "; + } + if (specModel == null || specModel.equals("")) { + specModel = " "; + } + if (tecModel == null || tecModel.equals("")) { + tecModel = " "; + } + if (date_released != null) { + time = sdf.format(date_released); + } else { + time = " "; + } + String name = "BOM嵥-" + child.getTCProperty("item_id").getStringValue() + "-" + + child.getTCProperty("object_name").getStringValue() + "-" + specModel + "-" + tecModel + "-" + + recognise + "-RD-" + time + "-" + child.getTCProperty("item_revision_id").getStringValue(); + BOMName = name; + } catch (TCException e2) { + e2.printStackTrace(); + } + + nameField.setText(BOMName); + selectLabel = new JLabel(""); + // б + List selectExportType = new ArrayList<>(); + selectExportType.add("Excel"); + selectExportType.add("PDF"); + comBox_selectExportType=new JComboBox( + new DefaultComboBoxModel(selectExportType.toArray(new String[selectExportType.size()]))); + comBox_selectExportType.addItemListener(new ItemListener() { + + @Override + public void itemStateChanged(ItemEvent e) { + // TODO Auto-generated method stub + if (e.getItem() != null) { + + selectExportFileType = (String) e.getItem(); + } + } + }); + single_or_not = new JComboBox(); + single_or_not.addItem(""); + single_or_not.addItem(""); + single_or_not.setSelectedIndex(0); + + model_combo = new JComboBox(); + model_combo.addItem(""); + model_combo.addItem(""); + model_combo.setSelectedIndex(0); + + // б + List selectType = new ArrayList<>(); + selectType.add("ṹ嵥"); + selectType.add("Ӳ嵥"); + comBox_selectType = new JComboBox( + new DefaultComboBoxModel(selectType.toArray(new String[selectType.size()]))); + comBox_selectType.addItemListener(new ItemListener() { + + @Override + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + TCComponentItemRevision child = null; + String time = ""; + try { + child = ((TCComponentBOMLine) targetComp).getItemRevision(); + + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); + Date date_released = child.getTCProperty("date_released").getDateValue(); + if (date_released != null) { + + time = sdf.format(date_released); + } else { + time = ""; + + } + + } catch (TCException e2) { + e2.printStackTrace(); + } + if (e.getItem() != null) { + + selectWhichType = (String) e.getItem(); + + if (selectWhichType.equals("ṹ嵥")) { + try { + String name = "BOM嵥-" + child.getTCProperty("item_id").getStringValue() + "-" + + child.getTCProperty("object_name").getStringValue() + "-" + specModel + "-" + + tecModel + "-" + recognise + "-RD-" + time + "-" + + child.getTCProperty("item_revision_id").getStringValue(); + nameField.setText(name); + } catch (TCException e1) { + e1.printStackTrace(); + } + } else if (selectWhichType.equals("Ӳ嵥")) { + // 2017.10.27 ޸ĵ + try { + String name1; + if(isChecking()){ + name1 = "֤BOM嵥-" + child.getTCProperty("item_id").getStringValue() + "-" + // +child.getTCProperty("object_name").getStringValue() + + baseBoardComponentName// 2017.11.10л + + "-" + recognise + "-RD-" + time + "-" + + child.getTCProperty("item_revision_id").getStringValue(); + }else{ + name1 = "BOM嵥-" + child.getTCProperty("item_id").getStringValue() + "-" + // +child.getTCProperty("object_name").getStringValue() + + baseBoardComponentName// 2017.11.10л + + "-" + recognise + "-RD-" + time + "-" + + child.getTCProperty("item_revision_id").getStringValue(); + } + + nameField.setText(name1); + } catch (TCException e1) { + e1.printStackTrace(); + } + + } + + } else + return; + } + + } + }); + + pathLabel = new JLabel("·"); + pathField = new JTextField(FileSystemView.getFileSystemView().getHomeDirectory().getPath());// ǰû· + pathField.setEditable(false); + pathButton = new JButton("ѡļ"); + okButton = new JButton("ȷ"); + jFileChooser = new JFileChooser(FileSystemView.getFileSystemView().getHomeDirectory().getPath()); + jFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + // + pathButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent actionevent) { + setAlwaysOnTop(false); + if (jFileChooser.showOpenDialog(null) != 1) + pathField.setText(jFileChooser.getSelectedFile().getAbsolutePath()); + setAlwaysOnTop(true); + } + }); + + okButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent arg0) { + disposeDialog(); + dispose(); + try { + AbstractBOMLineViewerApplication bomapp = (AbstractBOMLineViewerApplication) AIFUtility + .getCurrentApplication(); + AbstractViewableTreeTable m_tree = null; + // ȡBOM + if (m_tree == null) { + m_tree = bomapp.getAbstractViewableTreeTable(); + } else { + m_tree = bomapp.getAbstractViewableTreeTable(); + + } + + // չBOM + ExpandBelowOperation operation2 = new ExpandBelowOperation(m_tree); + // session.queueOperation(operation); + session.queueOperation(operation2, true); + Thread.sleep(2*1000); +// MessageBox.post("ǰѡĿ꣺"+bomapp.getTargetComponent()+",Ϊ"+bomapp.getTargetComponent().getType(),"",MessageBox.INFORMATION); + comp = bomapp.getTargetComponent(); +// comp = targetComp; + + // if(selectWhichType.equals("ṹ嵥")) { + // if(!((TCComponentBOMLine) + // comp).getItemRevision().getTCProperty("item_id").getStringValue().startsWith("E-8")&&!((TCComponentBOMLine) + // comp).getItemRevision().getTCProperty("item_id").getStringValue().startsWith("8")) + // { + // MessageBox.post("ṹ嵥E-88ͷ","",MessageBox.INFORMATION); + // return; + // } + // } + // if(selectWhichType.equals("Ӳ嵥")) { + // if(!((TCComponentBOMLine) + // comp).getItemRevision().getTCProperty("item_id").getStringValue().startsWith("7")) + // { + // MessageBox.post("Ӳ嵥7ͷ","",MessageBox.INFORMATION); + // return; + // } + // } + + wait = new ProgressBarThread("BOM嵥", "ִУԵ..."); + String path = pathField.getText(); + wait.start(); + int isSingle = -1; + int model_choose = -1; + if(single_or_not.getSelectedItem().toString().equals("")) { + isSingle = 1; + }else { + isSingle = 0; + } + if(model_combo.getSelectedItem().toString().equals("")) { + model_choose = 1; + }else { + model_choose = 0; + } + if (selectWhichType.equals("ṹ嵥")) { + exportBOM_Operation operation = new exportBOM_Operation(nameField.getText(), path, wait, + session, (TCComponentBOMLine) comp,selectExportFileType,isSingle,model_choose); + session.queueOperation(operation); + } else if (selectWhichType.equals("Ӳ嵥")) { + exportHardwareBOM_Operation operation = new exportHardwareBOM_Operation(nameField.getText(), + path, wait, session, (TCComponentBOMLine) comp,selectExportFileType,isSingle,model_choose); + session.queueOperation(operation); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + + mainPanel.add("1.1.left.top", pathLabel); + mainPanel.add("1.2.left.top", pathField); + mainPanel.add("1.3.left.top", pathButton); + mainPanel.add("2.1.left.top", nameLabel); + mainPanel.add("2.2.left.top", nameField); + mainPanel.add("3.1.left.top", selectLabel); + mainPanel.add("3.2.left.top", comBox_selectType); + // 2017.12.5 ӵ + exportType = new JLabel("ʽ"); + mainPanel.add("4.1.left.top",exportType); + mainPanel.add("4.2.left.top",comBox_selectExportType); + //2022/11/10ӵ㼶 + mainPanel.add("5.1.left.top",new JLabel("㼶")); + mainPanel.add("5.2.left.top",single_or_not); + //2022//12/21ӵģ + mainPanel.add("6.1.left.top",new JLabel("ģ")); + mainPanel.add("6.2.left.top",model_combo); + add(mainPanel, BorderLayout.CENTER); + JPanel buttonPanel = new JPanel(new FlowLayout()); + buttonPanel.add(okButton); + celButton = new JButton("ȡ"); + celButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent arg0) { + disposeDialog(); + dispose(); + + } + }); + buttonPanel.add(celButton); + add(buttonPanel, BorderLayout.SOUTH); + centerToScreen(); + pack(); + showDialog(); + + } + private boolean isChecking(){ + try { + TCComponentItemRevision itemRevision = ((TCComponentBOMLine) targetComp).getItemRevision(); + //TCComponentBOMViewRevision bom_view_rev = ((TCComponentBOMLine) targetComp).getBOMViewRevision(); + TCComponent[] releses = itemRevision.getReferenceListProperty("release_status_list"); + if (releses!=null&&releses.length>0) { + TCComponent rel = releses[releses.length-1]; + String rel_name = rel.getProperty("object_name"); + System.out.println("״̬Ϊ:"+rel_name); + if (rel_name.equals("Checking")) { + return true; + } + } + + + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return false; + } +} diff --git a/src/com/connor/jk/plm/exportBOM/exportBOM_Handler.java b/src/com/connor/jk/plm/exportBOM/exportBOM_Handler.java new file mode 100644 index 0000000..e4b229a --- /dev/null +++ b/src/com/connor/jk/plm/exportBOM/exportBOM_Handler.java @@ -0,0 +1,21 @@ +package com.connor.jk.plm.exportBOM; + +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.aifrcp.AIFUtility; + +public class exportBOM_Handler extends AbstractHandler{ + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + // TODO Auto-generated method stub + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + exportBOM_Action action=new exportBOM_Action(app,null); + new Thread(action).start(); + return null; + } + +} diff --git a/src/com/connor/jk/plm/exportBOM/exportBOM_Operation.java b/src/com/connor/jk/plm/exportBOM/exportBOM_Operation.java new file mode 100644 index 0000000..766f106 --- /dev/null +++ b/src/com/connor/jk/plm/exportBOM/exportBOM_Operation.java @@ -0,0 +1,1100 @@ +package com.connor.jk.plm.exportBOM; + +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.List; + +import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.IndexedColors; +import org.apache.poi.ss.util.CellRangeAddress; +import org.apache.poi.xssf.usermodel.XSSFCell; +import org.apache.poi.xssf.usermodel.XSSFCellStyle; +import org.apache.poi.xssf.usermodel.XSSFFont; +import org.apache.poi.xssf.usermodel.XSSFRow; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + +import com.jacob.activeX.ActiveXComponent; +import com.jacob.com.ComThread; +import com.jacob.com.Dispatch; +import com.jacob.com.Variant; +import com.teamcenter.rac.aif.AbstractAIFOperation; +import com.teamcenter.rac.aif.kernel.AIFComponentContext; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentBOMLine; +import com.teamcenter.rac.kernel.TCComponentBOMView; +import com.teamcenter.rac.kernel.TCComponentDataset; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCComponentTcFile; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class exportBOM_Operation extends AbstractAIFOperation { + private String type; + private String path; + private ProgressBarThread wait; + private TCSession session; + private TCComponentBOMLine comp; + private FileInputStream fis; + private XSSFWorkbook workbook; + private FileOutputStream out; + private TCPreferenceService preferenceService; + private String selectExportFileType; + private int isSingle = -1; + private int model_choose = -1; + + public exportBOM_Operation(String type, String path, + ProgressBarThread wait, TCSession session, TCComponentBOMLine comp, + String selectExportFileType, int isSingle,int modelchoose) { + // TODO Auto-generated constructor stub + this.type = type; + this.path = path; + this.wait = wait; + this.session = session; + this.comp = comp; + this.selectExportFileType = selectExportFileType; + this.isSingle = isSingle; + model_choose = modelchoose; + } + + @Override + public void executeOperation() throws Exception { + // TODO Auto-generated method stub + // ץȡfnd0ActuatedInteractiveTsks fnd0Performer fnd0EndDate + // fnd0AliasTaskName + String name1 = ""; + String name2 = ""; + String name3 = ""; + TCComponent[] component = comp.getItemRevision() + .getTCProperty("fnd0ActuatedInteractiveTsks") + .getReferenceValueArray(); + // //ļ + // type=comp.getItemRevision().getTCProperty("item_id").getStringValue()+"-" + // +comp.getItemRevision().getTCProperty("object_name").getStringValue()+"-"; + // System.out.println(component.length); + + for (int i = 0; i < component.length; i++) { + // + if (component[i].getTCProperty("fnd0AliasTaskName") + .getStringValue().contains("")) { + name1 = component[i].getTCProperty("fnd0Performer") + .getDisplayValue().split("\\(")[0]; + name1 = name1 + + "/" + + component[i].getTCProperty("fnd0EndDate") + .getDisplayValue(); + } else if (component[i].getTCProperty("fnd0AliasTaskName") + .getStringValue().contains("")) { + name2 = component[i].getTCProperty("fnd0Performer") + .getDisplayValue().split("\\(")[0]; + name2 = name2 + + "/" + + component[i].getTCProperty("fnd0EndDate") + .getDisplayValue(); + } else if (component[i].getTCProperty("fnd0AliasTaskName") + .getStringValue().contains("׼")) { + name3 = component[i].getTCProperty("fnd0Performer") + .getDisplayValue().split("\\(")[0]; + name3 = name3 + + "/" + + component[i].getTCProperty("fnd0EndDate") + .getDisplayValue(); + } + } + long start = System.currentTimeMillis(); + int colsCount = 16; + String sxx = "";// G8TlM0X6YvbLjA + if(model_choose == 1) { + sxx = "jk_bom_uid";// G8TlM0X6YvbLjA + + }else if(model_choose ==0) { + + sxx = "tx_bom_uid";// G8TlM0X6YvbLjA + } + File file = getExcel(sxx); + if (file == null) { + return; + } + + long time01 = System.nanoTime(); + getBomline(comp, realNumber); + long time02 = System.nanoTime(); + System.out.println("===============ȡbomʱ(ms) " + ((time02 - time01) / 1000000L)+"==============="); +// MessageBox.post("ȡbomʱ(ms) " + ((time02 - time01) / 1000000L),"",MessageBox.INFORMATION); + // 2017.11.17 ͺţͺ + TCComponentForm form_topline = (TCComponentForm) comp.getItemRevision() + .getReferenceListProperty("IMAN_master_form_rev")[0]; + String techCode_topline = form_topline.getTCProperty("jk8TechModel") + .getStringValue(); + String specCode_topline = form_topline.getTCProperty("jk8SpecModel") + .getStringValue(); + + System.out.println("BOM" + list.size() + ""); + int rowCount = list.size(); + fis = new FileInputStream(file); + workbook = new XSSFWorkbook(fis); + XSSFSheet sheet = workbook.getSheet("ṹ嵥"); + System.out.println("ģ干"+sheet.getLastRowNum()+""); + + // sheet.setColumnWidth(4, 7000); + // sheet.setColumnWidth(12, 7000); + // XSSFCellStyle sty = workbook.createCellStyle(); + // sty.setWrapText(true);//Զ + // sty.setAlignment(XSSFCellStyle.ALIGN_CENTER); + // sty.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER); + // style1.setFillPattern(FillPatternType.SOLID_FOREGROUND);//һҪ䣬ñɫ + // style1.setFillForegroundColor(new XSSFColor( new Color(232, 242, + // 254)));//ñɫ + XSSFRow row = sheet.getRow(1); + XSSFCell cell_0 = row.getCell(3); + cell_0.setCellValue(comp.getItemRevision().getTCProperty("item_id") + .getStringValue()); + cell_0 = row.getCell(10); + cell_0.setCellValue(comp.getItemRevision() + .getTCProperty("item_revision_id").getStringValue()); + row = sheet.getRow(2); + cell_0 = row.getCell(3); + cell_0.setCellValue(comp.getItemRevision().getTCProperty("object_name") + .getStringValue()); + // 2017.11.17 + row = sheet.getRow(3); + cell_0 = row.getCell(3); + cell_0.setCellValue(specCode_topline); + cell_0 = row.getCell(10); + cell_0.setCellValue(techCode_topline); + + row = sheet.getRow(4); + cell_0 = row.getCell(3); + Date date = new Date(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + String time = sdf.format(date); + time = time.replace("-", "."); + cell_0.setCellValue(time);// Ч + int startRow = 6; + XSSFCellStyle sty = workbook.createCellStyle();// ½Ԫĸʽ + XSSFCellStyle style = workbook.createCellStyle();// BеԪĸʽ + // XSSFCellStyle sty2 = sheet.getRow(7).getCell(1).getCellStyle(); + XSSFCellStyle sty2 = workbook.createCellStyle();//еĸʽ + sty2.setBorderBottom((short) 1); + sty2.setBorderLeft((short) 2); + sty2.setBorderRight((short) 1); + sty2.setBorderTop((short) 1); + sty2.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER); + // XSSFCellStyle sty3 = sheet.getRow(6).getCell(13).getCellStyle();// + // NеԪĸʽ + XSSFCellStyle sty3 = workbook.createCellStyle();// PеԪĸʽ + // XSSFCellStyle sty4 = sheet.getRow(7).getCell(13).getCellStyle();// + // кһеĸʽ + XSSFCellStyle sty4 = workbook.createCellStyle();// кһеĸʽ + XSSFCellStyle sty5 = workbook.createCellStyle();// עеʽ + XSSFCellStyle sty6 = workbook.createCellStyle();// qianԪĸʽ + XSSFCellStyle sty7 = workbook.createCellStyle();// /ڵԪĸʽ + sty6.setBorderBottom((short) 2); + sty6.setBorderLeft((short) 2); + sty6.setBorderRight((short) 1); + sty6.setBorderTop((short) 1); + + sty7.setBorderLeft((short) 1); + sty7.setBorderBottom((short) 2); + sty7.setBorderRight((short) 2); + sty7.setBorderTop((short) 1); + + XSSFCellStyle sty8 = workbook.createCellStyle();// /ڵԪĸʽ + sty8.setBorderTop((short) 1); + sty8.setBorderBottom((short) 1); + sty8.setBorderLeft((short) 2); + sty8.setBorderRight((short) 1); + + XSSFCellStyle sty9 = workbook.createCellStyle();// /ڵԪĸʽ + sty9.setBorderTop((short) 1); + sty9.setBorderBottom((short) 1); + sty9.setBorderLeft((short) 1); + sty9.setBorderRight((short) 2); + + sty5.setBorderRight((short) 2); + sty5.setBorderLeft((short) 1); + sty5.setBorderTop((short) 1); + sty5.setBorderBottom((short) 1); + sty = sheet.getRow(7).getCell(11).getCellStyle(); + sty.setBorderBottom(CellStyle.BORDER_THIN); + sty.setBottomBorderColor(IndexedColors.BLACK.getIndex()); + sty.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER);// ֱ + sty.setAlignment(XSSFCellStyle.ALIGN_LEFT);// ˮƽ + XSSFFont font = workbook.createFont(); + font.setFontName("΢ź"); + font.setFontHeightInPoints((short) 9);// С + // sty.setFont(font); + style.setBorderBottom(CellStyle.BORDER_THIN); + style.setBorderTop((short) 1); + style.setBottomBorderColor(IndexedColors.BLACK.getIndex()); + style.setAlignment(XSSFCellStyle.ALIGN_CENTER); // + style.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER); // + style.setFont(font); + sty2.setFont(font); + sty3.setBorderBottom((short) 1); + sty3.setBorderRight((short) 2); + sty3.setBorderLeft((short) 1); + // sty3.setBottomBorderColor(IndexedColors.BLACK.getIndex()); + sty3.setBorderTop((short) 1); + // sty3.setTopBorderColor(IndexedColors.BLACK.getIndex()); + + sty4.setBorderBottom((short) 2); + // sty4.setBottomBorderColor(IndexedColors.BLACK.getIndex()); + sty4.setBorderTop((short) 1); + // sty4.setTopBorderColor(IndexedColors.BLACK.getIndex()); + sty4.setBorderLeft((short) 1); + // sty4.setLeftBorderColor(IndexedColors.BLACK.getIndex()); + sty4.setBorderRight((short) 1); + sty4.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER); + // sty4.setRightBorderColor(IndexedColors.BLACK.getIndex()); + XSSFFont font2 = workbook.createFont(); + font2.setFontName(""); + // font2.setFontName("΢ź"); + font2.setFontHeightInPoints((short) 11);// С + sty4.setFont(font2); + // sty4.setAlignment(XSSFCellStyle.ALIGN_CENTER); + // sty4.setAlignment(XSSFCellStyle.VERTICAL_CENTER); + for (int i = 0; i < rowCount + 7; i++) { + XSSFRow r = null; + boolean isCreate = false; + System.out.println("sheet.getLastRowNum()-------->" + + sheet.getLastRowNum()); + if ((i + startRow) > sheet.getLastRowNum()) { + r = sheet.createRow(i + startRow); + r.setHeight((short) 402); + isCreate = true; + } else { + r = sheet.getRow(i + startRow); + System.out.println("и---------" + r.getHeight()); + isCreate = false; + } + + // Ԫ񣬺ϲԪ + for (int cols = 1; cols < colsCount; cols++) { + XSSFCell cell = null; + if (isCreate) { + System.out.println(""+(i + startRow)+";"+cols+""); + cell = r.createCell(cols); + cell.setCellStyle(sty); + // TODO ʽ + } else { + if (r == null) { + r = sheet.createRow(i + startRow); + + System.out.println("ûд"); + } + cell = r.getCell(cols); + } + if (cols == 3 && isCreate && i < rowCount + 3) { + + CellRangeAddress cra = new CellRangeAddress(i + startRow, i + + startRow, 2, 3); + sheet.addMergedRegion(cra); + } else if (cols == 5 && isCreate && i < rowCount + 3) { + CellRangeAddress cra = new CellRangeAddress(i + startRow, i + + startRow, 4, 5); + sheet.addMergedRegion(cra); + } else if (cols == 7 && isCreate && i < rowCount + 3) { + CellRangeAddress cra = new CellRangeAddress(i + startRow, i + + startRow, 6, 7); + sheet.addMergedRegion(cra); + } else if (cols == 9 && isCreate && i < rowCount + 3) { + CellRangeAddress cra = new CellRangeAddress(i + startRow, i + + startRow, 8, 9); + sheet.addMergedRegion(cra); + } + } + + for (int cols = 1; cols < colsCount; cols++) { + // if (i < rowCount+3) { + // + // CellRangeAddress cra = new CellRangeAddress(i + startRow, i + + // startRow, 8,9); + // sheet.addMergedRegion(cra); + // } + XSSFCell cell = null; + if (isCreate) { + cell = r.createCell(cols); + cell.setCellStyle(sty); + // TODO ʽ + } else { + if (r == null) { + r = sheet.createRow(i + startRow); + System.out.println("ûд"); + } + cell = r.getCell(cols); + if (cols == 11) { + + cell.setCellStyle(sty); + } + } + if (cell == null) { + cell = r.createCell(cols); + // cell.setCellStyle(sty); + } + + cell.setCellType(XSSFCell.CELL_TYPE_STRING);// ıʽ + + // XSSFCellStyle + // sty0=sheet.getRow(9).getCell(11).getCellStyle(); + if (i < rowCount) { + + int rwsTemp = list.get(i).getTechCode().length() / 5 + 1; + int rwsTemp1 = list.get(i).getSpecCode().length() / 5 + 1; + int rwsTemp2 = list.get(i).getDrawID().length() / 5 + 1; + int rwsTemp3 = list.get(i).getMaterialName().length() / 5 + 1; + int rwsTemp4 = list.get(i).getGlobal_list().length() / 5 + 1; + int rwsTemp5 = list.get(i).getLocal_list().length() / 5 + 1; + int temp; + + int a[] = new int[] { rwsTemp, rwsTemp1, rwsTemp2, rwsTemp3, rwsTemp4, rwsTemp5 }; + Arrays.sort(a); + for (int i1 = 0; i1 < a.length; i1++) { +// System.out.println(a[i1]); + } + temp = a[5]; + + r.setHeight((short) (temp * 260)); + cell.getCellStyle().setWrapText(true); + } + if (i < rowCount) { + + switch (cols) { + case 1:// + if (list.get(i) == null) { + this.wait.setBool(true); + this.wait.interrupt(); + MessageBox.post("BOM嵥Ϊ", "", + MessageBox.INFORMATION); + return; + } else { + + if (i > 0) { + + cell.setCellStyle(sty2); + } + cell.setCellValue(list.get(i).getNumber()); + break; + } + + case 2:// ϱ + // if(i>2) { + // sty0=sheet.getRow(9).getCell(cols).getCellStyle(); + // cell.setCellStyle(sty0); + // } + if (i >= 2) { + + cell.setCellStyle(style); + } + cell.setCellValue(list.get(i).getMaterialCode());// д + break; + case 4:// + // cell.setCellStyle(sty0); + cell.setCellValue(list.get(i).getMaterialName()); + break; + case 6:// ͺ + // cell.setCellStyle(sty); + + cell.setCellValue(list.get(i).getTechCode()); + break; + case 8:// ͺ + // cell.setCellStyle(sty0); + + cell.setCellValue(list.get(i).getSpecCode()); + // cell.setCellStyle(styG); + break; + case 10:// + // cell.setCellStyle(sty0); + cell.setCellValue(list.get(i).getQuantity()); + break; + case 11:// λ + // cell.setCellStyle(sty0); + cell.setCellValue(list.get(i).getUnit()); + break; + case 12:// ͼ + // cell.setCellStyle(sty0); + + cell.setCellValue(list.get(i).getDrawID()); + + break; + case 13:// ע + cell.setCellValue(list.get(i).getGlobal_list()); + break; + case 14:// ע + cell.setCellValue(list.get(i).getLocal_list()); + break; + case 15:// ע + + if (i > 0) { + + cell.setCellStyle(sty3); + } + break; + } + } + } + + } + + // ϲԪ + for ( + + int i = 0; i < rowCount + 3; i++) { + // if (i < rowCount+3) { + // + // CellRangeAddress cra = new CellRangeAddress(i + startRow, i + + // startRow, 8,9); + // sheet.addMergedRegion(cra); + // cra = new CellRangeAddress(i + startRow, i + startRow, 6, 7); + // sheet.addMergedRegion(cra); + // cra = new CellRangeAddress(i + startRow, i + startRow, 4, 5); + // sheet.addMergedRegion(cra); + // cra = new CellRangeAddress(i + startRow, i + startRow, 2, 3); + // sheet.addMergedRegion(cra); + // } + } + // õеĵ±߿ + XSSFCell cell5 = null; + for (int cols = 1; cols < colsCount; cols++) { + cell5 = sheet.getRow(startRow + rowCount + 2).getCell(cols); + switch (cols) { + + case 1:// + + cell5.setCellStyle(sty4); + break; + case 2:// + + cell5.setCellStyle(sty4); + break; + case 3:// + + cell5.setCellStyle(sty4); + break; + case 4:// + + cell5.setCellStyle(sty4); + break; + case 5:// + + cell5.setCellStyle(sty4); + break; + case 6:// + + cell5.setCellStyle(sty4); + break; + case 7:// + + cell5.setCellStyle(sty4); + break; + case 8:// + + cell5.setCellStyle(sty4); + break; + case 9:// + + cell5.setCellStyle(sty4); + break; + case 10:// + + cell5.setCellStyle(sty4); + break; + case 11:// + + cell5.setCellStyle(sty4); + break; + case 12:// + + cell5.setCellStyle(sty4); + break; + case 13:// ע + + cell5.setCellStyle(sty4); + break; + case 14:// ע + + cell5.setCellStyle(sty4); + break; + case 15:// ע + + cell5.setCellStyle(sty4); + break; + } + } + // һеĵ±߿ + XSSFCell cellLast = null; + for (int cols = 1; cols < colsCount; cols++) { + cellLast = sheet.getRow(startRow + rowCount + 6).getCell(cols); + switch (cols) { + case 1:// + cellLast.setCellValue("/"); + cellLast.setCellStyle(sty4); + break; + case 2:// + + cellLast.setCellStyle(sty4); + break; + case 3:// + cellLast.setCellValue("/"); + cellLast.setCellStyle(sty4); + break; + case 4:// + + cellLast.setCellStyle(sty4); + break; + case 5:// + cellLast.setCellStyle(sty4); + break; + case 6:// + cellLast.setCellValue("׼/"); + + cellLast.setCellStyle(sty4); + break; + case 7:// + cellLast.setCellStyle(sty4); + break; + case 8:// + + cellLast.setCellStyle(sty4); + break; + case 9:// + cellLast.setCellValue("ĵ"); + cellLast.setCellStyle(sty4); + break; + case 10:// + cellLast.setCellStyle(sty4); + break; + case 11:// + cellLast.setCellValue(""); + cellLast.setCellStyle(sty4); + break; + case 12:// + cellLast.setCellValue(""); + + cellLast.setCellStyle(sty4); + break; + case 13:// ע + + cellLast.setCellValue("/"); + cellLast.setCellStyle(sty4); + break; + case 14:// ע + + cellLast.setCellStyle(sty4); + break; + case 15:// ע + + cellLast.setCellStyle(sty4); + break; + } + } + // ϲǩĵԪ + //(BC12,DEF35,GHI68,JK910,L11,M12,NOP1315 ) + CellRangeAddress cra = new CellRangeAddress(rowCount + startRow + 3, + rowCount + startRow + 5, 1, 2); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + + 5, 3, 5); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + + 5, 6, 8); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + + 5, 9, 10); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + + 5, 11, 11); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + + 5, 12, 12); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + + 5, 13, 15); + sheet.addMergedRegion(cra); + // ϲһ + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + + 6, 1, 2); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + + 6, 3, 5); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + + 6, 6, 8); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + + 6, 9, 10); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + + 6, 11, 11); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + + 6, 12, 12); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + + 6, 13, 15); + sheet.addMergedRegion(cra); + + XSSFCell cell6 = null; + cell6 = sheet.getRow(5).getCell(11); + cell6.getCellStyle().setBorderBottom((short) 2); + XSSFCell cell0 = sheet.getRow(startRow + rowCount + 2).getCell(1); + cell0.setCellStyle(sty6); + + cell0 = sheet.getRow(startRow + rowCount + 2).getCell(15); + cell0.setCellStyle(sty7); + + XSSFCell cell1 = sheet.getRow(startRow + rowCount + 4).getCell(1); + cell1.setCellStyle(sty6); + cell1 = sheet.getRow(startRow + rowCount + 4).getCell(15); + cell1.setCellStyle(sty7); + + cell1 = sheet.getRow(startRow + rowCount).getCell(1); + cell1.setCellStyle(sty8); + cell1 = sheet.getRow(startRow + rowCount + 1).getCell(1); + cell1.setCellStyle(sty8); + cell1 = sheet.getRow(startRow + rowCount + 3).getCell(1); + cell1.setCellStyle(sty8); + cell1 = sheet.getRow(startRow + rowCount + 5).getCell(1); + cell1.setCellStyle(sty8); + cell1 = sheet.getRow(startRow + rowCount + 6).getCell(1); + cell1.setCellStyle(sty6); + + cell1 = sheet.getRow(startRow + rowCount).getCell(15); + cell1.setCellStyle(sty9); + cell1 = sheet.getRow(startRow + rowCount + 1).getCell(15); + cell1.setCellStyle(sty9); + cell1 = sheet.getRow(startRow + rowCount + 3).getCell(15); + cell1.setCellStyle(sty9); + cell1 = sheet.getRow(startRow + rowCount + 5).getCell(15); + cell1.setCellStyle(sty9); + cell1 = sheet.getRow(startRow + rowCount + 6).getCell(15); + cell1.setCellStyle(sty7); + + XSSFCell cell2 = sheet.getRow(startRow + rowCount + 3).getCell(1); + cell2.setCellValue(name1); + XSSFFont font3 = workbook.createFont(); + font3.setFontName(""); + font3.setFontHeightInPoints((short) 10);// С + + cell2 = sheet.getRow(startRow + rowCount + 3).getCell(3); + + cell2.setCellValue(name2); + cell2 = sheet.getRow(startRow + rowCount + 3).getCell(6); + cell2.setCellValue(name3); + cell2 = sheet.getRow(startRow + rowCount + 3).getCell(1); + cell2.getCellStyle().setAlignment((short) 1); + cell2.getCellStyle().setVerticalAlignment((short) 1); + cell2.getCellStyle().setWrapText(true); + cell2.getCellStyle().setFont(font3); + System.out.println("ʽ------------>" + + sheet.getRow(12).getCell(4).getCellStyle().getAlignment()); + + cellLast = sheet.getRow(startRow + rowCount + 6).getCell(1); + cellLast.getCellStyle().setVerticalAlignment( + XSSFCellStyle.VERTICAL_CENTER); + // 2017.11.21 Ȱصû·£ȻתΪpdf + // ѡ񵼳pdf + File fileout; + String usrHome = System.getProperty("user.home"); + // System.out.println("usrHome=" + usrHome); + String excelPath = path + "\\" + type + ".xlsx"; + if (selectExportFileType.equals("Excel")) { + excelPath = judge2(excelPath); + + fileout = new File(excelPath); + } else { + fileout = new File(usrHome + "\\" + type + ".xlsx"); + } + + // File fileout = new File(path + "\\" + type + ".xlsx"); + // File fileout = new File(usrHome + "\\" + type + ".xlsx"); + try { + out = new FileOutputStream(fileout); + } catch (Exception e) { + this.wait.setBool(true); + this.wait.interrupt(); + e.printStackTrace(); + MessageBox.post("ļ!\nļǷ:ܰ/,\\,,*,?,\",<,>,|", + "ļǷ", MessageBox.INFORMATION); + // String str = "/,\\,,*,?,\",<,>,|"; + return; + // e.printStackTrace(); + } + workbook.write(out); + // תpdf + String inFilePath = path + "\\" + type + ".xlsx"; + // String inFilePath = usrHome + "\\" + type + ".xlsx"; + String outFilePath = path + "\\" + type + ".pdf"; + if (!selectExportFileType.equals("Excel")) { + // תpdf + System.out.println("------תpdf"); + inFilePath = usrHome + "\\" + type + ".xlsx"; + outFilePath = judge(outFilePath); + xlsToPdf(inFilePath, outFilePath); + deletePdf(inFilePath); + long end = System.currentTimeMillis(); + float time2 = (end - start) / 1000.00f; + System.out.println("ʱ" + time2 + ""); + this.wait.setBool(true); + this.wait.interrupt(); + if (rename2 == false) { + MessageBox.post("Ѿ", "ɹ", MessageBox.INFORMATION); + } else { + MessageBox.post( + "ѾԭļѴڣļΪ:\n" + + outFilePath.substring( + outFilePath.lastIndexOf("\\") + 1, + outFilePath.length()), "ɹ", + MessageBox.INFORMATION); + + } + Runtime.getRuntime().exec( + new String[] { "cmd.exe", "/c", outFilePath });// + } else { + long end = System.currentTimeMillis(); + float time2 = (end - start) / 1000.00f; + System.out.println("ʱ" + time2 + ""); + this.wait.setBool(true); + this.wait.interrupt(); + if (rename2 == false) { + MessageBox.post("Ѿ", "ɹ", MessageBox.INFORMATION); + } else { + MessageBox.post( + "ѾԭļѴڣļΪ:\n" + + excelPath.substring( + excelPath.lastIndexOf("\\") + 1, + excelPath.length()), "ɹ", + MessageBox.INFORMATION); + + } + Runtime.getRuntime().exec( + new String[] { "cmd.exe", "/c", excelPath });// + } + } + + // жͬpdfǷѾ + boolean rename = false; + boolean rename2 = false; + + private String judge(String outFilePath) { + rename = false; + File pdfFile = new File(outFilePath); + if (pdfFile.exists()) { + String name = outFilePath.split("\\.pdf")[0]; + outFilePath = name + "(1).pdf"; + rename = true; + rename2 = true; + } + if (rename == true) { + outFilePath = judge(outFilePath); + } + return outFilePath; + + } + + private String judge2(String outFilePath) { + rename = false; + File pdfFile = new File(outFilePath); + if (pdfFile.exists()) { + String name = outFilePath.split("\\.xlsx")[0]; + outFilePath = name + "(1).xlsx"; + rename = true; + rename2 = true; + } + if (rename == true) { + outFilePath = judge2(outFilePath); + } + + return outFilePath; + + } + + // EXCELתPDF + public String xlsToPdf(String inFilePath, String outFilePath) { + ComThread.InitSTA(true); + // deletePdf(outFilePath); + ActiveXComponent ax = new ActiveXComponent("Excel.Application"); + try { + ax.setProperty("Visible", new Variant(false)); + ax.setProperty("AutomationSecurity", new Variant(3)); // ú + Dispatch excels = ax.getProperty("Workbooks").toDispatch(); + + Dispatch excel = Dispatch.invoke( + excels, + "Open", + Dispatch.Method, + new Object[] { inFilePath, new Variant(false), + new Variant(false) }, new int[9]).toDispatch(); + // תʽ + Dispatch.invoke(excel, "ExportAsFixedFormat", Dispatch.Method, + new Object[] { new Variant(0), // PDFʽ=0 + outFilePath, new Variant(0) // 0=׼ (ɵPDFͼƬģ) + // 1=Сļ + // (ɵPDFͼƬһͿ) + }, new int[1]); + + // ʹSaveAs + /* + * Dispatch.invoke(excel,"SaveAs",Dispatch.Method,new Object[]{ + * outFile, new Variant(57), new Variant(false), new Variant(57), + * new Variant(57), new Variant(false), new Variant(true), new + * Variant(57), new Variant(true), new Variant(true), new + * Variant(true) },new int[1]); + */ + + // Dispatch.call(excel, "Close", false); + + if (ax != null) { + ax.invoke("Quit", new Variant[] {}); + ax = null; + } + ComThread.Release(); + return ""; + } catch (Exception es) { + return es.toString(); + } + } + + /** + * PDFɾPDF + * + * @param pdfPath + */ + private void deletePdf(String pdfPath) { + File pdfFile = new File(pdfPath); + if (pdfFile.exists()) { + pdfFile.delete(); + } + } + + private exportBOM_Bean bean; + private List list = new ArrayList<>(); + private TCComponentBOMLine child; + private String realNumber = ""; + private int num = 0;// ż + + private void getBomline(TCComponentBOMLine bomline, String realNumber_0) { + AIFComponentContext[] childline = null; + String materialCode = "";// ϱ + String materialName = "";// + String techCode = "";// ͺ + String specCode = "";// ͺ + String quantity = "";// + String unit = "";// λ + String drawID = "";// ͼ + String global_list="";//ȫ + String local_list="";//ֲ + int number_0 = 0; + try { + childline = bomline.getChildren(); + for (int i = 0; i < childline.length; i++) { + number_0++; + bean = new exportBOM_Bean(); + if (!bomline.getTCProperty("bl_formatted_parent_name") + .getStringValue().equals("")) { + if (i > 0) { + realNumber_0 = realNumber_0.substring(0, + realNumber_0.lastIndexOf(".") + 1) + + number_0; + + } else { + realNumber_0 = realNumber_0 + "." + number_0; + + } + } else { + realNumber_0 = number_0 + ""; + + } + bean.setNumber(realNumber_0); + child = (TCComponentBOMLine) childline[i].getComponent(); + materialCode = child.getItemRevision().getTCProperty("item_id") + .getStringValue() + + "/" + + child.getItemRevision() + .getTCProperty("current_revision_id") + .getStringValue(); + bean.setMaterialCode(materialCode); + System.out.println(materialCode + "------------" + + realNumber_0); + materialName = child.getItemRevision() + .getTCProperty("object_name").getStringValue(); + bean.setMaterialName(materialName); + TCComponentForm form = (TCComponentForm) child + .getItemRevision().getReferenceListProperty( + "IMAN_master_form_rev")[0]; + techCode = form.getTCProperty("jk8TechModel").getStringValue(); + bean.setTechCode(techCode); + specCode = form.getTCProperty("jk8SpecModel").getStringValue(); + bean.setSpecCode(specCode); + quantity = child.getTCProperty("bl_quantity").getStringValue(); + bean.setQuantity(quantity); + unit = child.getProperty("bl_uom"); + bean.setUnit(unit); + + TCComponent[] components = child.getItemRevision() + .getReferenceListProperty("TC_Is_Represented_By"); + for (int j = 0; j < components.length; j++) { + try { + drawID = drawID + + components[j].getTCProperty("item_id").getStringValue() + + ";"; + } catch (Exception e) { + // TODO: handle exception + System.out.println("쳣:"+e.getMessage()); + } + + + } + drawID = drawID.trim(); + bean.setDrawID(drawID); + //2018.3.21ȫֺ;ֲ + TCComponent[] substituteComponents=child.getItem().getTCProperty("global_alt_list").getReferenceValueArray();//TODO + if(substituteComponents.length==0) { + global_list=""; + }else if(substituteComponents.length>0) { + global_list=""; + for (int j = 0; j < substituteComponents.length; j++) { + String id=""; + try { + id=((TCComponentItem)substituteComponents[j]).getTCProperty("item_id").getStringValue(); + } catch (Exception e) { + // TODO Auto-generated catch block + id=((TCComponentBOMView)substituteComponents[j]).getTCProperty("object_name").getStringValue().split("-")[0]; + e.printStackTrace(); + } + global_list=global_list+id+","; + } + } + if(global_list.length()>=1) { + + global_list=global_list.trim(); + global_list=global_list.substring(0, global_list.length()-1); + } + + bean.setGlobal_list(global_list); + + substituteComponents=child.getTCProperty("bl_substitute_list").getReferenceValueArray(); + if(substituteComponents.length==0) { + local_list=""; + }else if(substituteComponents.length>0) { + local_list=""; + for (int j = 0; j < substituteComponents.length; j++) { + String id=""; + try { + id=((TCComponentItem)substituteComponents[j]).getTCProperty("item_id").getStringValue(); + } catch (Exception e) { + // TODO Auto-generated catch block + //id=((TCComponentBOMView)substituteComponents[j]).getTCProperty("object_name").getStringValue().split("-")[0]; + System.out.println("תֲ,Ͳ,:"+e.getMessage()); + //e.printStackTrace(); + } + local_list=local_list+id+","; + } + } + if(local_list.length()>=1) { + + local_list=local_list.trim(); + local_list=local_list.substring(0, local_list.length()-1); + } + + bean.setLocal_list(local_list); + + + + + list.add(bean); + if(isSingle == 0) { + if (child.getChildren().length > 0) { + getBomline(child, realNumber_0); + } + } + + } + } catch (TCException e) { + e.printStackTrace(); + } + + } + + private File getExcel(String ssx) { + File file = null; + preferenceService = session.getPreferenceService(); + String puid = preferenceService.getStringValue(ssx); + if (puid == null) { + MessageBox.post("ϵԱѡ", "", MessageBox.ERROR); + return null; + } + TCComponentDataset dataset = null; + try { + dataset = (TCComponentDataset) session.stringToComponent(puid); + } catch (TCException e) { + e.printStackTrace(); + } + if (dataset == null) { + MessageBox.post("ݼڣϵԱѡ", "", MessageBox.ERROR); + return null; + } + try { + TCComponentTcFile[] files = dataset.getTcFiles(); + if (files.length == 0) { + MessageBox.post("ݼûõļ,", "", MessageBox.ERROR); + return null; + } else if (files.length > 1) { + MessageBox.post("ݼõļ", "", MessageBox.ERROR); + return null; + } else { + file = files[0].getFmsFile(); + } + } catch (TCException e) { + e.printStackTrace(); + } + + return file; + } + private void listBOM(TCComponentBOMLine bomlineObj) { + com.teamcenter.services.rac.cad._2007_01.StructureManagement structureService = com.teamcenter.services.rac.cad.StructureManagementService.getService(session); + com.teamcenter.services.rac.cad._2007_01.StructureManagement.ExpandPSAllLevelsInfo levelInfo = new com.teamcenter.services.rac.cad._2007_01.StructureManagement.ExpandPSAllLevelsInfo(); + com.teamcenter.services.rac.cad._2007_01.StructureManagement.ExpandPSAllLevelsPref levelPref = new com.teamcenter.services.rac.cad._2007_01.StructureManagement.ExpandPSAllLevelsPref(); + levelInfo.parentBomLines = new TCComponentBOMLine[] {bomlineObj}; //붥BOMLine + levelInfo.excludeFilter="None"; + levelPref.expItemRev = false; + levelPref.info = new com.teamcenter.services.rac.cad._2007_01.StructureManagement.RelationAndTypesFilter[0]; + //ʹ·չBOM + com.teamcenter.services.rac.cad._2007_01.StructureManagement.ExpandPSAllLevelsResponse levelResp = structureService.expandPSAllLevels(levelInfo, levelPref); + if (levelResp.output.length <= 0) { + return; + } + /* + * levelRespеOutputеBOMLine + * StructureManagement.ExpandPSData[] children List of ExpandPSData children found for this parent. + StructureManagement.ExpandPSParentData parent ExpandPSParentData member + */ + + List bomlineList = new ArrayList(levelResp.output.length); + List itemRevList = new ArrayList(levelResp.output.length); + for(int i=0;i list = new ArrayList<>(); + private exportHardwareBOM_Bean bean; + private TCComponentBOMLine child; + private String jbName = "";// + private String SBH = "";// ʶ + private String selectExportFileType; + private List list_bom_rev; + private int isSingle = -1; + private int model_choose = -1; + + public exportHardwareBOM_Operation(String text, String path, ProgressBarThread wait, TCSession session, + TCComponentBOMLine comp,String selectExportFileType, int isSingle,int modelchoose) { + this.text = text; + this.path = path; + this.wait = wait; + this.session = session; + this.comp = comp; + this.selectExportFileType=selectExportFileType; + this.isSingle = isSingle; + model_choose = modelchoose; + } + + Integer[] keys = null; + String[] vals = null; + private String realNumber = ""; + @Override + public void executeOperation() throws Exception { + + //ץȡfnd0ActuatedInteractiveTsks fnd0Performer fnd0EndDate fnd0AliasTaskName + String name1="";// + String name2="";// + String name3="";//׼ + TCComponent[] component=comp.getItemRevision().getTCProperty("fnd0ActuatedInteractiveTsks").getReferenceValueArray(); +// System.out.println(component.length); + for (int i = 0; i < component.length; i++) { + // + if(component[i].getTCProperty("fnd0AliasTaskName").getStringValue().contains("")) { + name1=component[i].getTCProperty("fnd0Performer").getDisplayValue().split("\\(")[0]; + name1=name1+"/"+component[i].getTCProperty("fnd0EndDate").getDisplayValue(); + }else if(component[i].getTCProperty("fnd0AliasTaskName").getStringValue().contains("")) { + name2=component[i].getTCProperty("fnd0Performer").getDisplayValue().split("\\(")[0]; + name2=name2+"/"+component[i].getTCProperty("fnd0EndDate").getDisplayValue(); + }else if(component[i].getTCProperty("fnd0AliasTaskName").getStringValue().contains("׼")) { + name3=component[i].getTCProperty("fnd0Performer").getDisplayValue().split("\\(")[0]; + name3=name3+"/"+component[i].getTCProperty("fnd0EndDate").getDisplayValue(); + } + } + +// if(true) { +// return; +// } + long start = System.currentTimeMillis(); + int colsCount = 17;//2017.10.18һ 2017.10.26һcomment2018.3.19һ + // ȡ + TCComponentItemRevision itemRevision = comp.getItemRevision(); + String ck=itemRevision.getProperty("item_id")+"/"+itemRevision.getProperty("item_revision_id"); + TCComponentICO[] icoS = itemRevision.getClassificationObjects(); + + int count = 0; + int count1 = 0; + System.out.println("з--------------"+icoS.length); + for (int i = 0; i < icoS.length; i++) { + String revId=icoS[i].getProperty("id"); + ICSProperty[] cPropS = icoS[i].getICSProperties(true); + + System.out.println("з--------"+ cPropS.length); + for (int j = 0; j < cPropS.length; j++) { +// System.out.println(count); + count++; + } + keys = new Integer[count]; + vals = new String[count]; + for (int j = 0; j < cPropS.length; j++) { +// System.out.println(count); + keys[count1] = cPropS[j].getId(); + System.out.println("keys[" + count1 + "]================>" + keys[count1]); + vals[count1] = cPropS[j].getValue(); + System.out.println("vals[" + count1 + "]================>" + vals[count1]); + if (keys[count1] == 50205015) {//keys[count1] == -500293 2021/1/5Ǩƺid + if(revId.equals(ck)) { + + jbName = vals[count1]; + } + + } else if (keys[count1] ==1050 ) { // keys[count1] == -500301 2021/1/5Ǩƺid + if(revId.equals(ck)) { + + SBH = vals[count1]; + } + + } + count1++; + } + + } +// String sxx = "jk_bom2_uid";// G8TlM0X6YvbLjA G8TlM0X6YvbLjA TJXl8kmSYvbLjA +// String sxx_new = "jk_bom2_uid_new"; + String sxx = "";// G8TlM0X6YvbLjA + String sxx_new = "";// G8TlM0X6YvbLjA + if(model_choose == 1) { + sxx = "jk_bom2_uid";// G8TlM0X6YvbLjA + sxx_new = "jk_bom2_uid_new"; + + }else if(model_choose ==0) { + + sxx = "tx_bom2_uid"; + sxx_new = "tx_bom2_uid_new"; + } + File file = getExcel(sxx,sxx_new); + if (file == null) { + return; + } + long time01 = System.nanoTime(); + getBomline(comp,realNumber);//ȡ + long time02 = System.nanoTime(); + System.out.println("===============ȡbomʱ(ms) " + ((time02 - time01) / 1000000L)+"==============="); +// MessageBox.post("ȡbomʱ(ms) " + ((time02 - time01) / 1000000L),"",MessageBox.INFORMATION); + System.out.println("BOM" + list.size() + ""); + int rowCount = list.size(); + fis = new FileInputStream(file); + workbook = new XSSFWorkbook(fis); + //һе + XSSFFont font2 = workbook.createFont(); + font2.setFontName(""); + font2.setFontHeightInPoints((short) 11);// С + //ƣλŵȵʽ + XSSFFont font4 = workbook.createFont(); + font4.setFontName(""); + font4.setFontHeightInPoints((short) 10);// С + //Bŵ + XSSFFont font = workbook.createFont(); + font.setFontName("΢ź"); + font.setFontHeightInPoints((short) 9);// С + + XSSFSheet sheet = workbook.getSheet("Ӳ嵥"); + XSSFRow row = sheet.getRow(1); + XSSFCell cell_0 = row.getCell(3); + cell_0.setCellValue(comp.getItemRevision().getTCProperty("item_id").getStringValue()); + cell_0 = row.getCell(12); + cell_0.setCellValue(comp.getItemRevision().getTCProperty("item_revision_id").getStringValue()); + row = sheet.getRow(2); + cell_0 = row.getCell(3); + System.out.println("------------"+jbName); + cell_0.setCellValue(jbName); + cell_0 = row.getCell(12); + cell_0.setCellValue(SBH); + row = sheet.getRow(4); + cell_0 = row.getCell(3); + Date date=new Date(); + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); + String time= sdf.format(date); + time=time.replace("-", "."); + cell_0.setCellValue(time);//Ч + int startRow = 6; + + XSSFCellStyle sty = workbook.createCellStyle();// ½Ԫĸʽ + XSSFCellStyle style = workbook.createCellStyle();// Cϱ뵥Ԫĸʽ + XSSFCellStyle sty2 = workbook.createCellStyle();//BеԪʽ + sty2.setBorderBottom((short) 1); + sty2.setBorderLeft((short) 2); + sty2.setBorderRight((short) 1); + sty2.setBorderTop((short) 1); + sty2.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER); + sty2.setFont(font); + //P7ĸʽ + XSSFCellStyle styP7 = workbook.createCellStyle();//BеԪʽ + styP7.setBorderBottom((short) 1); + styP7.setBorderLeft((short) 1); + styP7.setBorderRight((short) 1); + styP7.setBorderTop((short) 2); + styP7.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER); + styP7.setFont(font); + + XSSFCellStyle sty3 = workbook.createCellStyle();// QбעԪĸʽ + XSSFCellStyle sty4 = workbook.createCellStyle();// кһеĸʽ + XSSFCellStyle sty5 = workbook.createCellStyle();// һעĸʽ + sty5.setBorderTop((short) 2); + sty5.setBorderRight((short) 2); + XSSFCellStyle sty6 = workbook.createCellStyle();// ˵Ԫĸʽ + XSSFCellStyle sty7 = workbook.createCellStyle();// /ڵԪĸʽ + + sty6.setBorderTop((short) 1); + sty6.setBorderBottom((short) 2); + sty6.setBorderLeft((short) 2); + sty6.setBorderRight((short) 1); + + sty7.setBorderLeft((short) 1); + sty7.setBorderBottom((short) 2); + sty7.setBorderRight((short) 2); + sty7.setBorderTop((short) 1); + + sty.setBorderBottom((short) 1); + sty.setBorderLeft((short) 1); + sty.setBorderRight((short) 1); + sty.setBorderTop((short) 1); + sty.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER);// ֱ + sty.setAlignment(XSSFCellStyle.ALIGN_LEFT);// ˮƽ + + style.setBorderBottom(CellStyle.BORDER_THIN); + style.setBorderTop((short) 1); + style.setAlignment(XSSFCellStyle.ALIGN_CENTER); // + style.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER); // + style.setFont(font); + + sty3.setBorderBottom((short) 1); + sty3.setBorderLeft((short) 1); + sty3.setBorderRight((short) 2); + sty3.setBorderTop((short) 1); + sty4.setBorderTop((short)1); + sty4.setBorderBottom((short)2); + sty4.setBorderLeft((short)1); + sty4.setBorderRight((short)1); + + sty4.setFont(font2); + sty4.setAlignment(XSSFCellStyle.ALIGN_CENTER); + for (int i = 0; i < rowCount + 7; i++) { + XSSFRow r = null; + boolean isCreate = false; +// System.out.println("sheet.getLastRowNum()-------->" + sheet.getLastRowNum()); + if ((i + startRow) > sheet.getLastRowNum()) { + r = sheet.createRow(i + startRow); + isCreate = true; + } else { + r = sheet.getRow(i + startRow); + isCreate = false; + } + if (i < rowCount + 3 && isCreate) { + + CellRangeAddress cra = new CellRangeAddress(i + startRow, i + startRow, 8, 9); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(i + startRow, i + startRow, 6, 7); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(i + startRow, i + startRow, 4, 5); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(i + startRow, i + startRow, 2, 3); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(i + startRow, i + startRow, 12,13);//2017.10.26 + sheet.addMergedRegion(cra); + } + + for (int cols = 1; cols < colsCount; cols++) { + XSSFCell cell = null; + if (isCreate) { + cell = r.createCell(cols); + + cell.setCellStyle(sty); + if (cols == 1) { + cell.setCellStyle(sty2); + } else if (cols == 16) { + cell.setCellStyle(sty3); + } + // TODO ʽ + } else { +// if (r == null) { +// r = sheet.createRow(i + startRow); +// System.out.println("ûд"); +// } + cell = r.getCell(cols); + } + if (cell == null) { + // cell = r.createCell(cols); + // cell.setCellStyle(sty); + } + + cell.setCellType(XSSFCell.CELL_TYPE_STRING);// ıʽ + + // XSSFCellStyle sty0=sheet.getRow(9).getCell(11).getCellStyle(); + //и + if (i < rowCount) { + int rwsTemp = list.get(i).getSpecCode().length()/2+1; //ͺ + int rwsTemp1 = list.get(i).getRef_designator().length()/3+1;//λ + int rwsTemp2 = list.get(i).getPackaging().length()/2+1; //װ + int rwsTemp3 = list.get(i).getGlobal_bl_substitute_list().length()/3+1; // + int rwsTemp4 = list.get(i).getLocal_bl_substitute_list().length()/3+1; // + int rwsTemp5 = list.get(i).getComment().length()/3+1; //comment + int rwsTemp6= list.get(i).getMaterialName().length()/2+1; // + + int temp; + + int a[]=new int[]{rwsTemp,rwsTemp1,rwsTemp2,rwsTemp3,rwsTemp4,rwsTemp5,rwsTemp6}; + Arrays.sort(a); + for(int i1=0;i1"+a[i1]); + } + temp=a[6]; + + cell.getCellStyle().setWrapText(true); +// r.setHeight((short)(temp * 110-(temp-1)*20)); + r.setHeight((short)(temp * 100)); + } + if (i < rowCount) { + + switch (cols) { + case 1:// + if (list.get(i) == null) { + this.wait.setBool(true); + this.wait.interrupt(); + MessageBox.post("BOM嵥Ϊ", "", MessageBox.INFORMATION); + return; + } else { + + if (i > 0) { + cell.setCellStyle(sty2); + + } + cell.setCellValue(list.get(i).getNumber()); + System.out.println(list.get(i).getNumber()); + break; + } + + case 2:// ϱ + // if(i>2) { + // sty0=sheet.getRow(9).getCell(cols).getCellStyle(); + // cell.setCellStyle(sty0); + // } + if (i >= 2) { + cell.setCellStyle(style); + + } + + cell.setCellValue(list.get(i).getMaterialCode());// д + break; + case 4:// + cell.getCellStyle().setFont(font4); + cell.getCellStyle().setAlignment(CellStyle.ALIGN_LEFT); + cell.setCellValue(list.get(i).getMaterialName()); + break; + case 6:// ͺ + cell.getCellStyle().setFont(font4); + cell.setCellValue(list.get(i).getRef_designator()); +// System.out.println("λ-------------"+list.get(i).getRef_designator()); + break; + case 8:// ͺ + cell.getCellStyle().setFont(font4); + cell.setCellValue(list.get(i).getSpecCode()); + + // cell.setCellStyle(styG); + break; + + //2017.10.26 Comment + case 10:// Comment + cell.getCellStyle().setFont(font4); + cell.setCellType(Cell.CELL_TYPE_STRING); + cell.setCellValue(list.get(i).getComment()); + break; + case 11:// + cell.getCellStyle().setFont(font4); + cell.setCellType(Cell.CELL_TYPE_STRING); + cell.setCellValue(list.get(i).getQuantity()); +// System.out.println("--------------->"+list.get(i).getQuantity()); + break; + case 12:// װ + cell.getCellStyle().setFont(font4); + cell.getCellStyle().setAlignment(CellStyle.ALIGN_LEFT); + cell.setCellValue(list.get(i).getPackaging()); + break; + case 14:// ȫ + cell.setCellValue(list.get(i).getGlobal_bl_substitute_list()); + break; + case 15:// ֲ + cell.setCellValue(list.get(i).getLocal_bl_substitute_list()); + break; + case 16:// ע + cell.setCellStyle(sty3); + break; + } + } + } + } + XSSFCell cell14=sheet.getRow(6).getCell(16); + cell14.setCellStyle(sty5); + + + // һеĵ±߿ + XSSFCell cellLast = null; + for (int cols = 1; cols < colsCount; cols++) { + cellLast = sheet.getRow(startRow + rowCount + 6).getCell(cols); + switch (cols) { + case 1:// + cellLast.setCellValue("/"); + cellLast.setCellStyle(sty2); + break; + case 2:// + + cellLast.setCellStyle(sty4); + break; + case 3:// + cellLast.setCellValue("/"); + cellLast.setCellStyle(sty4); + break; + case 4:// + + cellLast.setCellStyle(sty4); + break; + case 5:// + cellLast.setCellValue("׼/"); + cellLast.setCellStyle(sty4); + break; + case 6:// + + cellLast.setCellStyle(sty4); + break; + case 7:// + cellLast.setCellValue("ĵ"); + cellLast.setCellStyle(sty4); + break; + case 8:// + + cellLast.setCellStyle(sty4); + break; + case 9:// + cellLast.setCellValue(""); + cellLast.setCellStyle(sty4); + break; + case 10:// + cellLast.setCellStyle(sty4); + break; + case 11:// + cellLast.setCellValue(""); + cellLast.setCellStyle(sty4); + break; + case 12:// + cellLast.setCellValue("/"); + + cellLast.setCellStyle(sty4); + break; + case 13:// + + cellLast.setCellStyle(sty4); + break; + case 14:// + + cellLast.setCellStyle(sty4); + break; + case 15:// + + cellLast.setCellStyle(sty4); + break; + case 16:// ע + + cellLast.setCellStyle(sty3); + break; + } + } + // һеԪɫ߿ + for (int i = startRow + rowCount+6; i < startRow + rowCount + 7; i++) { + XSSFCell cell = null; + for (int cols = 1; cols < colsCount; cols++) { + cell = sheet.getRow(i).getCell(cols); + switch (cols) { + case 1:// + + cell.setCellStyle(sty6); + break; + + case 16:// ע + + if (i > 0) { + + cell.setCellStyle(sty7); + } + break; + } + } + } + // ϲǩĵԪ + CellRangeAddress cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + 5, 1, 2); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + 5, 3, 4); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + 5, 5, 6); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + 5, 7, 8); + sheet.addMergedRegion(cra); + //2017.10.26 ϲ910 + cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + 5, 9, 10); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + 5, 11, 11); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + 5, 12, 16); + sheet.addMergedRegion(cra); + // ϲһ + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + 6, 1, 2); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + 6, 3, 4); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + 6, 5, 6); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + 6, 7, 8); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + 6, 9, 10); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + 6, 12, 16); + sheet.addMergedRegion(cra); + // õеĵ±߿ + XSSFCell cell5 = null; + for (int cols = 1; cols < colsCount; cols++) { + cell5 = sheet.getRow(startRow + rowCount + 2).getCell(cols); + switch (cols) { + + case 1:// + + cell5.setCellStyle(sty4); + break; + case 2:// + + cell5.setCellStyle(sty4); + break; + case 3:// + + cell5.setCellStyle(sty4); + break; + case 4:// + + cell5.setCellStyle(sty4); + break; + case 5:// + + cell5.setCellStyle(sty4); + break; + case 6:// + + cell5.setCellStyle(sty4); + break; + case 7:// + + cell5.setCellStyle(sty4); + break; + case 8:// + + cell5.setCellStyle(sty4); + break; + case 9:// + + cell5.setCellStyle(sty4); + break; + case 10:// + + cell5.setCellStyle(sty4); + break; + case 11:// + + cell5.setCellStyle(sty4); + break; + case 12:// + + cell5.setCellStyle(sty4); + break; + case 13:// + + cell5.setCellStyle(sty4); + break; + case 14:// ע + + cell5.setCellStyle(sty4); + break; + case 15:// ע + + cell5.setCellStyle(sty4); + break; + case 16:// ע + + cell5.setCellStyle(sty4); + break; + } + } + + XSSFCell cell0=sheet.getRow(startRow + rowCount + 2).getCell(1); + cell0.setCellStyle(sty6);//5еԪA + + cell0=sheet.getRow(startRow + rowCount + 2).getCell(16); + cell0.setCellStyle(sty7);//5еԪQ + + XSSFCell cell1=sheet.getRow(startRow + rowCount + 4).getCell(1); + cell1.setCellStyle(sty6); + cell1=sheet.getRow(startRow + rowCount + 4).getCell(16); + cell1.setCellStyle(sty7); + +// XSSFRow row1=sheet.getRow(startRow + rowCount + 3); +// row1.getCell(1).getCellStyle().getFont().setFontHeightInPoints((short) 10); +// row1.getCell(1).getCellStyle().getFont().setFontName("Tahoma"); + XSSFCell cell2=sheet.getRow(startRow + rowCount + 3).getCell(1);//4AԪĸʽ + cell2.getCellStyle().getFont().setFontHeightInPoints((short) 10); + cell2.getCellStyle().getFont().setFontName(""); + cell2.setCellValue(name1);// + cell2=sheet.getRow(startRow + rowCount + 3).getCell(3); + cell2.setCellValue(name2);// + cell2=sheet.getRow(startRow + rowCount + 3).getCell(5); + cell2.setCellValue(name3);//׼ + + + cell2 = sheet.getRow(startRow + rowCount + 3).getCell(1); + cell2.getCellStyle().setAlignment((short) 1); + cell2.getCellStyle().setVerticalAlignment((short) 1); + cell2.getCellStyle().setWrapText(true);//Զ +// cell2.getCellStyle().setFont(font3); + + + sheet.getRow(startRow + rowCount + 6).setHeight((short)402);//һеĸ߶ + cellLast = sheet.getRow(startRow + rowCount + 6).getCell(1); + cellLast.getCellStyle().setAlignment(CellStyle.ALIGN_LEFT); + cellLast.getCellStyle().setVerticalAlignment(CellStyle.VERTICAL_CENTER); + cellLast = sheet.getRow(startRow + rowCount + 6).getCell(3); + cellLast.getCellStyle().setAlignment(CellStyle.ALIGN_LEFT); + cellLast.getCellStyle().setVerticalAlignment(CellStyle.VERTICAL_CENTER); + + cellLast = sheet.getRow( 6).getCell(2); + cellLast.getCellStyle().setAlignment(CellStyle.ALIGN_CENTER); + cellLast = sheet.getRow( 7).getCell(2); + cellLast.getCellStyle().setAlignment(CellStyle.ALIGN_CENTER); + + sheet.getRow(6).getCell(15).setCellStyle(styP7); + + + // 2017.11.21 Ȱصû·£ȻתΪpdf + //ѡ񵼳pdf + File fileout; + String usrHome = System.getProperty("user.home"); +// System.out.println("usrHome=" + usrHome); + String excelPath=path + "\\" + text + ".xlsx"; + if(selectExportFileType.equals("Excel")) { + excelPath=judge2(excelPath); + + fileout = new File(excelPath); + }else { + fileout = new File(usrHome + "\\" + text + ".xlsx"); + } + +// File fileout = new File(path + "\\" + type + ".xlsx"); +// File fileout = new File(usrHome + "\\" + type + ".xlsx"); + try { + out = new FileOutputStream(fileout); + } catch (Exception e) { + this.wait.setBool(true); + this.wait.interrupt(); + MessageBox.post("ȹرͬļ", "", MessageBox.INFORMATION); + return; + // e.printStackTrace(); + } + workbook.write(out); + // תpdf + String inFilePath = path + "\\" + text + ".xlsx"; +// String inFilePath = usrHome + "\\" + type + ".xlsx"; + String outFilePath = path + "\\" + text + ".pdf"; + if(!selectExportFileType.equals("Excel")) { + //תpdf + System.out.println("------תpdf"); + inFilePath = usrHome + "\\" + text + ".xlsx"; + outFilePath=judge(outFilePath); + xlsToPdf(inFilePath, outFilePath); + deletePdf(inFilePath); + long end = System.currentTimeMillis(); + float time2 = (end - start) / 1000.00f; + System.out.println("ʱ" + time2 + ""); + this.wait.setBool(true); + this.wait.interrupt(); + if(rename2==false) { + MessageBox.post("Ѿ", "ɹ", MessageBox.INFORMATION); + }else { + MessageBox.post("ѾԭļѴڣļΪ:\n"+outFilePath.substring(outFilePath.lastIndexOf("\\")+1,outFilePath.length()), "ɹ", MessageBox.INFORMATION); + + } + Runtime.getRuntime().exec(new String[] { "cmd.exe", "/c", outFilePath });// + }else { + long end = System.currentTimeMillis(); + float time2 = (end - start) / 1000.00f; + System.out.println("ʱ" + time2 + ""); + this.wait.setBool(true); + this.wait.interrupt(); + if(rename2==false) { + MessageBox.post("Ѿ", "ɹ", MessageBox.INFORMATION); + }else { + MessageBox.post("ѾԭļѴڣļΪ:\n"+excelPath.substring(excelPath.lastIndexOf("\\")+1,excelPath.length()), "ɹ", MessageBox.INFORMATION); + + } + Runtime.getRuntime().exec(new String[] { "cmd.exe", "/c", excelPath });// + } + + + + // 2017.11.21 Ȱصû·£ȻתΪpdf +// String usrHome = System.getProperty("user.home"); +// System.out.println("usrHome=" + usrHome); + +// File fileout = new File(path + "\\" + text + ".xlsx"); +//// File fileout = new File(usrHome + "\\" + text + ".xlsx"); +// try { +// out = new FileOutputStream(fileout); +// } catch (Exception e) { +// this.wait.setBool(true); +// this.wait.interrupt(); +// MessageBox.post("ȹرͬļ","",MessageBox.INFORMATION); +// return; +// } +// workbook.write(out); +// // תpdf +// String inFilePath = path + "\\" + text + ".xlsx"; +//// String inFilePath = usrHome + "\\" + text + ".xlsx"; +// String outFilePath = path + "\\" + text + ".pdf"; +// // deletePdf(outFilePath);//ɾѾڵpdf,Ҫ޸ļ +// outFilePath=judge(outFilePath); +// System.out.println(System.getProperty("java.library.path")); +// xlsToPdf(inFilePath, outFilePath); +//// deletePdf(inFilePath); +// long end = System.currentTimeMillis(); +// float time2 = (end - start) / 1000.00f; +// System.out.println("ʱ" + time2 + ""); +//// System.out.println("汾----------------------->"+comp.getItemRevision().getTCProperty("item_revision_id").getStringValue()); +// this.wait.setBool(true); +// this.wait.interrupt(); +// if(rename2==false) { +// MessageBox.post("Ѿ", "ɹ", MessageBox.INFORMATION); +// }else { +// MessageBox.post("ѾԭļѴڣļΪ:\n"+outFilePath.substring(outFilePath.lastIndexOf("\\")+1,outFilePath.length()), "ɹ", MessageBox.INFORMATION); +// +// } +// Runtime.getRuntime().exec(new String[] { "cmd.exe", "/c", outFilePath });// +// System.out.println("2017.11.2"); + } + private String judge2(String outFilePath) { + rename=false; + File pdfFile = new File(outFilePath); + if (pdfFile.exists()) { + String name=outFilePath.split("\\.xlsx")[0]; + outFilePath = name + "(1).xlsx"; + rename=true; + rename2=true; + } + if(rename==true) { + outFilePath=judge2(outFilePath); + } + return outFilePath; + + } + //жͬpdfǷѾ + boolean rename=false; + boolean rename2=false; + private String judge(String outFilePath) { + rename=false; + + File pdfFile = new File(outFilePath); + if (pdfFile.exists()) { + String name=outFilePath.split("\\.pdf")[0]; + outFilePath = name + "(1).pdf"; + rename=true; + rename2=true; + } + if(rename==true) { + outFilePath=judge(outFilePath); + } + return outFilePath; + + } + // EXCELתPDF + public String xlsToPdf(String inFilePath, String outFilePath) { + ComThread.InitSTA(true); + + ActiveXComponent ax = new ActiveXComponent("Excel.Application"); + try { + ax.setProperty("Visible", new Variant(false)); + ax.setProperty("AutomationSecurity", new Variant(3)); // ú + Dispatch excels = ax.getProperty("Workbooks").toDispatch(); + + Dispatch excel = Dispatch + .invoke(excels, "Open", Dispatch.Method, + new Object[] { inFilePath, new Variant(false), new Variant(false) }, new int[9]) + .toDispatch(); + // תʽ + Dispatch.invoke(excel, "ExportAsFixedFormat", Dispatch.Method, new Object[] { new Variant(0), // PDFʽ=0 + outFilePath, new Variant(0) // 0=׼ (ɵPDFͼƬģ) 1=Сļ (ɵPDFͼƬһͿ) + }, new int[1]); + + // ʹSaveAs + /* + * Dispatch.invoke(excel,"SaveAs",Dispatch.Method,new Object[]{ outFile, new + * Variant(57), new Variant(false), new Variant(57), new Variant(57), new + * Variant(false), new Variant(true), new Variant(57), new Variant(true), new + * Variant(true), new Variant(true) },new int[1]); + */ + +// Dispatch.call(excel, "Close", false); + + if (ax != null) { + ax.invoke("Quit", new Variant[] {}); + ax = null; + } + ComThread.Release(); + return ""; + } catch (Exception es) { + return es.toString(); + } + } + + /** + * PDFɾPDF + * + * @param pdfPath + */ + private void deletePdf(String pdfPath) { + File pdfFile = new File(pdfPath); + if (pdfFile.exists()) { + pdfFile.delete(); + } + } + + private boolean isChecking(){ + + + try { + + TCComponentItemRevision itemRevision = comp.getItemRevision(); + TCComponent[] releses = itemRevision.getReferenceListProperty("release_status_list"); + if (releses!=null&&releses.length>0) { + TCComponent rel = releses[releses.length-1]; + String rel_name = rel.getProperty("object_name"); + System.out.println("״̬Ϊ:"+rel_name); + if (rel_name.equals("Checking")) { + return true; + } + } + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return false; + + + } + private void getAllChildren(TCComponentBOMLine bomline) throws TCException{ + + AIFComponentContext[] child = bomline.getChildren(); + for (int i = 0; i < child.length; i++) { + TCComponentBOMLine lin = (TCComponentBOMLine) child[i].getComponent(); + list_bom_rev.add(lin); + getAllChildren(lin); + } + } + + private File getExcel(String ssx,String ssx_new) { + + File file = null; + String puid; + preferenceService = session.getPreferenceService(); + if(isChecking()){ + puid = preferenceService.getStringValue(ssx_new); + }else{ + puid = preferenceService.getStringValue(ssx); + } + if (puid == null) { + MessageBox.post("ϵԱѡ", "", MessageBox.ERROR); + return null; + } + TCComponentDataset dataset = null; + try { + dataset = (TCComponentDataset) session.stringToComponent(puid); + } catch (TCException e) { + e.printStackTrace(); + } + if (dataset == null) { + MessageBox.post("ݼڣϵԱѡ", "", MessageBox.ERROR); + return null; + } + try { + TCComponentTcFile[] files = dataset.getTcFiles(); + if (files.length == 0) { + MessageBox.post("ݼûõļ,", "", MessageBox.ERROR); + return null; + } else if (files.length > 1) { + MessageBox.post("ݼõļ", "", MessageBox.ERROR); + return null; + } else { + file = files[0].getFmsFile(); + } + } catch (TCException e) { + e.printStackTrace(); + } + + return file; + } + + + private void getBomline(TCComponentBOMLine bomline, String realNumber_0) { + AIFComponentContext[] childline = null; + String materialCode = "";// ϱ + String materialName = "";// + String specCode = "";// ͺ + String quantity = "";// + String unit = "";// λ + String ref_designator = "";// λ + String packaging = "";// װ + String comment="";//comment + String bl_substitute_list="";//(ȫֺ;ֲ) + int number_0 = 0; + try { + childline = bomline.getChildren(); + for (int i = 0; i < childline.length; i++) { + + number_0++; + bean = new exportHardwareBOM_Bean(); + if (!bomline.getTCProperty("bl_formatted_parent_name").getStringValue().equals("")) { + if (i > 0) { + realNumber_0 = realNumber_0.substring(0, realNumber_0.lastIndexOf(".") + 1) + number_0; + + } else { + realNumber_0 = realNumber_0 + "." + number_0; + + } + } else { + realNumber_0 = number_0 + ""; + + } + bean.setNumber(realNumber_0); + + child = (TCComponentBOMLine) childline[i].getComponent(); + //2017.10.17ϱԸij"/汾" + materialCode = child.getItemRevision().getTCProperty("item_id").getStringValue()+"/"+ child.getItemRevision().getTCProperty("current_revision_id").getStringValue(); + bean.setMaterialCode(materialCode); + materialName = child.getItemRevision().getTCProperty("object_name").getStringValue(); + bean.setMaterialName(materialName); + packaging = ""; + comment=""; + try { + TCComponentICO[] icoS = child.getItemRevision().getClassificationObjects(); + int count = 0; + int count1 = 0; + for (int j = 0; j < icoS.length; j++) { + ICSProperty[] cPropS = icoS[j].getICSProperties(true); + for (int k = 0; k < cPropS.length; k++) { +// System.out.println(count); + count++; + } + keys = new Integer[count]; + vals = new String[count]; + for (int k = 0; k < cPropS.length; k++) { +// System.out.println(count); + keys[count1] = cPropS[k].getId(); + System.out.println("keys[" + count1 + "]================>" + keys[count1]); + vals[count1] = cPropS[k].getValue(); + System.out.println("vals[" + count1 + "]================>" + vals[count1]); + if (keys[count1] == 1066) {//keys[count1] == -500242 2021/1/5Ǩƺid + packaging = vals[count1]; + + } + if (keys[count1] == 1000) {//keys[count1] == -500239 2021/1/5Ǩƺid + comment = vals[count1]; + + } + count1++; + } + + } + } catch (Exception e) { + // TODO: handle exception + e.printStackTrace(); + } + + bean.setPackaging(packaging); + bean.setComment(comment); + TCComponentForm form = (TCComponentForm) child.getItemRevision() + .getReferenceListProperty("IMAN_master_form_rev")[0]; + // techCode = form.getTCProperty("jk8TechModel").getStringValue(); + // bean.setTechCode(techCode); + specCode = form.getTCProperty("jk8SpecModel").getStringValue(); + bean.setSpecCode(specCode); + ref_designator = child.getTCProperty("bl_ref_designator").getStringValue(); + // + System.out.println("ָʾ------------------->" + ref_designator); + + //2017.10.26 C1-C3ijC1,C2,C3ĸʽ + String[] xx=ref_designator.split(","); + List ref_designator_list=new ArrayList<>(); + for (int k = 0; k < xx.length; k++) { + if(xx[k].contains("-")) { + + String strings1=xx[k].split("-")[0];//Сֵ + String strings2=xx[k].split("-")[1];//ֵ + //ֵ + String up=""; + int up_num=0; + for (int j = strings2.length()-1;j>=0; j--) { + if(Character.isDigit(strings2.charAt(j))==true) { + up=strings2.charAt(j)+up; + }else { + break; + } + + } + up_num=Integer.valueOf(up); + //Сֵ + String down=""; + int down_num=0; + int mark=0; + for(int j = strings1.length()-1;j>=0; j--) { + if(Character.isDigit(strings1.charAt(j))==true) { + down=strings1.charAt(j)+down; + }else { + mark=j; + break; + } + } + down_num=Integer.valueOf(down); + //ͷλ + String wh=strings1.substring(0, mark+1); + for (int j = down_num; j <= up_num; j++) { + String aa=wh+j; + ref_designator_list.add(aa); + } + + + }else if(!xx[k].contains("-")) { + ref_designator_list.add(xx[k]); + } + } +// bean.setRef_designator(ref_designator);//ҪC1,C2,C3ʾλžע + ref_designator=""; + for (int j = 0; j < ref_designator_list.size(); j++) { + ref_designator=ref_designator+ref_designator_list.get(j)+","; + } + ref_designator=ref_designator.substring(0,ref_designator.length()-1); + bean.setRef_designator(ref_designator);//ҪC1-C3ʾλžע + + + + quantity = child.getTCProperty("bl_quantity").getStringValue().split("\\.")[0];//2017.10.26 ʾС +// if(Integer.valueOf(quantity)>3) { +// quantity=quantity+"-"; +// } + bean.setQuantity(quantity); + unit = child.getProperty("bl_uom"); + bean.setUnit(unit); + + //2017.10.18 + //2018.3.21ȫ +// TCComponent[] components=child.getTCProperty("global_bl_substitute_list").getReferenceValueArray(); + TCComponent[] components=child.getItem().getTCProperty("global_alt_list").getReferenceValueArray();//TODO + if(components.length==0) { + bl_substitute_list=""; + }else if(components.length>0) { + bl_substitute_list=""; + for (int j = 0; j < components.length; j++) { + //2018.1.16 + String id=""; + try { + id=((TCComponentItem)components[j]).getTCProperty("item_id").getStringValue(); + } catch (Exception e) { + // TODO Auto-generated catch block + id=((TCComponentBOMView)components[j]).getTCProperty("object_name").getStringValue().split("-")[0]; + e.printStackTrace(); + } + bl_substitute_list=bl_substitute_list+id+","; + } + } + if(bl_substitute_list.length()>=1) { + + bl_substitute_list=bl_substitute_list.trim(); + bl_substitute_list=bl_substitute_list.substring(0, bl_substitute_list.length()-1); + } + + bean.setGlobal_bl_substitute_list(bl_substitute_list); + + //2018.3.19 Ӳ嵥ģСϡһУΪȫϡֲϡ + components=child.getTCProperty("bl_substitute_list").getReferenceValueArray(); + if(components.length==0) { + bl_substitute_list=""; + }else if(components.length>0) { + bl_substitute_list=""; + for (int j = 0; j < components.length; j++) { + String id=""; + try { + id=((TCComponentItem)components[j]).getTCProperty("item_id").getStringValue(); + } catch (Exception e) { + // TODO Auto-generated catch block + id=((TCComponentBOMView)components[j]).getTCProperty("object_name").getStringValue().split("-")[0]; + e.printStackTrace(); + } + bl_substitute_list=bl_substitute_list+id+","; + } + } + if(bl_substitute_list.length()>=1) { + + bl_substitute_list=bl_substitute_list.trim(); + bl_substitute_list=bl_substitute_list.substring(0, bl_substitute_list.length()-1); + } + + bean.setLocal_bl_substitute_list(bl_substitute_list); + + + list.add(bean); + if(isSingle == 0) { + if (child.getChildren().length > 0) { + getBomline(child,realNumber_0); + } + } + + } + } catch (TCException e) { + e.printStackTrace(); + } + + } + private void listBOM(TCComponentBOMLine bomlineObj) { + com.teamcenter.services.rac.cad._2007_01.StructureManagement structureService = com.teamcenter.services.rac.cad.StructureManagementService.getService(session); + com.teamcenter.services.rac.cad._2007_01.StructureManagement.ExpandPSAllLevelsInfo levelInfo = new com.teamcenter.services.rac.cad._2007_01.StructureManagement.ExpandPSAllLevelsInfo(); + com.teamcenter.services.rac.cad._2007_01.StructureManagement.ExpandPSAllLevelsPref levelPref = new com.teamcenter.services.rac.cad._2007_01.StructureManagement.ExpandPSAllLevelsPref(); + levelInfo.parentBomLines = new TCComponentBOMLine[] {bomlineObj}; //붥BOMLine + levelInfo.excludeFilter="None"; + levelPref.expItemRev = false; + levelPref.info = new com.teamcenter.services.rac.cad._2007_01.StructureManagement.RelationAndTypesFilter[0]; + //ʹ·չBOM + com.teamcenter.services.rac.cad._2007_01.StructureManagement.ExpandPSAllLevelsResponse levelResp = structureService.expandPSAllLevels(levelInfo, levelPref); + if (levelResp.output.length <= 0) { + return; + } + /* + * levelRespеOutputеBOMLine + * StructureManagement.ExpandPSData[] children List of ExpandPSData children found for this parent. + StructureManagement.ExpandPSParentData parent ExpandPSParentData member + */ + + List bomlineList = new ArrayList(levelResp.output.length); + List itemRevList = new ArrayList(levelResp.output.length); + for(int i=0;i toplines = new ArrayList(); + try { + if(targetComps != null && targetComps.length > 0){ + for (int n = 0; n < targetComps.length; n++) { + InterfaceAIFComponent targetComp = targetComps[n]; + + if (targetComp instanceof TCComponentBOMViewRevision) { + try { + TCComponent comp = (TCComponent) targetComp; + AIFComponentContext[] context = comp.whereReferenced(); + TCComponentItemRevision rev = null; + for (int i = 0; i < context.length; i++) { + System.out.println("i:" + i); + if (context[i].getComponent() instanceof TCComponentItemRevision) { + rev = (TCComponentItemRevision) context[i].getComponent(); + break; + } + } + + TCComponentBOMWindowType type = (TCComponentBOMWindowType) session.getTypeComponent("BOMWindow"); + TCComponentBOMWindow win = type.create(null); + TCComponentBOMLine topline = null; + topline = win.setWindowTopLine(rev.getItem(), rev, null, null); + toplines.add(topline); + + } catch (Exception e) { + e.printStackTrace(); + } + + }else { + MessageBox.post("ǰѡе"+targetComp.getType()+",ѡͼ汾ڽṹѡжBOMLineٵ","",MessageBox.INFORMATION); + return; + } + } + //forѭ + exportBOM_Dialog dialog=new exportBOM_Dialog(session,toplines); + new Thread(dialog).run(); + } + } catch (Exception e) { + + } + + } + +} diff --git a/src/com/connor/jk/plm/exportBOM20200221/exportBOM_Bean.java b/src/com/connor/jk/plm/exportBOM20200221/exportBOM_Bean.java new file mode 100644 index 0000000..e2b228b --- /dev/null +++ b/src/com/connor/jk/plm/exportBOM20200221/exportBOM_Bean.java @@ -0,0 +1,80 @@ +package com.connor.jk.plm.exportBOM20200221; + +public class exportBOM_Bean { + + private String number;//ţ + private String materialCode;//ϱ룻 + private String materialName;// + private String techCode;//ͺ + private String specCode;//ͺ + private String quantity;// + private String unit;//λ + private String drawID;//ͼ + + //ȫ + private String global_list; + //ֲ + private String local_list; + + public String getGlobal_list() { + return global_list; + } + public void setGlobal_list(String global_list) { + this.global_list = global_list; + } + public String getLocal_list() { + return local_list; + } + public void setLocal_list(String local_list) { + this.local_list = local_list; + } + public String getNumber() { + return number; + } + public void setNumber(String number) { + this.number = number; + } + public String getMaterialCode() { + return materialCode; + } + public void setMaterialCode(String materialCode) { + this.materialCode = materialCode; + } + public String getMaterialName() { + return materialName; + } + public void setMaterialName(String materialName) { + this.materialName = materialName; + } + public String getTechCode() { + return techCode; + } + public void setTechCode(String techCode) { + this.techCode = techCode; + } + public String getSpecCode() { + return specCode; + } + public void setSpecCode(String specCode) { + this.specCode = specCode; + } + public String getQuantity() { + return quantity; + } + public void setQuantity(String quantity) { + this.quantity = quantity; + } + public String getUnit() { + return unit; + } + public void setUnit(String unit) { + this.unit = unit; + } + public String getDrawID() { + return drawID; + } + public void setDrawID(String drawID) { + this.drawID = drawID; + } + +} diff --git a/src/com/connor/jk/plm/exportBOM20200221/exportBOM_Dialog.java b/src/com/connor/jk/plm/exportBOM20200221/exportBOM_Dialog.java new file mode 100644 index 0000000..2c784f3 --- /dev/null +++ b/src/com/connor/jk/plm/exportBOM20200221/exportBOM_Dialog.java @@ -0,0 +1,310 @@ +package com.connor.jk.plm.exportBOM20200221; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.swing.DefaultComboBoxModel; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JFileChooser; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; +import javax.swing.filechooser.FileSystemView; + +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentBOMLine; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCComponentICO; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.kernel.ics.ICSProperty; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; + +public class exportBOM_Dialog extends AbstractAIFDialog { + + /** + * BOM嵥 + */ + private static final long serialVersionUID = 1L; + private TCSession session; + private JLabel pathLabel; + private JTextField pathField; + private JLabel nameLabel;// + private JTextField nameField;// ĬΪ嵥 + private JLabel selectLabel;// ͣṹ嵥Ӳ嵥 + + private JButton celButton; + private JLabel exportType;// + private JComboBox comBox_selectExportType; + + private String selectExportFileType = "Excel"; + private String selectWhichType = "ṹ嵥"; + + private JButton pathButton; + private JFileChooser jFileChooser; + private JButton okButton; +// ProgressBarThread wait; + + List toplines ; + + private JComboBox comBox_selectType; + + public exportBOM_Dialog(TCSession session, List toplines) { + this.session = session; + this.toplines = toplines; + } + + @Override + public void run() { + initUI(); + + } + + private void initUI() { + + this.setTitle("BOM嵥"); + this.setSize(new Dimension(300, 300)); + this.setLayout(new BorderLayout()); + this.setAlwaysOnTop(true); + setLayout(new BorderLayout()); + JPanel mainPanel = new JPanel(new PropertyLayout()); + + nameLabel = new JLabel(""); + nameField = new JTextField(50); + // 2017.10.27ļƶΪid--ͺ + // Ӳ嵥BOM嵥-u8--Ʒʶ-RD-ĵ-汾 + // ṹ嵥BOM嵥-u8(item_id)-Ʒʶ(jk8ProductIdentifyNO)-RD-ĵ(date_released)-汾ţitem_revision_id + // 2017.11.10ļƶΪ + // Ӳ嵥BOM嵥-u8-ƣԴԣ-ƷʶţԴԡʹòƷʶš޸öΪգ-RD-ĵڣBOM׼绹δ׼öΪգ-汾 + // ṹ嵥BOM嵥-u8-Ʒ-ƷʶţԴԡͺš-L/RԴԡͺš޸öΪգ-RD-ĵڣBOM׼绹δ׼öΪգ-汾 + + + selectLabel = new JLabel(""); + // б + List selectExportType = new ArrayList<>(); + selectExportType.add("Excel"); + selectExportType.add("PDF"); + comBox_selectExportType=new JComboBox( + new DefaultComboBoxModel(selectExportType.toArray(new String[selectExportType.size()]))); + comBox_selectExportType.addItemListener(new ItemListener() { + + @Override + public void itemStateChanged(ItemEvent e) { + // TODO Auto-generated method stub + if (e.getItem() != null) { + + selectExportFileType = (String) e.getItem(); + } + } + }); + + // б + List selectType = new ArrayList<>(); + selectType.add("ṹ嵥"); + selectType.add("Ӳ嵥"); + comBox_selectType = new JComboBox( + new DefaultComboBoxModel(selectType.toArray(new String[selectType.size()]))); + comBox_selectType.addItemListener(new ItemListener() { + + @Override + public void itemStateChanged(ItemEvent e) { + // TODO Auto-generated method stub + if (e.getItem() != null) { + + selectWhichType = (String) e.getItem(); + } + } + }); + + pathLabel = new JLabel("·"); + pathField = new JTextField(FileSystemView.getFileSystemView().getHomeDirectory().getPath());// ǰû· + pathField.setEditable(false); + pathButton = new JButton("ѡļ"); + okButton = new JButton("ȷ"); + jFileChooser = new JFileChooser(FileSystemView.getFileSystemView().getHomeDirectory().getPath()); + jFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + // + pathButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent actionevent) { + setAlwaysOnTop(false); + if (jFileChooser.showOpenDialog(null) != 1) + pathField.setText(jFileChooser.getSelectedFile().getAbsolutePath()); + setAlwaysOnTop(true); + } + }); + + okButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent arg0) { + disposeDialog(); + dispose(); + try { + // wait = new ProgressBarThread("BOM嵥", "ִУԵ..."); + // wait.start(); + selectWhichType = comBox_selectType.getSelectedItem().toString(); + for (int i = 0; i < toplines.size(); i++) { + TCComponentBOMLine topline = toplines.get(i); + TCComponentItemRevision child = topline.getItemRevision(); + + String recognise = ""; + String baseBoardComponentName = " ";// + String specModel = " "; // ͺ + String tecModel = " "; // ͺ + // ڷеIJƷʶ + TCComponent[] forms = child.getTCProperty("IMAN_master_form_rev").getReferenceValueArray(); + specModel = ((TCComponentForm) forms[0]).getTCProperty("jk8SpecModel").getStringValue(); + tecModel = ((TCComponentForm) forms[0]).getTCProperty("jk8TechModel").getStringValue(); + TCComponentICO[] icoS = child.getClassificationObjects(); + Integer[] keys = null; + String[] vals = null; + int count = 0; + int count1 = 0; + for (int m = 0; m < icoS.length; m++) { + ICSProperty[] cPropS = icoS[m].getICSProperties(true); + for (int j = 0; j < cPropS.length; j++) { + // System.out.println(count); + count++; + } + keys = new Integer[count]; + vals = new String[count]; + for (int j = 0; j < cPropS.length; j++) { + // System.out.println(count); + keys[count1] = cPropS[j].getId();// Ǵ + // System.out.println("keys[" + count1 + "]================>" + keys[count1]); + vals[count1] = cPropS[j].getValue(); + // System.out.println("vals[" + count1 + "]================>" + vals[count1]); + if (keys[count1] == 1050) {// Ʒʶ keys[count1] == -500301 2021/1/5Ǩƺid + + recognise = vals[count1]; + System.out.println("ԲƷʶ:"+recognise); + // break; + } + if (keys[count1] == 50205015) {// keys[count1] == -500293 2021/1/5Ǩƺid + baseBoardComponentName = vals[count1]; + System.out.println("Ի:"+baseBoardComponentName); + } + + count1++; + } + + } + // if(child.getTCProperty("jk8ProductIdentifyNO")==null) { + // MessageBox.post("汾 Ʒʶţjk8ProductIdentifyNO + // δ","",MessageBox.INFORMATION); + // recognise="޲Ʒʶ"; + // }else { + // + // recognise=child.getTCProperty("jk8ProductIdentifyNO").getStringValue(); + // } + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); + Date date_released = child.getTCProperty("date_released").getDateValue(); + String time = ""; + if (recognise == null || recognise.equals("")) { + recognise = " "; + } + if (baseBoardComponentName == null || baseBoardComponentName.equals("")) { + baseBoardComponentName = " "; + } + if (specModel == null || specModel.equals("")) { + specModel = " "; + } + if (tecModel == null || tecModel.equals("")) { + tecModel = " "; + } + if (date_released != null) { + time = sdf.format(date_released); + } else { + time = " "; + } + String exportName = ""; + if (selectWhichType.equals("ṹ嵥")) { + try { + exportName = "BOM嵥-" + child.getTCProperty("item_id").getStringValue() + "-" + + child.getTCProperty("object_name").getStringValue() + "-" + specModel + "-" + + tecModel + "-" + recognise + "-RD-" + time + "-" + + child.getTCProperty("item_revision_id").getStringValue(); + + } catch (TCException e1) { + e1.printStackTrace(); + } + } else if (selectWhichType.equals("Ӳ嵥")) { + try { + exportName = "BOM嵥-" + child.getTCProperty("item_id").getStringValue() + "-" + // +child.getTCProperty("object_name").getStringValue() + + baseBoardComponentName// 2017.11.10л + + "-" + recognise + "-RD-" + time + "-" + + child.getTCProperty("item_revision_id").getStringValue(); + + } catch (TCException e1) { + e1.printStackTrace(); + } + } + + String path = pathField.getText(); + if (selectWhichType.equals("ṹ嵥")) { + exportBOM_Operation operation = new exportBOM_Operation(exportName, path, + session, topline, selectExportFileType, i, toplines.size()); + session.queueOperation(operation); + } else if (selectWhichType.equals("Ӳ嵥")) { + exportHardwareBOM_Operation operation = new exportHardwareBOM_Operation(exportName, + path, session, topline, selectExportFileType, i, toplines.size()); + session.queueOperation(operation); + } + } + // wait.setBool(true); + // wait.interrupt(); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + + mainPanel.add("1.1.left.top", pathLabel); + mainPanel.add("1.2.left.top", pathField); + mainPanel.add("1.3.left.top", pathButton); + mainPanel.add("2.1.left.top", nameLabel); + mainPanel.add("2.2.left.top", nameField); + mainPanel.add("3.1.left.top", selectLabel); + mainPanel.add("3.2.left.top", comBox_selectType); + // 2017.12.5 ӵ + exportType = new JLabel("ʽ"); + mainPanel.add("4.1.left.top",exportType); + mainPanel.add("4.2.left.top",comBox_selectExportType); + add(mainPanel, BorderLayout.CENTER); + JPanel buttonPanel = new JPanel(new FlowLayout()); + buttonPanel.add(okButton); + celButton = new JButton("ȡ"); + celButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent arg0) { + disposeDialog(); + dispose(); + + } + }); + buttonPanel.add(celButton); + add(buttonPanel, BorderLayout.SOUTH); + centerToScreen(); + pack(); + showDialog(); + + } + +} diff --git a/src/com/connor/jk/plm/exportBOM20200221/exportBOM_Handler.java b/src/com/connor/jk/plm/exportBOM20200221/exportBOM_Handler.java new file mode 100644 index 0000000..efc6bfe --- /dev/null +++ b/src/com/connor/jk/plm/exportBOM20200221/exportBOM_Handler.java @@ -0,0 +1,26 @@ +package com.connor.jk.plm.exportBOM20200221; + +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.aifrcp.AIFUtility; + +/* + * BOM嵥 + * + */ +public class exportBOM_Handler extends AbstractHandler{ + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + // TODO Auto-generated method stub + System.out.println("汾20210105"); + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + exportBOM_Action action=new exportBOM_Action(app,null); + new Thread(action).start(); + return null; + } + +} diff --git a/src/com/connor/jk/plm/exportBOM20200221/exportBOM_Operation.java b/src/com/connor/jk/plm/exportBOM20200221/exportBOM_Operation.java new file mode 100644 index 0000000..b529d3d --- /dev/null +++ b/src/com/connor/jk/plm/exportBOM20200221/exportBOM_Operation.java @@ -0,0 +1,1054 @@ +package com.connor.jk.plm.exportBOM20200221; + +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.List; + +import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.IndexedColors; +import org.apache.poi.ss.util.CellRangeAddress; +import org.apache.poi.xssf.usermodel.XSSFCell; +import org.apache.poi.xssf.usermodel.XSSFCellStyle; +import org.apache.poi.xssf.usermodel.XSSFFont; +import org.apache.poi.xssf.usermodel.XSSFRow; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + +import com.connor.jk.plm.exportBOM.ProgressBarThread; +import com.jacob.activeX.ActiveXComponent; +import com.jacob.com.ComThread; +import com.jacob.com.Dispatch; +import com.jacob.com.Variant; +import com.teamcenter.rac.aif.AbstractAIFOperation; +import com.teamcenter.rac.aif.kernel.AIFComponentContext; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentBOMLine; +import com.teamcenter.rac.kernel.TCComponentBOMView; +import com.teamcenter.rac.kernel.TCComponentDataset; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCComponentTcFile; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class exportBOM_Operation extends AbstractAIFOperation { + private String type; + private String path; + private ProgressBarThread wait; + private TCSession session; + private TCComponentBOMLine comp; + private FileInputStream fis; + private XSSFWorkbook workbook; + private FileOutputStream out; + private TCPreferenceService preferenceService; + private String selectExportFileType; + private int completeCount; + private int allCount; + + + public exportBOM_Operation(String type, String path, + TCSession session, TCComponentBOMLine comp, + String selectExportFileType, int i, int allCount) { + // TODO Auto-generated constructor stub + this.type = type; + this.path = path; + // this.wait = wait; + this.session = session; + this.comp = comp; + this.selectExportFileType = selectExportFileType; + this.completeCount = i; + this.allCount = allCount; + wait = new ProgressBarThread("BOM嵥", "ִУԵ..."); + wait.start(); + } + + @Override + public void executeOperation() throws Exception { + // TODO Auto-generated method stub + // ץȡfnd0ActuatedInteractiveTsks fnd0Performer fnd0EndDate + // fnd0AliasTaskName + String name1 = ""; + String name2 = ""; + String name3 = ""; + TCComponent[] component = comp.getItemRevision() + .getTCProperty("fnd0ActuatedInteractiveTsks") + .getReferenceValueArray(); + // //ļ + // type=comp.getItemRevision().getTCProperty("item_id").getStringValue()+"-" + // +comp.getItemRevision().getTCProperty("object_name").getStringValue()+"-"; + // System.out.println(component.length); + + for (int i = 0; i < component.length; i++) { + // + if (component[i].getTCProperty("fnd0AliasTaskName") + .getStringValue().contains("")) { + name1 = component[i].getTCProperty("fnd0Performer") + .getDisplayValue().split("\\(")[0]; + name1 = name1 + + "/" + + component[i].getTCProperty("fnd0EndDate") + .getDisplayValue(); + } else if (component[i].getTCProperty("fnd0AliasTaskName") + .getStringValue().contains("")) { + name2 = component[i].getTCProperty("fnd0Performer") + .getDisplayValue().split("\\(")[0]; + name2 = name2 + + "/" + + component[i].getTCProperty("fnd0EndDate") + .getDisplayValue(); + } else if (component[i].getTCProperty("fnd0AliasTaskName") + .getStringValue().contains("׼")) { + name3 = component[i].getTCProperty("fnd0Performer") + .getDisplayValue().split("\\(")[0]; + name3 = name3 + + "/" + + component[i].getTCProperty("fnd0EndDate") + .getDisplayValue(); + } + } + long start = System.currentTimeMillis(); + int colsCount = 16; + String sxx = "jk_bom_uid";// G8TlM0X6YvbLjA + File file = getExcel(sxx); + if (file == null) { + return; + } + getBomline(comp, realNumber); + // 2017.11.17 ͺţͺ + TCComponentForm form_topline = (TCComponentForm) comp.getItemRevision() + .getReferenceListProperty("IMAN_master_form_rev")[0]; + String techCode_topline = form_topline.getTCProperty("jk8TechModel") + .getStringValue(); + String specCode_topline = form_topline.getTCProperty("jk8SpecModel") + .getStringValue(); + + System.out.println("BOM" + list.size() + ""); + int rowCount = list.size(); + fis = new FileInputStream(file); + workbook = new XSSFWorkbook(fis); + XSSFSheet sheet = workbook.getSheet("ṹ嵥"); + System.out.println("ģ干"+sheet.getLastRowNum()+""); + + // sheet.setColumnWidth(4, 7000); + // sheet.setColumnWidth(12, 7000); + // XSSFCellStyle sty = workbook.createCellStyle(); + // sty.setWrapText(true);//Զ + // sty.setAlignment(XSSFCellStyle.ALIGN_CENTER); + // sty.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER); + // style1.setFillPattern(FillPatternType.SOLID_FOREGROUND);//һҪ䣬ñɫ + // style1.setFillForegroundColor(new XSSFColor( new Color(232, 242, + // 254)));//ñɫ + XSSFRow row = sheet.getRow(1); + XSSFCell cell_0 = row.getCell(3); + cell_0.setCellValue(comp.getItemRevision().getTCProperty("item_id") + .getStringValue()); + cell_0 = row.getCell(10); + cell_0.setCellValue(comp.getItemRevision() + .getTCProperty("item_revision_id").getStringValue()); + row = sheet.getRow(2); + cell_0 = row.getCell(3); + cell_0.setCellValue(comp.getItemRevision().getTCProperty("object_name") + .getStringValue()); + // 2017.11.17 + row = sheet.getRow(3); + cell_0 = row.getCell(3); + cell_0.setCellValue(specCode_topline); + cell_0 = row.getCell(10); + cell_0.setCellValue(techCode_topline); + + row = sheet.getRow(4); + cell_0 = row.getCell(3); + Date date = new Date(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + String time = sdf.format(date); + time = time.replace("-", "."); + cell_0.setCellValue(time);// Ч + int startRow = 6; + XSSFCellStyle sty = workbook.createCellStyle();// ½Ԫĸʽ + XSSFCellStyle style = workbook.createCellStyle();// BеԪĸʽ + // XSSFCellStyle sty2 = sheet.getRow(7).getCell(1).getCellStyle(); + XSSFCellStyle sty2 = workbook.createCellStyle();//еĸʽ + sty2.setBorderBottom((short) 1); + sty2.setBorderLeft((short) 2); + sty2.setBorderRight((short) 1); + sty2.setBorderTop((short) 1); + sty2.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER); + // XSSFCellStyle sty3 = sheet.getRow(6).getCell(13).getCellStyle();// + // NеԪĸʽ + XSSFCellStyle sty3 = workbook.createCellStyle();// PеԪĸʽ + // XSSFCellStyle sty4 = sheet.getRow(7).getCell(13).getCellStyle();// + // кһеĸʽ + XSSFCellStyle sty4 = workbook.createCellStyle();// кһеĸʽ + XSSFCellStyle sty5 = workbook.createCellStyle();// עеʽ + XSSFCellStyle sty6 = workbook.createCellStyle();// qianԪĸʽ + XSSFCellStyle sty7 = workbook.createCellStyle();// /ڵԪĸʽ + sty6.setBorderBottom((short) 2); + sty6.setBorderLeft((short) 2); + sty6.setBorderRight((short) 1); + sty6.setBorderTop((short) 1); + + sty7.setBorderLeft((short) 1); + sty7.setBorderBottom((short) 2); + sty7.setBorderRight((short) 2); + sty7.setBorderTop((short) 1); + + XSSFCellStyle sty8 = workbook.createCellStyle();// /ڵԪĸʽ + sty8.setBorderTop((short) 1); + sty8.setBorderBottom((short) 1); + sty8.setBorderLeft((short) 2); + sty8.setBorderRight((short) 1); + + XSSFCellStyle sty9 = workbook.createCellStyle();// /ڵԪĸʽ + sty9.setBorderTop((short) 1); + sty9.setBorderBottom((short) 1); + sty9.setBorderLeft((short) 1); + sty9.setBorderRight((short) 2); + + sty5.setBorderRight((short) 2); + sty5.setBorderLeft((short) 1); + sty5.setBorderTop((short) 1); + sty5.setBorderBottom((short) 1); + sty = sheet.getRow(7).getCell(11).getCellStyle(); + sty.setBorderBottom(CellStyle.BORDER_THIN); + sty.setBottomBorderColor(IndexedColors.BLACK.getIndex()); + sty.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER);// ֱ + sty.setAlignment(XSSFCellStyle.ALIGN_LEFT);// ˮƽ + XSSFFont font = workbook.createFont(); + font.setFontName("΢ź"); + font.setFontHeightInPoints((short) 9);// С + // sty.setFont(font); + style.setBorderBottom(CellStyle.BORDER_THIN); + style.setBorderTop((short) 1); + style.setBottomBorderColor(IndexedColors.BLACK.getIndex()); + style.setAlignment(XSSFCellStyle.ALIGN_CENTER); // + style.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER); // + style.setFont(font); + sty2.setFont(font); + sty3.setBorderBottom((short) 1); + sty3.setBorderRight((short) 2); + sty3.setBorderLeft((short) 1); + // sty3.setBottomBorderColor(IndexedColors.BLACK.getIndex()); + sty3.setBorderTop((short) 1); + // sty3.setTopBorderColor(IndexedColors.BLACK.getIndex()); + + sty4.setBorderBottom((short) 2); + // sty4.setBottomBorderColor(IndexedColors.BLACK.getIndex()); + sty4.setBorderTop((short) 1); + // sty4.setTopBorderColor(IndexedColors.BLACK.getIndex()); + sty4.setBorderLeft((short) 1); + // sty4.setLeftBorderColor(IndexedColors.BLACK.getIndex()); + sty4.setBorderRight((short) 1); + sty4.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER); + // sty4.setRightBorderColor(IndexedColors.BLACK.getIndex()); + XSSFFont font2 = workbook.createFont(); + font2.setFontName(""); + // font2.setFontName("΢ź"); + font2.setFontHeightInPoints((short) 11);// С + sty4.setFont(font2); + // sty4.setAlignment(XSSFCellStyle.ALIGN_CENTER); + // sty4.setAlignment(XSSFCellStyle.VERTICAL_CENTER); + for (int i = 0; i < rowCount + 7; i++) { + XSSFRow r = null; + boolean isCreate = false; + System.out.println("sheet.getLastRowNum()-------->" + + sheet.getLastRowNum()); + if ((i + startRow) > sheet.getLastRowNum()) { + r = sheet.createRow(i + startRow); + r.setHeight((short) 402); + isCreate = true; + } else { + r = sheet.getRow(i + startRow); + System.out.println("и---------" + r.getHeight()); + isCreate = false; + } + + // Ԫ񣬺ϲԪ + for (int cols = 1; cols < colsCount; cols++) { + XSSFCell cell = null; + if (isCreate) { + System.out.println(""+(i + startRow)+";"+cols+""); + cell = r.createCell(cols); + cell.setCellStyle(sty); + // TODO ʽ + } else { + if (r == null) { + r = sheet.createRow(i + startRow); + + System.out.println("ûд"); + } + cell = r.getCell(cols); + } + if (cols == 3 && isCreate && i < rowCount + 3) { + + CellRangeAddress cra = new CellRangeAddress(i + startRow, i + + startRow, 2, 3); + sheet.addMergedRegion(cra); + } else if (cols == 5 && isCreate && i < rowCount + 3) { + CellRangeAddress cra = new CellRangeAddress(i + startRow, i + + startRow, 4, 5); + sheet.addMergedRegion(cra); + } else if (cols == 7 && isCreate && i < rowCount + 3) { + CellRangeAddress cra = new CellRangeAddress(i + startRow, i + + startRow, 6, 7); + sheet.addMergedRegion(cra); + } else if (cols == 9 && isCreate && i < rowCount + 3) { + CellRangeAddress cra = new CellRangeAddress(i + startRow, i + + startRow, 8, 9); + sheet.addMergedRegion(cra); + } + } + + for (int cols = 1; cols < colsCount; cols++) { + // if (i < rowCount+3) { + // + // CellRangeAddress cra = new CellRangeAddress(i + startRow, i + + // startRow, 8,9); + // sheet.addMergedRegion(cra); + // } + XSSFCell cell = null; + if (isCreate) { + cell = r.createCell(cols); + cell.setCellStyle(sty); + // TODO ʽ + } else { + if (r == null) { + r = sheet.createRow(i + startRow); + System.out.println("ûд"); + } + cell = r.getCell(cols); + if (cols == 11) { + + cell.setCellStyle(sty); + } + } + if (cell == null) { + cell = r.createCell(cols); + // cell.setCellStyle(sty); + } + + cell.setCellType(XSSFCell.CELL_TYPE_STRING);// ıʽ + + // XSSFCellStyle + // sty0=sheet.getRow(9).getCell(11).getCellStyle(); + if (i < rowCount) { + + int rwsTemp = list.get(i).getTechCode().length() / 5 + 1; + int rwsTemp1 = list.get(i).getSpecCode().length() / 5 + 1; + int rwsTemp2 = list.get(i).getDrawID().length() / 5 + 1; + int rwsTemp3 = list.get(i).getMaterialName().length() / 5 + 1; + int rwsTemp4 = list.get(i).getGlobal_list().length() / 5 + 1; + int rwsTemp5 = list.get(i).getLocal_list().length() / 5 + 1; + int temp; + + int a[] = new int[] { rwsTemp, rwsTemp1, rwsTemp2, rwsTemp3, rwsTemp4, rwsTemp5 }; + Arrays.sort(a); + for (int i1 = 0; i1 < a.length; i1++) { +// System.out.println(a[i1]); + } + temp = a[5]; + + r.setHeight((short) (temp * 260)); + cell.getCellStyle().setWrapText(true); + } + if (i < rowCount) { + + switch (cols) { + case 1:// + if (list.get(i) == null) { + // this.wait.setBool(true); + // this.wait.interrupt(); + // MessageBox.post("BOM嵥Ϊ", "",MessageBox.INFORMATION); + return; + } else { + + if (i > 0) { + + cell.setCellStyle(sty2); + } + cell.setCellValue(list.get(i).getNumber()); + break; + } + + case 2:// ϱ + // if(i>2) { + // sty0=sheet.getRow(9).getCell(cols).getCellStyle(); + // cell.setCellStyle(sty0); + // } + if (i >= 2) { + + cell.setCellStyle(style); + } + cell.setCellValue(list.get(i).getMaterialCode());// д + break; + case 4:// + // cell.setCellStyle(sty0); + cell.setCellValue(list.get(i).getMaterialName()); + break; + case 6:// ͺ + // cell.setCellStyle(sty); + + cell.setCellValue(list.get(i).getTechCode()); + break; + case 8:// ͺ + // cell.setCellStyle(sty0); + + cell.setCellValue(list.get(i).getSpecCode()); + // cell.setCellStyle(styG); + break; + case 10:// + // cell.setCellStyle(sty0); + cell.setCellValue(list.get(i).getQuantity()); + break; + case 11:// λ + // cell.setCellStyle(sty0); + cell.setCellValue(list.get(i).getUnit()); + break; + case 12:// ͼ + // cell.setCellStyle(sty0); + + cell.setCellValue(list.get(i).getDrawID()); + + break; + case 13:// ע + cell.setCellValue(list.get(i).getGlobal_list()); + break; + case 14:// ע + cell.setCellValue(list.get(i).getLocal_list()); + break; + case 15:// ע + + if (i > 0) { + + cell.setCellStyle(sty3); + } + break; + } + } + } + + } + + // ϲԪ + for ( + + int i = 0; i < rowCount + 3; i++) { + // if (i < rowCount+3) { + // + // CellRangeAddress cra = new CellRangeAddress(i + startRow, i + + // startRow, 8,9); + // sheet.addMergedRegion(cra); + // cra = new CellRangeAddress(i + startRow, i + startRow, 6, 7); + // sheet.addMergedRegion(cra); + // cra = new CellRangeAddress(i + startRow, i + startRow, 4, 5); + // sheet.addMergedRegion(cra); + // cra = new CellRangeAddress(i + startRow, i + startRow, 2, 3); + // sheet.addMergedRegion(cra); + // } + } + // õеĵ±߿ + XSSFCell cell5 = null; + for (int cols = 1; cols < colsCount; cols++) { + cell5 = sheet.getRow(startRow + rowCount + 2).getCell(cols); + switch (cols) { + + case 1:// + + cell5.setCellStyle(sty4); + break; + case 2:// + + cell5.setCellStyle(sty4); + break; + case 3:// + + cell5.setCellStyle(sty4); + break; + case 4:// + + cell5.setCellStyle(sty4); + break; + case 5:// + + cell5.setCellStyle(sty4); + break; + case 6:// + + cell5.setCellStyle(sty4); + break; + case 7:// + + cell5.setCellStyle(sty4); + break; + case 8:// + + cell5.setCellStyle(sty4); + break; + case 9:// + + cell5.setCellStyle(sty4); + break; + case 10:// + + cell5.setCellStyle(sty4); + break; + case 11:// + + cell5.setCellStyle(sty4); + break; + case 12:// + + cell5.setCellStyle(sty4); + break; + case 13:// ע + + cell5.setCellStyle(sty4); + break; + case 14:// ע + + cell5.setCellStyle(sty4); + break; + case 15:// ע + + cell5.setCellStyle(sty4); + break; + } + } + // һеĵ±߿ + XSSFCell cellLast = null; + for (int cols = 1; cols < colsCount; cols++) { + cellLast = sheet.getRow(startRow + rowCount + 6).getCell(cols); + switch (cols) { + case 1:// + cellLast.setCellValue("/"); + cellLast.setCellStyle(sty4); + break; + case 2:// + + cellLast.setCellStyle(sty4); + break; + case 3:// + cellLast.setCellValue("/"); + cellLast.setCellStyle(sty4); + break; + case 4:// + + cellLast.setCellStyle(sty4); + break; + case 5:// + cellLast.setCellStyle(sty4); + break; + case 6:// + cellLast.setCellValue("׼/"); + + cellLast.setCellStyle(sty4); + break; + case 7:// + cellLast.setCellStyle(sty4); + break; + case 8:// + + cellLast.setCellStyle(sty4); + break; + case 9:// + cellLast.setCellValue("ĵ"); + cellLast.setCellStyle(sty4); + break; + case 10:// + cellLast.setCellStyle(sty4); + break; + case 11:// + cellLast.setCellValue(""); + cellLast.setCellStyle(sty4); + break; + case 12:// + cellLast.setCellValue(""); + + cellLast.setCellStyle(sty4); + break; + case 13:// ע + + cellLast.setCellValue("/"); + cellLast.setCellStyle(sty4); + break; + case 14:// ע + + cellLast.setCellStyle(sty4); + break; + case 15:// ע + + cellLast.setCellStyle(sty4); + break; + } + } + // ϲǩĵԪ + //(BC12,DEF35,GHI68,JK910,L11,M12,NOP1315 ) + CellRangeAddress cra = new CellRangeAddress(rowCount + startRow + 3, + rowCount + startRow + 5, 1, 2); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + + 5, 3, 5); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + + 5, 6, 8); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + + 5, 9, 10); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + + 5, 11, 11); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + + 5, 12, 12); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + + 5, 13, 15); + sheet.addMergedRegion(cra); + // ϲһ + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + + 6, 1, 2); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + + 6, 3, 5); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + + 6, 6, 8); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + + 6, 9, 10); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + + 6, 11, 11); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + + 6, 12, 12); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + + 6, 13, 15); + sheet.addMergedRegion(cra); + + XSSFCell cell6 = null; + cell6 = sheet.getRow(5).getCell(11); + cell6.getCellStyle().setBorderBottom((short) 2); + XSSFCell cell0 = sheet.getRow(startRow + rowCount + 2).getCell(1); + cell0.setCellStyle(sty6); + + cell0 = sheet.getRow(startRow + rowCount + 2).getCell(15); + cell0.setCellStyle(sty7); + + XSSFCell cell1 = sheet.getRow(startRow + rowCount + 4).getCell(1); + cell1.setCellStyle(sty6); + cell1 = sheet.getRow(startRow + rowCount + 4).getCell(15); + cell1.setCellStyle(sty7); + + cell1 = sheet.getRow(startRow + rowCount).getCell(1); + cell1.setCellStyle(sty8); + cell1 = sheet.getRow(startRow + rowCount + 1).getCell(1); + cell1.setCellStyle(sty8); + cell1 = sheet.getRow(startRow + rowCount + 3).getCell(1); + cell1.setCellStyle(sty8); + cell1 = sheet.getRow(startRow + rowCount + 5).getCell(1); + cell1.setCellStyle(sty8); + cell1 = sheet.getRow(startRow + rowCount + 6).getCell(1); + cell1.setCellStyle(sty6); + + cell1 = sheet.getRow(startRow + rowCount).getCell(15); + cell1.setCellStyle(sty9); + cell1 = sheet.getRow(startRow + rowCount + 1).getCell(15); + cell1.setCellStyle(sty9); + cell1 = sheet.getRow(startRow + rowCount + 3).getCell(15); + cell1.setCellStyle(sty9); + cell1 = sheet.getRow(startRow + rowCount + 5).getCell(15); + cell1.setCellStyle(sty9); + cell1 = sheet.getRow(startRow + rowCount + 6).getCell(15); + cell1.setCellStyle(sty7); + + XSSFCell cell2 = sheet.getRow(startRow + rowCount + 3).getCell(1); + cell2.setCellValue(name1); + XSSFFont font3 = workbook.createFont(); + font3.setFontName(""); + font3.setFontHeightInPoints((short) 10);// С + + cell2 = sheet.getRow(startRow + rowCount + 3).getCell(3); + + cell2.setCellValue(name2); + cell2 = sheet.getRow(startRow + rowCount + 3).getCell(6); + cell2.setCellValue(name3); + cell2 = sheet.getRow(startRow + rowCount + 3).getCell(1); + cell2.getCellStyle().setAlignment((short) 1); + cell2.getCellStyle().setVerticalAlignment((short) 1); + cell2.getCellStyle().setWrapText(true); + cell2.getCellStyle().setFont(font3); + System.out.println("ʽ------------>" + + sheet.getRow(12).getCell(4).getCellStyle().getAlignment()); + + cellLast = sheet.getRow(startRow + rowCount + 6).getCell(1); + cellLast.getCellStyle().setVerticalAlignment( + XSSFCellStyle.VERTICAL_CENTER); + // 2017.11.21 Ȱصû·£ȻתΪpdf + // ѡ񵼳pdf + File fileout; + String usrHome = System.getProperty("user.home"); + // System.out.println("usrHome=" + usrHome); + String excelPath = path + "\\" + type + ".xlsx"; + if (selectExportFileType.equals("Excel")) { + excelPath = judge2(excelPath); + + fileout = new File(excelPath); + } else { + fileout = new File(usrHome + "\\" + type + ".xlsx"); + } + + // File fileout = new File(path + "\\" + type + ".xlsx"); + // File fileout = new File(usrHome + "\\" + type + ".xlsx"); + try { + out = new FileOutputStream(fileout); + } catch (Exception e) { + // this.wait.setBool(true); + // this.wait.interrupt(); + e.printStackTrace(); + MessageBox.post("ļ!\nļǷ:ܰ/,\\,,*,?,\",<,>,|","ļǷ", MessageBox.INFORMATION); + // String str = "/,\\,,*,?,\",<,>,|"; + return; + // e.printStackTrace(); + } + workbook.write(out); + // תpdf + String inFilePath = path + "\\" + type + ".xlsx"; + // String inFilePath = usrHome + "\\" + type + ".xlsx"; + String outFilePath = path + "\\" + type + ".pdf"; + try { + if (!selectExportFileType.equals("Excel")) { + // תpdf + System.out.println("------תpdf"); + inFilePath = usrHome + "\\" + type + ".xlsx"; + outFilePath = judge(outFilePath); + xlsToPdf(inFilePath, outFilePath); + deletePdf(inFilePath); + long end = System.currentTimeMillis(); + float time2 = (end - start) / 1000.00f; + System.out.println("ʱ" + time2 + ""); + // this.wait.setBool(true); + // this.wait.interrupt(); + /* if (rename2 == false) { + MessageBox.post("Ѿ", "ɹ", MessageBox.INFORMATION); + } else { + MessageBox.post("ѾԭļѴڣļΪ:\n" + + outFilePath.substring( + outFilePath.lastIndexOf("\\") + 1, + outFilePath.length()), "ɹ", + MessageBox.INFORMATION); + + } + Runtime.getRuntime().exec(new String[] { "cmd.exe", "/c", outFilePath });*/ + } else { + long end = System.currentTimeMillis(); + float time2 = (end - start) / 1000.00f; + System.out.println("ʱ" + time2 + ""); + // this.wait.setBool(true); + // this.wait.interrupt(); + /* if (rename2 == false) { + MessageBox.post("Ѿ", "ɹ", MessageBox.INFORMATION); + } else { + MessageBox.post( + "ѾԭļѴڣļΪ:\n" + + excelPath.substring( + excelPath.lastIndexOf("\\") + 1, + excelPath.length()), "ɹ", + MessageBox.INFORMATION); + + } + Runtime.getRuntime().exec(new String[] { "cmd.exe", "/c", excelPath });*/ + } + } catch (Exception e) { + // TODO: handle exception + }finally{ + wait.setBool(true); + wait.interrupt(); + } + + if(completeCount == allCount -1 ){ + MessageBox.post("Ѿ", "ɹ", MessageBox.INFORMATION); + } + } + + // жͬpdfǷѾ + boolean rename = false; + boolean rename2 = false; + + private String judge(String outFilePath) { + rename = false; + File pdfFile = new File(outFilePath); + if (pdfFile.exists()) { + String name = outFilePath.split("\\.pdf")[0]; + outFilePath = name + "(1).pdf"; + rename = true; + rename2 = true; + } + if (rename == true) { + outFilePath = judge(outFilePath); + } + return outFilePath; + + } + + private String judge2(String outFilePath) { + rename = false; + File pdfFile = new File(outFilePath); + if (pdfFile.exists()) { + String name = outFilePath.split("\\.xlsx")[0]; + outFilePath = name + "(1).xlsx"; + rename = true; + rename2 = true; + } + if (rename == true) { + outFilePath = judge2(outFilePath); + } + + return outFilePath; + + } + + // EXCELתPDF + public String xlsToPdf(String inFilePath, String outFilePath) { + ComThread.InitSTA(true); + // deletePdf(outFilePath); + ActiveXComponent ax = new ActiveXComponent("Excel.Application"); + try { + ax.setProperty("Visible", new Variant(false)); + ax.setProperty("AutomationSecurity", new Variant(3)); // ú + Dispatch excels = ax.getProperty("Workbooks").toDispatch(); + + Dispatch excel = Dispatch.invoke( + excels, + "Open", + Dispatch.Method, + new Object[] { inFilePath, new Variant(false), + new Variant(false) }, new int[9]).toDispatch(); + // תʽ + Dispatch.invoke(excel, "ExportAsFixedFormat", Dispatch.Method, + new Object[] { new Variant(0), // PDFʽ=0 + outFilePath, new Variant(0) // 0=׼ (ɵPDFͼƬģ) + // 1=Сļ + // (ɵPDFͼƬһͿ) + }, new int[1]); + + // ʹSaveAs + /* + * Dispatch.invoke(excel,"SaveAs",Dispatch.Method,new Object[]{ + * outFile, new Variant(57), new Variant(false), new Variant(57), + * new Variant(57), new Variant(false), new Variant(true), new + * Variant(57), new Variant(true), new Variant(true), new + * Variant(true) },new int[1]); + */ + + // Dispatch.call(excel, "Close", false); + + if (ax != null) { + ax.invoke("Quit", new Variant[] {}); + ax = null; + } + ComThread.Release(); + return ""; + } catch (Exception es) { + return es.toString(); + } + } + + /** + * PDFɾPDF + * + * @param pdfPath + */ + private void deletePdf(String pdfPath) { + File pdfFile = new File(pdfPath); + if (pdfFile.exists()) { + pdfFile.delete(); + } + } + + private exportBOM_Bean bean; + private List list = new ArrayList<>(); + private TCComponentBOMLine child; + private String realNumber = ""; + private int num = 0;// ż + + private void getBomline(TCComponentBOMLine bomline, String realNumber_0) { + AIFComponentContext[] childline = null; + String materialCode = "";// ϱ + String materialName = "";// + String techCode = "";// ͺ + String specCode = "";// ͺ + String quantity = "";// + String unit = "";// λ + String drawID = "";// ͼ + String global_list="";//ȫ + String local_list="";//ֲ + int number_0 = 0; + try { + childline = bomline.getChildren(); + for (int i = 0; i < childline.length; i++) { + number_0++; + bean = new exportBOM_Bean(); + if (!bomline.getTCProperty("bl_formatted_parent_name") + .getStringValue().equals("")) { + if (i > 0) { + realNumber_0 = realNumber_0.substring(0, + realNumber_0.lastIndexOf(".") + 1) + + number_0; + + } else { + realNumber_0 = realNumber_0 + "." + number_0; + + } + } else { + realNumber_0 = number_0 + ""; + + } + bean.setNumber(realNumber_0); + child = (TCComponentBOMLine) childline[i].getComponent(); + materialCode = child.getItemRevision().getTCProperty("item_id") + .getStringValue() + + "/" + + child.getItemRevision() + .getTCProperty("current_revision_id") + .getStringValue(); + bean.setMaterialCode(materialCode); + System.out.println(materialCode + "------------" + + realNumber_0); + materialName = child.getItemRevision() + .getTCProperty("object_name").getStringValue(); + bean.setMaterialName(materialName); + TCComponentForm form = (TCComponentForm) child + .getItemRevision().getReferenceListProperty( + "IMAN_master_form_rev")[0]; + techCode = form.getTCProperty("jk8TechModel").getStringValue(); + bean.setTechCode(techCode); + specCode = form.getTCProperty("jk8SpecModel").getStringValue(); + bean.setSpecCode(specCode); + quantity = child.getTCProperty("bl_quantity").getStringValue(); + bean.setQuantity(quantity); + unit = child.getProperty("bl_uom"); + bean.setUnit(unit); + + TCComponent[] components = child.getItemRevision() + .getReferenceListProperty("TC_Is_Represented_By"); + for (int j = 0; j < components.length; j++) { + drawID = drawID + + ((TCComponentItemRevision) components[j]) + .getTCProperty("item_id").getStringValue() + + ";"; + + } + drawID = drawID.trim(); + bean.setDrawID(drawID); + //2018.3.21ȫֺ;ֲ + TCComponent[] substituteComponents=child.getItem().getTCProperty("global_alt_list").getReferenceValueArray();//TODO + if(substituteComponents.length==0) { + global_list=""; + }else if(substituteComponents.length>0) { + global_list=""; + for (int j = 0; j < substituteComponents.length; j++) { + String id=""; + try { + id=((TCComponentItem)substituteComponents[j]).getTCProperty("item_id").getStringValue(); + } catch (Exception e) { + // TODO Auto-generated catch block + id=((TCComponentBOMView)substituteComponents[j]).getTCProperty("object_name").getStringValue().split("-")[0]; + e.printStackTrace(); + } + global_list=global_list+id+","; + } + } + if(global_list.length()>=1) { + + global_list=global_list.trim(); + global_list=global_list.substring(0, global_list.length()-1); + } + + bean.setGlobal_list(global_list); + + substituteComponents=child.getTCProperty("bl_substitute_list").getReferenceValueArray(); + if(substituteComponents.length==0) { + local_list=""; + }else if(substituteComponents.length>0) { + local_list=""; + for (int j = 0; j < substituteComponents.length; j++) { + String id=""; + try { + id=((TCComponentItem)substituteComponents[j]).getTCProperty("item_id").getStringValue(); + } catch (Exception e) { + // TODO Auto-generated catch block + id=((TCComponentBOMView)substituteComponents[j]).getTCProperty("object_name").getStringValue().split("-")[0]; + e.printStackTrace(); + } + local_list=local_list+id+","; + } + } + if(local_list.length()>=1) { + + local_list=local_list.trim(); + local_list=local_list.substring(0, local_list.length()-1); + } + + bean.setLocal_list(local_list); + + + + + list.add(bean); + if (child.getChildren().length > 0) { + getBomline(child, realNumber_0); + } + + } + } catch (TCException e) { + e.printStackTrace(); + } + + } + + private File getExcel(String ssx) { + File file = null; + preferenceService = session.getPreferenceService(); + String puid = preferenceService.getStringValue(ssx); + if (puid == null) { + MessageBox.post("ϵԱѡ", "", MessageBox.ERROR); + return null; + } + TCComponentDataset dataset = null; + try { + dataset = (TCComponentDataset) session.stringToComponent(puid); + } catch (TCException e) { + e.printStackTrace(); + } + if (dataset == null) { + MessageBox.post("ݼڣϵԱѡ", "", MessageBox.ERROR); + return null; + } + try { + TCComponentTcFile[] files = dataset.getTcFiles(); + if (files.length == 0) { + MessageBox.post("ݼûõļ,", "", MessageBox.ERROR); + return null; + } else if (files.length > 1) { + MessageBox.post("ݼõļ", "", MessageBox.ERROR); + return null; + } else { + file = files[0].getFmsFile(); + } + } catch (TCException e) { + e.printStackTrace(); + } + + return file; + } + +} diff --git a/src/com/connor/jk/plm/exportBOM20200221/exportHardwareBOM_Bean.java b/src/com/connor/jk/plm/exportBOM20200221/exportHardwareBOM_Bean.java new file mode 100644 index 0000000..f6c9c0f --- /dev/null +++ b/src/com/connor/jk/plm/exportBOM20200221/exportHardwareBOM_Bean.java @@ -0,0 +1,82 @@ +package com.connor.jk.plm.exportBOM20200221; + +public class exportHardwareBOM_Bean { + private String materialCode;//ϱ룻2017.10.17ϱijid+汾 + private String materialName;// + private String ref_designator;//λ + private String specCode;//ͺ + private String quantity;// + private String unit;//λ + private String packaging;//װ + private String comment;//comment + public String getComment() { + return comment; + } + public void setComment(String comment) { + this.comment = comment; + } + private String number; + + private String global_bl_substitute_list;//2017.10.18 + private String local_bl_substitute_list;//2018.3.19ԭϸΪֲϺȫ + public String getGlobal_bl_substitute_list() { + return global_bl_substitute_list; + } + public void setGlobal_bl_substitute_list(String global_bl_substitute_list) { + this.global_bl_substitute_list = global_bl_substitute_list; + } + public String getLocal_bl_substitute_list() { + return local_bl_substitute_list; + } + public void setLocal_bl_substitute_list(String local_bl_substitute_list) { + this.local_bl_substitute_list = local_bl_substitute_list; + } + public String getNumber() { + return number; + } + public void setNumber(String number) { + this.number = number; + } + public String getMaterialCode() { + return materialCode; + } + public void setMaterialCode(String materialCode) { + this.materialCode = materialCode; + } + public String getMaterialName() { + return materialName; + } + public void setMaterialName(String materialName) { + this.materialName = materialName; + } + public String getRef_designator() { + return ref_designator; + } + public void setRef_designator(String ref_designator) { + this.ref_designator = ref_designator; + } + public String getSpecCode() { + return specCode; + } + public void setSpecCode(String specCode) { + this.specCode = specCode; + } + public String getQuantity() { + return quantity; + } + public void setQuantity(String quantity) { + this.quantity = quantity; + } + public String getUnit() { + return unit; + } + public void setUnit(String unit) { + this.unit = unit; + } + public String getPackaging() { + return packaging; + } + public void setPackaging(String packaging) { + this.packaging = packaging; + } +} diff --git a/src/com/connor/jk/plm/exportBOM20200221/exportHardwareBOM_Operation.java b/src/com/connor/jk/plm/exportBOM20200221/exportHardwareBOM_Operation.java new file mode 100644 index 0000000..2a91de8 --- /dev/null +++ b/src/com/connor/jk/plm/exportBOM20200221/exportHardwareBOM_Operation.java @@ -0,0 +1,1110 @@ +package com.connor.jk.plm.exportBOM20200221; + +import java.awt.Color; +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.List; + +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.IndexedColors; +import org.apache.poi.ss.util.CellRangeAddress; +import org.apache.poi.xssf.usermodel.XSSFCell; +import org.apache.poi.xssf.usermodel.XSSFCellStyle; +import org.apache.poi.xssf.usermodel.XSSFFont; +import org.apache.poi.xssf.usermodel.XSSFRow; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + +import com.connor.jk.plm.exportBOM.ProgressBarThread; +import com.jacob.activeX.ActiveXComponent; +import com.jacob.com.ComThread; +import com.jacob.com.Dispatch; +import com.jacob.com.Variant; +import com.teamcenter.rac.aif.AbstractAIFOperation; +import com.teamcenter.rac.aif.kernel.AIFComponentContext; + +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentBOMLine; +import com.teamcenter.rac.kernel.TCComponentBOMView; +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.TCComponentTcFile; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.kernel.ics.ICSProperty; +import com.teamcenter.rac.util.MessageBox; + +public class exportHardwareBOM_Operation extends AbstractAIFOperation { + private String text; + private String path; + private ProgressBarThread wait; + private TCSession session; + private TCComponentBOMLine comp; + private FileInputStream fis; + private XSSFWorkbook workbook; + private FileOutputStream out; + private TCPreferenceService preferenceService; + private List list = new ArrayList<>(); + private exportHardwareBOM_Bean bean; + private TCComponentBOMLine child; + private String jbName = "";// + private String SBH = "";// ʶ + private String selectExportFileType; + private int completeCount; + private int allCount; + + public exportHardwareBOM_Operation(String text, String path, TCSession session, + TCComponentBOMLine comp,String selectExportFileType, int i, int allCount) { + this.text = text; + this.path = path; + // this.wait = wait; + this.session = session; + this.comp = comp; + this.selectExportFileType=selectExportFileType; + this.completeCount = i; + this.allCount = allCount; + wait = new ProgressBarThread("BOM嵥", "ִУԵ..."); + wait.start(); + } + + Integer[] keys = null; + String[] vals = null; + private String realNumber = ""; + @Override + public void executeOperation() throws Exception { + + //ץȡfnd0ActuatedInteractiveTsks fnd0Performer fnd0EndDate fnd0AliasTaskName + String name1="";// + String name2="";// + String name3="";//׼ + TCComponent[] component=comp.getItemRevision().getTCProperty("fnd0ActuatedInteractiveTsks").getReferenceValueArray(); +// System.out.println(component.length); + for (int i = 0; i < component.length; i++) { + // + if(component[i].getTCProperty("fnd0AliasTaskName").getStringValue().contains("")) { + name1=component[i].getTCProperty("fnd0Performer").getDisplayValue().split("\\(")[0]; + name1=name1+"/"+component[i].getTCProperty("fnd0EndDate").getDisplayValue(); + }else if(component[i].getTCProperty("fnd0AliasTaskName").getStringValue().contains("")) { + name2=component[i].getTCProperty("fnd0Performer").getDisplayValue().split("\\(")[0]; + name2=name2+"/"+component[i].getTCProperty("fnd0EndDate").getDisplayValue(); + }else if(component[i].getTCProperty("fnd0AliasTaskName").getStringValue().contains("׼")) { + name3=component[i].getTCProperty("fnd0Performer").getDisplayValue().split("\\(")[0]; + name3=name3+"/"+component[i].getTCProperty("fnd0EndDate").getDisplayValue(); + } + } + +// if(true) { +// return; +// } + long start = System.currentTimeMillis(); + int colsCount = 17;//2017.10.18һ 2017.10.26һcomment2018.3.19һ + // ȡ + TCComponentItemRevision itemRevision = comp.getItemRevision(); + String ck=itemRevision.getProperty("item_id")+"/"+itemRevision.getProperty("item_revision_id"); + TCComponentICO[] icoS = itemRevision.getClassificationObjects(); + + int count = 0; + int count1 = 0; + System.out.println("з--------------"+icoS.length); + for (int i = 0; i < icoS.length; i++) { + String revId=icoS[i].getProperty("id"); + ICSProperty[] cPropS = icoS[i].getICSProperties(true); + + System.out.println("з--------"+ cPropS.length); + for (int j = 0; j < cPropS.length; j++) { +// System.out.println(count); + count++; + } + keys = new Integer[count]; + vals = new String[count]; + for (int j = 0; j < cPropS.length; j++) { +// System.out.println(count); + keys[count1] = cPropS[j].getId(); + System.out.println("keys[" + count1 + "]================>" + keys[count1]); + vals[count1] = cPropS[j].getValue(); + System.out.println("vals[" + count1 + "]================>" + vals[count1]); + if (keys[count1] == 1050) {//keys[count1] == -500293 2021/1/5Ǩƺid + if(revId.equals(ck)) { + + jbName = vals[count1]; + System.out.println("jbName="+jbName); + } + + } else if (keys[count1] == 50205015) { // keys[count1] == -500301 2021/1/5Ǩƺid + if(revId.equals(ck)) { + + SBH = vals[count1]; + System.out.println("SBH="+SBH); + } + + } + count1++; + } + + } + String sxx = "jk_bom2_uid";// G8TlM0X6YvbLjA G8TlM0X6YvbLjA TJXl8kmSYvbLjA + File file = getExcel(sxx); + if (file == null) { + return; + } + getBomline(comp,realNumber);//ȡ + System.out.println("BOM" + list.size() + ""); + int rowCount = list.size(); + fis = new FileInputStream(file); + workbook = new XSSFWorkbook(fis); + //һе + XSSFFont font2 = workbook.createFont(); + font2.setFontName(""); + font2.setFontHeightInPoints((short) 11);// С + //ƣλŵȵʽ + XSSFFont font4 = workbook.createFont(); + font4.setFontName(""); + font4.setFontHeightInPoints((short) 10);// С + //Bŵ + XSSFFont font = workbook.createFont(); + font.setFontName("΢ź"); + font.setFontHeightInPoints((short) 9);// С + + XSSFSheet sheet = workbook.getSheet("Ӳ嵥"); + XSSFRow row = sheet.getRow(1); + XSSFCell cell_0 = row.getCell(3); + cell_0.setCellValue(comp.getItemRevision().getTCProperty("item_id").getStringValue()); + cell_0 = row.getCell(12); + cell_0.setCellValue(comp.getItemRevision().getTCProperty("item_revision_id").getStringValue()); + row = sheet.getRow(2); + cell_0 = row.getCell(3); + System.out.println("------------"+jbName); + cell_0.setCellValue(jbName); + cell_0 = row.getCell(12); + cell_0.setCellValue(SBH); + row = sheet.getRow(4); + cell_0 = row.getCell(3); + Date date=new Date(); + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); + String time= sdf.format(date); + time=time.replace("-", "."); + cell_0.setCellValue(time);//Ч + int startRow = 6; + + XSSFCellStyle sty = workbook.createCellStyle();// ½Ԫĸʽ + XSSFCellStyle style = workbook.createCellStyle();// Cϱ뵥Ԫĸʽ + XSSFCellStyle sty2 = workbook.createCellStyle();//BеԪʽ + sty2.setBorderBottom((short) 1); + sty2.setBorderLeft((short) 2); + sty2.setBorderRight((short) 1); + sty2.setBorderTop((short) 1); + sty2.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER); + sty2.setFont(font); + //P7ĸʽ + XSSFCellStyle styP7 = workbook.createCellStyle();//BеԪʽ + styP7.setBorderBottom((short) 1); + styP7.setBorderLeft((short) 1); + styP7.setBorderRight((short) 1); + styP7.setBorderTop((short) 2); + styP7.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER); + styP7.setFont(font); + + XSSFCellStyle sty3 = workbook.createCellStyle();// QбעԪĸʽ + XSSFCellStyle sty4 = workbook.createCellStyle();// кһеĸʽ + XSSFCellStyle sty5 = workbook.createCellStyle();// һעĸʽ + sty5.setBorderTop((short) 2); + sty5.setBorderRight((short) 2); + XSSFCellStyle sty6 = workbook.createCellStyle();// ˵Ԫĸʽ + XSSFCellStyle sty7 = workbook.createCellStyle();// /ڵԪĸʽ + + sty6.setBorderTop((short) 1); + sty6.setBorderBottom((short) 2); + sty6.setBorderLeft((short) 2); + sty6.setBorderRight((short) 1); + + sty7.setBorderLeft((short) 1); + sty7.setBorderBottom((short) 2); + sty7.setBorderRight((short) 2); + sty7.setBorderTop((short) 1); + + sty.setBorderBottom((short) 1); + sty.setBorderLeft((short) 1); + sty.setBorderRight((short) 1); + sty.setBorderTop((short) 1); + sty.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER);// ֱ + sty.setAlignment(XSSFCellStyle.ALIGN_LEFT);// ˮƽ + + style.setBorderBottom(CellStyle.BORDER_THIN); + style.setBorderTop((short) 1); + style.setAlignment(XSSFCellStyle.ALIGN_CENTER); // + style.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER); // + style.setFont(font); + + sty3.setBorderBottom((short) 1); + sty3.setBorderLeft((short) 1); + sty3.setBorderRight((short) 2); + sty3.setBorderTop((short) 1); + sty4.setBorderTop((short)1); + sty4.setBorderBottom((short)2); + sty4.setBorderLeft((short)1); + sty4.setBorderRight((short)1); + + sty4.setFont(font2); + sty4.setAlignment(XSSFCellStyle.ALIGN_CENTER); + for (int i = 0; i < rowCount + 7; i++) { + XSSFRow r = null; + boolean isCreate = false; +// System.out.println("sheet.getLastRowNum()-------->" + sheet.getLastRowNum()); + if ((i + startRow) > sheet.getLastRowNum()) { + r = sheet.createRow(i + startRow); + isCreate = true; + } else { + r = sheet.getRow(i + startRow); + isCreate = false; + } + if (i < rowCount + 3 && isCreate) { + + CellRangeAddress cra = new CellRangeAddress(i + startRow, i + startRow, 8, 9); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(i + startRow, i + startRow, 6, 7); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(i + startRow, i + startRow, 4, 5); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(i + startRow, i + startRow, 2, 3); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(i + startRow, i + startRow, 12,13);//2017.10.26 + sheet.addMergedRegion(cra); + } + + for (int cols = 1; cols < colsCount; cols++) { + XSSFCell cell = null; + if (isCreate) { + cell = r.createCell(cols); + + cell.setCellStyle(sty); + if (cols == 1) { + cell.setCellStyle(sty2); + } else if (cols == 16) { + cell.setCellStyle(sty3); + } + // TODO ʽ + } else { +// if (r == null) { +// r = sheet.createRow(i + startRow); +// System.out.println("ûд"); +// } + cell = r.getCell(cols); + } + if (cell == null) { + // cell = r.createCell(cols); + // cell.setCellStyle(sty); + } + + cell.setCellType(XSSFCell.CELL_TYPE_STRING);// ıʽ + + // XSSFCellStyle sty0=sheet.getRow(9).getCell(11).getCellStyle(); + //и + if (i < rowCount) { + int rwsTemp = list.get(i).getSpecCode().length()/2+1; //ͺ + int rwsTemp1 = list.get(i).getRef_designator().length()/3+1;//λ + int rwsTemp2 = list.get(i).getPackaging().length()/2+1; //װ + int rwsTemp3 = list.get(i).getGlobal_bl_substitute_list().length()/3+1; // + int rwsTemp4 = list.get(i).getLocal_bl_substitute_list().length()/3+1; // + int rwsTemp5 = list.get(i).getComment().length()/3+1; //comment + int rwsTemp6= list.get(i).getMaterialName().length()/2+1; // + + int temp; + + int a[]=new int[]{rwsTemp,rwsTemp1,rwsTemp2,rwsTemp3,rwsTemp4,rwsTemp5,rwsTemp6}; + Arrays.sort(a); + for(int i1=0;i1"+a[i1]); + } + temp=a[6]; + + cell.getCellStyle().setWrapText(true); +// r.setHeight((short)(temp * 110-(temp-1)*20)); + r.setHeight((short)(temp * 100)); + } + if (i < rowCount) { + + switch (cols) { + case 1:// + if (list.get(i) == null) { + // this.wait.setBool(true); + // this.wait.interrupt(); + // MessageBox.post("BOM嵥Ϊ", "", MessageBox.INFORMATION); + return; + } else { + + if (i > 0) { + cell.setCellStyle(sty2); + + } + cell.setCellValue(list.get(i).getNumber()); + System.out.println(list.get(i).getNumber()); + break; + } + + case 2:// ϱ + // if(i>2) { + // sty0=sheet.getRow(9).getCell(cols).getCellStyle(); + // cell.setCellStyle(sty0); + // } + if (i >= 2) { + cell.setCellStyle(style); + + } + + cell.setCellValue(list.get(i).getMaterialCode());// д + break; + case 4:// + cell.getCellStyle().setFont(font4); + cell.getCellStyle().setAlignment(CellStyle.ALIGN_LEFT); + cell.setCellValue(list.get(i).getMaterialName()); + break; + case 6:// ͺ + cell.getCellStyle().setFont(font4); + cell.setCellValue(list.get(i).getRef_designator()); +// System.out.println("λ-------------"+list.get(i).getRef_designator()); + break; + case 8:// ͺ + cell.getCellStyle().setFont(font4); + cell.setCellValue(list.get(i).getSpecCode()); + + // cell.setCellStyle(styG); + break; + + //2017.10.26 Comment + case 10:// Comment + cell.getCellStyle().setFont(font4); + cell.setCellType(Cell.CELL_TYPE_STRING); + cell.setCellValue(list.get(i).getComment()); + break; + case 11:// + cell.getCellStyle().setFont(font4); + cell.setCellType(Cell.CELL_TYPE_STRING); + cell.setCellValue(list.get(i).getQuantity()); +// System.out.println("--------------->"+list.get(i).getQuantity()); + break; + case 12:// װ + cell.getCellStyle().setFont(font4); + cell.getCellStyle().setAlignment(CellStyle.ALIGN_LEFT); + cell.setCellValue(list.get(i).getPackaging()); + break; + case 14:// ȫ + cell.setCellValue(list.get(i).getGlobal_bl_substitute_list()); + break; + case 15:// ֲ + cell.setCellValue(list.get(i).getLocal_bl_substitute_list()); + break; + case 16:// ע + cell.setCellStyle(sty3); + break; + } + } + } + } + XSSFCell cell14=sheet.getRow(6).getCell(16); + cell14.setCellStyle(sty5); + + + // һеĵ±߿ + XSSFCell cellLast = null; + for (int cols = 1; cols < colsCount; cols++) { + cellLast = sheet.getRow(startRow + rowCount + 6).getCell(cols); + switch (cols) { + case 1:// + cellLast.setCellValue("/"); + cellLast.setCellStyle(sty2); + break; + case 2:// + + cellLast.setCellStyle(sty4); + break; + case 3:// + cellLast.setCellValue("/"); + cellLast.setCellStyle(sty4); + break; + case 4:// + + cellLast.setCellStyle(sty4); + break; + case 5:// + cellLast.setCellValue("׼/"); + cellLast.setCellStyle(sty4); + break; + case 6:// + + cellLast.setCellStyle(sty4); + break; + case 7:// + cellLast.setCellValue("ĵ"); + cellLast.setCellStyle(sty4); + break; + case 8:// + + cellLast.setCellStyle(sty4); + break; + case 9:// + cellLast.setCellValue(""); + cellLast.setCellStyle(sty4); + break; + case 10:// + cellLast.setCellStyle(sty4); + break; + case 11:// + cellLast.setCellValue(""); + cellLast.setCellStyle(sty4); + break; + case 12:// + cellLast.setCellValue("/"); + + cellLast.setCellStyle(sty4); + break; + case 13:// + + cellLast.setCellStyle(sty4); + break; + case 14:// + + cellLast.setCellStyle(sty4); + break; + case 15:// + + cellLast.setCellStyle(sty4); + break; + case 16:// ע + + cellLast.setCellStyle(sty3); + break; + } + } + // һеԪɫ߿ + for (int i = startRow + rowCount+6; i < startRow + rowCount + 7; i++) { + XSSFCell cell = null; + for (int cols = 1; cols < colsCount; cols++) { + cell = sheet.getRow(i).getCell(cols); + switch (cols) { + case 1:// + + cell.setCellStyle(sty6); + break; + + case 16:// ע + + if (i > 0) { + + cell.setCellStyle(sty7); + } + break; + } + } + } + // ϲǩĵԪ + CellRangeAddress cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + 5, 1, 2); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + 5, 3, 4); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + 5, 5, 6); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + 5, 7, 8); + sheet.addMergedRegion(cra); + //2017.10.26 ϲ910 + cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + 5, 9, 10); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + 5, 11, 11); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + 5, 12, 16); + sheet.addMergedRegion(cra); + // ϲһ + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + 6, 1, 2); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + 6, 3, 4); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + 6, 5, 6); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + 6, 7, 8); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + 6, 9, 10); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + 6, 12, 16); + sheet.addMergedRegion(cra); + // õеĵ±߿ + XSSFCell cell5 = null; + for (int cols = 1; cols < colsCount; cols++) { + cell5 = sheet.getRow(startRow + rowCount + 2).getCell(cols); + switch (cols) { + + case 1:// + + cell5.setCellStyle(sty4); + break; + case 2:// + + cell5.setCellStyle(sty4); + break; + case 3:// + + cell5.setCellStyle(sty4); + break; + case 4:// + + cell5.setCellStyle(sty4); + break; + case 5:// + + cell5.setCellStyle(sty4); + break; + case 6:// + + cell5.setCellStyle(sty4); + break; + case 7:// + + cell5.setCellStyle(sty4); + break; + case 8:// + + cell5.setCellStyle(sty4); + break; + case 9:// + + cell5.setCellStyle(sty4); + break; + case 10:// + + cell5.setCellStyle(sty4); + break; + case 11:// + + cell5.setCellStyle(sty4); + break; + case 12:// + + cell5.setCellStyle(sty4); + break; + case 13:// + + cell5.setCellStyle(sty4); + break; + case 14:// ע + + cell5.setCellStyle(sty4); + break; + case 15:// ע + + cell5.setCellStyle(sty4); + break; + case 16:// ע + + cell5.setCellStyle(sty4); + break; + } + } + + XSSFCell cell0=sheet.getRow(startRow + rowCount + 2).getCell(1); + cell0.setCellStyle(sty6);//5еԪA + + cell0=sheet.getRow(startRow + rowCount + 2).getCell(16); + cell0.setCellStyle(sty7);//5еԪQ + + XSSFCell cell1=sheet.getRow(startRow + rowCount + 4).getCell(1); + cell1.setCellStyle(sty6); + cell1=sheet.getRow(startRow + rowCount + 4).getCell(16); + cell1.setCellStyle(sty7); + +// XSSFRow row1=sheet.getRow(startRow + rowCount + 3); +// row1.getCell(1).getCellStyle().getFont().setFontHeightInPoints((short) 10); +// row1.getCell(1).getCellStyle().getFont().setFontName("Tahoma"); + XSSFCell cell2=sheet.getRow(startRow + rowCount + 3).getCell(1);//4AԪĸʽ + cell2.getCellStyle().getFont().setFontHeightInPoints((short) 10); + cell2.getCellStyle().getFont().setFontName(""); + cell2.setCellValue(name1);// + cell2=sheet.getRow(startRow + rowCount + 3).getCell(3); + cell2.setCellValue(name2);// + cell2=sheet.getRow(startRow + rowCount + 3).getCell(5); + cell2.setCellValue(name3);//׼ + + + cell2 = sheet.getRow(startRow + rowCount + 3).getCell(1); + cell2.getCellStyle().setAlignment((short) 1); + cell2.getCellStyle().setVerticalAlignment((short) 1); + cell2.getCellStyle().setWrapText(true);//Զ +// cell2.getCellStyle().setFont(font3); + + + sheet.getRow(startRow + rowCount + 6).setHeight((short)402);//һеĸ߶ + cellLast = sheet.getRow(startRow + rowCount + 6).getCell(1); + cellLast.getCellStyle().setAlignment(CellStyle.ALIGN_LEFT); + cellLast.getCellStyle().setVerticalAlignment(CellStyle.VERTICAL_CENTER); + cellLast = sheet.getRow(startRow + rowCount + 6).getCell(3); + cellLast.getCellStyle().setAlignment(CellStyle.ALIGN_LEFT); + cellLast.getCellStyle().setVerticalAlignment(CellStyle.VERTICAL_CENTER); + + cellLast = sheet.getRow( 6).getCell(2); + cellLast.getCellStyle().setAlignment(CellStyle.ALIGN_CENTER); + cellLast = sheet.getRow( 7).getCell(2); + cellLast.getCellStyle().setAlignment(CellStyle.ALIGN_CENTER); + + sheet.getRow(6).getCell(15).setCellStyle(styP7); + + + // 2017.11.21 Ȱصû·£ȻתΪpdf + //ѡ񵼳pdf + File fileout; + String usrHome = System.getProperty("user.home"); +// System.out.println("usrHome=" + usrHome); + String excelPath=path + "\\" + text + ".xlsx"; + if(selectExportFileType.equals("Excel")) { + excelPath=judge2(excelPath); + + fileout = new File(excelPath); + }else { + fileout = new File(usrHome + "\\" + text + ".xlsx"); + } + +// File fileout = new File(path + "\\" + type + ".xlsx"); +// File fileout = new File(usrHome + "\\" + type + ".xlsx"); + try { + out = new FileOutputStream(fileout); + } catch (Exception e) { + // this.wait.setBool(true); + // this.wait.interrupt(); + // MessageBox.post("ȹرͬļ", "", MessageBox.INFORMATION); + return; + // e.printStackTrace(); + } + workbook.write(out); + // תpdf + String inFilePath = path + "\\" + text + ".xlsx"; +// String inFilePath = usrHome + "\\" + type + ".xlsx"; + String outFilePath = path + "\\" + text + ".pdf"; + try { + if(!selectExportFileType.equals("Excel")) { + //תpdf + System.out.println("------תpdf"); + inFilePath = usrHome + "\\" + text + ".xlsx"; + outFilePath=judge(outFilePath); + xlsToPdf(inFilePath, outFilePath); + deletePdf(inFilePath); + long end = System.currentTimeMillis(); + float time2 = (end - start) / 1000.00f; + System.out.println("ʱ" + time2 + ""); + // this.wait.setBool(true); + // this.wait.interrupt(); + /* if(rename2==false) { + MessageBox.post("Ѿ", "ɹ", MessageBox.INFORMATION); + }else { + MessageBox.post("ѾԭļѴڣļΪ:\n"+outFilePath.substring(outFilePath.lastIndexOf("\\")+1,outFilePath.length()), "ɹ", MessageBox.INFORMATION); + + } + Runtime.getRuntime().exec(new String[] { "cmd.exe", "/c", outFilePath });*/ + }else { + long end = System.currentTimeMillis(); + float time2 = (end - start) / 1000.00f; + System.out.println("ʱ" + time2 + ""); + /* this.wait.setBool(true); + this.wait.interrupt(); + if(rename2==false) { + MessageBox.post("Ѿ", "ɹ", MessageBox.INFORMATION); + }else { + MessageBox.post("ѾԭļѴڣļΪ:\n"+excelPath.substring(excelPath.lastIndexOf("\\")+1,excelPath.length()), "ɹ", MessageBox.INFORMATION); + + } + Runtime.getRuntime().exec(new String[] { "cmd.exe", "/c", excelPath });*/ + } + } catch (Exception e) { + // TODO: handle exception + }finally{ + wait.setBool(true); + wait.interrupt(); + } + + if(completeCount == allCount -1 ){ + MessageBox.post("Ѿ", "ɹ", MessageBox.INFORMATION); + } + + + // 2017.11.21 Ȱصû·£ȻתΪpdf +// String usrHome = System.getProperty("user.home"); +// System.out.println("usrHome=" + usrHome); + +// File fileout = new File(path + "\\" + text + ".xlsx"); +//// File fileout = new File(usrHome + "\\" + text + ".xlsx"); +// try { +// out = new FileOutputStream(fileout); +// } catch (Exception e) { +// this.wait.setBool(true); +// this.wait.interrupt(); +// MessageBox.post("ȹرͬļ","",MessageBox.INFORMATION); +// return; +// } +// workbook.write(out); +// // תpdf +// String inFilePath = path + "\\" + text + ".xlsx"; +//// String inFilePath = usrHome + "\\" + text + ".xlsx"; +// String outFilePath = path + "\\" + text + ".pdf"; +// // deletePdf(outFilePath);//ɾѾڵpdf,Ҫ޸ļ +// outFilePath=judge(outFilePath); +// System.out.println(System.getProperty("java.library.path")); +// xlsToPdf(inFilePath, outFilePath); +//// deletePdf(inFilePath); +// long end = System.currentTimeMillis(); +// float time2 = (end - start) / 1000.00f; +// System.out.println("ʱ" + time2 + ""); +//// System.out.println("汾----------------------->"+comp.getItemRevision().getTCProperty("item_revision_id").getStringValue()); +// this.wait.setBool(true); +// this.wait.interrupt(); +// if(rename2==false) { +// MessageBox.post("Ѿ", "ɹ", MessageBox.INFORMATION); +// }else { +// MessageBox.post("ѾԭļѴڣļΪ:\n"+outFilePath.substring(outFilePath.lastIndexOf("\\")+1,outFilePath.length()), "ɹ", MessageBox.INFORMATION); +// +// } +// Runtime.getRuntime().exec(new String[] { "cmd.exe", "/c", outFilePath });// +// System.out.println("2017.11.2"); + } + private String judge2(String outFilePath) { + rename=false; + File pdfFile = new File(outFilePath); + if (pdfFile.exists()) { + String name=outFilePath.split("\\.xlsx")[0]; + outFilePath = name + "(1).xlsx"; + rename=true; + rename2=true; + } + if(rename==true) { + outFilePath=judge2(outFilePath); + } + return outFilePath; + + } + //жͬpdfǷѾ + boolean rename=false; + boolean rename2=false; + private String judge(String outFilePath) { + rename=false; + + File pdfFile = new File(outFilePath); + if (pdfFile.exists()) { + String name=outFilePath.split("\\.pdf")[0]; + outFilePath = name + "(1).pdf"; + rename=true; + rename2=true; + } + if(rename==true) { + outFilePath=judge(outFilePath); + } + return outFilePath; + + } + // EXCELתPDF + public String xlsToPdf(String inFilePath, String outFilePath) { + ComThread.InitSTA(true); + + ActiveXComponent ax = new ActiveXComponent("Excel.Application"); + try { + ax.setProperty("Visible", new Variant(false)); + ax.setProperty("AutomationSecurity", new Variant(3)); // ú + Dispatch excels = ax.getProperty("Workbooks").toDispatch(); + + Dispatch excel = Dispatch + .invoke(excels, "Open", Dispatch.Method, + new Object[] { inFilePath, new Variant(false), new Variant(false) }, new int[9]) + .toDispatch(); + // תʽ + Dispatch.invoke(excel, "ExportAsFixedFormat", Dispatch.Method, new Object[] { new Variant(0), // PDFʽ=0 + outFilePath, new Variant(0) // 0=׼ (ɵPDFͼƬģ) 1=Сļ (ɵPDFͼƬһͿ) + }, new int[1]); + + // ʹSaveAs + /* + * Dispatch.invoke(excel,"SaveAs",Dispatch.Method,new Object[]{ outFile, new + * Variant(57), new Variant(false), new Variant(57), new Variant(57), new + * Variant(false), new Variant(true), new Variant(57), new Variant(true), new + * Variant(true), new Variant(true) },new int[1]); + */ + +// Dispatch.call(excel, "Close", false); + + if (ax != null) { + ax.invoke("Quit", new Variant[] {}); + ax = null; + } + ComThread.Release(); + return ""; + } catch (Exception es) { + return es.toString(); + } + } + + /** + * PDFɾPDF + * + * @param pdfPath + */ + private void deletePdf(String pdfPath) { + File pdfFile = new File(pdfPath); + if (pdfFile.exists()) { + pdfFile.delete(); + } + } + + private File getExcel(String ssx) { + File file = null; + preferenceService = session.getPreferenceService(); + String puid = preferenceService.getStringValue(ssx); + if (puid == null) { + MessageBox.post("ϵԱѡ", "", MessageBox.ERROR); + return null; + } + TCComponentDataset dataset = null; + try { + dataset = (TCComponentDataset) session.stringToComponent(puid); + } catch (TCException e) { + e.printStackTrace(); + } + if (dataset == null) { + MessageBox.post("ݼڣϵԱѡ", "", MessageBox.ERROR); + return null; + } + try { + TCComponentTcFile[] files = dataset.getTcFiles(); + if (files.length == 0) { + MessageBox.post("ݼûõļ,", "", MessageBox.ERROR); + return null; + } else if (files.length > 1) { + MessageBox.post("ݼõļ", "", MessageBox.ERROR); + return null; + } else { + file = files[0].getFmsFile(); + } + } catch (TCException e) { + e.printStackTrace(); + } + + return file; + } + + + private void getBomline(TCComponentBOMLine bomline, String realNumber_0) { + AIFComponentContext[] childline = null; + String materialCode = "";// ϱ + String materialName = "";// + String specCode = "";// ͺ + String quantity = "";// + String unit = "";// λ + String ref_designator = "";// λ + String packaging = "";// װ + String comment="";//comment + String bl_substitute_list="";//(ȫֺ;ֲ) + int number_0 = 0; + try { + childline = bomline.getChildren(); + for (int i = 0; i < childline.length; i++) { + + number_0++; + bean = new exportHardwareBOM_Bean(); + if (!bomline.getTCProperty("bl_formatted_parent_name").getStringValue().equals("")) { + if (i > 0) { + realNumber_0 = realNumber_0.substring(0, realNumber_0.lastIndexOf(".") + 1) + number_0; + + } else { + realNumber_0 = realNumber_0 + "." + number_0; + + } + } else { + realNumber_0 = number_0 + ""; + + } + bean.setNumber(realNumber_0); + + child = (TCComponentBOMLine) childline[i].getComponent(); + //2017.10.17ϱԸij"/汾" + materialCode = child.getItemRevision().getTCProperty("item_id").getStringValue()+"/"+ child.getItemRevision().getTCProperty("current_revision_id").getStringValue(); + bean.setMaterialCode(materialCode); + materialName = child.getItemRevision().getTCProperty("object_name").getStringValue(); + bean.setMaterialName(materialName); + packaging = ""; + comment=""; + TCComponentICO[] icoS = child.getItemRevision().getClassificationObjects(); + int count = 0; + int count1 = 0; + for (int j = 0; j < icoS.length; j++) { + ICSProperty[] cPropS = icoS[j].getICSProperties(true); + for (int k = 0; k < cPropS.length; k++) { +// System.out.println(count); + count++; + } + keys = new Integer[count]; + vals = new String[count]; + for (int k = 0; k < cPropS.length; k++) { +// System.out.println(count); + keys[count1] = cPropS[k].getId(); + System.out.println("keys[" + count1 + "]================>" + keys[count1]); + vals[count1] = cPropS[k].getValue(); + System.out.println("vals[" + count1 + "]================>" + vals[count1]); + if (keys[count1] == 1066) {//keys[count1] == -500242 2021/1/5Ǩƺid + packaging = vals[count1]; + System.out.println("packaging="+packaging); + + } + if (keys[count1] == 1000) {//keys[count1] == -500239 2021/1/5Ǩƺid + comment = vals[count1]; + System.out.println("comment="+comment); + + } + count1++; + } + + } + + bean.setPackaging(packaging); + bean.setComment(comment); + TCComponentForm form = (TCComponentForm) child.getItemRevision() + .getReferenceListProperty("IMAN_master_form_rev")[0]; + // techCode = form.getTCProperty("jk8TechModel").getStringValue(); + // bean.setTechCode(techCode); + specCode = form.getTCProperty("jk8SpecModel").getStringValue(); + bean.setSpecCode(specCode); + ref_designator = child.getTCProperty("bl_ref_designator").getStringValue(); + // + System.out.println("ָʾ------------------->" + ref_designator); + + //2017.10.26 C1-C3ijC1,C2,C3ĸʽ + String[] xx=ref_designator.split(","); + List ref_designator_list=new ArrayList<>(); + for (int k = 0; k < xx.length; k++) { + if(xx[k].contains("-")) { + + String strings1=xx[k].split("-")[0];//Сֵ + String strings2=xx[k].split("-")[1];//ֵ + //ֵ + String up=""; + int up_num=0; + for (int j = strings2.length()-1;j>=0; j--) { + if(Character.isDigit(strings2.charAt(j))==true) { + up=strings2.charAt(j)+up; + }else { + break; + } + + } + up_num=Integer.valueOf(up); + //Сֵ + String down=""; + int down_num=0; + int mark=0; + for(int j = strings1.length()-1;j>=0; j--) { + if(Character.isDigit(strings1.charAt(j))==true) { + down=strings1.charAt(j)+down; + }else { + mark=j; + break; + } + } + down_num=Integer.valueOf(down); + //ͷλ + String wh=strings1.substring(0, mark+1); + for (int j = down_num; j <= up_num; j++) { + String aa=wh+j; + ref_designator_list.add(aa); + } + + + }else if(!xx[k].contains("-")) { + ref_designator_list.add(xx[k]); + } + } +// bean.setRef_designator(ref_designator);//ҪC1,C2,C3ʾλžע + ref_designator=""; + for (int j = 0; j < ref_designator_list.size(); j++) { + ref_designator=ref_designator+ref_designator_list.get(j)+","; + } + ref_designator=ref_designator.substring(0,ref_designator.length()-1); + bean.setRef_designator(ref_designator);//ҪC1-C3ʾλžע + + + + quantity = child.getTCProperty("bl_quantity").getStringValue().split("\\.")[0];//2017.10.26 ʾС +// if(Integer.valueOf(quantity)>3) { +// quantity=quantity+"-"; +// } + bean.setQuantity(quantity); + unit = child.getProperty("bl_uom"); + bean.setUnit(unit); + + //2017.10.18 + //2018.3.21ȫ +// TCComponent[] components=child.getTCProperty("global_bl_substitute_list").getReferenceValueArray(); + TCComponent[] components=child.getItem().getTCProperty("global_alt_list").getReferenceValueArray();//TODO + if(components.length==0) { + bl_substitute_list=""; + }else if(components.length>0) { + bl_substitute_list=""; + for (int j = 0; j < components.length; j++) { + //2018.1.16 + String id=""; + try { + id=((TCComponentItem)components[j]).getTCProperty("item_id").getStringValue(); + } catch (Exception e) { + // TODO Auto-generated catch block + id=((TCComponentBOMView)components[j]).getTCProperty("object_name").getStringValue().split("-")[0]; + e.printStackTrace(); + } + bl_substitute_list=bl_substitute_list+id+","; + } + } + if(bl_substitute_list.length()>=1) { + + bl_substitute_list=bl_substitute_list.trim(); + bl_substitute_list=bl_substitute_list.substring(0, bl_substitute_list.length()-1); + } + + bean.setGlobal_bl_substitute_list(bl_substitute_list); + + //2018.3.19 Ӳ嵥ģСϡһУΪȫϡֲϡ + components=child.getTCProperty("bl_substitute_list").getReferenceValueArray(); + if(components.length==0) { + bl_substitute_list=""; + }else if(components.length>0) { + bl_substitute_list=""; + for (int j = 0; j < components.length; j++) { + String id=""; + try { + id=((TCComponentItem)components[j]).getTCProperty("item_id").getStringValue(); + } catch (Exception e) { + // TODO Auto-generated catch block + id=((TCComponentBOMView)components[j]).getTCProperty("object_name").getStringValue().split("-")[0]; + e.printStackTrace(); + } + bl_substitute_list=bl_substitute_list+id+","; + } + } + if(bl_substitute_list.length()>=1) { + + bl_substitute_list=bl_substitute_list.trim(); + bl_substitute_list=bl_substitute_list.substring(0, bl_substitute_list.length()-1); + } + + bean.setLocal_bl_substitute_list(bl_substitute_list); + + + list.add(bean); + if (child.getChildren().length > 0) { + getBomline(child,realNumber_0); + } + + } + } catch (TCException e) { + e.printStackTrace(); + } + + } +} diff --git a/src/com/connor/jk/plm/exportBOM20200224/DeleteFile.java b/src/com/connor/jk/plm/exportBOM20200224/DeleteFile.java new file mode 100644 index 0000000..c4d033f --- /dev/null +++ b/src/com/connor/jk/plm/exportBOM20200224/DeleteFile.java @@ -0,0 +1,52 @@ +package com.connor.jk.plm.exportBOM20200224; + +import java.io.File; + +public class DeleteFile { + + // ɾļ + // param folderPath ļ· + + public static void delFolder(String folderPath) { + try { + delAllFile(folderPath); // ɾ + String filePath = folderPath; + filePath = filePath.toString(); + java.io.File myFilePath = new java.io.File(filePath); + myFilePath.delete(); // ɾļ + } catch (Exception e) { + e.printStackTrace(); + } + } + + // ɾָļļ + // param path ļ· + public static boolean delAllFile(String path) { + boolean flag = false; + File file = new File(path); + if (!file.exists()) { + return flag; + } + if (!file.isDirectory()) { + return flag; + } + String[] tempList = file.list(); + File temp = null; + for (int i = 0; i < tempList.length; i++) { + if (path.endsWith(File.separator)) { + temp = new File(path + tempList[i]); + } else { + temp = new File(path + File.separator + tempList[i]); + } + if (temp.isFile()) { + temp.delete(); + } + if (temp.isDirectory()) { + delAllFile(path + "/" + tempList[i]);// ɾļļ + delFolder(path + "/" + tempList[i]);// ɾļ + flag = true; + } + } + return flag; + } +} diff --git a/src/com/connor/jk/plm/exportBOM20200224/ProgressBar.java b/src/com/connor/jk/plm/exportBOM20200224/ProgressBar.java new file mode 100644 index 0000000..0b934a9 --- /dev/null +++ b/src/com/connor/jk/plm/exportBOM20200224/ProgressBar.java @@ -0,0 +1,171 @@ +/** + * @file ProgressBar.java + * + * @brief Create progress bar + * + * @author Yanghui + * + * @history + * ================================================================ + * Date Name Description of Change + * 25-July-2008 Yanghui this class is used to create + * progress bar. + */ +package com.connor.jk.plm.exportBOM20200224; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JProgressBar; +import javax.swing.Timer; +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.util.PropertyLayout; +import com.teamcenter.rac.util.Registry; + +/** + * @class ProgressBar + * @brief Create progress bar + * @author Yanghui + */ +public class ProgressBar extends AbstractAIFDialog implements ActionListener { + /** + * @var ProgressBar.progressbar + * @brief JProgressBar + */ + private JProgressBar progressbar; + + /** + * @var ProgressBar.label + * @brief label used to tips + */ + private JLabel label; + + /** + * @var ProgressBar.timer + * @brief timer used to timing operation + */ + private Timer timer; + + /** + * @var ProgressBar.bool + * @brief bool used to flag thread return + */ + private boolean bool = false; + + /** + * @var Progressbar.registry + * @brief Registry + */ + private Registry registry; + + /** + * @fn public ProgressBar() + * @brief constructor + * @param[in] null + */ + private String showLable = null ; + public ProgressBar(String showlable) { + super(true); + showLable = showlable; + this.setAlwaysOnTop(true); + } + + /** + * @fn public void setBool(boolean bool) + * @brief set bool value + * @param[in] bool + * @param[out] null + */ + public void setBool(boolean bool) { + this.bool = bool; + } + + /** + * @fn private void initUI() + * @brief createDialog method + * @param[in] null + * @param[out] null + */ + public void initUI() { + Container container = getContentPane(); + JPanel mainPanel = new JPanel(new PropertyLayout()); + this.label = new JLabel(showLable, JLabel.CENTER); + this.progressbar = new JProgressBar(); + this.progressbar.setOrientation(JProgressBar.HORIZONTAL); + this.progressbar.setMinimum(0); + this.progressbar.setMaximum(100); + this.progressbar.setValue(0); + this.progressbar.setPreferredSize(new Dimension(200, 15)); + this.progressbar.setBorderPainted(true); + this.timer = new Timer(50, (ActionListener) this); + this.timer.setRepeats(false); + mainPanel.add("1.1.center", new JLabel(" ")); + mainPanel.add("2.1.center", label); + mainPanel.add("3.1.center", progressbar); + mainPanel.add("4.1.center", new JLabel(" ")); + container.add(mainPanel); + pack(); + setLocation(500, 200); + TaskThread thread = new TaskThread(this); + thread.start(); + addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + bool = true; + } + }); + this.setVisible(true); + } + + /** + * @class TaskThread + * @brief Create progressbar + * + */ + class TaskThread extends Thread { + private ProgressBar bar; + + public TaskThread(ProgressBar bar) { + this.bar = bar; + } + + public void run() { + if (bool == false) { + // Set Status is running. + // session.setStatus(registry.getString("export Running")); + } + for (int i = 0; i < i + 1; i++) { + timer.start(); + int value = progressbar.getValue(); + if (value < 100) { + value = value + 5; + progressbar.setValue(value); + } else { + timer.stop(); + progressbar.setValue(0); + } + try { + sleep(100); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + if (bool == true) { + bar.setVisible(false); + bar.dispose(); + return; + + } + + } + } + } + + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + + } +} diff --git a/src/com/connor/jk/plm/exportBOM20200224/ProgressBarThread.java b/src/com/connor/jk/plm/exportBOM20200224/ProgressBarThread.java new file mode 100644 index 0000000..d146002 --- /dev/null +++ b/src/com/connor/jk/plm/exportBOM20200224/ProgressBarThread.java @@ -0,0 +1,41 @@ +/** + * @file ProgressBarThread.java + * + * @brief control progressBar. + * + * @author Yanghui + * + * @history + * ================================================================ + * Date Name Description of Change + * 08-Auguest-2008 Yanghui this class is used to control + * progress bar. + */ +package com.connor.jk.plm.exportBOM20200224; + +/** + * @class ProgressBarThread + * @brief Create progress bar thread + * @author Yanghui + */ +public class ProgressBarThread extends Thread { + + private ProgressBar bar; + + private String title; + + public ProgressBarThread(String title,String showLable) { + this.title = title; + bar = new ProgressBar(showLable); + } + + public void run() { + bar.setTitle(title); + bar.initUI(); + } + + public void setBool(boolean bool) { + bar.setBool(true); + bar.setAlwaysOnTop(false); + } +} diff --git a/src/com/connor/jk/plm/exportBOM20200224/exportBOM_Action.java b/src/com/connor/jk/plm/exportBOM20200224/exportBOM_Action.java new file mode 100644 index 0000000..b8621d2 --- /dev/null +++ b/src/com/connor/jk/plm/exportBOM20200224/exportBOM_Action.java @@ -0,0 +1,86 @@ + +package com.connor.jk.plm.exportBOM20200224; + +import java.util.ArrayList; +import java.util.List; + +import com.connor.jk.plm.exportBOM20200224.exportBOM_Dialog; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.common.actions.AbstractAIFAction; +import com.teamcenter.rac.aif.kernel.AIFComponentContext; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentBOMLine; +import com.teamcenter.rac.kernel.TCComponentBOMViewRevision; +import com.teamcenter.rac.kernel.TCComponentBOMWindow; +import com.teamcenter.rac.kernel.TCComponentBOMWindowType; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +/** + * @author Administrator + * + */ +public class exportBOM_Action extends AbstractAIFAction { + private AbstractAIFApplication app; + private InterfaceAIFComponent targetComps[]; + private TCSession session; + + + public exportBOM_Action(AbstractAIFApplication arg0, String arg1) { + super(arg0, arg1); + this.app = arg0; + this.session = (TCSession) app.getSession(); + this.targetComps = app.getTargetComponents(); + } + + + @Override + public void run() { + List toplines = new ArrayList(); + try { + if(targetComps != null && targetComps.length > 0 ){ + for (int n = 0; n < targetComps.length; n++) { + InterfaceAIFComponent targetComp = targetComps[n]; + if (targetComp instanceof TCComponentBOMViewRevision) { + try { + + TCComponent comp = (TCComponent) targetComp; + AIFComponentContext[] context = comp.whereReferenced(); + TCComponentItemRevision rev = null; + for (int i = 0; i < context.length; i++) { + System.out.println("i:" + i); + if (context[i].getComponent() instanceof TCComponentItemRevision) { + rev = (TCComponentItemRevision) context[i].getComponent(); + break; + } + } + + TCComponentBOMWindowType type = (TCComponentBOMWindowType) session.getTypeComponent("BOMWindow"); + TCComponentBOMWindow win = type.create(null); + TCComponentBOMLine topline = null; + topline = win.setWindowTopLine(rev.getItem(), rev, null, null); + toplines.add(topline); + + } catch (Exception e) { + e.printStackTrace(); + } + + }else { + MessageBox.post("ǰѡе"+targetComp.getType()+",ѡͼ汾ڽṹѡжBOMLineٵ","",MessageBox.INFORMATION); + return; + } + + } + //forѭ + exportBOM_Dialog dialog=new exportBOM_Dialog(session,toplines); + new Thread(dialog).run(); + } + } catch (Exception e) { + + } + + } + +} diff --git a/src/com/connor/jk/plm/exportBOM20200224/exportBOM_Bean.java b/src/com/connor/jk/plm/exportBOM20200224/exportBOM_Bean.java new file mode 100644 index 0000000..9d11158 --- /dev/null +++ b/src/com/connor/jk/plm/exportBOM20200224/exportBOM_Bean.java @@ -0,0 +1,80 @@ +package com.connor.jk.plm.exportBOM20200224; + +public class exportBOM_Bean { + + private String number;//ţ + private String materialCode;//ϱ룻 + private String materialName;// + private String techCode;//ͺ + private String specCode;//ͺ + private String quantity;// + private String unit;//λ + private String drawID;//ͼ + + //ȫ + private String global_list; + //ֲ + private String local_list; + + public String getGlobal_list() { + return global_list; + } + public void setGlobal_list(String global_list) { + this.global_list = global_list; + } + public String getLocal_list() { + return local_list; + } + public void setLocal_list(String local_list) { + this.local_list = local_list; + } + public String getNumber() { + return number; + } + public void setNumber(String number) { + this.number = number; + } + public String getMaterialCode() { + return materialCode; + } + public void setMaterialCode(String materialCode) { + this.materialCode = materialCode; + } + public String getMaterialName() { + return materialName; + } + public void setMaterialName(String materialName) { + this.materialName = materialName; + } + public String getTechCode() { + return techCode; + } + public void setTechCode(String techCode) { + this.techCode = techCode; + } + public String getSpecCode() { + return specCode; + } + public void setSpecCode(String specCode) { + this.specCode = specCode; + } + public String getQuantity() { + return quantity; + } + public void setQuantity(String quantity) { + this.quantity = quantity; + } + public String getUnit() { + return unit; + } + public void setUnit(String unit) { + this.unit = unit; + } + public String getDrawID() { + return drawID; + } + public void setDrawID(String drawID) { + this.drawID = drawID; + } + +} diff --git a/src/com/connor/jk/plm/exportBOM20200224/exportBOM_Dialog.java b/src/com/connor/jk/plm/exportBOM20200224/exportBOM_Dialog.java new file mode 100644 index 0000000..9f21e70 --- /dev/null +++ b/src/com/connor/jk/plm/exportBOM20200224/exportBOM_Dialog.java @@ -0,0 +1,346 @@ +package com.connor.jk.plm.exportBOM20200224; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.swing.DefaultComboBoxModel; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; + +import com.connor.jk.plm.exportBOM.ProgressBarThread; +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.aif.kernel.AIFComponentContext; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentBOMLine; +import com.teamcenter.rac.kernel.TCComponentFolder; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCComponentICO; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCComponentUser; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.kernel.ics.ICSProperty; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; + +public class exportBOM_Dialog extends AbstractAIFDialog { + + /** + * BOM嵥TCļ + */ + private static final long serialVersionUID = 1L; + private TCSession session; + private JLabel pathLabel; + private JLabel nameLabel;// + private JTextField nameField;// ĬΪ嵥 + private JLabel selectLabel;// ͣṹ嵥Ӳ嵥 + private String selectWhichType = "ṹ嵥"; + private JButton celButton; + private JLabel exportType;// + private JComboBox comBox_selectExportType; + private String selectExportFileType = "Excel"; + +// private JButton pathButton; 20200224 + private JButton okButton; +// ProgressBarThread wait; + + List toplines ; + + private JComboBox comBox_selectType; + //ȡFolderб + private JComboBox comBox_selectFolder; + + //20200224 + private long stime = System.currentTimeMillis(); + + public exportBOM_Dialog(TCSession session, List toplines) { + this.session = session; + this.toplines = toplines; + } + + @Override + public void run() { + initUI(); + + } + + private void initUI() { + + this.setTitle("BOM嵥"); + this.setSize(new Dimension(300, 300)); + this.setLayout(new BorderLayout()); + this.setAlwaysOnTop(true); + setLayout(new BorderLayout()); + JPanel mainPanel = new JPanel(new PropertyLayout()); + + nameLabel = new JLabel(""); + nameField = new JTextField(50); + // 2017.10.27ļƶΪid--ͺ + // Ӳ嵥BOM嵥-u8--Ʒʶ-RD-ĵ-汾 + // ṹ嵥BOM嵥-u8(item_id)-Ʒʶ(jk8ProductIdentifyNO)-RD-ĵ(date_released)-汾ţitem_revision_id + // 2017.11.10ļƶΪ + // Ӳ嵥BOM嵥-u8-ƣԴԣ-ƷʶţԴԡʹòƷʶš޸öΪգ-RD-ĵڣBOM׼绹δ׼öΪգ-汾 + // ṹ嵥BOM嵥-u8-Ʒ-ƷʶţԴԡͺš-L/RԴԡͺš޸öΪգ-RD-ĵڣBOM׼绹δ׼öΪգ-汾 + + selectLabel = new JLabel(""); + // б + List selectExportType = new ArrayList<>(); + selectExportType.add("Excel"); + selectExportType.add("PDF"); + comBox_selectExportType=new JComboBox( + new DefaultComboBoxModel(selectExportType.toArray(new String[selectExportType.size()]))); + comBox_selectExportType.addItemListener(new ItemListener() { + + @Override + public void itemStateChanged(ItemEvent e) { + // + if (e.getItem() != null) { + + selectExportFileType = (String) e.getItem(); + } + } + }); + + // б + List selectType = new ArrayList<>(); + selectType.add("ṹ嵥"); + selectType.add("Ӳ嵥"); + comBox_selectType = new JComboBox( + new DefaultComboBoxModel(selectType.toArray(new String[selectType.size()]))); + comBox_selectType.addItemListener(new ItemListener() { + + @Override + public void itemStateChanged(ItemEvent e) { + if (e.getItem() != null) { + + selectWhichType = (String) e.getItem(); + } + } + }); + + pathLabel = new JLabel("ļ"); + + String[] folderNames = getFolderNames(); + if(folderNames != null){ + comBox_selectFolder = new JComboBox(new DefaultComboBoxModel(folderNames)); + }else{ + MessageBox.post("δҵѡ[JK_BOMFolder_Names]ѡô", "", MessageBox.ERROR); + return ; + } + + okButton = new JButton("ȷ"); + okButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent arg0) { + disposeDialog(); + dispose(); + try { + // wait = new ProgressBarThread("BOM嵥", "ִУԵ..."); + // wait.start(); + selectWhichType = comBox_selectType.getSelectedItem().toString(); + selectExportFileType = comBox_selectExportType.getSelectedItem().toString(); + String path = System.getProperty("user.home") + "\\" + stime; + // String path = System.getProperty("user.home"); + //ȡӦļ + String folderName = comBox_selectFolder.getSelectedItem().toString(); + TCComponentFolder folderBom = getFolder(folderName); + if(folderBom == null ){ + MessageBox.post("δҵѡļ,ļǷ", "ʾ", MessageBox.ERROR); + return ; + } + for (int i = 0; i < toplines.size(); i++) { + TCComponentBOMLine topline = toplines.get(i); + TCComponentItemRevision child = topline.getItemRevision(); + + String recognise = ""; + String baseBoardComponentName = " ";// + String specModel = " "; // ͺ + String tecModel = " "; // ͺ + // ڷеIJƷʶ + TCComponent[] forms = child.getTCProperty("IMAN_master_form_rev").getReferenceValueArray(); + specModel = ((TCComponentForm) forms[0]).getTCProperty("jk8SpecModel").getStringValue(); + tecModel = ((TCComponentForm) forms[0]).getTCProperty("jk8TechModel").getStringValue(); + TCComponentICO[] icoS = child.getClassificationObjects(); + Integer[] keys = null; + String[] vals = null; + int count = 0; + int count1 = 0; + for (int m = 0; m < icoS.length; m++) { + ICSProperty[] cPropS = icoS[m].getICSProperties(true); + for (int j = 0; j < cPropS.length; j++) { + // System.out.println(count); + count++; + } + keys = new Integer[count]; + vals = new String[count]; + for (int j = 0; j < cPropS.length; j++) { + // System.out.println(count); + keys[count1] = cPropS[j].getId();// Ǵ + // System.out.println("keys[" + count1 + "]================>" + keys[count1]); + vals[count1] = cPropS[j].getValue(); + // System.out.println("vals[" + count1 + "]================>" + vals[count1]); + if (keys[count1] == 1050) {// Ʒʶ keys[count1] == -500301 2021/1/5Ǩƺid + recognise = vals[count1]; + // break; + } + if (keys[count1] == 50205015) {// keys[count1] == -500293 2021/1/5Ǩƺid + baseBoardComponentName = vals[count1]; + } + + count1++; + } + + } + // if(child.getTCProperty("jk8ProductIdentifyNO")==null) { + // MessageBox.post("汾 Ʒʶţjk8ProductIdentifyNO + // δ","",MessageBox.INFORMATION); + // recognise="޲Ʒʶ"; + // }else { + // + // recognise=child.getTCProperty("jk8ProductIdentifyNO").getStringValue(); + // } + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); + Date date_released = child.getTCProperty("date_released").getDateValue(); + String time = ""; + if (recognise == null || recognise.equals("")) { + recognise = " "; + } + if (baseBoardComponentName == null || baseBoardComponentName.equals("")) { + baseBoardComponentName = " "; + } + if (specModel == null || specModel.equals("")) { + specModel = " "; + } + if (tecModel == null || tecModel.equals("")) { + tecModel = " "; + } + if (date_released != null) { + time = sdf.format(date_released); + } else { + time = " "; + } + String exportName = ""; + if (selectWhichType.equals("ṹ嵥")) { + try { + exportName = "BOM嵥-" + child.getTCProperty("item_id").getStringValue() + "-" + + child.getTCProperty("object_name").getStringValue() + "-" + specModel + "-" + + tecModel + "-" + recognise + "-RD-" + time + "-" + + child.getTCProperty("item_revision_id").getStringValue(); + + } catch (TCException e1) { + e1.printStackTrace(); + } + } else if (selectWhichType.equals("Ӳ嵥")) { + try { + exportName = "BOM嵥-" + child.getTCProperty("item_id").getStringValue() + "-" + // +child.getTCProperty("object_name").getStringValue() + + baseBoardComponentName// 2017.11.10л + + "-" + recognise + "-RD-" + time + "-" + + child.getTCProperty("item_revision_id").getStringValue(); + + } catch (TCException e1) { + e1.printStackTrace(); + } + } + if (selectWhichType.equals("ṹ嵥")) { + exportBOM_Operation operation = new exportBOM_Operation(exportName, path, + session, topline, selectExportFileType, folderBom, i, toplines.size()); + session.queueOperation(operation); + } else if (selectWhichType.equals("Ӳ嵥")) { + exportHardwareBOM_Operation operation = new exportHardwareBOM_Operation(exportName, + path, session, topline, selectExportFileType, folderBom, i, toplines.size()); + session.queueOperation(operation); + } + } + // wait.setBool(true); + // wait.interrupt(); + } catch (Exception e) { + e.printStackTrace(); + } + + } + }); + + mainPanel.add("1.1.left.top", pathLabel); + mainPanel.add("1.2.left.top", comBox_selectFolder); + mainPanel.add("2.1.left.top", nameLabel); + mainPanel.add("2.2.left.top", nameField); + mainPanel.add("3.1.left.top", selectLabel); + mainPanel.add("3.2.left.top", comBox_selectType); + // 2017.12.5 ӵ + exportType = new JLabel("ʽ"); + mainPanel.add("4.1.left.top",exportType); + mainPanel.add("4.2.left.top",comBox_selectExportType); + add(mainPanel, BorderLayout.CENTER); + JPanel buttonPanel = new JPanel(new FlowLayout()); + buttonPanel.add(okButton); + celButton = new JButton("ȡ"); + celButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent arg0) { + disposeDialog(); + dispose(); + + } + }); + buttonPanel.add(celButton); + add(buttonPanel, BorderLayout.SOUTH); + centerToScreen(); + pack(); + showDialog(); + + } + //ѡFolderб + private String[] getFolderNames() { + TCPreferenceService pref = session.getPreferenceService(); + String names[] = pref.getStringValues("JK_BOMFolder_Names");// ѡpuid + if (names != null) { + return names; + + } else { + // MessageBox.post("δҵѡ[JK_PCB_Dataset_Puid]ѡô", "", MessageBox.ERROR); + return null; + } + } + //ȡhomeļ´BOMṹݼfolder + public TCComponentFolder getFolder(String folderName){ + TCComponentUser user = session.getUser(); + TCComponentFolder bomFolder = null ; + try { + // TCComponentFolder newStuff = user.getNewStuffFolder(); + TCComponentFolder homeStuff = user.getHomeFolder(); + AIFComponentContext[] childFolders = homeStuff.getChildren(); + if(childFolders != null && childFolders.length > 0 ){ + for (int i = 0; i < childFolders.length; i++) { + InterfaceAIFComponent childFolder = childFolders[i].getComponent(); + if(childFolder instanceof TCComponentFolder){ + TCComponentFolder childSecFolder = (TCComponentFolder) childFolder; + if(childSecFolder.getProperty("object_string").equals(folderName)) { + bomFolder = childSecFolder ; + break ; + } + } + } + } + } catch (TCException e) { + e.printStackTrace(); + } + return bomFolder; + } +} diff --git a/src/com/connor/jk/plm/exportBOM20200224/exportBOM_Handler.java b/src/com/connor/jk/plm/exportBOM20200224/exportBOM_Handler.java new file mode 100644 index 0000000..7ad4215 --- /dev/null +++ b/src/com/connor/jk/plm/exportBOM20200224/exportBOM_Handler.java @@ -0,0 +1,25 @@ +package com.connor.jk.plm.exportBOM20200224; + +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.aifrcp.AIFUtility; + +/* + * BOM嵥TCѡļ + * + */ +public class exportBOM_Handler extends AbstractHandler{ + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + // TODO Auto-generated method stub + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + exportBOM_Action action=new exportBOM_Action(app,null); + new Thread(action).start(); + return null; + } + +} diff --git a/src/com/connor/jk/plm/exportBOM20200224/exportBOM_Operation.java b/src/com/connor/jk/plm/exportBOM20200224/exportBOM_Operation.java new file mode 100644 index 0000000..904e683 --- /dev/null +++ b/src/com/connor/jk/plm/exportBOM20200224/exportBOM_Operation.java @@ -0,0 +1,1148 @@ +package com.connor.jk.plm.exportBOM20200224; + +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.List; + +import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.IndexedColors; +import org.apache.poi.ss.util.CellRangeAddress; +import org.apache.poi.xssf.usermodel.XSSFCell; +import org.apache.poi.xssf.usermodel.XSSFCellStyle; +import org.apache.poi.xssf.usermodel.XSSFFont; +import org.apache.poi.xssf.usermodel.XSSFRow; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + +import com.connor.jk.plm.DbomToEbom.ChangeDbomUtil; +import com.connor.jk.plm.exportBOM.ProgressBarThread; +import com.jacob.activeX.ActiveXComponent; +import com.jacob.com.ComThread; +import com.jacob.com.Dispatch; +import com.jacob.com.Variant; +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.TCComponent; +import com.teamcenter.rac.kernel.TCComponentBOMLine; +import com.teamcenter.rac.kernel.TCComponentBOMView; +import com.teamcenter.rac.kernel.TCComponentDataset; +import com.teamcenter.rac.kernel.TCComponentDatasetType; +import com.teamcenter.rac.kernel.TCComponentFolder; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCComponentTcFile; +import com.teamcenter.rac.kernel.TCComponentUser; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class exportBOM_Operation extends AbstractAIFOperation { + private String type; + private String path; +// private ProgressBarThread wait; + private TCSession session; + private TCComponentBOMLine comp; + private FileInputStream fis; + private XSSFWorkbook workbook; + private FileOutputStream out; + private TCPreferenceService preferenceService; + private String selectExportFileType; + private TCComponentFolder selectBomFolder ; + private int completeCount; + private int allCount; + ProgressBarThread wait; + + public exportBOM_Operation(String type, String path, TCSession session, TCComponentBOMLine comp, + String selectExportFileType, TCComponentFolder selectBomFolder, int i, int allCount) { + // TODO Auto-generated constructor stub + this.type = type; + this.path = path; + this.session = session; + this.comp = comp; + this.selectExportFileType = selectExportFileType; + this.selectBomFolder = selectBomFolder; + this.completeCount = i; + this.allCount = allCount; + wait = new ProgressBarThread("BOM嵥", "ִУԵ..."); + wait.start(); + } + + @Override + public void executeOperation() throws Exception { + // TODO Auto-generated method stub + // ץȡfnd0ActuatedInteractiveTsks fnd0Performer fnd0EndDate + // fnd0AliasTaskName + String name1 = ""; + String name2 = ""; + String name3 = ""; + TCComponent[] component = comp.getItemRevision() + .getTCProperty("fnd0ActuatedInteractiveTsks") + .getReferenceValueArray(); + // //ļ + // type=comp.getItemRevision().getTCProperty("item_id").getStringValue()+"-" + // +comp.getItemRevision().getTCProperty("object_name").getStringValue()+"-"; + // System.out.println(component.length); + + for (int i = 0; i < component.length; i++) { + // + if (component[i].getTCProperty("fnd0AliasTaskName") + .getStringValue().contains("")) { + name1 = component[i].getTCProperty("fnd0Performer") + .getDisplayValue().split("\\(")[0]; + name1 = name1 + + "/" + + component[i].getTCProperty("fnd0EndDate") + .getDisplayValue(); + } else if (component[i].getTCProperty("fnd0AliasTaskName") + .getStringValue().contains("")) { + name2 = component[i].getTCProperty("fnd0Performer") + .getDisplayValue().split("\\(")[0]; + name2 = name2 + + "/" + + component[i].getTCProperty("fnd0EndDate") + .getDisplayValue(); + } else if (component[i].getTCProperty("fnd0AliasTaskName") + .getStringValue().contains("׼")) { + name3 = component[i].getTCProperty("fnd0Performer") + .getDisplayValue().split("\\(")[0]; + name3 = name3 + + "/" + + component[i].getTCProperty("fnd0EndDate") + .getDisplayValue(); + } + } + long start = System.currentTimeMillis(); + int colsCount = 16; + String sxx = "jk_bom_uid";// G8TlM0X6YvbLjA + File file = getExcel(sxx); + if (file == null) { + return; + } + getBomline(comp, realNumber); + // 2017.11.17 ͺţͺ + TCComponentForm form_topline = (TCComponentForm) comp.getItemRevision() + .getReferenceListProperty("IMAN_master_form_rev")[0]; + String techCode_topline = form_topline.getTCProperty("jk8TechModel") + .getStringValue(); + String specCode_topline = form_topline.getTCProperty("jk8SpecModel") + .getStringValue(); + + System.out.println("BOM" + list.size() + ""); + int rowCount = list.size(); + fis = new FileInputStream(file); + workbook = new XSSFWorkbook(fis); + XSSFSheet sheet = workbook.getSheet("ṹ嵥"); + System.out.println("ģ干"+sheet.getLastRowNum()+""); + + // sheet.setColumnWidth(4, 7000); + // sheet.setColumnWidth(12, 7000); + // XSSFCellStyle sty = workbook.createCellStyle(); + // sty.setWrapText(true);//Զ + // sty.setAlignment(XSSFCellStyle.ALIGN_CENTER); + // sty.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER); + // style1.setFillPattern(FillPatternType.SOLID_FOREGROUND);//һҪ䣬ñɫ + // style1.setFillForegroundColor(new XSSFColor( new Color(232, 242, + // 254)));//ñɫ + XSSFRow row = sheet.getRow(1); + XSSFCell cell_0 = row.getCell(3); + cell_0.setCellValue(comp.getItemRevision().getTCProperty("item_id") + .getStringValue()); + cell_0 = row.getCell(10); + cell_0.setCellValue(comp.getItemRevision() + .getTCProperty("item_revision_id").getStringValue()); + row = sheet.getRow(2); + cell_0 = row.getCell(3); + cell_0.setCellValue(comp.getItemRevision().getTCProperty("object_name") + .getStringValue()); + // 2017.11.17 + row = sheet.getRow(3); + cell_0 = row.getCell(3); + cell_0.setCellValue(specCode_topline); + cell_0 = row.getCell(10); + cell_0.setCellValue(techCode_topline); + + row = sheet.getRow(4); + cell_0 = row.getCell(3); + Date date = new Date(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + String time = sdf.format(date); + time = time.replace("-", "."); + cell_0.setCellValue(time);// Ч + int startRow = 6; + XSSFCellStyle sty = workbook.createCellStyle();// ½Ԫĸʽ + XSSFCellStyle style = workbook.createCellStyle();// BеԪĸʽ + // XSSFCellStyle sty2 = sheet.getRow(7).getCell(1).getCellStyle(); + XSSFCellStyle sty2 = workbook.createCellStyle();//еĸʽ + sty2.setBorderBottom((short) 1); + sty2.setBorderLeft((short) 2); + sty2.setBorderRight((short) 1); + sty2.setBorderTop((short) 1); + sty2.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER); + // XSSFCellStyle sty3 = sheet.getRow(6).getCell(13).getCellStyle();// + // NеԪĸʽ + XSSFCellStyle sty3 = workbook.createCellStyle();// PеԪĸʽ + // XSSFCellStyle sty4 = sheet.getRow(7).getCell(13).getCellStyle();// + // кһеĸʽ + XSSFCellStyle sty4 = workbook.createCellStyle();// кһеĸʽ + XSSFCellStyle sty5 = workbook.createCellStyle();// עеʽ + XSSFCellStyle sty6 = workbook.createCellStyle();// qianԪĸʽ + XSSFCellStyle sty7 = workbook.createCellStyle();// /ڵԪĸʽ + sty6.setBorderBottom((short) 2); + sty6.setBorderLeft((short) 2); + sty6.setBorderRight((short) 1); + sty6.setBorderTop((short) 1); + + sty7.setBorderLeft((short) 1); + sty7.setBorderBottom((short) 2); + sty7.setBorderRight((short) 2); + sty7.setBorderTop((short) 1); + + XSSFCellStyle sty8 = workbook.createCellStyle();// /ڵԪĸʽ + sty8.setBorderTop((short) 1); + sty8.setBorderBottom((short) 1); + sty8.setBorderLeft((short) 2); + sty8.setBorderRight((short) 1); + + XSSFCellStyle sty9 = workbook.createCellStyle();// /ڵԪĸʽ + sty9.setBorderTop((short) 1); + sty9.setBorderBottom((short) 1); + sty9.setBorderLeft((short) 1); + sty9.setBorderRight((short) 2); + + sty5.setBorderRight((short) 2); + sty5.setBorderLeft((short) 1); + sty5.setBorderTop((short) 1); + sty5.setBorderBottom((short) 1); + sty = sheet.getRow(7).getCell(11).getCellStyle(); + sty.setBorderBottom(CellStyle.BORDER_THIN); + sty.setBottomBorderColor(IndexedColors.BLACK.getIndex()); + sty.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER);// ֱ + sty.setAlignment(XSSFCellStyle.ALIGN_LEFT);// ˮƽ + XSSFFont font = workbook.createFont(); + font.setFontName("΢ź"); + font.setFontHeightInPoints((short) 9);// С + // sty.setFont(font); + style.setBorderBottom(CellStyle.BORDER_THIN); + style.setBorderTop((short) 1); + style.setBottomBorderColor(IndexedColors.BLACK.getIndex()); + style.setAlignment(XSSFCellStyle.ALIGN_CENTER); // + style.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER); // + style.setFont(font); + sty2.setFont(font); + sty3.setBorderBottom((short) 1); + sty3.setBorderRight((short) 2); + sty3.setBorderLeft((short) 1); + // sty3.setBottomBorderColor(IndexedColors.BLACK.getIndex()); + sty3.setBorderTop((short) 1); + // sty3.setTopBorderColor(IndexedColors.BLACK.getIndex()); + + sty4.setBorderBottom((short) 2); + // sty4.setBottomBorderColor(IndexedColors.BLACK.getIndex()); + sty4.setBorderTop((short) 1); + // sty4.setTopBorderColor(IndexedColors.BLACK.getIndex()); + sty4.setBorderLeft((short) 1); + // sty4.setLeftBorderColor(IndexedColors.BLACK.getIndex()); + sty4.setBorderRight((short) 1); + sty4.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER); + // sty4.setRightBorderColor(IndexedColors.BLACK.getIndex()); + XSSFFont font2 = workbook.createFont(); + font2.setFontName(""); + // font2.setFontName("΢ź"); + font2.setFontHeightInPoints((short) 11);// С + sty4.setFont(font2); + // sty4.setAlignment(XSSFCellStyle.ALIGN_CENTER); + // sty4.setAlignment(XSSFCellStyle.VERTICAL_CENTER); + for (int i = 0; i < rowCount + 7; i++) { + XSSFRow r = null; + boolean isCreate = false; + System.out.println("sheet.getLastRowNum()-------->" + + sheet.getLastRowNum()); + if ((i + startRow) > sheet.getLastRowNum()) { + r = sheet.createRow(i + startRow); + r.setHeight((short) 402); + isCreate = true; + } else { + r = sheet.getRow(i + startRow); + System.out.println("и---------" + r.getHeight()); + isCreate = false; + } + + // Ԫ񣬺ϲԪ + for (int cols = 1; cols < colsCount; cols++) { + XSSFCell cell = null; + if (isCreate) { + System.out.println(""+(i + startRow)+";"+cols+""); + cell = r.createCell(cols); + cell.setCellStyle(sty); + // TODO ʽ + } else { + if (r == null) { + r = sheet.createRow(i + startRow); + + System.out.println("ûд"); + } + cell = r.getCell(cols); + } + if (cols == 3 && isCreate && i < rowCount + 3) { + + CellRangeAddress cra = new CellRangeAddress(i + startRow, i + + startRow, 2, 3); + sheet.addMergedRegion(cra); + } else if (cols == 5 && isCreate && i < rowCount + 3) { + CellRangeAddress cra = new CellRangeAddress(i + startRow, i + + startRow, 4, 5); + sheet.addMergedRegion(cra); + } else if (cols == 7 && isCreate && i < rowCount + 3) { + CellRangeAddress cra = new CellRangeAddress(i + startRow, i + + startRow, 6, 7); + sheet.addMergedRegion(cra); + } else if (cols == 9 && isCreate && i < rowCount + 3) { + CellRangeAddress cra = new CellRangeAddress(i + startRow, i + + startRow, 8, 9); + sheet.addMergedRegion(cra); + } + } + + for (int cols = 1; cols < colsCount; cols++) { + // if (i < rowCount+3) { + // + // CellRangeAddress cra = new CellRangeAddress(i + startRow, i + + // startRow, 8,9); + // sheet.addMergedRegion(cra); + // } + XSSFCell cell = null; + if (isCreate) { + cell = r.createCell(cols); + cell.setCellStyle(sty); + // TODO ʽ + } else { + if (r == null) { + r = sheet.createRow(i + startRow); + System.out.println("ûд"); + } + cell = r.getCell(cols); + if (cols == 11) { + + cell.setCellStyle(sty); + } + } + if (cell == null) { + cell = r.createCell(cols); + // cell.setCellStyle(sty); + } + + cell.setCellType(XSSFCell.CELL_TYPE_STRING);// ıʽ + + // XSSFCellStyle + // sty0=sheet.getRow(9).getCell(11).getCellStyle(); + if (i < rowCount) { + + int rwsTemp = list.get(i).getTechCode().length() / 5 + 1; + int rwsTemp1 = list.get(i).getSpecCode().length() / 5 + 1; + int rwsTemp2 = list.get(i).getDrawID().length() / 5 + 1; + int rwsTemp3 = list.get(i).getMaterialName().length() / 5 + 1; + int rwsTemp4 = list.get(i).getGlobal_list().length() / 5 + 1; + int rwsTemp5 = list.get(i).getLocal_list().length() / 5 + 1; + int temp; + + int a[] = new int[] { rwsTemp, rwsTemp1, rwsTemp2, rwsTemp3, rwsTemp4, rwsTemp5 }; + Arrays.sort(a); + for (int i1 = 0; i1 < a.length; i1++) { +// System.out.println(a[i1]); + } + temp = a[5]; + + r.setHeight((short) (temp * 260)); + cell.getCellStyle().setWrapText(true); + } + if (i < rowCount) { + + switch (cols) { + case 1:// + if (list.get(i) == null) { + // this.wait.setBool(true); + // this.wait.interrupt(); + // MessageBox.post("BOM嵥Ϊ", "", MessageBox.INFORMATION);*/ + return; + } else { + + if (i > 0) { + + cell.setCellStyle(sty2); + } + cell.setCellValue(list.get(i).getNumber()); + break; + } + + case 2:// ϱ + // if(i>2) { + // sty0=sheet.getRow(9).getCell(cols).getCellStyle(); + // cell.setCellStyle(sty0); + // } + if (i >= 2) { + + cell.setCellStyle(style); + } + cell.setCellValue(list.get(i).getMaterialCode());// д + break; + case 4:// + // cell.setCellStyle(sty0); + cell.setCellValue(list.get(i).getMaterialName()); + break; + case 6:// ͺ + // cell.setCellStyle(sty); + + cell.setCellValue(list.get(i).getTechCode()); + break; + case 8:// ͺ + // cell.setCellStyle(sty0); + + cell.setCellValue(list.get(i).getSpecCode()); + // cell.setCellStyle(styG); + break; + case 10:// + // cell.setCellStyle(sty0); + cell.setCellValue(list.get(i).getQuantity()); + break; + case 11:// λ + // cell.setCellStyle(sty0); + cell.setCellValue(list.get(i).getUnit()); + break; + case 12:// ͼ + // cell.setCellStyle(sty0); + + cell.setCellValue(list.get(i).getDrawID()); + + break; + case 13:// ע + cell.setCellValue(list.get(i).getGlobal_list()); + break; + case 14:// ע + cell.setCellValue(list.get(i).getLocal_list()); + break; + case 15:// ע + + if (i > 0) { + + cell.setCellStyle(sty3); + } + break; + } + } + } + + } + + // ϲԪ + for ( + + int i = 0; i < rowCount + 3; i++) { + // if (i < rowCount+3) { + // + // CellRangeAddress cra = new CellRangeAddress(i + startRow, i + + // startRow, 8,9); + // sheet.addMergedRegion(cra); + // cra = new CellRangeAddress(i + startRow, i + startRow, 6, 7); + // sheet.addMergedRegion(cra); + // cra = new CellRangeAddress(i + startRow, i + startRow, 4, 5); + // sheet.addMergedRegion(cra); + // cra = new CellRangeAddress(i + startRow, i + startRow, 2, 3); + // sheet.addMergedRegion(cra); + // } + } + // õеĵ±߿ + XSSFCell cell5 = null; + for (int cols = 1; cols < colsCount; cols++) { + cell5 = sheet.getRow(startRow + rowCount + 2).getCell(cols); + switch (cols) { + + case 1:// + + cell5.setCellStyle(sty4); + break; + case 2:// + + cell5.setCellStyle(sty4); + break; + case 3:// + + cell5.setCellStyle(sty4); + break; + case 4:// + + cell5.setCellStyle(sty4); + break; + case 5:// + + cell5.setCellStyle(sty4); + break; + case 6:// + + cell5.setCellStyle(sty4); + break; + case 7:// + + cell5.setCellStyle(sty4); + break; + case 8:// + + cell5.setCellStyle(sty4); + break; + case 9:// + + cell5.setCellStyle(sty4); + break; + case 10:// + + cell5.setCellStyle(sty4); + break; + case 11:// + + cell5.setCellStyle(sty4); + break; + case 12:// + + cell5.setCellStyle(sty4); + break; + case 13:// ע + + cell5.setCellStyle(sty4); + break; + case 14:// ע + + cell5.setCellStyle(sty4); + break; + case 15:// ע + + cell5.setCellStyle(sty4); + break; + } + } + // һеĵ±߿ + XSSFCell cellLast = null; + for (int cols = 1; cols < colsCount; cols++) { + cellLast = sheet.getRow(startRow + rowCount + 6).getCell(cols); + switch (cols) { + case 1:// + cellLast.setCellValue("/"); + cellLast.setCellStyle(sty4); + break; + case 2:// + + cellLast.setCellStyle(sty4); + break; + case 3:// + cellLast.setCellValue("/"); + cellLast.setCellStyle(sty4); + break; + case 4:// + + cellLast.setCellStyle(sty4); + break; + case 5:// + cellLast.setCellStyle(sty4); + break; + case 6:// + cellLast.setCellValue("׼/"); + + cellLast.setCellStyle(sty4); + break; + case 7:// + cellLast.setCellStyle(sty4); + break; + case 8:// + + cellLast.setCellStyle(sty4); + break; + case 9:// + cellLast.setCellValue("ĵ"); + cellLast.setCellStyle(sty4); + break; + case 10:// + cellLast.setCellStyle(sty4); + break; + case 11:// + cellLast.setCellValue(""); + cellLast.setCellStyle(sty4); + break; + case 12:// + cellLast.setCellValue(""); + + cellLast.setCellStyle(sty4); + break; + case 13:// ע + + cellLast.setCellValue("/"); + cellLast.setCellStyle(sty4); + break; + case 14:// ע + + cellLast.setCellStyle(sty4); + break; + case 15:// ע + + cellLast.setCellStyle(sty4); + break; + } + } + // ϲǩĵԪ + //(BC12,DEF35,GHI68,JK910,L11,M12,NOP1315 ) + CellRangeAddress cra = new CellRangeAddress(rowCount + startRow + 3, + rowCount + startRow + 5, 1, 2); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + + 5, 3, 5); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + + 5, 6, 8); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + + 5, 9, 10); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + + 5, 11, 11); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + + 5, 12, 12); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + + 5, 13, 15); + sheet.addMergedRegion(cra); + // ϲһ + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + + 6, 1, 2); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + + 6, 3, 5); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + + 6, 6, 8); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + + 6, 9, 10); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + + 6, 11, 11); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + + 6, 12, 12); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + + 6, 13, 15); + sheet.addMergedRegion(cra); + + XSSFCell cell6 = null; + cell6 = sheet.getRow(5).getCell(11); + cell6.getCellStyle().setBorderBottom((short) 2); + XSSFCell cell0 = sheet.getRow(startRow + rowCount + 2).getCell(1); + cell0.setCellStyle(sty6); + + cell0 = sheet.getRow(startRow + rowCount + 2).getCell(15); + cell0.setCellStyle(sty7); + + XSSFCell cell1 = sheet.getRow(startRow + rowCount + 4).getCell(1); + cell1.setCellStyle(sty6); + cell1 = sheet.getRow(startRow + rowCount + 4).getCell(15); + cell1.setCellStyle(sty7); + + cell1 = sheet.getRow(startRow + rowCount).getCell(1); + cell1.setCellStyle(sty8); + cell1 = sheet.getRow(startRow + rowCount + 1).getCell(1); + cell1.setCellStyle(sty8); + cell1 = sheet.getRow(startRow + rowCount + 3).getCell(1); + cell1.setCellStyle(sty8); + cell1 = sheet.getRow(startRow + rowCount + 5).getCell(1); + cell1.setCellStyle(sty8); + cell1 = sheet.getRow(startRow + rowCount + 6).getCell(1); + cell1.setCellStyle(sty6); + + cell1 = sheet.getRow(startRow + rowCount).getCell(15); + cell1.setCellStyle(sty9); + cell1 = sheet.getRow(startRow + rowCount + 1).getCell(15); + cell1.setCellStyle(sty9); + cell1 = sheet.getRow(startRow + rowCount + 3).getCell(15); + cell1.setCellStyle(sty9); + cell1 = sheet.getRow(startRow + rowCount + 5).getCell(15); + cell1.setCellStyle(sty9); + cell1 = sheet.getRow(startRow + rowCount + 6).getCell(15); + cell1.setCellStyle(sty7); + + XSSFCell cell2 = sheet.getRow(startRow + rowCount + 3).getCell(1); + cell2.setCellValue(name1); + XSSFFont font3 = workbook.createFont(); + font3.setFontName(""); + font3.setFontHeightInPoints((short) 10);// С + + cell2 = sheet.getRow(startRow + rowCount + 3).getCell(3); + + cell2.setCellValue(name2); + cell2 = sheet.getRow(startRow + rowCount + 3).getCell(6); + cell2.setCellValue(name3); + cell2 = sheet.getRow(startRow + rowCount + 3).getCell(1); + cell2.getCellStyle().setAlignment((short) 1); + cell2.getCellStyle().setVerticalAlignment((short) 1); + cell2.getCellStyle().setWrapText(true); + cell2.getCellStyle().setFont(font3); + System.out.println("ʽ------------>" + + sheet.getRow(12).getCell(4).getCellStyle().getAlignment()); + + cellLast = sheet.getRow(startRow + rowCount + 6).getCell(1); + cellLast.getCellStyle().setVerticalAlignment( + XSSFCellStyle.VERTICAL_CENTER); + // 2017.11.21 Ȱصû·£ȻתΪpdf + // ѡ񵼳pdf + File fileout; + String usrHome = System.getProperty("user.home"); + // 20200224 + // String usrHome = System.getProperty("user.home"); + // System.out.println("usrHome=" + usrHome); + // C:\Users\4448\1582592704582\BOM嵥-820090303-ԶĤʽȼ-JGD10S-N-12H.50--ٳ-- -RD-20200107-01.xlsx + String excelPath = path + "\\" + type + ".xlsx"; + fileMkDir(path); + if (selectExportFileType.equals("Excel")) { + excelPath = judge2(excelPath); + fileout = new File(excelPath); + } else { + // fileout = new File(path + "\\" + type + ".xlsx"); + fileout = new File(usrHome + "\\" + type + ".xlsx"); + } + + // File fileout = new File(path + "\\" + type + ".xlsx"); + // File fileout = new File(usrHome + "\\" + type + ".xlsx"); + try { + out = new FileOutputStream(fileout); + } catch (Exception e) { + // this.wait.setBool(true); + // this.wait.interrupt(); + e.printStackTrace(); + MessageBox.post("ļ!\nļǷ:ܰ/,\\,,*,?,\",<,>,|", + "ļǷ", MessageBox.INFORMATION); + // String str = "/,\\,,*,?,\",<,>,|"; + return; + // e.printStackTrace(); + } + workbook.write(out); + // 20200224 + try { + if (selectExportFileType.equals("Excel")) { + TCComponentDatasetType dataType = (TCComponentDatasetType) session.getTypeComponent("Dataset"); + TCComponentDataset tcData = dataType.create(type, "description", "MSExcelX"); + tcData.setFiles(new String[] { excelPath }, new String[] { "excel" }); + /* TCComponentFolder bomFolder = getFolder(); + bomFolder.add("contents", tcData);*/ + selectBomFolder.add("contents", tcData); + tcData.lock(); + tcData.save(); + tcData.unlock(); + + DeleteFile.delFolder(path); //ɾıļ + } + } catch (Exception e) { + // TODO: handle exception + }finally{ + + } + + // תpdf + String inFilePath = path + "\\" + type + ".xlsx"; + // String inFilePath = usrHome + "\\" + type + ".xlsx"; + String outFilePath = path + "\\" + type + ".pdf"; + // String outFilePath = System.getProperty("user.home") + "\\" + type + ".pdf"; + try { + if (!selectExportFileType.equals("Excel")) { + System.out.println("·0"); + ChangeDbomUtil.setByPass(true); + // תpdf + inFilePath = usrHome + "\\" + type + ".xlsx"; + // inFilePath = path + "\\" + type + ".xlsx"; + outFilePath = judge(outFilePath); + xlsToPdf(inFilePath, outFilePath); + // 20200224 + TCComponentDatasetType dataType = (TCComponentDatasetType) session.getTypeComponent("Dataset"); + TCComponentDataset tcPdfData = dataType.create(type , "", "PDF"); + tcPdfData.setFiles(new String[] { outFilePath }, new String[] { "PDF_Reference" }); + /* TCComponentFolder bomFolder = getFolder(); + bomFolder.add("contents", tcPdfData);*/ + selectBomFolder.add("contents", tcPdfData); + tcPdfData.lock(); + tcPdfData.save(); + tcPdfData.unlock(); + System.out.println("·"); + ChangeDbomUtil.setByPass(false); + long end = System.currentTimeMillis(); + float time2 = (end - start) / 1000.00f; + System.out.println("ʱ" + time2 + ""); + // this.wait.setBool(true); + // this.wait.interrupt(); + /* if (rename2 == false) { + MessageBox.post("Ѿ", "ɹ", MessageBox.INFORMATION); + } else { + MessageBox.post( + "ѾԭļѴڣļΪ:\n" + + outFilePath.substring( + outFilePath.lastIndexOf("\\") + 1, + outFilePath.length()), "ɹ", + MessageBox.INFORMATION); + + }*/ + // 20200224 + /* Runtime.getRuntime().exec( + new String[] { "cmd.exe", "/c", outFilePath });*/ + } else { + long end = System.currentTimeMillis(); + float time2 = (end - start) / 1000.00f; + System.out.println("ʱ" + time2 + ""); + // this.wait.setBool(true); + // this.wait.interrupt(); + /* if (rename2 == false) { + MessageBox.post("Ѿ", "ɹ", MessageBox.INFORMATION); + } else { + MessageBox.post( + "ѾԭļѴڣļΪ:\n" + + excelPath.substring( + excelPath.lastIndexOf("\\") + 1, + excelPath.length()), "ɹ", + MessageBox.INFORMATION); + + }*/ + /* Runtime.getRuntime().exec( + new String[] { "cmd.exe", "/c", excelPath });*/ + } + } catch (Exception e) { + // this.wait.setBool(true); + // this.wait.interrupt(); + // TODO: handle exception + }finally{ + DeleteFile.delFolder(path); + deletePdf(inFilePath); + wait.setBool(true); + wait.interrupt(); + + } + if(completeCount == allCount -1 ){ + MessageBox.post("Ѿ", "ɹ", MessageBox.INFORMATION); + } + } + + // жͬpdfǷѾ + boolean rename = false; + boolean rename2 = false; + + private String judge(String outFilePath) { + rename = false; + File pdfFile = new File(outFilePath); + if (pdfFile.exists()) { + String name = outFilePath.split("\\.pdf")[0]; + outFilePath = name + "(1).pdf"; + rename = true; + rename2 = true; + } + if (rename == true) { + outFilePath = judge(outFilePath); + } + return outFilePath; + + } + + private String judge2(String outFilePath) { + rename = false; + File pdfFile = new File(outFilePath); + if (pdfFile.exists()) { + String name = outFilePath.split("\\.xlsx")[0]; + outFilePath = name + "(1).xlsx"; + rename = true; + rename2 = true; + }else{ + + } + if (rename == true) { + outFilePath = judge2(outFilePath); + } + + return outFilePath; + + } + // Ƿд·򴴽 + public static void fileMkDir(String filePath) { + System.out.println("validFile(" + filePath + ")"); + try { + File f = new File(filePath); + if (!f.exists()) { + f.mkdir(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + // EXCELתPDF + public String xlsToPdf(String inFilePath, String outFilePath) { + ComThread.InitSTA(true); + // deletePdf(outFilePath); + ActiveXComponent ax = new ActiveXComponent("Excel.Application"); + try { + ax.setProperty("Visible", new Variant(false)); + ax.setProperty("AutomationSecurity", new Variant(3)); // ú + Dispatch excels = ax.getProperty("Workbooks").toDispatch(); + + Dispatch excel = Dispatch.invoke( + excels, + "Open", + Dispatch.Method, + new Object[] { inFilePath, new Variant(false), + new Variant(false) }, new int[9]).toDispatch(); + // תʽ + Dispatch.invoke(excel, "ExportAsFixedFormat", Dispatch.Method, + new Object[] { new Variant(0), // PDFʽ=0 + outFilePath, new Variant(0) // 0=׼ (ɵPDFͼƬģ) + // 1=Сļ + // (ɵPDFͼƬһͿ) + }, new int[1]); + + // ʹSaveAs + /* + * Dispatch.invoke(excel,"SaveAs",Dispatch.Method,new Object[]{ + * outFile, new Variant(57), new Variant(false), new Variant(57), + * new Variant(57), new Variant(false), new Variant(true), new + * Variant(57), new Variant(true), new Variant(true), new + * Variant(true) },new int[1]); + */ + + // Dispatch.call(excel, "Close", false); + + if (ax != null) { + ax.invoke("Quit", new Variant[] {}); + ax = null; + } + ComThread.Release(); + return ""; + } catch (Exception es) { + return es.toString(); + } + } + + /** + * PDFɾPDF + * + * @param pdfPath + */ + private void deletePdf(String pdfPath) { + File pdfFile = new File(pdfPath); + if (pdfFile.exists()) { + pdfFile.delete(); + } + } + + private exportBOM_Bean bean; + private List list = new ArrayList<>(); + private TCComponentBOMLine child; + private String realNumber = ""; + private int num = 0;// ż + + private void getBomline(TCComponentBOMLine bomline, String realNumber_0) { + AIFComponentContext[] childline = null; + String materialCode = "";// ϱ + String materialName = "";// + String techCode = "";// ͺ + String specCode = "";// ͺ + String quantity = "";// + String unit = "";// λ + String drawID = "";// ͼ + String global_list="";//ȫ + String local_list="";//ֲ + int number_0 = 0; + try { + childline = bomline.getChildren(); + for (int i = 0; i < childline.length; i++) { + number_0++; + bean = new exportBOM_Bean(); + if (!bomline.getTCProperty("bl_formatted_parent_name") + .getStringValue().equals("")) { + if (i > 0) { + realNumber_0 = realNumber_0.substring(0, + realNumber_0.lastIndexOf(".") + 1) + + number_0; + + } else { + realNumber_0 = realNumber_0 + "." + number_0; + + } + } else { + realNumber_0 = number_0 + ""; + + } + bean.setNumber(realNumber_0); + child = (TCComponentBOMLine) childline[i].getComponent(); + materialCode = child.getItemRevision().getTCProperty("item_id") + .getStringValue() + + "/" + + child.getItemRevision() + .getTCProperty("current_revision_id") + .getStringValue(); + bean.setMaterialCode(materialCode); + System.out.println(materialCode + "------------" + + realNumber_0); + materialName = child.getItemRevision() + .getTCProperty("object_name").getStringValue(); + bean.setMaterialName(materialName); + TCComponentForm form = (TCComponentForm) child + .getItemRevision().getReferenceListProperty( + "IMAN_master_form_rev")[0]; + techCode = form.getTCProperty("jk8TechModel").getStringValue(); + bean.setTechCode(techCode); + specCode = form.getTCProperty("jk8SpecModel").getStringValue(); + bean.setSpecCode(specCode); + quantity = child.getTCProperty("bl_quantity").getStringValue(); + bean.setQuantity(quantity); + unit = child.getProperty("bl_uom"); + bean.setUnit(unit); + + TCComponent[] components = child.getItemRevision() + .getReferenceListProperty("TC_Is_Represented_By"); + for (int j = 0; j < components.length; j++) { + drawID = drawID + + ((TCComponentItemRevision) components[j]) + .getTCProperty("item_id").getStringValue() + + ";"; + + } + drawID = drawID.trim(); + bean.setDrawID(drawID); + //2018.3.21ȫֺ;ֲ + TCComponent[] substituteComponents=child.getItem().getTCProperty("global_alt_list").getReferenceValueArray();//TODO + if(substituteComponents.length==0) { + global_list=""; + }else if(substituteComponents.length>0) { + global_list=""; + for (int j = 0; j < substituteComponents.length; j++) { + String id=""; + try { + id=((TCComponentItem)substituteComponents[j]).getTCProperty("item_id").getStringValue(); + } catch (Exception e) { + // TODO Auto-generated catch block + id=((TCComponentBOMView)substituteComponents[j]).getTCProperty("object_name").getStringValue().split("-")[0]; + e.printStackTrace(); + } + global_list=global_list+id+","; + } + } + if(global_list.length()>=1) { + + global_list=global_list.trim(); + global_list=global_list.substring(0, global_list.length()-1); + } + + bean.setGlobal_list(global_list); + + substituteComponents=child.getTCProperty("bl_substitute_list").getReferenceValueArray(); + if(substituteComponents.length==0) { + local_list=""; + }else if(substituteComponents.length>0) { + local_list=""; + for (int j = 0; j < substituteComponents.length; j++) { + String id=""; + try { + id=((TCComponentItem)substituteComponents[j]).getTCProperty("item_id").getStringValue(); + } catch (Exception e) { + // TODO Auto-generated catch block + id=((TCComponentBOMView)substituteComponents[j]).getTCProperty("object_name").getStringValue().split("-")[0]; + e.printStackTrace(); + } + local_list=local_list+id+","; + } + } + if(local_list.length()>=1) { + + local_list=local_list.trim(); + local_list=local_list.substring(0, local_list.length()-1); + } + + bean.setLocal_list(local_list); + + + + + list.add(bean); + if (child.getChildren().length > 0) { + getBomline(child, realNumber_0); + } + + } + } catch (TCException e) { + e.printStackTrace(); + } + + } + + private File getExcel(String ssx) { + File file = null; + preferenceService = session.getPreferenceService(); + String puid = preferenceService.getStringValue(ssx); + if (puid == null) { + MessageBox.post("ϵԱѡ", "", MessageBox.ERROR); + return null; + } + TCComponentDataset dataset = null; + try { + dataset = (TCComponentDataset) session.stringToComponent(puid); + } catch (TCException e) { + e.printStackTrace(); + } + if (dataset == null) { + MessageBox.post("ݼڣϵԱѡ", "", MessageBox.ERROR); + return null; + } + try { + TCComponentTcFile[] files = dataset.getTcFiles(); + if (files.length == 0) { + MessageBox.post("ݼûõļ,", "", MessageBox.ERROR); + return null; + } else if (files.length > 1) { + MessageBox.post("ݼõļ", "", MessageBox.ERROR); + return null; + } else { + file = files[0].getFmsFile(); + } + } catch (TCException e) { + e.printStackTrace(); + } + + return file; + } + + //ȡhomeļ´BOMṹݼfolder + public TCComponentFolder getFolder(){ + TCComponentUser user = session.getUser(); + TCComponentFolder bomFolder = null ; + try { + // TCComponentFolder newStuff = user.getNewStuffFolder(); + TCComponentFolder homeStuff = user.getHomeFolder(); + AIFComponentContext[] childFolders = homeStuff.getChildren(); + if(childFolders != null && childFolders.length > 0 ){ + for (int i = 0; i < childFolders.length; i++) { + InterfaceAIFComponent childFolder = childFolders[i].getComponent(); + if(childFolder instanceof TCComponentFolder){ + TCComponentFolder childSecFolder = (TCComponentFolder) childFolder; + if(childSecFolder.getProperty("object_string").equals("testݼ")) { + bomFolder = childSecFolder ; + break ; + } + } + } + } + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return bomFolder; + } + +} diff --git a/src/com/connor/jk/plm/exportBOM20200224/exportHardwareBOM_Bean.java b/src/com/connor/jk/plm/exportBOM20200224/exportHardwareBOM_Bean.java new file mode 100644 index 0000000..0496d49 --- /dev/null +++ b/src/com/connor/jk/plm/exportBOM20200224/exportHardwareBOM_Bean.java @@ -0,0 +1,82 @@ +package com.connor.jk.plm.exportBOM20200224; + +public class exportHardwareBOM_Bean { + private String materialCode;//ϱ룻2017.10.17ϱijid+汾 + private String materialName;// + private String ref_designator;//λ + private String specCode;//ͺ + private String quantity;// + private String unit;//λ + private String packaging;//װ + private String comment;//comment + public String getComment() { + return comment; + } + public void setComment(String comment) { + this.comment = comment; + } + private String number; + + private String global_bl_substitute_list;//2017.10.18 + private String local_bl_substitute_list;//2018.3.19ԭϸΪֲϺȫ + public String getGlobal_bl_substitute_list() { + return global_bl_substitute_list; + } + public void setGlobal_bl_substitute_list(String global_bl_substitute_list) { + this.global_bl_substitute_list = global_bl_substitute_list; + } + public String getLocal_bl_substitute_list() { + return local_bl_substitute_list; + } + public void setLocal_bl_substitute_list(String local_bl_substitute_list) { + this.local_bl_substitute_list = local_bl_substitute_list; + } + public String getNumber() { + return number; + } + public void setNumber(String number) { + this.number = number; + } + public String getMaterialCode() { + return materialCode; + } + public void setMaterialCode(String materialCode) { + this.materialCode = materialCode; + } + public String getMaterialName() { + return materialName; + } + public void setMaterialName(String materialName) { + this.materialName = materialName; + } + public String getRef_designator() { + return ref_designator; + } + public void setRef_designator(String ref_designator) { + this.ref_designator = ref_designator; + } + public String getSpecCode() { + return specCode; + } + public void setSpecCode(String specCode) { + this.specCode = specCode; + } + public String getQuantity() { + return quantity; + } + public void setQuantity(String quantity) { + this.quantity = quantity; + } + public String getUnit() { + return unit; + } + public void setUnit(String unit) { + this.unit = unit; + } + public String getPackaging() { + return packaging; + } + public void setPackaging(String packaging) { + this.packaging = packaging; + } +} diff --git a/src/com/connor/jk/plm/exportBOM20200224/exportHardwareBOM_Operation.java b/src/com/connor/jk/plm/exportBOM20200224/exportHardwareBOM_Operation.java new file mode 100644 index 0000000..11b4a0e --- /dev/null +++ b/src/com/connor/jk/plm/exportBOM20200224/exportHardwareBOM_Operation.java @@ -0,0 +1,1187 @@ +package com.connor.jk.plm.exportBOM20200224; + +import java.awt.Color; +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.List; + +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.IndexedColors; +import org.apache.poi.ss.util.CellRangeAddress; +import org.apache.poi.xssf.usermodel.XSSFCell; +import org.apache.poi.xssf.usermodel.XSSFCellStyle; +import org.apache.poi.xssf.usermodel.XSSFFont; +import org.apache.poi.xssf.usermodel.XSSFRow; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + +import com.connor.jk.plm.exportBOM.ProgressBarThread; +import com.jacob.activeX.ActiveXComponent; +import com.jacob.com.ComThread; +import com.jacob.com.Dispatch; +import com.jacob.com.Variant; +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.TCComponent; +import com.teamcenter.rac.kernel.TCComponentBOMLine; +import com.teamcenter.rac.kernel.TCComponentBOMView; +import com.teamcenter.rac.kernel.TCComponentDataset; +import com.teamcenter.rac.kernel.TCComponentDatasetType; +import com.teamcenter.rac.kernel.TCComponentFolder; +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.TCComponentTcFile; +import com.teamcenter.rac.kernel.TCComponentUser; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.kernel.ics.ICSProperty; +import com.teamcenter.rac.util.MessageBox; + +public class exportHardwareBOM_Operation extends AbstractAIFOperation { + private String text; + private String path; +// private ProgressBarThread wait; + private TCSession session; + private TCComponentBOMLine comp; + private FileInputStream fis; + private XSSFWorkbook workbook; + private FileOutputStream out; + private TCPreferenceService preferenceService; + private List list = new ArrayList<>(); + private exportHardwareBOM_Bean bean; + private TCComponentBOMLine child; + private String jbName = "";// + private String SBH = "";// ʶ + private String selectExportFileType; + private TCComponentFolder selectBomFolder ; + private int completeCount; + private int allCount; + ProgressBarThread wait; + + public exportHardwareBOM_Operation(String text, String path, TCSession session, + TCComponentBOMLine comp,String selectExportFileType, TCComponentFolder selectBomFolder, int i, int allCount) { + this.text = text; + this.path = path; +// this.wait = wait; + this.session = session; + this.comp = comp; + this.selectExportFileType=selectExportFileType; + this.selectBomFolder = selectBomFolder; + this.completeCount = i; + this.allCount = allCount; + wait = new ProgressBarThread("BOM嵥", "ִУԵ..."); + wait.start(); + } + + Integer[] keys = null; + String[] vals = null; + private String realNumber = ""; + @Override + public void executeOperation() throws Exception { + + //ץȡfnd0ActuatedInteractiveTsks fnd0Performer fnd0EndDate fnd0AliasTaskName + String name1="";// + String name2="";// + String name3="";//׼ + TCComponent[] component=comp.getItemRevision().getTCProperty("fnd0ActuatedInteractiveTsks").getReferenceValueArray(); +// System.out.println(component.length); + for (int i = 0; i < component.length; i++) { + // + if(component[i].getTCProperty("fnd0AliasTaskName").getStringValue().contains("")) { + name1=component[i].getTCProperty("fnd0Performer").getDisplayValue().split("\\(")[0]; + name1=name1+"/"+component[i].getTCProperty("fnd0EndDate").getDisplayValue(); + }else if(component[i].getTCProperty("fnd0AliasTaskName").getStringValue().contains("")) { + name2=component[i].getTCProperty("fnd0Performer").getDisplayValue().split("\\(")[0]; + name2=name2+"/"+component[i].getTCProperty("fnd0EndDate").getDisplayValue(); + }else if(component[i].getTCProperty("fnd0AliasTaskName").getStringValue().contains("׼")) { + name3=component[i].getTCProperty("fnd0Performer").getDisplayValue().split("\\(")[0]; + name3=name3+"/"+component[i].getTCProperty("fnd0EndDate").getDisplayValue(); + } + } + +// if(true) { +// return; +// } + long start = System.currentTimeMillis(); + int colsCount = 17;//2017.10.18һ 2017.10.26һcomment2018.3.19һ + // ȡ + TCComponentItemRevision itemRevision = comp.getItemRevision(); + String ck=itemRevision.getProperty("item_id")+"/"+itemRevision.getProperty("item_revision_id"); + TCComponentICO[] icoS = itemRevision.getClassificationObjects(); + + int count = 0; + int count1 = 0; + System.out.println("з--------------"+icoS.length); + for (int i = 0; i < icoS.length; i++) { + String revId=icoS[i].getProperty("id"); + ICSProperty[] cPropS = icoS[i].getICSProperties(true); + + System.out.println("з--------"+ cPropS.length); + for (int j = 0; j < cPropS.length; j++) { +// System.out.println(count); + count++; + } + keys = new Integer[count]; + vals = new String[count]; + for (int j = 0; j < cPropS.length; j++) { +// System.out.println(count); + keys[count1] = cPropS[j].getId(); + System.out.println("keys[" + count1 + "]================>" + keys[count1]); + vals[count1] = cPropS[j].getValue(); + System.out.println("vals[" + count1 + "]================>" + vals[count1]); + if (keys[count1] == 1050) {//keys[count1] == -500293 2021/1/5Ǩƺid + if(revId.equals(ck)) { + + jbName = vals[count1]; + } + + } else if (keys[count1] == 50205015) { // keys[count1] == -500301 2021/1/5Ǩƺid + if(revId.equals(ck)) { + + SBH = vals[count1]; + } + + } + count1++; + } + + } + String sxx = "jk_bom2_uid";// G8TlM0X6YvbLjA G8TlM0X6YvbLjA TJXl8kmSYvbLjA + File file = getExcel(sxx); + if (file == null) { + return; + } + getBomline(comp,realNumber);//ȡ + System.out.println("BOM" + list.size() + ""); + int rowCount = list.size(); + fis = new FileInputStream(file); + workbook = new XSSFWorkbook(fis); + //һе + XSSFFont font2 = workbook.createFont(); + font2.setFontName(""); + font2.setFontHeightInPoints((short) 11);// С + //ƣλŵȵʽ + XSSFFont font4 = workbook.createFont(); + font4.setFontName(""); + font4.setFontHeightInPoints((short) 10);// С + //Bŵ + XSSFFont font = workbook.createFont(); + font.setFontName("΢ź"); + font.setFontHeightInPoints((short) 9);// С + + XSSFSheet sheet = workbook.getSheet("Ӳ嵥"); + XSSFRow row = sheet.getRow(1); + XSSFCell cell_0 = row.getCell(3); + cell_0.setCellValue(comp.getItemRevision().getTCProperty("item_id").getStringValue()); + cell_0 = row.getCell(12); + cell_0.setCellValue(comp.getItemRevision().getTCProperty("item_revision_id").getStringValue()); + row = sheet.getRow(2); + cell_0 = row.getCell(3); + System.out.println("------------"+jbName); + cell_0.setCellValue(jbName); + cell_0 = row.getCell(12); + cell_0.setCellValue(SBH); + row = sheet.getRow(4); + cell_0 = row.getCell(3); + Date date=new Date(); + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); + String time= sdf.format(date); + time=time.replace("-", "."); + cell_0.setCellValue(time);//Ч + int startRow = 6; + + XSSFCellStyle sty = workbook.createCellStyle();// ½Ԫĸʽ + XSSFCellStyle style = workbook.createCellStyle();// Cϱ뵥Ԫĸʽ + XSSFCellStyle sty2 = workbook.createCellStyle();//BеԪʽ + sty2.setBorderBottom((short) 1); + sty2.setBorderLeft((short) 2); + sty2.setBorderRight((short) 1); + sty2.setBorderTop((short) 1); + sty2.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER); + sty2.setFont(font); + //P7ĸʽ + XSSFCellStyle styP7 = workbook.createCellStyle();//BеԪʽ + styP7.setBorderBottom((short) 1); + styP7.setBorderLeft((short) 1); + styP7.setBorderRight((short) 1); + styP7.setBorderTop((short) 2); + styP7.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER); + styP7.setFont(font); + + XSSFCellStyle sty3 = workbook.createCellStyle();// QбעԪĸʽ + XSSFCellStyle sty4 = workbook.createCellStyle();// кһеĸʽ + XSSFCellStyle sty5 = workbook.createCellStyle();// һעĸʽ + sty5.setBorderTop((short) 2); + sty5.setBorderRight((short) 2); + XSSFCellStyle sty6 = workbook.createCellStyle();// ˵Ԫĸʽ + XSSFCellStyle sty7 = workbook.createCellStyle();// /ڵԪĸʽ + + sty6.setBorderTop((short) 1); + sty6.setBorderBottom((short) 2); + sty6.setBorderLeft((short) 2); + sty6.setBorderRight((short) 1); + + sty7.setBorderLeft((short) 1); + sty7.setBorderBottom((short) 2); + sty7.setBorderRight((short) 2); + sty7.setBorderTop((short) 1); + + sty.setBorderBottom((short) 1); + sty.setBorderLeft((short) 1); + sty.setBorderRight((short) 1); + sty.setBorderTop((short) 1); + sty.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER);// ֱ + sty.setAlignment(XSSFCellStyle.ALIGN_LEFT);// ˮƽ + + style.setBorderBottom(CellStyle.BORDER_THIN); + style.setBorderTop((short) 1); + style.setAlignment(XSSFCellStyle.ALIGN_CENTER); // + style.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER); // + style.setFont(font); + + sty3.setBorderBottom((short) 1); + sty3.setBorderLeft((short) 1); + sty3.setBorderRight((short) 2); + sty3.setBorderTop((short) 1); + sty4.setBorderTop((short)1); + sty4.setBorderBottom((short)2); + sty4.setBorderLeft((short)1); + sty4.setBorderRight((short)1); + + sty4.setFont(font2); + sty4.setAlignment(XSSFCellStyle.ALIGN_CENTER); + for (int i = 0; i < rowCount + 7; i++) { + XSSFRow r = null; + boolean isCreate = false; +// System.out.println("sheet.getLastRowNum()-------->" + sheet.getLastRowNum()); + if ((i + startRow) > sheet.getLastRowNum()) { + r = sheet.createRow(i + startRow); + isCreate = true; + } else { + r = sheet.getRow(i + startRow); + isCreate = false; + } + if (i < rowCount + 3 && isCreate) { + + CellRangeAddress cra = new CellRangeAddress(i + startRow, i + startRow, 8, 9); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(i + startRow, i + startRow, 6, 7); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(i + startRow, i + startRow, 4, 5); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(i + startRow, i + startRow, 2, 3); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(i + startRow, i + startRow, 12,13);//2017.10.26 + sheet.addMergedRegion(cra); + } + + for (int cols = 1; cols < colsCount; cols++) { + XSSFCell cell = null; + if (isCreate) { + cell = r.createCell(cols); + + cell.setCellStyle(sty); + if (cols == 1) { + cell.setCellStyle(sty2); + } else if (cols == 16) { + cell.setCellStyle(sty3); + } + } else { +// if (r == null) { +// r = sheet.createRow(i + startRow); +// System.out.println("ûд"); +// } + cell = r.getCell(cols); + } + if (cell == null) { + // cell = r.createCell(cols); + // cell.setCellStyle(sty); + } + + cell.setCellType(XSSFCell.CELL_TYPE_STRING);// ıʽ + + // XSSFCellStyle sty0=sheet.getRow(9).getCell(11).getCellStyle(); + //и + if (i < rowCount) { + int rwsTemp = list.get(i).getSpecCode().length()/2+1; //ͺ + int rwsTemp1 = list.get(i).getRef_designator().length()/3+1;//λ + int rwsTemp2 = list.get(i).getPackaging().length()/2+1; //װ + int rwsTemp3 = list.get(i).getGlobal_bl_substitute_list().length()/3+1; // + int rwsTemp4 = list.get(i).getLocal_bl_substitute_list().length()/3+1; // + int rwsTemp5 = list.get(i).getComment().length()/3+1; //comment + int rwsTemp6= list.get(i).getMaterialName().length()/2+1; // + + int temp; + + int a[]=new int[]{rwsTemp,rwsTemp1,rwsTemp2,rwsTemp3,rwsTemp4,rwsTemp5,rwsTemp6}; + Arrays.sort(a); + for(int i1=0;i1"+a[i1]); + } + temp=a[6]; + + cell.getCellStyle().setWrapText(true); +// r.setHeight((short)(temp * 110-(temp-1)*20)); + r.setHeight((short)(temp * 100)); + } + if (i < rowCount) { + + switch (cols) { + case 1:// + if (list.get(i) == null) { + /* this.wait.setBool(true); + this.wait.interrupt(); + MessageBox.post("BOM嵥Ϊ", "", MessageBox.INFORMATION);*/ + return; + } else { + + if (i > 0) { + cell.setCellStyle(sty2); + + } + cell.setCellValue(list.get(i).getNumber()); + System.out.println(list.get(i).getNumber()); + break; + } + + case 2:// ϱ + // if(i>2) { + // sty0=sheet.getRow(9).getCell(cols).getCellStyle(); + // cell.setCellStyle(sty0); + // } + if (i >= 2) { + cell.setCellStyle(style); + + } + + cell.setCellValue(list.get(i).getMaterialCode());// д + break; + case 4:// + cell.getCellStyle().setFont(font4); + cell.getCellStyle().setAlignment(CellStyle.ALIGN_LEFT); + cell.setCellValue(list.get(i).getMaterialName()); + break; + case 6:// ͺ + cell.getCellStyle().setFont(font4); + cell.setCellValue(list.get(i).getRef_designator()); +// System.out.println("λ-------------"+list.get(i).getRef_designator()); + break; + case 8:// ͺ + cell.getCellStyle().setFont(font4); + cell.setCellValue(list.get(i).getSpecCode()); + + // cell.setCellStyle(styG); + break; + + //2017.10.26 Comment + case 10:// Comment + cell.getCellStyle().setFont(font4); + cell.setCellType(Cell.CELL_TYPE_STRING); + cell.setCellValue(list.get(i).getComment()); + break; + case 11:// + cell.getCellStyle().setFont(font4); + cell.setCellType(Cell.CELL_TYPE_STRING); + cell.setCellValue(list.get(i).getQuantity()); +// System.out.println("--------------->"+list.get(i).getQuantity()); + break; + case 12:// װ + cell.getCellStyle().setFont(font4); + cell.getCellStyle().setAlignment(CellStyle.ALIGN_LEFT); + cell.setCellValue(list.get(i).getPackaging()); + break; + case 14:// ȫ + cell.setCellValue(list.get(i).getGlobal_bl_substitute_list()); + break; + case 15:// ֲ + cell.setCellValue(list.get(i).getLocal_bl_substitute_list()); + break; + case 16:// ע + cell.setCellStyle(sty3); + break; + } + } + } + } + XSSFCell cell14=sheet.getRow(6).getCell(16); + cell14.setCellStyle(sty5); + + + // һеĵ±߿ + XSSFCell cellLast = null; + for (int cols = 1; cols < colsCount; cols++) { + cellLast = sheet.getRow(startRow + rowCount + 6).getCell(cols); + switch (cols) { + case 1:// + cellLast.setCellValue("/"); + cellLast.setCellStyle(sty2); + break; + case 2:// + + cellLast.setCellStyle(sty4); + break; + case 3:// + cellLast.setCellValue("/"); + cellLast.setCellStyle(sty4); + break; + case 4:// + + cellLast.setCellStyle(sty4); + break; + case 5:// + cellLast.setCellValue("׼/"); + cellLast.setCellStyle(sty4); + break; + case 6:// + + cellLast.setCellStyle(sty4); + break; + case 7:// + cellLast.setCellValue("ĵ"); + cellLast.setCellStyle(sty4); + break; + case 8:// + + cellLast.setCellStyle(sty4); + break; + case 9:// + cellLast.setCellValue(""); + cellLast.setCellStyle(sty4); + break; + case 10:// + cellLast.setCellStyle(sty4); + break; + case 11:// + cellLast.setCellValue(""); + cellLast.setCellStyle(sty4); + break; + case 12:// + cellLast.setCellValue("/"); + + cellLast.setCellStyle(sty4); + break; + case 13:// + + cellLast.setCellStyle(sty4); + break; + case 14:// + + cellLast.setCellStyle(sty4); + break; + case 15:// + + cellLast.setCellStyle(sty4); + break; + case 16:// ע + + cellLast.setCellStyle(sty3); + break; + } + } + // һеԪɫ߿ + for (int i = startRow + rowCount+6; i < startRow + rowCount + 7; i++) { + XSSFCell cell = null; + for (int cols = 1; cols < colsCount; cols++) { + cell = sheet.getRow(i).getCell(cols); + switch (cols) { + case 1:// + + cell.setCellStyle(sty6); + break; + + case 16:// ע + + if (i > 0) { + + cell.setCellStyle(sty7); + } + break; + } + } + } + // ϲǩĵԪ + CellRangeAddress cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + 5, 1, 2); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + 5, 3, 4); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + 5, 5, 6); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + 5, 7, 8); + sheet.addMergedRegion(cra); + //2017.10.26 ϲ910 + cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + 5, 9, 10); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + 5, 11, 11); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 3, rowCount + startRow + 5, 12, 16); + sheet.addMergedRegion(cra); + // ϲһ + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + 6, 1, 2); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + 6, 3, 4); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + 6, 5, 6); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + 6, 7, 8); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + 6, 9, 10); + sheet.addMergedRegion(cra); + cra = new CellRangeAddress(rowCount + startRow + 6, rowCount + startRow + 6, 12, 16); + sheet.addMergedRegion(cra); + // õеĵ±߿ + XSSFCell cell5 = null; + for (int cols = 1; cols < colsCount; cols++) { + cell5 = sheet.getRow(startRow + rowCount + 2).getCell(cols); + switch (cols) { + + case 1:// + + cell5.setCellStyle(sty4); + break; + case 2:// + + cell5.setCellStyle(sty4); + break; + case 3:// + + cell5.setCellStyle(sty4); + break; + case 4:// + + cell5.setCellStyle(sty4); + break; + case 5:// + + cell5.setCellStyle(sty4); + break; + case 6:// + + cell5.setCellStyle(sty4); + break; + case 7:// + + cell5.setCellStyle(sty4); + break; + case 8:// + + cell5.setCellStyle(sty4); + break; + case 9:// + + cell5.setCellStyle(sty4); + break; + case 10:// + + cell5.setCellStyle(sty4); + break; + case 11:// + + cell5.setCellStyle(sty4); + break; + case 12:// + + cell5.setCellStyle(sty4); + break; + case 13:// + + cell5.setCellStyle(sty4); + break; + case 14:// ע + + cell5.setCellStyle(sty4); + break; + case 15:// ע + + cell5.setCellStyle(sty4); + break; + case 16:// ע + + cell5.setCellStyle(sty4); + break; + } + } + + XSSFCell cell0=sheet.getRow(startRow + rowCount + 2).getCell(1); + cell0.setCellStyle(sty6);//5еԪA + + cell0=sheet.getRow(startRow + rowCount + 2).getCell(16); + cell0.setCellStyle(sty7);//5еԪQ + + XSSFCell cell1=sheet.getRow(startRow + rowCount + 4).getCell(1); + cell1.setCellStyle(sty6); + cell1=sheet.getRow(startRow + rowCount + 4).getCell(16); + cell1.setCellStyle(sty7); + +// XSSFRow row1=sheet.getRow(startRow + rowCount + 3); +// row1.getCell(1).getCellStyle().getFont().setFontHeightInPoints((short) 10); +// row1.getCell(1).getCellStyle().getFont().setFontName("Tahoma"); + XSSFCell cell2=sheet.getRow(startRow + rowCount + 3).getCell(1);//4AԪĸʽ + cell2.getCellStyle().getFont().setFontHeightInPoints((short) 10); + cell2.getCellStyle().getFont().setFontName(""); + cell2.setCellValue(name1);// + cell2=sheet.getRow(startRow + rowCount + 3).getCell(3); + cell2.setCellValue(name2);// + cell2=sheet.getRow(startRow + rowCount + 3).getCell(5); + cell2.setCellValue(name3);//׼ + + + cell2 = sheet.getRow(startRow + rowCount + 3).getCell(1); + cell2.getCellStyle().setAlignment((short) 1); + cell2.getCellStyle().setVerticalAlignment((short) 1); + cell2.getCellStyle().setWrapText(true);//Զ +// cell2.getCellStyle().setFont(font3); + + + sheet.getRow(startRow + rowCount + 6).setHeight((short)402);//һеĸ߶ + cellLast = sheet.getRow(startRow + rowCount + 6).getCell(1); + cellLast.getCellStyle().setAlignment(CellStyle.ALIGN_LEFT); + cellLast.getCellStyle().setVerticalAlignment(CellStyle.VERTICAL_CENTER); + cellLast = sheet.getRow(startRow + rowCount + 6).getCell(3); + cellLast.getCellStyle().setAlignment(CellStyle.ALIGN_LEFT); + cellLast.getCellStyle().setVerticalAlignment(CellStyle.VERTICAL_CENTER); + + cellLast = sheet.getRow( 6).getCell(2); + cellLast.getCellStyle().setAlignment(CellStyle.ALIGN_CENTER); + cellLast = sheet.getRow( 7).getCell(2); + cellLast.getCellStyle().setAlignment(CellStyle.ALIGN_CENTER); + + sheet.getRow(6).getCell(15).setCellStyle(styP7); + + + // 2017.11.21 Ȱصû·£ȻתΪpdf + //ѡ񵼳pdf + File fileout; + String usrHome = System.getProperty("user.home"); +// System.out.println("usrHome=" + usrHome); + String excelPath=path + "\\" + text + ".xlsx"; + fileMkDir(path); + if(selectExportFileType.equals("Excel")) { + excelPath=judge2(excelPath); + + fileout = new File(excelPath); + }else { + // fileout = new File(path + "\\" + text + ".xlsx"); + fileout = new File(usrHome + "\\" + text + ".xlsx"); + } + +// File fileout = new File(path + "\\" + type + ".xlsx"); +// File fileout = new File(usrHome + "\\" + type + ".xlsx"); + try { + out = new FileOutputStream(fileout); + } catch (Exception e) { + /* this.wait.setBool(true); + this.wait.interrupt(); + MessageBox.post("ȹرͬļ", "", MessageBox.INFORMATION);*/ + return; + // e.printStackTrace(); + } + workbook.write(out); + // 20200224 + try { + if (selectExportFileType.equals("Excel")) { + TCComponentDatasetType dataType = (TCComponentDatasetType) session.getTypeComponent("Dataset"); + TCComponentDataset tcData = dataType.create(text, "description", "MSExcelX"); + /* TCComponentFolder bomFolder = getFolder(); + bomFolder.add("contents", tcData);*/ + selectBomFolder.add("contents", tcData); + tcData.setFiles(new String[] { excelPath }, new String[] { "excel" }); + tcData.lock(); + tcData.save(); + tcData.unlock(); + + DeleteFile.delFolder(path); + } + } catch (Exception e) { + + }finally{ + + } + + // תpdf + String inFilePath = path + "\\" + text + ".xlsx"; +// String inFilePath = usrHome + "\\" + type + ".xlsx"; + // String outFilePath = System.getProperty("user.home") + "\\" + text + ".pdf"; + String outFilePath = path + "\\" + text + ".pdf"; + try { + if(!selectExportFileType.equals("Excel")) { + + //תpdf + System.out.println("------תpdf"); + // inFilePath = path + "\\" + text + ".xlsx"; + inFilePath = usrHome + "\\" + text + ".xlsx"; + outFilePath=judge(outFilePath); + xlsToPdf(inFilePath, outFilePath); + // 20200224 + TCComponentDatasetType dataType = (TCComponentDatasetType) session.getTypeComponent("Dataset"); + TCComponentDataset tcPdfData = dataType.create(text, "description", "PDF"); + tcPdfData.setFiles(new String[] { outFilePath }, new String[] { "PDF_Reference" }); + /* TCComponentFolder bomFolder = getFolder(); + bomFolder.add("contents", tcPdfData);*/ + selectBomFolder.add("contents", tcPdfData); + tcPdfData.lock(); + tcPdfData.save(); + tcPdfData.unlock(); + + + long end = System.currentTimeMillis(); + float time2 = (end - start) / 1000.00f; + System.out.println("ʱ" + time2 + ""); + /* this.wait.setBool(true); + this.wait.interrupt(); + if(rename2==false) { + MessageBox.post("Ѿ", "ɹ", MessageBox.INFORMATION); + }else { + MessageBox.post("ѾԭļѴڣļΪ:\n"+outFilePath.substring(outFilePath.lastIndexOf("\\")+1,outFilePath.length()), "ɹ", MessageBox.INFORMATION); + + }*/ + // Runtime.getRuntime().exec(new String[] { "cmd.exe", "/c", outFilePath });// + }else { + long end = System.currentTimeMillis(); + float time2 = (end - start) / 1000.00f; + System.out.println("ʱ" + time2 + ""); + /* this.wait.setBool(true); + this.wait.interrupt(); + if(rename2==false) { + MessageBox.post("Ѿ", "ɹ", MessageBox.INFORMATION); + }else { + MessageBox.post("ѾԭļѴڣļΪ:\n"+excelPath.substring(excelPath.lastIndexOf("\\")+1,excelPath.length()), "ɹ", MessageBox.INFORMATION); + + }*/ + // Runtime.getRuntime().exec(new String[] { "cmd.exe", "/c", excelPath });// + } + } catch (Exception e) { + // TODO: handle exception + }finally{ + DeleteFile.delFolder(path); + deletePdf(outFilePath); + wait.setBool(true); + wait.interrupt(); + } + + if(completeCount == allCount -1 ){ + MessageBox.post("Ѿ", "ɹ", MessageBox.INFORMATION); + } + + + // 2017.11.21 Ȱصû·£ȻתΪpdf +// String usrHome = System.getProperty("user.home"); +// System.out.println("usrHome=" + usrHome); + +// File fileout = new File(path + "\\" + text + ".xlsx"); +//// File fileout = new File(usrHome + "\\" + text + ".xlsx"); +// try { +// out = new FileOutputStream(fileout); +// } catch (Exception e) { +// this.wait.setBool(true); +// this.wait.interrupt(); +// MessageBox.post("ȹرͬļ","",MessageBox.INFORMATION); +// return; +// } +// workbook.write(out); +// // תpdf +// String inFilePath = path + "\\" + text + ".xlsx"; +//// String inFilePath = usrHome + "\\" + text + ".xlsx"; +// String outFilePath = path + "\\" + text + ".pdf"; +// // deletePdf(outFilePath);//ɾѾڵpdf,Ҫ޸ļ +// outFilePath=judge(outFilePath); +// System.out.println(System.getProperty("java.library.path")); +// xlsToPdf(inFilePath, outFilePath); +//// deletePdf(inFilePath); +// long end = System.currentTimeMillis(); +// float time2 = (end - start) / 1000.00f; +// System.out.println("ʱ" + time2 + ""); +//// System.out.println("汾----------------------->"+comp.getItemRevision().getTCProperty("item_revision_id").getStringValue()); +// this.wait.setBool(true); +// this.wait.interrupt(); +// if(rename2==false) { +// MessageBox.post("Ѿ", "ɹ", MessageBox.INFORMATION); +// }else { +// MessageBox.post("ѾԭļѴڣļΪ:\n"+outFilePath.substring(outFilePath.lastIndexOf("\\")+1,outFilePath.length()), "ɹ", MessageBox.INFORMATION); +// +// } +// Runtime.getRuntime().exec(new String[] { "cmd.exe", "/c", outFilePath });// +// System.out.println("2017.11.2"); + } + private String judge2(String outFilePath) { + rename=false; + File pdfFile = new File(outFilePath); + if (pdfFile.exists()) { + String name=outFilePath.split("\\.xlsx")[0]; + outFilePath = name + "(1).xlsx"; + rename=true; + rename2=true; + } + if(rename==true) { + outFilePath=judge2(outFilePath); + } + return outFilePath; + + } + //жͬpdfǷѾ + boolean rename=false; + boolean rename2=false; + private String judge(String outFilePath) { + rename=false; + + File pdfFile = new File(outFilePath); + if (pdfFile.exists()) { + String name=outFilePath.split("\\.pdf")[0]; + outFilePath = name + "(1).pdf"; + rename=true; + rename2=true; + } + if(rename==true) { + outFilePath=judge(outFilePath); + } + return outFilePath; + + } + // Ƿд·򴴽 + public static void fileMkDir(String filePath) { + System.out.println("validFile(" + filePath + ")"); + try { + File f = new File(filePath); + if (!f.exists()) { + f.mkdir(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + // EXCELתPDF + public String xlsToPdf(String inFilePath, String outFilePath) { + ComThread.InitSTA(true); + + ActiveXComponent ax = new ActiveXComponent("Excel.Application"); + try { + ax.setProperty("Visible", new Variant(false)); + ax.setProperty("AutomationSecurity", new Variant(3)); // ú + Dispatch excels = ax.getProperty("Workbooks").toDispatch(); + + Dispatch excel = Dispatch.invoke(excels, "Open", Dispatch.Method, + new Object[] { inFilePath, new Variant(false), new Variant(false) }, new int[9]) + .toDispatch(); + // תʽ + Dispatch.invoke(excel, "ExportAsFixedFormat", Dispatch.Method, new Object[] { new Variant(0), // PDFʽ=0 + outFilePath, new Variant(0) // 0=׼ (ɵPDFͼƬģ) 1=Сļ (ɵPDFͼƬһͿ) + }, new int[1]); + + // ʹSaveAs + /* + * Dispatch.invoke(excel,"SaveAs",Dispatch.Method,new Object[]{ outFile, new + * Variant(57), new Variant(false), new Variant(57), new Variant(57), new + * Variant(false), new Variant(true), new Variant(57), new Variant(true), new + * Variant(true), new Variant(true) },new int[1]); + */ + +// Dispatch.call(excel, "Close", false); + + if (ax != null) { + ax.invoke("Quit", new Variant[] {}); + ax = null; + } + ComThread.Release(); + return ""; + } catch (Exception es) { + return es.toString(); + } + } + + /** + * PDFɾPDF + * + * @param pdfPath + */ + private void deletePdf(String pdfPath) { + File pdfFile = new File(pdfPath); + if (pdfFile.exists()) { + pdfFile.delete(); + } + } + + private File getExcel(String ssx) { + File file = null; + preferenceService = session.getPreferenceService(); + String puid = preferenceService.getStringValue(ssx); + if (puid == null) { + MessageBox.post("ϵԱѡ", "", MessageBox.ERROR); + return null; + } + TCComponentDataset dataset = null; + try { + dataset = (TCComponentDataset) session.stringToComponent(puid); + } catch (TCException e) { + e.printStackTrace(); + } + if (dataset == null) { + MessageBox.post("ݼڣϵԱѡ", "", MessageBox.ERROR); + return null; + } + try { + TCComponentTcFile[] files = dataset.getTcFiles(); + if (files.length == 0) { + MessageBox.post("ݼûõļ,", "", MessageBox.ERROR); + return null; + } else if (files.length > 1) { + MessageBox.post("ݼõļ", "", MessageBox.ERROR); + return null; + } else { + file = files[0].getFmsFile(); + } + } catch (TCException e) { + e.printStackTrace(); + } + + return file; + } + + + private void getBomline(TCComponentBOMLine bomline, String realNumber_0) { + AIFComponentContext[] childline = null; + String materialCode = "";// ϱ + String materialName = "";// + String specCode = "";// ͺ + String quantity = "";// + String unit = "";// λ + String ref_designator = "";// λ + String packaging = "";// װ + String comment="";//comment + String bl_substitute_list="";//(ȫֺ;ֲ) + int number_0 = 0; + try { + childline = bomline.getChildren(); + for (int i = 0; i < childline.length; i++) { + + number_0++; + bean = new exportHardwareBOM_Bean(); + if (!bomline.getTCProperty("bl_formatted_parent_name").getStringValue().equals("")) { + if (i > 0) { + realNumber_0 = realNumber_0.substring(0, realNumber_0.lastIndexOf(".") + 1) + number_0; + + } else { + realNumber_0 = realNumber_0 + "." + number_0; + + } + } else { + realNumber_0 = number_0 + ""; + + } + bean.setNumber(realNumber_0); + + child = (TCComponentBOMLine) childline[i].getComponent(); + //2017.10.17ϱԸij"/汾" + materialCode = child.getItemRevision().getTCProperty("item_id").getStringValue()+"/"+ child.getItemRevision().getTCProperty("current_revision_id").getStringValue(); + bean.setMaterialCode(materialCode); + materialName = child.getItemRevision().getTCProperty("object_name").getStringValue(); + bean.setMaterialName(materialName); + packaging = ""; + comment=""; + TCComponentICO[] icoS = child.getItemRevision().getClassificationObjects(); + int count = 0; + int count1 = 0; + for (int j = 0; j < icoS.length; j++) { + ICSProperty[] cPropS = icoS[j].getICSProperties(true); + for (int k = 0; k < cPropS.length; k++) { +// System.out.println(count); + count++; + } + keys = new Integer[count]; + vals = new String[count]; + for (int k = 0; k < cPropS.length; k++) { +// System.out.println(count); + keys[count1] = cPropS[k].getId(); + System.out.println("keys[" + count1 + "]================>" + keys[count1]); + vals[count1] = cPropS[k].getValue(); + System.out.println("vals[" + count1 + "]================>" + vals[count1]); + if (keys[count1] == 1066) {//keys[count1] == -500242 2021/1/5Ǩƺid + packaging = vals[count1]; + + } + if (keys[count1] == 1000) {//keys[count1] == -500239 2021/1/5Ǩƺid + comment = vals[count1]; + + } + count1++; + } + + } + + bean.setPackaging(packaging); + bean.setComment(comment); + TCComponentForm form = (TCComponentForm) child.getItemRevision() + .getReferenceListProperty("IMAN_master_form_rev")[0]; + // techCode = form.getTCProperty("jk8TechModel").getStringValue(); + // bean.setTechCode(techCode); + specCode = form.getTCProperty("jk8SpecModel").getStringValue(); + bean.setSpecCode(specCode); + ref_designator = child.getTCProperty("bl_ref_designator").getStringValue(); + // + System.out.println("ָʾ------------------->" + ref_designator); + + //2017.10.26 C1-C3ijC1,C2,C3ĸʽ + String[] xx=ref_designator.split(","); + List ref_designator_list=new ArrayList<>(); + for (int k = 0; k < xx.length; k++) { + if(xx[k].contains("-")) { + + String strings1=xx[k].split("-")[0];//Сֵ + String strings2=xx[k].split("-")[1];//ֵ + //ֵ + String up=""; + int up_num=0; + for (int j = strings2.length()-1;j>=0; j--) { + if(Character.isDigit(strings2.charAt(j))==true) { + up=strings2.charAt(j)+up; + }else { + break; + } + + } + up_num=Integer.valueOf(up); + //Сֵ + String down=""; + int down_num=0; + int mark=0; + for(int j = strings1.length()-1;j>=0; j--) { + if(Character.isDigit(strings1.charAt(j))==true) { + down=strings1.charAt(j)+down; + }else { + mark=j; + break; + } + } + down_num=Integer.valueOf(down); + //ͷλ + String wh=strings1.substring(0, mark+1); + for (int j = down_num; j <= up_num; j++) { + String aa=wh+j; + ref_designator_list.add(aa); + } + + + }else if(!xx[k].contains("-")) { + ref_designator_list.add(xx[k]); + } + } +// bean.setRef_designator(ref_designator);//ҪC1,C2,C3ʾλžע + ref_designator=""; + for (int j = 0; j < ref_designator_list.size(); j++) { + ref_designator=ref_designator+ref_designator_list.get(j)+","; + } + ref_designator=ref_designator.substring(0,ref_designator.length()-1); + bean.setRef_designator(ref_designator);//ҪC1-C3ʾλžע + + + + quantity = child.getTCProperty("bl_quantity").getStringValue().split("\\.")[0];//2017.10.26 ʾС +// if(Integer.valueOf(quantity)>3) { +// quantity=quantity+"-"; +// } + bean.setQuantity(quantity); + unit = child.getProperty("bl_uom"); + bean.setUnit(unit); + + //2017.10.18 + //2018.3.21ȫ +// TCComponent[] components=child.getTCProperty("global_bl_substitute_list").getReferenceValueArray(); + TCComponent[] components=child.getItem().getTCProperty("global_alt_list").getReferenceValueArray(); + if(components.length==0) { + bl_substitute_list=""; + }else if(components.length>0) { + bl_substitute_list=""; + for (int j = 0; j < components.length; j++) { + //2018.1.16 + String id=""; + try { + id=((TCComponentItem)components[j]).getTCProperty("item_id").getStringValue(); + } catch (Exception e) { + id=((TCComponentBOMView)components[j]).getTCProperty("object_name").getStringValue().split("-")[0]; + e.printStackTrace(); + } + bl_substitute_list=bl_substitute_list+id+","; + } + } + if(bl_substitute_list.length()>=1) { + + bl_substitute_list=bl_substitute_list.trim(); + bl_substitute_list=bl_substitute_list.substring(0, bl_substitute_list.length()-1); + } + + bean.setGlobal_bl_substitute_list(bl_substitute_list); + + //2018.3.19 Ӳ嵥ģСϡһУΪȫϡֲϡ + components=child.getTCProperty("bl_substitute_list").getReferenceValueArray(); + if(components.length==0) { + bl_substitute_list=""; + }else if(components.length>0) { + bl_substitute_list=""; + for (int j = 0; j < components.length; j++) { + String id=""; + try { + id=((TCComponentItem)components[j]).getTCProperty("item_id").getStringValue(); + } catch (Exception e) { + id=((TCComponentBOMView)components[j]).getTCProperty("object_name").getStringValue().split("-")[0]; + e.printStackTrace(); + } + bl_substitute_list=bl_substitute_list+id+","; + } + } + if(bl_substitute_list.length()>=1) { + + bl_substitute_list=bl_substitute_list.trim(); + bl_substitute_list=bl_substitute_list.substring(0, bl_substitute_list.length()-1); + } + + bean.setLocal_bl_substitute_list(bl_substitute_list); + + + list.add(bean); + if (child.getChildren().length > 0) { + getBomline(child,realNumber_0); + } + + } + } catch (TCException e) { + e.printStackTrace(); + } + + } + //ȡhomeļ´BOMṹݼfolder + public TCComponentFolder getFolder() { + TCComponentUser user = session.getUser(); + TCComponentFolder bomFolder = null; + try { + // TCComponentFolder newStuff = user.getNewStuffFolder(); + TCComponentFolder homeStuff = user.getHomeFolder(); + AIFComponentContext[] childFolders = homeStuff.getChildren(); + if (childFolders != null && childFolders.length > 0) { + for (int i = 0; i < childFolders.length; i++) { + InterfaceAIFComponent childFolder = childFolders[i] + .getComponent(); + if (childFolder instanceof TCComponentFolder) { + TCComponentFolder childSecFolder = (TCComponentFolder) childFolder; + if (childSecFolder.getProperty("object_string").equals("testݼ")) { + bomFolder = childSecFolder; + break; + } + } + } + } + } catch (TCException e) { + e.printStackTrace(); + } + return bomFolder; + } + +} diff --git a/src/com/connor/jk/plm/exportForm/ExportHZB_Dialog.java b/src/com/connor/jk/plm/exportForm/ExportHZB_Dialog.java new file mode 100644 index 0000000..474e03d --- /dev/null +++ b/src/com/connor/jk/plm/exportForm/ExportHZB_Dialog.java @@ -0,0 +1,156 @@ +package com.connor.jk.plm.exportForm; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.File; +import java.util.Map; + +import javax.swing.BorderFactory; +import javax.swing.JButton; +import javax.swing.JFileChooser; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTable; +import javax.swing.JTextField; +import javax.swing.border.TitledBorder; +import javax.swing.filechooser.FileSystemView; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; + +public class ExportHZB_Dialog extends AbstractAIFDialog { + + private JTextField textField; + private JButton okButton; + private JButton celButton; + private JButton pathButton; + // ļѡ + private JFileChooser jFileChooser; + + private TCComponentForm form; + private TCSession session; + + public ExportHZB_Dialog(TCComponentForm form,TCSession session) { + // TODO Auto-generated constructor stub + this.form=form; + this.session=session; + //ExportHZB_Operation ex=new ExportHZB_Operation(maptab); + //session.queueOperation(ex); + } + + public void run() { + initUI(); + + } + private void initUI() { + // TODO Auto-generated method stub + FileSystemView fsv = FileSystemView.getFileSystemView(); // õϵͳfileview + String deskPath = fsv.getHomeDirectory().getPath(); // ǰû· + + this.setSize(new Dimension(600, 400)); + this.setTitle(""); + this.textField = new JTextField(deskPath); + + jFileChooser = new JFileChooser(); + this.jFileChooser.setCurrentDirectory(new File(deskPath));// ļѡijʼĿ¼Ϊǰû + this.jFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + + this.pathButton = new JButton("..."); + this.okButton = new JButton("ȷ"); + this.celButton = new JButton("ȡ"); + + + JPanel midJPanel = new JPanel(new PropertyLayout()); + midJPanel.setBorder(new TitledBorder(BorderFactory + .createLineBorder(Color.WHITE), "ѡ񵼳·")); // ߿ TitleBorder + midJPanel.add("1.1.left.top", new JLabel(" ")); + midJPanel.add("2.1.left.top", new JLabel("·")); + midJPanel.add("2.2.left.top", this.textField); + midJPanel.add("2.3.left.top", this.pathButton); + JPanel rootJPanel = new JPanel(new FlowLayout()); + rootJPanel.add(this.okButton); + rootJPanel.add(this.celButton); + + pathButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + selectFileButtonEvent(); + } + }); + okButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + if (textField.getText().contains(".")) { + MessageBox.post("ѡļУ", "", MessageBox.WARNING); + } else { + okEvent(); + } + } + }); + celButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + celEvent(); + + } + }); + + this.setLayout(new BorderLayout()); + this.add(midJPanel, BorderLayout.CENTER); + this.add(rootJPanel, BorderLayout.SOUTH); + + this.centerToScreen(); + this.pack(); + this.setVisible(true); + this.showDialog(); + } + + public void celEvent() { + // TODO Auto-generated method stub + this.disposeDialog(); + this.dispose(); + } + + public void selectFileButtonEvent() { + int state = jFileChooser.showOpenDialog(null);// ˾ǴļѡĴ + if (state == 1) { + return; + } else { + File f = jFileChooser.getSelectedFile();// fΪѡ񵽵Ŀ¼ + textField.setText(f.getAbsolutePath()); + } + } + + public void okEvent() { + + this.disposeDialog(); + this.dispose(); + + try { + String path=textField.getText(); + System.out.println("ok"); + ExportHZB_Operation op=new ExportHZB_Operation(form,session,path); + session.queueOperation(op); + + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + +} diff --git a/src/com/connor/jk/plm/exportForm/ExportHZB_Handler.java b/src/com/connor/jk/plm/exportForm/ExportHZB_Handler.java new file mode 100644 index 0000000..42b9400 --- /dev/null +++ b/src/com/connor/jk/plm/exportForm/ExportHZB_Handler.java @@ -0,0 +1,40 @@ +package com.connor.jk.plm.exportForm; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.connor.jk.plm.createproject.CreateProjrct_Action; +import com.connor.jk.plm.imform.ImfomAIFDialog; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class ExportHZB_Handler extends AbstractHandler { + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + // TODO Auto-generated method stub + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + InterfaceAIFComponent targetComp = app.getTargetComponent(); + TCSession session = (TCSession) app.getSession(); + if(targetComp==null){ + MessageBox.post("ѡ²ƷͺŵǼDZִв","",MessageBox.ERROR); + return null; + } + if("JK8NewPModNORegForm".equals(targetComp.getType())){ + System.out.println("start"); + ExportHZB_Dialog action=new ExportHZB_Dialog((TCComponentForm)targetComp,session); + new Thread(action).start(); + + }else{ + MessageBox.post("ѡ²ƷͺŵǼDZִв","",MessageBox.ERROR); + } + + return null; + } + +} diff --git a/src/com/connor/jk/plm/exportForm/ExportHZB_Operation.java b/src/com/connor/jk/plm/exportForm/ExportHZB_Operation.java new file mode 100644 index 0000000..a011fcb --- /dev/null +++ b/src/com/connor/jk/plm/exportForm/ExportHZB_Operation.java @@ -0,0 +1,806 @@ +package com.connor.jk.plm.exportForm; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.swing.JTable; + +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 com.connor.jk.plm.bom.until.ProgressBarThread; +import com.teamcenter.rac.aif.AbstractAIFOperation; +import com.teamcenter.rac.kernel.TCComponentDataset; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCComponentTcFile; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class ExportHZB_Operation extends AbstractAIFOperation { + private Map maptab; + // private JTable dataTable1;// 1 + // private JTable dataTable2;// 2 + // private JTable dataTable3;// 3 + // private JTable dataTable4;// 4 + // private JTable dataTable5;// 5 + // private JTable dataTable6;// 6 + // private JTable dataTable7;// 7 + private Map>> mapVal; + private List> list1 = new ArrayList<>(); + private List> list2 = new ArrayList<>(); + private List> list3 = new ArrayList<>(); + private List> list4 = new ArrayList<>(); + private List> list5 = new ArrayList<>(); + private List> list6 = new ArrayList<>(); + private List> list7 = new ArrayList<>(); + private List> list8 = new ArrayList<>(); + private List> list9 = new ArrayList<>(); + private List> list10 = new ArrayList<>(); + private List> list11 = new ArrayList<>(); + private List> list12 = new ArrayList<>();//2019.07.31 + + + private String[] lx; // Ʒ + private String[] xmmc;// Ŀ + private String[] xmbh;// Ŀ + private String[] cpxh;// Ʒͺ + private String[] sbh;// ʶ + private String[] cpmc;// Ʒ + private String[] jbcj;// + private String[] ickxh;// ICͺ + private String[] xlbxh;// ·ͺ + private String[] cxtz;// + private String[] tdxh;// ͺ + private String[] gngs;// ܸ + private String[] khtsyq;// ͻҪ + // private String[] u8mmh;// U8 + private String[] fm;// + private String[] jmlx;// + private String[] sqr;// + private String[] djrq;// Ǽ + private String[] sysc;// г + private String[] ptjbcj;// ׻ + + private String[] status;// ״̬ //2018.6.4½4 + private String[] fmlx;// " + private String[] txfs;// ͨŷʽ + private String[] gdlx;// 緽ʽ + // TODO 2019.07.31 +// private String[] qtzl;// +// private String[] sycs;// ʹó +// private String[] bjbf;// ⲿֵĹϵ +// private String[] scxhzl;// ź +// private String[] cptzh;// Ʒ + + + private String[] tcqt;// ̽ + private String[] yycs;// Ӧó + private String[] txyn;//ͨŷʽ(л) + private String[] scxh;// ź + private String[] sccj;// + //2022/11/18 + private String[] fbzh;// ֤ + private String[] xpzh;// ֤ + private String[] cspz;// ʼ + private String[] mz;// ģ + private String[] xp;// оƬ + private String[] xy;// Э + private String[] znf;// ֹ淧 + private String[] qyk;// ȡѹ + private String[] jkpm;// ƤĤ + private String[] jxwb;// е² + private String[] klc;// + private String[] jbcgfs;// ɹʽ + private String[] jbys;// ɫ + private String[] hztj;// ת + private String[] wbbj;// ⲿ + private String[] mzfc;// ַ + private String[] gdfc;// ܵ + private String[] szld;// ʱ﮵ + private String[] ddsc;// ϴ + private String[] ghzy;// ۻר + private String[] wbzlogo;// װlogo + private String[] mxts;// ÿ̨ + private String[] cpghfs;// Ʒʽ + private String[] yhfffs;// ûѷʽ + private String[] xmjl;// Ŀ + private String[] bz;// ע + private String[] sfts;// Ƿͣ + private String[] tsyy;// ͣԭ + private String[] tshxcp;// ͣۺ²Ʒ + private String[] sqrq;// + private String[] jxhdz;// + private String[] kh;// + private String[] cpzxl; + private String[] lbdm; + private String[] lsh; + private String[] jbcj2; + private TCComponentForm form; + private TCSession session; + private String path; + private File file; + + private XSSFSheet sheet; + private XSSFWorkbook workBook; + private FileInputStream fis; + private FileOutputStream fos; + private String excelPath; + private ProgressBarThread wait; + + public ExportHZB_Operation(Map maptab) { + // TODO Auto-generated constructor stub + this.maptab = maptab; + // dataTable1=maptab.get("ñ"); + // dataTable2=maptab.get("ҵ"); + // dataTable3=maptab.get("ɼ"); + // dataTable4=maptab.get(""); + // dataTable5=maptab.get(""); + // dataTable6=maptab.get("ֵ"); + // dataTable7=maptab.get("ֳֻ"); + + } + + public ExportHZB_Operation(TCComponentForm form, TCSession session, + String path) { + // TODO Auto-generated constructor stub + this.form = form; + this.session = session; + this.path = path; + + } + + private void getval() { + // TODO Auto-generated method stub + try { + lx = form.getTCProperty("jk8ProductType").getStringArrayValue(); + xmbh = form.getTCProperty("jk8ProjectNO").getStringArrayValue();// Ŀ + xmmc = form.getTCProperty("jk8ProjectName").getStringArrayValue();// Ŀ + cpxh = form.getTCProperty("jk8ProductModNO").getStringArrayValue();// Ʒͺ + sbh = form.getTCProperty("jk8ProductIdentifyNO") + .getStringArrayValue();// ʶ + cpmc = form.getTCProperty("jk8ProductName").getStringArrayValue();// Ʒ + jbcj = form.getTCProperty("jk8BaseMeterManufactor") + .getStringArrayValue();// + ickxh = form.getTCProperty("jk8ICCardType").getStringArrayValue();// ICͺ + xlbxh = form.getTCProperty("jk8CircBoardModNO") + .getStringArrayValue();// ·ͺ + cxtz = form.getTCProperty("jk8ProgramFeatures") + .getStringArrayValue();// + tdxh = form.getTCProperty("jk8InsteadType").getStringArrayValue();// ͺ + gngs = form.getTCProperty("jk8FunctionOverview") + .getStringArrayValue();// ܸ + khtsyq = form.getTCProperty("jk8CustSpecRequirements") + .getStringArrayValue();// ͻҪ + // u8mmh = form.getTCProperty("jk8U8NO").getStringArrayValue();// + // U8 + fm = form.getTCProperty("jk8Valve").getStringArrayValue();// + jmlx = form.getTCProperty("jk8EncryptType").getStringArrayValue();// + sqr = form.getTCProperty("jk8Applicant").getStringArrayValue();// + djrq = form.getTCProperty("jk8RecordDate").getStringArrayValue();// Ǽ + sysc = form.getTCProperty("jk8ApplyMarket").getStringArrayValue();// г + ptjbcj = form.getTCProperty("jk8BMManfMatched") + .getStringArrayValue();// ׻ + status = form.getTCProperty("jk8Status").getStringArrayValue();// ״̬ + fmlx = form.getTCProperty("jk8ValveType").getStringArrayValue();// + txfs = form.getTCProperty("jk8CommunicateMode").getStringArrayValue();// ͨŷʽ + gdlx = form.getTCProperty("jk8PowerSupplyMode").getStringArrayValue();// + //2019.07.31 ʹó ⲿֵĹϵ ź Ʒ + //2020.08.05̽ Ӧó ͨŷʽ(л) ź +// qtzl = form.getTCProperty("jk8GasType").getStringArrayValue();// +// sycs=form.getTCProperty("jk8UsePlace").getStringArrayValue(); +// //bjbf=form.getTCProperty("jk8AlaDectRelation").getStringArrayValue(); +// scxhzl=form.getTCProperty("jk8OutputSignal").getStringArrayValue(); +// cptzh=form.getTCProperty("jk8ProFeatNum").getStringArrayValue(); + + tcqt = form.getTCProperty("jk8GasType").getStringArrayValue();// ̽ + yycs=form.getTCProperty("jk8UsePlace").getStringArrayValue();// Ӧó + txyn=form.getTCProperty("jk8CommunicateMode2").getStringArrayValue();//ͨŷʽ(л) + scxh=form.getTCProperty("jk8OutputSignal").getStringArrayValue();// ź + sccj=form.getTCProperty("jk8Manufacturer").getStringArrayValue();// + + + fbzh = form.getTCProperty("jk8FlameproofType").getStringArrayValue();// ֤ + xpzh = form.getTCProperty("jk8TypeCerNo").getStringArrayValue();// ֤ + cspz = form.getTCProperty("jk8InitConfig").getStringArrayValue();// ʼ + mz = form.getTCProperty("jk8Module").getStringArrayValue();// ģ + xp = form.getTCProperty("jk8Chip").getStringArrayValue();// оƬ + xy = form.getTCProperty("jk8Agreement").getStringArrayValue();// Э + znf = form.getTCProperty("jk8BackstopValve").getStringArrayValue();// ֹ淧 + qyk = form.getTCProperty("jk8PressureTap").getStringArrayValue();// ȡѹ + jkpm = form.getTCProperty("jk8ImpSkin").getStringArrayValue();// ƤĤ + jxwb = form.getTCProperty("jk8MechTempC").getStringArrayValue();// е² + klc = form.getTCProperty("jk8WideRange").getStringArrayValue();// + jbcgfs = form.getTCProperty("jk8BMBuy").getStringArrayValue();// ɹʽ + jbys = form.getTCProperty("jk8BMColor").getStringArrayValue();// ɫ + hztj = form.getTCProperty("jk8GyratoryVolume").getStringArrayValue();// ת + wbbj = form.getTCProperty("jk8ExAlarm").getStringArrayValue();// ⲿ + mzfc = form.getTCProperty("jk8FaceAntiRemove").getStringArrayValue();// ַ + gdfc = form.getTCProperty("jk8PipeAntiRemove").getStringArrayValue();// ܵ + szld = form.getTCProperty("jk8ClockLiBattey").getStringArrayValue();// ʱ﮵ + ddsc = form.getTCProperty("jk8UploadPowerFail").getStringArrayValue();// ϴ + ghzy = form.getTCProperty("jk8ForHK").getStringArrayValue();// ۻר + wbzlogo = form.getTCProperty("jk8PackageLogo").getStringArrayValue();// װlogo + mxts = form.getTCProperty("jk8PerBoxUnits").getStringArrayValue();// ÿ̨ + cpghfs = form.getTCProperty("jk8SupplyMode").getStringArrayValue();// Ʒʽ + yhfffs = form.getTCProperty("jk8UserPayMethod").getStringArrayValue();// ûѷʽ + xmjl = form.getTCProperty("jk8ProjectManager").getStringArrayValue();// Ŀ + bz = form.getTCProperty("jk8Remarks").getStringArrayValue();// ע + sfts = form.getTCProperty("jk8StopSale").getStringArrayValue();// Ƿͣ + tsyy = form.getTCProperty("jk8ReasonsStopSale").getStringArrayValue();// ͣԭ + tshxcp = form.getTCProperty("jk8StopSaleNewProduct").getStringArrayValue();// ͣۺ²Ʒ + sqrq = form.getTCProperty("jk8ApplyDate").getStringArrayValue();// + + jxhdz = form.getTCProperty("jk8Customized").getStringArrayValue();// ߻ + kh = form.getTCProperty("jk8Customer").getStringArrayValue();// ͻ + cpzxl = form.getTCProperty("jk8ProductFamily").getStringArrayValue();// Ʒϵ + lbdm = form.getTCProperty("jk8ContrlCompType").getStringArrayValue();// + lsh = form.getTCProperty("jk8Applicant").getStringArrayValue();//ˮ + jbcj2 = form.getTCProperty("jk8BMManufactor").getStringArrayValue();// + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + wait.setBool(true);// رս + wait.interrupt(); + } + if (lx != null && lx.length > 0) { + int len = lx.length; + for (int i = 0; i < len; i++) { + List list = new ArrayList<>(); + if ("tb1".equals(lx[i])) { + list.add(sbh[i]); + list.add(jxhdz[i]); + list.add(kh[i]); + list.add(cpmc[i]); + list.add(cpxh[i]); + list.add(fbzh[i]); + list.add(xpzh[i]); + list.add(cpzxl[i]); + list.add(cspz[i]); + list.add(mz[i]); + list.add(xp[i]); + list.add(xy[i]); + list.add(lx[i]); + list.add(lbdm[i]); +// + list.add(jbcj2[i]); + + list.add(znf[i]); + list.add(qyk[i]); + list.add(jkpm[i]); + list.add(jxwb[i]); + list.add(klc[i]); + list.add(jbcgfs[i]); + + //list.add(khtsyq[i]);//ģظ + list.add(jbys[i]); + + list.add(hztj[i]); + list.add(ghzy[i]); + + list.add(fm[i]); + list.add(szld[i]); + list.add(wbbj[i]); + list.add(mzfc[i]); + list.add(gdfc[i]); + + list.add(ddsc[i]); + + list.add(wbzlogo[i]); + list.add(mxts[i]); + list.add(cpghfs[i]); + list.add(yhfffs[i]); + list.add(ickxh[i]); + list.add(jmlx[i]); + list.add(xmmc[i]); + list.add(xmbh[i]); + list.add(xmjl[i]); + list.add(bz[i]); + list.add(tsyy[i]); + list.add(tshxcp[i]); + list.add(sfts[i]); + list.add(lsh[i]); + list.add(sqrq[i]); + + list1.add(list); + } else if ("tb2".equals(lx[i])) { + list.add(xmmc[i]); + list.add(xmbh[i]); + list.add(cpxh[i]); + list.add(sbh[i]); + list.add(cpmc[i]); + list.add(xlbxh[i]); + list.add(gngs[i]); + list.add(tdxh[i]); + list.add(sqr[i]); + list.add(djrq[i]); + list.add(status[i]); + list2.add(list); + } else if ("tb3".equals(lx[i])) { + list.add(xmmc[i]); + list.add(xmbh[i]); + list.add(cpxh[i]); + list.add(sbh[i]); + list.add(cpmc[i]); + list.add(gngs[i]); + list.add(sysc[i]); + list.add(sqr[i]); + list.add(djrq[i]); + list.add(status[i]); + list3.add(list); + } else if ("tb4".equals(lx[i])) { + list.add(xmmc[i]); + list.add(xmbh[i]); + list.add(cpxh[i]); + list.add(sbh[i]); + list.add(cpmc[i]); + list.add(ptjbcj[i]); + list.add(gngs[i]); + list.add(sqr[i]); + list.add(djrq[i]); + list.add(status[i]); + list4.add(list); + } else if ("tb5".equals(lx[i])) { + list.add(xmmc[i]); + list.add(xmbh[i]); + list.add(cpmc[i]); + list.add(cpxh[i]); + list.add(sbh[i]); + list.add(gngs[i]); + list.add(sqr[i]); + list.add(djrq[i]); + list.add(status[i]); + list5.add(list); + } else if ("tb6".equals(lx[i])) { + list.add(xmmc[i]); + list.add(xmbh[i]); + list.add(cpmc[i]); + list.add(cpxh[i]); + list.add(sbh[i]); + list.add(gngs[i]); + list.add(sqr[i]); + list.add(djrq[i]); + list.add(status[i]); + list6.add(list); + + } else if ("tb7".equals(lx[i])) { + list.add(xmmc[i]); + list.add(xmbh[i]); + list.add(cpmc[i]); + list.add(cpxh[i]); + list.add(sbh[i]); + list.add(gngs[i]); + list.add(sqr[i]); + list.add(djrq[i]); + list.add(status[i]); + list7.add(list); + }else if ("tb8".equals(lx[i])) { + list.add(xmmc[i]); + list.add(xmbh[i]); + list.add(cpmc[i]); + list.add(cpxh[i]); + list.add(sbh[i]); + list.add(gngs[i]); + list.add(sqr[i]); + list.add(djrq[i]); + list.add(status[i]); + list8.add(list); + }else if ("tb9".equals(lx[i])) { + list.add(xmmc[i]); + list.add(xmbh[i]); + list.add(cpmc[i]); + list.add(cpxh[i]); + list.add(sbh[i]); + list.add(gngs[i]); + list.add(sqr[i]); + list.add(djrq[i]); + list.add(status[i]); + list9.add(list); + }else if ("tb10".equals(lx[i])) { + list.add(xmmc[i]); + list.add(xmbh[i]); + list.add(cpmc[i]); + list.add(cpxh[i]); + list.add(sbh[i]); + + list.add(fmlx[i]);// " + list.add(txfs[i]);// ͨŷʽ + list.add(gdlx[i]);// 緽ʽ + + list.add(sqr[i]); + list.add(djrq[i]); + list.add(status[i]); + list10.add(list); + }else if ("tb12".equals(lx[i])) { +// "Ŀ", "Ŀ", "Ʒ",//3 +// "Ʒͺ", "Ӧó","̽","", +// "ͨŷʽ(л)","ͨŷʽ","緽ʽ","ź","ʶ","״̬" + +// "", +// "Ŀ", "Ŀ", "Ʒ",//3 +// "Ʒͺ", "Ӧó","̽","","ͨŷʽ(л)","ͨŷʽ", +// "緽ʽ","ź","ʶ","", "Ǽ","״̬" + list.add(xmmc[i]); + list.add(xmbh[i]); + list.add(cpmc[i]); + list.add(cpxh[i]); + + list.add(yycs[i]); + list.add(tcqt[i]); + list.add(sccj[i]); + list.add(txyn[i]); + list.add(txfs[i]); + + list.add(gdlx[i]); + list.add(scxh[i]); + + + list.add(sbh[i]); + list.add(sqr[i]); + list.add(djrq[i]); + list.add(status[i]); + //list11.add(list);//ԭĴ + list12.add(list);//2020.07.27޸ + }else if (lx[i]==null ||"tb11".equals(lx[i])||"".equals(lx[i])) { + list.add(xmmc[i]); + list.add(xmbh[i]); + list.add(cpmc[i]); + list.add(cpxh[i]); + list.add(sbh[i]); + list.add(gngs[i]); + list.add(sqr[i]); + list.add(djrq[i]); + list.add(status[i]); + list11.add(list); + } + + + } + } + + } + + @Override + public void executeOperation() throws Exception { + // TODO Auto-generated method stub + file = getSXX(); + if (file != null) { + wait = new ProgressBarThread("ݵ", + "ݵУԵ..."); + wait.start();// + // getVal(); + try { + getval(); + writeExcel(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + wait.setBool(true);// رս + wait.interrupt(); + } + wait.setBool(true);// رս + wait.interrupt(); + MessageBox.post("","",MessageBox.INFORMATION); + Runtime.getRuntime().exec("cmd /c \"" + excelPath + "\""); + } + + } + + public File getSXX() { + TCPreferenceService pref = session.getPreferenceService(); + String puid = pref.getStringValue("JK_SQB_Dataset_Puid");// ѡpuid + if (puid != null) { + try { + TCComponentDataset dataset = (TCComponentDataset) session + .stringToComponent(puid); + if (dataset == null) { + return null; + } + TCComponentTcFile[] file = dataset.getTcFiles(); + if (file.length == 0 || file.length != 1) { + MessageBox.post("ݼûõļļ࣬飡", "WARNING", + MessageBox.WARNING); + return null; + } else { + File fmsFile = file[0].getFmsFile(); + return fmsFile; + } + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } else { + MessageBox.post("δҵѡ[JK_SQB_Dataset_Puid]ѡô", "", + MessageBox.ERROR); + return null; + } + return null; + } + + public void writeExcel() { + // TODO Auto-generated method stub + + try { + fis = new FileInputStream(file); + workBook = new XSSFWorkbook(fis); + if (workBook != null) { + int sheetlength = workBook.getNumberOfSheets(); + List sheetNameList = new ArrayList<>(); + for (int i = 0; i < sheetlength; i++) { + sheetNameList.add(workBook.getSheetName(i)); + } + for (String sheetName : sheetNameList) { + XSSFSheet sheet = workBook.getSheet(sheetName); + if (sheetName.equals("ñ")) { + writeSheet(sheet,list1); + } else if (sheetName.equals("ҵ")) { + writeSheet(sheet,list2); + } else if (sheetName.equals("ɼ")) { + writeSheet(sheet,list3); + } else if (sheetName.equals("")) { + writeSheet(sheet,list4); + } else if (sheetName.equals("")) { + writeSheet(sheet,list5); + } else if (sheetName.equals("ֵ")) { + writeSheet(sheet,list6); + } else if (sheetName.equals("ֳֻ")) { + writeSheet(sheet,list7); + }else if (sheetName.equals("")) { + writeSheet(sheet,list8); + }else if (sheetName.equals("ģ")) { + writeSheet(sheet,list9); + }else if (sheetName.equals("")) { + writeSheet(sheet,list10); + }else if (sheetName.equals("")) { + writeSheet(sheet,list11); + }else if (sheetName.equals("")) { + writeSheet(sheet,list12); + } + + } + + SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");// ڸʽ + String time = df.format(new Date()); + excelPath = path + File.separator + "ƷͺʶŻܱ" + + time + ".xlsx"; + File fileout = new File(excelPath); + fos = new FileOutputStream(fileout); + workBook.write(fos); + // Runtime.getRuntime().exec(excelPath); + + + + } + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + wait.setBool(true);// رս + wait.interrupt(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + wait.setBool(true);// رս + wait.interrupt(); + } + + } + + public void writeSheet(XSSFSheet sheet, List> list) { + // TODO Auto-generated method stub + for (int i = 0; i < list.size(); i++) { + XSSFRow rowm = sheet.createRow(i + 1); + XSSFCellStyle sty =workBook.createCellStyle(); //sheet.getRow(0).getCell(0).getCellStyle(); + for (int j = 0; j < list.get(i).size(); j++) { + XSSFCell c = rowm.createCell(j); + c.setCellStyle(sty); + c.setCellValue(list.get(i).get(j)==null?"":list.get(i).get(j)); + + + } + + } + + } + + // public void getVal() { + // // TODO Auto-generated method stub + // mapVal=new HashMap>>(); + // List> tbList; + // List tableList; + // int rowCount1 = dataTable1.getRowCount(); + // int rowCount2 = dataTable2.getRowCount(); + // int rowCount3 = dataTable3.getRowCount(); + // int rowCount4 = dataTable4.getRowCount(); + // int rowCount5 = dataTable5.getRowCount(); + // int rowCount6 = dataTable6.getRowCount(); + // int rowCount7 = dataTable7.getRowCount(); + // tbList=new ArrayList<>(); + // for (int j = 0; j < rowCount1; j++) { + // tableList=new ArrayList<>(); + // tableList.add(dataTable1.getValueAt(j, + // 1)==null?"":(String)dataTable1.getValueAt(j, 1));//Ŀ + // tableList.add(dataTable1.getValueAt(j, + // 2)==null?"":(String)dataTable1.getValueAt(j, 2));//Ŀ + // tableList.add(dataTable1.getValueAt(j, + // 3)==null?"":(String)dataTable1.getValueAt(j, 3)); + // tableList.add(dataTable1.getValueAt(j, + // 4)==null?"":(String)dataTable1.getValueAt(j, 4));// ʶ + // tableList.add(dataTable1.getValueAt(j, + // 5)==null?"":(String)dataTable1.getValueAt(j, 5));// Ʒ + // tableList.add(dataTable1.getValueAt(j, + // 6)==null?"":(String)dataTable1.getValueAt(j, 6));// + // tableList.add(dataTable1.getValueAt(j, + // 7)==null?"":(String)dataTable1.getValueAt(j, 7));// ICͺ + // tableList.add(dataTable1.getValueAt(j, + // 8)==null?"":(String)dataTable1.getValueAt(j, 8));// ·ͺ + // tableList.add(dataTable1.getValueAt(j, + // 9)==null?"":(String)dataTable1.getValueAt(j, 9));// + // tableList.add(dataTable1.getValueAt(j, + // 10)==null?"":(String)dataTable1.getValueAt(j, 10));// ͺ + // tableList.add(dataTable1.getValueAt(j, + // 11)==null?"":(String)dataTable1.getValueAt(j, 11));// ܸ + // tableList.add(dataTable1.getValueAt(j, + // 12)==null?"":(String)dataTable1.getValueAt(j, 12));// ͻҪ + // tableList.add(dataTable1.getValueAt(j, + // 13)==null?"":(String)dataTable1.getValueAt(j, 13));// + // tableList.add(dataTable1.getValueAt(j, + // 14)==null?"":(String)dataTable1.getValueAt(j, 14));// + // tableList.add(dataTable1.getValueAt(j, + // 15)==null?"":(String)dataTable1.getValueAt(j, 15));// + // tableList.add(dataTable1.getValueAt(j, + // 16)==null?"":(String)dataTable1.getValueAt(j, 16));// Ǽ + // tbList.add(tableList); + // } + // mapVal.put("ñ", tbList); + // tbList=new ArrayList<>(); + // for (int j = 0; j < rowCount2; j++) { + // tableList=new ArrayList<>(); + // tableList.add(dataTable2.getValueAt(j, 1)==null?"":(String) + // dataTable2.getValueAt(j, 1));//Ŀ + // tableList.add(dataTable2.getValueAt(j, 2)==null?"":(String) + // dataTable2.getValueAt(j, 2));//Ŀ + // tableList.add(dataTable2.getValueAt(j, 3)==null?"":(String) + // dataTable2.getValueAt(j, 3));// Ʒͺ + // tableList.add(dataTable2.getValueAt(j, 4)==null?"":(String) + // dataTable2.getValueAt(j, 4));// ʶ + // tableList.add(dataTable2.getValueAt(j, 5)==null?"":(String) + // dataTable2.getValueAt(j, 5));// Ʒ + // tableList.add(dataTable2.getValueAt(j, 6)==null?"":(String) + // dataTable2.getValueAt(j, 6));// ·ͺ + // tableList.add(dataTable2.getValueAt(j, 7)==null?"":(String) + // dataTable2.getValueAt(j, 7));// ܸ + // tableList.add(dataTable2.getValueAt(j, 8)==null?"":(String) + // dataTable2.getValueAt(j, 8));// ͺ + // tableList.add(dataTable2.getValueAt(j, 9)==null?"":(String) + // dataTable2.getValueAt(j, 9));// + // tableList.add(dataTable2.getValueAt(j, 10)==null?"":(String) + // dataTable2.getValueAt(j, 10));// Ǽ + // tbList.add(tableList); + // } + // mapVal.put("ҵ", tbList); + // + // tbList=new ArrayList<>(); + // for (int j = 0; j < rowCount3; j++) { + // tableList=new ArrayList<>(); + // tableList.add(dataTable3.getValueAt(j, 1)==null?"":(String) + // dataTable3.getValueAt(j, 1));// Ŀ + // tableList.add(dataTable3.getValueAt(j, 2)==null?"":(String) + // dataTable3.getValueAt(j, 2));// Ŀ + // tableList.add(dataTable3.getValueAt(j, 3)==null?"":(String) + // dataTable3.getValueAt(j, 3));// Ʒͺ + // tableList.add(dataTable3.getValueAt(j, 4)==null?"":(String) + // dataTable3.getValueAt(j, 4));// ʶ + // tableList.add(dataTable3.getValueAt(j, 5)==null?"":(String) + // dataTable3.getValueAt(j, 5));// Ʒ + // tableList.add(dataTable3.getValueAt(j, 6)==null?"":(String) + // dataTable3.getValueAt(j, 6));// ܸ + // tableList.add(dataTable3.getValueAt(j, 7)==null?"":(String) + // dataTable3.getValueAt(j, 7));// г + // tableList.add(dataTable3.getValueAt(j, 8)==null?"":(String) + // dataTable3.getValueAt(j, 8));// + // tableList.add(dataTable3.getValueAt(j, 9)==null?"":(String) + // dataTable3.getValueAt(j, 9));// Ǽ + // + // } + // mapVal.put("ɼ", tbList); + // + // tbList=new ArrayList<>(); + // for (int j =0; j < rowCount4; j++) { + // tableList=new ArrayList<>(); + // tableList.add( dataTable4.getValueAt(j, 1)==null?"":(String) + // dataTable4.getValueAt(j, 1));// Ŀ + // tableList.add( dataTable4.getValueAt(j, 2)==null?"":(String) + // dataTable4.getValueAt(j, 2));// Ŀ + // tableList.add( dataTable4.getValueAt(j, 3)==null?"":(String) + // dataTable4.getValueAt(j, 3));// ʶ + // tableList.add( dataTable4.getValueAt(j, 4)==null?"":(String) + // dataTable4.getValueAt(j, 4));// Ʒ + // tableList.add( dataTable4.getValueAt(j, 5)==null?"":(String) + // dataTable4.getValueAt(j, 5));// ׻ + // tableList.add(dataTable4.getValueAt(j, 6)==null?"":(String) + // dataTable4.getValueAt(j, 6));// ܸ + // tableList.add( dataTable4.getValueAt(j, 7)==null?"":(String) + // dataTable4.getValueAt(j, 7));// + // tableList.add( dataTable4.getValueAt(j, 8)==null?"":(String) + // dataTable4.getValueAt(j, 8));// Ǽ + // + // } + // mapVal.put("", tbList); + // + // tbList=new ArrayList<>(); + // for (int j = 0; j < rowCount5; j++) { + // tableList=new ArrayList<>(); + // tableList.add(dataTable5.getValueAt(j, 1)==null?"":(String) + // dataTable5.getValueAt(j, 1));// Ŀ + // tableList.add(dataTable5.getValueAt(j, 2)==null?"":(String) + // dataTable5.getValueAt(j, 2));// Ŀ + // tableList.add(dataTable5.getValueAt(j, 3)==null?"":(String) + // dataTable5.getValueAt(j, 3));// Ʒ + // tableList.add(dataTable5.getValueAt(j, 4)==null?"":(String) + // dataTable5.getValueAt(j, 4));// ʶ + // tableList.add(dataTable5.getValueAt(j, 5)==null?"":(String) + // dataTable5.getValueAt(j, 5));// ܸ + // tableList.add(dataTable5.getValueAt(j, 6)==null?"":(String) + // dataTable5.getValueAt(j, 6));// + // tableList.add(dataTable5.getValueAt(j, 7)==null?"":(String) + // dataTable5.getValueAt(j, 7));// Ǽ + // } + // mapVal.put("", tbList); + // + // tbList=new ArrayList<>(); + // for (int j = 0; j (); + // tableList.add( dataTable6.getValueAt(j, 1)==null?"":(String) + // dataTable6.getValueAt(j, 1));// Ŀ + // tableList.add(dataTable6.getValueAt(j, 2)==null?"":(String) + // dataTable6.getValueAt(j, 2));// Ŀ + // tableList.add( dataTable6.getValueAt(j, 3)==null?"":(String) + // dataTable6.getValueAt(j, 3));// Ʒ + // tableList.add( dataTable6.getValueAt(j, 4)==null?"":(String) + // dataTable6.getValueAt(j, 4));// ʶ + // tableList.add( dataTable6.getValueAt(j, 5)==null?"":(String) + // dataTable6.getValueAt(j, 5));// ܸ + // tableList.add( dataTable6.getValueAt(j, 6)==null?"":(String) + // dataTable6.getValueAt(j, 6));// + // tableList.add( dataTable6.getValueAt(j, 7)==null?"":(String) + // dataTable6.getValueAt(j, 7));// Ǽ + // + // } + // mapVal.put("ֵ", tbList); + // + // tbList=new ArrayList<>(); + // for (int j = 0; j < rowCount7; j++) { + // tableList=new ArrayList<>(); + // tableList.add( dataTable7.getValueAt(j, 1)==null?"":(String) + // dataTable7.getValueAt(j, 1));// Ŀ + // tableList.add( dataTable7.getValueAt(j, 2)==null?"":(String) + // dataTable7.getValueAt(j, 2));// Ŀ + // tableList.add( dataTable7.getValueAt(j, 3)==null?"":(String) + // dataTable7.getValueAt(j, 3));// Ʒ + // tableList.add( dataTable7.getValueAt(j, 4)==null?"":(String) + // dataTable7.getValueAt(j, 4));// ʶ + // tableList.add( dataTable7.getValueAt(j, 5)==null?"":(String) + // dataTable7.getValueAt(j, 5));// ܸ + // tableList.add( dataTable7.getValueAt(j, 6)==null?"":(String) + // dataTable7.getValueAt(j, 6));// + // tableList.add( dataTable7.getValueAt(j, 7)==null?"":(String) + // dataTable7.getValueAt(j, 7));// Ǽ + // } + // mapVal.put("ֳֻ", tbList); + // } + +} diff --git a/src/com/connor/jk/plm/exportForm/ExportHZB_Operation20230613.java b/src/com/connor/jk/plm/exportForm/ExportHZB_Operation20230613.java new file mode 100644 index 0000000..766e262 --- /dev/null +++ b/src/com/connor/jk/plm/exportForm/ExportHZB_Operation20230613.java @@ -0,0 +1,781 @@ +package com.connor.jk.plm.exportForm; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.swing.JTable; + +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 com.connor.jk.plm.bom.until.ProgressBarThread; +import com.teamcenter.rac.aif.AbstractAIFOperation; +import com.teamcenter.rac.kernel.TCComponentDataset; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCComponentTcFile; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class ExportHZB_Operation20230613 extends AbstractAIFOperation { + private Map maptab; + // private JTable dataTable1;// 1 + // private JTable dataTable2;// 2 + // private JTable dataTable3;// 3 + // private JTable dataTable4;// 4 + // private JTable dataTable5;// 5 + // private JTable dataTable6;// 6 + // private JTable dataTable7;// 7 + private Map>> mapVal; + private List> list1 = new ArrayList<>(); + private List> list2 = new ArrayList<>(); + private List> list3 = new ArrayList<>(); + private List> list4 = new ArrayList<>(); + private List> list5 = new ArrayList<>(); + private List> list6 = new ArrayList<>(); + private List> list7 = new ArrayList<>(); + private List> list8 = new ArrayList<>(); + private List> list9 = new ArrayList<>(); + private List> list10 = new ArrayList<>(); + private List> list11 = new ArrayList<>(); + private List> list12 = new ArrayList<>();//2019.07.31 + + + private String[] lx; // Ʒ + private String[] xmmc;// Ŀ + private String[] xmbh;// Ŀ + private String[] cpxh;// Ʒͺ + private String[] sbh;// ʶ + private String[] cpmc;// Ʒ + private String[] jbcj;// + private String[] ickxh;// ICͺ + private String[] xlbxh;// ·ͺ + private String[] cxtz;// + private String[] tdxh;// ͺ + private String[] gngs;// ܸ + private String[] khtsyq;// ͻҪ + // private String[] u8mmh;// U8 + private String[] fm;// + private String[] jmlx;// + private String[] sqr;// + private String[] djrq;// Ǽ + private String[] sysc;// г + private String[] ptjbcj;// ׻ + + private String[] status;// ״̬ //2018.6.4½4 + private String[] fmlx;// " + private String[] txfs;// ͨŷʽ + private String[] gdlx;// 緽ʽ + // TODO 2019.07.31 +// private String[] qtzl;// +// private String[] sycs;// ʹó +// private String[] bjbf;// ⲿֵĹϵ +// private String[] scxhzl;// ź +// private String[] cptzh;// Ʒ + + + private String[] tcqt;// ̽ + private String[] yycs;// Ӧó + private String[] txyn;//ͨŷʽ(л) + private String[] scxh;// ź + private String[] sccj;// + //2022/11/18 + private String[] fbzh;// ֤ + private String[] xpzh;// ֤ + private String[] cspz;// ʼ + private String[] mz;// ģ + private String[] xp;// оƬ + private String[] xy;// Э + private String[] znf;// ֹ淧 + private String[] qyk;// ȡѹ + private String[] jkpm;// ƤĤ + private String[] jxwb;// е² + private String[] klc;// + private String[] jbcgfs;// ɹʽ + private String[] jbys;// ɫ + private String[] hztj;// ת + private String[] wbbj;// ⲿ + private String[] mzfc;// ַ + private String[] gdfc;// ܵ + private String[] szld;// ʱ﮵ + private String[] ddsc;// ϴ + private String[] ghzy;// ۻר + private String[] wbzlogo;// װlogo + private String[] mxts;// ÿ̨ + private String[] cpghfs;// Ʒʽ + private String[] yhfffs;// ûѷʽ + private String[] xmjl;// Ŀ + private String[] bz;// ע + private String[] sfts;// Ƿͣ + private String[] tsyy;// ͣԭ + private String[] tshxcp;// ͣۺ²Ʒ + private String[] sqrq;// + + private TCComponentForm form; + private TCSession session; + private String path; + private File file; + + private XSSFSheet sheet; + private XSSFWorkbook workBook; + private FileInputStream fis; + private FileOutputStream fos; + private String excelPath; + private ProgressBarThread wait; + + public ExportHZB_Operation20230613(Map maptab) { + // TODO Auto-generated constructor stub + this.maptab = maptab; + // dataTable1=maptab.get("ñ"); + // dataTable2=maptab.get("ҵ"); + // dataTable3=maptab.get("ɼ"); + // dataTable4=maptab.get(""); + // dataTable5=maptab.get(""); + // dataTable6=maptab.get("ֵ"); + // dataTable7=maptab.get("ֳֻ"); + + } + + public ExportHZB_Operation20230613(TCComponentForm form, TCSession session, + String path) { + // TODO Auto-generated constructor stub + this.form = form; + this.session = session; + this.path = path; + + } + + private void getval() { + // TODO Auto-generated method stub + try { + lx = form.getTCProperty("jk8ProductType").getStringArrayValue(); + xmbh = form.getTCProperty("jk8ProjectNO").getStringArrayValue();// Ŀ + xmmc = form.getTCProperty("jk8ProjectName").getStringArrayValue();// Ŀ + cpxh = form.getTCProperty("jk8ProductModNO").getStringArrayValue();// Ʒͺ + sbh = form.getTCProperty("jk8ProductIdentifyNO") + .getStringArrayValue();// ʶ + cpmc = form.getTCProperty("jk8ProductName").getStringArrayValue();// Ʒ + jbcj = form.getTCProperty("jk8BaseMeterManufactor") + .getStringArrayValue();// + ickxh = form.getTCProperty("jk8ICCardType").getStringArrayValue();// ICͺ + xlbxh = form.getTCProperty("jk8CircBoardModNO") + .getStringArrayValue();// ·ͺ + cxtz = form.getTCProperty("jk8ProgramFeatures") + .getStringArrayValue();// + tdxh = form.getTCProperty("jk8InsteadType").getStringArrayValue();// ͺ + gngs = form.getTCProperty("jk8FunctionOverview") + .getStringArrayValue();// ܸ + khtsyq = form.getTCProperty("jk8CustSpecRequirements") + .getStringArrayValue();// ͻҪ + // u8mmh = form.getTCProperty("jk8U8NO").getStringArrayValue();// + // U8 + fm = form.getTCProperty("jk8Valve").getStringArrayValue();// + jmlx = form.getTCProperty("jk8EncryptType").getStringArrayValue();// + sqr = form.getTCProperty("jk8Applicant").getStringArrayValue();// + djrq = form.getTCProperty("jk8RecordDate").getStringArrayValue();// Ǽ + sysc = form.getTCProperty("jk8ApplyMarket").getStringArrayValue();// г + ptjbcj = form.getTCProperty("jk8BMManfMatched") + .getStringArrayValue();// ׻ + status = form.getTCProperty("jk8Status").getStringArrayValue();// ״̬ + fmlx = form.getTCProperty("jk8ValveType").getStringArrayValue();// + txfs = form.getTCProperty("jk8CommunicateMode").getStringArrayValue();// ͨŷʽ + gdlx = form.getTCProperty("jk8PowerSupplyMode").getStringArrayValue();// + //2019.07.31 ʹó ⲿֵĹϵ ź Ʒ + //2020.08.05̽ Ӧó ͨŷʽ(л) ź +// qtzl = form.getTCProperty("jk8GasType").getStringArrayValue();// +// sycs=form.getTCProperty("jk8UsePlace").getStringArrayValue(); +// //bjbf=form.getTCProperty("jk8AlaDectRelation").getStringArrayValue(); +// scxhzl=form.getTCProperty("jk8OutputSignal").getStringArrayValue(); +// cptzh=form.getTCProperty("jk8ProFeatNum").getStringArrayValue(); + + tcqt = form.getTCProperty("jk8GasType").getStringArrayValue();// ̽ + yycs=form.getTCProperty("jk8UsePlace").getStringArrayValue();// Ӧó + txyn=form.getTCProperty("jk8CommunicateMode2").getStringArrayValue();//ͨŷʽ(л) + scxh=form.getTCProperty("jk8OutputSignal").getStringArrayValue();// ź + sccj=form.getTCProperty("jk8Manufacturer").getStringArrayValue();// + + + fbzh = form.getTCProperty("jk8FlameproofType").getStringArrayValue();// ֤ + xpzh = form.getTCProperty("jk8TypeCerNo").getStringArrayValue();// ֤ + cspz = form.getTCProperty("jk8InitConfig").getStringArrayValue();// ʼ + mz = form.getTCProperty("jk8Module").getStringArrayValue();// ģ + xp = form.getTCProperty("jk8Chip").getStringArrayValue();// оƬ + xy = form.getTCProperty("jk8Agreement").getStringArrayValue();// Э + znf = form.getTCProperty("jk8BackstopValve").getStringArrayValue();// ֹ淧 + qyk = form.getTCProperty("jk8PressureTap").getStringArrayValue();// ȡѹ + jkpm = form.getTCProperty("jk8ImpSkin").getStringArrayValue();// ƤĤ + jxwb = form.getTCProperty("jk8MechTempC").getStringArrayValue();// е² + klc = form.getTCProperty("jk8WideRange").getStringArrayValue();// + jbcgfs = form.getTCProperty("jk8BMBuy").getStringArrayValue();// ɹʽ + jbys = form.getTCProperty("jk8BMColor").getStringArrayValue();// ɫ + hztj = form.getTCProperty("jk8GyratoryVolume").getStringArrayValue();// ת + wbbj = form.getTCProperty("jk8ExAlarm").getStringArrayValue();// ⲿ + mzfc = form.getTCProperty("jk8FaceAntiRemove").getStringArrayValue();// ַ + gdfc = form.getTCProperty("jk8PipeAntiRemove").getStringArrayValue();// ܵ + szld = form.getTCProperty("jk8ClockLiBattey").getStringArrayValue();// ʱ﮵ + ddsc = form.getTCProperty("jk8UploadPowerFail").getStringArrayValue();// ϴ + ghzy = form.getTCProperty("jk8ForHK").getStringArrayValue();// ۻר + wbzlogo = form.getTCProperty("jk8PackageLogo").getStringArrayValue();// װlogo + mxts = form.getTCProperty("jk8PerBoxUnits").getStringArrayValue();// ÿ̨ + cpghfs = form.getTCProperty("jk8SupplyMode").getStringArrayValue();// Ʒʽ + yhfffs = form.getTCProperty("jk8UserPayMethod").getStringArrayValue();// ûѷʽ + xmjl = form.getTCProperty("jk8ProjectManager").getStringArrayValue();// Ŀ + bz = form.getTCProperty("jk8Remarks").getStringArrayValue();// ע + sfts = form.getTCProperty("jk8StopSale").getStringArrayValue();// Ƿͣ + tsyy = form.getTCProperty("jk8ReasonsStopSale").getStringArrayValue();// ͣԭ + tshxcp = form.getTCProperty("jk8StopSaleNewProduct").getStringArrayValue();// ͣۺ²Ʒ + sqrq = form.getTCProperty("jk8ApplyDate").getStringArrayValue();// + + + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + wait.setBool(true);// رս + wait.interrupt(); + } + if (lx != null && lx.length > 0) { + int len = lx.length; + for (int i = 0; i < len; i++) { + List list = new ArrayList<>(); + if ("tb1".equals(lx[i])) { + list.add(sbh[i]); + list.add(cpmc[i]); + list.add(fbzh[i]); + list.add(xpzh[i]); + list.add(cspz[i]); + list.add(mz[i]); + list.add(xp[i]); + list.add(xy[i]); + list.add(znf[i]); + list.add(qyk[i]); + list.add(jkpm[i]); + list.add(jxwb[i]); + list.add(klc[i]); + list.add(jbcgfs[i]); + //list.add(khtsyq[i]);//ģظ + list.add(jbys[i]); + list.add(hztj[i]); + list.add(fm[i]); + list.add(wbbj[i]); + list.add(mzfc[i]); + list.add(gdfc[i]); + list.add(szld[i]); + list.add(ddsc[i]); + list.add(ghzy[i]); + list.add(wbzlogo[i]); + list.add(mxts[i]); + list.add(cpghfs[i]); + list.add(yhfffs[i]); + list.add(ickxh[i]); + list.add(jmlx[i]); + list.add(xmmc[i]); + list.add(xmbh[i]); + list.add(xmjl[i]); + list.add(bz[i]); + list.add(sfts[i]); + list.add(tsyy[i]); + list.add(tshxcp[i]); + list.add(sqrq[i]); + + list1.add(list); + } else if ("tb2".equals(lx[i])) { + list.add(xmmc[i]); + list.add(xmbh[i]); + list.add(cpxh[i]); + list.add(sbh[i]); + list.add(cpmc[i]); + list.add(xlbxh[i]); + list.add(gngs[i]); + list.add(tdxh[i]); + list.add(sqr[i]); + list.add(djrq[i]); + list.add(status[i]); + list2.add(list); + } else if ("tb3".equals(lx[i])) { + list.add(xmmc[i]); + list.add(xmbh[i]); + list.add(cpxh[i]); + list.add(sbh[i]); + list.add(cpmc[i]); + list.add(gngs[i]); + list.add(sysc[i]); + list.add(sqr[i]); + list.add(djrq[i]); + list.add(status[i]); + list3.add(list); + } else if ("tb4".equals(lx[i])) { + list.add(xmmc[i]); + list.add(xmbh[i]); + list.add(cpxh[i]); + list.add(sbh[i]); + list.add(cpmc[i]); + list.add(ptjbcj[i]); + list.add(gngs[i]); + list.add(sqr[i]); + list.add(djrq[i]); + list.add(status[i]); + list4.add(list); + } else if ("tb5".equals(lx[i])) { + list.add(xmmc[i]); + list.add(xmbh[i]); + list.add(cpmc[i]); + list.add(cpxh[i]); + list.add(sbh[i]); + list.add(gngs[i]); + list.add(sqr[i]); + list.add(djrq[i]); + list.add(status[i]); + list5.add(list); + } else if ("tb6".equals(lx[i])) { + list.add(xmmc[i]); + list.add(xmbh[i]); + list.add(cpmc[i]); + list.add(cpxh[i]); + list.add(sbh[i]); + list.add(gngs[i]); + list.add(sqr[i]); + list.add(djrq[i]); + list.add(status[i]); + list6.add(list); + + } else if ("tb7".equals(lx[i])) { + list.add(xmmc[i]); + list.add(xmbh[i]); + list.add(cpmc[i]); + list.add(cpxh[i]); + list.add(sbh[i]); + list.add(gngs[i]); + list.add(sqr[i]); + list.add(djrq[i]); + list.add(status[i]); + list7.add(list); + }else if ("tb8".equals(lx[i])) { + list.add(xmmc[i]); + list.add(xmbh[i]); + list.add(cpmc[i]); + list.add(cpxh[i]); + list.add(sbh[i]); + list.add(gngs[i]); + list.add(sqr[i]); + list.add(djrq[i]); + list.add(status[i]); + list8.add(list); + }else if ("tb9".equals(lx[i])) { + list.add(xmmc[i]); + list.add(xmbh[i]); + list.add(cpmc[i]); + list.add(cpxh[i]); + list.add(sbh[i]); + list.add(gngs[i]); + list.add(sqr[i]); + list.add(djrq[i]); + list.add(status[i]); + list9.add(list); + }else if ("tb10".equals(lx[i])) { + list.add(xmmc[i]); + list.add(xmbh[i]); + list.add(cpmc[i]); + list.add(cpxh[i]); + list.add(sbh[i]); + + list.add(fmlx[i]);// " + list.add(txfs[i]);// ͨŷʽ + list.add(gdlx[i]);// 緽ʽ + + list.add(sqr[i]); + list.add(djrq[i]); + list.add(status[i]); + list10.add(list); + }else if ("tb12".equals(lx[i])) { +// "Ŀ", "Ŀ", "Ʒ",//3 +// "Ʒͺ", "Ӧó","̽","", +// "ͨŷʽ(л)","ͨŷʽ","緽ʽ","ź","ʶ","״̬" + +// "", +// "Ŀ", "Ŀ", "Ʒ",//3 +// "Ʒͺ", "Ӧó","̽","","ͨŷʽ(л)","ͨŷʽ", +// "緽ʽ","ź","ʶ","", "Ǽ","״̬" + list.add(xmmc[i]); + list.add(xmbh[i]); + list.add(cpmc[i]); + list.add(cpxh[i]); + + list.add(yycs[i]); + list.add(tcqt[i]); + list.add(sccj[i]); + list.add(txyn[i]); + list.add(txfs[i]); + + list.add(gdlx[i]); + list.add(scxh[i]); + + + list.add(sbh[i]); + list.add(sqr[i]); + list.add(djrq[i]); + list.add(status[i]); + //list11.add(list);//ԭĴ + list12.add(list);//2020.07.27޸ + }else if (lx[i]==null ||"tb11".equals(lx[i])||"".equals(lx[i])) { + list.add(xmmc[i]); + list.add(xmbh[i]); + list.add(cpmc[i]); + list.add(cpxh[i]); + list.add(sbh[i]); + list.add(gngs[i]); + list.add(sqr[i]); + list.add(djrq[i]); + list.add(status[i]); + list11.add(list); + } + + + } + } + + } + + @Override + public void executeOperation() throws Exception { + // TODO Auto-generated method stub + file = getSXX(); + if (file != null) { + wait = new ProgressBarThread("ݵ", + "ݵУԵ..."); + wait.start();// + // getVal(); + try { + getval(); + writeExcel(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + wait.setBool(true);// رս + wait.interrupt(); + } + wait.setBool(true);// رս + wait.interrupt(); + MessageBox.post("","",MessageBox.INFORMATION); + Runtime.getRuntime().exec("cmd /c \"" + excelPath + "\""); + } + + } + + public File getSXX() { + TCPreferenceService pref = session.getPreferenceService(); + String puid = pref.getStringValue("JK_SQB_Dataset_Puid");// ѡpuid + if (puid != null) { + try { + TCComponentDataset dataset = (TCComponentDataset) session + .stringToComponent(puid); + if (dataset == null) { + return null; + } + TCComponentTcFile[] file = dataset.getTcFiles(); + if (file.length == 0 || file.length != 1) { + MessageBox.post("ݼûõļļ࣬飡", "WARNING", + MessageBox.WARNING); + return null; + } else { + File fmsFile = file[0].getFmsFile(); + return fmsFile; + } + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } else { + MessageBox.post("δҵѡ[JK_SQB_Dataset_Puid]ѡô", "", + MessageBox.ERROR); + return null; + } + return null; + } + + public void writeExcel() { + // TODO Auto-generated method stub + + try { + fis = new FileInputStream(file); + workBook = new XSSFWorkbook(fis); + if (workBook != null) { + int sheetlength = workBook.getNumberOfSheets(); + List sheetNameList = new ArrayList<>(); + for (int i = 0; i < sheetlength; i++) { + sheetNameList.add(workBook.getSheetName(i)); + } + for (String sheetName : sheetNameList) { + XSSFSheet sheet = workBook.getSheet(sheetName); + if (sheetName.equals("ñ")) { + writeSheet(sheet,list1); + } else if (sheetName.equals("ҵ")) { + writeSheet(sheet,list2); + } else if (sheetName.equals("ɼ")) { + writeSheet(sheet,list3); + } else if (sheetName.equals("")) { + writeSheet(sheet,list4); + } else if (sheetName.equals("")) { + writeSheet(sheet,list5); + } else if (sheetName.equals("ֵ")) { + writeSheet(sheet,list6); + } else if (sheetName.equals("ֳֻ")) { + writeSheet(sheet,list7); + }else if (sheetName.equals("")) { + writeSheet(sheet,list8); + }else if (sheetName.equals("ģ")) { + writeSheet(sheet,list9); + }else if (sheetName.equals("")) { + writeSheet(sheet,list10); + }else if (sheetName.equals("")) { + writeSheet(sheet,list11); + }else if (sheetName.equals("")) { + writeSheet(sheet,list12); + } + + } + + SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");// ڸʽ + String time = df.format(new Date()); + excelPath = path + File.separator + "ƷͺʶŻܱ" + + time + ".xlsx"; + File fileout = new File(excelPath); + fos = new FileOutputStream(fileout); + workBook.write(fos); + // Runtime.getRuntime().exec(excelPath); + + + + } + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + wait.setBool(true);// رս + wait.interrupt(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + wait.setBool(true);// رս + wait.interrupt(); + } + + } + + public void writeSheet(XSSFSheet sheet, List> list) { + // TODO Auto-generated method stub + for (int i = 0; i < list.size(); i++) { + XSSFRow rowm = sheet.createRow(i + 1); + XSSFCellStyle sty =workBook.createCellStyle(); //sheet.getRow(0).getCell(0).getCellStyle(); + for (int j = 0; j < list.get(i).size(); j++) { + XSSFCell c = rowm.createCell(j); + c.setCellStyle(sty); + c.setCellValue(list.get(i).get(j)==null?"":list.get(i).get(j)); + + + } + + } + + } + + // public void getVal() { + // // TODO Auto-generated method stub + // mapVal=new HashMap>>(); + // List> tbList; + // List tableList; + // int rowCount1 = dataTable1.getRowCount(); + // int rowCount2 = dataTable2.getRowCount(); + // int rowCount3 = dataTable3.getRowCount(); + // int rowCount4 = dataTable4.getRowCount(); + // int rowCount5 = dataTable5.getRowCount(); + // int rowCount6 = dataTable6.getRowCount(); + // int rowCount7 = dataTable7.getRowCount(); + // tbList=new ArrayList<>(); + // for (int j = 0; j < rowCount1; j++) { + // tableList=new ArrayList<>(); + // tableList.add(dataTable1.getValueAt(j, + // 1)==null?"":(String)dataTable1.getValueAt(j, 1));//Ŀ + // tableList.add(dataTable1.getValueAt(j, + // 2)==null?"":(String)dataTable1.getValueAt(j, 2));//Ŀ + // tableList.add(dataTable1.getValueAt(j, + // 3)==null?"":(String)dataTable1.getValueAt(j, 3)); + // tableList.add(dataTable1.getValueAt(j, + // 4)==null?"":(String)dataTable1.getValueAt(j, 4));// ʶ + // tableList.add(dataTable1.getValueAt(j, + // 5)==null?"":(String)dataTable1.getValueAt(j, 5));// Ʒ + // tableList.add(dataTable1.getValueAt(j, + // 6)==null?"":(String)dataTable1.getValueAt(j, 6));// + // tableList.add(dataTable1.getValueAt(j, + // 7)==null?"":(String)dataTable1.getValueAt(j, 7));// ICͺ + // tableList.add(dataTable1.getValueAt(j, + // 8)==null?"":(String)dataTable1.getValueAt(j, 8));// ·ͺ + // tableList.add(dataTable1.getValueAt(j, + // 9)==null?"":(String)dataTable1.getValueAt(j, 9));// + // tableList.add(dataTable1.getValueAt(j, + // 10)==null?"":(String)dataTable1.getValueAt(j, 10));// ͺ + // tableList.add(dataTable1.getValueAt(j, + // 11)==null?"":(String)dataTable1.getValueAt(j, 11));// ܸ + // tableList.add(dataTable1.getValueAt(j, + // 12)==null?"":(String)dataTable1.getValueAt(j, 12));// ͻҪ + // tableList.add(dataTable1.getValueAt(j, + // 13)==null?"":(String)dataTable1.getValueAt(j, 13));// + // tableList.add(dataTable1.getValueAt(j, + // 14)==null?"":(String)dataTable1.getValueAt(j, 14));// + // tableList.add(dataTable1.getValueAt(j, + // 15)==null?"":(String)dataTable1.getValueAt(j, 15));// + // tableList.add(dataTable1.getValueAt(j, + // 16)==null?"":(String)dataTable1.getValueAt(j, 16));// Ǽ + // tbList.add(tableList); + // } + // mapVal.put("ñ", tbList); + // tbList=new ArrayList<>(); + // for (int j = 0; j < rowCount2; j++) { + // tableList=new ArrayList<>(); + // tableList.add(dataTable2.getValueAt(j, 1)==null?"":(String) + // dataTable2.getValueAt(j, 1));//Ŀ + // tableList.add(dataTable2.getValueAt(j, 2)==null?"":(String) + // dataTable2.getValueAt(j, 2));//Ŀ + // tableList.add(dataTable2.getValueAt(j, 3)==null?"":(String) + // dataTable2.getValueAt(j, 3));// Ʒͺ + // tableList.add(dataTable2.getValueAt(j, 4)==null?"":(String) + // dataTable2.getValueAt(j, 4));// ʶ + // tableList.add(dataTable2.getValueAt(j, 5)==null?"":(String) + // dataTable2.getValueAt(j, 5));// Ʒ + // tableList.add(dataTable2.getValueAt(j, 6)==null?"":(String) + // dataTable2.getValueAt(j, 6));// ·ͺ + // tableList.add(dataTable2.getValueAt(j, 7)==null?"":(String) + // dataTable2.getValueAt(j, 7));// ܸ + // tableList.add(dataTable2.getValueAt(j, 8)==null?"":(String) + // dataTable2.getValueAt(j, 8));// ͺ + // tableList.add(dataTable2.getValueAt(j, 9)==null?"":(String) + // dataTable2.getValueAt(j, 9));// + // tableList.add(dataTable2.getValueAt(j, 10)==null?"":(String) + // dataTable2.getValueAt(j, 10));// Ǽ + // tbList.add(tableList); + // } + // mapVal.put("ҵ", tbList); + // + // tbList=new ArrayList<>(); + // for (int j = 0; j < rowCount3; j++) { + // tableList=new ArrayList<>(); + // tableList.add(dataTable3.getValueAt(j, 1)==null?"":(String) + // dataTable3.getValueAt(j, 1));// Ŀ + // tableList.add(dataTable3.getValueAt(j, 2)==null?"":(String) + // dataTable3.getValueAt(j, 2));// Ŀ + // tableList.add(dataTable3.getValueAt(j, 3)==null?"":(String) + // dataTable3.getValueAt(j, 3));// Ʒͺ + // tableList.add(dataTable3.getValueAt(j, 4)==null?"":(String) + // dataTable3.getValueAt(j, 4));// ʶ + // tableList.add(dataTable3.getValueAt(j, 5)==null?"":(String) + // dataTable3.getValueAt(j, 5));// Ʒ + // tableList.add(dataTable3.getValueAt(j, 6)==null?"":(String) + // dataTable3.getValueAt(j, 6));// ܸ + // tableList.add(dataTable3.getValueAt(j, 7)==null?"":(String) + // dataTable3.getValueAt(j, 7));// г + // tableList.add(dataTable3.getValueAt(j, 8)==null?"":(String) + // dataTable3.getValueAt(j, 8));// + // tableList.add(dataTable3.getValueAt(j, 9)==null?"":(String) + // dataTable3.getValueAt(j, 9));// Ǽ + // + // } + // mapVal.put("ɼ", tbList); + // + // tbList=new ArrayList<>(); + // for (int j =0; j < rowCount4; j++) { + // tableList=new ArrayList<>(); + // tableList.add( dataTable4.getValueAt(j, 1)==null?"":(String) + // dataTable4.getValueAt(j, 1));// Ŀ + // tableList.add( dataTable4.getValueAt(j, 2)==null?"":(String) + // dataTable4.getValueAt(j, 2));// Ŀ + // tableList.add( dataTable4.getValueAt(j, 3)==null?"":(String) + // dataTable4.getValueAt(j, 3));// ʶ + // tableList.add( dataTable4.getValueAt(j, 4)==null?"":(String) + // dataTable4.getValueAt(j, 4));// Ʒ + // tableList.add( dataTable4.getValueAt(j, 5)==null?"":(String) + // dataTable4.getValueAt(j, 5));// ׻ + // tableList.add(dataTable4.getValueAt(j, 6)==null?"":(String) + // dataTable4.getValueAt(j, 6));// ܸ + // tableList.add( dataTable4.getValueAt(j, 7)==null?"":(String) + // dataTable4.getValueAt(j, 7));// + // tableList.add( dataTable4.getValueAt(j, 8)==null?"":(String) + // dataTable4.getValueAt(j, 8));// Ǽ + // + // } + // mapVal.put("", tbList); + // + // tbList=new ArrayList<>(); + // for (int j = 0; j < rowCount5; j++) { + // tableList=new ArrayList<>(); + // tableList.add(dataTable5.getValueAt(j, 1)==null?"":(String) + // dataTable5.getValueAt(j, 1));// Ŀ + // tableList.add(dataTable5.getValueAt(j, 2)==null?"":(String) + // dataTable5.getValueAt(j, 2));// Ŀ + // tableList.add(dataTable5.getValueAt(j, 3)==null?"":(String) + // dataTable5.getValueAt(j, 3));// Ʒ + // tableList.add(dataTable5.getValueAt(j, 4)==null?"":(String) + // dataTable5.getValueAt(j, 4));// ʶ + // tableList.add(dataTable5.getValueAt(j, 5)==null?"":(String) + // dataTable5.getValueAt(j, 5));// ܸ + // tableList.add(dataTable5.getValueAt(j, 6)==null?"":(String) + // dataTable5.getValueAt(j, 6));// + // tableList.add(dataTable5.getValueAt(j, 7)==null?"":(String) + // dataTable5.getValueAt(j, 7));// Ǽ + // } + // mapVal.put("", tbList); + // + // tbList=new ArrayList<>(); + // for (int j = 0; j (); + // tableList.add( dataTable6.getValueAt(j, 1)==null?"":(String) + // dataTable6.getValueAt(j, 1));// Ŀ + // tableList.add(dataTable6.getValueAt(j, 2)==null?"":(String) + // dataTable6.getValueAt(j, 2));// Ŀ + // tableList.add( dataTable6.getValueAt(j, 3)==null?"":(String) + // dataTable6.getValueAt(j, 3));// Ʒ + // tableList.add( dataTable6.getValueAt(j, 4)==null?"":(String) + // dataTable6.getValueAt(j, 4));// ʶ + // tableList.add( dataTable6.getValueAt(j, 5)==null?"":(String) + // dataTable6.getValueAt(j, 5));// ܸ + // tableList.add( dataTable6.getValueAt(j, 6)==null?"":(String) + // dataTable6.getValueAt(j, 6));// + // tableList.add( dataTable6.getValueAt(j, 7)==null?"":(String) + // dataTable6.getValueAt(j, 7));// Ǽ + // + // } + // mapVal.put("ֵ", tbList); + // + // tbList=new ArrayList<>(); + // for (int j = 0; j < rowCount7; j++) { + // tableList=new ArrayList<>(); + // tableList.add( dataTable7.getValueAt(j, 1)==null?"":(String) + // dataTable7.getValueAt(j, 1));// Ŀ + // tableList.add( dataTable7.getValueAt(j, 2)==null?"":(String) + // dataTable7.getValueAt(j, 2));// Ŀ + // tableList.add( dataTable7.getValueAt(j, 3)==null?"":(String) + // dataTable7.getValueAt(j, 3));// Ʒ + // tableList.add( dataTable7.getValueAt(j, 4)==null?"":(String) + // dataTable7.getValueAt(j, 4));// ʶ + // tableList.add( dataTable7.getValueAt(j, 5)==null?"":(String) + // dataTable7.getValueAt(j, 5));// ܸ + // tableList.add( dataTable7.getValueAt(j, 6)==null?"":(String) + // dataTable7.getValueAt(j, 6));// + // tableList.add( dataTable7.getValueAt(j, 7)==null?"":(String) + // dataTable7.getValueAt(j, 7));// Ǽ + // } + // mapVal.put("ֳֻ", tbList); + // } + +} diff --git a/src/com/connor/jk/plm/exportPCB/ProgressBar.java b/src/com/connor/jk/plm/exportPCB/ProgressBar.java new file mode 100644 index 0000000..e84f0d3 --- /dev/null +++ b/src/com/connor/jk/plm/exportPCB/ProgressBar.java @@ -0,0 +1,171 @@ +/** + * @file ProgressBar.java + * + * @brief Create progress bar + * + * @author Yanghui + * + * @history + * ================================================================ + * Date Name Description of Change + * 25-July-2008 Yanghui this class is used to create + * progress bar. + */ +package com.connor.jk.plm.exportPCB; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JProgressBar; +import javax.swing.Timer; +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.util.PropertyLayout; +import com.teamcenter.rac.util.Registry; + +/** + * @class ProgressBar + * @brief Create progress bar + * @author Yanghui + */ +public class ProgressBar extends AbstractAIFDialog implements ActionListener { + /** + * @var ProgressBar.progressbar + * @brief JProgressBar + */ + private JProgressBar progressbar; + + /** + * @var ProgressBar.label + * @brief label used to tips + */ + private JLabel label; + + /** + * @var ProgressBar.timer + * @brief timer used to timing operation + */ + private Timer timer; + + /** + * @var ProgressBar.bool + * @brief bool used to flag thread return + */ + private boolean bool = false; + + /** + * @var Progressbar.registry + * @brief Registry + */ + private Registry registry; + + /** + * @fn public ProgressBar() + * @brief constructor + * @param[in] null + */ + private String showLable = null ; + public ProgressBar(String showlable) { + super(true); + showLable = showlable; + this.setAlwaysOnTop(true); + } + + /** + * @fn public void setBool(boolean bool) + * @brief set bool value + * @param[in] bool + * @param[out] null + */ + public void setBool(boolean bool) { + this.bool = bool; + } + + /** + * @fn private void initUI() + * @brief createDialog method + * @param[in] null + * @param[out] null + */ + public void initUI() { + Container container = getContentPane(); + JPanel mainPanel = new JPanel(new PropertyLayout()); + this.label = new JLabel(showLable, JLabel.CENTER); + this.progressbar = new JProgressBar(); + this.progressbar.setOrientation(JProgressBar.HORIZONTAL); + this.progressbar.setMinimum(0); + this.progressbar.setMaximum(100); + this.progressbar.setValue(0); + this.progressbar.setPreferredSize(new Dimension(200, 15)); + this.progressbar.setBorderPainted(true); + this.timer = new Timer(50, (ActionListener) this); + this.timer.setRepeats(false); + mainPanel.add("1.1.center", new JLabel(" ")); + mainPanel.add("2.1.center", label); + mainPanel.add("3.1.center", progressbar); + mainPanel.add("4.1.center", new JLabel(" ")); + container.add(mainPanel); + pack(); + setLocation(500, 200); + TaskThread thread = new TaskThread(this); + thread.start(); + addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + bool = true; + } + }); + this.setVisible(true); + } + + /** + * @class TaskThread + * @brief Create progressbar + * + */ + class TaskThread extends Thread { + private ProgressBar bar; + + public TaskThread(ProgressBar bar) { + this.bar = bar; + } + + public void run() { + if (bool == false) { + // Set Status is running. + // session.setStatus(registry.getString("export Running")); + } + for (int i = 0; i < i + 1; i++) { + timer.start(); + int value = progressbar.getValue(); + if (value < 100) { + value = value + 5; + progressbar.setValue(value); + } else { + timer.stop(); + progressbar.setValue(0); + } + try { + sleep(100); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + if (bool == true) { + bar.setVisible(false); + bar.dispose(); + return; + + } + + } + } + } + + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + + } +} diff --git a/src/com/connor/jk/plm/exportPCB/ProgressBarThread.java b/src/com/connor/jk/plm/exportPCB/ProgressBarThread.java new file mode 100644 index 0000000..f7d9d82 --- /dev/null +++ b/src/com/connor/jk/plm/exportPCB/ProgressBarThread.java @@ -0,0 +1,41 @@ +/** + * @file ProgressBarThread.java + * + * @brief control progressBar. + * + * @author Yanghui + * + * @history + * ================================================================ + * Date Name Description of Change + * 08-Auguest-2008 Yanghui this class is used to control + * progress bar. + */ +package com.connor.jk.plm.exportPCB; + +/** + * @class ProgressBarThread + * @brief Create progress bar thread + * @author Yanghui + */ +public class ProgressBarThread extends Thread { + + private ProgressBar bar; + + private String title; + + public ProgressBarThread(String title,String showLable) { + this.title = title; + bar = new ProgressBar(showLable); + } + + public void run() { + bar.setTitle(title); + bar.initUI(); + } + + public void setBool(boolean bool) { + bar.setBool(true); + bar.setAlwaysOnTop(false); + } +} diff --git a/src/com/connor/jk/plm/exportPCB/exportPCB_Dialog.java b/src/com/connor/jk/plm/exportPCB/exportPCB_Dialog.java new file mode 100644 index 0000000..9c45e17 --- /dev/null +++ b/src/com/connor/jk/plm/exportPCB/exportPCB_Dialog.java @@ -0,0 +1,153 @@ +package com.connor.jk.plm.exportPCB; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.File; + +import javax.swing.BorderFactory; +import javax.swing.JButton; +import javax.swing.JFileChooser; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; +import javax.swing.border.TitledBorder; +import javax.swing.filechooser.FileSystemView; + +import com.connor.jk.plm.exportForm.ExportHZB_Operation; +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; + +public class exportPCB_Dialog extends AbstractAIFDialog { + private JTextField textField; + private JButton okButton; + private JButton celButton; + private JButton pathButton; + // ļѡ + private JFileChooser jFileChooser; + + private TCComponentForm form; + private TCSession session; + + public exportPCB_Dialog(TCComponentForm form, TCSession session) { + // TODO Auto-generated constructor stub + this.form=form; + this.session=session; + } + + @Override + public void run() { +// super.run(); + initUI(); + } + + private void initUI() { + FileSystemView fsv = FileSystemView.getFileSystemView(); // õϵͳfileview + String deskPath = fsv.getHomeDirectory().getPath(); // ǰû· + + this.setSize(new Dimension(600, 400)); + this.setTitle(""); + this.textField = new JTextField(deskPath); + + jFileChooser = new JFileChooser(); + this.jFileChooser.setCurrentDirectory(new File(deskPath));// ļѡijʼĿ¼Ϊǰû + this.jFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + + this.pathButton = new JButton("..."); + this.okButton = new JButton("ȷ"); + this.celButton = new JButton("ȡ"); + + + JPanel midJPanel = new JPanel(new PropertyLayout()); + midJPanel.setBorder(new TitledBorder(BorderFactory + .createLineBorder(Color.WHITE), "ѡ񵼳·")); // ߿ TitleBorder + midJPanel.add("1.1.left.top", new JLabel(" ")); + midJPanel.add("2.1.left.top", new JLabel("·")); + midJPanel.add("2.2.left.top", this.textField); + midJPanel.add("2.3.left.top", this.pathButton); + JPanel rootJPanel = new JPanel(new FlowLayout()); + rootJPanel.add(this.okButton); + rootJPanel.add(this.celButton); + + pathButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + selectFileButtonEvent(); + } + }); + okButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + if (textField.getText().contains(".")) { + MessageBox.post("ѡļУ", "", MessageBox.WARNING); + } else { + okEvent(); + } + } + }); + celButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + celEvent(); + + } + }); + + this.setLayout(new BorderLayout()); + this.add(midJPanel, BorderLayout.CENTER); + this.add(rootJPanel, BorderLayout.SOUTH); + + this.centerToScreen(); + this.pack(); + this.setVisible(true); + this.showDialog(); + + } + + protected void celEvent() { + // TODO Auto-generated method stub + this.disposeDialog(); + this.dispose(); + } + + protected void okEvent() { + + this.disposeDialog(); + this.dispose(); + + try { + String path=textField.getText(); + System.out.println("ok"); + exportPCB_Operation op=new exportPCB_Operation(form,session,path); + session.queueOperation(op); + + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + protected void selectFileButtonEvent() { + // TODO Auto-generated method stub + int state = jFileChooser.showOpenDialog(null);// ˾ǴļѡĴ + if (state == 1) { + return; + } else { + File f = jFileChooser.getSelectedFile();// fΪѡ񵽵Ŀ¼ + textField.setText(f.getAbsolutePath()); + } + } + +} diff --git a/src/com/connor/jk/plm/exportPCB/exportPCB_Handler.java b/src/com/connor/jk/plm/exportPCB/exportPCB_Handler.java new file mode 100644 index 0000000..8c30a75 --- /dev/null +++ b/src/com/connor/jk/plm/exportPCB/exportPCB_Handler.java @@ -0,0 +1,39 @@ +package com.connor.jk.plm.exportPCB; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.connor.jk.plm.exportForm.ExportHZB_Dialog; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class exportPCB_Handler extends AbstractHandler{ + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + // TODO Auto-generated method stub + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + InterfaceAIFComponent targetComp = app.getTargetComponent(); + TCSession session = (TCSession) app.getSession(); + if(targetComp==null){ + MessageBox.post("ѡPCBǼDZִв","",MessageBox.ERROR); + return null; + } + if("JK8PCBNORegForm".equals(targetComp.getType())){ + System.out.println("start"); + exportPCB_Dialog action=new exportPCB_Dialog((TCComponentForm)targetComp,session); + new Thread(action).start(); + + }else{ + MessageBox.post("ѡPCBǼDZִв","",MessageBox.ERROR); + } + + return null; + } + +} diff --git a/src/com/connor/jk/plm/exportPCB/exportPCB_Operation.java b/src/com/connor/jk/plm/exportPCB/exportPCB_Operation.java new file mode 100644 index 0000000..bbce02a --- /dev/null +++ b/src/com/connor/jk/plm/exportPCB/exportPCB_Operation.java @@ -0,0 +1,138 @@ +package com.connor.jk.plm.exportPCB; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; + +import org.apache.poi.xssf.usermodel.XSSFCell; +import org.apache.poi.xssf.usermodel.XSSFRow; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + +import com.connor.jk.plm.bom.until.ProgressBarThread; +import com.teamcenter.rac.aif.AbstractAIFOperation; +import com.teamcenter.rac.kernel.TCComponentDataset; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCComponentTcFile; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class exportPCB_Operation extends AbstractAIFOperation { + private TCComponentForm form; + private TCSession session; + private String path; + private File file; + public exportPCB_Operation(TCComponentForm form, TCSession session, String path) { + // TODO Auto-generated constructor stub + this.form = form; + this.session = session; + this.path = path; + } + private ProgressBarThread wait; + private FileInputStream fis; + private FileOutputStream fos; + private XSSFWorkbook workBook; + @Override + public void executeOperation() throws Exception { + // TODO Auto-generated method stub + file = getSXX(); + if (file != null) { + wait = new ProgressBarThread("ͬ", + "ͬУԵ..."); + wait.start();// + + try { + System.out.println(form==null); + String[] jk8Projectname = form.getTCProperty("jk8Projectname").getStringValueArray();// Ŀ + String[] jk8Companylogo = form.getTCProperty("jk8Companylogo").getStringValueArray();// ˾ʶ + String[] jk8MeasureType = form.getTCProperty("jk8MeasureType").getStringValueArray();// ԭ + String[] jk8CommunicateMode = form.getTCProperty("jk8CommunicateMode").getStringValueArray();// ͨѶʽ + String[] jk8Application = form.getTCProperty("jk8Application").getStringValueArray();// Ӧ÷Χ + String[] jk8PCBNO = form.getTCProperty("jk8PCBNO").getStringValueArray();// PCB + int col = jk8Companylogo.length; + fis = new FileInputStream(file); + workBook = new XSSFWorkbook(fis); + XSSFSheet sheet = workBook.getSheetAt(0); + for (int i = 1; i < col+1; i++) { + XSSFRow r = null; + if (i >= 1) { + + r = sheet.createRow(i ); + } else { + r = sheet.getRow(i); + } + XSSFCell ce = null; + if (i >= 1) { + + for (int j = 0; j < 7; j++) { + ce = r.createCell(j); + } + } +// else { +// for (int j = 1; j < 10; j++) { +// ce = r.getCell(j); +// } +// } + + r.getCell(0).setCellValue(i + ""); + r.getCell(1).setCellValue(jk8Projectname[i-1]); + r.getCell(2).setCellValue(jk8Companylogo[i-1]); + r.getCell(3).setCellValue(jk8MeasureType[i-1]); + r.getCell(4).setCellValue(jk8CommunicateMode[i-1]); + r.getCell(5).setCellValue(jk8Application[i-1]); + r.getCell(6).setCellValue(jk8PCBNO[i-1]); + } + } catch (Exception e) { + wait.setBool(true);// رս + wait.interrupt(); + MessageBox.post("ʧ", "", MessageBox.INFORMATION); + e.printStackTrace(); + return; + } + + File file = new File(path + "\\" + "PCBǼDZ" + ".xlsx"); + fos = new FileOutputStream(file); + workBook.write(fos); + wait.setBool(true);// رս + wait.interrupt(); + MessageBox.post("Ѿ", "ɹ", MessageBox.INFORMATION); + Runtime.getRuntime().exec(new String[] { "cmd.exe", "/c", path + "\\" + "PCBǼDZ" + ".xlsx" });// ɺֱӴ + + } + } + + private File getSXX() { + TCPreferenceService pref = session.getPreferenceService(); + String puid = pref.getStringValue("JK_PCB_Dataset_Puid");// ѡpuid txVld3uJYvbLjA + if (puid != null) { + try { + TCComponentDataset dataset = (TCComponentDataset) session + .stringToComponent(puid); + if (dataset == null) { + return null; + } + TCComponentTcFile[] file = dataset.getTcFiles(); + if (file.length == 0 || file.length != 1) { + MessageBox.post("ݼûõļļ࣬飡", "WARNING", + MessageBox.WARNING); + return null; + } else { + File fmsFile = file[0].getFmsFile(); + return fmsFile; + } + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } else { + MessageBox.post("δҵѡ[JK_PCB_Dataset_Puid]ѡô", "", + MessageBox.ERROR); + return null; + } + return null; + } + +} diff --git a/src/com/connor/jk/plm/exportWaterForm/ExportWaterForm_Dialog.java b/src/com/connor/jk/plm/exportWaterForm/ExportWaterForm_Dialog.java new file mode 100644 index 0000000..2c8bd87 --- /dev/null +++ b/src/com/connor/jk/plm/exportWaterForm/ExportWaterForm_Dialog.java @@ -0,0 +1,160 @@ +package com.connor.jk.plm.exportWaterForm; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.File; +import java.util.Map; + +import javax.swing.BorderFactory; +import javax.swing.JButton; +import javax.swing.JFileChooser; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTable; +import javax.swing.JTextField; +import javax.swing.border.TitledBorder; +import javax.swing.filechooser.FileSystemView; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; + +public class ExportWaterForm_Dialog extends AbstractAIFDialog { + + /** + * ˮܱ + */ + private static final long serialVersionUID = 1L; + private JTextField textField; + private JButton okButton; + private JButton celButton; + private JButton pathButton; + // ļѡ + private JFileChooser jFileChooser; + + private TCComponentForm form; + private TCSession session; + + public ExportWaterForm_Dialog(TCComponentForm form,TCSession session) { + // TODO Auto-generated constructor stub + this.form=form; + this.session=session; + //ExportHZB_Operation ex=new ExportHZB_Operation(maptab); + //session.queueOperation(ex); + } + + public void run() { + initUI(); + + } + private void initUI() { + // TODO Auto-generated method stub + FileSystemView fsv = FileSystemView.getFileSystemView(); // õϵͳfileview + String deskPath = fsv.getHomeDirectory().getPath(); // ǰû· + + this.setSize(new Dimension(600, 400)); + this.setTitle(""); + this.textField = new JTextField(deskPath); + + jFileChooser = new JFileChooser(); + this.jFileChooser.setCurrentDirectory(new File(deskPath));// ļѡijʼĿ¼Ϊǰû + this.jFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + + this.pathButton = new JButton("..."); + this.okButton = new JButton("ȷ"); + this.celButton = new JButton("ȡ"); + + + JPanel midJPanel = new JPanel(new PropertyLayout()); + midJPanel.setBorder(new TitledBorder(BorderFactory + .createLineBorder(Color.WHITE), "ѡ񵼳·")); // ߿ TitleBorder + midJPanel.add("1.1.left.top", new JLabel(" ")); + midJPanel.add("2.1.left.top", new JLabel("·")); + midJPanel.add("2.2.left.top", this.textField); + midJPanel.add("2.3.left.top", this.pathButton); + JPanel rootJPanel = new JPanel(new FlowLayout()); + rootJPanel.add(this.okButton); + rootJPanel.add(this.celButton); + + pathButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + selectFileButtonEvent(); + } + }); + okButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + if (textField.getText().contains(".")) { + MessageBox.post("ѡļУ", "", MessageBox.WARNING); + } else { + okEvent(); + } + } + }); + celButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + celEvent(); + + } + }); + + this.setLayout(new BorderLayout()); + this.add(midJPanel, BorderLayout.CENTER); + this.add(rootJPanel, BorderLayout.SOUTH); + + this.centerToScreen(); + this.pack(); + this.setVisible(true); + this.showDialog(); + } + + public void celEvent() { + // TODO Auto-generated method stub + this.disposeDialog(); + this.dispose(); + } + + public void selectFileButtonEvent() { + int state = jFileChooser.showOpenDialog(null);// ˾ǴļѡĴ + if (state == 1) { + return; + } else { + File f = jFileChooser.getSelectedFile();// fΪѡ񵽵Ŀ¼ + textField.setText(f.getAbsolutePath()); + } + } + + public void okEvent() { + + this.disposeDialog(); + this.dispose(); + + try { + String path=textField.getText(); + System.out.println("ok"); + ExportWaterForm_Operation op=new ExportWaterForm_Operation(form,session,path); + session.queueOperation(op); + + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + +} diff --git a/src/com/connor/jk/plm/exportWaterForm/ExportWaterForm_Handler.java b/src/com/connor/jk/plm/exportWaterForm/ExportWaterForm_Handler.java new file mode 100644 index 0000000..dd34d2d --- /dev/null +++ b/src/com/connor/jk/plm/exportWaterForm/ExportWaterForm_Handler.java @@ -0,0 +1,39 @@ +package com.connor.jk.plm.exportWaterForm; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.connor.jk.plm.createproject.CreateProjrct_Action; +import com.connor.jk.plm.imform.ImfomAIFDialog; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class ExportWaterForm_Handler extends AbstractHandler { + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + InterfaceAIFComponent targetComp = app.getTargetComponent(); + TCSession session = (TCSession) app.getSession(); + if(targetComp==null){ + MessageBox.post("ѡˮǼDZִв","",MessageBox.ERROR); + return null; + } + if("JK8NNWPModNORegForm".equals(targetComp.getType())){ + System.out.println("start"); + ExportWaterForm_Dialog action=new ExportWaterForm_Dialog((TCComponentForm)targetComp,session); + new Thread(action).start(); + + }else{ + MessageBox.post("ѡˮǼDZִв","",MessageBox.ERROR); + } + + return null; + } + +} diff --git a/src/com/connor/jk/plm/exportWaterForm/ExportWaterForm_Operation.java b/src/com/connor/jk/plm/exportWaterForm/ExportWaterForm_Operation.java new file mode 100644 index 0000000..5eb7f62 --- /dev/null +++ b/src/com/connor/jk/plm/exportWaterForm/ExportWaterForm_Operation.java @@ -0,0 +1,488 @@ +package com.connor.jk.plm.exportWaterForm; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import javax.swing.JTable; + +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 com.connor.jk.plm.bom.until.ProgressBarThread; +import com.teamcenter.rac.aif.AbstractAIFOperation; +import com.teamcenter.rac.kernel.TCComponentDataset; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCComponentTcFile; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class ExportWaterForm_Operation extends AbstractAIFOperation { + private Map maptab; + // private JTable dataTable1;// 1 + // private JTable dataTable2;// 2 + // private JTable dataTable3;// 3 + // private JTable dataTable4;// 4 + // private JTable dataTable5;// 5 + // private JTable dataTable6;// 6 + // private JTable dataTable7;// 7 + private Map>> mapVal; + private List> list1 = new ArrayList<>(); + + + + private String[] jk8ProductTypePMN;// + private String[] jk8ProjectNO;//Ŀ + private String[] jk8ProjectName;//Ŀ + private String[] jk8ProductModNO;//Ʒͺ + private String[] jk8ProductIdentifyNO;//ʶ + + private String[] jk8ProductName;//Ʒ + private String[] jk8BMManufactor;// + private String[] jk8BMMaterial;// + private String[] jk8ContrlCompType;// + private String[] jk8Note;//ע + + private String[] jk8Applicant;// + private String[] jk8RecordDate;//Ǽ + private String[] jk8Status;//״̬ +// private String[] jk8ProductTypePMN;//Ʒ + private String[] jk8PipeDSpec;//ܾ + + //private String[] jk8CommunicateMode;//ͨŷʽ//20210201ȥ,֮ǰûȥ + private String[] jk8Structure;//ṹ + + /** zmf add : 19/12/27 **/ + private String[] jk8Description;// + + // + private String[] tz; + private String[] cz; + + private TCComponentForm form; + private TCSession session; + private String path; + private File file; + + private XSSFSheet sheet; + private XSSFWorkbook workBook; + private FileInputStream fis; + private FileOutputStream fos; + private String excelPath; + private ProgressBarThread wait; + + public ExportWaterForm_Operation(Map maptab) { + + this.maptab = maptab; + // dataTable1=maptab.get("ñ"); + // dataTable2=maptab.get("ҵ"); + // dataTable3=maptab.get("ɼ"); + // dataTable4=maptab.get(""); + // dataTable5=maptab.get(""); + // dataTable6=maptab.get("ֵ"); + // dataTable7=maptab.get("ֳֻ"); + + } + + public ExportWaterForm_Operation(TCComponentForm form, TCSession session, + String path) { + + this.form = form; + this.session = session; + this.path = path; + + } + + private void getval() { + + try { + jk8ProductTypePMN = form.getTCProperty("jk8ProductTypePMN").getStringArrayValue(); + jk8ProjectNO = form.getTCProperty("jk8ProjectNO").getStringArrayValue();// Ŀ + jk8ProjectName = form.getTCProperty("jk8ProjectName").getStringArrayValue();// Ŀ + jk8ProductModNO = form.getTCProperty("jk8ProductModNO").getStringArrayValue();// Ʒͺ + jk8ProductIdentifyNO = form.getTCProperty("jk8ProductIdentifyNO").getStringArrayValue();// ʶ + jk8ProductName = form.getTCProperty("jk8ProductName").getStringArrayValue();// Ʒ + jk8BMManufactor = form.getTCProperty("jk8BMManufactor").getStringArrayValue();// + jk8BMMaterial = form.getTCProperty("jk8BMMaterial").getStringArrayValue();// + jk8ContrlCompType = form.getTCProperty("jk8ContrlCompType").getStringArrayValue();// + jk8Note = form.getTCProperty("jk8Note").getStringArrayValue();// ע + jk8Applicant = form.getTCProperty("jk8Applicant").getStringArrayValue();// + jk8RecordDate = form.getTCProperty("jk8RecordDate").getStringArrayValue();// Ǽ + jk8Status = form.getTCProperty("jk8Status").getStringArrayValue();// ״̬ + // u8mmh = form.getTCProperty("jk8U8NO").getStringArrayValue();// + // U8 + jk8PipeDSpec = form.getTCProperty("jk8PipeDSpec").getStringArrayValue();// ܾ + //jk8CommunicateMode = form.getTCProperty("jk8CommunicateMode").getStringArrayValue();// ͨŷʽ + jk8Structure = form.getTCProperty("jk8Structure").getStringArrayValue();// ṹ + /* add */ + jk8Description = form.getTCProperty("jk8FunctionOverview").getStringArrayValue(); //jk8FunctionOverview + // + tz = form.getTCProperty("jk8Feature").getStringArrayValue(); //jk8Feature + cz = form.getTCProperty("jk8Texture").getStringArrayValue(); //jk8Texture + + } catch (TCException e) { + + e.printStackTrace(); + wait.setBool(true);// رս + wait.interrupt(); + } + if (jk8ProductIdentifyNO != null && jk8ProductIdentifyNO.length > 0) { + int len = jk8ProductIdentifyNO.length; + for (int i = 0; i < len; i++) { + List list = new ArrayList<>(); + list.add(jk8ProductTypePMN[i]); + list.add(jk8ProjectNO[i]); + list.add(jk8ProjectName[i]); + list.add(jk8ProductModNO[i]); + list.add(jk8ProductIdentifyNO[i]); + + list.add(jk8ProductName[i]); + list.add(jk8BMManufactor[i]); + list.add(jk8BMMaterial[i]); + list.add(jk8ContrlCompType[i]); + list.add(jk8Note[i]); + + list.add(jk8Applicant[i]); + list.add(jk8RecordDate[i]); + list.add(jk8Status[i]); + list.add(jk8PipeDSpec[i]); + //list.add(jk8CommunicateMode[i]); + + list.add(jk8Structure[i]); + /* add */ + list.add(jk8Description[i]); + // + list.add(tz[i]); + list.add(cz[i]); + + list1.add(list); + + + } + } + + } + + @Override + public void executeOperation() throws Exception { + + file = getSXX(); + if (file != null) { + wait = new ProgressBarThread("ݵ", + "ݵУԵ..."); + wait.start();// + // getVal(); + try { + getval(); + writeExcel(); + } catch (Exception e) { + + e.printStackTrace(); + wait.setBool(true);// رս + wait.interrupt(); + } + wait.setBool(true);// رս + wait.interrupt(); + MessageBox.post("","",MessageBox.INFORMATION); + Runtime.getRuntime().exec("cmd /c \"" + excelPath + "\""); + } + + } + + public File getSXX() { + TCPreferenceService pref = session.getPreferenceService(); + String puid = pref.getStringValue("JK_WATER_FORM_Dataset_Puid");// ѡpuid + if (puid != null) { + try { + TCComponentDataset dataset = (TCComponentDataset) session + .stringToComponent(puid); + if (dataset == null) { + return null; + } + TCComponentTcFile[] file = dataset.getTcFiles(); + if (file.length == 0 || file.length != 1) { + MessageBox.post("ݼûõļļ࣬飡", "WARNING", + MessageBox.WARNING); + return null; + } else { + File fmsFile = file[0].getFmsFile(); + return fmsFile; + } + } catch (TCException e) { + + e.printStackTrace(); + } + + } else { + MessageBox.post("δҵѡ[JK_WATER_FORM_Dataset_Puid]ѡô", "", + MessageBox.ERROR); + return null; + } + return null; + } + + public void writeExcel() { + + try { + fis = new FileInputStream(file); + workBook = new XSSFWorkbook(fis); + if (workBook != null) { + int sheetlength = workBook.getNumberOfSheets(); + List sheetNameList = new ArrayList<>(); + for (int i = 0; i < sheetlength; i++) { + sheetNameList.add(workBook.getSheetName(i)); + } + for (String sheetName : sheetNameList) { + XSSFSheet sheet = workBook.getSheet(sheetName); + if (sheetName.equals("ˮǼDZ")) { + writeSheet(sheet,list1); + } + + } + + SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");// ڸʽ + String time = df.format(new Date()); + excelPath = path + File.separator + "ˮƷͺʶŻܱ" + + time + ".xlsx"; + File fileout = new File(excelPath); + fos = new FileOutputStream(fileout); + workBook.write(fos); + // Runtime.getRuntime().exec(excelPath); + + + + } + } catch (FileNotFoundException e) { + + e.printStackTrace(); + wait.setBool(true);// رս + wait.interrupt(); + } catch (IOException e) { + + e.printStackTrace(); + wait.setBool(true);// رս + wait.interrupt(); + } + + } + + public void writeSheet(XSSFSheet sheet, List> list) { + for (int i = 0; i < list.size(); i++) { + XSSFRow rowm = sheet.createRow(i + 1); + XSSFCellStyle sty =workBook.createCellStyle(); //sheet.getRow(0).getCell(0).getCellStyle(); + for (int j = 0; j <= list.get(i).size(); j++) { + XSSFCell c = rowm.createCell(j); + c.setCellStyle(sty); + if(j==0) { + c.setCellValue(i+1+""); + }else { + c.setCellValue(list.get(i).get(j-1)==null?"":list.get(i).get(j-1)); + } + + + } + + } + + } + + // public void getVal() { + // + // mapVal=new HashMap>>(); + // List> tbList; + // List tableList; + // int rowCount1 = dataTable1.getRowCount(); + // int rowCount2 = dataTable2.getRowCount(); + // int rowCount3 = dataTable3.getRowCount(); + // int rowCount4 = dataTable4.getRowCount(); + // int rowCount5 = dataTable5.getRowCount(); + // int rowCount6 = dataTable6.getRowCount(); + // int rowCount7 = dataTable7.getRowCount(); + // tbList=new ArrayList<>(); + // for (int j = 0; j < rowCount1; j++) { + // tableList=new ArrayList<>(); + // tableList.add(dataTable1.getValueAt(j, + // 1)==null?"":(String)dataTable1.getValueAt(j, 1));//Ŀ + // tableList.add(dataTable1.getValueAt(j, + // 2)==null?"":(String)dataTable1.getValueAt(j, 2));//Ŀ + // tableList.add(dataTable1.getValueAt(j, + // 3)==null?"":(String)dataTable1.getValueAt(j, 3)); + // tableList.add(dataTable1.getValueAt(j, + // 4)==null?"":(String)dataTable1.getValueAt(j, 4));// ʶ + // tableList.add(dataTable1.getValueAt(j, + // 5)==null?"":(String)dataTable1.getValueAt(j, 5));// Ʒ + // tableList.add(dataTable1.getValueAt(j, + // 6)==null?"":(String)dataTable1.getValueAt(j, 6));// + // tableList.add(dataTable1.getValueAt(j, + // 7)==null?"":(String)dataTable1.getValueAt(j, 7));// ICͺ + // tableList.add(dataTable1.getValueAt(j, + // 8)==null?"":(String)dataTable1.getValueAt(j, 8));// ·ͺ + // tableList.add(dataTable1.getValueAt(j, + // 9)==null?"":(String)dataTable1.getValueAt(j, 9));// + // tableList.add(dataTable1.getValueAt(j, + // 10)==null?"":(String)dataTable1.getValueAt(j, 10));// ͺ + // tableList.add(dataTable1.getValueAt(j, + // 11)==null?"":(String)dataTable1.getValueAt(j, 11));// ܸ + // tableList.add(dataTable1.getValueAt(j, + // 12)==null?"":(String)dataTable1.getValueAt(j, 12));// ͻҪ + // tableList.add(dataTable1.getValueAt(j, + // 13)==null?"":(String)dataTable1.getValueAt(j, 13));// + // tableList.add(dataTable1.getValueAt(j, + // 14)==null?"":(String)dataTable1.getValueAt(j, 14));// + // tableList.add(dataTable1.getValueAt(j, + // 15)==null?"":(String)dataTable1.getValueAt(j, 15));// + // tableList.add(dataTable1.getValueAt(j, + // 16)==null?"":(String)dataTable1.getValueAt(j, 16));// Ǽ + // tbList.add(tableList); + // } + // mapVal.put("ñ", tbList); + // tbList=new ArrayList<>(); + // for (int j = 0; j < rowCount2; j++) { + // tableList=new ArrayList<>(); + // tableList.add(dataTable2.getValueAt(j, 1)==null?"":(String) + // dataTable2.getValueAt(j, 1));//Ŀ + // tableList.add(dataTable2.getValueAt(j, 2)==null?"":(String) + // dataTable2.getValueAt(j, 2));//Ŀ + // tableList.add(dataTable2.getValueAt(j, 3)==null?"":(String) + // dataTable2.getValueAt(j, 3));// Ʒͺ + // tableList.add(dataTable2.getValueAt(j, 4)==null?"":(String) + // dataTable2.getValueAt(j, 4));// ʶ + // tableList.add(dataTable2.getValueAt(j, 5)==null?"":(String) + // dataTable2.getValueAt(j, 5));// Ʒ + // tableList.add(dataTable2.getValueAt(j, 6)==null?"":(String) + // dataTable2.getValueAt(j, 6));// ·ͺ + // tableList.add(dataTable2.getValueAt(j, 7)==null?"":(String) + // dataTable2.getValueAt(j, 7));// ܸ + // tableList.add(dataTable2.getValueAt(j, 8)==null?"":(String) + // dataTable2.getValueAt(j, 8));// ͺ + // tableList.add(dataTable2.getValueAt(j, 9)==null?"":(String) + // dataTable2.getValueAt(j, 9));// + // tableList.add(dataTable2.getValueAt(j, 10)==null?"":(String) + // dataTable2.getValueAt(j, 10));// Ǽ + // tbList.add(tableList); + // } + // mapVal.put("ҵ", tbList); + // + // tbList=new ArrayList<>(); + // for (int j = 0; j < rowCount3; j++) { + // tableList=new ArrayList<>(); + // tableList.add(dataTable3.getValueAt(j, 1)==null?"":(String) + // dataTable3.getValueAt(j, 1));// Ŀ + // tableList.add(dataTable3.getValueAt(j, 2)==null?"":(String) + // dataTable3.getValueAt(j, 2));// Ŀ + // tableList.add(dataTable3.getValueAt(j, 3)==null?"":(String) + // dataTable3.getValueAt(j, 3));// Ʒͺ + // tableList.add(dataTable3.getValueAt(j, 4)==null?"":(String) + // dataTable3.getValueAt(j, 4));// ʶ + // tableList.add(dataTable3.getValueAt(j, 5)==null?"":(String) + // dataTable3.getValueAt(j, 5));// Ʒ + // tableList.add(dataTable3.getValueAt(j, 6)==null?"":(String) + // dataTable3.getValueAt(j, 6));// ܸ + // tableList.add(dataTable3.getValueAt(j, 7)==null?"":(String) + // dataTable3.getValueAt(j, 7));// г + // tableList.add(dataTable3.getValueAt(j, 8)==null?"":(String) + // dataTable3.getValueAt(j, 8));// + // tableList.add(dataTable3.getValueAt(j, 9)==null?"":(String) + // dataTable3.getValueAt(j, 9));// Ǽ + // + // } + // mapVal.put("ɼ", tbList); + // + // tbList=new ArrayList<>(); + // for (int j =0; j < rowCount4; j++) { + // tableList=new ArrayList<>(); + // tableList.add( dataTable4.getValueAt(j, 1)==null?"":(String) + // dataTable4.getValueAt(j, 1));// Ŀ + // tableList.add( dataTable4.getValueAt(j, 2)==null?"":(String) + // dataTable4.getValueAt(j, 2));// Ŀ + // tableList.add( dataTable4.getValueAt(j, 3)==null?"":(String) + // dataTable4.getValueAt(j, 3));// ʶ + // tableList.add( dataTable4.getValueAt(j, 4)==null?"":(String) + // dataTable4.getValueAt(j, 4));// Ʒ + // tableList.add( dataTable4.getValueAt(j, 5)==null?"":(String) + // dataTable4.getValueAt(j, 5));// ׻ + // tableList.add(dataTable4.getValueAt(j, 6)==null?"":(String) + // dataTable4.getValueAt(j, 6));// ܸ + // tableList.add( dataTable4.getValueAt(j, 7)==null?"":(String) + // dataTable4.getValueAt(j, 7));// + // tableList.add( dataTable4.getValueAt(j, 8)==null?"":(String) + // dataTable4.getValueAt(j, 8));// Ǽ + // + // } + // mapVal.put("", tbList); + // + // tbList=new ArrayList<>(); + // for (int j = 0; j < rowCount5; j++) { + // tableList=new ArrayList<>(); + // tableList.add(dataTable5.getValueAt(j, 1)==null?"":(String) + // dataTable5.getValueAt(j, 1));// Ŀ + // tableList.add(dataTable5.getValueAt(j, 2)==null?"":(String) + // dataTable5.getValueAt(j, 2));// Ŀ + // tableList.add(dataTable5.getValueAt(j, 3)==null?"":(String) + // dataTable5.getValueAt(j, 3));// Ʒ + // tableList.add(dataTable5.getValueAt(j, 4)==null?"":(String) + // dataTable5.getValueAt(j, 4));// ʶ + // tableList.add(dataTable5.getValueAt(j, 5)==null?"":(String) + // dataTable5.getValueAt(j, 5));// ܸ + // tableList.add(dataTable5.getValueAt(j, 6)==null?"":(String) + // dataTable5.getValueAt(j, 6));// + // tableList.add(dataTable5.getValueAt(j, 7)==null?"":(String) + // dataTable5.getValueAt(j, 7));// Ǽ + // } + // mapVal.put("", tbList); + // + // tbList=new ArrayList<>(); + // for (int j = 0; j (); + // tableList.add( dataTable6.getValueAt(j, 1)==null?"":(String) + // dataTable6.getValueAt(j, 1));// Ŀ + // tableList.add(dataTable6.getValueAt(j, 2)==null?"":(String) + // dataTable6.getValueAt(j, 2));// Ŀ + // tableList.add( dataTable6.getValueAt(j, 3)==null?"":(String) + // dataTable6.getValueAt(j, 3));// Ʒ + // tableList.add( dataTable6.getValueAt(j, 4)==null?"":(String) + // dataTable6.getValueAt(j, 4));// ʶ + // tableList.add( dataTable6.getValueAt(j, 5)==null?"":(String) + // dataTable6.getValueAt(j, 5));// ܸ + // tableList.add( dataTable6.getValueAt(j, 6)==null?"":(String) + // dataTable6.getValueAt(j, 6));// + // tableList.add( dataTable6.getValueAt(j, 7)==null?"":(String) + // dataTable6.getValueAt(j, 7));// Ǽ + // + // } + // mapVal.put("ֵ", tbList); + // + // tbList=new ArrayList<>(); + // for (int j = 0; j < rowCount7; j++) { + // tableList=new ArrayList<>(); + // tableList.add( dataTable7.getValueAt(j, 1)==null?"":(String) + // dataTable7.getValueAt(j, 1));// Ŀ + // tableList.add( dataTable7.getValueAt(j, 2)==null?"":(String) + // dataTable7.getValueAt(j, 2));// Ŀ + // tableList.add( dataTable7.getValueAt(j, 3)==null?"":(String) + // dataTable7.getValueAt(j, 3));// Ʒ + // tableList.add( dataTable7.getValueAt(j, 4)==null?"":(String) + // dataTable7.getValueAt(j, 4));// ʶ + // tableList.add( dataTable7.getValueAt(j, 5)==null?"":(String) + // dataTable7.getValueAt(j, 5));// ܸ + // tableList.add( dataTable7.getValueAt(j, 6)==null?"":(String) + // dataTable7.getValueAt(j, 6));// + // tableList.add( dataTable7.getValueAt(j, 7)==null?"":(String) + // dataTable7.getValueAt(j, 7));// Ǽ + // } + // mapVal.put("ֳֻ", tbList); + // } + +} diff --git a/src/com/connor/jk/plm/form/BOM.java b/src/com/connor/jk/plm/form/BOM.java new file mode 100644 index 0000000..8d82dbc --- /dev/null +++ b/src/com/connor/jk/plm/form/BOM.java @@ -0,0 +1,10 @@ +package com.connor.jk.plm.form; + +import com.teamcenter.rac.kernel.TCComponentBOMLine; +import com.teamcenter.rac.kernel.TCComponentBOMWindow; + +public class BOM { + public TCComponentBOMWindow window; + public TCComponentBOMLine line; + +} diff --git a/src/com/connor/jk/plm/form/BZGXBean.java b/src/com/connor/jk/plm/form/BZGXBean.java new file mode 100644 index 0000000..1b9ae59 --- /dev/null +++ b/src/com/connor/jk/plm/form/BZGXBean.java @@ -0,0 +1,24 @@ +package com.connor.jk.plm.form; + +/** + * @copyRight ݿտƼ޹˾ + * @author E-mail:hub@connor.net.cn + * @date ʱ䣺2016-10-19 7:44:31 + * @version v1.0 + * @parameter + * @since + * @return + */ + +public class BZGXBean { + public String hx3_gxbz = ""; // ׼ + public String hx3_gxsm = "";// ˵ + public String hx3_gzzx = "";// , + public String hx3_gzzxmc = "";// + public boolean hx3_dcgx1 = false;// 幤 + public boolean hx3_bgd1 = false;// + public boolean hx3_wwgx1 = false;// ί⹤ + public boolean hx3_jfd1 = false;// Ʒѵ + public boolean hx3_jhwwgx1 = false;// ƻί⹤ + +} diff --git a/src/com/connor/jk/plm/form/BomStructBean.java b/src/com/connor/jk/plm/form/BomStructBean.java new file mode 100644 index 0000000..74f0f46 --- /dev/null +++ b/src/com/connor/jk/plm/form/BomStructBean.java @@ -0,0 +1,77 @@ +package com.connor.jk.plm.form; + +import java.util.List; + +import com.teamcenter.rac.kernel.TCComponentBOMLine; +import com.teamcenter.rac.kernel.TCException; + +public class BomStructBean { + + private TCComponentBOMLine bomLine; + + private String gxh; + private String itemID; + + private List chlidLineS; + + // ============================================ + + public List getChlidLineS() { + return chlidLineS; + } + + public String getItemID() { + return itemID; + } + + public void setItemID(String itemID) { + this.itemID = itemID; + } + + public String getGxh() { + return gxh; + } + + public void setGxh(String gxh) { + this.gxh = gxh; + } + + public void setChlidLineS(List chlidLineS) { + this.chlidLineS = chlidLineS; + } + + public TCComponentBOMLine getBomLine() { + return bomLine; + } + + public void setBomLine(TCComponentBOMLine bomLine) { + this.bomLine = bomLine; + try { + this.gxh = bomLine.getStringProperty("HX3_gxhh"); + this.itemID = bomLine.getItem().getStringProperty("item_id"); + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + @Override + public String toString() { + String objectString = "NULL"; + if (bomLine != null) { + try { + objectString = bomLine.getItemRevision().getStringProperty( + "object_string") + + " [" + this.gxh + "]"; + + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + + return objectString; + } + +} diff --git a/src/com/connor/jk/plm/form/BomStructTree.java b/src/com/connor/jk/plm/form/BomStructTree.java new file mode 100644 index 0000000..cf1b8a2 --- /dev/null +++ b/src/com/connor/jk/plm/form/BomStructTree.java @@ -0,0 +1,275 @@ +package com.connor.jk.plm.form; + +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.List; + +import javax.swing.BorderFactory; +import javax.swing.DefaultListModel; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTree; +import javax.swing.border.TitledBorder; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeCellRenderer; +import javax.swing.tree.DefaultTreeModel; + +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.util.ButtonLayout; + +public class BomStructTree extends AbstractAIFDialog implements ActionListener { + + private BomStructBean bean; + private JTree tree; + private JButton okButton; + private JButton celButton; + private JButton addButton; + private JButton delButton; + private JList selectList; + private BomStructBean selectStructBean; + private JPanel listJPanel; + private com.teamcenter.rac.form.JK8_JSPSFormStyleSheet sheet; + private HX3_GYLXRevisionFormPropBean hx3Bean; + private DefaultListModel listModel; + + public BomStructTree(BomStructBean bean, + com.teamcenter.rac.form.JK8_JSPSFormStyleSheet hx3_GYLXRevisionFormStyleSheet) { + super(false); + this.bean = bean; + this.sheet = hx3_GYLXRevisionFormStyleSheet; + init(); + } + + public void init() { + + DefaultMutableTreeNode top = new DefaultMutableTreeNode(this.bean); + try { + getTypeOptionInfo(this.bean, top); + } catch (TCException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + tree = new JTree(top); + // tree.setCellRenderer(new CellRender(this.hx3Bean)); + tree.setCellRenderer(new BomStructTreeCellRenderer()); + tree.addTreeSelectionListener(new TreeSelectionListener() { + @Override + public void valueChanged(TreeSelectionEvent e) { + // TODO Auto-generated method stub + DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) tree + .getLastSelectedPathComponent();// ѡĽڵ + // String sel = selectedNode.toString(); // ȡѡеĽڵ + if (selectedNode == null) + return; + selectStructBean = (BomStructBean) selectedNode.getUserObject(); + + } + }); + + this.okButton = new JButton("ȷ"); + this.okButton.addActionListener(this); + + this.celButton = new JButton("ȡ"); + this.celButton.addActionListener(this); + + JPanel bottomJPanel = new JPanel(new FlowLayout()); + bottomJPanel.add(okButton); + bottomJPanel.add(new JLabel(" ")); + bottomJPanel.add(celButton); + JPanel treeJPanel = new JPanel(new BorderLayout()); + treeJPanel.add(new JScrollPane(tree), BorderLayout.CENTER); + + this.addButton = new JButton(">>"); + this.addButton.setToolTipText(""); + this.addButton.addActionListener(this); + this.delButton = new JButton("<<"); + this.delButton.setToolTipText("Ƴ"); + this.delButton.addActionListener(this); + JPanel midJPanel = new JPanel(new ButtonLayout(ButtonLayout.VERTICAL)); + midJPanel.add(addButton); + midJPanel.add(new JLabel(" ")); + midJPanel.add(delButton); + treeJPanel.add(midJPanel, BorderLayout.EAST); + + listModel = new DefaultListModel<>(); + selectList = new JList<>(listModel); + listJPanel = new JPanel(new BorderLayout()); + listJPanel.add(new JScrollPane(selectList), BorderLayout.CENTER); + + JPanel centerJPanel = new JPanel(new ButtonLayout( + ButtonLayout.HORIZONTAL)); + centerJPanel.add(treeJPanel); + // centerJPanel.add(midJPanel); + centerJPanel.add(listJPanel); + centerJPanel.setBorder(new TitledBorder(BorderFactory + .createEtchedBorder())); + + this.setSize(new Dimension(900, 900)); + this.setLayout(new BorderLayout()); + this.add(centerJPanel, BorderLayout.CENTER); + this.add(bottomJPanel, BorderLayout.SOUTH); + + // this.showDialog(); + this.centerToScreen(); + this.setAlwaysOnTop(true); + this.validate(); + + } + + public void getTypeOptionInfo(BomStructBean bean, + DefaultMutableTreeNode node) throws TCException { + + if (bean != null && bean.getChlidLineS() != null + && bean.getChlidLineS().size() != 0) { + + List childBeanS = bean.getChlidLineS(); + for (int i = 0; i < childBeanS.size(); i++) { + DefaultMutableTreeNode cTypeNode = new DefaultMutableTreeNode( + childBeanS.get(i)); + getTypeOptionInfo(childBeanS.get(i), cTypeNode); + node.add(cTypeNode); + + } + } + + } + + public void getSelectedItem(BomStructBean bean) { + if (bean == null) { + return; + } + if(bean.getGxh()==null){ + return; + } + if (bean.getGxh().equals(this.hx3Bean.hx3_gxhh)) { + listModel.addElement(bean); + } + if (bean.getChlidLineS() != null) { + for (BomStructBean child : bean.getChlidLineS()) { + getSelectedItem(child); + } + + } + } + + public void showDialog(HX3_GYLXRevisionFormPropBean bean) { + + this.hx3Bean = bean; + this.listModel.removeAllElements(); + getSelectedItem(this.bean); + this.listJPanel.validate(); + ((DefaultTreeModel) this.tree.getModel()).reload(); + this.validate(); + + super.showDialog(); + } + + @Override + public void actionPerformed(ActionEvent actionevent) { + // TODO Auto-generated method stub + Object sorceObj = actionevent.getSource(); + if (sorceObj.equals(this.okButton)) { + int size = this.listModel.getSize(); + StringBuffer gxhhSb = new StringBuffer(); + for (int i = 0; i < size; i++) { + listModel.getElementAt(i).setGxh(this.hx3Bean.hx3_gxhh); + gxhhSb.append(listModel.getElementAt(i).getItemID()); + if (i != (size - 1)) { + gxhhSb.append(","); + } + } + hx3Bean.hx3_lywl = gxhhSb.toString(); + this.disposeDialog(); + } else if (sorceObj.equals(this.celButton)) { + this.disposeDialog(); + // this.dispose(); + } else if (sorceObj.equals(this.addButton)) { + // selectStructBean + if (selectStructBean.getGxh().trim().isEmpty()) { + if (selectStructBean != null) { + if (!listModel.contains(selectStructBean)){ + listModel.addElement(selectStructBean); + selectStructBean.setGxh(hx3Bean.hx3_gxhh); + } + } + } + //this.validate(); + //this.setVisible(false); + this.setVisible(true); + // listModel. + } else if (sorceObj.equals(this.delButton)) { + int index = this.selectList.getSelectedIndex(); + if (index == -1) { + return; + } + this.listModel.getElementAt(index).setGxh(""); + this.listModel.removeElementAt(index); + //this.validate(); + //this.setVisible(false); + this.setVisible(true); + } + + } + + class BomStructTreeCellRenderer extends DefaultTreeCellRenderer { + /** + * ID + */ + private static final long serialVersionUID = 2L; + + /** + * + */ + @Override + public Component getTreeCellRendererComponent(JTree tree, Object value, + boolean sel, boolean expanded, boolean leaf, int row, + boolean hasFocus) { + + super.getTreeCellRendererComponent(tree, value, sel, expanded, + leaf, row, hasFocus); + + setText(value.toString()); + + if (sel) { + setForeground(getTextSelectionColor()); + } else { + setForeground(getTextNonSelectionColor()); + } + + DefaultMutableTreeNode node = (DefaultMutableTreeNode) value; + + Object obj = node.getUserObject(); + + if (obj != null && (obj instanceof BomStructBean) + && ((BomStructBean) obj).getBomLine() != null) { + + ImageIcon imageIcon = null; + try { + imageIcon = com.teamcenter.rac.common.TCTypeRenderer + .getIcon(((BomStructBean) obj).getBomLine() + .getItemRevision().getType()); + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + this.setIcon(imageIcon); + + } + + return this; + } + } + +} diff --git a/src/com/connor/jk/plm/form/CellRender.java b/src/com/connor/jk/plm/form/CellRender.java new file mode 100644 index 0000000..49054a9 --- /dev/null +++ b/src/com/connor/jk/plm/form/CellRender.java @@ -0,0 +1,66 @@ +package com.connor.jk.plm.form; + +import java.awt.BorderLayout; +import java.awt.Component; + +import javax.swing.JCheckBox; +import javax.swing.JPanel; +import javax.swing.JTree; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.TreeCellRenderer; +import javax.swing.tree.TreePath; + +public class CellRender extends JPanel implements TreeCellRenderer { + + private JCheckBox checkBox = new JCheckBox(); + private HX3_GYLXRevisionFormPropBean hx3Bean; + private boolean isSelect; + + public CellRender(HX3_GYLXRevisionFormPropBean hx3Bean) { + + setLayout(new BorderLayout()); + setOpaque(false); + this.hx3Bean = hx3Bean; + checkBox.setOpaque(false); + } + + public Component getTreeCellRendererComponent(JTree tree, Object value, + boolean selected, boolean expanded, boolean leaf, int row, + boolean hasFocus) { + + BomStructBean bean = (BomStructBean) ((DefaultMutableTreeNode) value) + .getUserObject(); + + TreePath path = tree.getPathForRow(row); + checkBox.setText(bean.toString()); + if (bean.getGxh() != null && !bean.getGxh().isEmpty()) { + // System.out.println("к = >" + bean.getGxh()); + checkBox.setSelected(true); + checkBox.setEnabled(false); + if (hx3Bean != null && hx3Bean.hx3_gxhh.equals(bean.getGxh())) { + // System.out.println("к == hx3Bean.hx3_gxhh "); + checkBox.setEnabled(true); + } else { + // System.out.println("к =/= hx3Bean.hx3_gxhh "); + } + } else { + // System.out.println("к = NULL/\"\" >" + bean.getGxh()); + checkBox.setEnabled(true); + + } + + if (path.equals(tree.getSelectionPath()) && checkBox.isEnabled()) { + System.out.println("ѡ / " + checkBox.isSelected()); + if (checkBox.isSelected()) { + checkBox.setSelected(false); + } else { + checkBox.setSelected(true); + } + } + removeAll(); + add(checkBox, BorderLayout.WEST); + // add(this, BorderLayout.CENTER); + + return this; + } +} diff --git a/src/com/connor/jk/plm/form/GYLXFormPropBean.java b/src/com/connor/jk/plm/form/GYLXFormPropBean.java new file mode 100644 index 0000000..9f6f745 --- /dev/null +++ b/src/com/connor/jk/plm/form/GYLXFormPropBean.java @@ -0,0 +1,67 @@ +package com.connor.jk.plm.form; + +import java.util.List; + +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JComponent; + +import com.teamcenter.rac.kernel.TCProperty; + +public class GYLXFormPropBean { + private TCProperty prop; + private JComponent comp; + private JButton addBtn; + private JButton celBtn; + private JComboBox selectBox; + private List innerValue; + + public JButton getAddBtn() { + return addBtn; + } + + public void setAddBtn(JButton addBtn) { + this.addBtn = addBtn; + } + + public JButton getCelBtn() { + return celBtn; + } + + public void setCelBtn(JButton celBtn) { + this.celBtn = celBtn; + } + + public JComboBox getSelectBox() { + return selectBox; + } + + public void setSelectBox(JComboBox selectBox) { + this.selectBox = selectBox; + } + + public List getInnerValue() { + return innerValue; + } + + public void setInnerValue(List innerValue) { + this.innerValue = innerValue; + } + + public TCProperty getProp() { + return prop; + } + + public void setProp(TCProperty prop) { + this.prop = prop; + } + + public JComponent getComp() { + return comp; + } + + public void setComp(JComponent comp) { + this.comp = comp; + } + +} diff --git a/src/com/connor/jk/plm/form/GYLXFormStyleSheet.java b/src/com/connor/jk/plm/form/GYLXFormStyleSheet.java new file mode 100644 index 0000000..e11e852 --- /dev/null +++ b/src/com/connor/jk/plm/form/GYLXFormStyleSheet.java @@ -0,0 +1,84 @@ +package com.connor.jk.plm.form; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; + +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.stylesheet.AbstractRendering; + +public class GYLXFormStyleSheet extends AbstractRendering implements + ActionListener, MouseListener, KeyListener { + + public GYLXFormStyleSheet(TCComponent form) throws Exception { + super(form); + } + + @Override + public void keyPressed(KeyEvent arg0) { + + } + + @Override + public void keyReleased(KeyEvent arg0) { + + } + + @Override + public void keyTyped(KeyEvent arg0) { + + } + + @Override + public void mouseClicked(MouseEvent arg0) { + // TODO Auto-generated method stub + + } + + @Override + public void mouseEntered(MouseEvent arg0) { + // TODO Auto-generated method stub + + } + + @Override + public void mouseExited(MouseEvent arg0) { + // TODO Auto-generated method stub + + } + + @Override + public void mousePressed(MouseEvent arg0) { + // TODO Auto-generated method stub + + } + + @Override + public void mouseReleased(MouseEvent arg0) { + // TODO Auto-generated method stub + + } + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + + } + + @Override + public void loadRendering() throws TCException { + // TODO Auto-generated method stub + + } + + @Override + public void saveRendering() { + // TODO Auto-generated method stub + + } + +} diff --git a/src/com/connor/jk/plm/form/HX3_BZGX.java b/src/com/connor/jk/plm/form/HX3_BZGX.java new file mode 100644 index 0000000..52ac96e --- /dev/null +++ b/src/com/connor/jk/plm/form/HX3_BZGX.java @@ -0,0 +1,464 @@ +package com.connor.jk.plm.form; + +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map.Entry; +import java.util.Set; +import javax.swing.DefaultCellEditor; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTabbedPane; +import javax.swing.JTable; +import javax.swing.ListSelectionModel; +import javax.swing.table.DefaultTableModel; +import javax.swing.table.TableCellRenderer; +import javax.swing.table.TableColumn; + +import com.teamcenter.rac.common.IEditableSwingComp; +import com.teamcenter.rac.kernel.ListOfValuesInfo; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCComponentListOfValues; +import com.teamcenter.rac.kernel.TCComponentListOfValuesType; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.stylesheet.AbstractRendering; +import com.teamcenter.rac.util.ButtonLayout; +import com.teamcenter.rac.util.MessageBox; + +public class HX3_BZGX extends AbstractRendering implements ActionListener { + private final String[] propNameS ={"hx3_gzbz","hx3_gxsm","hx3_gzzx",//string + "hx3_bgd1","hx3_dcgx1","hx3_jfd1","hx3_jhwwgx1","hx3_wwgx1"}; //boolean + private final Object[] tfStr = {true,false}; + private TCComponentForm form ; + private List lovList; + private HashMap lovMap; + private HashMap> bzgxBeanMap; + private List tableList; + private JTabbedPane tabbedPane; + private JButton addButton; + private JButton addUpButton; + private JButton delButton; + + /** + * + */ + public void cleanAll(){ + if(lovList!=null){ + lovList.clear(); + } + if(lovMap!=null){ + lovMap.clear(); + } + if(bzgxBeanMap!=null){ + bzgxBeanMap.clear(); + } + } + + public void setPropS() throws TCException{ + boolean isSaveOk = false; + StringBuffer errorBuffer = new StringBuffer(); + List hx3_gzbzValueList = new ArrayList<>(); + List hx3_gxsmValueList = new ArrayList<>(); + List hx3_gzzxValueList = new ArrayList<>(); + List hx3_bgd1ValueList = new ArrayList<>(); + List hx3_dcgx1ValueList = new ArrayList<>(); + List hx3_jfd1ValueList = new ArrayList<>(); + List hx3_jhwwgx1ValueList = new ArrayList<>(); + List hx3_wwgx1ValueList = new ArrayList<>(); + TCProperty[] propSS= form.getTCProperties(propNameS); + + for(JTable table : tableList){ + DefaultTableModel model = (DefaultTableModel) table.getModel(); + int rowCount = model.getRowCount(); + for(int i = 0 ;i (); + this.lovList = getLov("HX3_GZZX"); + if(this.lovList!=null){ + for(LOVBean bean : this.lovList){ + List bzgxBeanList = new ArrayList<>(); + + this.bzgxBeanMap.put(bean.disValue, bzgxBeanList); + } + } + TCProperty[] propSS= form.getTCProperties(propNameS); + boolean isOk = true; + for(int i = 0 ;i < 8;i++){ + if( propSS[i]==null){ + isOk = false; + } + } + if(!isOk){ + return; + } + if(propSS[0].getStringArrayValue().length ==propSS[1].getStringArrayValue().length + &&propSS[0].getStringArrayValue().length ==propSS[2].getStringArrayValue().length + &&propSS[0].getStringArrayValue().length ==propSS[3].getBoolArrayValue().length + &&propSS[0].getStringArrayValue().length ==propSS[4].getBoolArrayValue().length + &&propSS[0].getStringArrayValue().length ==propSS[5].getBoolArrayValue().length + &&propSS[0].getStringArrayValue().length ==propSS[6].getBoolArrayValue().length + &&propSS[0].getStringArrayValue().length ==propSS[7].getBoolArrayValue().length){ + System.out.println("Array length is ok !"); + }else{ + System.out.println("Array length is not ok !"); + return; + } + + for(int i = 0;i= totleLen) { + for (int i = 0; i < titleNames.length; i++) { + partsTable.getColumnModel().getColumn(i) + .setPreferredWidth(105); + } + partsTable.setAutoResizeMode(0); + + } else { + // System.out.println("auto size"); + partsTable.setAutoResizeMode(1); + } + + } + return partsTable; + } + + public DefaultTableModel getTableModel(DefaultTableModel dtm, + Object[] columNameObjects, Object[][] objects) { + // Object[] columNameObjects = this.titleNames; //// , + // Object[][] objects = getValues(this.valueLists); + if (dtm == null) { + dtm = new DefaultTableModel(objects, columNameObjects); + } + return dtm; + } + /*** + * ȡLOVʾֵʵֵ + * + * @param lovPropName + * @return + */ + public List getLov(String lovPropName) { + List beanList = new ArrayList<>(); + this.lovMap = new HashMap<>(); + TCComponentListOfValues lobList = TCComponentListOfValuesType + .findLOVByName(lovPropName); + try { + if (lobList != null) { + ListOfValuesInfo info = lobList.getListOfValues(); + String[] valuesList = info.getStringListOfValues(); + //LOVBean bean = new LOVBean("", ""); + //beanList.add(bean); + for (int w = 0; w < valuesList.length; w++) { + String disValue = info.getDisplayableValue(valuesList[w]); + lovMap.put(disValue,valuesList[w]); + System.out.println("Lov dis = "+valuesList[w]+" | "+disValue); + LOVBean bean1 = new LOVBean(disValue, valuesList[w]); + beanList.add(bean1); + } + } + } catch (Exception e) { + + } + return beanList; + + } + + public HX3_BZGX(TCComponent arg0) throws Exception { + super(arg0); + this.form = (TCComponentForm) arg0; + initUI(); + } + + @Override + public void loadRendering() throws TCException { + System.out.println("loadRendering............"); + } + + @Override + public void saveRendering() { + try { + setPropS(); + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + + + + @Override + public void initializeRenderingDisplay() { + // TODO Auto-generated method stub + System.out.println("initializeRenderingDisplay ..."); + super.initializeRenderingDisplay(); + } + + @Override + public IEditableSwingComp refreshPanel(JPanel arg0, TCComponent arg1) + throws Exception { + // TODO Auto-generated method stub + System.out.println("refreshPanel ..."); + return super.refreshPanel(arg0, arg1); + } + + @Override + public void setRefreshAfterSaveFlag(boolean arg0) { + // TODO Auto-generated method stub + System.out.println("setRefreshAfterSaveFlag ..."); + super.setRefreshAfterSaveFlag(arg0); + } + + @Override + public void updateRendering() { + // TODO Auto-generated method stub + System.out.println("updateRendering ..."); + super.updateRendering(); + } + + /** + * ¼ + */ + @Override + public void actionPerformed(ActionEvent arg0) { + Object sourceObj = arg0.getSource(); + int index = this.tabbedPane.getSelectedIndex(); + + String titleName = this.tabbedPane.getTitleAt(index); + JTable table = this.tableList.get(index); + + int selectIndex = table.getSelectedRow(); + + if(sourceObj.equals(this.addButton)){ + Object[] addRowObjS ={"","",titleName , false,false,false,false,false}; + ((DefaultTableModel)table.getModel()).addRow(addRowObjS); + }else if(sourceObj.equals(this.addUpButton)){ + if(selectIndex !=-1){ + + Object[] addRowObjS ={"","",titleName , false,false,false,false,false}; + ((DefaultTableModel)table.getModel()).insertRow(selectIndex, addRowObjS); + }else{ + MessageBox.post("ѡҪ","",MessageBox.WARNING); + } + }else if(sourceObj.equals(this.delButton)){ + if(selectIndex !=-1){ + ((DefaultTableModel)table.getModel()).removeRow(selectIndex); + } + } + + } + +} + +class MyComboBoxRenderer extends JComboBox implements TableCellRenderer { + public MyComboBoxRenderer(Object[] items) { + super(items); + } + + public Component getTableCellRendererComponent(JTable table, Object value, + boolean isSelected, boolean hasFocus, int row, int column) { + + if (isSelected) { + setForeground(table.getSelectionForeground()); + super.setBackground(table.getSelectionBackground()); + } else { + setForeground(table.getForeground()); + setBackground(table.getBackground()); + } + setSelectedItem(value); + return this; + } +} + +class MyComboBoxEditor extends DefaultCellEditor { + + public MyComboBoxEditor(Object[] items) { + super(new JComboBox(items)); + } +} \ No newline at end of file diff --git a/src/com/connor/jk/plm/form/HX3_GYLXRevisionFormPropBean.java b/src/com/connor/jk/plm/form/HX3_GYLXRevisionFormPropBean.java new file mode 100644 index 0000000..8305723 --- /dev/null +++ b/src/com/connor/jk/plm/form/HX3_GYLXRevisionFormPropBean.java @@ -0,0 +1,50 @@ +package com.connor.jk.plm.form; + +import java.util.Date; + +public class HX3_GYLXRevisionFormPropBean implements Comparable{ + + public static final int COUNT = 16; + public String hx3_gxhh = "";// "к", + public String hx3_bzgx = "";// "׼", + public String hx3_gxsm = "";// "˵", + public String hx3_gzzx = "";// "", + public String hx3_gzzxmc = "";// "",// 5 + public String hx3_mjbh = "";// "ģ߱", + public boolean hx3_dcgx1 = false;// "幤", + public boolean hx3_bgd1 = false;// "", + public boolean hx3_wwgx1 = false;// "ί⹤", + public boolean hx3_jfd1 = false;// "Ʒѵ",// 10 + public boolean hx3_jhwwgx1 = false;// "ƻί⹤", + public Date hx3_sxrq = new Date();// "Ч", + public Date hx3_shixrq = new Date();// "ʧЧ", + public String hx3_gywjbh = "";// "ļ", + public String hx3_gywjbb = "";// "ļ汾", // 15 + public String hx3_lywl = "";// "", + // public String hx3_lywlid = "";// "ID" // 17 + @Override + public int compareTo(Object o) { + // TODO Auto-generated method stub + if(o ==null){ + return 0; + } + HX3_GYLXRevisionFormPropBean bean = (HX3_GYLXRevisionFormPropBean) o; + if(this.hx3_gxhh == null){ + if(bean.hx3_gxhh!=null){ + //111 + return "".compareTo(bean.hx3_gxhh); + }else{ + return 0; + } + }else{ + if(bean.hx3_gxhh!=null){ + //111 + return this.hx3_gxhh.compareTo(bean.hx3_gxhh); + }else{ + return this.hx3_gxhh.compareTo(""); + } + //return this.hx3_gxhh.compareTo(bean.hx3_gxhh); + } + } + +} diff --git a/src/com/connor/jk/plm/form/HX3_GYLXRevisionFormStyleSheet.java b/src/com/connor/jk/plm/form/HX3_GYLXRevisionFormStyleSheet.java new file mode 100644 index 0000000..025e3d5 --- /dev/null +++ b/src/com/connor/jk/plm/form/HX3_GYLXRevisionFormStyleSheet.java @@ -0,0 +1,1235 @@ +package com.connor.jk.plm.form; +//package com.connor.hx3.plm.hxom012; +// +//import java.awt.BorderLayout; +//import java.awt.Color; +//import java.awt.Component; +//import java.awt.Font; +//import java.awt.Toolkit; +//import java.awt.datatransfer.StringSelection; +//import java.awt.event.ActionEvent; +//import java.awt.event.ActionListener; +//import java.awt.event.MouseEvent; +//import java.awt.event.MouseListener; +//import java.text.ParseException; +//import java.text.SimpleDateFormat; +//import java.util.ArrayList; +//import java.util.Collections; +//import java.util.Date; +//import java.util.HashMap; +//import java.util.List; +// +//import javax.swing.JButton; +//import javax.swing.JComponent; +//import javax.swing.JLabel; +//import javax.swing.JMenu; +//import javax.swing.JMenuItem; +//import javax.swing.JPanel; +//import javax.swing.JPopupMenu; +//import javax.swing.JScrollPane; +//import javax.swing.JTabbedPane; +//import javax.swing.JTable; +//import javax.swing.JTextArea; +//import javax.swing.ListSelectionModel; +//import javax.swing.event.MouseInputListener; +//import javax.swing.table.DefaultTableModel; +//import javax.swing.table.TableCellRenderer; +// +//import com.connor.hx3.plm.util.HxomMethodUtil; +//import com.teamcenter.rac.aif.kernel.AIFComponentContext; +//import com.teamcenter.rac.aifrcp.AIFUtility; +//import com.teamcenter.rac.kernel.TCComponent; +//import com.teamcenter.rac.kernel.TCComponentBOMLine; +//import com.teamcenter.rac.kernel.TCComponentForm; +//import com.teamcenter.rac.kernel.TCComponentItem; +//import com.teamcenter.rac.kernel.TCComponentItemRevision; +//import com.teamcenter.rac.kernel.TCComponentType; +//import com.teamcenter.rac.kernel.TCException; +//import com.teamcenter.rac.kernel.TCProperty; +//import com.teamcenter.rac.kernel.TCSession; +//import com.teamcenter.rac.stylesheet.AbstractRendering; +//import com.teamcenter.rac.util.ButtonLayout; +//import com.teamcenter.rac.util.MessageBox; +// +//public class HX3_GYLXRevisionFormStyleSheet extends AbstractRendering implements +// ActionListener { +// private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); +// private final String HX_BZGX_Option_Name = "HX_BZGX_Option_Name"; +// private String titleName ; +// +// private JPanel rootPanel; +// private JPanel topPanel; +// private JPanel buttomPanel; +// private JScrollPane scrollPanel; +// private JLabel emptyLable; +// private JButton addButton; +// private JButton insertButton; +// private JButton delButton; +// +// private JTable partsTable; +// public boolean isRefresh; +// public boolean over; +// private List valueLists; +// private HashMap> bzgxMap;//׼ +// private DefaultTableModel dtm; +// private TCComponent formComp; +// +// private TCProperty[] propertiesArray; +// private BomStructTree bomJTree; +// private BomStructBean firstBean; +// private HX3_GYLXRevisionFormPropBean selectTableBean; +// private BOM bomMsg; +// +// private String[] BZGX_LIST = { // +// "hx3_gzbz", // ׼ +// "hx3_gxsm",// ˵ +// "hx3_gzzx",// , +// "hx3_dcgx1",// 幤 bool +// "hx3_bgd1",// bool +// "hx3_wwgx1",// ί⹤ bool +// "hx3_jfd1",// Ʒѵ bool +// "hx3_jhwwgx1"// ƻί⹤ bool +// }; +// private Object[] titleNames = { // +// "к", "׼", "˵", "", "",// 5 +// "ģ߱", "幤", "", "ί⹤", "Ʒѵ",// 10 +// "ƻί⹤", "Ч", "ʧЧ", "ļ", "ļ汾", // 15 +// "" // 17 +// }; +// public static final String[] TM2_PROCESS_PROP_NAMES = {// +// "hx3_gxhh", "hx3_gxbz", "hx3_gxsm", "hx3_gzzx", +// "hx3_gzzxmc", // 5 +// "hx3_mjbh", "hx3_dcgx1", "hx3_bgd1", "hx3_wwgx1", +// "hx3_jfd1", // 10 +// "hx3_jhwwgx1", "hx3_sxrq", "hx3_shixrq", "hx3_gywjbh", +// "hx3_gywjbb",// 15 +// "hx3_lywl"// 17 +// }; +// +// // =========================== +// +// public HX3_GYLXRevisionFormStyleSheet(TCComponent arg0) throws Exception { +// super(arg0); +// this.formComp = arg0; +// getTitle(); +// this.isRefresh = false; +// this.over = false; +// loadRendering(); +// if (firstBean == null) { +// getFormMsg(); +// bomJTree = new BomStructTree(firstBean, this); +// } +// new Thread() { +// +// @Override +// public void run() { +// // TODO Auto-generated method stub +// // super.run(); +// while (!over) { +// try { +// new Thread().sleep(1000); +// if (selectTableBean != null) { +// +// int index = valueLists.indexOf(selectTableBean); +// +// if(index !=-1){ +// ((DefaultTableModel) partsTable.getModel()) +// .setValueAt(selectTableBean.hx3_lywl, +// index, 15); +// } +// +// } +// } catch (InterruptedException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// }catch(Exception e){ +// e.printStackTrace(); +// } +// } +// } +// +// }.start(); +// } +// +// public void getTitle(){ +// try { +// TCComponentItemRevision tempRev = (TCComponentItemRevision) formComp +// .getReferenceProperty("item_revision"); +// if(tempRev == null){ +// return; +// } +// TCComponentItem item = tempRev.getItem(); +// if(item == null){ +// return; +// } +// AIFComponentContext[] contextS = item.whereReferencedByTypeRelation(new String[]{"HX3_WLRevision"},new String[]{ "HX3_GYLXRelation"}); +// System.out.println("count = "+contextS.length); +// if(contextS!=null && contextS.length>0){ +// titleName =((TCComponentItemRevision) contextS[0].getComponent()).getStringProperty("object_string")+"·ͼ"; +// } +// } catch (TCException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } +// +// } +// +// public void getBZGXList() { +// try { +// bzgxMap = new HashMap<>(); +// String puid = HxomMethodUtil.getPrefStr(HX_BZGX_Option_Name); +// TCSession session = (TCSession) AIFUtility.getCurrentApplication() +// .getSession(); +// +// TCComponentForm form = (TCComponentForm) session +// .stringToComponent(puid); +// TCProperty[] propS = form.getTCProperties(BZGX_LIST); +// if (propS != null) { +// if (propS[0] != null && propS[1] != null && propS[2] != null +// && propS[3] != null && propS[4] != null +// && propS[5] != null && propS[6] != null +// && propS[7] != null) { +// if (propS[0].getStringArrayValue().length == propS[1] +// .getStringArrayValue().length +// && propS[0].getStringArrayValue().length == propS[2] +// .getStringArrayValue().length +// && propS[0].getStringArrayValue().length == propS[3] +// .getLogicalValueArray().length +// && propS[0].getStringArrayValue().length == propS[4] +// .getLogicalValueArray().length +// && propS[0].getStringArrayValue().length == propS[5] +// .getLogicalValueArray().length +// && propS[0].getStringArrayValue().length == propS[6] +// .getLogicalValueArray().length +// && propS[0].getStringArrayValue().length == propS[7] +// .getLogicalValueArray().length) { +// for (int i = 0; i < propS[0].getStringArrayValue().length; i++) { +// BZGXBean bean = new BZGXBean(); +// bean.hx3_gxbz = propS[0].getStringArrayValue()[i]; // ׼ +// bean.hx3_gxsm = propS[1].getStringArrayValue()[i];// ˵ +// bean.hx3_gzzx = propS[2].getStringArrayValue()[i];// , +// bean.hx3_gzzxmc = propS[2].getDisplayableValues() +// .get(i);// +// bean.hx3_dcgx1 = propS[3].getLogicalValueArray()[i];// 幤 +// bean.hx3_bgd1 = propS[4].getLogicalValueArray()[i];// +// bean.hx3_wwgx1 = propS[5].getLogicalValueArray()[i];// ί⹤ +// bean.hx3_jfd1 = propS[6].getLogicalValueArray()[i];// Ʒѵ +// bean.hx3_jhwwgx1 = propS[7].getLogicalValueArray()[i];// ƻί⹤ +// if (!bzgxMap.containsKey(bean.hx3_gxbz)) { +// System.out.println("׼ =>" + bean.hx3_gxbz); +// List bzgxBeanList = new ArrayList<>(); +// bzgxBeanList.add(bean); +// bzgxMap.put(bean.hx3_gxsm, bzgxBeanList); +// }else{ +// List bzgxBeanList = bzgxMap.get(bean.hx3_gxbz); +// bzgxBeanList.add(bean); +// } +// } +// +// } else { +// System.out.println("׼ijȲͬ"); +// } +// +// } else { +// System.out.println("ȡ׼ִ"); +// } +// +// } +// +// } catch (TCException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } +// +// } +// +// /** +// * ͨFormϹϢ +// * +// * @throws TCException +// */ +// public void getFormMsg() throws TCException { +// getBZGXList(); +// TCComponentItemRevision rev = (TCComponentItemRevision) formComp +// .getReferenceProperty("item_revision");// ȡڵİ汾 +// if (rev == null) { +// System.out.println("ûҵ汾"); +// return; +// } +// TCComponentItem item = rev.getItem(); +// if (item == null) { +// System.out.println("ûҵ"); +// return; +// } +// AIFComponentContext[] aifContext = item.whereReferencedByTypeRelation( +// new String[] { "HX3_WLRevision" }, +// new String[] { "HX3_GYLXRelation" }); +// if (aifContext == null || aifContext.length == 0 +// || aifContext.length > 1) { +// System.out.println("ǰ·߹˶ϰ汾"); +// } +// firstBean = new BomStructBean(); +// TCComponentBOMLine topLine = null; +// if(aifContext != null && aifContext.length>0){ +// TCComponentItemRevision wlRev = ((TCComponentItemRevision) aifContext[0] +// .getComponent()); +// bomMsg = HxomMethodUtil.getTopLineByRev2(wlRev); +// topLine = bomMsg.line; +// } +// if (topLine == null) { +// System.out.println("ǰûBOMϢ"); +// return; +// +// } +// exchangeLineToBean(firstBean, topLine); +// +// } +// +// /** +// * FORMʱȡ +// */ +// public void getFormVlue() { +// +// this.valueLists = new ArrayList<>(); +// try { +// +// // ȡֵ +// propertiesArray = formComp.getTCProperties(TM2_PROCESS_PROP_NAMES); +// // дֵԵ +// if (propertiesArray != null) { +// String[] valueStrs0 = propertiesArray[0] == null ? new String[0] +// : propertiesArray[0].getStringArrayValue(); +// String[] valueStrs1 = propertiesArray[1] == null ? new String[0] +// : propertiesArray[1].getStringArrayValue(); +// String[] valueStrs2 = propertiesArray[2] == null ? new String[0] +// : propertiesArray[2].getStringArrayValue(); +// String[] valueStrs3 = propertiesArray[3] == null ? new String[0] +// : propertiesArray[3].getStringArrayValue(); +// String[] valueStrs4 = propertiesArray[4] == null ? new String[0] +// : propertiesArray[4].getStringArrayValue(); +// String[] valueStrs5 = propertiesArray[5] == null ? new String[0] +// : propertiesArray[5].getStringArrayValue(); +// boolean[] valueStrs6 = propertiesArray[6] == null ? new boolean[0] +// : propertiesArray[6].getBoolArrayValue(); +// boolean[] valueStrs7 = propertiesArray[7] == null ? new boolean[0] +// : propertiesArray[7].getBoolArrayValue(); +// boolean[] valueStrs8 = propertiesArray[8] == null ? new boolean[0] +// : propertiesArray[8].getBoolArrayValue(); +// boolean[] valueStrs9 = propertiesArray[9] == null ? new boolean[0] +// : propertiesArray[9].getBoolArrayValue(); +// boolean[] valueStrs10 = propertiesArray[10] == null ? new boolean[0] +// : propertiesArray[10].getBoolArrayValue(); +// Date[] valueStrs11 = propertiesArray[11] == null ? new Date[0] +// : propertiesArray[11].getDateValueArray();// Date +// Date[] valueStrs12 = propertiesArray[12] == null ? new Date[0] +// : propertiesArray[12].getDateValueArray();// Date +// String[] valueStrs13 = propertiesArray[13] == null ? new String[0] +// : propertiesArray[13].getStringArrayValue(); +// String[] valueStrs14 = propertiesArray[14] == null ? new String[0] +// : propertiesArray[14].getStringArrayValue(); +// String[] valueStrs15 = propertiesArray[15] == null ? new String[0] +// : propertiesArray[15].getStringArrayValue();// TypedReference +// +// if (valueStrs0.length == valueStrs1.length +// && valueStrs0.length == valueStrs2.length +// && valueStrs0.length == valueStrs3.length +// && valueStrs0.length == valueStrs4.length +// && valueStrs0.length == valueStrs5.length +// && valueStrs0.length == valueStrs6.length +// && valueStrs0.length == valueStrs7.length +// && valueStrs0.length == valueStrs8.length +// && valueStrs0.length == valueStrs9.length +// && valueStrs0.length == valueStrs10.length +// && valueStrs0.length == valueStrs11.length +// && valueStrs0.length == valueStrs12.length +// && valueStrs0.length == valueStrs13.length +// && valueStrs0.length == valueStrs14.length +// && valueStrs0.length == valueStrs15.length +// +// && valueStrs0.length != 0) { +// for (int i = 0; i < valueStrs0.length; i++) { +// HX3_GYLXRevisionFormPropBean bean = new HX3_GYLXRevisionFormPropBean(); +// bean.hx3_gxhh = valueStrs0[i];// "к", +// +// bean.hx3_bzgx = valueStrs1[i];// "׼", +// bean.hx3_gxsm = valueStrs2[i];// "˵", +// bean.hx3_gzzx = valueStrs3[i];// "", +// bean.hx3_gzzxmc = valueStrs4[i];// "",// 5 +// bean.hx3_mjbh = valueStrs5[i];// "ģ߱", +// bean.hx3_dcgx1 = valueStrs6[i];// "幤", +// bean.hx3_bgd1 = valueStrs7[i];// "", +// bean.hx3_wwgx1 = valueStrs8[i];// "ί⹤", +// bean.hx3_jfd1 = valueStrs9[i];// "Ʒѵ",// 10 +// bean.hx3_jhwwgx1 = valueStrs10[i];// "ƻί⹤", +// +// bean.hx3_sxrq = valueStrs11[i];// "Ч", +// bean.hx3_shixrq = valueStrs12[i];// "ʧЧ", +// bean.hx3_gywjbh = valueStrs13[i];// "ļ", +// bean.hx3_gywjbb = valueStrs14[i];// "ļ汾", // 15 +// bean.hx3_lywl = valueStrs15[i];// "", +// +// this.valueLists.add(bean); +// +// +// } +// } +// } +// Collections.sort(this.valueLists); +// } catch (TCException e) { +// e.printStackTrace(); +// } +// +// } +// +// /** +// * +// */ +// public void saveWLProps() { +// if (valueLists == null) { +// System.out.println("бΪ"); +// return; +// } +// Collections.sort(this.valueLists); +// // List gxbbList = new ArrayList<>(); +// // for (int i = 0; i < valueLists.size(); i++) { +// // HX3_GYLXRevisionFormPropBean bean = valueLists.get(i); +// // +// // } +// try { +// HxomMethodUtil.setByPass(true); +// } catch (TCException e2) { +// // TODO Auto-generated catch block +// e2.printStackTrace(); +// } +// String[] valueStrs0 = new String[valueLists.size()]; +// String[] valueStrs1 = new String[valueLists.size()]; +// String[] valueStrs2 = new String[valueLists.size()]; +// String[] valueStrs3 = new String[valueLists.size()]; +// String[] valueStrs4 = new String[valueLists.size()]; +// String[] valueStrs5 = new String[valueLists.size()]; +// +// boolean[] valueStrs6 = new boolean[valueLists.size()]; +// boolean[] valueStrs7 = new boolean[valueLists.size()]; +// boolean[] valueStrs8 = new boolean[valueLists.size()]; +// boolean[] valueStrs9 = new boolean[valueLists.size()]; +// boolean[] valueStrs10 = new boolean[valueLists.size()]; +// Date[] valueStrs11 = new Date[valueLists.size()]; +// Date[] valueStrs12 = new Date[valueLists.size()]; +// String[] valueStrs13 = new String[valueLists.size()]; +// String[] valueStrs14 = new String[valueLists.size()]; +// String[] valueStrs15 = new String[valueLists.size()]; +// +// for (int i = 0; i < valueLists.size(); i++) { +// HX3_GYLXRevisionFormPropBean bean = valueLists.get(i); +// valueStrs0[i] = bean.hx3_gxhh == null ? "" : bean.hx3_gxhh; +// valueStrs1[i] = bean.hx3_bzgx == null ? "" : bean.hx3_bzgx; +// valueStrs2[i] = bean.hx3_gxsm == null ? "" : bean.hx3_gxsm; +// valueStrs3[i] = bean.hx3_gzzx == null ? "" : bean.hx3_gzzx; +// valueStrs4[i] = bean.hx3_gzzxmc == null ? "" : bean.hx3_gzzxmc; +// valueStrs5[i] = bean.hx3_mjbh == null ? "" : bean.hx3_mjbh; +// valueStrs6[i] = bean.hx3_dcgx1; +// valueStrs7[i] = bean.hx3_bgd1; +// valueStrs8[i] = bean.hx3_wwgx1; +// valueStrs9[i] = bean.hx3_jfd1; +// valueStrs10[i] = bean.hx3_jhwwgx1; +// valueStrs11[i] = bean.hx3_sxrq; +// valueStrs12[i] = bean.hx3_shixrq; +// valueStrs13[i] = bean.hx3_gywjbh == null ? "" : bean.hx3_gywjbh; +// valueStrs14[i] = bean.hx3_gywjbb == null ? "" : bean.hx3_gywjbb; +// valueStrs15[i] = bean.hx3_lywl == null ? "" : bean.hx3_lywl; +// } +// try { +// if (propertiesArray[0] != null) +// propertiesArray[0].setStringValueArray(valueStrs0); +// if (propertiesArray[1] != null) +// propertiesArray[1].setStringValueArray(valueStrs1); +// if (propertiesArray[2] != null) +// propertiesArray[2].setStringValueArray(valueStrs2); +// if (propertiesArray[3] != null) +// propertiesArray[3].setStringValueArray(valueStrs3); +// if (propertiesArray[4] != null) +// propertiesArray[4].setStringValueArray(valueStrs4); +// if (propertiesArray[5] != null) +// propertiesArray[5].setStringValueArray(valueStrs5); +// if (propertiesArray[6] != null) +// propertiesArray[6].setLogicalValueArray(valueStrs6); +// if (propertiesArray[7] != null) +// propertiesArray[7].setLogicalValueArray(valueStrs7); +// if (propertiesArray[8] != null) +// propertiesArray[8].setLogicalValueArray(valueStrs8); +// if (propertiesArray[9] != null) +// propertiesArray[9].setLogicalValueArray(valueStrs9); +// if (propertiesArray[10] != null) +// propertiesArray[10].setLogicalValueArray(valueStrs10); +// if (propertiesArray[11] != null) +// propertiesArray[11].setDateValueArray(valueStrs11); +// if (propertiesArray[12] != null) +// propertiesArray[12].setDateValueArray(valueStrs12); +// if (propertiesArray[13] != null) +// propertiesArray[13].setStringValueArray(valueStrs13); +// if (propertiesArray[14] != null) +// propertiesArray[14].setStringValueArray(valueStrs14); +// if (propertiesArray[15] != null) +// propertiesArray[15].setStringValueArray(valueStrs15); +// +// formComp.setTCProperties(propertiesArray); +// +// List lineList = new ArrayList<>(); +// List propList = new ArrayList<>(); +// +// if (this.firstBean != null) { +// +// if (this.firstBean.getChlidLineS() != null) { +// +// for (BomStructBean structBean : this.firstBean +// .getChlidLineS()) { +// setBomlineProp(structBean, lineList, propList); +// } +// } +// +// TCProperty[][] props = new TCProperty[propList.size()][1]; +// +// for (int j = 0; j < propList.size(); j++) { +// props[j][0] = propList.get(j); +// } +// +// if (bomMsg.window != null) { +// bomMsg.window.lock(); +// TCComponentType.setPropertiesSet( +// lineList.toArray(new TCComponent[lineList.size()]), +// props); +// bomMsg.window.save(); +// bomMsg.window.unlock(); +// bomMsg.window.close(); +// +// } +// +// } +// +// } catch (TCException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } catch (Exception e1) { +// e1.printStackTrace(); +// } +// try { +// HxomMethodUtil.setByPass(false); +// } catch (TCException e2) { +// // TODO Auto-generated catch block +// e2.printStackTrace(); +// } +// } +// +// /** +// * +// * @param bean +// * @throws TCException +// */ +// public void setBomlineProp(BomStructBean bean, List lineList, +// List propList) throws TCException { +// +// if (bean == null) { +// return; +// } +// lineList.add(bean.getBomLine()); +// TCProperty prop = bean.getBomLine().getTCProperty("HX3_gxhh"); +// prop.setStringValue(bean.getGxh()); +// // bean.getBomLine().lock(); +// // bean.getBomLine().setTCProperty(prop); +// // bean.getBomLine().save(); +// // bean.getBomLine().unlock(); +// propList.add(prop); +// +// if (bean.getChlidLineS() != null && bean.getChlidLineS().size() > 0) { +// for (BomStructBean child : bean.getChlidLineS()) { +// setBomlineProp(child, lineList, propList); +// } +// } +// +// } +// +// /** +// * ǩ벢 +// */ +// @Override +// public boolean checkForSave(Object obj) { +// // TODO Auto-generated method stub +// over = true; +// saveWLProps(); +// +// System.out.println("ǩ벢"); +// return super.checkForSave(obj); +// } +// +// /** +// * +// */ +// @Override +// public void save() { +// // TODO Auto-generated method stub +// over = true; +// saveWLProps(); +// +// System.out.println(""); +// super.save(); +// } +// +// public void init() { +// System.out.println("====>>>> ʼ <1>"); +// // clorMap = new HashMap(); +// // fontMap = new HashMap(); +// valueLists = new ArrayList(); +// getFormVlue(); +// this.setLayout(new BorderLayout()); +// this.setBackground(Color.WHITE); +// rootPanel = new JPanel(new BorderLayout()); +// addButton = new JButton(""); +// +// addButton.setEnabled(true); +// insertButton = new JButton(""); +// insertButton.setEnabled(true); +// delButton = new JButton("ɾ"); +// delButton.setEnabled(true); +// emptyLable = new JLabel(" "); +// +// addButton.addActionListener(new ActionListener() { +// @Override +// public void actionPerformed(ActionEvent e) { +// addRow(e); +// } +// }); +// +// insertButton.addActionListener(new ActionListener() { +// @Override +// public void actionPerformed(ActionEvent e) { +// insertRow(e); +// } +// }); +// +// delButton.addActionListener(new ActionListener() { +// @Override +// public void actionPerformed(ActionEvent e) { +// delRow(e); +// } +// }); +// // TODO Table +// this.partsTable = getjTable(partsTable, this.dtm, this.titleNames, +// getValues(valueLists)); +// final MouseInputListener mouseInputListener = getMouseInputListener(partsTable);// Ҽѡ +// +// partsTable.addMouseListener(mouseInputListener); +// +// this.topPanel = new JPanel(new BorderLayout()); +// scrollPanel = new JScrollPane(); +// scrollPanel.getViewport().add(partsTable, null); +// scrollPanel.validate(); +// +// this.topPanel.add(BorderLayout.CENTER, scrollPanel); +// +// this.buttomPanel = new JPanel(new ButtonLayout(ButtonLayout.VERTICAL)); +// this.buttomPanel.add(addButton); +// this.buttomPanel.add(new JLabel(" ")); +// this.buttomPanel.add(insertButton); +// this.buttomPanel.add(emptyLable); +// this.buttomPanel.add(delButton); +// +// this.rootPanel = new JPanel(new BorderLayout()); +// this.rootPanel.add(BorderLayout.CENTER, topPanel); +// // this.rootPanel.add(BorderLayout.SOUTH, buttomPanel); +// +// JTabbedPane tabPane = new JTabbedPane(); +// +// +// String title = "·Ϣ"; +// if(titleName!=null) +// { +// title = titleName; +// } +// tabPane.add(title, new JScrollPane(rootPanel)); +// +// this.setLayout(new BorderLayout()); +// this.add(buttomPanel, BorderLayout.EAST); +// this.add(tabPane, BorderLayout.CENTER); +// } +// +// private void addRow(ActionEvent e) { +// +// HX3_GYLXRevisionFormPropBean bean = new HX3_GYLXRevisionFormPropBean(); +// try { +// bean.hx3_sxrq = sdf.parse("2000-01-01"); +// bean.hx3_shixrq = sdf.parse("2099-12-31"); +// } catch (ParseException e1) { +// // TODO Auto-generated catch block +// e1.printStackTrace(); +// } +// +// Object[] objs = new Object[] { bean.hx3_gxhh, bean.hx3_bzgx, +// bean.hx3_gxsm, bean.hx3_gzzx, bean.hx3_gzzxmc, bean.hx3_mjbh, +// bean.hx3_dcgx1, bean.hx3_bgd1, bean.hx3_wwgx1, bean.hx3_jfd1, +// bean.hx3_jhwwgx1, sdf.format(bean.hx3_sxrq), +// sdf.format(bean.hx3_shixrq), bean.hx3_gywjbh, bean.hx3_gywjbb, +// bean.hx3_lywl }; +// +// valueLists.add(bean); +// ((DefaultTableModel) this.partsTable.getModel()).addRow(objs); +// +// ((DefaultTableModel) this.partsTable.getModel()) +// .fireTableStructureChanged(); +// ((DefaultTableModel) this.partsTable.getModel()).fireTableDataChanged(); +// scrollPanel.validate(); +// +// } +// +// private void insertRow(ActionEvent e) { +// int index = partsTable.getSelectedRow(); +// if (partsTable.getRowCount() == 0) { +// index = 0; +// } +// // if (index == -1) { +// // MessageBox.post("ѡִɾ", "Warning", MessageBox.WARNING); +// // return; +// // } +// HX3_GYLXRevisionFormPropBean bean = new HX3_GYLXRevisionFormPropBean(); +// try { +// bean.hx3_sxrq = sdf.parse("2000-01-01"); +// bean.hx3_shixrq = sdf.parse("2099-12-31"); +// } catch (ParseException e1) { +// // TODO Auto-generated catch block +// e1.printStackTrace(); +// } +// +// Object[] objs = new Object[] { bean.hx3_gxhh, bean.hx3_bzgx, +// bean.hx3_gxsm, bean.hx3_gzzx, bean.hx3_gzzxmc, bean.hx3_mjbh, +// bean.hx3_dcgx1, bean.hx3_bgd1, bean.hx3_wwgx1, bean.hx3_jfd1, +// bean.hx3_jhwwgx1, sdf.format(bean.hx3_sxrq), +// sdf.format(bean.hx3_shixrq), bean.hx3_gywjbh, bean.hx3_gywjbb, +// bean.hx3_lywl }; +// if (index != -1) { +// valueLists.add(index, bean); +// ((DefaultTableModel) this.partsTable.getModel()).insertRow(index, +// objs); +// } else { +// valueLists.add(bean); +// ((DefaultTableModel) this.partsTable.getModel()).addRow(objs); +// } +// +// ((DefaultTableModel) this.partsTable.getModel()) +// .fireTableStructureChanged(); +// ((DefaultTableModel) this.partsTable.getModel()).fireTableDataChanged(); +// scrollPanel.validate(); +// } +// +// private void delRow(ActionEvent e) { +// int index = partsTable.getSelectedRow(); +// if (index == -1) { +// MessageBox.post("ѡִɾ", "", MessageBox.WARNING); +// return; +// } +// if(valueLists.get(index).hx3_lywl!=null){ +// if(!valueLists.get(index).hx3_lywl.trim().isEmpty()){ +// MessageBox.post("ƳϺִɾ", "", MessageBox.WARNING); +// return; +// } +// } +// valueLists.remove(index); +// ((DefaultTableModel) this.partsTable.getModel()).removeRow(index); +// ((DefaultTableModel) this.partsTable.getModel()) +// .fireTableStructureChanged(); +// ((DefaultTableModel) this.partsTable.getModel()).fireTableDataChanged(); +// scrollPanel.validate(); +// } +// +// /***************************************************/ +// +// /** +// * JTABLEͨ÷ +// * +// * @param partsTable +// * @param titleNames +// * @return +// */ +// public JTable getjTable(JTable partsTable, DefaultTableModel dtm, +// Object[] titleNames, Object[][] values) { +// int simpleLen = 72; +// int totleLen = 900; +// if (partsTable == null) { +// //partsTable.isCellEditable(arg0, arg1) +// +// partsTable = new JTable(getTableModel(dtm, titleNames, values)) { +// @Override +// public boolean isCellEditable(int row, int column) { +// +// if (column == 15|| column == 1|| (column >2 && column < 5) +// || (column > 5 && column < 13)){ +// return false; +// }else if(column == 0){ +// if(valueLists.get(row).hx3_lywl ==null || valueLists.get(row).hx3_lywl.trim().isEmpty()){ +// return true; +// } +// return false; +// } +// else{ +// +// +// +// return true; +// } +// } +// +// }; +// +// partsTable.setDefaultRenderer(Object.class, +// new TableCellTextAreaRenderer()); +// +// partsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); +// +// if (simpleLen * titleNames.length >= totleLen) { +// for (int i = 0; i < titleNames.length; i++) { +// partsTable.getColumnModel().getColumn(i) +// .setPreferredWidth(72); +// } +// partsTable.setAutoResizeMode(0); +// +// } else { +// // System.out.println("auto size"); +// partsTable.setAutoResizeMode(1); +// } +// +// } +// return partsTable; +// } +// +// public DefaultTableModel getTableModel(DefaultTableModel dtm, +// Object[] columNameObjects, Object[][] objects) { +// // Object[] columNameObjects = this.titleNames; //// , +// // Object[][] objects = getValues(this.valueLists); +// if (dtm == null) { +// dtm = new DefaultTableModel(objects, columNameObjects); +// } +// return dtm; +// } +// +// public Object[][] getValues(List beanList) { +// Object[][] objects = new Object[beanList.size()][HX3_GYLXRevisionFormPropBean.COUNT]; +// +// for (int i = 0; i < beanList.size(); i++) { +// // objects[i][0] =beanList.get(i).getIndex(); +// objects[i][0] = beanList.get(i).hx3_gxhh;// "к", +// +// objects[i][1] = beanList.get(i).hx3_bzgx;// "׼", +// objects[i][2] = beanList.get(i).hx3_gxsm;// "˵", +// objects[i][3] = beanList.get(i).hx3_gzzx;// "", +// objects[i][4] = beanList.get(i).hx3_gzzxmc;// "",// 5 +// objects[i][5] = beanList.get(i).hx3_mjbh;// "ģ߱", +// objects[i][6] = beanList.get(i).hx3_dcgx1;// "幤", +// objects[i][7] = beanList.get(i).hx3_bgd1;// "", +// objects[i][8] = beanList.get(i).hx3_wwgx1;// "ί⹤", +// objects[i][9] = beanList.get(i).hx3_jfd1;// "Ʒѵ",// 10 +// objects[i][10] = beanList.get(i).hx3_jhwwgx1;// "ƻί⹤", +// objects[i][11] = sdf.format(beanList.get(i).hx3_sxrq);// "Ч", +// objects[i][12] = sdf.format(beanList.get(i).hx3_shixrq);// "ʧЧ", +// objects[i][13] = beanList.get(i).hx3_gywjbh;// "ļ", +// objects[i][14] = beanList.get(i).hx3_gywjbb;// "ļ汾", // 15 +// objects[i][15] = beanList.get(i).hx3_lywl;// "", +// // objects[i][16] = beanList.get(i).hx3_lywlid; +// } +// return objects; +// } +// +// public void setClipboard(String str) { +// StringSelection ss = new StringSelection(str); +// Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null); +// } +// +// /**************************************************/ +// @Override +// public void actionPerformed(ActionEvent e) { +// // TODO Auto-generated method stub +// +// } +// +// @Override +// public void loadRendering() throws TCException { +// // TODO Auto-generated method stub +// init(); +// } +// +// @Override +// public void saveRendering() { +// // TODO Auto-generated method stub +// +// } +// +// public static void main(String[] args) { +// +// } +// +// /** +// * BOM +// * +// * @param bean +// * @param line +// * @throws TCException +// */ +// public void exchangeLineToBean(BomStructBean bean, TCComponentBOMLine line) +// throws TCException { +// if (line == null && bean != null) { +// return; +// } +// bean.setBomLine(line); +// List childBeanList = new ArrayList<>(); +// +// AIFComponentContext[] contextS = line.getChildren(); +// if (contextS != null) { +// for (AIFComponentContext context : contextS) { +// BomStructBean childBean = new BomStructBean(); +// TCComponentBOMLine childLine = (TCComponentBOMLine) context +// .getComponent(); +// // childBean.setBomLine(childLine); +// childBeanList.add(childBean); +// exchangeLineToBean(childBean, childLine); +// } +// } +// bean.setChlidLineS(childBeanList); +// +// } +// +// /** +// * +// * ҼѡʾҼ˵ +// */ +// private MouseInputListener getMouseInputListener(final JComponent jTable) { +// return new MouseInputListener() { +// public void mouseClicked(MouseEvent e) { +// processEvent(e); +// System.out.println(" =>>>> mouseClicked"); +// } +// +// public void mousePressed(MouseEvent e) { +// processEvent(e); +// System.out.println(" =>>>> mousePressed"); +// } +// +// public void mouseReleased(MouseEvent e) { +// processEvent(e); +// System.out.println(" =>>> mouseReleased"); +// System.out +// .println(" jTable.isEnabled() =" + jTable.isEnabled()); +// if (!jTable.isEnabled()) { +// System.out.println("ؼʹ"); +// return; +// } +// if ((e.getModifiers() & MouseEvent.BUTTON3_MASK) != 0 +// && !e.isControlDown() && !e.isShiftDown()) { +// // popupMenu.show(tableLyz, e.getX(), e.getY());//Ҽ˵ʾ +// JMenu a = new JMenu(""); +// JMenuItem c = new JMenuItem(""); +// c.addMouseListener(new MouseListener() { +// @Override +// public void mouseReleased(MouseEvent arg0) { +// +// } +// +// @Override +// public void mousePressed(MouseEvent arg0) { +// System.out.println("++++++++++++++"); +// // new Thread(bomJTree).start(); +// selectTableBean = valueLists.get(((JTable) jTable) +// .getSelectedRow()); +// if (selectTableBean.hx3_gxhh == null +// || selectTableBean.hx3_gxhh.trim() +// .isEmpty()) { +// MessageBox.post("кΪգдк֮", "", +// MessageBox.WARNING); +// } else { +// bomJTree.showDialog(valueLists +// .get(((JTable) jTable).getSelectedRow())); +// } +// +// } +// +// @Override +// public void mouseExited(MouseEvent arg0) { +// // TODO Auto-generated method stub +// // System.out.println("3333333333"); +// } +// +// @Override +// public void mouseEntered(MouseEvent arg0) { +// // TODO Auto-generated method stub +// // System.out.println("2222222222"); +// } +// +// @Override +// public void mouseClicked(MouseEvent arg0) { +// // TODO Auto-generated method stub +// // System.out.println("1111111111"); +// } +// }); +// //JMenuItem d = new JMenuItem("Ƴ"); +// +// a.add(c); +// //a.add(d); +// JPopupMenu b = new JPopupMenu(); +// b = a.getPopupMenu(); +// b.show(jTable, e.getX(), e.getY()); +// +// } +// +// } +// +// public void mouseEntered(MouseEvent e) { +// +// processEvent(e); +// +// } +// +// public void mouseExited(MouseEvent e) { +// +// processEvent(e); +// +// } +// +// public void mouseDragged(MouseEvent e) { +// +// processEvent(e); +// +// } +// +// public void mouseMoved(MouseEvent e) { +// +// processEvent(e); +// +// } +// +// private void processEvent(MouseEvent e) { +// +// if ((e.getModifiers() & MouseEvent.BUTTON3_MASK) != 0) { +// +// int modifiers = e.getModifiers(); +// +// modifiers -= MouseEvent.BUTTON3_MASK; +// +// modifiers |= MouseEvent.BUTTON1_MASK; +// +// MouseEvent ne = new MouseEvent(e.getComponent(), e.getID(), +// +// e.getWhen(), modifiers, e.getX(), e.getY(), e +// +// .getClickCount(), false); +// +// jTable.dispatchEvent(ne); +// } +// } +// }; +// } +// +// class TableCellTextAreaRenderer extends JTextArea implements +// TableCellRenderer { +// private BZGXBean bean = null; +// +// public TableCellTextAreaRenderer() { +// setLineWrap(true); +// setWrapStyleWord(true); +// } +// +// public Component getTableCellRendererComponent(JTable table, +// Object value, boolean isSelected, boolean hasFocus, int row, +// int column) { +// +// // 㵱еѸ߶ +// int maxPreferredHeight = 0; +// for (int i = 0; i < table.getColumnCount(); i++) { +// setText("" + table.getValueAt(row, i)); +// setSize(table.getColumnModel().getColumn(column).getWidth(), 0); +// maxPreferredHeight = Math.max(maxPreferredHeight, +// getPreferredSize().height); +// } +// +// if (table.getRowHeight(row) != maxPreferredHeight) // Ϲæ +// table.setRowHeight(row, maxPreferredHeight); +// +// setText(value == null ? "" : value.toString()); +// // table.setSelectionBackground(Color.yellow); +// Font fp = new Font("Menu.font", Font.PLAIN, 14); +// Font fb = new Font("Menu.font", Font.BOLD, 14); +// if (isSelected) { +// this.setFont(fb); +// +// } else { +// this.setFont(fp); +// } +// +// if (isSelected +// && hasFocus +// && row == table.getSelectedRow() +// && column == table.getSelectedColumn() +// && !((column ==1)||(column > 2 && column < 5) || (column > 5 && column < 11))) { +// +// bean = null; +// System.out.println(" => " + table.getValueAt(row, 2)); +// if (bzgxMap.containsKey(table.getValueAt(row, 2))) { +// bean = bzgxMap.get(table.getValueAt(row, 2)).get(0); +// +// System.out.println("contains "); +// } else { +// System.out.println("not contains "); +// } +// switch (column) { +// case 0: +// valueLists.get(row).hx3_gxhh = value == null ? "" : value +// .toString(); +// break; +// case 2: +// if (bean == null) { +// +// valueLists.get(row).hx3_bzgx = ""; +// table.setValueAt("", row, 1); +// valueLists.get(row).hx3_gzzx = ""; +// table.setValueAt("", row, 3); +// valueLists.get(row).hx3_gzzxmc = ""; +// table.setValueAt("", row, 4); +// valueLists.get(row).hx3_dcgx1 = false; +// table.setValueAt(false, row, 6); +// valueLists.get(row).hx3_bgd1 = false; +// table.setValueAt(false, row, 7); +// valueLists.get(row).hx3_wwgx1 = false; +// table.setValueAt(false, row, 8); +// valueLists.get(row).hx3_jfd1 = false; +// table.setValueAt(false, row, 9); +// valueLists.get(row).hx3_jhwwgx1 = false; +// table.setValueAt(false, row, 10); +// valueLists.get(row).hx3_gxsm = value == null ? "" +// : value.toString(); +// } else { +// valueLists.get(row).hx3_bzgx = bean.hx3_gxbz; +// table.setValueAt(bean.hx3_gxbz, row, 1); +// valueLists.get(row).hx3_gzzx = bean.hx3_gzzx; +// table.setValueAt(bean.hx3_gzzx, row, 3); +// valueLists.get(row).hx3_gzzxmc = bean.hx3_gzzxmc; +// table.setValueAt(bean.hx3_gzzxmc, row, 4); +// valueLists.get(row).hx3_dcgx1 = bean.hx3_dcgx1; +// table.setValueAt(bean.hx3_dcgx1, row, 6); +// valueLists.get(row).hx3_bgd1 = bean.hx3_bgd1; +// table.setValueAt(bean.hx3_bgd1, row, 7); +// valueLists.get(row).hx3_wwgx1 = bean.hx3_wwgx1; +// table.setValueAt(bean.hx3_wwgx1, row, 8); +// valueLists.get(row).hx3_jfd1 = bean.hx3_jfd1; +// table.setValueAt(bean.hx3_jfd1, row, 9); +// valueLists.get(row).hx3_jhwwgx1 = bean.hx3_jhwwgx1; +// table.setValueAt(bean.hx3_jhwwgx1, row, 10); +// valueLists.get(row).hx3_gxsm = (String) value; +// } +// +// break; +// +// case 3: +// // if (bean != null) { +// // value = bean.hx3_gzzx; +// // } else { +// // value = ""; +// // } +// // +// // valueLists.get(row).hx3_gzzx = value == null ? "" : value +// // .toString(); +// break; +// case 4: +// // if (bean != null) { +// // value = bean.hx3_gzzxmc; +// // } else { +// // value = ""; +// // } +// // valueLists.get(row).hx3_gzzxmc = value == null ? "" : +// // value +// // .toString(); +// break; +// case 5: +// +// valueLists.get(row).hx3_mjbh = value == null ? "" : value +// .toString(); +// break; +// case 6: +// // if (bean != null) { +// // value = bean.hx3_dcgx1; +// // } else { +// // value = false; +// // } +// // valueLists.get(row).hx3_dcgx1 = (boolean) value; +// break; +// case 7: +// // if (bean != null) { +// // value = bean.hx3_bgd1; +// // } else { +// // value = false; +// // } +// // valueLists.get(row).hx3_bgd1 = (boolean) value; +// +// break; +// case 8: +// // if (bean != null) { +// // value = bean.hx3_wwgx1; +// // } else { +// // value = false; +// // } +// // valueLists.get(row).hx3_wwgx1 = (boolean) value; +// +// break; +// case 9: +// // if (bean != null) { +// // value = bean.hx3_jfd1; +// // } else { +// // value = false; +// // } +// // valueLists.get(row).hx3_jfd1 = (boolean) value; +// +// break; +// case 10: +// // if (bean != null) { +// // value = bean.hx3_jhwwgx1; +// // } else { +// // value = false; +// // } +// // valueLists.get(row).hx3_jhwwgx1 = (boolean) value; +// +// break; +// +// case 13: +// valueLists.get(row).hx3_gywjbh = value == null ? "" : value +// .toString(); +// break; +// case 14: +// valueLists.get(row).hx3_gywjbb = value == null ? "" : value +// .toString(); +// break; +// +// default: +// break; +// +// } +// +// // 2.õǰCellɫ +// // Component c = super.getTableCellRendererComponent(table, +// // value, +// // isSelected, hasFocus, row, column); +// this.setBackground(Color.yellow);// ñɫ +// this.setForeground(Color.BLACK);// ǰɫ +// return this; +// } else { +// +// // 3.õУżеɫ +// if (row % 2 == 0) {// żʱɫ +// setBackground(Color.white); +// } else if (row % 2 == 1) {// õеɫ +// setBackground(Color.white); +// } +// if (isSelected) { +// this.setBackground(Color.LIGHT_GRAY);// ñɫ +// } +// return this; +// } +// +// // return this; +// } +// } +// +//} diff --git a/src/com/connor/jk/plm/form/HX3_SelectBzgxDialog.java b/src/com/connor/jk/plm/form/HX3_SelectBzgxDialog.java new file mode 100644 index 0000000..9294cff --- /dev/null +++ b/src/com/connor/jk/plm/form/HX3_SelectBzgxDialog.java @@ -0,0 +1,43 @@ +package com.connor.jk.plm.form; + +import java.awt.BorderLayout; +import java.util.List; + +import javax.swing.JButton; +import javax.swing.JPanel; +import javax.swing.JTable; + +import com.teamcenter.rac.aif.AbstractAIFDialog; + + +public class HX3_SelectBzgxDialog extends AbstractAIFDialog { + private List bzgxBeanList; + public static int index = -1; + private JTable bzgxTable; + private JButton okButton; + private JButton celButton; + + public HX3_SelectBzgxDialog(List bzgxBeanList){ + super(false); + this.bzgxBeanList = bzgxBeanList; + this.index = -1; + } + + public void initUI(){ + this.setTitle("׼ѡ"); + this.setLayout(new BorderLayout()); + //JPanel + + + this.centerToScreen(); + this.pack(); + this.showDialog(); + + } + + @Override + public void run() { + initUI(); + } + +} diff --git a/src/com/connor/jk/plm/form/LOVBean.java b/src/com/connor/jk/plm/form/LOVBean.java new file mode 100644 index 0000000..5c34440 --- /dev/null +++ b/src/com/connor/jk/plm/form/LOVBean.java @@ -0,0 +1,20 @@ +package com.connor.jk.plm.form; + +public class LOVBean { + public String disValue; + public String value; + public String relName; + + + public LOVBean(String disValue,String value){ + this.disValue = disValue; + this.value = value; + } + + + @Override + public String toString() { + return disValue==null?"":disValue; + } + +} diff --git a/src/com/connor/jk/plm/form/MyTCComponent.java b/src/com/connor/jk/plm/form/MyTCComponent.java new file mode 100644 index 0000000..ce8e1b9 --- /dev/null +++ b/src/com/connor/jk/plm/form/MyTCComponent.java @@ -0,0 +1,46 @@ +package com.connor.jk.plm.form; + +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCSession; + +public class MyTCComponent { + public static TCSession session; + static { + if (session == null) { + session = (TCSession) AIFUtility.getCurrentApplication() + .getSession(); + } + } + private TCComponent comp; + + public MyTCComponent(TCComponent comp) { + this.comp = comp; + } + + public MyTCComponent(String id) { + try { + if (session != null) { + + comp = session.stringToComponent(id); + } + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + + @Override + public String toString() { + try { + if (comp != null) + return comp.getStringProperty("object_string"); + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return "NULL"; + } +} \ No newline at end of file diff --git a/src/com/connor/jk/plm/form/WL_Form.java b/src/com/connor/jk/plm/form/WL_Form.java new file mode 100644 index 0000000..7f77a56 --- /dev/null +++ b/src/com/connor/jk/plm/form/WL_Form.java @@ -0,0 +1,72 @@ +package com.connor.jk.plm.form; + +import java.awt.FlowLayout; + +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JTextField; + +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.stylesheet.AbstractRendering; +import com.teamcenter.rac.util.MessageBox; + +public class WL_Form extends AbstractRendering { + + private TCComponent form; + + public WL_Form(TCComponent arg0) throws Exception { + super(arg0); + // + this.form = arg0;// = form; + initUI(); + } + + public void initUI(){ + JLabel nameLabel = new JLabel("NAME:"); + JTextField nameField = new JTextField(16); + JButton printButton = new JButton("Print"); + + this.setLayout(new FlowLayout()); + this.add(nameLabel); + this.add(nameField); + this.add(printButton); + + } + + + + + + + + @Override + public void loadRendering() throws TCException { + // TODO Auto-generated method stub + //MessageBox.post("load","11",MessageBox.ERROR); + + + + } + + + + @Override + public void initializeRenderingDisplay() { + // TODO Auto-generated method stub + + initUI(); + super.initializeRenderingDisplay(); + } + + @Override + public void saveRendering() { + // TODO Auto-generated method stub + MessageBox.post("save()","11",MessageBox.ERROR); + + } + + + + +} diff --git a/src/com/connor/jk/plm/handlers/CreateProjrct_Handler.java b/src/com/connor/jk/plm/handlers/CreateProjrct_Handler.java new file mode 100644 index 0000000..1d4e688 --- /dev/null +++ b/src/com/connor/jk/plm/handlers/CreateProjrct_Handler.java @@ -0,0 +1,22 @@ +package com.connor.jk.plm.handlers; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.connor.jk.plm.createproject.CreateProjrct_Action; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aifrcp.AIFUtility; + +public class CreateProjrct_Handler extends AbstractHandler{ + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + // TODO Auto-generated method stub + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + CreateProjrct_Action action=new CreateProjrct_Action(app,null); + new Thread(action).start(); + return null; + } + +} diff --git a/src/com/connor/jk/plm/handlers/Generate_Handler.java b/src/com/connor/jk/plm/handlers/Generate_Handler.java new file mode 100644 index 0000000..b22a5ba --- /dev/null +++ b/src/com/connor/jk/plm/handlers/Generate_Handler.java @@ -0,0 +1,22 @@ +package com.connor.jk.plm.handlers; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.connor.jk.plm.sqb.Generate_Action; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aifrcp.AIFUtility; + +public class Generate_Handler extends AbstractHandler{ + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + // TODO Auto-generated method stub + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + Generate_Action action=new Generate_Action(app,null); + new Thread(action).start(); + return null; + } + +} diff --git a/src/com/connor/jk/plm/handlers/ImportBOM_Handler.java b/src/com/connor/jk/plm/handlers/ImportBOM_Handler.java new file mode 100644 index 0000000..0aa6311 --- /dev/null +++ b/src/com/connor/jk/plm/handlers/ImportBOM_Handler.java @@ -0,0 +1,22 @@ +package com.connor.jk.plm.handlers; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.connor.jk.plm.imp.bom.ImportBOM_Action; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aifrcp.AIFUtility; + +public class ImportBOM_Handler extends AbstractHandler { + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + // TODO Auto-generated method stub + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + ImportBOM_Action ib=new ImportBOM_Action(app, null); + new Thread(ib).start(); + return null; + } + +} diff --git a/src/com/connor/jk/plm/handlers/JK8CotlerPModAppForm_Handler.java b/src/com/connor/jk/plm/handlers/JK8CotlerPModAppForm_Handler.java new file mode 100644 index 0000000..a871413 --- /dev/null +++ b/src/com/connor/jk/plm/handlers/JK8CotlerPModAppForm_Handler.java @@ -0,0 +1,23 @@ +package com.connor.jk.plm.handlers; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.connor.jk.plm.sqb.JK8_SBH_Action; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCSession; + +public class JK8CotlerPModAppForm_Handler extends AbstractHandler{ + private String type="JK8CotlerPModAppForm"; + //private String type="HX3_GYLXMaster"; + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + JK8_SBH_Action action=new JK8_SBH_Action(app, type); + new Thread(action).start(); + return null; + } + +} diff --git a/src/com/connor/jk/plm/handlers/JK8_CJQ_Handler.java b/src/com/connor/jk/plm/handlers/JK8_CJQ_Handler.java new file mode 100644 index 0000000..fc93301 --- /dev/null +++ b/src/com/connor/jk/plm/handlers/JK8_CJQ_Handler.java @@ -0,0 +1,22 @@ +package com.connor.jk.plm.handlers; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.connor.jk.plm.sqb.JK8_SBH_Action; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aifrcp.AIFUtility; + +public class JK8_CJQ_Handler extends AbstractHandler{ + private String type = "JK8CJQIdenNOAppForm"; + //private String type="HX3_GYLXMaster"; + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + AbstractAIFApplication app = AIFUtility.getCurrentApplication(); + JK8_SBH_Action action = new JK8_SBH_Action(app, type); + new Thread(action).start(); + return null; + } + +} diff --git a/src/com/connor/jk/plm/handlers/JK8_CPXH_Handler.java b/src/com/connor/jk/plm/handlers/JK8_CPXH_Handler.java new file mode 100644 index 0000000..37f16ed --- /dev/null +++ b/src/com/connor/jk/plm/handlers/JK8_CPXH_Handler.java @@ -0,0 +1,22 @@ +package com.connor.jk.plm.handlers; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.connor.jk.plm.sqb.JK8_SBH_Action; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aifrcp.AIFUtility; + +public class JK8_CPXH_Handler extends AbstractHandler { + + private String type = "JK8NPModINOAppForm"; + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + AbstractAIFApplication app = AIFUtility.getCurrentApplication(); + JK8_SBH_Action action = new JK8_SBH_Action(app, type); + new Thread(action).start(); + return null; + } + +} diff --git a/src/com/connor/jk/plm/handlers/JK8_ColPIdenNOAppForm_Handler.java b/src/com/connor/jk/plm/handlers/JK8_ColPIdenNOAppForm_Handler.java new file mode 100644 index 0000000..c2239e8 --- /dev/null +++ b/src/com/connor/jk/plm/handlers/JK8_ColPIdenNOAppForm_Handler.java @@ -0,0 +1,23 @@ +package com.connor.jk.plm.handlers; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.connor.jk.plm.sqb.JK8_SBH_Action; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCSession; + +public class JK8_ColPIdenNOAppForm_Handler extends AbstractHandler{ + private String type="JK8ColPIdenNOAppForm"; + //private String type="HX3_GYLXMaster"; + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + JK8_SBH_Action action=new JK8_SBH_Action(app, type); + new Thread(action).start(); + return null; + } + +} diff --git a/src/com/connor/jk/plm/handlers/JK8_SBH_Handler.java b/src/com/connor/jk/plm/handlers/JK8_SBH_Handler.java new file mode 100644 index 0000000..783b73f --- /dev/null +++ b/src/com/connor/jk/plm/handlers/JK8_SBH_Handler.java @@ -0,0 +1,22 @@ +package com.connor.jk.plm.handlers; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.connor.jk.plm.sqb.JK8_SBH_Action; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aifrcp.AIFUtility; + +public class JK8_SBH_Handler extends AbstractHandler{ + private String type = "JK8NewPIdenNOAppForm"; + //private String type="HX3_GYLXMaster"; + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + AbstractAIFApplication app = AIFUtility.getCurrentApplication(); + JK8_SBH_Action action = new JK8_SBH_Action(app, type); + new Thread(action).start(); + return null; + } + +} diff --git a/src/com/connor/jk/plm/handlers/JK8_TSSBH_Handler.java b/src/com/connor/jk/plm/handlers/JK8_TSSBH_Handler.java new file mode 100644 index 0000000..6f833af --- /dev/null +++ b/src/com/connor/jk/plm/handlers/JK8_TSSBH_Handler.java @@ -0,0 +1,20 @@ +package com.connor.jk.plm.handlers; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.connor.jk.plm.sqb.JK8_SBH_Action; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aifrcp.AIFUtility; + +public class JK8_TSSBH_Handler extends AbstractHandler { + private String type="JK8SpecPINOAppForm"; + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + JK8_SBH_Action action=new JK8_SBH_Action(app, type); + new Thread(action).start(); + return null; + } +} diff --git a/src/com/connor/jk/plm/handlers/JK8_YSSBH_Handler.java b/src/com/connor/jk/plm/handlers/JK8_YSSBH_Handler.java new file mode 100644 index 0000000..3142dff --- /dev/null +++ b/src/com/connor/jk/plm/handlers/JK8_YSSBH_Handler.java @@ -0,0 +1,20 @@ +package com.connor.jk.plm.handlers; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.connor.jk.plm.sqb.JK8_SBH_Action; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aifrcp.AIFUtility; + +public class JK8_YSSBH_Handler extends AbstractHandler { + private String type="JK8DerPIdenNOAppForm"; + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + JK8_SBH_Action action=new JK8_SBH_Action(app, type); + new Thread(action).start(); + return null; + } +} diff --git a/src/com/connor/jk/plm/handlers/JK8_YZCPXHSQB_Handler.java b/src/com/connor/jk/plm/handlers/JK8_YZCPXHSQB_Handler.java new file mode 100644 index 0000000..42f5bed --- /dev/null +++ b/src/com/connor/jk/plm/handlers/JK8_YZCPXHSQB_Handler.java @@ -0,0 +1,23 @@ +package com.connor.jk.plm.handlers; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.connor.jk.plm.sqb.JK8_SBH_Action; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCSession; + +public class JK8_YZCPXHSQB_Handler extends AbstractHandler{ + private String type="JK8ExtPIdenNOAppForm"; + //private String type="HX3_GYLXMaster"; + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + JK8_SBH_Action action=new JK8_SBH_Action(app, type); + new Thread(action).start(); + return null; + } + +} diff --git a/src/com/connor/jk/plm/handlers/JspsReport_Handler.java b/src/com/connor/jk/plm/handlers/JspsReport_Handler.java new file mode 100644 index 0000000..d0ca6bd --- /dev/null +++ b/src/com/connor/jk/plm/handlers/JspsReport_Handler.java @@ -0,0 +1,22 @@ +package com.connor.jk.plm.handlers; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.connor.jk.plm.report.JspsReport_Action; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aifrcp.AIFUtility; + +public class JspsReport_Handler extends AbstractHandler { + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + // TODO Auto-generated method stub + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + JspsReport_Action action=new JspsReport_Action(app,null); + new Thread(action).start(); + return null; + } + +} diff --git a/src/com/connor/jk/plm/imform/FormBean.java b/src/com/connor/jk/plm/imform/FormBean.java new file mode 100644 index 0000000..855e5f4 --- /dev/null +++ b/src/com/connor/jk/plm/imform/FormBean.java @@ -0,0 +1,639 @@ +package com.connor.jk.plm.imform; + +import java.util.Arrays; + +public class FormBean { + private String lx;// Ʒ + private String xmmc;// Ŀ + private String xmbh;// Ŀ + private String cpxh;// Ʒͺ + private String sbh;// ʶ + private String cpmc;// Ʒ + private String jbcj;// + private String ickxh;// ICͺ + private String xlbxh;// ·ͺ + private String cxtz;// + private String tdxh;// ͺ + private String gngs;// ܸ + private String khtsyq;// ͻҪ + private String fm;// + private String jmlx;// + private String sqr;// + private String djrq;// Ǽ + private String sysc;// г + private String ptjbcj;// ׻ + private String status;// ״̬ //2018.6.4½4 + private String fmlx;// " + private String txfs;// ͨŷʽ + private String gdlx;// 緽ʽ + // TODO 2019.07.31 + // private String qtzl;// + // private String sycs;// ʹó + // private String bjbf;// ⲿֵĹϵ + // private String scxhzl;// ź + // private String cptzh;// Ʒ + // TODO 2020.08.05 + private String tcqt;// ̽ + private String yycs;// Ӧó + private String txyn;// ͨŷʽ(л) + private String scxh;// ź + private String sccj;// + + //2022/11/18 + private String fbzh;// ֤ + private String xpzh;// ֤ + private String cspz;// ʼ + private String mz;// ģ + private String xp;// оƬ + private String xy;// Э + private String znf;// ֹ淧 + private String qyk;// ȡѹ + private String jkpm;// ƤĤ + private String jxwb;// е² + private String klc;// + private String jbcgfs;// ɹʽ + private String jbys;// ɫ + private String hztj;// ת + private String wbbj;// ⲿ + private String mzfc;// ַ + private String gdfc;// ܵ + private String szld;// ʱ﮵ + private String ddsc;// ϴ + private String ghzy;// ۻר + private String wbzlogo;// װlogo + private String mxts;// ÿ̨ + private String cpghfs;// Ʒʽ + private String yhfffs;// ûѷʽ + private String xmjl;// Ŀ + private String bz;// ע + private String sfts;// Ƿͣ + private String tsyy;// ͣԭ + private String tshxcp;// ͣۺ²Ʒ + private String sqrq;// + private String jxhdz;// ߻ jk8Customized + private String kh;// ͻ jk8Customer + private String cpzxl; //Ʒϵ jk8ProductFamily + private String lbdm; // jk8ContrlCompType + private String lsh;//ˮ jk8SerialCode + private String jbcj2; // jk8BMManufactor + public String getJxhdz() { + return jxhdz; + } + + public void setJxhdz(String jxhdz) { + this.jxhdz = jxhdz; + } + + public String getKh() { + return kh; + } + + public void setKh(String kh) { + this.kh = kh; + } + + public String getCpzxl() { + return cpzxl; + } + + public void setCpzxl(String cpzxl) { + this.cpzxl = cpzxl; + } + + public String getLbdm() { + return lbdm; + } + + public void setLbdm(String lbdm) { + this.lbdm = lbdm; + } + + public String getLsh() { + return lsh; + } + + public void setLsh(String lsh) { + this.lsh = lsh; + } + + public String getJbcj2() { + return jbcj2; + } + + public void setJbcj2(String jbcj2) { + this.jbcj2 = jbcj2; + } + + public String getTcqt() { + return tcqt; + } + + public void setTcqt(String tcqt) { + this.tcqt = tcqt; + } + + public String getYycs() { + return yycs; + } + + public void setYycs(String yycs) { + this.yycs = yycs; + } + + public String getTxyn() { + return txyn; + } + + public void setTxyn(String txyn) { + this.txyn = txyn; + } + + public String getScxh() { + return scxh; + } + + public void setScxh(String scxh) { + this.scxh = scxh; + } + + public String getSccj() { + return sccj; + } + + public void setSccj(String sccj) { + this.sccj = sccj; + } + + // public String getQtzl() { + // return qtzl; + // } + // public void setQtzl(String qtzl) { + // this.qtzl = qtzl; + // } + // public String getSycs() { + // return sycs; + // } + // public void setSycs(String sycs) { + // this.sycs = sycs; + // } + // public String getBjbf() { + // return bjbf; + // } + // public void setBjbf(String bjbf) { + // this.bjbf = bjbf; + // } + // public String getScxhzl() { + // return scxhzl; + // } + // public void setScxhzl(String scxhzl) { + // this.scxhzl = scxhzl; + // } + // public String getCptzh() { + // return cptzh; + // } + // public void setCptzh(String cptzh) { + // this.cptzh = cptzh; + // } + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getFmlx() { + return fmlx; + } + + public void setFmlx(String fmlx) { + this.fmlx = fmlx; + } + + public String getTxfs() { + return txfs; + } + + public void setTxfs(String txfs) { + this.txfs = txfs; + } + + public String getGdlx() { + return gdlx; + } + + public void setGdlx(String gdlx) { + this.gdlx = gdlx; + } + + public String getLx() { + return lx; + } + + public void setLx(String lx) { + this.lx = lx; + } + + public String getXmmc() { + return xmmc; + } + + public void setXmmc(String xmmc) { + this.xmmc = xmmc; + } + + public String getXmbh() { + return xmbh; + } + + public void setXmbh(String xmbh) { + this.xmbh = xmbh; + } + + public String getCpxh() { + return cpxh; + } + + public void setCpxh(String cpxh) { + this.cpxh = cpxh; + } + + public String getSbh() { + return sbh; + } + + public void setSbh(String sbh) { + this.sbh = sbh; + } + + public String getCpmc() { + return cpmc; + } + + public void setCpmc(String cpmc) { + this.cpmc = cpmc; + } + + public String getJbcj() { + return jbcj; + } + + public void setJbcj(String jbcj) { + this.jbcj = jbcj; + } + + public String getIckxh() { + return ickxh; + } + + public void setIckxh(String ickxh) { + this.ickxh = ickxh; + } + + public String getXlbxh() { + return xlbxh; + } + + public void setXlbxh(String xlbxh) { + this.xlbxh = xlbxh; + } + + public String getCxtz() { + return cxtz; + } + + public void setCxtz(String cxtz) { + this.cxtz = cxtz; + } + + public String getTdxh() { + return tdxh; + } + + public void setTdxh(String tdxh) { + this.tdxh = tdxh; + } + + public String getGngs() { + return gngs; + } + + public void setGngs(String gngs) { + this.gngs = gngs; + } + + public String getKhtsyq() { + return khtsyq; + } + + public void setKhtsyq(String khtsyq) { + this.khtsyq = khtsyq; + } + + public String getFm() { + return fm; + } + + public void setFm(String fm) { + this.fm = fm; + } + + public String getJmlx() { + return jmlx; + } + + public void setJmlx(String jmlx) { + this.jmlx = jmlx; + } + + public String getSqr() { + return sqr; + } + + public void setSqr(String sqr) { + this.sqr = sqr; + } + + public String getDjrq() { + return djrq; + } + + public void setDjrq(String djrq) { + this.djrq = djrq; + } + + public String getSysc() { + return sysc; + } + + public void setSysc(String sysc) { + this.sysc = sysc; + } + + public String getPtjbcj() { + return ptjbcj; + } + + public void setPtjbcj(String ptjbcj) { + this.ptjbcj = ptjbcj; + } + + public String getFbzh() { + return fbzh; + } + + public void setFbzh(String fbzh) { + this.fbzh = fbzh; + } + + public String getXpzh() { + return xpzh; + } + + public void setXpzh(String xpzh) { + this.xpzh = xpzh; + } + + public String getCspz() { + return cspz; + } + + public void setCspz(String cspz) { + this.cspz = cspz; + } + + public String getMz() { + return mz; + } + + public void setMz(String mz) { + this.mz = mz; + } + + public String getXp() { + return xp; + } + + public void setXp(String xp) { + this.xp = xp; + } + + public String getXy() { + return xy; + } + + public void setXy(String xy) { + this.xy = xy; + } + + public String getZnf() { + return znf; + } + + public void setZnf(String znf) { + this.znf = znf; + } + + public String getQyk() { + return qyk; + } + + public void setQyk(String qyk) { + this.qyk = qyk; + } + + public String getJkpm() { + return jkpm; + } + + public void setJkpm(String jkpm) { + this.jkpm = jkpm; + } + + public String getJxwb() { + return jxwb; + } + + public void setJxwb(String jxwb) { + this.jxwb = jxwb; + } + + public String getKlc() { + return klc; + } + + public void setKlc(String klc) { + this.klc = klc; + } + + public String getJbcgfs() { + return jbcgfs; + } + + public void setJbcgfs(String jbcgfs) { + this.jbcgfs = jbcgfs; + } + + public String getJbys() { + return jbys; + } + + public void setJbys(String jbys) { + this.jbys = jbys; + } + + public String getHztj() { + return hztj; + } + + public void setHztj(String hztj) { + this.hztj = hztj; + } + + public String getWbbj() { + return wbbj; + } + + public void setWbbj(String wbbj) { + this.wbbj = wbbj; + } + + public String getMzfc() { + return mzfc; + } + + public void setMzfc(String mzfc) { + this.mzfc = mzfc; + } + + public String getGdfc() { + return gdfc; + } + + public void setGdfc(String gdfc) { + this.gdfc = gdfc; + } + + public String getSzld() { + return szld; + } + + public void setSzld(String szld) { + this.szld = szld; + } + + public String getDdsc() { + return ddsc; + } + + public void setDdsc(String ddsc) { + this.ddsc = ddsc; + } + + public String getGhzy() { + return ghzy; + } + + public void setGhzy(String ghzy) { + this.ghzy = ghzy; + } + + public String getWbzlogo() { + return wbzlogo; + } + + public void setWbzlogo(String wbzlogo) { + this.wbzlogo = wbzlogo; + } + + public String getMxts() { + return mxts; + } + + public void setMxts(String mxts) { + this.mxts = mxts; + } + + public String getCpghfs() { + return cpghfs; + } + + public void setCpghfs(String cpghfs) { + this.cpghfs = cpghfs; + } + + public String getYhfffs() { + return yhfffs; + } + + public void setYhfffs(String yhfffs) { + this.yhfffs = yhfffs; + } + + public String getXmjl() { + return xmjl; + } + + public void setXmjl(String xmjl) { + this.xmjl = xmjl; + } + + public String getBz() { + return bz; + } + + public void setBz(String bz) { + this.bz = bz; + } + + public String getSfts() { + return sfts; + } + + public void setSfts(String sfts) { + this.sfts = sfts; + } + + public String getTsyy() { + return tsyy; + } + + public void setTsyy(String tsyy) { + this.tsyy = tsyy; + } + + public String getTshxcp() { + return tshxcp; + } + + public void setTshxcp(String tshxcp) { + this.tshxcp = tshxcp; + } + + public String getSqrq() { + return sqrq; + } + + public void setSqrq(String sqrq) { + this.sqrq = sqrq; + } + + @Override + public String toString() { + return "FormBean [lx=" + lx + ", xmmc=" + xmmc + ", xmbh=" + xmbh + ", cpxh=" + cpxh + ", sbh=" + sbh + + ", cpmc=" + cpmc + ", jbcj=" + jbcj + ", ickxh=" + ickxh + ", xlbxh=" + xlbxh + ", cxtz=" + cxtz + + ", tdxh=" + tdxh + ", gngs=" + gngs + ", khtsyq=" + khtsyq + ", fm=" + fm + ", jmlx=" + jmlx + + ", sqr=" + sqr + ", djrq=" + djrq + ", sysc=" + sysc + ", ptjbcj=" + ptjbcj + ", status=" + status + + ", fmlx=" + fmlx + ", txfs=" + txfs + ", gdlx=" + gdlx + ", tcqt=" + tcqt + ", yycs=" + yycs + + ", txyn=" + txyn + ", scxh=" + scxh + ", sccj=" + sccj + ", fbzh=" + fbzh + ", xpzh=" + xpzh + + ", cspz=" + cspz + ", mz=" + mz + ", xp=" + xp + ", xy=" + xy + ", znf=" + znf + ", qyk=" + qyk + + ", jkpm=" + jkpm + ", jxwb=" + jxwb + ", klc=" + klc + ", jbcgfs=" + jbcgfs + ", jbys=" + jbys + + ", hztj=" + hztj + ", wbbj=" + wbbj + ", mzfc=" + mzfc + ", gdfc=" + gdfc + ", szld=" + szld + + ", ddsc=" + ddsc + ", ghzy=" + ghzy + ", wbzlogo=" + wbzlogo + ", mxts=" + mxts + ", cpghfs=" + cpghfs + + ", yhfffs=" + yhfffs + ", xmjl=" + xmjl + ", bz=" + bz + ", sfts=" + sfts + ", tsyy=" + tsyy + + ", tshxcp=" + tshxcp + ", sqrq=" + sqrq + "]"; + } + + + +} diff --git a/src/com/connor/jk/plm/imform/ImfomAIFDialog.java b/src/com/connor/jk/plm/imform/ImfomAIFDialog.java new file mode 100644 index 0000000..bff6704 --- /dev/null +++ b/src/com/connor/jk/plm/imform/ImfomAIFDialog.java @@ -0,0 +1,196 @@ +package com.connor.jk.plm.imform; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.File; + +import javax.swing.JButton; +import javax.swing.JFileChooser; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JTextField; +import javax.swing.filechooser.FileSystemView; + +import com.connor.jk.plm.bom.until.ProgressBarThread; +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; + +public class ImfomAIFDialog extends AbstractAIFDialog { + + private TCSession session; + private InterfaceAIFComponent targetComp; + private TCComponentForm form; + private JFileChooser jFileChooser; + private JTextField jt4 = new JTextField(20); + private JLabel jb4; + private JButton pBut; + private JButton okBut=new JButton("ȷ"); + private JButton celBut=new JButton("ȡ"); + private JButton celallBut=new JButton(""); + public ImfomAIFDialog(TCSession session, InterfaceAIFComponent targetComp ){ + this.session = session; + this.targetComp = targetComp; + this.form=(TCComponentForm)targetComp; +// initUI(); + } + public void run() { + super.run(); + initUI(); + } + public void initUI() { + FileSystemView fsv = FileSystemView.getFileSystemView(); // õϵͳfileview + String deskPath = fsv.getHomeDirectory().getPath(); // ǰû· + + setLayout(new PropertyLayout()); + jb4 = new JLabel(" ļ·"); + jt4.setText(deskPath); + pBut = new JButton("..."); + jFileChooser = new JFileChooser(); + this.jFileChooser.setCurrentDirectory(new File(deskPath));// ļѡijʼĿ¼Ϊǰû + add("1.1.left.top", jb4); + add("1.2.left.top", jt4); + add("1.3.left.top", pBut); + add("2.1.left.top", okBut); + add("2.2.left.top", celBut); + add("2.3.left.top", celallBut); + setSize(300, 300); + setVisible(true); + pBut.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent arg0) { + selectFileButtonEvent(); + } + }); + okBut.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent arg0) { + String path=jt4.getText(); + if(path.endsWith(".xlsx")){ + setVisible(false); + ProgressBarThread wait = new ProgressBarThread("ͬ", "ͬУԵ..."); + wait.start();// + SetExcel se=new SetExcel(path,form); + wait.setBool(true);// رս + wait.interrupt(); + MessageBox.post("!!!","",MessageBox.INFORMATION); + } + System.out.println("ok"); + } + }); + celBut.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent arg0) { + setVisible(false); + } + }); + celallBut.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + int yn = JOptionPane.showConfirmDialog(null, "Ƿɾݣ", + "ɾȷ϶Ի", 0, 2); + if (yn == 0) { + + try { + form.getTCProperty("jk8ProjectName").setStringValueArray(new String[]{}); + form.getTCProperty("jk8ProjectNO").setStringValueArray(new String[]{}); + form.getTCProperty("jk8ProductType").setStringValueArray(new String[]{});// + form.getTCProperty("jk8ProductModNO").setStringValueArray(new String[]{}); + form.getTCProperty("jk8ProductIdentifyNO").setStringValueArray(new String[]{}); + form.getTCProperty("jk8ProductName").setStringValueArray(new String[]{}); + form.getTCProperty("jk8BaseMeterManufactor").setStringValueArray(new String[]{}); + form.getTCProperty("jk8ICCardType").setStringValueArray(new String[]{}); + form.getTCProperty("jk8CircBoardModNO").setStringValueArray(new String[]{}); + form.getTCProperty("jk8ProgramFeatures").setStringValueArray(new String[]{}); + form.getTCProperty("jk8InsteadType").setStringValueArray(new String[]{}); + form.getTCProperty("jk8FunctionOverview").setStringValueArray(new String[]{}); + form.getTCProperty("jk8CustSpecRequirements").setStringValueArray(new String[]{}); + //form.getTCProperty("jk8U8NO").setStringValueArray(u8mmh1); + form.getTCProperty("jk8Valve").setStringValueArray(new String[]{}); + form.getTCProperty("jk8EncryptType").setStringValueArray(new String[]{}); + form.getTCProperty("jk8Applicant").setStringValueArray(new String[]{}); + form.getTCProperty("jk8RecordDate").setStringValueArray(new String[]{}); + form.getTCProperty("jk8ApplyMarket").setStringValueArray(new String[]{}); + form.getTCProperty("jk8BMManfMatched").setStringValueArray(new String[]{}); + + form.getTCProperty("jk8Status").setStringValueArray(new String[]{}); //״̬jk8Status + form.getTCProperty("jk8ValveType").setStringValueArray(new String[]{}); + form.getTCProperty("jk8CommunicateMode").setStringValueArray(new String[]{}); + form.getTCProperty("jk8PowerSupplyMode").setStringValueArray(new String[]{}); + + //2019.07.31 +// form.getTCProperty("jk8GasType").setStringValueArray(new String[]{}); // +// form.getTCProperty("jk8UsePlace").setStringValueArray(new String[]{}); +// form.getTCProperty("jk8AlaDectRelation").setStringValueArray(new String[]{}); +// form.getTCProperty("jk8OutputSignal").setStringValueArray(new String[]{}); +// form.getTCProperty("jk8ProFeatNum").setStringValueArray(new String[]{}); + //2020.8.5 + form.getTCProperty("jk8GasType").setStringValueArray(new String[]{}); // + form.getTCProperty("jk8UsePlace").setStringValueArray(new String[]{}); + form.getTCProperty("jk8CommunicateMode2").setStringValueArray(new String[]{}); + form.getTCProperty("jk8OutputSignal").setStringValueArray(new String[]{}); + form.getTCProperty("jk8Manufacturer").setStringValueArray(new String[]{}); + + //2022/11/18 + form.getTCProperty("jk8FlameproofType").setStringValueArray(new String[]{});// ֤ + form.getTCProperty("jk8TypeCerNo").setStringValueArray(new String[]{});// ֤ + form.getTCProperty("jk8InitConfig").setStringValueArray(new String[]{});// ʼ + form.getTCProperty("jk8Module").setStringValueArray(new String[]{});// ģ + form.getTCProperty("jk8Chip").setStringValueArray(new String[]{});// оƬ + form.getTCProperty("jk8Agreement").setStringValueArray(new String[]{});// Э + form.getTCProperty("jk8BackstopValve").setStringValueArray(new String[]{});// ֹ淧 + form.getTCProperty("jk8PressureTap").setStringValueArray(new String[]{});// ȡѹ + form.getTCProperty("jk8ImpSkin").setStringValueArray(new String[]{});// ƤĤ + form.getTCProperty("jk8MechTempC").setStringValueArray(new String[]{});// е² + form.getTCProperty("jk8WideRange").setStringValueArray(new String[]{});// + form.getTCProperty("jk8BMBuy").setStringValueArray(new String[]{});// ɹʽ + form.getTCProperty("jk8BMColor").setStringValueArray(new String[]{});// ɫ + form.getTCProperty("jk8GyratoryVolume").setStringValueArray(new String[]{});// ת + form.getTCProperty("jk8ExAlarm").setStringValueArray(new String[]{});// ⲿ + form.getTCProperty("jk8FaceAntiRemove").setStringValueArray(new String[]{});// ַ + form.getTCProperty("jk8PipeAntiRemove").setStringValueArray(new String[]{});// ܵ + form.getTCProperty("jk8ClockLiBattey").setStringValueArray(new String[]{});// ʱ﮵ + form.getTCProperty("jk8UploadPowerFail").setStringValueArray(new String[]{});// ϴ + form.getTCProperty("jk8ForHK").setStringValueArray(new String[]{});// ۻר + form.getTCProperty("jk8PackageLogo").setStringValueArray(new String[]{});// װlogo + form.getTCProperty("jk8PerBoxUnits").setStringValueArray(new String[]{});// ÿ̨ + form.getTCProperty("jk8SupplyMode").setStringValueArray(new String[]{});// Ʒʽ + form.getTCProperty("jk8UserPayMethod").setStringValueArray(new String[]{});// ûѷʽ + form.getTCProperty("jk8ProjectManager").setStringValueArray(new String[]{});// Ŀ + form.getTCProperty("jk8Remarks").setStringValueArray(new String[]{});// ע + form.getTCProperty("jk8StopSale").setStringValueArray(new String[]{});// Ƿͣ + form.getTCProperty("jk8ReasonsStopSale").setStringValueArray(new String[]{});// ͣԭ + form.getTCProperty("jk8StopSaleNewProduct").setStringValueArray(new String[]{});// ͣۺ²Ʒ + form.getTCProperty("jk8ApplyDate").setStringValueArray(new String[]{});// + MessageBox.post("ɾɹ","",MessageBox.INFORMATION); + } catch (TCException e1) { + MessageBox.post("ɾʧ","",MessageBox.ERROR); + e1.printStackTrace(); + } + } + + + } + }); + + } + + public void selectFileButtonEvent() { + int state = jFileChooser.showOpenDialog(null);// ˾ǴļѡĴ + if (state == 1) { + return; + } else { + File f = jFileChooser.getSelectedFile();// fΪѡ񵽵ļĿ¼ + jt4.setText(f.getAbsolutePath()); + } + } + +} diff --git a/src/com/connor/jk/plm/imform/ImformHandler.java b/src/com/connor/jk/plm/imform/ImformHandler.java new file mode 100644 index 0000000..15c7a54 --- /dev/null +++ b/src/com/connor/jk/plm/imform/ImformHandler.java @@ -0,0 +1,50 @@ +package com.connor.jk.plm.imform; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class ImformHandler extends AbstractHandler { + private InterfaceAIFComponent targetComp; + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + // TODO Auto-generated method stub + AbstractAIFApplication app = AIFUtility.getCurrentApplication(); + TCSession session =(TCSession) app.getSession(); + targetComp = app.getTargetComponent(); + if(targetComp==null){ + MessageBox.post("ѡ²ƷͺŵǼDZִв","",MessageBox.ERROR); + return null; + } + + try { + if ("admin".equals(session.getUser().getUserId())) { + if("JK8NewPModNORegForm".equals(targetComp.getType())){ + System.out.println("start"); + ImfomAIFDialog log=new ImfomAIFDialog(session, targetComp); + new Thread(log).start(); + }else{ + MessageBox.post("ѡ²ƷͺŵǼDZִв","",MessageBox.ERROR); + } + }else { + MessageBox.post("ʹadminûִиù","",MessageBox.ERROR); + } + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + + + + return null; + } + +} diff --git a/src/com/connor/jk/plm/imform/SetExcel.java b/src/com/connor/jk/plm/imform/SetExcel.java new file mode 100644 index 0000000..b2d0e52 --- /dev/null +++ b/src/com/connor/jk/plm/imform/SetExcel.java @@ -0,0 +1,870 @@ +package com.connor.jk.plm.imform; + +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.apache.poi.xssf.usermodel.XSSFCell; +import org.apache.poi.xssf.usermodel.XSSFRow; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.util.MessageBox; + +public class SetExcel { + private XSSFWorkbook wb; + private List beanList = new ArrayList<>(); + private TCComponentForm form; + private String[] lx; + private String[] xmmc;// Ŀ + private String[] xmbh;// Ŀ + private String[] cpxh;// Ʒͺ + private String[] sbh;// ʶ + private String[] cpmc;// Ʒ + private String[] jbcj;// + private String[] ickxh;// ICͺ + private String[] xlbxh;// ·ͺ + private String[] cxtz;// + private String[] tdxh;// ͺ + private String[] gngs;// ܸ + private String[] khtsyq;// ͻҪ + private String[] fm;// + private String[] jmlx;// + private String[] sqr;// + private String[] djrq;// Ǽ + private String[] sysc;// г + private String[] ptjbcj;// ׻ + private String[] status;// ״̬ //2018.6.4½4 + private String[] fmlx;// " + private String[] txfs;// ͨŷʽ + private String[] gdlx;// 緽ʽ + // TODO 2019.07.31 +// private String[] qtzl;// +// private String[] sycs;// ʹó +// private String[] bjbf;// ⲿֵĹϵ +// private String[] scxhzl;// ź +// private String[] cptzh;// Ʒ + // TODO 2020.8.5 + private String[] tcqt;// ̽ + private String[] yycs;// Ӧó + private String[] txyn;// ͨŷʽ(л) + private String[] scxh;// ź + private String[] sccj;// + + private String[] lx1; + private String[] xmmc1;// Ŀ + private String[] xmbh1;// Ŀ + private String[] cpxh1;// Ʒͺ + private String[] sbh1;// ʶ + private String[] cpmc1;// Ʒ + private String[] jbcj1;// + private String[] ickxh1;// ICͺ + private String[] xlbxh1;// ·ͺ + private String[] cxtz1;// + private String[] tdxh1;// ͺ + private String[] gngs1;// ܸ + private String[] khtsyq1;// ͻҪ + private String[] fm1;// + private String[] jmlx1;// + private String[] sqr1;// + private String[] djrq1;// Ǽ + private String[] sysc1;// г + private String[] ptjbcj1;// ׻ + private String[] status1;// ״̬ //2018.6.4½4 + private String[] fmlx1;// " + private String[] txfs1;// ͨŷʽ + private String[] gdlx1;// 緽ʽ +// // TODO 2019.07.31 +// private String[] qtzl1;// +// private String[] sycs1;// ʹó +// private String[] bjbf1;// ⲿֵĹϵ +// private String[] scxhzl1;// ź +// private String[] cptzh1;// Ʒ + // TODO 2020.8.5 + private String[] tcqt1;// ̽ + private String[] yycs1;// Ӧó + private String[] txyn1;// ͨŷʽ(л) + private String[] scxh1;// ź + private String[] sccj1;// + //2022/11/18 + private String[] fbzh;// ֤ + private String[] xpzh;// ֤ + private String[] cspz;// ʼ + private String[] mz;// ģ + private String[] xp;// оƬ + private String[] xy;// Э + private String[] znf;// ֹ淧 + private String[] qyk;// ȡѹ + private String[] jkpm;// ƤĤ + private String[] jxwb;// е² + private String[] klc;// + private String[] jbcgfs;// ɹʽ + private String[] jbys;// ɫ + private String[] hztj;// ת + private String[] wbbj;// ⲿ + private String[] mzfc;// ַ + private String[] gdfc;// ܵ + private String[] szld;// ʱ﮵ + private String[] ddsc;// ϴ + private String[] ghzy;// ۻר + private String[] wbzlogo;// װlogo + private String[] mxts;// ÿ̨ + private String[] cpghfs;// Ʒʽ + private String[] yhfffs;// ûѷʽ + private String[] xmjl;// Ŀ + private String[] bz;// ע + private String[] sfts;// Ƿͣ + private String[] tsyy;// ͣԭ + private String[] tshxcp;// ͣۺ²Ʒ + private String[] sqrq;// + + private String[] jxhdz;// + private String[] kh;// + private String[] cpzxl; + private String[] lbdm; + private String[] lsh; + private String[] jbcj2; + + private String[] jxhdz1;// + private String[] kh1;// + private String[] cpzxl1; + private String[] lbdm1; + private String[] lsh1; + private String[] jbcj21; + //2022/11/18 + private String[] fbzh1;// ֤ + private String[] xpzh1;// ֤ + private String[] cspz1;// ʼ + private String[] mz1;// ģ + private String[] xp1;// оƬ + private String[] xy1;// Э + private String[] znf1;// ֹ淧 + private String[] qyk1;// ȡѹ + private String[] jkpm1;// ƤĤ + private String[] jxwb1;// е² + private String[] klc1;// + private String[] jbcgfs1;// ɹʽ + private String[] jbys1;// ɫ + private String[] hztj1;// ת + private String[] wbbj1;// ⲿ + private String[] mzfc1;// ַ + private String[] gdfc1;// ܵ + private String[] szld1;// ʱ﮵ + private String[] ddsc1;// ϴ + private String[] ghzy1;// ۻר + private String[] wbzlogo1;// װlogo + private String[] mxts1;// ÿ̨ + private String[] cpghfs1;// Ʒʽ + private String[] yhfffs1;// ûѷʽ + private String[] xmjl1;// Ŀ + private String[] bz1;// ע + private String[] sfts1;// Ƿͣ + private String[] tsyy1;// ͣԭ + private String[] tshxcp1;// ͣۺ²Ʒ + private String[] sqrq1;// + + public SetExcel(String path, TCComponentForm form) { + this.form = form; + try { + wb = new XSSFWorkbook(new FileInputStream(path)); + if (wb != null) { + int sheetlength = wb.getNumberOfSheets(); + List sheetNameList = new ArrayList<>(); + for (int i = 0; i < sheetlength; i++) { + sheetNameList.add(wb.getSheetName(i)); + } + for (String sheetName : sheetNameList) { + XSSFSheet sheet = wb.getSheet(sheetName); + if (sheetName.contains("ñ")) { + int cound = 45; + getList("tb1", sheet, cound); + } else if (sheetName.contains("ҵ")) { + int cound = 11; + getList("tb2", sheet, cound); + } else if (sheetName.contains("ɼ")) { + int cound = 10; + getList("tb3", sheet, cound); + } else if (sheetName.contains("")) { + int cound = 10; + getList("tb4", sheet, cound); + } else if (sheetName.contains("")) { + int cound = 9; + getList("tb5", sheet, cound); + } else if (sheetName.contains("ֵ")) { + int cound = 9; + getList("tb6", sheet, cound); + } else if (sheetName.contains("ֳֻ")) { + int cound = 9; + getList("tb7", sheet, cound); + } else if (sheetName.contains("")) { + int cound = 9; + getList("tb8", sheet, cound); + } else if (sheetName.contains("ģ")) { + int cound = 9; + getList("tb9", sheet, cound); + } else if (sheetName.contains("")) { + System.out.println("ʼ"); + int cound = 11; + getList("tb10", sheet, cound); + System.out.println("˳"); + } else if (sheetName.contains("")) { + int cound = 9; + getList("tb11", sheet, cound); + } else if (sheetName.contains("")) { + System.out.println("ʼ뱨"); + int cound = 15; + getList("tb12", sheet, cound); + System.out.println("˳뱨"); + } + + } + if (beanList != null && beanList.size() > 0) { + setForm(); + } + } else { + MessageBox.post("ģ,", "", MessageBox.ERROR); + } + + } catch (FileNotFoundException e) { + e.printStackTrace(); + MessageBox.post("ģ"+e.getMessage(), "", MessageBox.ERROR); + } catch (IOException e) { + e.printStackTrace(); + MessageBox.post("ģ"+e.getMessage(), "", MessageBox.ERROR); + } + } + + public void setForm() { + try { + lx = form.getTCProperty("jk8ProductType").getStringArrayValue(); + xmbh = form.getTCProperty("jk8ProjectNO").getStringArrayValue();// Ŀ + xmmc = form.getTCProperty("jk8ProjectName").getStringArrayValue();// Ŀ + cpxh = form.getTCProperty("jk8ProductModNO").getStringArrayValue();// Ʒͺ + sbh = form.getTCProperty("jk8ProductIdentifyNO") + .getStringArrayValue();// ʶ + cpmc = form.getTCProperty("jk8ProductName").getStringArrayValue();// Ʒ + jbcj = form.getTCProperty("jk8BaseMeterManufactor") + .getStringArrayValue();// + ickxh = form.getTCProperty("jk8ICCardType").getStringArrayValue();// ICͺ + xlbxh = form.getTCProperty("jk8CircBoardModNO") + .getStringArrayValue();// ·ͺ + cxtz = form.getTCProperty("jk8ProgramFeatures") + .getStringArrayValue();// + tdxh = form.getTCProperty("jk8InsteadType").getStringArrayValue();// ͺ + gngs = form.getTCProperty("jk8FunctionOverview") + .getStringArrayValue();// ܸ + khtsyq = form.getTCProperty("jk8CustSpecRequirements") + .getStringArrayValue();// ͻҪ + fm = form.getTCProperty("jk8Valve").getStringArrayValue();// + jmlx = form.getTCProperty("jk8EncryptType").getStringArrayValue();// + sqr = form.getTCProperty("jk8Applicant").getStringArrayValue();// + djrq = form.getTCProperty("jk8RecordDate").getStringArrayValue();// Ǽ + sysc = form.getTCProperty("jk8ApplyMarket").getStringArrayValue();// г + ptjbcj = form.getTCProperty("jk8BMManfMatched") + .getStringArrayValue();// ׻ + status = form.getTCProperty("jk8Status").getStringArrayValue();// ״̬ + fmlx = form.getTCProperty("jk8ValveType").getStringArrayValue();// + txfs = form.getTCProperty("jk8CommunicateMode").getStringArrayValue();// ͨŷʽ + gdlx = form.getTCProperty("jk8PowerSupplyMode").getStringArrayValue();// + //2019.07.31 ʹó ⲿֵĹϵ ź Ʒ + //2020.07.27 ͺʶ + //2020.8.5 + tcqt = form.getTCProperty("jk8GasType").getStringArrayValue();// + yycs=form.getTCProperty("jk8UsePlace").getStringArrayValue(); + txyn=form.getTCProperty("jk8CommunicateMode2").getStringArrayValue(); + scxh=form.getTCProperty("jk8OutputSignal").getStringArrayValue(); + sccj=form.getTCProperty("jk8Manufacturer").getStringArrayValue(); + //2022/11/18 + fbzh = form.getTCProperty("jk8FlameproofType").getStringArrayValue();// ֤ + xpzh = form.getTCProperty("jk8TypeCerNo").getStringArrayValue();// ֤ + cspz = form.getTCProperty("jk8InitConfig").getStringArrayValue();// ʼ + mz = form.getTCProperty("jk8Module").getStringArrayValue();// ģ + xp = form.getTCProperty("jk8Chip").getStringArrayValue();// оƬ + xy = form.getTCProperty("jk8Agreement").getStringArrayValue();// Э + znf = form.getTCProperty("jk8BackstopValve").getStringArrayValue();// ֹ淧 + qyk = form.getTCProperty("jk8PressureTap").getStringArrayValue();// ȡѹ + jkpm = form.getTCProperty("jk8ImpSkin").getStringArrayValue();// ƤĤ + jxwb = form.getTCProperty("jk8MechTempC").getStringArrayValue();// е² + klc = form.getTCProperty("jk8WideRange").getStringArrayValue();// + jbcgfs = form.getTCProperty("jk8BMBuy").getStringArrayValue();// ɹʽ + jbys = form.getTCProperty("jk8BMColor").getStringArrayValue();// ɫ + hztj = form.getTCProperty("jk8GyratoryVolume").getStringArrayValue();// ת + wbbj = form.getTCProperty("jk8ExAlarm").getStringArrayValue();// ⲿ + mzfc = form.getTCProperty("jk8FaceAntiRemove").getStringArrayValue();// ַ + gdfc = form.getTCProperty("jk8PipeAntiRemove").getStringArrayValue();// ܵ + szld = form.getTCProperty("jk8ClockLiBattey").getStringArrayValue();// ʱ﮵ + ddsc = form.getTCProperty("jk8UploadPowerFail").getStringArrayValue();// ϴ + ghzy = form.getTCProperty("jk8ForHK").getStringArrayValue();// ۻר + wbzlogo = form.getTCProperty("jk8PackageLogo").getStringArrayValue();// װlogo + mxts = form.getTCProperty("jk8PerBoxUnits").getStringArrayValue();// ÿ̨ + cpghfs = form.getTCProperty("jk8SupplyMode").getStringArrayValue();// Ʒʽ + yhfffs = form.getTCProperty("jk8UserPayMethod").getStringArrayValue();// ûѷʽ + xmjl = form.getTCProperty("jk8ProjectManager").getStringArrayValue();// Ŀ + bz = form.getTCProperty("jk8Remarks").getStringArrayValue();// ע + sfts = form.getTCProperty("jk8StopSale").getStringArrayValue();// Ƿͣ + tsyy = form.getTCProperty("jk8ReasonsStopSale").getStringArrayValue();// ͣԭ + tshxcp = form.getTCProperty("jk8StopSaleNewProduct").getStringArrayValue();// ͣۺ²Ʒ + sqrq = form.getTCProperty("jk8ApplyDate").getStringArrayValue();// + + jxhdz = form.getTCProperty("jk8Customized").getStringArrayValue();// ߻ + kh = form.getTCProperty("jk8Customer").getStringArrayValue();// ͻ + cpzxl = form.getTCProperty("jk8ProductFamily").getStringArrayValue();// Ʒϵ + lbdm = form.getTCProperty("jk8ContrlCompType").getStringArrayValue();// + lsh = form.getTCProperty("jk8Applicant").getStringArrayValue();//ˮ + jbcj2 = form.getTCProperty("jk8BMManufactor").getStringArrayValue();// + + + if (lx != null) { + int count = lx.length + beanList.size(); + lx1 = new String[count]; + xmmc1 = new String[count];// Ŀ + xmbh1 = new String[count];// Ŀ + cpxh1 = new String[count];// Ʒͺ + sbh1 = new String[count];// ʶ + cpmc1 = new String[count];// Ʒ + jbcj1 = new String[count];// + ickxh1 = new String[count];// ICͺ + xlbxh1 = new String[count];// ·ͺ + cxtz1 = new String[count];// + tdxh1 = new String[count];// ͺ + gngs1 = new String[count];// ܸ + khtsyq1 = new String[count];// ͻҪ + fm1 = new String[count];// + jmlx1 = new String[count];// + sqr1 = new String[count];// + djrq1 = new String[count];// Ǽ + sysc1 = new String[count];// г + ptjbcj1 = new String[count];// ׻ + status1 = new String[count];// ״̬ + fmlx1= new String[count];// " + txfs1= new String[count];// ͨŷʽ + gdlx1= new String[count];// 緽ʽ + + jxhdz1= new String[count];// " + kh1= new String[count];// ͨŷʽ + cpzxl1= new String[count];// 緽ʽ + lbdm1= new String[count];// " + lsh1= new String[count];// ͨŷʽ + jbcj21= new String[count];// 緽ʽ +// //2019.07.31 +// qtzl1 = new String[count];// +// sycs1= new String[count];// ʹó +// bjbf1= new String[count];// +// scxhzl1= new String[count];// ź +// cptzh1= new String[count];// Ʒ + + //2020.08.5 + tcqt1 = new String[count];// ̽ + yycs1 = new String[count];// Ӧó + txyn1 = new String[count];// ͨŷʽ(л) + scxh1 = new String[count];// ź + sccj1 = new String[count];// + //2022/11/18 + fbzh1 = new String[count];// ֤ + xpzh1 = new String[count];// ֤ + cspz1 = new String[count];// ʼ + mz1 = new String[count];// ģ + xp1 = new String[count];// оƬ + xy1 = new String[count];// Э + znf1 = new String[count];// ֹ淧 + qyk1 = new String[count];// ȡѹ + jkpm1 = new String[count];// ƤĤ + jxwb1 = new String[count];// е² + klc1 = new String[count];// + jbcgfs1 = new String[count];// ɹʽ + jbys1 = new String[count];// ɫ + hztj1 = new String[count];// ת + wbbj1 = new String[count];// ⲿ + mzfc1 = new String[count];// ַ + gdfc1 = new String[count];// ܵ + szld1 = new String[count];// ʱ﮵ + ddsc1 = new String[count];// ϴ + ghzy1 = new String[count];// ۻר + wbzlogo1 = new String[count];// װlogo + mxts1 = new String[count];// ÿ̨ + cpghfs1 = new String[count];// Ʒʽ + yhfffs1 = new String[count];// ûѷʽ + xmjl1 = new String[count];// Ŀ + bz1 = new String[count];// ע + sfts1 = new String[count];// Ƿͣ + tsyy1 = new String[count];// ͣԭ + tshxcp1 = new String[count];// ͣۺ²Ʒ + sqrq1 = new String[count];// + for (int i = 0; i < count; i++) { + if (i < lx.length) { + jxhdz1[i] = jxhdz[i] == null ? "" : jxhdz[i]; + kh1[i] = kh[i] == null ? "" : kh[i]; + cpzxl1[i] = cpzxl[i] == null ? "" : cpzxl[i]; + lbdm1[i] = lbdm[i] == null ? "" : lbdm[i]; + lsh1[i] = lsh[i] == null ? "" : lsh[i]; + jbcj21[i] = jbcj2[i] == null ? "" : jbcj2[i]; + + lx1[i] = lx[i] == null ? "" : lx[i]; + xmmc1[i] = xmmc[i] == null ? "" : xmmc[i]; + xmbh1[i] = xmbh[i] == null ? "" : xmbh[i]; + cpxh1[i] = cpxh[i] == null ? "" : cpxh[i]; + sbh1[i] = sbh[i] == null ? "" : sbh[i]; + cpmc1[i] = cpmc[i] == null ? "" : cpmc[i]; + jbcj1[i] = jbcj[i] == null ? "" : jbcj[i]; + ickxh1[i] = ickxh[i] == null ? "" : ickxh[i]; + xlbxh1[i] = xlbxh[i] == null ? "" : xlbxh[i]; + cxtz1[i] = cxtz[i] == null ? "" : cxtz[i]; + tdxh1[i] = tdxh[i] == null ? "" : tdxh[i]; + gngs1[i] = gngs[i] == null ? "" : gngs[i]; + khtsyq1[i] = khtsyq[i] == null ? "" : khtsyq[i]; + fm1[i] = fm[i] == null ? "" : fm[i]; + jmlx1[i] = jmlx[i] == null ? "" : jmlx[i]; + sqr1[i] = sqr[i] == null ? "" : sqr[i]; + djrq1[i] = djrq[i] == null ? "" : djrq[i]; + sysc1[i] = sysc[i] == null ? "" : sysc[i]; + ptjbcj1[i] = ptjbcj[i] == null ? "" : ptjbcj[i]; + status1[i] = status1[i] == null ? "" : status1[i]; + fmlx1[i] = fmlx1[i] == null ? "" : fmlx1[i]; + txfs1[i] = txfs1[i] == null ? "" : txfs1[i]; + gdlx1[i] = gdlx1[i] == null ? "" : gdlx1[i]; +// //2019.07.31 +// qtzl1[i] = qtzl1[i] == null ? "" : qtzl1[i]; +// sycs1[i] = sycs1[i] == null ? "" : sycs1[i]; +// bjbf1[i] = bjbf1[i] == null ? "" : bjbf1[i]; +// scxhzl1[i] = scxhzl1[i] == null ? "" : scxhzl1[i]; +// cptzh1[i] = cptzh1[i] == null ? "" : cptzh1[i]; + //2020.08.5 + tcqt1[i] = tcqt1[i] == null ? "" : tcqt1[i]; + yycs1[i] = yycs1[i] == null ? "" : yycs1[i]; + txyn1[i] = txyn1[i] == null ? "" : txyn1[i]; + scxh1[i] = scxh1[i] == null ? "" : scxh1[i]; + sccj1[i] = sccj1[i] == null ? "" : sccj1[i]; + + //2022/11/18 + fbzh1[i] = fbzh[i] == null ? "":fbzh[i];// ֤ + xpzh1[i] = xpzh[i] == null ? "":xpzh[i];// ֤ + cspz1[i] = cspz[i] == null ? "":cspz[i];// ʼ + mz1[i] = mz[i] == null ? "":mz[i];// ģ + xp1[i] = xp[i] == null ? "":xp[i];// оƬ + xy1[i] = xy[i] == null ? "":xy[i];// Э + znf1[i] = znf[i] == null ? "":znf[i];// ֹ淧 + qyk1[i] = qyk[i] == null ? "":qyk[i];// ȡѹ + jkpm1[i] = jkpm[i] == null ? "":jkpm[i];// ƤĤ + jxwb1[i] = jxwb[i] == null ? "":jxwb[i];// е² + klc1[i] = klc[i] == null ? "":klc[i];// + jbcgfs1[i] = jbcgfs[i] == null ? "":jbcgfs[i];// ɹʽ + jbys1[i] = jbys[i] == null ? "":jbys[i];// ɫ + hztj1[i] = hztj[i] == null ? "":hztj[i];// ת + wbbj1[i] = wbbj[i] == null ? "":wbbj[i];// ⲿ + mzfc1[i] = mzfc[i] == null ? "":mzfc[i];// ַ + gdfc1[i] = gdfc[i] == null ? "":gdfc[i];// ܵ + szld1[i] = szld[i] == null ? "":szld[i];// ʱ﮵ + ddsc1[i] = ddsc[i] == null ? "":ddsc[i];// ϴ + ghzy1[i] = ghzy[i] == null ? "":ghzy[i];// ۻר + wbzlogo1[i] = wbzlogo[i] == null ? "":wbzlogo[i];// װlogo + mxts1[i] = mxts[i] == null ? "":mxts[i];// ÿ̨ + cpghfs1[i] = cpghfs[i] == null ? "":cpghfs[i];// Ʒʽ + yhfffs1[i] = yhfffs[i] == null ? "":yhfffs[i];// ûѷʽ + xmjl1[i] = xmjl[i] == null ? "":xmjl[i];// Ŀ + bz1[i] = bz[i] == null ? "":bz[i];// ע + sfts1[i] = sfts[i] == null ? "":sfts[i];// Ƿͣ + tsyy1[i] = tsyy[i] == null ? "":tsyy[i];// ͣԭ + tshxcp1[i] = tshxcp[i] == null ? "":tshxcp[i];// ͣۺ²Ʒ + sqrq1[i] = sqrq[i] == null ? "":sqrq[i];// + + } else { + int j = i - lx.length; + jxhdz1[i] = beanList.get(j).getJxhdz() == null ? "" + : beanList.get(j).getJxhdz(); + kh1[i] = beanList.get(j).getKh() == null ? "" + : beanList.get(j).getKh(); + cpzxl1[i] = beanList.get(j).getCpzxl() == null ? "" + : beanList.get(j).getCpzxl(); + lbdm1[i] = beanList.get(j).getLbdm() == null ? "" + : beanList.get(j).getLbdm(); + lsh1[i] = beanList.get(j).getLsh() == null ? "" + : beanList.get(j).getLsh(); + jbcj21[i] = beanList.get(j).getJbcj2() == null ? "" + : beanList.get(j).getJbcj2(); + + lx1[i] = beanList.get(j).getLx() == null ? "" + : beanList.get(j).getLx(); + xmmc1[i] = beanList.get(j).getXmmc() == null ? "" + : beanList.get(j).getXmmc(); + xmbh1[i] = beanList.get(j).getXmbh() == null ? "" + : beanList.get(j).getXmbh(); + cpxh1[i] = beanList.get(j).getCpxh() == null ? "" + : beanList.get(j).getCpxh(); + sbh1[i] = beanList.get(j).getSbh() == null ? "" + : beanList.get(j).getSbh(); + cpmc1[i] = beanList.get(j).getCpmc() == null ? "" + : beanList.get(j).getCpmc(); + jbcj1[i] = beanList.get(j).getJbcj() == null ? "" + : beanList.get(j).getJbcj(); + ickxh1[i] = beanList.get(j).getIckxh() == null ? "" + : beanList.get(j).getIckxh(); + xlbxh1[i] = beanList.get(j).getXlbxh() == null ? "" + : beanList.get(j).getXlbxh(); + cxtz1[i] = beanList.get(j).getCxtz() == null ? "" + : beanList.get(j).getCxtz(); + tdxh1[i] = beanList.get(j).getTdxh() == null ? "" + : beanList.get(j).getTdxh(); + gngs1[i] = beanList.get(j).getGngs() == null ? "" + : beanList.get(j).getGngs(); + khtsyq1[i] = beanList.get(j).getKhtsyq() == null ? "" + : beanList.get(j).getKhtsyq(); + fm1[i] = beanList.get(j).getFm() == null ? "" + : beanList.get(j).getFm(); + jmlx1[i] = beanList.get(j).getJmlx() == null ? "" + : beanList.get(j).getJmlx(); + sqr1[i] = beanList.get(j).getSqr() == null ? "" + : beanList.get(j).getSqr(); + djrq1[i] = beanList.get(j).getDjrq() == null ? "" + : beanList.get(j).getDjrq(); + sysc1[i] = beanList.get(j).getSysc() == null ? "" + : beanList.get(j).getSysc(); + ptjbcj1[i] = beanList.get(j).getPtjbcj() == null ? "" + : beanList.get(j).getPtjbcj(); + + status1[i] = beanList.get(j).getStatus() == null ? "" + : beanList.get(j).getStatus(); + fmlx1[i] = beanList.get(j).getFmlx() == null ? "" + : beanList.get(j).getFmlx(); + txfs1[i] = beanList.get(j).getTxfs() == null ? "" + : beanList.get(j).getTxfs(); + gdlx1[i] = beanList.get(j).getGdlx()== null ? "" + : beanList.get(j).getGdlx(); + + //2019.07.31 + //2020.8.5 + tcqt1[i] = beanList.get(j).getTcqt() == null ? "" + : beanList.get(j).getTcqt(); + yycs1[i] = beanList.get(j).getYycs() == null ? "" + : beanList.get(j).getYycs(); + txyn1[i] = beanList.get(j).getTxyn() == null ? "" + : beanList.get(j).getTxyn(); + scxh1[i] = beanList.get(j).getScxh() == null ? "" + : beanList.get(j).getScxh(); + sccj1[i] = beanList.get(j).getSccj() == null ? "" + : beanList.get(j).getSccj(); + + //2022/11/18 + fbzh1[i] = beanList.get(j).getFbzh() == null ? "":beanList.get(j).getFbzh();// ֤ + xpzh1[i] = beanList.get(j).getXpzh() == null ? "":beanList.get(j).getXpzh();// ֤ + cspz1[i] = beanList.get(j).getCspz() == null ? "":beanList.get(j).getCspz();// ʼ + mz1[i] = beanList.get(j).getMz() == null ? "":beanList.get(j).getMz();// ģ + xp1[i] = beanList.get(j).getXp() == null ? "":beanList.get(j).getXp();// оƬ + xy1[i] = beanList.get(j).getXy() == null ? "":beanList.get(j).getXy();// Э + znf1[i] = beanList.get(j).getZnf() == null ? "":beanList.get(j).getZnf();// ֹ淧 + qyk1[i] = beanList.get(j).getQyk() == null ? "":beanList.get(j).getQyk();// ȡѹ + jkpm1[i] = beanList.get(j).getJkpm() == null ? "":beanList.get(j).getJkpm();// ƤĤ + jxwb1[i] = beanList.get(j).getJxwb() == null ? "":beanList.get(j).getJxwb();// е² + klc1[i] = beanList.get(j).getKlc() == null ? "":beanList.get(j).getKlc();// + jbcgfs1[i] = beanList.get(j).getJbcgfs() == null ? "":beanList.get(j).getJbcgfs();// ɹʽ + jbys1[i] = beanList.get(j).getJbys() == null ? "":beanList.get(j).getJbys();// ɫ + hztj1[i] = beanList.get(j).getHztj() == null ? "":beanList.get(j).getHztj();// ת + wbbj1[i] = beanList.get(j).getWbbj() == null ? "":beanList.get(j).getWbbj();// ⲿ + mzfc1[i] = beanList.get(j).getMzfc() == null ? "":beanList.get(j).getMzfc();// ַ + gdfc1[i] = beanList.get(j).getGdfc() == null ? "":beanList.get(j).getGdfc();// ܵ + szld1[i] = beanList.get(j).getSzld() == null ? "":beanList.get(j).getSzld();// ʱ﮵ + ddsc1[i] = beanList.get(j).getDdsc() == null ? "":beanList.get(j).getDdsc();// ϴ + ghzy1[i] = beanList.get(j).getGhzy() == null ? "":beanList.get(j).getGhzy();// ۻר + wbzlogo1[i] = beanList.get(j).getWbzlogo() == null ? "":beanList.get(j).getWbzlogo();// װlogo + mxts1[i] = beanList.get(j).getMxts() == null ? "":beanList.get(j).getMxts();// ÿ̨ + cpghfs1[i] = beanList.get(j).getCpghfs() == null ? "":beanList.get(j).getCpghfs();// Ʒʽ + yhfffs1[i] = beanList.get(j).getYhfffs() == null ? "":beanList.get(j).getYhfffs();// ûѷʽ + xmjl1[i] = beanList.get(j).getXmjl() == null ? "":beanList.get(j).getXmjl();// Ŀ + bz1[i] = beanList.get(j).getBz() == null ? "":beanList.get(j).getBz();// ע + sfts1[i] = beanList.get(j).getSfts() == null ? "":beanList.get(j).getSfts();// Ƿͣ + tsyy1[i] = beanList.get(j).getTsyy() == null ? "":beanList.get(j).getTsyy();// ͣԭ + tshxcp1[i] = beanList.get(j).getTshxcp() == null ? "":beanList.get(j).getTshxcp();// ͣۺ²Ʒ + sqrq1[i] = beanList.get(j).getSqrq() == null ? "":beanList.get(j).getSqrq();// + + } + + } + + form.getTCProperty("jk8Customized").setStringValueArray(jxhdz1); + form.getTCProperty("jk8Customer").setStringValueArray(kh1); + form.getTCProperty("jk8ProductFamily").setStringValueArray(cpzxl1);// + form.getTCProperty("jk8ContrlCompType").setStringValueArray(lbdm1); + form.getTCProperty("jk8Applicant").setStringValueArray(lsh1); + form.getTCProperty("jk8BMManufactor").setStringValueArray(jbcj21);// + + form.getTCProperty("jk8ProjectName").setStringValueArray(xmmc1); + form.getTCProperty("jk8ProjectNO").setStringValueArray(xmbh1); + form.getTCProperty("jk8ProductType").setStringValueArray(lx1);// + form.getTCProperty("jk8ProductModNO") + .setStringValueArray(cpxh1); + form.getTCProperty("jk8ProductIdentifyNO").setStringValueArray( + sbh1); + form.getTCProperty("jk8ProductName").setStringValueArray(cpmc1); + form.getTCProperty("jk8BaseMeterManufactor") + .setStringValueArray(jbcj1); + form.getTCProperty("jk8ICCardType").setStringValueArray(ickxh1); + form.getTCProperty("jk8CircBoardModNO").setStringValueArray( + xlbxh1); + form.getTCProperty("jk8ProgramFeatures").setStringValueArray( + cxtz1); + form.getTCProperty("jk8InsteadType").setStringValueArray(tdxh1); + form.getTCProperty("jk8FunctionOverview").setStringValueArray( + gngs1); + form.getTCProperty("jk8CustSpecRequirements") + .setStringValueArray(khtsyq1); + // form.getTCProperty("jk8U8NO").setStringValueArray(u8mmh1); + form.getTCProperty("jk8Valve").setStringValueArray(fm1); + form.getTCProperty("jk8EncryptType").setStringValueArray(jmlx1); + form.getTCProperty("jk8Applicant").setStringValueArray(sqr1); + form.getTCProperty("jk8RecordDate").setStringValueArray(djrq1); + form.getTCProperty("jk8ApplyMarket").setStringValueArray(sysc1); + form.getTCProperty("jk8BMManfMatched").setStringValueArray( + ptjbcj1); + + form.getTCProperty("jk8Status").setStringValueArray(status1); //״̬jk8Status + form.getTCProperty("jk8ValveType").setStringValueArray(fmlx1); + form.getTCProperty("jk8CommunicateMode").setStringValueArray(txfs1); + form.getTCProperty("jk8PowerSupplyMode").setStringValueArray(gdlx1); + //2019.07.31 +// form.getTCProperty("jk8GasType").setStringValueArray(qtzl1); // +// form.getTCProperty("jk8UsePlace").setStringValueArray(sycs1); +// form.getTCProperty("jk8AlaDectRelation").setStringValueArray(bjbf1); +// form.getTCProperty("jk8OutputSignal").setStringValueArray(scxhzl1); +// form.getTCProperty("jk8ProFeatNum").setStringValueArray(cptzh1); + //2020.8.5 + form.getTCProperty("jk8GasType").setStringValueArray(tcqt1); // + form.getTCProperty("jk8UsePlace").setStringValueArray(yycs1); + form.getTCProperty("jk8CommunicateMode2").setStringValueArray(txyn1); + form.getTCProperty("jk8OutputSignal").setStringValueArray(scxh1); + form.getTCProperty("jk8Manufacturer").setStringValueArray(sccj1); + //2022/11/18 + form.getTCProperty("jk8FlameproofType").setStringValueArray(fbzh1);// ֤ + form.getTCProperty("jk8TypeCerNo").setStringValueArray(xpzh1);// ֤ + form.getTCProperty("jk8InitConfig").setStringValueArray(cspz1);// ʼ + form.getTCProperty("jk8Module").setStringValueArray(mz1);// ģ + form.getTCProperty("jk8Chip").setStringValueArray(xp1);// оƬ + form.getTCProperty("jk8Agreement").setStringValueArray(xy1);// Э + form.getTCProperty("jk8BackstopValve").setStringValueArray(znf1);// ֹ淧 + form.getTCProperty("jk8PressureTap").setStringValueArray(qyk1);// ȡѹ + form.getTCProperty("jk8ImpSkin").setStringValueArray(jkpm1);// ƤĤ + form.getTCProperty("jk8MechTempC").setStringValueArray(jxwb1);// е² + form.getTCProperty("jk8WideRange").setStringValueArray(klc1);// + form.getTCProperty("jk8BMBuy").setStringValueArray(jbcgfs1);// ɹʽ + form.getTCProperty("jk8BMColor").setStringValueArray(jbys1);// ɫ + form.getTCProperty("jk8GyratoryVolume").setStringValueArray(hztj1);// ת + form.getTCProperty("jk8ExAlarm").setStringValueArray(wbbj1);// ⲿ + form.getTCProperty("jk8FaceAntiRemove").setStringValueArray(mzfc1);// ַ + form.getTCProperty("jk8PipeAntiRemove").setStringValueArray(gdfc1);// ܵ + form.getTCProperty("jk8ClockLiBattey").setStringValueArray(szld1);// ʱ﮵ + form.getTCProperty("jk8UploadPowerFail").setStringValueArray(ddsc1);// ϴ + form.getTCProperty("jk8ForHK").setStringValueArray(ghzy1);// ۻר + form.getTCProperty("jk8PackageLogo").setStringValueArray(wbzlogo1);// װlogo + form.getTCProperty("jk8PerBoxUnits").setStringValueArray(mxts1);// ÿ̨ + form.getTCProperty("jk8SupplyMode").setStringValueArray(cpghfs1);// Ʒʽ + form.getTCProperty("jk8UserPayMethod").setStringValueArray(yhfffs1);// ûѷʽ + form.getTCProperty("jk8ProjectManager").setStringValueArray(xmjl1);// Ŀ + form.getTCProperty("jk8Remarks").setStringValueArray(bz1);// ע + form.getTCProperty("jk8StopSale").setStringValueArray(sfts1);// Ƿͣ + form.getTCProperty("jk8ReasonsStopSale").setStringValueArray(tsyy1);// ͣԭ + form.getTCProperty("jk8StopSaleNewProduct").setStringValueArray(tshxcp1);// ͣۺ²Ʒ + form.getTCProperty("jk8ApplyDate").setStringValueArray(sqrq1);// + } + } catch (TCException e) { + e.printStackTrace(); + MessageBox.post("ģ"+e.getMessage(), "", MessageBox.ERROR); + } + + } + + public void getList(String lx, XSSFSheet sheet, int cound) { + int rowSize = sheet.getLastRowNum() + 1; + for (int i = 1; i < rowSize; i++) { + XSSFRow row = sheet.getRow(i); + if (row == null) {// Թ + continue; + } + List list = new ArrayList<>(); + for (int j = 0; j < cound; j++) { + XSSFCell cell = row.getCell(j); + System.out.println("cell=" + cell); + if (cell != null) { + list.add(cell.toString()); + } else { + list.add(""); + } + } + boolean is = true; + FormBean bean = new FormBean(); + bean.setLx(lx); + if (lx.equals("tb1")) { + if (list.get(2) == null || list.get(2).equals("")) { + is = false; + } + bean.setSbh(list.get(0));// ʶ + bean.setJxhdz(list.get(1)); + bean.setKh(list.get(2)); + bean.setCpmc(list.get(3));// Ʒ + bean.setCpxh(list.get(4)); + bean.setFbzh(list.get(5));// ֤ + bean.setXpzh(list.get(6));// ֤ + bean.setCpzxl(list.get(7));// ʼ + bean.setCspz(list.get(8)); + bean.setMz(list.get(9));// ģ + bean.setXp(list.get(10));// оƬ + bean.setXy(list.get(11));// Э + bean.setLx(list.get(12)); + bean.setLbdm(list.get(13)); + + bean.setJbcj2(list.get(14)); + bean.setZnf(list.get(15));// ֹ淧 + bean.setQyk(list.get(16));// ȡѹ + bean.setJkpm(list.get(17));// ƤĤ + bean.setJxwb(list.get(18));// е² + bean.setKlc(list.get(19));// + bean.setJbcgfs(list.get(20));// ɹʽ + // bean.setKhtsyq(list.get(14));//ͻҪ + bean.setJbys(list.get(21));// ɫ + bean.setHztj(list.get(22));// ת + bean.setGhzy(list.get(23));// ۻר + bean.setFm(list.get(24));// + bean.setSzld(list.get(25));// ʱ﮵ + bean.setWbbj(list.get(26));// ⲿ + bean.setMzfc(list.get(27));// ַ + bean.setGdfc(list.get(28));// ܵ + + bean.setDdsc(list.get(29));// ϴ + + bean.setWbzlogo(list.get(30));// װlogo + bean.setMxts(list.get(31));// ÿ̨ + bean.setCpghfs(list.get(32));// Ʒʽ + bean.setYhfffs(list.get(33));// ûѷʽ + bean.setIckxh(list.get(34));// ICͺ + bean.setJmlx(list.get(35));// + bean.setXmmc(list.get(36));// Ŀ + bean.setXmbh(list.get(37));// Ŀ + bean.setXmjl(list.get(38));// Ŀ + bean.setBz(list.get(39));// ע + bean.setTsyy(list.get(40));// ͣԭ + bean.setTshxcp(list.get(41));// ͣۺ²Ʒ + bean.setSfts(list.get(42));// Ƿͣ + bean.setLsh(list.get(43)); + bean.setSqrq(list.get(44));// + } else if (lx.equals("tb2")) { + if (list.get(2) == null || list.get(2).equals("")) { + is = false; + } + bean.setXmmc(list.get(0));// Ŀ + bean.setXmbh(list.get(1));// Ŀ + bean.setCpxh(list.get(2));// Ʒͺ + bean.setSbh(list.get(3));// ʶ + bean.setCpmc(list.get(4));// Ʒ + bean.setXlbxh(list.get(5));// ·ͺ + bean.setGngs(list.get(6));// ܸ + bean.setTdxh(list.get(7));// ͺ + bean.setSqr(list.get(8));// + bean.setDjrq(list.get(9));// Ǽ + bean.setStatus(list.get(10));// ״̬ + } else if (lx.equals("tb3")) { + if (list.get(2) == null || list.get(2).equals("")) { + is = false; + } + bean.setXmmc(list.get(0));// Ŀ + bean.setXmbh(list.get(1));// Ŀ + bean.setCpxh(list.get(2));// Ʒͺ + bean.setSbh(list.get(3));// ʶ + bean.setCpmc(list.get(4));// Ʒ + bean.setGngs(list.get(5));// ܸ + bean.setSysc(list.get(6));// г + bean.setSqr(list.get(7));// + bean.setDjrq(list.get(8));// Ǽ + bean.setStatus(list.get(9));// ״̬ + } else if (lx.equals("tb4")) { + if (list.get(3) == null || list.get(3).equals("")) { + is = false; + } + bean.setXmmc(list.get(0));// Ŀ + bean.setXmbh(list.get(1));// Ŀ + bean.setCpxh(list.get(2));// Ʒͺ + bean.setSbh(list.get(3));// ʶ + bean.setCpmc(list.get(4));// Ʒ + bean.setPtjbcj(list.get(5));// ׻ + bean.setGngs(list.get(6));// ܸ + bean.setSqr(list.get(7));// + bean.setDjrq(list.get(8));// Ǽ + bean.setStatus(list.get(9));// ״̬ + } else if (lx.equals("tb10")) { + System.out.println("================"+bean); + if (list.get(3) == null || list.get(3).equals("")) { + is = false; + } + bean.setXmmc(list.get(0));// Ŀ + bean.setXmbh(list.get(1));// Ŀ + bean.setCpxh(list.get(2));// Ʒͺ + bean.setSbh(list.get(3));// ʶ + bean.setCpmc(list.get(4));// Ʒ + + bean.setFmlx(list.get(5)); + bean.setTxfs(list.get(6)); + bean.setGdlx(list.get(7)); + + bean.setSqr(list.get(8));// + bean.setDjrq(list.get(9));// Ǽ + bean.setStatus(list.get(10));// ״̬ + + }else if (lx.equals("tb12")) { + if (list.get(2) == null || list.get(2).equals("")) { + is = false; + } + //ʶ +// "Ŀ", "Ŀ", "Ʒ",//3 +// "Ʒͺ", "Ӧó","̽","","ͨŷʽ(л)","ͨŷʽ","緽ʽ","ź","ʶ","״̬" + bean.setXmmc(list.get(0));// Ŀ + bean.setXmbh(list.get(1));// Ŀ + bean.setCpmc(list.get(2));// Ʒ + bean.setCpxh(list.get(3));// Ʒͺ + + bean.setYycs(list.get(4)); + bean.setTcqt(list.get(5)); + bean.setSccj(list.get(6)); + bean.setTxyn(list.get(7)); + bean.setTxfs(list.get(8)); + bean.setGdlx(list.get(9)); + bean.setScxh(list.get(10)); + bean.setSbh(list.get(11)); +// bean.setQtzl(list.get(4));// +// +// bean.setSycs(list.get(5));//ʹó +// bean.setBjbf(list.get(6));// +// bean.setScxhzl(list.get(7));//ź +// bean.setCptzh(list.get(8));//Ʒ +// + bean.setSqr(list.get(12));// + bean.setDjrq(list.get(13));// Ǽ + bean.setStatus(list.get(14));// ״̬ + + + + System.out.println("================"+bean); + + }else { + if (list.get(2) == null || list.get(2).equals("")) { + is = false; + } + bean.setXmmc(list.get(0));// Ŀ + bean.setXmbh(list.get(1));// Ŀ + bean.setCpmc(list.get(2));// Ʒ + bean.setCpxh(list.get(3));// Ʒͺ + bean.setSbh(list.get(4));// ʶ + bean.setGngs(list.get(5));// ܸ + bean.setSqr(list.get(6));// + bean.setDjrq(list.get(7));// Ǽ + bean.setStatus(list.get(8));// ״̬ + + } + if (is) { + beanList.add(bean); + System.out.println(bean); + } + + } + } + +} diff --git a/src/com/connor/jk/plm/imp/bom/ImportBOM_Action.java b/src/com/connor/jk/plm/imp/bom/ImportBOM_Action.java new file mode 100644 index 0000000..4323426 --- /dev/null +++ b/src/com/connor/jk/plm/imp/bom/ImportBOM_Action.java @@ -0,0 +1,27 @@ +package com.connor.jk.plm.imp.bom; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.common.actions.AbstractAIFAction; + +public class ImportBOM_Action extends AbstractAIFAction { + + private AbstractAIFApplication app; + public ImportBOM_Action(AbstractAIFApplication arg0, String arg1) { + super(arg0, arg1); + // TODO Auto-generated constructor stub + this.app=arg0; + } + + @Override + public void run() { + // TODO Auto-generated method stub + ImportBOM_Command ic=new ImportBOM_Command(app); + try { + ic.executeModal(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + +} diff --git a/src/com/connor/jk/plm/imp/bom/ImportBOM_Command.java b/src/com/connor/jk/plm/imp/bom/ImportBOM_Command.java new file mode 100644 index 0000000..26b3858 --- /dev/null +++ b/src/com/connor/jk/plm/imp/bom/ImportBOM_Command.java @@ -0,0 +1,19 @@ +package com.connor.jk.plm.imp.bom; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.AbstractAIFCommand; + +public class ImportBOM_Command extends AbstractAIFCommand { + + private AbstractAIFApplication app; + public ImportBOM_Command(AbstractAIFApplication app){ + this.app = app; + } + @Override + public void executeModal() throws Exception { + // TODO Auto-generated method stub + super.executeModal(); + ImportBOM_Dialog dialog = new ImportBOM_Dialog(app); + new Thread(dialog).start(); + } +} diff --git a/src/com/connor/jk/plm/imp/bom/ImportBOM_Dialog.java b/src/com/connor/jk/plm/imp/bom/ImportBOM_Dialog.java new file mode 100644 index 0000000..713007c --- /dev/null +++ b/src/com/connor/jk/plm/imp/bom/ImportBOM_Dialog.java @@ -0,0 +1,153 @@ +package com.connor.jk.plm.imp.bom; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.File; + +import javax.swing.BorderFactory; +import javax.swing.JButton; +import javax.swing.JFileChooser; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; +import javax.swing.border.TitledBorder; +import javax.swing.filechooser.FileSystemView; + + +import com.connor.jk.plm.bom.until.ProgressBarThread; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponentFolder; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; + +public class ImportBOM_Dialog extends AbstractAIFDialog { + + private AbstractAIFApplication app; + private TCSession session; + private InterfaceAIFComponent targetComp; + + private ProgressBarThread wait; + private JTextField textField; + private JButton okButton; + private JButton celButton; + private JButton pathButton; + private JFileChooser jFileChooser;//ļѡ + + public ImportBOM_Dialog(AbstractAIFApplication app) { + // TODO Auto-generated constructor stub + this.app = app; + this.session = (TCSession) app.getSession(); + this.targetComp = app.getTargetComponent(); + } + + @Override + public void run() { + // TODO Auto-generated method stub + super.run(); + initUI(); + } + + private void initUI() { + // TODO Auto-generated method stub + FileSystemView fsv = FileSystemView.getFileSystemView(); // õϵͳfileview + String deskPath = fsv.getHomeDirectory().getPath(); // ǰû· + + this.setSize( new Dimension(600, 400)); + this.setTitle("bom"); + this.textField = new JTextField(deskPath); + + jFileChooser = new JFileChooser(); + this.jFileChooser.setCurrentDirectory(new File(deskPath));// ļѡijʼĿ¼Ϊǰû + this.jFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); + + this.pathButton = new JButton("..."); + this.okButton = new JButton("ȷ"); + this.celButton = new JButton("ȡ"); + pathButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + selectFileButtonEvent(); + } + }); + okButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + okEvent(); + } + }); + celButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + disposeDialog(); + dispose(); + } + }); + + + JPanel midJPanel = new JPanel(new PropertyLayout()); + midJPanel.setBorder(new TitledBorder(BorderFactory.createLineBorder(Color.WHITE), "ѡģ")); //߿ TitleBorder + midJPanel.add("1.1.left.top", new JLabel(" ")); + midJPanel.add("2.1.left.top", new JLabel("ģ·")); + midJPanel.add("2.2.left.top", this.textField); + midJPanel.add("2.3.left.top", this.pathButton); + midJPanel.add("3.1.left.top", new JLabel(" ")); + JPanel rootJPanel = new JPanel(new FlowLayout()); + rootJPanel.add(this.okButton); + rootJPanel.add(this.celButton); + + + this.setLayout(new BorderLayout()); + this.add(midJPanel, BorderLayout.CENTER); + this.add(rootJPanel, BorderLayout.SOUTH); + + this.centerToScreen(); + this.pack(); + this.setVisible(true); + this.showDialog(); + } + + public void selectFileButtonEvent() { + int state = jFileChooser.showOpenDialog(null);// ˾ǴļѡĴ + if (state == 1) { + return; + } else { + File f = jFileChooser.getSelectedFile();// fΪѡ񵽵Ŀ¼ + textField.setText(f.getAbsolutePath()); + } + } + + public void okEvent(){ + if (targetComp instanceof TCComponentFolder) { + disposeDialog(); + dispose(); + wait = new ProgressBarThread("BOMϢ","ȡУԵ..."); + wait.start(); + + try { + String pathfield = this.textField.getText(); + ImportBOM_Operation operation = new ImportBOM_Operation(pathfield, session, targetComp, wait, this); + operation.executeOperation(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + }else{ + MessageBox.post("ѡļж.", "", MessageBox.ERROR); + } + } + +} diff --git a/src/com/connor/jk/plm/imp/bom/ImportBOM_Operation.java b/src/com/connor/jk/plm/imp/bom/ImportBOM_Operation.java new file mode 100644 index 0000000..b811967 --- /dev/null +++ b/src/com/connor/jk/plm/imp/bom/ImportBOM_Operation.java @@ -0,0 +1,171 @@ +package com.connor.jk.plm.imp.bom; + +import java.io.File; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.connor.jk.plm.bom.until.ExcelUtil; +import com.connor.jk.plm.bom.until.ExcelUtil07; +import com.connor.jk.plm.bom.until.ProgressBarThread; +import com.teamcenter.rac.aif.AbstractAIFOperation; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCClassificationService; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentICO; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemType; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.kernel.ics.ICSApplicationObject; +import com.teamcenter.rac.kernel.ics.ICSProperty; +import com.teamcenter.rac.kernel.ics.ICSPropertyDescription; +import com.teamcenter.rac.kernel.ics.ICSView; +import com.teamcenter.rac.util.MessageBox; + +public class ImportBOM_Operation extends AbstractAIFOperation { + + private TCSession session; + private InterfaceAIFComponent targetComp; + private ProgressBarThread wait; + private String pathField; + private ImportBOM_Dialog dialog; + private File pathfile; + private String xls = "xls"; + private String xlsx = "xlsx"; + + public ImportBOM_Operation(String pathfield, TCSession session, + InterfaceAIFComponent targetComp, ProgressBarThread wait, + ImportBOM_Dialog importBOM_Dialog) { + // TODO Auto-generated constructor stub + + } + + @Override + public void executeOperation() throws Exception { + // TODO Auto-generated method stub + + this.pathfile = new File(pathField); + List> excelvaluelist = new ArrayList>(); + if (!this.pathField.endsWith(this.xls) + && !this.pathField.endsWith(this.xlsx)) { + MessageBox + .post("ѡеIJexcelļѡexcelļ", "", MessageBox.WARNING); + return; + } + + if (this.pathField.endsWith(this.xls)) { + ExcelUtil excelutil = new ExcelUtil(); + excelvaluelist = excelutil.readExcel(this.pathfile); + } + if (this.pathField.endsWith(this.xlsx)) { + ExcelUtil07 excelutil = new ExcelUtil07(); + excelvaluelist = excelutil.readExcel(this.pathfile); + } + if (excelvaluelist != null) { + for (int i = 0; i < excelvaluelist.size(); i++) { + TCComponentItemType itemType = (TCComponentItemType) session + .getTypeComponent("JK8Material"); + // ȡԪ + String level = excelvaluelist.get(i).get(0); // bom㼶 + String JKId = excelvaluelist.get(i).get(1); // id + String JKName = excelvaluelist.get(i).get(2); // + String JKQuantity = excelvaluelist.get(i).get(3); // + String JKUom = excelvaluelist.get(i).get(4); // λ + String JKBaseQuantity = excelvaluelist.get(i).get(5); // + String JKSDate = excelvaluelist.get(i).get(6); // Ч + String JKEDate = excelvaluelist.get(i).get(7); // ʧЧ + String JKSupplyType = excelvaluelist.get(i).get(8); // Ӧ + String JKWarehouse = excelvaluelist.get(i).get(9); // ֿ + String JKSubstitMaterial = excelvaluelist.get(i).get(10); // + String JKSubstitOrder = excelvaluelist.get(i).get(11); // + String JKSubstitRatio = excelvaluelist.get(i).get(12); // + String JKRemarkDesc = excelvaluelist.get(i).get(13); // ע˵ + + if ("".equals(level) || level == null) { + break; + } + if (level.startsWith("+")) { + level = level.length() + ""; + } + + } + + } + } + + public InterfaceAIFComponent[] getItemResult(String string0) { + + String[] names = { "ID" }; + String[] values = { string0 }; + + // òѯ + + InterfaceAIFComponent[] resultCompS = SearchUtility + .searchComponentsCollection(session, "ѯ", names, values); + + return resultCompS; + } + + public void classify() throws TCException { + + List childItemList = new ArrayList<>(); + Map childMap = null; + List valueList = null; + String value = ""; + // TODO Auto-generated method stub + // ޸߼ + TCComponentItem childItem = childItemList.get(0); + + TCComponentICO[] icoS = childItem.getClassificationObjects(); + //childItem.getLatestItemRevision().getClassificationClass(); + String str=childItem.getClassificationClass(); + if (icoS == null || icoS.length == 0) { + icoS = childItem.getLatestItemRevision().getClassificationObjects(); + if (icoS == null || icoS.length == 0) { + } + // continue; + } + + for (TCComponentICO cIco : icoS) { + System.out.println(value + "^" + cIco.getId()); + if (childMap.containsKey(value + "^" + cIco.getId()) + && !valueList.contains(value + "^" + cIco.getId())) { + + Map classAttrS = new HashMap<>(); + + ICSProperty[] cPropS = cIco.getICSProperties(true); + for (ICSProperty prop : cPropS) { + classAttrS.put(prop.getId(), prop.getValue()); + } + } + } + + } + + public void createICS(String class_id, TCComponentItem target, + String partid, Integer[] integers, String[] vals) + throws TCException { + + TCClassificationService myService = session.getClassificationService(); + + ICSApplicationObject icsAppObj = myService + .newICSApplicationObject("ICM"); + + icsAppObj.create(partid, target.getUid()); + icsAppObj.setView(class_id); + ICSView icsview = icsAppObj.getView(); + ICSPropertyDescription icsproperty[] = icsview + .getPropertyDescriptions(); + ICSProperty icspro[] = new ICSProperty[integers.length]; + + for (int i = 0; i < icspro.length; i++) { + System.out.println(" CLASS ID = " + integers[i] + " =" + vals[i]); + icspro[i] = new ICSProperty(integers[i], vals[i]); + } + icsAppObj.setProperties(icspro); + icsAppObj.save(); + } + +} diff --git a/src/com/connor/jk/plm/imp/bom/PropertyBean.java b/src/com/connor/jk/plm/imp/bom/PropertyBean.java new file mode 100644 index 0000000..c778024 --- /dev/null +++ b/src/com/connor/jk/plm/imp/bom/PropertyBean.java @@ -0,0 +1,5 @@ +package com.connor.jk.plm.imp.bom; + +public class PropertyBean { + +} diff --git a/src/com/connor/jk/plm/imp/bom/SearchUtility.java b/src/com/connor/jk/plm/imp/bom/SearchUtility.java new file mode 100644 index 0000000..c681dbc --- /dev/null +++ b/src/com/connor/jk/plm/imp/bom/SearchUtility.java @@ -0,0 +1,62 @@ +package com.connor.jk.plm.imp.bom; + +import com.teamcenter.rac.aif.AIFDesktop; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponentContextList; +import com.teamcenter.rac.kernel.TCComponentQuery; +import com.teamcenter.rac.kernel.TCComponentQueryType; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.kernel.TCTextService; +import com.teamcenter.rac.util.MessageBox; + +public class SearchUtility { + + public static InterfaceAIFComponent[] searchComponentsCollection( + TCSession session, String searchName, String[] keys, String[] values) { + // Ϣ + InterfaceAIFComponent[] result = new InterfaceAIFComponent[0]; + + try { + TCTextService textService = session.getTextService(); + TCComponentQueryType querytype = (TCComponentQueryType) session + .getTypeComponent("ImanQuery"); + TCComponentQuery query = (TCComponentQuery) querytype + .find(searchName); + + System.out.println("query="+query); +// String[] as = new String[keys.length]; +// for (int i = 0; i < keys.length; i++) { +// as[i] = textService.getTextValue(keys[i]); +// } + + // String[] as1 = new String[values.length]; + // for (int i = 0; i < values.length; i++) { + // as1[i] = textService.getTextValue(values[i]); + // } + if (query == null) { + MessageBox.post("ûвҵ" + searchName + "ѯ", "", 0); + return null; + } + query.clearCache(); + TCComponentContextList list = query.getExecuteResultsList(keys, + values); + if (list != null) { + int count = list.getListCount(); + result = new InterfaceAIFComponent[count]; + + for (int i = 0; i < count; i++) { + result[i] = list.get(i).getComponent(); + } + } + } catch (TCException e) { + + e.printStackTrace(); + MessageBox.post(AIFDesktop.getActiveDesktop().getShell(), "ͨѯ" + + searchName + "ѯ.", "", 1); + + } + + return result; + } +} diff --git a/src/com/connor/jk/plm/importPCB/FormBean.java b/src/com/connor/jk/plm/importPCB/FormBean.java new file mode 100644 index 0000000..71f5a47 --- /dev/null +++ b/src/com/connor/jk/plm/importPCB/FormBean.java @@ -0,0 +1,199 @@ +package com.connor.jk.plm.importPCB; + +public class FormBean { + private String jk8Projectname;//Ŀ + private String jk8Companylogo;//˾ʶ + private String jk8MeasureType;//ԭ + private String jk8CommunicateMode;//ͨѶʽ + private String jk8Application;//Ӧ÷Χ + private String jk8Revisionlevel;//汾ʶ + private String jk8PCBNO;//PCB + + public String getJk8Projectname() { + return jk8Projectname; + } + public void setJk8Projectname(String jk8Projectname) { + this.jk8Projectname = jk8Projectname; + } + public String getJk8Companylogo() { + return jk8Companylogo; + } + public void setJk8Companylogo(String jk8Companylogo) { + this.jk8Companylogo = jk8Companylogo; + } + public String getJk8MeasureType() { + return jk8MeasureType; + } + public void setJk8MeasureType(String jk8MeasureType) { + this.jk8MeasureType = jk8MeasureType; + } + public String getJk8CommunicateMode() { + return jk8CommunicateMode; + } + public void setJk8CommunicateMode(String jk8CommunicateMode) { + this.jk8CommunicateMode = jk8CommunicateMode; + } + public String getJk8Application() { + return jk8Application; + } + public void setJk8Application(String jk8Application) { + this.jk8Application = jk8Application; + } + public String getJk8Revisionlevel() { + return jk8Revisionlevel; + } + public void setJk8Revisionlevel(String jk8Revisionlevel) { + this.jk8Revisionlevel = jk8Revisionlevel; + } + public String getJk8PCBNO() { + return jk8PCBNO; + } + public void setJk8PCBNO(String jk8pcbno) { + jk8PCBNO = jk8pcbno; + } + private String lx;//Ʒ + private String xmmc;// Ŀ + private String xmbh;//Ŀ + private String cpxh;// Ʒͺ + private String sbh;// ʶ + private String cpmc;// Ʒ + private String jbcj;// + private String ickxh;// ICͺ + private String xlbxh;// ·ͺ + private String cxtz;// + private String tdxh;// ͺ + private String gngs;// ܸ + private String khtsyq;// ͻҪ + private String fm;// + private String jmlx;// + private String sqr;// + private String djrq;// Ǽ + private String sysc;// г + private String ptjbcj;// ׻ + public String getLx() { + return lx; + } + public void setLx(String lx) { + this.lx = lx; + } + public String getXmmc() { + return xmmc; + } + public void setXmmc(String xmmc) { + this.xmmc = xmmc; + } + public String getXmbh() { + return xmbh; + } + public void setXmbh(String xmbh) { + this.xmbh = xmbh; + } + public String getCpxh() { + return cpxh; + } + public void setCpxh(String cpxh) { + this.cpxh = cpxh; + } + public String getSbh() { + return sbh; + } + public void setSbh(String sbh) { + this.sbh = sbh; + } + public String getCpmc() { + return cpmc; + } + public void setCpmc(String cpmc) { + this.cpmc = cpmc; + } + public String getJbcj() { + return jbcj; + } + public void setJbcj(String jbcj) { + this.jbcj = jbcj; + } + public String getIckxh() { + return ickxh; + } + public void setIckxh(String ickxh) { + this.ickxh = ickxh; + } + public String getXlbxh() { + return xlbxh; + } + public void setXlbxh(String xlbxh) { + this.xlbxh = xlbxh; + } + public String getCxtz() { + return cxtz; + } + public void setCxtz(String cxtz) { + this.cxtz = cxtz; + } + public String getTdxh() { + return tdxh; + } + public void setTdxh(String tdxh) { + this.tdxh = tdxh; + } + public String getGngs() { + return gngs; + } + public void setGngs(String gngs) { + this.gngs = gngs; + } + public String getKhtsyq() { + return khtsyq; + } + public void setKhtsyq(String khtsyq) { + this.khtsyq = khtsyq; + } + public String getFm() { + return fm; + } + public void setFm(String fm) { + this.fm = fm; + } + public String getJmlx() { + return jmlx; + } + public void setJmlx(String jmlx) { + this.jmlx = jmlx; + } + public String getSqr() { + return sqr; + } + public void setSqr(String sqr) { + this.sqr = sqr; + } + public String getDjrq() { + return djrq; + } + public void setDjrq(String djrq) { + this.djrq = djrq; + } + public String getSysc() { + return sysc; + } + public void setSysc(String sysc) { + this.sysc = sysc; + } + public String getPtjbcj() { + return ptjbcj; + } + public void setPtjbcj(String ptjbcj) { + this.ptjbcj = ptjbcj; + } + @Override + public String toString() { + return "FormBean [lx=" + lx + ", xmmc=" + xmmc + ", xmbh=" + xmbh + + ", cpxh=" + cpxh + ", sbh=" + sbh + ", cpmc=" + cpmc + + ", jbcj=" + jbcj + ", ickxh=" + ickxh + ", xlbxh=" + xlbxh + + ", cxtz=" + cxtz + ", tdxh=" + tdxh + ", gngs=" + gngs + + ", khtsyq=" + khtsyq + ", fm=" + fm + ", jmlx=" + jmlx + + ", sqr=" + sqr + ", djrq=" + djrq + ", sysc=" + sysc + + ", ptjbcj=" + ptjbcj + "]"; + } + + +} diff --git a/src/com/connor/jk/plm/importPCB/ProgressBar.java b/src/com/connor/jk/plm/importPCB/ProgressBar.java new file mode 100644 index 0000000..1e1312a --- /dev/null +++ b/src/com/connor/jk/plm/importPCB/ProgressBar.java @@ -0,0 +1,174 @@ +/** + * @file ProgressBar.java + * + * @brief Create progress bar + * + * @author Yanghui + * + * @history + * ================================================================ + * Date Name Description of Change + * 25-July-2008 Yanghui this class is used to create + * progress bar. + */ +package com.connor.jk.plm.importPCB; + +import java.awt.Container; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JProgressBar; +import javax.swing.Timer; +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.util.PropertyLayout; +import com.teamcenter.rac.util.Registry; + +/** + * @class ProgressBar + * @brief Create progress bar + * @author Yanghui + */ +public class ProgressBar extends AbstractAIFDialog implements ActionListener { + /** + * @var ProgressBar.progressbar + * @brief JProgressBar + */ + private JProgressBar progressbar; + + /** + * @var ProgressBar.label + * @brief label used to tips + */ + private JLabel label; + + /** + * @var ProgressBar.timer + * @brief timer used to timing operation + */ + private Timer timer; + + /** + * @var ProgressBar.bool + * @brief bool used to flag thread return + */ + private boolean bool = false; + + /** + * @var Progressbar.registry + * @brief Registry + */ + private Registry registry; + + /** + * @fn public ProgressBar() + * @brief constructor + * @param[in] null + */ + private String showLable = null ; + public ProgressBar(String showlable) { + super(true); + showLable = showlable; + this.setAlwaysOnTop(true); + } + + /** + * @fn public void setBool(boolean bool) + * @brief set bool value + * @param[in] bool + * @param[out] null + */ + public void setBool(boolean bool) { + this.bool = bool; + } + + /** + * @fn private void initUI() + * @brief createDialog method + * @param[in] null + * @param[out] null + */ + public void initUI() { + Container container = getContentPane(); + JPanel mainPanel = new JPanel(new PropertyLayout()); + this.label = new JLabel(showLable, JLabel.CENTER); + this.progressbar = new JProgressBar(); + this.progressbar.setOrientation(JProgressBar.HORIZONTAL); + this.progressbar.setMinimum(0); + this.progressbar.setMaximum(100); + this.progressbar.setValue(0); + this.progressbar.setPreferredSize(new Dimension(200, 15)); + this.progressbar.setBorderPainted(true); + this.timer = new Timer(50, (ActionListener) this); + this.timer.setRepeats(false); + mainPanel.add("1.1.center", new JLabel(" ")); + mainPanel.add("2.1.center", label); + mainPanel.add("3.1.center", progressbar); + mainPanel.add("4.1.center", new JLabel(" ")); + container.add(mainPanel); + pack(); + setLocation(500, 200); + TaskThread thread = new TaskThread(this); + thread.start(); + addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + bool = true; + } + }); + this.setVisible(true); + } + + /** + * @class TaskThread + * @brief Create progressbar + * + */ + class TaskThread extends Thread { + private ProgressBar bar; + + public TaskThread(ProgressBar bar) { + this.bar = bar; + } + + public void run() { + if (bool == false) { + // Set Status is running. + // session.setStatus(registry.getString("export Running")); + } + for (int i = 0; i < i + 1; i++) { + timer.start(); + int value = progressbar.getValue(); + if (value < 100) { + value = value + 5; + progressbar.setValue(value); + } else { + timer.stop(); + progressbar.setValue(0); + } + try { + sleep(100); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + if (bool == true) { + this.bar.setVisible(false); + this.bar.disposeDialog(); + this.bar.dispose(); + this.interrupt(); + return; + + } + + } + } + } + + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + + } +} diff --git a/src/com/connor/jk/plm/importPCB/ProgressBarThread.java b/src/com/connor/jk/plm/importPCB/ProgressBarThread.java new file mode 100644 index 0000000..dd270ac --- /dev/null +++ b/src/com/connor/jk/plm/importPCB/ProgressBarThread.java @@ -0,0 +1,42 @@ +/** + * @file ProgressBarThread.java + * + * @brief control progressBar. + * + * @author Yanghui + * + * @history + * ================================================================ + * Date Name Description of Change + * 08-Auguest-2008 Yanghui this class is used to control + * progress bar. + */ +package com.connor.jk.plm.importPCB; + + +/** + * @class ProgressBarThread + * @brief Create progress bar thread + * @author Yanghui + */ +public class ProgressBarThread extends Thread { + + private ProgressBar bar; + + private String title; + + public ProgressBarThread(String title,String showLable) { + this.title = title; + bar = new ProgressBar(showLable); + } + + public void run() { + bar.setTitle(title); + bar.initUI(); + } + + public void setBool(boolean bool) { + bar.setBool(true); + bar.setAlwaysOnTop(false); + } +} diff --git a/src/com/connor/jk/plm/importPCB/SetExcel.java b/src/com/connor/jk/plm/importPCB/SetExcel.java new file mode 100644 index 0000000..3d4d968 --- /dev/null +++ b/src/com/connor/jk/plm/importPCB/SetExcel.java @@ -0,0 +1,170 @@ +package com.connor.jk.plm.importPCB; + +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.apache.poi.xssf.usermodel.XSSFCell; +import org.apache.poi.xssf.usermodel.XSSFRow; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.util.MessageBox; + +public class SetExcel { + private XSSFWorkbook wb; + private List beanList=new ArrayList<>(); + private TCComponentForm form; + + private String[] jk8Projectname;//Ŀ + private String[] jk8Companylogo;//˾ʶ + private String[] jk8MeasureType;//ԭ + private String[] jk8CommunicateMode;//ͨѶʽ + private String[] jk8Application;//Ӧ÷Χ + private String[] jk8PCBNO;//PCB + + private String[] jk8Projectname1;//Ŀ + private String[] jk8Companylogo1;//˾ʶ + private String[] jk8MeasureType1;//ԭ + private String[] jk8CommunicateMode1;//ͨѶʽ + private String[] jk8Application1;//Ӧ÷Χ + private String[] jk8PCBNO1;//PCB + + + + + + + public SetExcel(String path, TCComponentForm form) { + this.form=form; + try { + wb = new XSSFWorkbook(new FileInputStream(path)); + if (wb != null) { + int sheetlength = wb.getNumberOfSheets(); + List sheetNameList = new ArrayList<>(); + for (int i = 0; i < sheetlength; i++) { + sheetNameList.add(wb.getSheetName(i)); + } + for (String sheetName : sheetNameList) { + XSSFSheet sheet = wb.getSheet(sheetName); + if (sheetName.contains("PCBǼDZ")) { + int cound=7; + getList("tb1", sheet,cound); + break; + } + + } + if(beanList!=null&&beanList.size()>0){ + setForm(); + } + }else{ + MessageBox.post("ģ,","",MessageBox.ERROR); + } + + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public void setForm() { + System.out.println("--------------------->setForm()"); + try { + jk8Projectname=form.getTCProperty("jk8Projectname").getStringArrayValue();//Ŀ + jk8Companylogo=form.getTCProperty("jk8Companylogo").getStringArrayValue();//˾ʶ + jk8MeasureType=form.getTCProperty("jk8MeasureType").getStringArrayValue();//ԭ + jk8CommunicateMode=form.getTCProperty("jk8CommunicateMode").getStringArrayValue();//ͨѶʽ + jk8Application=form.getTCProperty("jk8Application").getStringArrayValue();//Ӧ÷Χ + jk8PCBNO=form.getTCProperty("jk8PCBNO").getStringArrayValue();//PCB + + if(jk8Companylogo!=null) { + int count=jk8Companylogo.length+beanList.size(); + jk8Projectname1=new String[count];//Ŀ + jk8Companylogo1=new String[count];//˾ʶ + jk8MeasureType1=new String[count];//ԭ + jk8CommunicateMode1=new String[count];//ͨѶʽ + jk8Application1=new String[count];//Ӧ÷Χ + jk8PCBNO1=new String[count];//PCB + for(int i=0;igetList()"); + int rowSize = sheet.getLastRowNum() + 1; + for(int i=1;i list=new ArrayList<>(); + for(int j=1;j beanList=new ArrayList<>(); + private TCComponentForm form; + + private String[] jk8ProductTypePMN;// + private String[] jk8ProjectNO;//Ŀ + private String[] jk8ProjectName;//Ŀ + private String[] jk8ProductModNO;//Ʒͺ + private String[] jk8ProductIdentifyNO;//ʶ + + private String[] jk8ProductName;//Ʒ + private String[] jk8BMManufactor;// + private String[] jk8BMMaterial;// + private String[] jk8ContrlCompType;// + private String[] jk8Note;//ע + + private String[] jk8Applicant;// + private String[] jk8RecordDate;//Ǽ + private String[] jk8Status;//״̬ +// private String[] jk8ProductTypePMN;//Ʒ + private String[] jk8PipeDSpec;//ܾ + + //private String[] jk8CommunicateMode;//ͨŷʽ + private String[] jk8Structure;//ṹ + + private String[] jk8ProductTypePMN1;// + private String[] jk8ProjectNO1;//Ŀ + private String[] jk8ProjectName1;//Ŀ + private String[] jk8ProductModNO1;//Ʒͺ + private String[] jk8ProductIdentifyNO1;//ʶ + + private String[] jk8ProductName1;//Ʒ + private String[] jk8BMManufactor1;// + private String[] jk8BMMaterial1;// + private String[] jk8ContrlCompType1;// + private String[] jk8Note1;//ע + + private String[] jk8Applicant1;// + private String[] jk8RecordDate1;//Ǽ + private String[] jk8Status1;//״̬ +// private String[] jk8ProductTypePMN;//Ʒ + private String[] jk8PipeDSpec1;//ܾ + + //private String[] jk8CommunicateMode1;//ͨŷʽ + private String[] jk8Structure1;//ṹ + /** add **/ + private String[] jk8Description1; + // + private String[] tz1; + private String[] cz1; + + public SetWaterExcel(String path, TCComponentForm form) { + this.form=form; + try { + wb = new XSSFWorkbook(new FileInputStream(path)); + if (wb != null) { + int sheetlength = wb.getNumberOfSheets(); + List sheetNameList = new ArrayList<>(); + for (int i = 0; i < sheetlength; i++) { + sheetNameList.add(wb.getSheetName(i)); + } + for (String sheetName : sheetNameList) { + XSSFSheet sheet = wb.getSheet(sheetName); + if (sheetName.contains("ˮǼDZ")) { + int cound=19; + getList("tb1", sheet,cound); + break; + } + + } + if (beanList != null && beanList.size() > 0) { + setForm(); + } + }else{ + MessageBox.post("ģ,","",MessageBox.ERROR); + } + + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public void setForm() { + System.out.println("--------------------->setForm()"); + try { + jk8ProductTypePMN=form.getTCProperty("jk8ProductTypePMN").getStringArrayValue();// + jk8ProjectNO=form.getTCProperty("jk8ProjectNO").getStringArrayValue();//Ŀ + jk8ProjectName=form.getTCProperty("jk8ProjectName").getStringArrayValue();//Ŀ + jk8ProductModNO=form.getTCProperty("jk8ProductModNO").getStringArrayValue();//Ʒͺ + jk8ProductIdentifyNO=form.getTCProperty("jk8ProductIdentifyNO").getStringArrayValue();//ʶ + + jk8ProductName=form.getTCProperty("jk8ProductName").getStringArrayValue();//Ʒ + jk8BMManufactor=form.getTCProperty("jk8BMManufactor").getStringArrayValue();// + jk8BMMaterial=form.getTCProperty("jk8BMMaterial").getStringArrayValue();// + jk8ContrlCompType=form.getTCProperty("jk8ContrlCompType").getStringArrayValue();// + jk8Note=form.getTCProperty("jk8Note").getStringArrayValue();//ע + + jk8Applicant=form.getTCProperty("jk8Applicant").getStringArrayValue();// + jk8RecordDate=form.getTCProperty("jk8RecordDate").getStringArrayValue();//Ǽ + jk8Status=form.getTCProperty("jk8Status").getStringArrayValue();//״̬ + jk8PipeDSpec=form.getTCProperty("jk8PipeDSpec").getStringArrayValue();//ܾ + //jk8CommunicateMode=form.getTCProperty("jk8CommunicateMode").getStringArrayValue();//ͨŷʽ + + jk8Structure=form.getTCProperty("jk8Structure").getStringArrayValue();//ṹ + + if(jk8ProductIdentifyNO!=null) { + int count=jk8ProductIdentifyNO.length + beanList.size(); + jk8ProductTypePMN1=new String[count];// + jk8ProjectNO1=new String[count];// + jk8ProjectName1=new String[count];// + jk8ProductModNO1=new String[count];// + jk8ProductIdentifyNO1=new String[count];// + + jk8ProductName1=new String[count];// + jk8BMManufactor1=new String[count];// + jk8BMMaterial1=new String[count];// + jk8ContrlCompType1=new String[count];// + jk8Note1=new String[count];// + + jk8Applicant1=new String[count];// + jk8RecordDate1=new String[count];// + jk8Status1=new String[count];// + jk8PipeDSpec1=new String[count];// + //jk8CommunicateMode1=new String[count];// + + jk8Structure1=new String[count];// + /* add zmf */ + jk8Description1=new String[count];// + // + tz1 = new String[count];// + cz1 = new String[count];// + + for(int i=0;igetList()"); + int rowSize = sheet.getLastRowNum() + 1; + for(int i=1;i list=new ArrayList<>(); + for(int j=1;j<=cound;j++ ){ + XSSFCell cell = row.getCell(j); + System.out.println("cell="+cell); + if(cell!=null){ + list.add(cell.toString()); + }else{ + list.add(""); + } + } + boolean is=true; + waterFormBean bean =new waterFormBean(); +// bean.setLx(lx);// + if(list.get(1)==null||list.get(1).equals("")){ + is=false; + } + bean.setJk8ProductTypePMN(list.get(0));// + bean.setJk8ProjectNO(list.get(1));//Ŀ + bean.setJk8ProjectName(list.get(2));//Ŀ + bean.setJk8ProductModNO(list.get(3));//Ʒͺ + bean.setJk8ProductIdentifyNO(list.get(4));//ʶ + + bean.setJk8ProductName(list.get(5));//Ʒ + bean.setJk8BMManufactor(list.get(6));// + bean.setJk8BMMaterial(list.get(7));// + bean.setJk8ContrlCompType(list.get(8));// + bean.setJk8Note(list.get(9));//ע + + bean.setJk8Applicant(list.get(10));// + bean.setJk8RecordDate(list.get(11));//Ǽ + bean.setJk8Status(list.get(12));//״̬ + bean.setJk8PipeDSpec(list.get(13));//ܾ + //bean.setJk8CommunicateMode(list.get(14));//ͨŷʽ + bean.setJk8Structure(list.get(14));//ṹ + /** add zmf **/ + bean.setJk8Description(list.get(15)); + // + bean.setTz(list.get(16)); + bean.setCz(list.get(17)); + + if(is){ + beanList.add(bean); + System.out.println(bean); + } + + + + } + } + +} diff --git a/src/com/connor/jk/plm/importWaterForm/importWater_Dialog.java b/src/com/connor/jk/plm/importWaterForm/importWater_Dialog.java new file mode 100644 index 0000000..96fbd56 --- /dev/null +++ b/src/com/connor/jk/plm/importWaterForm/importWater_Dialog.java @@ -0,0 +1,154 @@ +package com.connor.jk.plm.importWaterForm; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.File; + +import javax.swing.JButton; +import javax.swing.JFileChooser; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JTextField; +import javax.swing.filechooser.FileSystemView; + +//import com.connor.jk.plm.bom.until.ProgressBarThread; +//import com.connor.jk.plm.imform.SetExcel; +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; + +public class importWater_Dialog extends AbstractAIFDialog { + private TCSession session; + private InterfaceAIFComponent targetComp; + private TCComponentForm form; + private JFileChooser jFileChooser; + private JTextField jt4 = new JTextField(20); + private JLabel jb4; + private JButton pBut; + private JButton okBut=new JButton("ȷ"); + private JButton celBut=new JButton("ȡ"); + private JButton celallBut=new JButton(""); + public importWater_Dialog(TCSession session, InterfaceAIFComponent targetComp) { + this.session = session; + this.targetComp = targetComp; + this.form=(TCComponentForm)targetComp; + } + + public void run() { +// super.run(); + initUI(); + } + + private void initUI() { + FileSystemView fsv = FileSystemView.getFileSystemView(); // õϵͳfileview + String deskPath = fsv.getHomeDirectory().getPath(); // ǰû· + setLayout(new PropertyLayout()); + jb4 = new JLabel(" ļ·"); + jt4.setText(deskPath); + pBut = new JButton("..."); + jFileChooser = new JFileChooser(); + this.jFileChooser.setCurrentDirectory(new File(deskPath));// ļѡijʼĿ¼Ϊǰû + add("1.1.left.top", jb4); + add("1.2.left.top", jt4); + add("1.3.left.top", pBut); + add("2.1.left.top", okBut); + add("2.2.left.top", celBut); + add("2.3.left.top", celallBut); +// setSize(300, 300); + setVisible(true); + this.centerToScreen(); + this.pack(); + pBut.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent arg0) { + selectFileButtonEvent(); + } + }); + okBut.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + String path=jt4.getText(); + if(path.endsWith(".xlsx")){ + setVisible(false); + ProgressBarThread wait = new ProgressBarThread("ͬ", "ͬУԵ..."); + wait.start();// + SetWaterExcel se=new SetWaterExcel(path,form); + wait.setBool(true);// رս + wait.interrupt(); + MessageBox.post("!!!","",MessageBox.INFORMATION); + } + System.out.println("ok"); + } + }); + celBut.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + setVisible(false); + } + }); + celallBut.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + int yn = JOptionPane.showConfirmDialog(null, "Ƿɾݣ", + "ɾȷ϶Ի", 0, 2); + if (yn == 0) { + + try { + form.getTCProperty("jk8ProductTypePMN").setStringValueArray(new String[]{});// + form.getTCProperty("jk8ProjectNO").setStringValueArray(new String[]{});//Ŀ + form.getTCProperty("jk8ProjectName").setStringValueArray(new String[]{});//Ŀ + form.getTCProperty("jk8ProductModNO").setStringValueArray(new String[]{});// Ʒͺ + form.getTCProperty("jk8ProductIdentifyNO").setStringValueArray(new String[]{});//ʶ + + form.getTCProperty("jk8ProductName").setStringValueArray(new String[]{});//Ʒ + form.getTCProperty("jk8BMManufactor").setStringValueArray(new String[]{});// + form.getTCProperty("jk8BMMaterial").setStringValueArray(new String[]{});// + form.getTCProperty("jk8ContrlCompType").setStringValueArray(new String[]{});// + form.getTCProperty("jk8Note").setStringValueArray(new String[]{});//ע + + form.getTCProperty("jk8Applicant").setStringValueArray(new String[]{});// + form.getTCProperty("jk8RecordDate").setStringValueArray(new String[]{});//Ǽ + form.getTCProperty("jk8Status").setStringValueArray(new String[]{});//״̬ + form.getTCProperty("jk8ProductTypePMN").setStringValueArray(new String[]{});//Ʒ + form.getTCProperty("jk8PipeDSpec").setStringValueArray(new String[]{});//ܾ + //form.getTCProperty("jk8CommunicateMode").setStringValueArray(new String[]{});//ͨŷʽ + form.getTCProperty("jk8Structure").setStringValueArray(new String[]{});//ṹ + /* add */ + form.getTCProperty("jk8FunctionOverview").setStringValueArray(new String[]{}); + // + form.getTCProperty("jk8Feature").setStringValueArray(new String[]{}); + form.getTCProperty("jk8Texture").setStringValueArray(new String[]{}); + + MessageBox.post("ɾɹ","",MessageBox.INFORMATION); + } catch (TCException e1) { + MessageBox.post("ɾʧ","",MessageBox.ERROR); + e1.printStackTrace(); + } + } + + + } + }); + + } + public void selectFileButtonEvent() { + int state = jFileChooser.showOpenDialog(null);// ˾ǴļѡĴ + if (state == 1) { + return; + } else { + File f = jFileChooser.getSelectedFile();// fΪѡ񵽵ļĿ¼ + jt4.setText(f.getAbsolutePath()); + } + } +} diff --git a/src/com/connor/jk/plm/importWaterForm/importWater_Handler.java b/src/com/connor/jk/plm/importWaterForm/importWater_Handler.java new file mode 100644 index 0000000..9b308d9 --- /dev/null +++ b/src/com/connor/jk/plm/importWaterForm/importWater_Handler.java @@ -0,0 +1,36 @@ +package com.connor.jk.plm.importWaterForm; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.connor.jk.plm.imform.ImfomAIFDialog; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class importWater_Handler extends AbstractHandler{ + private InterfaceAIFComponent targetComp; + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + // TODO Auto-generated method stub + AbstractAIFApplication app = AIFUtility.getCurrentApplication(); + TCSession session =(TCSession) app.getSession(); + targetComp = app.getTargetComponent(); + if(targetComp==null){ + MessageBox.post("ѡˮǼDZִв","",MessageBox.ERROR); + return null; + } + if("JK8NNWPModNORegForm".equals(targetComp.getType())){ + System.out.println("start"); + importWater_Dialog log=new importWater_Dialog(session, targetComp); + new Thread(log).start(); + }else{ + MessageBox.post("ѡˮǼDZִв","",MessageBox.ERROR); + } + return null; + } + +} diff --git a/src/com/connor/jk/plm/importWaterForm/waterFormBean.java b/src/com/connor/jk/plm/importWaterForm/waterFormBean.java new file mode 100644 index 0000000..5fd7832 --- /dev/null +++ b/src/com/connor/jk/plm/importWaterForm/waterFormBean.java @@ -0,0 +1,164 @@ +package com.connor.jk.plm.importWaterForm; + +public class waterFormBean { + private String jk8ProductTypePMN;// + private String jk8ProjectNO;//Ŀ + private String jk8ProjectName;//Ŀ + private String jk8ProductModNO;//Ʒͺ + private String jk8ProductIdentifyNO;//ʶ + + private String jk8ProductName;//Ʒ + private String jk8BMManufactor;// + private String jk8BMMaterial;// + private String jk8ContrlCompType;// + private String jk8Note;//ע + + private String jk8Applicant;// + private String jk8RecordDate;//Ǽ + private String jk8Status;//״̬ + private String jk8PipeDSpec;//ܾ + private String jk8CommunicateMode;//ͨŷʽ + private String jk8Structure;//ṹ + /** add zmf **/ + private String jk8Description; + // + private String tz; + private String cz; + + + public String getTz() { + return tz; + } + + public void setTz(String tz) { + this.tz = tz; + } + + public String getCz() { + return cz; + } + + public void setCz(String cz) { + this.cz = cz; + } + + public String getJk8Description() { + return jk8Description; + } + + public void setJk8Description(String jk8Description) { + this.jk8Description = jk8Description; + } + + public String getJk8CommunicateMode() { + return jk8CommunicateMode; + } + + public void setJk8CommunicateMode(String jk8CommunicateMode) { + this.jk8CommunicateMode = jk8CommunicateMode; + } + + public String getJk8ProductTypePMN() { + return jk8ProductTypePMN; + } + public void setJk8ProductTypePMN(String jk8ProductTypePMN) { + this.jk8ProductTypePMN = jk8ProductTypePMN; + } + public String getJk8ProjectNO() { + return jk8ProjectNO; + } + public void setJk8ProjectNO(String jk8ProjectNO) { + this.jk8ProjectNO = jk8ProjectNO; + } + public String getJk8ProjectName() { + return jk8ProjectName; + } + public void setJk8ProjectName(String jk8ProjectName) { + this.jk8ProjectName = jk8ProjectName; + } + public String getJk8ProductModNO() { + return jk8ProductModNO; + } + public void setJk8ProductModNO(String jk8ProductModNO) { + this.jk8ProductModNO = jk8ProductModNO; + } + public String getJk8ProductIdentifyNO() { + return jk8ProductIdentifyNO; + } + public void setJk8ProductIdentifyNO(String jk8ProductIdentifyNO) { + this.jk8ProductIdentifyNO = jk8ProductIdentifyNO; + } + public String getJk8ProductName() { + return jk8ProductName; + } + public void setJk8ProductName(String jk8ProductName) { + this.jk8ProductName = jk8ProductName; + } + public String getJk8BMManufactor() { + return jk8BMManufactor; + } + public void setJk8BMManufactor(String jk8bmManufactor) { + jk8BMManufactor = jk8bmManufactor; + } + public String getJk8BMMaterial() { + return jk8BMMaterial; + } + public void setJk8BMMaterial(String jk8bmMaterial) { + jk8BMMaterial = jk8bmMaterial; + } + public String getJk8ContrlCompType() { + return jk8ContrlCompType; + } + public void setJk8ContrlCompType(String jk8ContrlCompType) { + this.jk8ContrlCompType = jk8ContrlCompType; + } + public String getJk8Note() { + return jk8Note; + } + public void setJk8Note(String jk8Note) { + this.jk8Note = jk8Note; + } + public String getJk8Applicant() { + return jk8Applicant; + } + public void setJk8Applicant(String jk8Applicant) { + this.jk8Applicant = jk8Applicant; + } + public String getJk8RecordDate() { + return jk8RecordDate; + } + public void setJk8RecordDate(String jk8RecordDate) { + this.jk8RecordDate = jk8RecordDate; + } + public String getJk8Status() { + return jk8Status; + } + public void setJk8Status(String jk8Status) { + this.jk8Status = jk8Status; + } + public String getJk8PipeDSpec() { + return jk8PipeDSpec; + } + public void setJk8PipeDSpec(String jk8PipeDSpec) { + this.jk8PipeDSpec = jk8PipeDSpec; + } + public String getJk8Structure() { + return jk8Structure; + } + public void setJk8Structure(String jk8Structure) { + this.jk8Structure = jk8Structure; + } + + + @Override + public String toString() { + return "FormBean [jk8ProductTypePMN=" + jk8ProductTypePMN + ", jk8ProjectNO=" + jk8ProjectNO + ", jk8ProjectName=" + jk8ProjectName + + ", jk8ProductModNO=" + jk8ProductModNO + ", jk8ProductIdentifyNO=" + jk8ProductIdentifyNO + ", jk8ProductName=" + jk8ProductName + + ", jk8BMManufactor=" + jk8BMManufactor + ", jk8BMMaterial=" + jk8BMMaterial + ", jk8ContrlCompType=" + jk8ContrlCompType + + ", jk8Note=" + jk8Note + ", jk8Applicant=" + jk8Applicant + ", jk8RecordDate=" + jk8RecordDate + + ", jk8Status=" + jk8Status + ", jk8PipeDSpec=" + jk8PipeDSpec + ", jk8CommunicateMode=" + jk8CommunicateMode + + ", jk8Structure=" + jk8Structure + ", jk8Description=" + jk8Description + "]"; + } + + +} diff --git a/src/com/connor/jk/plm/itemsave/Itemsave_Action.java b/src/com/connor/jk/plm/itemsave/Itemsave_Action.java new file mode 100644 index 0000000..0b14581 --- /dev/null +++ b/src/com/connor/jk/plm/itemsave/Itemsave_Action.java @@ -0,0 +1,26 @@ +package com.connor.jk.plm.itemsave; + +import java.awt.Frame; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.common.actions.AbstractAIFAction; + +public class Itemsave_Action extends AbstractAIFAction { + private AbstractAIFApplication app; + + public Itemsave_Action(AbstractAIFApplication app, String arg1) { + super(app, arg1); + this.app=app; + } + + @Override + public void run() { + Itemsave_Operation op=new Itemsave_Operation(app); + try { + op.executeOperation(); + } catch (Exception e) { + e.printStackTrace(); + } + } + +} diff --git a/src/com/connor/jk/plm/itemsave/Itemsave_Handler.java b/src/com/connor/jk/plm/itemsave/Itemsave_Handler.java new file mode 100644 index 0000000..5b92ee4 --- /dev/null +++ b/src/com/connor/jk/plm/itemsave/Itemsave_Handler.java @@ -0,0 +1,22 @@ +package com.connor.jk.plm.itemsave; + +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.aifrcp.AIFUtility; + +public class Itemsave_Handler extends AbstractHandler { + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + // TODO Auto-generated method stub + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + Itemsave_Action action=new Itemsave_Action(app,null); + new Thread(action).start(); + return null; + + } + +} diff --git a/src/com/connor/jk/plm/itemsave/Itemsave_Operation.java b/src/com/connor/jk/plm/itemsave/Itemsave_Operation.java new file mode 100644 index 0000000..013c5ea --- /dev/null +++ b/src/com/connor/jk/plm/itemsave/Itemsave_Operation.java @@ -0,0 +1,139 @@ +package com.connor.jk.plm.itemsave; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +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.TCComponent; +import com.teamcenter.rac.kernel.TCComponentBOMLine; +import com.teamcenter.rac.kernel.TCComponentBOMView; +import com.teamcenter.rac.kernel.TCComponentBOMViewRevision; +import com.teamcenter.rac.kernel.TCComponentBOMWindow; +import com.teamcenter.rac.kernel.TCComponentBOMWindowType; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +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.util.MessageBox; + +public class Itemsave_Operation extends AbstractAIFOperation { + private AbstractAIFApplication app; + private TCSession session; + private InterfaceAIFComponent targetComp; + + public Itemsave_Operation(AbstractAIFApplication app) { + // TODO Auto-generated constructor stub + this.app = app; + this.session = (TCSession) app.getSession(); + this.targetComp = app.getTargetComponent(); + } + + @Override + public void executeOperation() throws Exception { + // TODO Auto-generated method stub + if (targetComp == null) { + MessageBox.post("ѡ", "", MessageBox.ERROR); + return; + } + if (!targetComp.getType().equals("JK8DesignReqSpec") + && !targetComp.getType().equals("JK8DesignReq")) { + MessageBox.post("ѡ", "", MessageBox.ERROR); + return; + } + TCComponentItem item = (TCComponentItem) targetComp; + + TCComponentItemRevision rev = item.getLatestItemRevision(); + + TCComponentItem newitem = rev.saveAsItem(null, null); + TCComponentItemRevision newrev = newitem.getLatestItemRevision(); + + TCComponentBOMLine line = getTopLineByRev(newrev);// öbomline + if(line!=null){ + setbom(line,newrev); + }else{ + setGlxq(newrev); + } + + + + session.getUser().getNewStuffFolder().add("contents", newitem);//newstuffļ + MessageBox.post("NewStuffļ²鿴","ɹ",MessageBox.INFORMATION); + + } + + public void setGlxq(TCComponentItemRevision newrev) {//ø + try { + TCComponent[] yzxqs = newrev + .getReferenceListProperty("FND_TraceLink"); + + if (yzxqs != null && yzxqs.length > 0) {// ֤ + + for (int i = 0; i < yzxqs.length; i++) { + if (yzxqs[i].getType().equals("JK8FuncTestReq") + || yzxqs[i].getType().equals("JK8PerfTestReq")) { + + newrev.remove("FND_TraceLink", yzxqs[i]); + TCComponentItem nitem = ((TCComponentItem) yzxqs[i]) + .getLatestItemRevision().saveAsItem(null, null); + newrev.add("FND_TraceLink", nitem); + } + } + + } + } catch (TCException e) { + e.printStackTrace(); + } + } + + private void setbom(TCComponentBOMLine line ,TCComponentItemRevision rev) {//bom + try { + setGlxq(rev); + System.out.println("lineddd=" + line.toString()); + AIFComponentContext[] lins = line.getChildren(); + if (lins == null || lins.length <= 0) { + return; + } + for (AIFComponentContext l : lins) { + TCComponent lt = (TCComponent) l.getComponent(); + TCProperty[] tcs = ((TCComponentBOMLine) lt) + .getTCProperties(new String[] { "bl_quantity", + "bl_sequence_no" }); + line.lock(); + line.remove("", lt); + TCComponentItem chitem = ((TCComponentBOMLine) lt).getItem() + .getLatestItemRevision().saveAsItem(null, null); + TCComponentItemRevision r = chitem.getLatestItemRevision(); + TCComponentBOMLine childBomLine = line.add(r.getItem(), r, + null, false, ""); + childBomLine.setTCProperties(tcs); + + setbom(childBomLine,r); + line.save(); + line.unlock(); + } + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public TCComponentBOMLine getTopLineByRev(TCComponentItemRevision rev) {//öbomline + TCComponentBOMLine line = null; + try { + TCTypeService service = session.getTypeService(); + TCComponentBOMWindowType winType = (TCComponentBOMWindowType) service + .getTypeComponent("BOMWindow"); + TCComponentBOMWindow window = winType.create(null); + line = window.setWindowTopLine(rev.getItem(), rev, null, null); + + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + return line; + } + +} diff --git a/src/com/connor/jk/plm/jk8Frequency/Util.java b/src/com/connor/jk/plm/jk8Frequency/Util.java new file mode 100644 index 0000000..c7db8dd --- /dev/null +++ b/src/com/connor/jk/plm/jk8Frequency/Util.java @@ -0,0 +1,53 @@ +package com.connor.jk.plm.jk8Frequency; +import java.util.List; + +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.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +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.TCUserService; +import com.teamcenter.rac.util.MessageBox; + +public class Util { + public static TCPreferenceService service; + public static TCSession session; + public static TCUserService userservice;; + + static { + if (session == null) { + session = (TCSession) (AIFUtility.getCurrentApplication() + .getSession()); + } + if (service == null) + service = session.getPreferenceService(); + } + + public static void setByPass(boolean val) throws TCException { + if (userservice == null) { + userservice = session.getUserService(); + } + Object[] obj = new Object[1]; + obj[0] = "origin"; + if (val) { + userservice.call("ORIGIN_set_bypass", obj); + } else { + userservice.call("ORIGIN_close_bypass", obj); + } + } + + +} diff --git a/src/com/connor/jk/plm/jk8Frequency/jk8Frequency_Handler.java b/src/com/connor/jk/plm/jk8Frequency/jk8Frequency_Handler.java new file mode 100644 index 0000000..0c79c52 --- /dev/null +++ b/src/com/connor/jk/plm/jk8Frequency/jk8Frequency_Handler.java @@ -0,0 +1,79 @@ +package com.connor.jk.plm.jk8Frequency; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.connor.jk.plm.sqb.Generate_Action; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.kernel.AIFComponentContext; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.util.MessageBox; + +public class jk8Frequency_Handler extends AbstractHandler{ + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + try { + Util.setByPass(true); + } catch (TCException e1) { + e1.printStackTrace(); + } + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + InterfaceAIFComponent tar=app.getTargetComponent(); + TCComponent comp=(TCComponent) tar; + Map map=new HashMap<>(); + try { + System.out.println(comp.getProperty("object_type")); + if (comp.getProperty("object_type").equals("JK8MaterialRevision") + || comp.getProperty("object_type").equals("JK8EmbSoftwareRevision") + || comp.getProperty("object_type").equals("JK8LSMaterialRevision") + || comp.getProperty("object_type").equals("Virtl Material Revision") + || comp.getProperty("object_type").equals("ϰ汾") + || comp.getProperty("object_type").equals("ʱϰ汾") + ||comp.getProperty("object_type").equals("ϰ汾") + || comp.getProperty("object_type").equals("汾")) { + System.out.println("aaaa"); + TCComponentItemRevision rev=(TCComponentItemRevision) comp; + TCComponent[] dd=rev.whereUsed((short) 0); + TCComponent[] dd1=rev.whereUsed((short) 1); + TCComponent[] dd2=rev.whereUsed((short) 2); + TCComponent[] dd3=rev.whereUsed((short) 3); + System.out.println(dd.length); + System.out.println(dd1.length); + System.out.println(dd2.length); + System.out.println(dd3.length); + for (int i = 0; i < dd.length; i++) { +// String key=dd[i].getProperty("item_id")+dd[i].getProperty("item_revision_id"); + String key=dd[i].getProperty("item_id");//ֻ㱻ͬʹõƵΣ汾ͬ + System.out.println(key); + if(!map.containsKey(key)) { + map.put(key, ""); + } + } + //TODO + TCComponent form= rev.getTCProperty("IMAN_master_form_rev").getReferenceValueArray()[0]; + form.getTCProperty("jk8Frequency").setStringValue(map.size()+""); + MessageBox.post("ʹƵ:"+map.size(),"",MessageBox.INFORMATION); + } else { + MessageBox.post("Ͳֲ֧ѯʹƵ","",MessageBox.INFORMATION); + } + } catch (TCException e) { + e.printStackTrace(); + } + try { + Util.setByPass(false); + } catch (TCException e1) { + e1.printStackTrace(); + } + return null; + } + +} diff --git a/src/com/connor/jk/plm/kzq/DataBaseControl.java b/src/com/connor/jk/plm/kzq/DataBaseControl.java new file mode 100644 index 0000000..2510c9a --- /dev/null +++ b/src/com/connor/jk/plm/kzq/DataBaseControl.java @@ -0,0 +1,193 @@ +package com.connor.jk.plm.kzq; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.HashMap; +import java.util.Vector; + +public class DataBaseControl { + + /** ************************ݿ:*********************************** */ + /** + * kelsen .... + */ + Connection conn; + + ResultSet rs; + + PreparedStatement pstmt; + + Statement stmt; + + String strUrl, strUserName, strPassword, strSQLQuery, strDriver; + + public String str_Information=""; + + + /** + * + */ + public DataBaseControl(String strDriver, String strUrl, String strUserName, + String strPassword) { + this.strDriver = strDriver; // "oracle.jdbc.driver.OracleDriver";// + this.strUrl = strUrl; // "jdbc:oracle:thin:@127.0.0.1:1521:tceng";//· + this.strUserName = strUserName; // "infodba";//ݿû + this.strPassword = strPassword; // "infodba";//ݿ + // strSQLQuery="select * from LABELID";//ѯ + + // + try { + Class.forName(strDriver);// ͨڴ + } catch (ClassNotFoundException cnfe) { + cnfe.printStackTrace(); + } + } + + /** + * + * @param strSQLQuery + */ + public void dbModify(String strSQLQuery) { + + openDataBase(); + + try { + stmt = conn.createStatement(); + stmt.executeUpdate(strSQLQuery); + } catch (SQLException sqle2) { + sqle2.printStackTrace(); + } + + closeDataBase(); + } + + /** + * ѯ + * @param strSQLQuery + * @return + */ + public ResultSet dbQuery(String strSQLQuery) { + ResultSet rs_result = null; + if (conn == null) + openDataBase(); + try { + stmt = conn.createStatement(); + rs_result = stmt.executeQuery(strSQLQuery); + + } catch (SQLException sqle2) { + sqle2.printStackTrace(); + } + return rs_result; + } + + /** + * + * + */ + public void openDataBase() { + try { + //this.strUrl="jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.29)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=tcprod)))"; + if (conn == null || conn.isClosed()) + conn = DriverManager.getConnection(strUrl, strUserName, + strPassword); + } catch (SQLException sqle) { + sqle.printStackTrace(); + } + } + + /** + * رݿ + * + */ + public void closeDataBase() { + try { + if (rs != null) { + try { + rs.close(); + } catch (SQLException sqlec) { + sqlec.printStackTrace(); + } + } + if (conn != null && !conn.isClosed()) { + try { + conn.close(); + } catch (SQLException sqlecon) { + sqlecon.printStackTrace(); + } + + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * 䴫ݿвѯ + * ѯõĽÿһ¼װһHashMap,keyԱֶ + * ѯ¼VectorжٸHasnMapԪ + * @param strSQLQuery + * @return + * @author xuk + */ + public Vector orgQuery(String strSQLQuery){ + openDataBase(); + Vector v_result=new Vector(); + try{ + ResultSet rs_get=dbQuery(strSQLQuery); +// System.out.println("RS_GET:"+rs_get); + if(rs_get!=null){ + ResultSetMetaData metaData = rs_get.getMetaData(); + + int i_ColumnCount=metaData.getColumnCount(); +// System.out.println("i_ColumnCount:"+i_ColumnCount); + while(rs_get.next()){ +// System.out.println("BJZJ2"+rs_get.getString("BJZJ2"));; + HashMap hm_unit=new HashMap(); + for(int i=1;i<=i_ColumnCount;i++){ + hm_unit.put(metaData.getColumnName(i), rs_get.getString(i)); +// System.out.println("metaData.getColumnName(i):"+metaData.getColumnName(i)); +// System.out.println("rs_get.getString(i):"+rs_get.getString(i)); + } + v_result.add(hm_unit); + } + }else{ + str_Information=""+strSQLQuery+""+"ѯĽΪ\n"; + } + }catch(Exception e){ + e.printStackTrace(); + } + return v_result; + } + + + /** + * + * @param args + */ + public static void main(String args[]) { + try{ + /*String str_DataBaseDriver = "oracle.jdbc.driver.OracleDriver"; + String str_URL = "jdbc:oracle:thin:@origin-667aaf64:1521:TCENG"; + String str_UserName = "kelsen"; + String str_Password = "kelsen"; + DataBaseControl dbc = new DataBaseControl(str_DataBaseDriver, str_URL, + str_UserName, str_Password); + String str_Query=" select * from YLCSB where YLZCID='000001' and YLZCBBH='A'"; + Vector v_get=dbc.orgQuery(str_Query); + System.out.println("v_get:"+v_get.size()); + for(int i=0;i realNameMap;// ѡֵ + private DataBaseControl dbc = null; + private String[] sbhall;// ʶ + private String[] cpxhall;// Ʒͺ + private String allSBH = ""; + private String allCPXH = ""; + + public GenerateKzq_Operation(AbstractAIFApplication app) { + this.app = app; + this.targetComp = app.getTargetComponent(); + this.session = (TCSession) app.getSession(); + this.type = targetComp.getType(); + String[] names = session.getPreferenceService().getStringValues( + "JK_WATER_SQB_GZ"); + if (names != null) { + realNameMap = new HashMap<>(); + for (int i = 0; i < names.length; i++) { + String[] s = names[i].split(":"); + if (s != null && s.length == 2) { + String key = s[0]; + String value = s[1]; + realNameMap.put(key, value); + } else { + MessageBox.post("ѡ JK_WATER_SQB_GZ ôϵԱ", "", + MessageBox.ERROR); + return; + } + + } + + } else { + MessageBox + .post("ѡ JK_WATER_SQB_GZ ڣϵԱ", "", MessageBox.ERROR); + } + TCPreferenceService pref = session.getPreferenceService(); + String puid = pref.getStringValue("JK_WATER_SQB_FORM_PUID");// ѡpuid + if (puid == null) { + MessageBox.post("ѡδҵϵԱ", "", MessageBox.ERROR); + } + + TCComponentForm formAll; + try { + formAll = (TCComponentForm) session.stringToComponent(puid); + if (formAll == null) { + MessageBox.post("δҵϵԱ", "", MessageBox.ERROR); + } + + sbhall = formAll.getTCProperty("jk8ProductIdentifyNO") + .getStringArrayValue(); + cpxhall = formAll.getTCProperty("jk8ProductModNO") + .getStringArrayValue(); + + if (sbhall != null) + for (String s : sbhall) { + allSBH = allSBH + s + ","; // ʶһַ + } + if (cpxhall != null) + for (String s : cpxhall) { + allCPXH = allCPXH + s + "&"; // вƷͺһַ + } + + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + // + public String createLSM2(String itemID0) { + String newID = ""; + String JdbcDriverClass = "oracle.jdbc.driver.OracleDriver"; + //String strUrl = "jdbc:oracle:thin:@10.201.5.202:1521:jktc";// + String strUrl = "jdbc:oracle:thin:@10.200.2.43:1521:jktc";//ʽ + String strUserName = "infodba"; + String strPassword = "infodba"; + try { + try { + Class.forName(JdbcDriverClass); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } + Connection conn = DriverManager.getConnection(strUrl, strUserName, strPassword); + + String query = "select * from JK_WATER_TABLE where JK_SBH='" + itemID0 + "'"; + Statement stmt = conn.createStatement(); + + ResultSet rs_get = stmt.executeQuery(query); + int rowCount = 0; + if (rs_get.next()) { + rowCount++; + String SBH = rs_get.getString("JK_SBH");// ȡ + if (itemID0.equals(SBH)) { +// int LSM =Integer.valueOf(rs_get.getString("JK_LSM")) ;// ȡˮ + String LSMString = rs_get.getString("JK_LSM"); + LSMString=Integer.valueOf(LSMString)+1+""; + int length = LSMString.length(); + if(length<2) { + LSMString = "0" + LSMString; + } + // ѯǰ+ˮ빹ɵidǷ +// newID = SBH + LSMString; + + + + + newID=loop( rs_get, query, itemID0, LSMString, SBH, stmt, conn); + + /*if (rs_get != null) { + rs_get.close(); + } + query= "select * from JK_WATER_TABLE where JK_SBH='" + itemID0 + "' and JK_LSM='"+LSMString+"'"; + System.out.println(query); + rs_get = stmt.executeQuery(query); + if (rs_get.next()) { + + LSMString = rs_get.getString("JK_LSM"); + LSMString=Integer.valueOf(LSMString)+1+""; + length = LSMString.length(); + if(length<2) { + LSMString = "0" + LSMString; + } + + }else { + newID = SBH + LSMString; + if (rs_get != null) { + rs_get.close(); + } +// query = "insert into JK_WATER_TABLE set JK_LSM='" + LSMString + "' , JK_BASE='"+newID+"' WHERE JK_SBH='"+SBH+"'" ; + query = "insert into JK_WATER_TABLE (JK_SBH,JK_LSM,JK_BASE) values('" + SBH + "', '"+LSMString+"' ,'"+newID+"')"; + System.out.println(query); + try { + rs_get = stmt.executeQuery(query); + } catch (Exception e) { + if (rs_get != null) { + rs_get.close(); + } + if (stmt != null) { + stmt.close(); + } + if (conn != null) { + } + e.printStackTrace(); + } + }*/ + + + + + + + + /*//ˮд + if (rs_get != null) { + rs_get.close(); + } +// query = "insert into JK_WATER_TABLE set JK_LSM='" + LSMString + "' , JK_BASE='"+newID+"' WHERE JK_SBH='"+SBH+"'" ; + query = "insert into JK_WATER_TABLE (JK_SBH,JK_LSM,JK_BASE) values('" + SBH + "', '"+LSMString+"' ,'"+newID+"')"; + System.out.println(query); + try { + rs_get = stmt.executeQuery(query); + } catch (Exception e) { + if (rs_get != null) { + rs_get.close(); + } + if (stmt != null) { + stmt.close(); + } + if (conn != null) { + } + e.printStackTrace(); + }*/ + } + + if (rs_get != null) { + rs_get.close(); + } + if (stmt != null) { + stmt.close(); + } + if (conn != null) { + conn.close(); + } + // дмеˮ + return newID; + + } else { + if (rs_get != null) { + rs_get.close(); + } + query = "insert into JK_WATER_TABLE (JK_SBH,JK_LSM,JK_BASE) values('" + itemID0 + "', '0' ,'"+itemID0+"00')"; + System.out.println(query); + try { + rs_get = stmt.executeQuery(query); + } catch (Exception e) { + if (rs_get != null) { + rs_get.close(); + } + if (stmt != null) { + stmt.close(); + } + if (conn != null) { + } + e.printStackTrace(); + } + if (rs_get.next()) { + System.out.println("OK"); + } + newID = itemID0 + "00"; + if (rs_get != null) { + rs_get.close(); + } + } + System.out.println(rowCount); + if (rs_get != null) { + rs_get.close(); + } + if (stmt != null) { + stmt.close(); + } + if (conn != null) { + conn.close(); + } + } catch (SQLException e) { + e.printStackTrace(); + } + + // дмеˮ + return newID; + + } +public String loop(ResultSet rs_get, String query,String itemID0,String LSMString, String SBH,Statement stmt,Connection conn) throws SQLException { + String newID=""; + if (rs_get != null) { + rs_get.close(); + } + query= "select * from JK_WATER_TABLE where JK_SBH='" + itemID0 + "' and JK_LSM='"+LSMString+"'"; + System.out.println(query); + rs_get = stmt.executeQuery(query); + if (rs_get.next()) { + + LSMString = rs_get.getString("JK_LSM"); + LSMString=Integer.valueOf(LSMString)+1+""; + int length = LSMString.length(); + if(length<2) { + LSMString = "0" + LSMString; + } + newID=loop(rs_get,query,itemID0,LSMString,SBH,stmt,conn); + + }else { + newID = SBH + LSMString; + if (rs_get != null) { + rs_get.close(); + } +// query = "insert into JK_WATER_TABLE set JK_LSM='" + LSMString + "' , JK_BASE='"+newID+"' WHERE JK_SBH='"+SBH+"'" ; + query = "insert into JK_WATER_TABLE (JK_SBH,JK_LSM,JK_BASE) values('" + SBH + "', '"+LSMString+"' ,'"+newID+"')"; + System.out.println(query); + try { + rs_get = stmt.executeQuery(query); + } catch (Exception e) { + if (rs_get != null) { + rs_get.close(); + } + if (stmt != null) { + stmt.close(); + } + if (conn != null) { + } + e.printStackTrace(); + } + } + return newID; + +} + + public String createLSM3(String jzsbh) { + String newID = ""; + String JdbcDriverClass = "oracle.jdbc.driver.OracleDriver"; +// String strUrl = "jdbc:oracle:thin:@10.201.5.202:1521:jktc";// + String strUrl = "jdbc:oracle:thin:@10.200.2.43:1521:jktc";//ʽ + String strUserName = "infodba"; + String strPassword = "infodba"; + try { + try { + Class.forName(JdbcDriverClass); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } + Connection conn = DriverManager.getConnection(strUrl, strUserName, strPassword); + + String query = "select * from JK_WATER_TABLE where JK_BASE='" + jzsbh + "'"; + Statement stmt = conn.createStatement(); + + ResultSet rs_get = stmt.executeQuery(query); + int rowCount = 0; + if (rs_get.next()) { + rowCount++; + String BASE = rs_get.getString("JK_BASE");// ȡ + if (jzsbh.equals(BASE)) { +// int LSM =Integer.valueOf(rs_get.getString("JK_LSM")) ;// ȡˮ + String YSMString = rs_get.getString("JK_YSM"); + if(YSMString==null||YSMString.equals("")) { + YSMString="0"; + }else { + + YSMString=Integer.valueOf(YSMString)+1+""; + } + + int length = YSMString.length(); + if(length<2) { + YSMString = "0" + YSMString; + } + // ѯǰ+ˮ빹ɵidǷ + newID = jzsbh +"."+ YSMString; + //ˮд + if (rs_get != null) { + rs_get.close(); + } + query = "update JK_WATER_TABLE set JK_YSM='" + YSMString +"' where JK_BASE='"+jzsbh+"'"; + System.out.println(query); + try { + rs_get = stmt.executeQuery(query); + } catch (Exception e) { + if (rs_get != null) { + rs_get.close(); + } + if (stmt != null) { + stmt.close(); + } + if (conn != null) { + } + e.printStackTrace(); + } + } + + } else { + + } + System.out.println(rowCount); + if (rs_get != null) { + rs_get.close(); + } + if (stmt != null) { + stmt.close(); + } + if (conn != null) { + conn.close(); + } + } catch (SQLException e) { + e.printStackTrace(); + } + + // дмеˮ + return newID; + + } + + + @Override + public void executeOperation() throws Exception { + // TODO Auto-generated method stub + if (targetComp instanceof TCComponentForm) { + form = (TCComponentForm) targetComp; + } else { + MessageBox.post("ѡбִв", "", 0); + return; + } + GetLsmUtil ge = new GetLsmUtil(); + String xh = "";// ͺ + String sbh = "";// ʶ + if ("JK8WaterPModAppForm".equals(type)) {// "²Ʒͺšʶ"; + //TODO Ʒͺ + String cplx = form.getTCProperty("jk8ProductTypePMN").getStringValue();// Ʒͺ֮Ʒ + String gjgg = form.getTCProperty("jk8PipeDSpec").getStringValue();// ܾ + String txfs = form.getTCProperty("jk8CommunicateMode").getStringValue();// ͨŷʽ + if(!cplx.equals("")) { + String jg = form.getTCProperty("jk8Structure").getStringValue();// ṹ + xh = "LX" + setVal(cplx, "Ʒ") + setVal(jg, "ṹ")+"-"+gjgg +setVal(txfs, "ͨŷʽ"); + }else { + xh = "LX" + setVal(cplx, "Ʒ") +"-"+gjgg +setVal(txfs, "ͨŷʽ"); + + } + //TODO ˮʶű +// String sbh_cplx=form.getTCProperty("jk8ProductTypePIN").getStringValue();// ʶ֮Ʒ + String sbh_jbcj=form.getTCProperty("jk8BMManufactor").getStringValue();// + String sbh_jbcz=form.getTCProperty("jk8BMMaterial").getStringValue();// + String sbh_kzq=form.getTCProperty("jk8ContrlCompType").getStringValue();// + + //TODO ȡˮ + String sbhNew=createLSM2("W"+setVal(cplx, "Ʒ") + +setVal(sbh_jbcj, "") + +setVal(sbh_jbcz, "") + +setVal(sbh_kzq, "") ); + //TODO жʶڵǼDZǷ + boolean is=isha(sbhNew); + if(is){ + MessageBox.post("òƷʶ²ƷͺŵǼDZѴڣȷдȷ", + "", MessageBox.ERROR); + return; + } + + if (!xh.equals("") && !sbhNew.equals("")) { + form.getTCProperty("jk8ProductModNO").setStringValue(xh);// Ʒͺ + form.getTCProperty("jk8ProductIdentifyNO").setStringValue(sbhNew);// ʶ + MessageBox.post("ͺʶ,鿴", "ʾ", MessageBox.INFORMATION); + } else { + MessageBox.post("ͺʶʧ,", "", MessageBox.ERROR); + } + + + } else if ("JK8NWPIdenNOAppForm".equals(type)) {// "ˮƷʶ"; + //TODO ˮʶű + String cplx=form.getTCProperty("jk8ProductTypePMN").getStringValue();// Ʒ + String sbh_jbcj=form.getTCProperty("jk8BMManufactor").getStringValue();// + String sbh_jbcz=form.getTCProperty("jk8BMMaterial").getStringValue();// + String sbh_kzq=form.getTCProperty("jk8ContrlCompType").getStringValue();// + + //TODO ȡˮ + String sbhNew=createLSM2("W"+setVal(cplx, "Ʒ") + +setVal(sbh_jbcj, "") + +setVal(sbh_jbcz, "") + +setVal(sbh_kzq, "") ); + //TODO жʶڵǼDZǷ + boolean is=isha(sbhNew); + if(is){ + MessageBox.post("òƷʶ²ƷͺŵǼDZѴڣȷдȷ","", MessageBox.ERROR); + return; + } + + if ( !sbhNew.equals("")) { +// form.getTCProperty("jk8ProductModNO").setStringValue(xh);// Ʒͺ + form.getTCProperty("jk8ProductIdentifyNO").setStringValue(sbhNew);// ʶ + MessageBox.post("ͺʶ,鿴", "ʾ", MessageBox.INFORMATION); + } else { + MessageBox.post("ͺʶʧ,", "", MessageBox.ERROR); + } + + } else if ("JK8DWPIdenNOAppForm".equals(type)) {// ƷˮƷʶ + String jzsbh = form.getTCProperty("jk8BaseIdentifyNO").getStringValue();// ʶ֮Ʒ + + String sbhNew = createLSM3(jzsbh); + // TODO ȡˮ + // TODO жʶڵǼDZǷ + boolean is = isha(sbhNew); + if (is) { + MessageBox.post("òƷʶ²ƷͺŵǼDZѴڣȷдȷ", "", MessageBox.ERROR); + return; + } + + if (!sbhNew.equals("")) { + // form.getTCProperty("jk8ProductModNO").setStringValue(xh);// Ʒͺ + form.getTCProperty("jk8ProductIdentifyNO").setStringValue(sbhNew);// ʶ + MessageBox.post("ͺʶ,鿴", "ʾ", MessageBox.INFORMATION); + } else { + MessageBox.post("ͺʶʧ,", "", MessageBox.ERROR); + } + + } else if ("JK8WSpecPINOAppForm".equals(type)) {// "ҪƷʶ"; + String jzsbh = form.getTCProperty("jk8BaseIdentifyNO").getStringValue();// ʶ֮Ʒ + String tsyq=form.getTCProperty("jk8Specialrequirements").getStringValue();//ϵͳjk8SpecialRequirements + String sbhNew = jzsbh +setVal(tsyq, "Ҫ"); + boolean is = isha(sbhNew); + if (is) { + MessageBox.post("òƷʶ²ƷͺŵǼDZѴڣȷдȷ", "", MessageBox.ERROR); + return; + } + + if (!sbhNew.equals("")) { + // form.getTCProperty("jk8ProductModNO").setStringValue(xh);// Ʒͺ + form.getTCProperty("jk8ProductIdentifyNO").setStringValue(sbhNew);// ʶ + MessageBox.post("ͺʶ,鿴", "ʾ", MessageBox.INFORMATION); + } else { + MessageBox.post("ͺʶʧ,", "", MessageBox.ERROR); + } + } else { + MessageBox.post("ѡƷͺʶִв", "", MessageBox.ERROR); + } + + } + + private boolean isha(String sbh) { + if (!sbh.equals("")) { + if (sbhall != null) + for (String s : sbhall) { + if (sbh.equals(s)) { + System.out.println("ͬʶ"); + return true; + } + } + } + return false; + } + + private String setVal(String key, String Allkey) { + String[] all = realNameMap.get(Allkey).split(","); + HashMap Map_all = new HashMap<>(); + for (int i = 0; i < all.length; i++) { + System.out.println("ss=" + all[i]); + Map_all.put(all[i].split("=")[0], all[i].split("=")[1]); + } + if (Map_all.containsKey(key)) { + System.out.println(Allkey + "=" + Map_all.get(key)); + return Map_all.get(key).trim(); + } else { + System.out.println(Allkey + "="); + return ""; + } + + } + + +} diff --git a/src/com/connor/jk/plm/kzq/JK8ALIdenNOAppForm_Handler.java b/src/com/connor/jk/plm/kzq/JK8ALIdenNOAppForm_Handler.java new file mode 100644 index 0000000..2278c5d --- /dev/null +++ b/src/com/connor/jk/plm/kzq/JK8ALIdenNOAppForm_Handler.java @@ -0,0 +1,23 @@ +package com.connor.jk.plm.kzq; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.connor.jk.plm.sqb.JK8_SBH_Action; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCSession; + +public class JK8ALIdenNOAppForm_Handler extends AbstractHandler { + + private String type="JK8NWPIdenNOAppForm"; + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + JK8_water_Action action=new JK8_water_Action(app, type); + new Thread(action).start(); + return null; + } + +} diff --git a/src/com/connor/jk/plm/kzq/JK8ALModNORegForm_Handler.java b/src/com/connor/jk/plm/kzq/JK8ALModNORegForm_Handler.java new file mode 100644 index 0000000..f2a09b9 --- /dev/null +++ b/src/com/connor/jk/plm/kzq/JK8ALModNORegForm_Handler.java @@ -0,0 +1,23 @@ +package com.connor.jk.plm.kzq; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.connor.jk.plm.sqb.JK8_SBH_Action; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCSession; + +public class JK8ALModNORegForm_Handler extends AbstractHandler { + + private String type="JK8WaterPModAppForm"; + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + JK8_water_Action action=new JK8_water_Action(app, type); + new Thread(action).start(); + return null; + } + +} diff --git a/src/com/connor/jk/plm/kzq/JK8ALPModAppForm_Handler.java b/src/com/connor/jk/plm/kzq/JK8ALPModAppForm_Handler.java new file mode 100644 index 0000000..7b75c26 --- /dev/null +++ b/src/com/connor/jk/plm/kzq/JK8ALPModAppForm_Handler.java @@ -0,0 +1,23 @@ +package com.connor.jk.plm.kzq; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.connor.jk.plm.sqb.JK8_SBH_Action; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCSession; + +public class JK8ALPModAppForm_Handler extends AbstractHandler { + + private String type="JK8DWPIdenNOAppForm"; + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + JK8_water_Action action=new JK8_water_Action(app, type); + new Thread(action).start(); + return null; + } + +} diff --git a/src/com/connor/jk/plm/kzq/JK8WSpecPINOAppForm_Handler.java b/src/com/connor/jk/plm/kzq/JK8WSpecPINOAppForm_Handler.java new file mode 100644 index 0000000..a45d832 --- /dev/null +++ b/src/com/connor/jk/plm/kzq/JK8WSpecPINOAppForm_Handler.java @@ -0,0 +1,23 @@ +package com.connor.jk.plm.kzq; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.connor.jk.plm.sqb.JK8_SBH_Action; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCSession; + +public class JK8WSpecPINOAppForm_Handler extends AbstractHandler { + + private String type="JK8WSpecPINOAppForm"; + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + JK8_water_Action action=new JK8_water_Action(app, type); + new Thread(action).start(); + return null; + } + +} diff --git a/src/com/connor/jk/plm/kzq/JK8_water_Action.java b/src/com/connor/jk/plm/kzq/JK8_water_Action.java new file mode 100644 index 0000000..82ffd8c --- /dev/null +++ b/src/com/connor/jk/plm/kzq/JK8_water_Action.java @@ -0,0 +1,29 @@ +package com.connor.jk.plm.kzq; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.common.actions.AbstractAIFAction; +import com.teamcenter.rac.util.Registry; + +public class JK8_water_Action extends AbstractAIFAction{ + private AbstractAIFApplication app; + private String type; + public JK8_water_Action( AbstractAIFApplication arg0,String arg2) { + super(arg0, arg2); + this.type=arg2; + this.app=arg0; + + } + + @Override + public void run() { + + try { + JK8_water_Command command=new JK8_water_Command(type,app); + command.executeModal(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + +} diff --git a/src/com/connor/jk/plm/kzq/JK8_water_Command.java b/src/com/connor/jk/plm/kzq/JK8_water_Command.java new file mode 100644 index 0000000..b9d257c --- /dev/null +++ b/src/com/connor/jk/plm/kzq/JK8_water_Command.java @@ -0,0 +1,45 @@ +package com.connor.jk.plm.kzq; + +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.AbstractAIFCommand; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCSession; + +public class JK8_water_Command extends AbstractAIFCommand { + private AbstractAIFApplication app; + private InterfaceAIFComponent targetComp; + private TCSession session; + private String type; + + public JK8_water_Command(String type, AbstractAIFApplication app) { + this.app = app; + this.type=type; + this.targetComp = app.getTargetComponent(); + this.session = (TCSession) app.getSession(); + } + + @Override + public void executeModal() throws Exception { + super.executeModal(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss"); + String time=formatter.format(new Date()); +// Calendar calendar = Calendar.getInstance(); +// String year = String.valueOf(calendar.get(Calendar.YEAR));// ȡ +// String month = String.valueOf(calendar.get(Calendar.MONTH) + 1);// ȡ· +// String day = String.valueOf(calendar.get(Calendar.DATE));// ȡ +// String time = String.valueOf(calendar.get(Calendar.HOUR_OF_DAY)) +// + String.valueOf(calendar.get(Calendar.MINUTE)) +// + String.valueOf(calendar.get(Calendar.SECOND));// ȡ + //String name ="Ʒͺʶ"+ time; + System.out.println("------------------------------------"+time); + JK8_water_Operation operation = new JK8_water_Operation(type,time, session, + targetComp); + session.queueOperation(operation); + + } + +} diff --git a/src/com/connor/jk/plm/kzq/JK8_water_Operation.java b/src/com/connor/jk/plm/kzq/JK8_water_Operation.java new file mode 100644 index 0000000..4778faa --- /dev/null +++ b/src/com/connor/jk/plm/kzq/JK8_water_Operation.java @@ -0,0 +1,63 @@ +package com.connor.jk.plm.kzq; + +import com.teamcenter.rac.aif.AbstractAIFOperation; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponentFolder; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCComponentFormType; +import com.teamcenter.rac.kernel.TCComponentUser; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class JK8_water_Operation extends AbstractAIFOperation{ + private String time; + private String type; + private TCSession session; + private InterfaceAIFComponent targetComp; + public JK8_water_Operation(String type,String time, TCSession session, + InterfaceAIFComponent targetComp) { + this.type=type; + this.time=time; + this.session=session; + this.targetComp = targetComp; + } + + @Override + public void executeOperation() throws Exception { + TCComponentFormType formType=(TCComponentFormType) session.getTypeComponent("Form"); + if(formType==null){ + System.out.println("formTypeΪ"); + } + String leiXin=""; + String name=""; + if("JK8WaterPModAppForm".equals(type)){ + leiXin="ˮƷͺšʶɹ"; + name="ˮƷͺšʶ"; + }else if("JK8NWPIdenNOAppForm".equals(type)){ + leiXin="ˮƷʶɹ"; + name="ˮƷʶ"; + }else if("JK8DWPIdenNOAppForm".equals(type)){ + leiXin="ˮƷʶɹ"; + name="ˮƷʶ"; + }else if("JK8WSpecPINOAppForm".equals(type)){ + leiXin="ҪƷʶɹ"; + name="ҪƷʶ"; + } + + + + name=name+time; + TCComponentForm form=formType.create(name, "", type); + + if(targetComp instanceof TCComponentFolder){ + ((TCComponentFolder) targetComp).add("contents", form); + MessageBox.post(leiXin,"ɹ",MessageBox.INFORMATION); + }else{ + TCComponentUser user=this.session.getUser(); + TCComponentFolder newStuff=user.getNewStuffFolder(); + newStuff.add("contents", form); + MessageBox.post(leiXin+"\nNewStuffļ","ɹ",MessageBox.INFORMATION); + } + } + +} diff --git a/src/com/connor/jk/plm/mail/DataBaseControl.java b/src/com/connor/jk/plm/mail/DataBaseControl.java new file mode 100644 index 0000000..d74b174 --- /dev/null +++ b/src/com/connor/jk/plm/mail/DataBaseControl.java @@ -0,0 +1,235 @@ +package com.connor.jk.plm.mail; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Vector; + +import com.teamcenter.rac.util.MessageBox; + +public class DataBaseControl { + + /** ************************ݿ:*********************************** */ + /** + * kelsen .... + */ + Connection conn; + + ResultSet rs; + + PreparedStatement pstmt; + + Statement stmt; + + String strUrl, strUserName, strPassword, strSQLQuery, strDriver; + + public String str_Information = ""; + + /** + * + */ + public DataBaseControl(String strDriver, String strUrl, String strUserName, + String strPassword) { + this.strDriver = strDriver; // "oracle.jdbc.driver.OracleDriver";// + this.strUrl = strUrl; // "jdbc:oracle:thin:@127.0.0.1:1521:tceng";//· + this.strUserName = strUserName; // "infodba";//ݿû + this.strPassword = strPassword; // "infodba";//ݿ + // strSQLQuery="select * from LABELID";//ѯ + + // + try { + Class.forName(strDriver);// ͨڴ + } catch (ClassNotFoundException cnfe) { + cnfe.printStackTrace(); + } + // try { + // Class.forName("org.objectweb.rmijdbc.Driver").newInstance(); + // } catch (InstantiationException e) { + // // TODO Auto-generated catch block + // e.printStackTrace(); + // } catch (IllegalAccessException e) { + // // TODO Auto-generated catch block + // e.printStackTrace(); + // } catch (ClassNotFoundException e) { + // // TODO Auto-generated catch block + // e.printStackTrace(); + // } + } + + /** + * + * + * @param strSQLQuery + */ + public void dbModify(String strSQLQuery) { + + openDataBase(); + + try { + stmt = conn.createStatement(); + stmt.executeUpdate(strSQLQuery); + } catch (SQLException sqle2) { + sqle2.printStackTrace(); + } + + closeDataBase(); + } + + /** + * ѯ + * + * @param strSQLQuery + * @return + */ + public ResultSet dbQuery(String strSQLQuery) { + ResultSet rs_result = null; + if (conn == null) + openDataBase(); + try { + stmt = conn.createStatement(); + rs_result = stmt.executeQuery(strSQLQuery); + + } catch (SQLException sqle2) { + sqle2.printStackTrace(); + } + return rs_result; + } + + /** + * + * + */ + public void openDataBase() { + try { + // this.strUrl="jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.29)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=tcprod)))"; + if (conn == null || conn.isClosed()) + conn = DriverManager.getConnection(strUrl, strUserName, + strPassword); + } catch (SQLException sqle) { + sqle.printStackTrace(); + } + } + + /** + * رݿ + * + */ + public void closeDataBase() { + try { + if (rs != null) { + try { + rs.close(); + } catch (SQLException sqlec) { + sqlec.printStackTrace(); + } + } + if (stmt != null) { + try { + stmt.close(); + } catch (SQLException sqlec) { + sqlec.printStackTrace(); + } + } + if (conn != null && !conn.isClosed()) { + try { + conn.close(); + } catch (SQLException sqlecon) { + sqlecon.printStackTrace(); + } + + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * 䴫ݿвѯ ѯõĽÿһ¼װһHashMap,keyԱֶ + * ѯ¼VectorжٸHasnMapԪ + * + * @param strSQLQuery + * @return + * @author xuk + */ + public Vector orgQuery(String strSQLQuery) { + openDataBase(); + Vector v_result = new Vector(); + try { + ResultSet rs_get = dbQuery(strSQLQuery); + // System.out.println("RS_GET:"+rs_get); + if (rs_get != null) { + ResultSetMetaData metaData = rs_get.getMetaData(); + + int i_ColumnCount = metaData.getColumnCount(); + // System.out.println("i_ColumnCount:"+i_ColumnCount); + while (rs_get.next()) { + // System.out.println("BJZJ2"+rs_get.getString("BJZJ2"));; + String[] s=new String[i_ColumnCount]; + if(i_ColumnCount>=3){ + for(int i=1;i<=i_ColumnCount;i++){ + s[i-1]=rs_get.getString(i); + } + } + v_result.add(s); + } + } else { + str_Information = "" + strSQLQuery + "" + "ѯĽΪ\n"; + } + } catch (Exception e) { + e.printStackTrace(); + } + return v_result; + } + + /** + * ɾԭб,ͬ + * + * @param update + * @return + * @author + */ + + + + /** + * + * + * @param args + */ +// public static void main(String args[]) { +// try { +// +// +// DataBaseControl dbc = null; +// String[] paths;// · +// String JdbcDriverClass="com.microsoft.jdbc.sqlserver.SQLServerDriver"; +// String ConnectionString="jdbc:microsoft:sqlserver://10.200.1.66:1433;DatabaseName=ecology"; +// String DbUser="tc"; +// String DbPass="Tc_1234"; +// dbc = new DataBaseControl(JdbcDriverClass, ConnectionString, DbUser, +// DbPass); +// String strSQLQuery="select workcode,lastname,email from view_TC_humres"; +// Vector v=dbc.orgQuery(strSQLQuery); +// for(String[] ss:v){ +// String str=ss[0]+ss[1]+"("+ss[2]+")"; +// if(ss[2]!=null&&!ss[2].equals("")) +// System.out.println(str); +// } +// +// +// dbc.closeDataBase(); +// +// } catch (Exception e) { +// e.printStackTrace(); +// } +// } + +} diff --git a/src/com/connor/jk/plm/mail/Demo1.java b/src/com/connor/jk/plm/mail/Demo1.java new file mode 100644 index 0000000..d7dfbb1 --- /dev/null +++ b/src/com/connor/jk/plm/mail/Demo1.java @@ -0,0 +1,63 @@ +package com.connor.jk.plm.mail; + +import java.util.Properties; + +import javax.mail.Address; +import javax.mail.Message; +import javax.mail.Session; +import javax.mail.Transport; +import javax.mail.internet.InternetAddress; +import javax.mail.internet.MimeMessage; + + +public class Demo1 { + + /** + * @param args + * add by zxx ,Feb 5, 2009 + */ + + + public void sendmail(String zt,String sjr,String nr) { + // TODO Auto-generated method stub + try { + Address[] sendAddress = null; + String[] sendToMails = sjr.split(","); + for(String s :sendToMails){ + System.out.println("s==============="+s); + } + String emailTitle = zt; + String emailtext=nr; + System.out.println("zt==============="+zt); + System.out.println("nr==============="+nr); + Properties props = new Properties(); + props.setProperty("mail.smtp.auth", "true"); + props.setProperty("mail.transport.protocol", "smtp"); + Session session = Session.getInstance(props); + session.setDebug(true); + Message msg = new MimeMessage(session); + //msg.set + msg.setSubject(emailTitle); + + msg.setText(emailtext); + + + msg.setFrom(new InternetAddress("duanhj@connor.net.cn")); + Transport transport = session.getTransport(); + // transport.connect("mail.china-goldcard.com", + // 25,"plm@china-goldcard.com", "Goldcard1"); + transport.connect("smtp.connor.net.cn", 25, "duanhj@connor.net.cn", + "aaaa"); + + sendAddress = new Address[sendToMails.length]; + for (int i = 0; i < sendToMails.length; i++) { + sendAddress[i] = new InternetAddress(sendToMails[i]); + } + transport.sendMessage(msg, sendAddress); + transport.close(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } +} diff --git a/src/com/connor/jk/plm/mail/SendMail_Action.java b/src/com/connor/jk/plm/mail/SendMail_Action.java new file mode 100644 index 0000000..66c328b --- /dev/null +++ b/src/com/connor/jk/plm/mail/SendMail_Action.java @@ -0,0 +1,26 @@ +package com.connor.jk.plm.mail; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.common.actions.AbstractAIFAction; + +public class SendMail_Action extends AbstractAIFAction { + private AbstractAIFApplication app; + public SendMail_Action(AbstractAIFApplication arg0, String arg1) { + super(arg0, arg1); + // TODO Auto-generated constructor stub + this.app=arg0; + } + + @Override + public void run() { + // TODO Auto-generated method stub + SendMail_Command com=new SendMail_Command(app); + try { + com.executeModal(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + +} diff --git a/src/com/connor/jk/plm/mail/SendMail_Command.java b/src/com/connor/jk/plm/mail/SendMail_Command.java new file mode 100644 index 0000000..5479022 --- /dev/null +++ b/src/com/connor/jk/plm/mail/SendMail_Command.java @@ -0,0 +1,34 @@ +package com.connor.jk.plm.mail; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.AbstractAIFCommand; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class SendMail_Command extends AbstractAIFCommand { + private AbstractAIFApplication app; + private InterfaceAIFComponent targetComp; + private TCSession session; + public SendMail_Command(AbstractAIFApplication app) { + // TODO Auto-generated constructor stub + this.app=app; + this.targetComp = app.getTargetComponent(); + this.session = (TCSession) app.getSession(); + } + + @Override + public void executeModal() throws Exception { + // TODO Auto-generated method stub + super.executeModal(); + + if(targetComp!=null&&((TCComponent)targetComp).isTypeOf("ScheduleTask")){ + SendMail_Dialog dig=new SendMail_Dialog(targetComp, session); + }else{ + MessageBox.post("ѡִиò","ʾ",MessageBox.INFORMATION); + } + + + } +} diff --git a/src/com/connor/jk/plm/mail/SendMail_Dialog.java b/src/com/connor/jk/plm/mail/SendMail_Dialog.java new file mode 100644 index 0000000..b718246 --- /dev/null +++ b/src/com/connor/jk/plm/mail/SendMail_Dialog.java @@ -0,0 +1,281 @@ +package com.connor.jk.plm.mail; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.io.File; +import java.io.IOException; +import java.util.Vector; + +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.JTextField; + +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; + +public class SendMail_Dialog extends AbstractAIFDialog { + private InterfaceAIFComponent targetComp; + private TCSession session; + private JButton okBut = new JButton(""); + private JButton cBut = new JButton(""); + private JButton celBut = new JButton("ȡ"); + private JPanel jbutpan; + private JPanel jp; + private JPanel jp1; + private JPanel jpName; + private JPanel jpTxt; + private JScrollPane jsp; + private JList jlist; + private JTextField jt1; + private JTextField jt2; + private JTextArea jta; + private String mail = ""; + private String object_name = ""; + private String project_name = ""; + private Vector vet; + private Vector vetse; + private JTextField sejt; + private JButton seBut; + + + public SendMail_Dialog(InterfaceAIFComponent targetComp, TCSession session) { + this.targetComp = targetComp; + this.session = session; + load(); + init(); + + } + + public void load() { + // TODO Auto-generated method stub + vet = Sqljdbc(); + System.out.println("load"); + jlist = new JList(vet); + jlist.setVisibleRowCount(25); + // jlist.setFixedCellHeight(50); + jlist.setFixedCellWidth(150); + try { + + object_name = ((TCComponent) targetComp) + .getTCProperty("object_name") != null ? ((TCComponent) targetComp) + .getTCProperty("object_name").getStringValue() : ""; + TCComponent com = ((TCComponent) targetComp) + .getReferenceProperty("schedule_tag"); + if (com != null) { + project_name = com.getTCProperty("projects_list") != null ? com + .getTCProperty("projects_list").getStringValue() + : ""; + } + + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + + public void init() { + // TODO Auto-generated method stub + System.out.println("init"); + setTitle("ʼ"); + setSize(new Dimension(550, 500)); + setLayout(new BorderLayout()); + jp = new JPanel(new PropertyLayout()); + jp1 = new JPanel(new PropertyLayout()); + jbutpan = new JPanel(new PropertyLayout()); + jbutpan.add("1.1.left.top", new JLabel(" ")); + jbutpan.add("1.2.left.top", okBut); + jbutpan.add("1.3.left.top", cBut); + jbutpan.add("1.4.left.top", celBut); + jpName = new JPanel(new PropertyLayout()); + jsp = new JScrollPane(jlist); + JPanel jpse=new JPanel(new PropertyLayout()); + sejt=new JTextField(15); + seBut=new JButton(""); + jpse.add("1.1.left.top", sejt); + jpse.add("1.2.left.top", seBut); + jpName.add("1.1.left.top",jpse); + jpName.add("2.1.left.top", jsp); + jpTxt = new JPanel(new PropertyLayout()); + jt1 = new JTextField(28); + jt2 = new JTextField(32); + jta = new JTextArea(20, 32); + jta.setLineWrap(true); + jpTxt.add("1.1.left.top", new JLabel(":")); + jpTxt.add("1.2.left.top", jt1); + jpTxt.add("2.1.left.top", new JLabel("ռ:")); + jpTxt.add("2.2.left.top", jt2); + jpTxt.add("3.1.left.top", new JLabel(":")); + jpTxt.add("3.2.left.top",new JScrollPane(jta) ); + jta.setText("[:" + object_name + ";Ŀ:" + project_name + "]"); + jp1.add("1.1.left.top", jpTxt); + jp1.add("2.1.left.top", jbutpan); + jp.add("1.1.left.top", jpName); + jp.add("1.2.left.top", jp1); + add(jp, BorderLayout.CENTER); + setVisible(true); + seBut.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + String s=sejt.getText(); + if(!"".equals(s)){ + int col=vet.size(); + vetse=new Vector<>(); + System.out.println("col="+col); + for(int i=0;i Sqljdbc() { + Vector vect = new Vector<>(); + DataBaseControl dbc = null; + String[] paths;// · + String JdbcDriverClass = "com.microsoft.jdbc.sqlserver.SQLServerDriver"; + String ConnectionString = "jdbc:microsoft:sqlserver://10.200.1.66:1433;DatabaseName=ecology"; + String DbUser = "tc"; + String DbPass = "Tc_1234"; + dbc = new DataBaseControl(JdbcDriverClass, ConnectionString, DbUser, + DbPass); + String strSQLQuery = "select workcode,lastname,email from view_TC_humres"; + Vector v = dbc.orgQuery(strSQLQuery); + for (String[] ss : v) { + String str = ss[0] + ss[1] + "(" + ss[2] + ")"; + if (ss[2] != null && !ss[2].equals("")) { + vect.add(str); + } + + } + return vect; + + } + +} diff --git a/src/com/connor/jk/plm/mail/SendMail_Handler.java b/src/com/connor/jk/plm/mail/SendMail_Handler.java new file mode 100644 index 0000000..0a7e425 --- /dev/null +++ b/src/com/connor/jk/plm/mail/SendMail_Handler.java @@ -0,0 +1,21 @@ +package com.connor.jk.plm.mail; + +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.aifrcp.AIFUtility; + +public class SendMail_Handler extends AbstractHandler { + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + // TODO Auto-generated method stub + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + SendMail_Action action=new SendMail_Action(app,null); + new Thread(action).start(); + return null; + } + +} diff --git a/src/com/connor/jk/plm/paste/JKPasteOperation.java b/src/com/connor/jk/plm/paste/JKPasteOperation.java new file mode 100644 index 0000000..534cf11 --- /dev/null +++ b/src/com/connor/jk/plm/paste/JKPasteOperation.java @@ -0,0 +1,546 @@ +package com.connor.jk.plm.paste; + +import java.text.MessageFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Vector; + +import org.apache.log4j.Logger; + +import com.connor.jk.plm.tempToFormal.Util; +import com.teamcenter.rac.aif.AIFClipboard; +import com.teamcenter.rac.aif.AIFDesktop; +import com.teamcenter.rac.aif.AIFPortal; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.AbstractAIFUIApplication; +import com.teamcenter.rac.aif.kernel.AIFComponentContext; +import com.teamcenter.rac.aif.kernel.AbstractAIFSession; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.commands.newproxylink.NewProxyLinkCommand; +import com.teamcenter.rac.commands.newproxylink.NewProxyLinkOperation; +import com.teamcenter.rac.commands.open.OpenCommand; +import com.teamcenter.rac.commands.paste.PasteOperation; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentDataset; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCComponentGroup; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCComponentTcFile; +import com.teamcenter.rac.kernel.TCComponentTempProxyLink; +import com.teamcenter.rac.kernel.TCComponentTraceLink; +import com.teamcenter.rac.kernel.TCComponentType; +import com.teamcenter.rac.kernel.TCComponentUser; +import com.teamcenter.rac.kernel.TCComponentWorkContext; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.ConfirmationDialog; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.Registry; +import com.teamcenter.rac.util.log.Debug; + +/** + * + * + * @author hub + * + */ +public class JKPasteOperation extends PasteOperation { + + public JKPasteOperation(AbstractAIFUIApplication abstractaifuiapplication, TCComponent tccomponent, + InterfaceAIFComponent interfaceaifcomponent, String s) { + super(abstractaifuiapplication, tccomponent, interfaceaifcomponent, s); + statusUse = false; + cookieName = "PasteConfirm"; + openAfterPasteFlag = false; + AIFComponentContext aifcomponentcontext = new AIFComponentContext(tccomponent, interfaceaifcomponent, s); + contextArray = (new AIFComponentContext[] { aifcomponentcontext }); + } + + public JKPasteOperation(AbstractAIFUIApplication abstractaifuiapplication, TCComponent tccomponent, + InterfaceAIFComponent ainterfaceaifcomponent[], String s) { + super(abstractaifuiapplication, tccomponent, ainterfaceaifcomponent, s); + statusUse = false; + cookieName = "PasteConfirm"; + openAfterPasteFlag = false; + parentComp = tccomponent; + childrenComps = ainterfaceaifcomponent; + contextString = s; + } + + public JKPasteOperation(AbstractAIFUIApplication abstractaifuiapplication, TCComponent tccomponent, + InterfaceAIFComponent ainterfaceaifcomponent[], String s, boolean flag) { + super(abstractaifuiapplication, tccomponent, ainterfaceaifcomponent, s, flag); + statusUse = false; + cookieName = "PasteConfirm"; + openAfterPasteFlag = false; + parentComp = tccomponent; + childrenComps = ainterfaceaifcomponent; + contextString = s; + openAfterPasteFlag = flag; + } + + public JKPasteOperation(TCComponent tccomponent, InterfaceAIFComponent ainterfaceaifcomponent[], String s) { + super(tccomponent, ainterfaceaifcomponent, s); + statusUse = false; + cookieName = "PasteConfirm"; + openAfterPasteFlag = false; + parentComp = tccomponent; + childrenComps = ainterfaceaifcomponent; + contextString = s; + } + + public JKPasteOperation(AbstractAIFUIApplication abstractaifuiapplication, + AIFComponentContext aifcomponentcontext) { + super(abstractaifuiapplication, aifcomponentcontext); + statusUse = false; + cookieName = "PasteConfirm"; + openAfterPasteFlag = false; + contextArray = (new AIFComponentContext[] { aifcomponentcontext }); + } + + public JKPasteOperation(AIFComponentContext aifcomponentcontext) { + super(aifcomponentcontext); + statusUse = false; + cookieName = "PasteConfirm"; + openAfterPasteFlag = false; + contextArray = (new AIFComponentContext[] { aifcomponentcontext }); + } + + public JKPasteOperation(AIFComponentContext aifcomponentcontext, boolean flag) { + super(aifcomponentcontext, flag); + statusUse = false; + cookieName = "PasteConfirm"; + openAfterPasteFlag = false; + contextArray = (new AIFComponentContext[] { aifcomponentcontext }); + openAfterPasteFlag = flag; + } + + public JKPasteOperation(AbstractAIFUIApplication abstractaifuiapplication, + AIFComponentContext aaifcomponentcontext[]) { + this(aaifcomponentcontext); + System.out.println("aaaa7"); + } + + public JKPasteOperation(AIFComponentContext aaifcomponentcontext[]) { + super(aaifcomponentcontext); + statusUse = false; + cookieName = "PasteConfirm"; + openAfterPasteFlag = false; + contextArray = aaifcomponentcontext; + } + + public JKPasteOperation(TCComponent tccomponent, InterfaceAIFComponent ainterfaceaifcomponent[], String s, + Object obj, boolean flag) { + this(tccomponent, ainterfaceaifcomponent, s, obj, flag, false); + } + + public JKPasteOperation(TCComponent tccomponent, InterfaceAIFComponent ainterfaceaifcomponent[], String s, + Object obj, boolean flag, boolean flag1) { + super(tccomponent, ainterfaceaifcomponent, s, obj, flag, flag1); + statusUse = false; + cookieName = "PasteConfirm"; + openAfterPasteFlag = false; + + parentComp = tccomponent; + + childrenComps = ainterfaceaifcomponent; + contextString = s; + operationResultNew = obj; + statusUse = flag; + openAfterPasteFlag = flag1; + } + + // u8ӳ + private void getMsg() throws TCException { + // TODO Auto-generated method stub + + try { + if (parentComp.isTypeOf("Part Revision")) { + System.out.println("is PartRevision"); + for (InterfaceAIFComponent c : childrenComps) { + TCComponent cm = (TCComponent) c; + if (cm.isTypeOf(new String[] { "JK8AssiblyDrawRevision", "JK8PartDrawRevision", + "JK8PartDraw_CADRevision" })) { + System.out.println("is DrawRevision"); + cm.refresh(); + TCComponent[] tcs = cm.getReferenceListProperty("representation_for"); + String str = ""; + if (tcs != null && tcs.length >= 0) { + System.out.println("----------"); + for (TCComponent tc : tcs) { + str = str + tc.getTCProperty("item_id").getStringValue() + ","; + } + if (str.endsWith(",")) { + str = str.substring(0, str.length() - 1); + } + } + // String id=parentComp.getTCProperty("item_id").getStringValue(); + // str=str+id; + cm.getTCProperty("jk8U8NO").setStringValue(str); + cm.refresh(); + System.out.println(str); + } + } + } + + } catch (TCException e) { + // TODO Auto-generated catch block + Util.setByPass(false); + e.printStackTrace(); + } + + } + + public void executeOperation() throws TCException { + + System.out.println("paste"); + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + TCSession session= (TCSession) app.getSession(); + //жһЩ飬ǷͼֽͣǾͿճ + boolean isDraw=false; + TCSession tcsession = (TCSession) getSession(); + Registry registry = Registry.getRegistry(this); + if (parentComp != null && childrenComps != null) { + System.out.println(parentComp.getType()); + System.out.println(parentComp.getProperty("owning_user")); + String userid=""; + try { + userid = parentComp.getProperty("owning_user").split(" ")[1]; + System.out.println(userid); + userid=userid.substring(1, userid.length()-1); + System.out.println(userid); + TCComponentUser user=null; + try { + user=(TCComponentUser) session.search(" - ԱϢ", new String[] {"û ID"}, new String[] {userid})[0]; +// System.out.println(user.getLoginGroup().getGroupName()); +// +// System.out.println(user.getUserId()); +// System.out.println(session.getUser().getUserId()); + } catch (Exception e1) { + e1.printStackTrace(); + } + String group=session.getCurrentGroup().toString(); + if(group.equals("ṹ.оԺ")&&(user.getLoginGroup().getGroupName().equals("Ӳ") + ||user.getUserId().equals(session.getUser().getUserId()) + ||user.getLoginGroup().getGroupName().equals("ṹ") + )) { + for (InterfaceAIFComponent c : childrenComps) { + TCComponent cm = (TCComponent) c; + if (cm.isTypeOf(new String[] { "JK8AssiblyDrawRevision", "JK8PartDrawRevision", + "JK8PartDraw_CADRevision" })) { + isDraw=true; + + } + } + } + } catch (Exception e3) { + // TODO Auto-generated catch block + e3.printStackTrace(); + } +// System.out.println(parentComp.getTCProperty("owning_user").getStringValue()); + + if(isDraw==true) { + System.out.println("----------------------------·"); + try { + Util.setByPass(true); + } catch (TCException e2) { + e2.printStackTrace(); + } + try { + executeByChunk(); + } catch (TCException tcexception) { + Util.setByPass(false); + throw tcexception; + } + if (openAfterPasteFlag) + try { + OpenCommand opencommand = (OpenCommand) registry.newInstanceForEx("openCommand", + new Object[] { AIFUtility.getActiveDesktop(), childrenComps }); + opencommand.executeModeless(); + } catch (Exception exception) { + Util.setByPass(false); + logger.error(exception.getLocalizedMessage(), exception); + } + try { + getMsg(); + } catch (Exception e) { + Util.setByPass(false); + e.printStackTrace(); + } + // + try { + Util.setByPass(false); + } catch (TCException e2) { + e2.printStackTrace(); + } + }else { + System.out.println("----------------------------û·"); + try { + executeByChunk(); + } catch (TCException tcexception) { + throw tcexception; + } + if (openAfterPasteFlag) + try { + OpenCommand opencommand = (OpenCommand) registry.newInstanceForEx("openCommand", + new Object[] { AIFUtility.getActiveDesktop(), childrenComps }); + opencommand.executeModeless(); + } catch (Exception exception) { + logger.error(exception.getLocalizedMessage(), exception); + } + try { + getMsg(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + +// childrenComps.isTypeOf(new String[] { "JK8AssiblyDrawRevision", "JK8PartDrawRevision","JK8PartDraw_CADRevision" }) + return; + } + System.out.println("22222222222222222222"); + Object obj = null; + Object obj1 = null; + ArrayList arraylist = new ArrayList(); + boolean flag = false; + try { + ArrayList arraylist1 = new ArrayList(); + for (int i = 0; i < contextArray.length; i++) { + TCComponent tccomponent2 = (TCComponent) contextArray[i].getParentComponent(); + if (contextArray[i].getComponent() instanceof TCComponentTempProxyLink) { + TCComponentTempProxyLink tccomponenttempproxylink = (TCComponentTempProxyLink) contextArray[i] + .getComponent(); + setStatus(MessageFormat.format(registry.getString("pastingInto"), + new Object[] { tccomponenttempproxylink.toString(), tccomponent2.toString() })); + NewProxyLinkCommand newproxylinkcommand = new NewProxyLinkCommand( + tccomponenttempproxylink.getSession(), AIFDesktop.getActiveDesktop(), + tccomponenttempproxylink.getAppId(), new String[] { tccomponenttempproxylink.getObjId() }, + new InterfaceAIFComponent[] { tccomponent2 }, Boolean.FALSE); + newproxylinkcommand.executeModal(); + NewProxyLinkOperation newproxylinkoperation = newproxylinkcommand.getOperation(); + if (newproxylinkoperation != null) { + TCComponent atccomponent[] = newproxylinkoperation.getNewObjectLinks(); + if (atccomponent != null && atccomponent.length > 0) { + TCComponent tccomponent = atccomponent[0]; + String s = tccomponent2.getPreferredPasteRelation(tccomponent); + contextArray[i] = new AIFComponentContext(tccomponent2, tccomponent, s); + } else { + contextArray[i] = null; + } + } else { + contextArray[i] = null; + } + } else { + TCComponent tccomponent1 = (TCComponent) contextArray[i].getComponent(); + setStatus(MessageFormat.format(registry.getString("pastingInto"), + new Object[] { tccomponent1.toString(), tccomponent2.toString() })); + contextArray[i] = processPaste(contextArray[i], arraylist1); + arraylist.add(tccomponent1); + if (!flag && (tccomponent1 instanceof TCComponentWorkContext)) + flag = true; + } + } + + pasteInChunk(arraylist1); + } catch (Exception exception1) { + if (Debug.isOn("action,copy,cut,paste")) + Debug.printStackTrace(exception1); + throw new TCException(exception1); + } + + if (flag) + clearWorkContextProperty(tcsession); + if (openAfterPasteFlag && !arraylist.isEmpty()) { + InterfaceAIFComponent ainterfaceaifcomponent[] = (InterfaceAIFComponent[]) arraylist + .toArray(new InterfaceAIFComponent[arraylist.size()]); + try { + OpenCommand opencommand1 = (OpenCommand) registry.newInstanceForEx("openCommand", + new Object[] { AIFUtility.getActiveDesktop(), ainterfaceaifcomponent }); + opencommand1.executeModeless(); + } catch (Exception exception2) { + logger.error(exception2.getLocalizedMessage(), exception2); + } + } + + } + + private void executeByChunk() throws TCException { + if (parentComp == null || childrenComps == null) + return; + TCSession tcsession = parentComp.getSession(); + Registry registry = Registry.getRegistry(this); + AIFComponentContext aaifcomponentcontext[] = new AIFComponentContext[childrenComps.length]; + boolean flag = false; + try { + StringBuilder stringbuilder = new StringBuilder(); + for (int i = 0; i < childrenComps.length; i++) { + stringbuilder.append(i != 0 ? ", " : ""); + stringbuilder.append(childrenComps[i]); + } + + setStatus(MessageFormat.format(registry.getString("pastingInto"), + new Object[] { stringbuilder.toString(), parentComp.toString() })); + for (int j = 0; j < childrenComps.length; j++) { + aaifcomponentcontext[j] = new AIFComponentContext(parentComp, childrenComps[j], contextString); + if (!flag && (childrenComps[j] instanceof TCComponentWorkContext)) + flag = true; + } + + boolean flag1 = isConfirmPasteEnabled(); + boolean flag2 = false; + if (flag1) + flag2 = isExplicitPasteOperation(); + if (flag2) { + int k = ConfirmationDialog.post(AIFDesktop.getActiveDesktop(), registry.getString("pasteConfirmTitle"), + registry.getString("pasteConfirmText"), false, cookieName); + if (k == 2) + if ((parentComp instanceof TCComponentTraceLink) + && ((TCComponent) childrenComps[0]).isTypeOf("Fnd0CustomNoteRevision")) + pasteToNoteProperty(); + else + storeOperationResult(parentComp.pasteOperation(aaifcomponentcontext)); + } else if ((parentComp instanceof TCComponentTraceLink) + && ((TCComponent) childrenComps[0]).isTypeOf("Fnd0CustomNoteRevision")) + pasteToNoteProperty(); + else if ((parentComp instanceof TCComponentDataset) && contextString.equals("ref_list")) { + TCComponentDataset tccomponentdataset = (TCComponentDataset) parentComp; + for (int l = 0; l < childrenComps.length; l++) { + TCComponent tccomponent = (TCComponent) childrenComps[l]; + if (tccomponent instanceof TCComponentTcFile) { + TCComponentTcFile tccomponenttcfile = (TCComponentTcFile) tccomponent; + tccomponentdataset.addNamedReference(tccomponent, + tccomponenttcfile.getRefDatasetNamedReferences()); + } else if (tccomponent instanceof TCComponentForm) { + TCComponentForm tccomponentform = (TCComponentForm) tccomponent; + tccomponentdataset.addNamedReference(tccomponent, + tccomponentform.getRefDatasetNamedReferences()); + } + parentComp.refresh(); + } + + } else { + storeOperationResult(parentComp.pasteOperation(aaifcomponentcontext)); + } + } catch (TCException tcexception) { + int ai[] = tcexception.getErrorCodes(); + String s = contextString; + if (ai[0] == 38015) { + if (s == null || s.isEmpty()) + s = parentComp.getDefaultPasteRelation(); + String s1 = parentComp.getType(); + Object aobj[] = { s1, s }; + String s2 = MessageFormat.format(registry.getString("formattedAttachmentPanelPasteError"), aobj); + MessageBox.post(s2.trim(), registry.getString("warning.TITLE"), 4); + } else { + throw tcexception; + } + } + if (flag) + clearWorkContextProperty(tcsession); + } + + private void clearWorkContextProperty(AbstractAIFSession abstractaifsession) { + if (abstractaifsession != null && (abstractaifsession instanceof TCSession)) { + TCSession tcsession = (TCSession) abstractaifsession; + TCComponentUser tccomponentuser = tcsession.getUser(); + if (tccomponentuser != null) + tccomponentuser.clearCache("work_contexts"); + } + } + + private boolean isConfirmPasteEnabled() { + TCPreferenceService tcpreferenceservice = ((TCSession) AIFUtility.getCurrentApplication().getSession()) + .getPreferenceService(); + Boolean boolean1 = tcpreferenceservice.getLogicalValue("TC_confirm_paste_operation"); + return boolean1 != null && boolean1.booleanValue(); + } + + private boolean isExplicitPasteOperation() { + Vector vector = null; + boolean flag = false; + AIFClipboard aifclipboard = AIFPortal.getClipboard(); + java.awt.datatransfer.Transferable transferable = aifclipboard.getContents(this); + try { + if (transferable != null) + vector = (Vector) transferable + .getTransferData(new java.awt.datatransfer.DataFlavor(java.util.Vector.class, "AIF Vector")); + } catch (Exception exception) { + logger.error(exception.getLocalizedMessage(), exception); + vector = null; + } + if (vector != null) { + flag = true; + for (int i = 0; i < childrenComps.length; i++) { + int j = 0; + for (int k = 0; k < vector.size(); k++) { + if (((TCComponent) vector.get(k)).equals(childrenComps[i])) + break; + j++; + } + + if (j != vector.size()) + continue; + flag = false; + break; + } + + vector.clear(); + vector = null; + } + return flag; + } + + private void pasteToNoteProperty() throws TCException { + TCProperty tcproperty = parentComp.getTCProperty("fnd0CustomNotes"); + if (tcproperty != null) { + TCComponent atccomponent[] = tcproperty.getReferenceValueArray(); + ArrayList arraylist = new ArrayList(); + for (int i = 0; i < atccomponent.length; i++) + arraylist.add(atccomponent[i]); + + for (int j = 0; j < childrenComps.length; j++) + arraylist.add((TCComponent) childrenComps[j]); + + TCComponent atccomponent1[] = new TCComponent[arraylist.size()]; + atccomponent1 = (TCComponent[]) arraylist.toArray(new TCComponent[arraylist.size()]); + tcproperty.setReferenceValueArray(atccomponent1); + } + } + + public AIFComponentContext[] getTargetContexts() { + return contextArray; + } + + public Map getPartialFailedTargets() { + return Collections.EMPTY_MAP; + } + + private AIFComponentContext contextArray[]; + private InterfaceAIFComponent childrenComps[]; + private TCComponent parentComp; + private String contextString; + protected Object operationResultNew; + protected boolean statusUse; + private String cookieName; + private boolean openAfterPasteFlag; + public static final int relationNotFoundErrorCode = 38015; + private static final Logger logger = Logger.getLogger(com.teamcenter.rac.commands.paste.PasteOperation.class); + +} + +/* + * DECOMPILATION REPORT + * + * Decompiled from: + * F:\Teamcenter11ENV\JAVA\rac\plugins\com.teamcenter.rac.common_11000.2.0.jar + * Total time: 90 ms Jad reported messages/errors: Exit status: 0 Caught + * exceptions: + */ \ No newline at end of file diff --git a/src/com/connor/jk/plm/paste/Util.java b/src/com/connor/jk/plm/paste/Util.java new file mode 100644 index 0000000..31ba2b5 --- /dev/null +++ b/src/com/connor/jk/plm/paste/Util.java @@ -0,0 +1,53 @@ +package com.connor.jk.plm.paste; +import java.util.List; + +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.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +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.TCUserService; +import com.teamcenter.rac.util.MessageBox; + +public class Util { + public static TCPreferenceService service; + public static TCSession session; + public static TCUserService userservice;; + + static { + if (session == null) { + session = (TCSession) (AIFUtility.getCurrentApplication() + .getSession()); + } + if (service == null) + service = session.getPreferenceService(); + } + + public static void setByPass(boolean val) throws TCException { + if (userservice == null) { + userservice = session.getUserService(); + } + Object[] obj = new Object[1]; + obj[0] = "origin"; + if (val) { + userservice.call("ORIGIN_set_bypass", obj); + } else { + userservice.call("ORIGIN_close_bypass", obj); + } + } + + +} diff --git a/src/com/connor/jk/plm/pcb/GeneratePCB_Action.java b/src/com/connor/jk/plm/pcb/GeneratePCB_Action.java new file mode 100644 index 0000000..eb4916b --- /dev/null +++ b/src/com/connor/jk/plm/pcb/GeneratePCB_Action.java @@ -0,0 +1,27 @@ +package com.connor.jk.plm.pcb; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.common.actions.AbstractAIFAction; + +public class GeneratePCB_Action extends AbstractAIFAction{ + private AbstractAIFApplication app; + public GeneratePCB_Action(AbstractAIFApplication arg0,String arg1) { + super(arg0,arg1); + // TODO Auto-generated constructor stub + this.app=arg0; + } + + + @Override + public void run() { + // TODO Auto-generated method stub + GeneratePCB_Operation g=new GeneratePCB_Operation(app); + try { + g.executeOperation(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + +} diff --git a/src/com/connor/jk/plm/pcb/GeneratePCB_Handler.java b/src/com/connor/jk/plm/pcb/GeneratePCB_Handler.java new file mode 100644 index 0000000..3ef2ee9 --- /dev/null +++ b/src/com/connor/jk/plm/pcb/GeneratePCB_Handler.java @@ -0,0 +1,21 @@ +package com.connor.jk.plm.pcb; + +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.aifrcp.AIFUtility; + +public class GeneratePCB_Handler extends AbstractHandler{ + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + // TODO Auto-generated method stub + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + GeneratePCB_Action action=new GeneratePCB_Action(app,null); + new Thread(action).start(); + return null; + } + +} diff --git a/src/com/connor/jk/plm/pcb/GeneratePCB_Operation.java b/src/com/connor/jk/plm/pcb/GeneratePCB_Operation.java new file mode 100644 index 0000000..fee1db1 --- /dev/null +++ b/src/com/connor/jk/plm/pcb/GeneratePCB_Operation.java @@ -0,0 +1,259 @@ +package com.connor.jk.plm.pcb; + +import java.text.DecimalFormat; +import java.util.HashMap; + +import com.connor.jk.plm.createproject.GetLsmUtil; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.AbstractAIFOperation; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.kernel.TCUserService; +import com.teamcenter.rac.util.MessageBox; + +//ʶšƷͺ +public class GeneratePCB_Operation extends AbstractAIFOperation { + private AbstractAIFApplication app; + private InterfaceAIFComponent targetComp; + private TCSession session; + private String type; + private TCComponentForm form; + private HashMap realNameMap;// ѡֵ + private String[] pcball;// ʶ + private String allPCB=""; + + public GeneratePCB_Operation(AbstractAIFApplication app) { + // TODO Auto-generated constructor stub + this.app = app; + this.targetComp = app.getTargetComponent(); + this.session = (TCSession) app.getSession(); + this.type = targetComp.getType(); + String[] names = session.getPreferenceService().getStringValues( + "JK8PCBNORegForm_Rule"); + if (names != null) { + realNameMap = new HashMap<>(); + for (int i = 0; i < names.length; i++) { + String[] s = names[i].split(":"); + if (s != null && s.length == 2) { + String key = s[0]; + String value = s[1]; + realNameMap.put(key, value); + } else { + MessageBox.post("ѡ JK8PCBNORegForm_Rule ôϵԱ", "", + MessageBox.ERROR); + return; + } + + } + + } else { + MessageBox + .post("ѡ JK8PCBNORegForm_Rule ڣϵԱ", "", MessageBox.ERROR); + } + TCPreferenceService pref = session.getPreferenceService(); + String puid = pref.getStringValue("JK_PCBReg_uid");// ѡpuid + if (puid == null) { + MessageBox.post("ѡδҵϵԱ", "", MessageBox.ERROR); + } + + TCComponentForm formAll; + try { + formAll = (TCComponentForm) session.stringToComponent(puid); + if (formAll == null) { + MessageBox.post("δҵϵԱ", "", MessageBox.ERROR); + } + + pcball = formAll.getTCProperty("jk8PCBNO").getStringArrayValue(); + if(pcball!=null) + for(String s:pcball){ + allPCB=allPCB+s+","; //ʶһַ + } + allPCB=allPCB.replaceAll("", "("); + allPCB=allPCB.replaceAll("", ")"); + + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + @Override + public void executeOperation() throws Exception { + // TODO Auto-generated method stub + if (targetComp instanceof TCComponentForm) { + form = (TCComponentForm) targetComp; + } else { + MessageBox.post("ѡбִв", "", 0); + return; + } + GetLsmUtil ge=new GetLsmUtil(); + String sbh = "";// ʶ + if ("JK8PCBNOAppForm".equals(type)) {// "PCB"; + String sbh_old = form.getTCProperty("jk8PCBNO") + .getStringValue();// ʶ +// if (sbh_old != null && !sbh_old.equals("")) { +// MessageBox.post("Ѵ޷ظ", "ʾ", MessageBox.INFORMATION); +// return; +// } + String gsbs = form.getTCProperty("jk8Companylogo") + .getStringValue();// ˾ʶ + String jlfs = form.getTCProperty("jk8MeasureType") + .getStringValue();// ԭ + String txfs = form.getTCProperty("jk8CommunicateMode") + .getStringValue();// ͨѶʽ + String yyfw = form.getTCProperty("jk8Application") + .getStringValue();// Ӧ÷Χ + if(gsbs==null||gsbs.equals("")){ + MessageBox.post("PCBʧ,˾ʶΪ", "", MessageBox.ERROR); + return; + }else if (jlfs==null||jlfs.equals("")) { + MessageBox.post("PCBʧ,ԭΪ", "", MessageBox.ERROR); + return; + }else if(txfs==null||txfs.equals("")){ + MessageBox.post("PCBʧ,ͨѶʽΪ", "", MessageBox.ERROR); + return; + }else if (yyfw==null||yyfw.equals("")) { + MessageBox.post("PCBʧ,Ӧ÷ΧΪ", "", MessageBox.ERROR); + return; + } + String gsbs_gz = setVal(gsbs, "˾ʶ"); + String jlfs_gz = setVal(jlfs, "ԭ"); + String txfs_gz = setVal(txfs, "ͨѶʽ"); + String yyfw_gz = setVal(yyfw, "Ӧ÷Χ"); + sbh = gsbs_gz+jlfs_gz + txfs_gz + yyfw_gz; + + +// for(int i=0;i<9999;i++){ +// String str=ge.getLsm("pcblsm", sbh, "0000");//getCodeNumber(sbh, 6, 1, 99, 1, ""); +// if(!allPCB.contains(str)){ +// sbh=str; +// System.out.println("sbh="+sbh); +// break; +// } +// } + System.out.println("20171030"); + for(int i=0;i<9999;i++){ + int ls=ge.getLsm3("pcblsm", "pcbbm_lsm", "0000");//getCodeNumber(sbh, 6, 1, 99, 1, ""); + if(ls<220){ //ˢݿ,>220 + continue; + } + DecimalFormat df=new DecimalFormat("0000"); + String lsh=df.format(ls); + if(!allPCB.contains(lsh)){ + sbh=sbh+lsh; + System.out.println("sbh="+sbh); + break; + } + } + + String str2=ge.getLsm2("pcblsmrev", sbh, "00");//̨+1 + + sbh=sbh+"(V0.1)"; + System.out.println("sbh="+sbh); + if(allPCB.contains(sbh)){ + MessageBox.post("PCBʧ,ܱѴڸñ", "", MessageBox.ERROR); + return; + } + form.getTCProperty("jk8PCBNO").setStringValue(sbh);// ʶ + if (!sbh.equals("")) { + MessageBox.post("PCB,鿴", "ʾ", MessageBox.INFORMATION); + } else { + MessageBox.post("PCBʧ,", "", MessageBox.ERROR); + } + + } else if ("JK8DerPCBNOAppForm".equals(type)) {// "PCB"; + String sbh_old = form.getTCProperty("jk8PCBNO") + .getStringValue();// ʶ +// if (sbh_old != null && !sbh_old.equals("")) { +// MessageBox.post("Ѵ޷ظ", "ʾ", MessageBox.INFORMATION); +// return; +// } + +// String gsbs = form.getTCProperty("jk8ApplyType") +// .getStringValue();// ˾ʶ +// String jlfs = form.getTCProperty("jk8BMManufactor") +// .getStringValue();// ʽ +// String txfs = form.getTCProperty("jk8ProductType") +// .getStringValue();// ͨѶʽ +// String yyfw = form.getTCProperty("jk8ContrlCompType") +// .getStringValue();// Ӧ÷Χ +// String gsbs_gz = setVal(gsbs, "˾ʶ"); +// String jlfs_gz = setVal(jlfs, "ʽ"); +// String txfs_gz = setVal(txfs, "ͨѶʽ"); +// String yyfw_gz = setVal(yyfw, "Ӧ÷Χ"); +// sbh = gsbs_gz+jlfs_gz + txfs_gz + yyfw_gz; + String old = form.getTCProperty("jk8BasePCBNO") + .getStringValue();// ԭ + old=old.replaceAll("", "("); + old=old.replaceAll("", ")"); + String[] olds=old.split("\\("); + if(olds!=null&&olds.length>1){ + old=olds[0]; + } + for(int i=0;i<99;i++){ + String str2=ge.getLsm2("pcblsmrev", old, "00");//getCodeNumber(sbh, 6, 1, 99, 1, ""); + if(str2.length()>1){ + StringBuilder sb = new StringBuilder (str2); + sb.insert(1, "."); + sb.toString(); + sbh=old+"(V"+sb.toString()+")"; + if(!allPCB.contains(sbh)){ + System.out.println("sbhrev="+sbh); + break; + } + } + } + + form.getTCProperty("jk8PCBNO").setStringValue(sbh);// ʶ + if (!sbh.equals("")) { + MessageBox.post("PCB,鿴", "ʾ", MessageBox.INFORMATION); + } else { + MessageBox.post("PCBʧ,", "", MessageBox.ERROR); + } + + } else { + MessageBox.post("ѡƷͺʶִв", "", MessageBox.ERROR); + } + } + + private String setVal(String key, String Allkey) { + // TODO Auto-generated method stub + String[] all = realNameMap.get(Allkey).split(","); + HashMap Map_all = new HashMap<>(); + for (int i = 0; i < all.length; i++) { + System.out.println("ss=" + all[i]); + Map_all.put(all[i].split("=")[0], all[i].split("=")[1]); + } + if (Map_all.containsKey(key)) { + System.out.println(Allkey + "=" + Map_all.get(key)); + return Map_all.get(key).trim(); + } else { + System.out.println(Allkey + "="); + return ""; + } + + } + +// public String getCodeNumber(String patternCode, int codeLength, +// int startIndex, int maxValue, int increaseStep, String excludeStr) { +// +// TCUserService userService = session.getUserService(); +// +// codeLength = String.valueOf(maxValue).length(); +// Object[] params = { patternCode.trim(), codeLength, startIndex, +// maxValue, increaseStep, excludeStr }; +// +// try { +// String str = ""; +// str = (String) userService.call("queryPartNo", params); +// return str; +// } catch (Exception e) { +// e.printStackTrace(); +// return null; +// } +// } + +} diff --git a/src/com/connor/jk/plm/project/ProgressBar.java b/src/com/connor/jk/plm/project/ProgressBar.java new file mode 100644 index 0000000..870a477 --- /dev/null +++ b/src/com/connor/jk/plm/project/ProgressBar.java @@ -0,0 +1,171 @@ +/** + * @file ProgressBar.java + * + * @brief Create progress bar + * + * @author Yanghui + * + * @history + * ================================================================ + * Date Name Description of Change + * 25-July-2008 Yanghui this class is used to create + * progress bar. + */ +package com.connor.jk.plm.project; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JProgressBar; +import javax.swing.Timer; +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.util.PropertyLayout; +import com.teamcenter.rac.util.Registry; + +/** + * @class ProgressBar + * @brief Create progress bar + * @author Yanghui + */ +public class ProgressBar extends AbstractAIFDialog implements ActionListener { + /** + * @var ProgressBar.progressbar + * @brief JProgressBar + */ + private JProgressBar progressbar; + + /** + * @var ProgressBar.label + * @brief label used to tips + */ + private JLabel label; + + /** + * @var ProgressBar.timer + * @brief timer used to timing operation + */ + private Timer timer; + + /** + * @var ProgressBar.bool + * @brief bool used to flag thread return + */ + private boolean bool = false; + + /** + * @var Progressbar.registry + * @brief Registry + */ + private Registry registry; + + /** + * @fn public ProgressBar() + * @brief constructor + * @param[in] null + */ + private String showLable = null ; + public ProgressBar(String showlable) { + super(true); + showLable = showlable; + this.setAlwaysOnTop(true); + } + + /** + * @fn public void setBool(boolean bool) + * @brief set bool value + * @param[in] bool + * @param[out] null + */ + public void setBool(boolean bool) { + this.bool = bool; + } + + /** + * @fn private void initUI() + * @brief createDialog method + * @param[in] null + * @param[out] null + */ + public void initUI() { + Container container = getContentPane(); + JPanel mainPanel = new JPanel(new PropertyLayout()); + this.label = new JLabel(showLable, JLabel.CENTER); + this.progressbar = new JProgressBar(); + this.progressbar.setOrientation(JProgressBar.HORIZONTAL); + this.progressbar.setMinimum(0); + this.progressbar.setMaximum(100); + this.progressbar.setValue(0); + this.progressbar.setPreferredSize(new Dimension(200, 15)); + this.progressbar.setBorderPainted(true); + this.timer = new Timer(50, (ActionListener) this); + this.timer.setRepeats(false); + mainPanel.add("1.1.center", new JLabel(" ")); + mainPanel.add("2.1.center", label); + mainPanel.add("3.1.center", progressbar); + mainPanel.add("4.1.center", new JLabel(" ")); + container.add(mainPanel); + pack(); + setLocation(500, 200); + TaskThread thread = new TaskThread(this); + thread.start(); + addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + bool = true; + } + }); + this.setVisible(true); + } + + /** + * @class TaskThread + * @brief Create progressbar + * + */ + class TaskThread extends Thread { + private ProgressBar bar; + + public TaskThread(ProgressBar bar) { + this.bar = bar; + } + + public void run() { + if (bool == false) { + // Set Status is running. + // session.setStatus(registry.getString("export Running")); + } + for (int i = 0; i < i + 1; i++) { + timer.start(); + int value = progressbar.getValue(); + if (value < 100) { + value = value + 5; + progressbar.setValue(value); + } else { + timer.stop(); + progressbar.setValue(0); + } + try { + sleep(100); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + if (bool == true) { + bar.setVisible(false); + bar.dispose(); + return; + + } + + } + } + } + + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + + } +} diff --git a/src/com/connor/jk/plm/project/ProgressBarThread.java b/src/com/connor/jk/plm/project/ProgressBarThread.java new file mode 100644 index 0000000..d6bd71c --- /dev/null +++ b/src/com/connor/jk/plm/project/ProgressBarThread.java @@ -0,0 +1,41 @@ +/** + * @file ProgressBarThread.java + * + * @brief control progressBar. + * + * @author Yanghui + * + * @history + * ================================================================ + * Date Name Description of Change + * 08-Auguest-2008 Yanghui this class is used to control + * progress bar. + */ +package com.connor.jk.plm.project; + +/** + * @class ProgressBarThread + * @brief Create progress bar thread + * @author Yanghui + */ +public class ProgressBarThread extends Thread { + + private ProgressBar bar; + + private String title; + + public ProgressBarThread(String title,String showLable) { + this.title = title; + bar = new ProgressBar(showLable); + } + + public void run() { + bar.setTitle(title); + bar.initUI(); + } + + public void setBool(boolean bool) { + bar.setBool(true); + bar.setAlwaysOnTop(false); + } +} diff --git a/src/com/connor/jk/plm/project/ProjectBean.java b/src/com/connor/jk/plm/project/ProjectBean.java new file mode 100644 index 0000000..78266d4 --- /dev/null +++ b/src/com/connor/jk/plm/project/ProjectBean.java @@ -0,0 +1,337 @@ +package com.connor.jk.plm.project; + +public class ProjectBean { + + private String projectId;// ĿID + private String projectName;// Ŀ + private String doResearch;// Ƿз + private String sdate;// ʱ + private String projectState;// Ŀ׶ + private String ifxm;// ǷĿ + private String projectManager;// Ŀ + private String productManager;// Ʒ + private String productDirect;// Ʒܼ + private String projectLevel;// Ŀȼ + private String projectType;// Ŀ + private String bussinessUnit;// ҵ + private String isResearchProject;// ǷĿ + private String systemTime;// ͬʱ + private String edate;// ʱ + + // 2017.9.26 ӵ + private String object_desc;// + private String jk8ProductLine;// Ʒ + private String jk8EstStartDate;// Ԥƿʼʱ + private String jk8EstCompleteDate;// Ԥƽʱ + private String jk8ProjBudget;// Ԥ + private String jk8PhaseBudget;// ׶Ԥ + private String jk8ImplementBudget;// ִ + private String jk8ProjBudgetRatio;// ִ + private String jk8PhaseBudgetRatio;// ׶ִ + private String jk8HumanCost;// Ԥ + private String jk8ProjCoopForm;// Ŀʽ + private String jk8ProjSource;// ĿԴ + private String jk8ProjResForm;// Ŀɹʽ + private String jk8ExtExplain;// ⹫ + + private String owning_user;// + private String owning_group;// ID + private String last_mod_user;// ϴ޸û + + //2017.10.10ӵ + private String JK8SubProject;//ĿĿ + private String jk8Phasedovertime;//׶Թرʱ + private String oa_id; + + //2018.2.28ϵͳʦ + private String jk8SystemEngineer; + + public String getJk8SystemEngineer() { + return jk8SystemEngineer; + } + + public void setJk8SystemEngineer(String jk8SystemEngineer) { + this.jk8SystemEngineer = jk8SystemEngineer; + } + + public String getOa_id() { + return oa_id; + } + + public void setOa_id(String oa_id) { + this.oa_id = oa_id; + } + + public String getJK8SubProject() { + return JK8SubProject; + } + + public void setJK8SubProject(String jK8SubProject) { + JK8SubProject = jK8SubProject; + } + + public String getJk8Phasedovertime() { + return jk8Phasedovertime; + } + + public void setJk8Phasedovertime(String jk8Phasedovertime) { + this.jk8Phasedovertime = jk8Phasedovertime; + } + + public String getObject_desc() { + return object_desc; + } + + public void setObject_desc(String object_desc) { + this.object_desc = object_desc; + } + + public String getJk8ProductLine() { + return jk8ProductLine; + } + + public void setJk8ProductLine(String jk8ProductLine) { + this.jk8ProductLine = jk8ProductLine; + } + + public String getJk8EstStartDate() { + return jk8EstStartDate; + } + + public void setJk8EstStartDate(String jk8EstStartDate) { + this.jk8EstStartDate = jk8EstStartDate; + } + + public String getJk8EstCompleteDate() { + return jk8EstCompleteDate; + } + + public void setJk8EstCompleteDate(String jk8EstCompleteDate) { + this.jk8EstCompleteDate = jk8EstCompleteDate; + } + + public String getJk8ProjBudget() { + return jk8ProjBudget; + } + + public void setJk8ProjBudget(String jk8ProjBudget) { + this.jk8ProjBudget = jk8ProjBudget; + } + + public String getJk8PhaseBudget() { + return jk8PhaseBudget; + } + + public void setJk8PhaseBudget(String jk8PhaseBudget) { + this.jk8PhaseBudget = jk8PhaseBudget; + } + + public String getJk8ImplementBudget() { + return jk8ImplementBudget; + } + + public void setJk8ImplementBudget(String jk8ImplementBudget) { + this.jk8ImplementBudget = jk8ImplementBudget; + } + + public String getJk8ProjBudgetRatio() { + return jk8ProjBudgetRatio; + } + + public void setJk8ProjBudgetRatio(String jk8ProjBudgetRatio) { + this.jk8ProjBudgetRatio = jk8ProjBudgetRatio; + } + + public String getJk8PhaseBudgetRatio() { + return jk8PhaseBudgetRatio; + } + + public void setJk8PhaseBudgetRatio(String jk8PhaseBudgetRatio) { + this.jk8PhaseBudgetRatio = jk8PhaseBudgetRatio; + } + + public String getJk8HumanCost() { + return jk8HumanCost; + } + + public void setJk8HumanCost(String jk8HumanCost) { + this.jk8HumanCost = jk8HumanCost; + } + + public String getJk8ProjCoopForm() { + return jk8ProjCoopForm; + } + + public void setJk8ProjCoopForm(String jk8ProjCoopForm) { + this.jk8ProjCoopForm = jk8ProjCoopForm; + } + + public String getJk8ProjSource() { + return jk8ProjSource; + } + + public void setJk8ProjSource(String jk8ProjSource) { + this.jk8ProjSource = jk8ProjSource; + } + + public String getJk8ProjResForm() { + return jk8ProjResForm; + } + + public void setJk8ProjResForm(String jk8ProjResForm) { + this.jk8ProjResForm = jk8ProjResForm; + } + + public String getJk8ExtExplain() { + return jk8ExtExplain; + } + + public void setJk8ExtExplain(String jk8ExtExplain) { + this.jk8ExtExplain = jk8ExtExplain; + } + + public String getOwning_user() { + return owning_user; + } + + public void setOwning_user(String owning_user) { + this.owning_user = owning_user; + } + + public String getOwning_group() { + return owning_group; + } + + public void setOwning_group(String owning_group) { + this.owning_group = owning_group; + } + + public String getLast_mod_user() { + return last_mod_user; + } + + public void setLast_mod_user(String last_mod_user) { + this.last_mod_user = last_mod_user; + } + + public String getProjectId() { + return projectId; + } + + public void setProjectId(String projectId) { + this.projectId = projectId; + } + + public String getProjectName() { + return projectName; + } + + public void setProjectName(String projectName) { + this.projectName = projectName; + } + + public String getDoResearch() { + return doResearch; + } + + public void setDoResearch(String doResearch) { + this.doResearch = doResearch; + } + + public String getSdate() { + return sdate; + } + + public void setSdate(String sdate) { + this.sdate = sdate; + } + + public String getProjectState() { + return projectState; + } + + public void setProjectState(String projectState) { + this.projectState = projectState; + } + + public String getIfxm() { + return ifxm; + } + + public void setIfxm(String ifxm) { + this.ifxm = ifxm; + } + + public String getProjectManager() { + return projectManager; + } + + public void setProjectManager(String projectManager) { + this.projectManager = projectManager; + } + + public String getProductManager() { + return productManager; + } + + public void setProductManager(String productManager) { + this.productManager = productManager; + } + + public String getProductDirect() { + return productDirect; + } + + public void setProductDirect(String productDirect) { + this.productDirect = productDirect; + } + + public String getProjectLevel() { + return projectLevel; + } + + public void setProjectLevel(String projectLevel) { + this.projectLevel = projectLevel; + } + + public String getProjectType() { + return projectType; + } + + public void setProjectType(String projectType) { + this.projectType = projectType; + } + + public String getBussinessUnit() { + return bussinessUnit; + } + + public void setBussinessUnit(String bussinessUnit) { + this.bussinessUnit = bussinessUnit; + } + + public String getIsResearchProject() { + return isResearchProject; + } + + public void setIsResearchProject(String isResearchProject) { + this.isResearchProject = isResearchProject; + } + + public String getSystemTime() { + return systemTime; + } + + public void setSystemTime(String systemTime) { + this.systemTime = systemTime; + } + + public String getEdate() { + return edate; + } + + public void setEdate(String edate) { + this.edate = edate; + } + +} diff --git a/src/com/connor/jk/plm/project/Project_Action.java b/src/com/connor/jk/plm/project/Project_Action.java new file mode 100644 index 0000000..028ad25 --- /dev/null +++ b/src/com/connor/jk/plm/project/Project_Action.java @@ -0,0 +1,27 @@ +package com.connor.jk.plm.project; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.common.actions.AbstractAIFAction; + +public class Project_Action extends AbstractAIFAction { +private AbstractAIFApplication app; + + public Project_Action(AbstractAIFApplication app, String String) { + super(app, String); + this.app=app; + } + + + @Override + public void run() { + Project_Dialog dialog=new Project_Dialog(app); + new Thread(dialog).start(); + + } + +} diff --git a/src/com/connor/jk/plm/project/Project_Dialog.java b/src/com/connor/jk/plm/project/Project_Dialog.java new file mode 100644 index 0000000..f2a6616 --- /dev/null +++ b/src/com/connor/jk/plm/project/Project_Dialog.java @@ -0,0 +1,170 @@ +package com.connor.jk.plm.project; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.File; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; + +import javax.swing.JButton; +import javax.swing.JFileChooser; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; +import javax.swing.filechooser.FileSystemView; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; + +public class Project_Dialog extends AbstractAIFDialog implements +ActionListener{ + private AbstractAIFApplication app; + private TCSession session; + private JPanel mainJpanel; + private JLabel pathJlabel; + private JTextField pathJTextField; + private JFileChooser chooser; + + private JButton okButton; + private JButton celButton; + + JLabel startLabel; + JTextField startField = new JTextField(20); + JLabel endLabel; + JTextField endField = new JTextField(20); + JButton startSelect; + JButton endSelect; + + + private JButton pathButton; + + private JPanel bottomJpanel; + + private String exportFile; + + private ProgressBarThread wait; + private TCPreferenceService tcPreferenceService; + public Project_Dialog(AbstractAIFApplication app) { + + this.app=app; + this.session=(TCSession) app.getSession(); + } + + @Override + public void run() { +// super.run();//ע򴰿ʾ + tcPreferenceService = session.getPreferenceService(); + String[] user=tcPreferenceService.getStringValue("jk_QA").split(","); + String owner=session.getUserName(); + System.out.println(owner); + boolean isReturn=false; + for (int i = 0; i < user.length; i++) { + if(user[i].equals(owner)) { + isReturn=true; + } + } + if(!isReturn) { + MessageBox.post("޴Ȩ޲鿴","",MessageBox.INFORMATION); + return; + } + initUI(); + } + + private void initUI() { + this.setTitle("Ŀ嵥"); + pathJlabel=new JLabel("ѡ񵼳·"); + pathJTextField=new JTextField(20); + FileSystemView fileSystemView=FileSystemView.getFileSystemView(); + String route=fileSystemView.getHomeDirectory().getPath(); + pathJTextField.setText(route); + + chooser=new JFileChooser(); + this.chooser.setCurrentDirectory(new File(route)); + this.chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + + + pathButton=new JButton("..."); + pathButton.addActionListener(this); + okButton=new JButton("ȷ"); + okButton.addActionListener(this); + this.getRootPane().setDefaultButton(okButton);//õǰĬѡаť + celButton=new JButton("ȡ"); + celButton.addActionListener(this); + + + this.setLayout(new BorderLayout()); + this.setAlwaysOnTop(true); + mainJpanel=new JPanel(new PropertyLayout()); + mainJpanel.add("1.1.left.top",pathJlabel); + mainJpanel.add("1.2.left.top",pathJTextField); + mainJpanel.add("1.3.left.top",pathButton); + bottomJpanel=new JPanel(new FlowLayout()); + bottomJpanel.add(okButton); + bottomJpanel.add(celButton); + + + this.add(mainJpanel,BorderLayout.CENTER); + this.add(bottomJpanel,BorderLayout.SOUTH); + this.pack(); + this.centerToScreen(); + this.showDialog(); + } + + @Override + public void actionPerformed(ActionEvent e) { + Object sourceObj = e.getSource(); + if(sourceObj.equals(pathButton)){ + selectFileButtonEvent(); + }else if(sourceObj.equals(okButton)){ + this.disposeDialog(); + this.dispose(); + this.wait = new ProgressBarThread("", "ȡУԵ..."); + this.wait.start(); + exportFile=pathJTextField.getText(); + + Project_Operation operation=new Project_Operation(this.wait,app,exportFile); + this.session.queueOperation(operation); + }else if(sourceObj.equals(celButton)){ + this.disposeDialog(); + this.dispose(); + } + + } + + public long getDate(String dstr) { + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");//СдmmʾǷ + Date date=null; + try { + date = sdf.parse(dstr); + } catch (ParseException e1) { + e1.printStackTrace(); + } + //ȡ + long longDate = date.getTime(); + return longDate; + } + private void selectFileButtonEvent() { + this.setAlwaysOnTop(false); + int state = chooser.showOpenDialog(null);// ˾ǴļѡĴ + if (state == 1) { + return; + } else { + File f = chooser.getSelectedFile();// fΪѡ񵽵Ŀ¼ + pathJTextField.setText(f.getAbsolutePath()); + this.setAlwaysOnTop(true); + } + + } + + + +} diff --git a/src/com/connor/jk/plm/project/Project_Handler.java b/src/com/connor/jk/plm/project/Project_Handler.java new file mode 100644 index 0000000..9867674 --- /dev/null +++ b/src/com/connor/jk/plm/project/Project_Handler.java @@ -0,0 +1,22 @@ +package com.connor.jk.plm.project; + +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.aifrcp.AIFUtility; + +public class Project_Handler extends AbstractHandler { + ; + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + + Project_Action action=new Project_Action(app,null); + new Thread(action).start(); + return null; + } + +} diff --git a/src/com/connor/jk/plm/project/Project_Operation.java b/src/com/connor/jk/plm/project/Project_Operation.java new file mode 100644 index 0000000..2a75146 --- /dev/null +++ b/src/com/connor/jk/plm/project/Project_Operation.java @@ -0,0 +1,713 @@ +package com.connor.jk.plm.project; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.poi.ss.usermodel.BorderStyle; +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.eclipse.ui.internal.menus.TrimAdditionCacheEntry; + +//import com.connor.jk.plm.TC_OA_Integration.SqlUtil; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.AbstractAIFOperation; +import com.teamcenter.rac.kernel.TCComponentDataset; +import com.teamcenter.rac.kernel.TCComponentTcFile; +import com.teamcenter.rac.kernel.TCComponentUser; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.kernel.tcservices.TcServicesService; +import com.teamcenter.rac.util.MessageBox; + +public class Project_Operation extends AbstractAIFOperation { + private AbstractAIFApplication app; + private String exportFile; + private TCSession session; + private TCPreferenceService tcPreferenceService; + private List valueLists = new ArrayList(); + private List valueListsNew = new ArrayList(); + private ProjectBean bean; + + private Map userid_nameMap=new HashMap<>(); + private FileInputStream fis; + private FileOutputStream fos; + private XSSFWorkbook workBook; + private ProgressBarThread wait; + long startLong; + long endLong; + + //2018.5.21 + private Map productManager_name_idMap=new HashMap<>(); + private Map productDirector_name_idMap=new HashMap<>(); + + + public Project_Operation(ProgressBarThread wait, AbstractAIFApplication app, String exportFile) { + this.app = app; + this.exportFile = exportFile; + this.session = (TCSession) app.getSession(); + this.wait = wait; + userid_nameMap=findPeople3(userid_nameMap); + } + + @Override + public void executeOperation() throws Exception { + long start = System.currentTimeMillis(); + String ssx = "jk_project_uid";// ģѡ AKWlp3cQYvbLjA ArYld3uJYvbLjA + File fmsFile = getExcle(ssx);// ģ + // int num=0; + + if (fmsFile == null) { + MessageBox.post("ģϵԱ", "", MessageBox.ERROR); + return; + } + tcPreferenceService = session.getPreferenceService(); + String driver_temp = ""; + String url = ""; + String dbName = ""; + String dbPassword = ""; + + + +// MessageBox.post(s1 + "\n" + s2, "", MessageBox.INFORMATION); + + String[] Jk8ProjectStatus = tcPreferenceService.getStringValue("jk_ Jk8ProjectState").split(",");// Ŀ״̬ + String[] Jk8ProjectLevel = tcPreferenceService.getStringValue("jk_ Jk8ProjectLevel").split(";");// Ŀȼ + String[] Jk8ProjectType = tcPreferenceService.getStringValue("jk_ Jk8ProjectType").split(",");// Ŀ + String[] Jk8BussinessUnit = tcPreferenceService.getStringValue("jk_ Jk8BussinessUnit").split(",");// ҵ + String[] Jk8IsResearchProj = tcPreferenceService.getStringValue("jk_ Jk8IsResearchProj").split(",");// ǷзĿ + String[] Jk8ProductorDirector = tcPreferenceService.getStringValue("jk8ProductDirector").split(",");// Ʒܼѡ + for (int i = 0; i < Jk8ProductorDirector.length; i++) { + String name=Jk8ProductorDirector[i].split("-")[1]; + String id=Jk8ProductorDirector[i].split("-")[0]; + productDirector_name_idMap.put(id,name); + + } + String[] Jk8ProductorManager = tcPreferenceService.getStringValue("jk8ProductManager").split(",");// Ʒѡ + for (int i = 0; i < Jk8ProductorManager.length; i++) { + String name=Jk8ProductorManager[i].split("-")[1]; + String id=Jk8ProductorManager[i].split("-")[0]; + productManager_name_idMap.put(id,name); + } + try { + String[] connect = tcPreferenceService.getStringValue("jk_tc_oa_integration").split("&"); + if (connect.length == 0) { + System.out.println("ѡ"); + return; + } + dbName = connect[0]; + dbPassword = connect[1]; + url = connect[2]; + driver_temp = connect[3]; + } catch (Exception e1) { + MessageBox.post("ѡjk_tc_oa_integration", "", MessageBox.ERROR); + e1.printStackTrace(); + return; + } + + // 2017.10.18 Ҫ鿴мԹж +// String s1 = ""; +// String s2 = ""; +// try { +// SqlUtil.getConnection(dbName, dbPassword, url, driver_temp); +// +// String searchQuestion_TC_project_info = "select * from TC_project_info "; +// ResultSet set_TC_project_info = SqlUtil.read(searchQuestion_TC_project_info);// ִ +// int rowCount = 0; +// while(set_TC_project_info.next()) { +// rowCount++; +// } +//// set_TC_project_info.last(); // ƶһ +//// int rowCount = set_TC_project_info.getRow(); // õǰкţ¼ +// +// String searchQuestion_TC_project_taskinfo = "select * from TC_project_taskinfo "; +// ResultSet set_TC_project_taskinfo = SqlUtil.read(searchQuestion_TC_project_taskinfo);// ִ +// int rowCount1 = 0; +// while(set_TC_project_taskinfo.next()) { +// rowCount1++; +// } +//// set_TC_project_taskinfo.last(); // ƶһ +//// int rowCount1 = set_TC_project_taskinfo.getRow(); // õǰкţ¼ +// +// s1 = "ĿǰΪֹһͬ" + rowCount + "ĿݵTC_project_info"; +// s2 = "ĿǰΪֹһͬ" + rowCount1 + "ʱݵTC_project_taskinfo"; +// System.out.println("**********************************************************"); +// System.out.println("**********************************************************"); +// System.out.println("**********************************************************"); +// System.out.println("ĿǰΪֹһͬ" + rowCount + "ĿݵTC_project_info"); +// System.out.println("ĿǰΪֹһͬ" + rowCount1 + "ʱݵTC_project_taskinfo"); +// System.out.println("**********************************************************"); +// System.out.println("**********************************************************"); +// System.out.println("**********************************************************"); +// SqlUtil.freeAll(); +// } catch (SQLException e3) { +// // TODO Auto-generated catch block +// e3.printStackTrace(); +// } + + SqlUtil.getConnection(dbName, dbPassword, url, driver_temp); + String searchQuestion = SqlUtil.getSelectSql_2("TC_project_info");//ѯֶ + try { + ResultSet set = SqlUtil.read(searchQuestion);// ѯ + while (set.next()) { + // num++; + bean = new ProjectBean(); + String project_id;// ĿID + String projectName = "";// Ŀ + String sdate;// ʱ + String projectState;// Ŀ׶ + String projectManager;// Ŀ + String productManager;// Ʒ + String productDirect;// Ʒܼ + String projectLevel;// Ŀȼ + String projectType;// Ŀ + String bussinessUnit;// ҵ + String isResearchProject;// ǷзĿ + String systemTime;// ͬʱ + String edate;// ʱ + + // 2017.9.26 ӵ + String object_desc;// + String jk8ProductLine;// Ʒ + String jk8EstStartDate;// Ԥƿʼʱ + String jk8EstCompleteDate;// Ԥƽʱ + String jk8ProjBudget;// Ԥ + String jk8PhaseBudget;// ׶Ԥ + String jk8ImplementBudget;// ִ + String jk8ProjBudgetRatio;// ִ + String jk8PhaseBudgetRatio;// ׶ִ + String jk8HumanCost;// Ԥ + String jk8ProjCoopForm;// Ŀʽ + String jk8ProjSource;// ĿԴ + String jk8ProjResForm;// Ŀɹʽ + String jk8ExtExplain;// ⹫ + + String owning_user;// + String owning_group;// ID + String last_mod_user;// ϴ޸û + + // 2017.10.10ӵ + String oa_id; + String jk8SubProject;// Ŀ + String jk8Phaseovertime;// ׶Թرʱ + + //2018.2.28ӵ + String jk8SystemEngineer;//ϵͳʦ + + try { + project_id = set.getString("project_id"); + System.out.println("Ŀid------------>"+project_id); + } catch (Exception e) { + project_id = " "; +// e.printStackTrace(); + } + try { + projectName = set.getString("project_name"); + } catch (Exception e) { + projectName = " "; +// e.printStackTrace(); + } + + try { + sdate = set.getString("JK8ProjApproveDate"); + } catch (Exception e) { + sdate = " "; +// e.printStackTrace(); + } + try { + projectState = set.getString("JK8ProjectState"); + for (int i = 0; i < Jk8ProjectStatus.length; i++) { + if (Jk8ProjectStatus[i].split("-")[0].equals(projectState)) { + projectState = Jk8ProjectStatus[i].split("-")[1]; + break; + } + } + } catch (Exception e) { + projectState = " "; +// e.printStackTrace(); + } + try { + projectManager = set.getString("JK8ProjectManager"); + System.out.println("Ŀ--------"+projectManager); +// projectManager = findPeople1(projectManager); + if(userid_nameMap.containsKey(projectManager)) { + projectManager=userid_nameMap.get(projectManager)+"("+projectManager+")"; + } + } catch (Exception e) { + projectManager = " "; +// e.printStackTrace(); + } + try { + productManager = set.getString("JK8ProductManager"); + productManager = findPeople2("jk8ProductManager",productManager,productManager_name_idMap);//TODO 2018.5.21 + } catch (Exception e) { + productManager = " "; +// e.printStackTrace(); + } + + try { + productDirect = set.getString("JK8ProductDirector"); + productDirect = findPeople2("jk8ProductDirector",productDirect,productDirector_name_idMap);//TODO 2018.5.21 + } catch (Exception e) { + productDirect = " "; +// e.printStackTrace(); + } + try { + projectLevel = set.getString("JK8ProjectLevel");//TODO + for (int i = 0; i < Jk8ProjectLevel.length; i++) { + if (Jk8ProjectLevel[i].split("-")[0].equals(projectLevel)) { + projectLevel = Jk8ProjectLevel[i].split("-")[1]; + break; + } + } + } catch (Exception e) { + projectLevel = " "; +// e.printStackTrace(); + } + try { + projectType = set.getString("JK8ProjectType");//TODO + for (int i = 0; i < Jk8ProjectType.length; i++) { + if (Jk8ProjectType[i].split("-")[0].equals(projectType)) { + projectType = Jk8ProjectType[i].split("-")[1]; + break; + } + } + } catch (Exception e) { + projectType = " "; +// e.printStackTrace(); + } + try { + bussinessUnit = set.getString("JK8BussinessUnit");//TODO + for (int i = 0; i < Jk8BussinessUnit.length; i++) { + if (Jk8BussinessUnit[i].split("-")[0].equals(bussinessUnit)) { + bussinessUnit = Jk8BussinessUnit[i].split("-")[1]; + break; + } + } + } catch (Exception e) { + bussinessUnit = " "; +// e.printStackTrace(); + } + try { + isResearchProject = set.getString("JK8IsResearchProj");//TODO + for (int i = 0; i < Jk8IsResearchProj.length; i++) { + if (Jk8IsResearchProj[i].split("-")[0].equals(isResearchProject)) { + isResearchProject = Jk8IsResearchProj[i].split("-")[1]; + break; + } + } + } catch (Exception e) { + isResearchProject = " "; +// e.printStackTrace(); + } + try { + systemTime = set.getString("System_time");//TODO + } catch (Exception e) { + systemTime = " "; +// e.printStackTrace(); + } + + try { + edate = set.getString("JK8ProjEndDate");//TODO + } catch (Exception e) { + edate = " "; +// e.printStackTrace(); + } + if (edate == null || edate.trim().equals("")) { + edate = " "; + } + try { + oa_id = set.getString("oa_id");//TODO + } catch (Exception e) { + oa_id = " "; +// e.printStackTrace(); + } + if (oa_id == null || oa_id.trim().equals("")) { + oa_id = " "; + } + + try { + object_desc = set.getString("object_desc");//TODO + } catch (Exception e) { + object_desc = " "; +// e.printStackTrace(); + } + try { + jk8ProductLine = set.getString("jk8ProductLine");//TODO + } catch (Exception e) { + jk8ProductLine = " "; +// e.printStackTrace(); + } + try { + jk8EstStartDate = set.getString("jk8EstStartDate");//TODO + } catch (Exception e) { + jk8EstStartDate = " "; +// e.printStackTrace(); + } + try { + jk8EstCompleteDate = set.getString("jk8EstCompleteDate");//TODO + } catch (Exception e) { + jk8EstCompleteDate = " "; +// e.printStackTrace(); + } + try { + jk8ProjBudget = set.getString("jk8ProjBudget");//TODO + } catch (Exception e) { + jk8ProjBudget = " "; +// e.printStackTrace(); + } + try { + jk8PhaseBudget = set.getString("jk8PhaseBudget");//TODO + } catch (Exception e) { + jk8PhaseBudget = " "; +// e.printStackTrace(); + } + try { + jk8ImplementBudget = set.getString("jk8ImplementBudget");//TODO + } catch (Exception e) { + jk8ImplementBudget = " "; +// e.printStackTrace(); + } + try { + jk8ProjBudgetRatio = set.getString("jk8ProjBudgetRatio");//TODO + } catch (Exception e) { + jk8ProjBudgetRatio = " "; +// e.printStackTrace(); + } + try { + jk8PhaseBudgetRatio = set.getString("jk8PhaseBudgetRatio");//TODO + } catch (Exception e) { + jk8PhaseBudgetRatio = " "; +// e.printStackTrace(); + } + try { + jk8HumanCost = set.getString("jk8HumanCost");//TODO + } catch (Exception e) { + jk8HumanCost = " "; +// e.printStackTrace(); + } + try { + jk8ProjCoopForm = set.getString("jk8ProjCoopForm");//TODO + } catch (Exception e) { + jk8ProjCoopForm = " "; +// e.printStackTrace(); + } + try { + jk8ProjSource = set.getString("jk8ProjSource");//TODO + } catch (Exception e) { + jk8ProjSource = " "; +// e.printStackTrace(); + } + try { + jk8ProjResForm = set.getString("jk8ProjResForm");//TODO + } catch (Exception e) { + jk8ProjResForm = " "; +// e.printStackTrace(); + } + try { + jk8ExtExplain = set.getString("jk8ExtExplain");//TODO + } catch (Exception e) { + jk8ExtExplain = " "; +// e.printStackTrace(); + } + try { + owning_user = set.getString("owning_user");//TODO + } catch (Exception e) { + owning_user = " "; +// e.printStackTrace(); + } + try { + owning_group = set.getString("owning_group");//TODO + } catch (Exception e) { + owning_group = " "; +// e.printStackTrace(); + } + try { + last_mod_user = set.getString("last_mod_user");//TODO + } catch (Exception e) { + last_mod_user = " "; +// e.printStackTrace(); + } + try { + jk8SubProject = set.getString("JK8SubProject");//TODO + } catch (Exception e) { + jk8SubProject = " "; +// e.printStackTrace(); + } + try { + jk8Phaseovertime = set.getString("jk8Phaseovertime");//TODO + } catch (Exception e) { + jk8Phaseovertime = " "; +// e.printStackTrace(); + } + //2018.2.28 + try { + jk8SystemEngineer = set.getString("jk8SystemEngineer"); + System.out.println("ϵͳʦ---------------"+jk8SystemEngineer); +// jk8SystemEngineer = findPeople1(jk8SystemEngineer); + if(userid_nameMap.containsKey(jk8SystemEngineer)) { + jk8SystemEngineer=userid_nameMap.get(jk8SystemEngineer)+"("+jk8SystemEngineer+")"; + } + } catch (Exception e) { + jk8SystemEngineer = " "; +// e.printStackTrace(); + } + bean.setObject_desc(object_desc); + bean.setJk8ProductLine(jk8ProductLine); + bean.setJk8EstStartDate(jk8EstStartDate); + bean.setJk8EstCompleteDate(jk8EstCompleteDate); + bean.setJk8ProjBudget(jk8ProjBudget); + bean.setJk8PhaseBudget(jk8PhaseBudget); + bean.setJk8ImplementBudget(jk8ImplementBudget); + bean.setJk8ProjBudgetRatio(jk8ProjBudgetRatio); + bean.setJk8PhaseBudgetRatio(jk8PhaseBudgetRatio); + bean.setJk8HumanCost(jk8HumanCost); + bean.setJk8ProjCoopForm(jk8ProjCoopForm); + bean.setJk8ProjSource(jk8ProjSource); + bean.setJk8ProjResForm(jk8ProjResForm); + bean.setJk8ExtExplain(jk8ExtExplain); + bean.setOwning_user(owning_user); + bean.setOwning_group(owning_group); + bean.setLast_mod_user(last_mod_user); + bean.setOa_id(oa_id); + bean.setJK8SubProject(jk8SubProject); + bean.setJk8Phasedovertime(jk8Phaseovertime); + + bean.setProjectId(project_id); + bean.setProjectName(projectName); + bean.setSdate(sdate); + bean.setProjectState(projectState); + bean.setProjectManager(projectManager); + bean.setProductManager(productManager); + bean.setProductDirect(productDirect); + bean.setProjectLevel(projectLevel); + bean.setProjectType(projectType); + bean.setBussinessUnit(bussinessUnit); + bean.setIsResearchProject(isResearchProject); + bean.setSystemTime(systemTime); + bean.setEdate(edate); + //20182.28ϵͳʦ + bean.setJk8SystemEngineer(jk8SystemEngineer); + this.valueLists.add(bean); + } + } catch (Exception e) { + System.out.println("ѯ"); + e.printStackTrace(); + } + + int row = valueLists.size(); + System.out.println("---------------------------->" + row); + fis = new FileInputStream(fmsFile); + workBook = new XSSFWorkbook(fis); + XSSFSheet sheet = workBook.getSheet("Ŀ嵥"); + XSSFCellStyle sty = sheet.getRow(0).getCell(0).getCellStyle(); + for (int i = 0; i < row; i++) { + XSSFRow r = sheet.createRow(i + 1); + for (int j = 0; j < 35; j++) { + XSSFCell ce = r.createCell(j); + ce.setCellStyle(sty); + } + r.getCell(0).setCellValue((i + 1) + "");// + r.getCell(1).setCellValue(valueLists.get(i).getOa_id());// oa_id + r.getCell(2).setCellValue(valueLists.get(i).getProjectId());// Ŀid + r.getCell(3).setCellValue(valueLists.get(i).getProjectName());// Ŀ + r.getCell(4).setCellValue(valueLists.get(i).getSdate());// ʱ + r.getCell(5).setCellValue(valueLists.get(i).getProjectState());// Ŀ״̬ + r.getCell(6).setCellValue(valueLists.get(i).getProjectManager());// Ŀ + r.getCell(7).setCellValue(valueLists.get(i).getProductManager());// Ʒ + //2018.2.28ϵͳʦ + r.getCell(8).setCellValue(valueLists.get(i).getJk8SystemEngineer());// ϵͳʦ + + r.getCell(9).setCellValue(valueLists.get(i).getProductDirect());// Ʒܼ + r.getCell(10).setCellValue(valueLists.get(i).getProjectLevel());// Ŀȼ + r.getCell(11).setCellValue(valueLists.get(i).getProjectType());// Ŀ + r.getCell(12).setCellValue(valueLists.get(i).getBussinessUnit());// ҵ + r.getCell(13).setCellValue(valueLists.get(i).getIsResearchProject());// ǷзĿ + r.getCell(14).setCellValue(valueLists.get(i).getSystemTime());// ͬʱ + r.getCell(15).setCellValue(valueLists.get(i).getEdate());// ʱ + r.getCell(16).setCellValue(valueLists.get(i).getJk8Phasedovertime());// ׶ʱ + r.getCell(17).setCellValue(valueLists.get(i).getObject_desc());// + r.getCell(18).setCellValue(valueLists.get(i).getJk8ProductLine());// Ʒ + r.getCell(19).setCellValue(valueLists.get(i).getJk8EstStartDate());// Ԥƿʼʱ + r.getCell(20).setCellValue(valueLists.get(i).getJk8EstCompleteDate());// Ԥƽʱ + r.getCell(21).setCellValue(valueLists.get(i).getJk8ProjBudget());// Ԥ + r.getCell(22).setCellValue(valueLists.get(i).getJk8PhaseBudget());// ׶Ԥ + r.getCell(23).setCellValue(valueLists.get(i).getJk8ImplementBudget());// ִ + r.getCell(24).setCellValue(valueLists.get(i).getJk8ProjBudgetRatio());// ִ + r.getCell(25).setCellValue(valueLists.get(i).getJk8PhaseBudgetRatio());// ׶ִ + r.getCell(26).setCellValue(valueLists.get(i).getJk8HumanCost());// Ԥ + r.getCell(27).setCellValue(valueLists.get(i).getJk8ProjCoopForm());// Ŀʽ + r.getCell(28).setCellValue(valueLists.get(i).getJk8ProjSource());// ĿԴ + r.getCell(29).setCellValue(valueLists.get(i).getJk8ProjResForm());// Ŀɹʽ + r.getCell(30).setCellValue(valueLists.get(i).getJk8ExtExplain());// ⹫ + r.getCell(31).setCellValue(valueLists.get(i).getOwning_user());// + r.getCell(32).setCellValue(valueLists.get(i).getOwning_group());// ID + r.getCell(33).setCellValue(valueLists.get(i).getLast_mod_user());// ϴ޸û + r.getCell(34).setCellValue(valueLists.get(i).getJK8SubProject());// Ŀ + } + + File file = null; + file = new File(exportFile + "\\" + "Ŀ嵥" + ".xlsx"); + fos = new FileOutputStream(file); + workBook.write(fos); + long end = System.currentTimeMillis(); + float time = (end - start) / 1000.00f; + System.out.println("ʱ" + time + ""); + this.wait.setBool(true); + this.wait.interrupt(); + MessageBox.post("Ѿ", "ɹ", MessageBox.INFORMATION); + Runtime.getRuntime().exec(new String[] { "cmd.exe", "/c", exportFile + "\\" + "Ŀ嵥" + ".xlsx" });// ɺֱӴ + + } + + private File getExcle(String ssx) { + File fmsFile = null; + tcPreferenceService = session.getPreferenceService(); + String puid = tcPreferenceService.getStringValue(ssx); + if (puid == null) { + MessageBox.post("ϵԱѡ", "", MessageBox.ERROR); + return null; + } + TCComponentDataset dateset = null; + + try { + dateset = (TCComponentDataset) session.stringToComponent(puid); + } catch (TCException e) { + e.printStackTrace(); + } + if (dateset == null) { + MessageBox.post("δҵݼϵԱѡ", "", MessageBox.ERROR); + return null; + } + try { + TCComponentTcFile[] file = dateset.getTcFiles(); + if (file.length == 0 || file.length != 1) { + MessageBox.post("ݼûõļļ࣬飡", "WARNING", MessageBox.WARNING); + return null; + } else { + fmsFile = file[0].getFmsFile(); + } + } catch (Exception e) { + e.printStackTrace(); + } + return fmsFile; + } + + public long getDate(String dstr) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");// СдmmʾǷ + Date date = null; + try { + date = sdf.parse(dstr); + } catch (ParseException e1) { + e1.printStackTrace(); + } + // ȡ + long longDate = date.getTime(); + return longDate; + } + + TCComponentUser user; + //2019.2.21ͨݿѯΪòѯˣԡuser_projectsֵ޷á ֵЧ ֵЧ ֵЧ ָûڷǻ״̬ + private Map findPeople3(Map userid_nameMap) { + String JdbcDriverClass = "oracle.jdbc.driver.OracleDriver"; + String strUrl = "jdbc:oracle:thin:@10.200.2.43:1521:jktc"; + String strUserName = "infodba"; + String strPassword = "infodba"; + + try { + try { + Class.forName(JdbcDriverClass); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } + Connection conn = DriverManager.getConnection(strUrl, strUserName, + strPassword); + + String query = "select puser_id,puser_name from ppom_user"; + Statement stmt = conn.createStatement(); + + ResultSet rs_get = stmt.executeQuery(query); + int rowCount = 0; + while (rs_get.next()) { + rowCount++; + String puser_id=rs_get.getString("puser_id");//ȡֵֶ + String puser_name=rs_get.getString("puser_name");//ȡֵֶ + userid_nameMap.put(puser_id, puser_name); + } + System.out.println(rowCount); +// stmt.executeUpdate(upin); + if (rs_get != null) { + rs_get.close(); + } + if (stmt != null) { + stmt.close(); + } + if (conn != null) { + conn.close(); + } + } catch (SQLException e) { + e.printStackTrace(); + } + + return userid_nameMap; + + } + + + /*private String findPeople1(String name) { + String id = "TC޴˹"; + if(name!=null){ + + try { + user = (TCComponentUser) session.search(" - ԱϢ", new String[] { "û ID" }, new String[] { name })[0]; + id = user.getTCProperty("object_string").getStringValue(); + + } catch (Exception e) { + e.printStackTrace(); + } + if (id.length() < 4) { + MessageBox.post("", "", MessageBox.ERROR); + id = "TC޴˹"; + } + }else{ + id=" "; + } + return id; + } + */ + //ͨѡƥԱid + private String findPeople2(String type,String id,Map map) { + String name=""; + if(id == null)return name; + if(map.containsKey(id)) { + name=map.get(id); + if(name.contains("")){ + System.out.println("bingo"); + name=name.replace("", ""); + } + name=name+"("+id+")"; + System.out.println("ʾֵ----------------------------------"+name); + }else { +// MessageBox.post("ϵϵͳԱѡ"+type+"ûû"+id, "", MessageBox.ERROR); +// name = "ѡ޴˹"; + name = id; + } + return name; + } +} diff --git a/src/com/connor/jk/plm/project/SqlUtil.java b/src/com/connor/jk/plm/project/SqlUtil.java new file mode 100644 index 0000000..7fa0bef --- /dev/null +++ b/src/com/connor/jk/plm/project/SqlUtil.java @@ -0,0 +1,633 @@ +package com.connor.jk.plm.project; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; + +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.Registry; + +/** + * ֹ̳final,ֹ󽨶˽й췽,ΪʹС PreparedStatementResultSetС + * + * @author hub 2015-02-06 + */ +public final class SqlUtil { + public static Connection connection = null; + public static PreparedStatement ps = null; + public static ResultSet rs = null; + private static Registry reg = Registry.getRegistry("com.connor.jk.plm.report.database"); + + /** + * ˽йnew󣬷ֹö + */ + private SqlUtil() { + + } + + static { + String driver = reg.getString("ORACEL_DRIVER"); // Util.getProperties("DRIVER"); + if (driver == null) { + driver = "oracle.jdbc.driver.OracleDriver"; + } + + System.out.println("driver " + driver); + try { + Class.forName(driver); + } catch (ClassNotFoundException e) { + System.out.println("ORACEL DRIVER IS EXCEPTION"); + e.printStackTrace(); + } + } + + /** + * ݿ + */ + public static Connection getConnection() { + try { + String driver_temp = reg.getString("ORACEL_DRIVER"); + String url = reg.getString("ORACEL_URL");// getProperties("URL"); + String dbName = reg.getString("ORACEL_NAME");// Util.getProperties("dbName"); + String dbPassword = reg.getString("ORACEL_PASSWORD");// Util.getProperties("dbPassword"); +// String driver_temp = "oracle.jdbc.driver.OracleDriver"; +// String url = "jdbc:oracle:thin:@localhost:1521:local ";// getProperties("URL"); +// String dbName = "GOLD_CARD";// Util.getProperties("dbName"); +// String dbPassword = "jk300349";// Util.getProperties("dbPassword"); + System.out.println("ORACEL_DRIVER:"+driver_temp); + System.out.println("ORACEL_URL:"+url); + System.out.println("ORACEL_NAME:"+dbName); + System.out.println("ORACEL_PASSWORD:"+dbPassword); +// int a=1; +// if(a==1){ +// return connection; +// } + + if (driver_temp == null || url == null || dbName == null + || dbPassword == null) { + + MessageBox.post("ݿѡǷȷ", "ʾ", MessageBox.ERROR); + + } + // else{ + // MessageBox.post(driver_temp+" | "+url+" | "+dbName+" | "+dbPassword,"ʾ",MessageBox.ERROR); + // + // } + System.out.println(url + dbName + dbPassword); + connection = DriverManager.getConnection(url, dbName, dbPassword); +// connection.setAutoCommit(false); + } catch (SQLException e) { + System.out.println("ORACEL CONNECT EXCEPTION"); + e.printStackTrace(); + return null; + // MessageBox.post("ORACEL CONNECT EXCEPTION \n"+e.getMessage(),"ERROR",MessageBox.ERROR); + } + return connection; + } + + /** + * ݿ + */ + public static Connection getConnection(String dbName,String dbPassword,String url,String driver_temp) { + try { + + System.out.println("ORACEL_DRIVER:"+driver_temp); + System.out.println("ORACEL_URL:"+url); + System.out.println("ORACEL_NAME:"+dbName); + System.out.println("ORACEL_PASSWORD:"+dbPassword); + if (driver_temp == null || url == null || dbName == null + || dbPassword == null) { + + MessageBox.post("ݿѡǷȷ", "ʾ", MessageBox.ERROR); + + } + // else{ + // MessageBox.post(driver_temp+" | "+url+" | "+dbName+" | "+dbPassword,"ʾ",MessageBox.ERROR); + // + // } + System.out.println(url + dbName + dbPassword); + connection = DriverManager.getConnection(url, dbName, dbPassword); +// connection.setAutoCommit(false); + } catch (SQLException e) { + System.out.println("ORACEL CONNECT EXCEPTION"); + e.printStackTrace(); + return null; + // MessageBox.post("ORACEL CONNECT EXCEPTION \n"+e.getMessage(),"ERROR",MessageBox.ERROR); + } + return connection; + } + + /** + * ݿ + */ + public static Connection getConnection(String url, String dbName, + String dbPassword) { + try { + String driver_temp = reg.getString("ORACEL_DRIVER"); + + System.out.println(url + dbName + dbPassword); + connection = DriverManager.getConnection(url, dbName, dbPassword); + connection.setAutoCommit(false); + } catch (SQLException e) { + System.out.println("ORACEL CONNECT EXCEPTION"); + e.printStackTrace(); + // MessageBox.post("ORACEL CONNECT EXCEPTION \n"+e.getMessage(),"ERROR",MessageBox.ERROR); + return null; + } + return connection; + } + + /** + * ƴSELECT + * + * @param tableName + * @param selectElement + * @param args + * @return + */ + public static String getSelectSql(String tableName, String[] selectElement, + String... args) { + StringBuffer valuesSB = new StringBuffer("SELECT "); + if (selectElement != null) { + for (String element : selectElement) { + valuesSB.append(element).append(","); + } + valuesSB.delete(valuesSB.length() - 1, valuesSB.length()); + } + valuesSB.append(" FROM "); + valuesSB.append(tableName); + valuesSB.append(" WHERE"); + for (int i = 0; i < args.length; i++) { + valuesSB.append(" "); + valuesSB.append(args[i]); + valuesSB.append("=? "); + valuesSB.append("AND"); + } + + valuesSB.delete(valuesSB.length() - 3, valuesSB.length()); + return valuesSB.toString(); + } + + + /** + * ƴSELECT + * + * @param tableName + * @param selectElement + * @param args + * @return + */ + public static String getSelectSql_1(String tableName, String selectElement, + String keyword ) { + StringBuffer valuesSB = new StringBuffer("SELECT *"); + + valuesSB.append(" FROM "); + valuesSB.append(tableName); + valuesSB.append(" WHERE "); + valuesSB.append(selectElement); + valuesSB.append(" = '"); + valuesSB.append(keyword); + valuesSB.append("'"); + return valuesSB.toString(); + } + + /** + * ƴSELECT + * + * @param tableName + * @param selectElement + * @param args + * @return + */ + public static String getSelectSql_id(String tableName, String selectElement, + int keyword ) { + StringBuffer valuesSB = new StringBuffer("SELECT *"); + + valuesSB.append(" FROM "); + valuesSB.append(tableName); + valuesSB.append(" WHERE "); + valuesSB.append(selectElement); + valuesSB.append(" = "); + valuesSB.append(keyword); +// valuesSB.append(""); + return valuesSB.toString(); + } + /** + * ƴSELECT + * + * @param tableName + * @param selectElement + * @param args + * @return + */ + public static String getSelectSql_3(String tableName, String selectElement, + int keyword ) { + StringBuffer valuesSB = new StringBuffer("SELECT *"); + + valuesSB.append(" FROM "); + valuesSB.append(tableName); + valuesSB.append(" WHERE "); + valuesSB.append(selectElement); + valuesSB.append(" = "); + valuesSB.append(keyword); + return valuesSB.toString(); + } + /** + * ƴSELECT + * + * @param tableName + * @param selectElement + * @param args + * @return + */ + public static String getSelectSql_2(String tableName ) { + StringBuffer valuesSB = new StringBuffer("SELECT *"); + valuesSB.append(" FROM "); + valuesSB.append(tableName); + return valuesSB.toString(); + } + + /** + * ƴSELECT + * + * @param tableName + * @param args + * @return + */ + public static String getSelectSql(String tableName, String... args) { + StringBuffer valuesSB = new StringBuffer("SELECT * FROM "); + valuesSB.append(tableName); + valuesSB.append(" WHERE"); + for (int i = 0; i < args.length; i++) { + valuesSB.append(" "); + valuesSB.append(args[i]); + valuesSB.append("=? "); + valuesSB.append("AND"); + } + + valuesSB.delete(valuesSB.length() - 3, valuesSB.length()); + return valuesSB.toString(); + } + + /** + * ƴӸ + * + * @param tableName + * @param args + * @param args2 + * @return + */ + public static String getUpdataSQL(String tableName, String[] args, + String[] args2) { + StringBuffer updateSB = new StringBuffer("UPDATE "); + updateSB.append(tableName); + updateSB.append(" SET "); + // ƴӸ + for (int i = 0; i < args.length; i++) { + if (args[i].toUpperCase().equals("OPERATE_TIME") + || args[i].toUpperCase().equals("LAST_UPDATE_DATE")) { + updateSB.append(args[i]).append( + "=to_date(?,'yyyy-MM-dd HH24:mi:ss') ,"); + } else { + updateSB.append(args[i]).append("=? ,"); + } + } + updateSB.delete(updateSB.length() - 2, updateSB.length()); + ; + updateSB.append(" WHERE "); + for (int i = 0; i < args2.length; i++) { + updateSB.append(args2[i]).append("=? AND "); + } + updateSB.delete(updateSB.length() - 4, updateSB.length()); + return updateSB.toString(); + } + + /** + * ƴSQLinsert + * + * @param tableName + * @param args + * @return + */ + public static String getInsertSql(String tableName, String... args) { + StringBuffer insertSql = new StringBuffer("insert into "); + StringBuffer values = new StringBuffer("values("); + + if (tableName != null && args != null && args.length > 0) { + insertSql.append(tableName); + insertSql.append("("); + for (int i = 0; i < args.length; i++) { + insertSql.append(args[i]); + insertSql.append(", "); + if (args[i].toUpperCase().equals("COMMIT_TIME") + || args[i].toUpperCase().equals("CREATE_DATE") + || args[i].toUpperCase().equals("INVALID_DATE")) { + values.append("to_date(?,'yyyy-MM-dd HH24:mi:ss'), "); + } else { + values.append("?, "); + } + + } + } else { + return null; + } + insertSql.delete(insertSql.length() - 2, insertSql.length()); + values.delete(values.length() - 2, values.length()); + insertSql.append(") ").append(values).append(")"); + return insertSql.toString(); + } + + /** + * õݿ + * + * @param tableName + * @param args + * + * @param args2 + * + * @return ƴӺĴݿ + */ + public final static String GetCreateTableSQL(String tableName, + String[] args, String[] args2) { + + if (args == null || args2 == null || args.length != args2.length) { + System.out.println("THE INPUT PRAGREMS IS ERROR"); + return null; + } + StringBuffer createSQL = new StringBuffer("create table "); + createSQL.append(tableName); + createSQL.append("("); + for (int i = 0; i < args.length; i++) { + createSQL.append(args[i] + " "); + createSQL.append(args2[i] + ", "); + } + createSQL.delete(createSQL.length() - 2, createSQL.length()); + createSQL.append(")"); + return createSQL.toString(); + } + + /** + * õStatement + */ + public final static PreparedStatement getPs(String sql) throws SQLException { + return getPs(sql, null); + } + + /** + * õStatement + */ + public final static PreparedStatement getPs(Object[] argments, String sql) + throws SQLException { +// System.out.println("PreparedStatement getPs"); + return getPs(sql, argments); + } + + /** + * õStatement + */ + public final static PreparedStatement getPs(String sql, Object[] argments) + throws SQLException { +// System.out.println("PreparedStatement getPs2"); + SqlUtil.ps = SqlUtil.connection.prepareStatement(sql); + if (argments != null) { + for (int i = 0; i < argments.length; i++) { + SqlUtil.ps.setObject(i + 1, argments[i]); + } + } + return SqlUtil.ps; + } + + + /** + * + */ + public final static int write(String sql) { + return write(sql, null); + } + + /** + * + */ + public final static int write(Object[] argments, String sql) { + return write(sql, argments); + } + + /** + * + */ + public final static int write(String sql, Object[] argments) { + + return update(sql, argments); + } + + /** + * ɾ + */ + public final static int delete(String sql) { + return delete(sql, null); + } + + /** + * ɾ + */ + public final static int delete(Object[] argments, String sql) { + return delete(sql, argments); + } + + /** + * ɾ + */ + public final static int delete(String sql, Object[] argments) { + return update(sql, argments); + } + + /** + * ޸ + */ + public final static int update(String sql) { + return update(sql, null); + } + + /** + * ޸ + */ + public final static int update(String[] argments, String sql) { + return update(sql, argments); + } + + /** + * ޸(ɾնҪô˷˴쳣رճConnectionΪĶ) + */ + public final static int update(String sql, Object[] argments) { + int i = -1; + try { + i = SqlUtil.getPs(argments, sql).executeUpdate(); + // 2015-11-19 + // SqlUtil.connection.commit(); + } catch (SQLException e) { + e.printStackTrace(); + } finally { + free(SqlUtil.rs, SqlUtil.ps); + } + return i; + } + + /** + * ѯ + */ + public final static ResultSet read(String sql) throws SQLException { +// System.out.println("ResultSet read"); + return read(sql, null); + } + + /** + * ѯ + */ + public final static ResultSet read(Object[] argments, String sql) + throws SQLException { + return read(sql, argments); + } + + /** + * ѯ(вѯնҪô˷治쳣׳ɵߴfinallyͷԴ) + * + * @throws SQLException + */ + public final static ResultSet read(String sql, Object[] argments) + throws SQLException { +// System.out.println("ResultSet read2"); + return SqlUtil.rs = SqlUtil.getPs(argments, sql).executeQuery(); + } + + /** + * + */ + public final static boolean createTable(String sql) { + return go(sql, null); + } + + /** + * ɾ + */ + public final static boolean dropTable(String sql) { + return go(sql, null); + } + + /** + * ޸ı + */ + public final static boolean alterTable(String sql) { + return go(sql, null); + } + + /** + * ˷ִDDL(,޸ı,ɾ) + */ + private final static boolean go(String sql, Object[] argments) { + boolean flag = false; + try { + flag = SqlUtil.getPs(sql, argments).execute(); + } catch (SQLException e) { + e.printStackTrace(); + } finally { + free(SqlUtil.rs, SqlUtil.ps); + } + if (flag) { + try { + SqlUtil.connection.commit(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return flag; + } + + /** + * ͷԴ + */ + public final static void free(ResultSet resultSet) { + free(resultSet, null, null); + } + + /** + * ͷԴ + */ + public final static void free(Statement statement) { + free(null, statement, null); + } + + /** + * ͷԴ + */ + public final static void free(Connection connection) { + free(null, null, connection); + } + + /** + * ͷԴ + */ + public final static void free(ResultSet resultSet, Statement statement) { + free(resultSet, statement, null); + } + + /** + * ͷԴ + */ + public final static void free(Statement statement, Connection connection) { + free(null, statement, connection); + } + + /** + * ͷԴ(Ĭϲ) + */ + public final static void free() { + free(SqlUtil.rs, SqlUtil.ps); + } + + /** + * ͷԴ(ȫͷ) + */ + public final static void freeAll() { + free(SqlUtil.rs, SqlUtil.ps, SqlUtil.connection); + } + + /** + * ͷԴ(ҲҪȫͷ) + */ + public final static void free(ResultSet resultSet, Statement statement, + Connection connection) { + try { + if (resultSet != null) { + try { + resultSet.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } finally { + try { + if (statement != null) { + try { + statement.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } finally { + if (connection != null) { + try { + connection.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + } + } + +// public void findsth(String searchpart){ +// +// } +} diff --git a/src/com/connor/jk/plm/report/CalendarPanel.java b/src/com/connor/jk/plm/report/CalendarPanel.java new file mode 100644 index 0000000..f642ace --- /dev/null +++ b/src/com/connor/jk/plm/report/CalendarPanel.java @@ -0,0 +1,625 @@ +package com.connor.jk.plm.report; +/** + + * Calender + + * @author BAOMH www.hotheme.com + + */ + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Toolkit; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import javax.swing.AbstractAction; +import javax.swing.InputMap; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JComponent; +import javax.swing.JDialog; +import javax.swing.JFrame; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JSpinner; +import javax.swing.JTable; +import javax.swing.JTextField; +import javax.swing.KeyStroke; +import javax.swing.ListSelectionModel; +import javax.swing.SpinnerNumberModel; +import javax.swing.SwingConstants; +import javax.swing.UIManager; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import javax.swing.table.DefaultTableCellRenderer; +import javax.swing.table.DefaultTableModel; + +import com.teamcenter.rac.aif.AbstractAIFApplication; + +public class CalendarPanel extends JDialog { + private JComboBox comboBoxMonth; + private JSpinner spinnerYear; + private JTable2 table; + private JTableModel2 tableModel; + private Calendar calendar; + public Date selecttime; + private String[] days = { "", "һ", "ڶ", "", "", "", "" }; + private String[] months = { "һ", + "", + "", + "", + "", + "", + "", + "", + "", + "ʮ", + "ʮһ", + "ʮ" + }; + private int year = -1; + private int month = -1; + private int date = -1; + private int oldYear = -1; + private int oldMonth = -1; + private int oldDate = -1; + private boolean flag = true; + private JButton okButton; + private JButton cancelButton; + private JTextField jt; + private int bo; + public Date getSelecttime() { + return selecttime; +} + + public int getBo() { + return bo; + } +public void setSelecttime(Date selecttime) { + this.selecttime = selecttime; +} + +public CalendarPanel(JFrame frame) { + + super(frame, true); + this.setTitle("ѡ"); + calendar = Calendar.getInstance(); + initComponent(); + setSize(350, 300); + center(); + setVisible(true); + } +public CalendarPanel(JTextField jt,int bo) { + this.jt = jt; + this.bo=bo; + this.setTitle("ѡ"); + calendar = Calendar.getInstance(); + initComponent(); + setSize(350, 300); + center(); + setAlwaysOnTop(true); + setVisible(true); +} +public CalendarPanel() { + this.setTitle("ѡ"); + calendar = Calendar.getInstance(); + initComponent(); + setSize(350, 300); + center(); + setVisible(true); +} + public CalendarPanel(Calendar calendar) { + + super(); + this.calendar = calendar; + initComponent(); + setSize(350, 300); + center(); + setVisible(true); + } + + public CalendarPanel(Date date) { + + super(); + this.calendar = Calendar.getInstance(); + this.calendar.setTime(date); + initComponent(); + setSize(350, 300); + center(); + setVisible(true); + } + + public CalendarPanel(int year, int month, int date) { + + super(); + this.calendar = Calendar.getInstance(); + calendar.set(Calendar.YEAR, year); + calendar.set(Calendar.MONTH, month - 1); + calendar.set(Calendar.DATE, date); + oldYear = calendar.get(Calendar.YEAR); + oldMonth = calendar.get(Calendar.MONTH); + oldDate = calendar.get(Calendar.DATE); + initComponent(); + setSize(350, 300); + center(); + setVisible(true); + } + + public void center() { + + Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); + Dimension frameSize = getSize(); + + if (frameSize.height > screenSize.height) { + frameSize.height = screenSize.height; + } + if (frameSize.width > screenSize.width) { + frameSize.width = screenSize.width; + } + + super.setLocation( + (screenSize.width - frameSize.width) / 2, + (screenSize.height - frameSize.height) / 2 + ); + } + + public Calendar getCalendar() { + return calendar; + } + + public String getCalendarByDate(String tag) { + + StringBuffer strRet = new StringBuffer(); + if (calendar != null) { + oldYear = calendar.get(Calendar.YEAR); + oldMonth = calendar.get(Calendar.MONTH)+1; + oldDate = calendar.get(Calendar.DATE); + + strRet.append(oldYear); + strRet.append(tag); + if (oldMonth < 10) + strRet.append("0" + oldMonth); + else + strRet.append(oldMonth); + strRet.append(tag); + if (oldDate < 10) + strRet.append("0" + oldDate); + else + strRet.append(oldDate); + + return strRet.toString(); + } + return null; + } + + public Date getCalendarByDate() { + if (calendar != null) + return calendar.getTime(); + return null; + } + //ʼpanel + private void initComponent() { + oldYear = calendar.get(Calendar.YEAR); + oldMonth = calendar.get(Calendar.MONTH); + oldDate = calendar.get(Calendar.DATE); + // this.setBorder(new TitledBorder("Date")); + this.getContentPane().setLayout(new BorderLayout()); + setNorthPanel(); + setCenterPanel(); + setSouthPanel(); + eventListenter(); + setData(); + } + //Ĭϵʱ伴Ϊǰʱ + private void setData() { + + year = calendar.get(Calendar.YEAR); + month = calendar.get(Calendar.MONTH); + date = calendar.get(Calendar.DATE); + comboBoxMonth.setSelectedIndex(month); + spinnerYear.setValue(new Integer(year)); + } + + private void eventListenter() { + + spinnerYear.addChangeListener(new ChangeListener() { + public void stateChanged(ChangeEvent e) { + year = Integer.parseInt(String.valueOf(spinnerYear.getValue())); + refreshTable(); + } + }); + + comboBoxMonth.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + month = comboBoxMonth.getSelectedIndex(); + refreshTable(); + } + }); + + table.getSelectionModel().addListSelectionListener( + new ListSelectionListener() { + public void valueChanged(ListSelectionEvent e) { + if (table.getSelectedRow()>-1&&table.getSelectedColumn()>-1) { + date = Integer.parseInt( + String.valueOf( + table.getValueAt( + table.getSelectedRow(), + table.getSelectedColumn() + ) + ) + ); + calendar.set(Calendar.YEAR, year); + calendar.set(Calendar.MONTH, month); + calendar.set(Calendar.DATE, date); + } + } + } + ); + + AbstractAction right = (new AbstractAction() { + private static final long serialVersionUID = -3429888240127305492L; + public void actionPerformed(ActionEvent e) { + if (table.getColumnCount() == table.getSelectedColumn() + 1) { + table.changeSelection( + table.getSelectedRow() + 1, + 0, + false, + false + ); + } else { + table.changeSelection( + table.getSelectedRow(), + table.getSelectedColumn() + 1, + false, + false + ); + } + } + }); + + AbstractAction left = (new AbstractAction() { + private static final long serialVersionUID = -2487040789339112435L; + public void actionPerformed(ActionEvent e) { + if (0 > table.getSelectedColumn() - 1) { + table.changeSelection( + table.getSelectedRow() - 1, + table.getColumnCount() - 1, + false, + false + ); + } else { + table.changeSelection( + table.getSelectedRow(), + table.getSelectedColumn() - 1, + false, + false + ); + } + } + }); + + InputMap inputMap = table.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); + KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0); + table.getActionMap().put(inputMap.get(keyStroke), right); + keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0); + table.getActionMap().put(inputMap.get(keyStroke), left); + okButton.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) { + calendar.set( + Calendar.YEAR, + Integer.parseInt( + String.valueOf(spinnerYear.getValue()) + ) + ); + calendar.set( + Calendar.MONTH, + comboBoxMonth.getSelectedIndex() + ); + calendar.set( + Calendar.DATE, + Integer.parseInt( + String.valueOf( + table.getValueAt( + table.getSelectedRow(), + table.getSelectedColumn() + ) + ) + ) + ); + + oldYear = calendar.get(Calendar.YEAR); + oldMonth = calendar.get(Calendar.MONTH); + oldDate = calendar.get(Calendar.DATE); + selecttime = CalendarPanel.this.getCalendarByDate(); + + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-M-dd"); + if(selecttime!=null){ + jt.setText(formatter.format(selecttime)); + } + // LP_DV_03_Dialog tw = new LP_DV_03_Dialog(dia,selecttime,bo); + setVisible(false); + } + + }); + + cancelButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + setVisible(false); + } + }); + /* + addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + calendar = null; + super.windowClosing(e); + } + }); + */ + + } + + private void refreshTable() { + for (int i = tableModel.getRowCount() - 1; i > 0; i--) { + tableModel.removeRow(i); + } + calendar.set(Calendar.YEAR, year); + calendar.set(Calendar.MONTH, month); + int maxDate = calendar.getActualMaximum(Calendar.DATE); + calendar.set(Calendar.DATE, 1); + int startDay = calendar.get(Calendar.DAY_OF_WEEK); + for (int i = 0; i < 6; i++) { + tableModel.addRow(new Object[7]); + } + int selectRow = -1; + int selectColumn = -1; + for (int i = 0; i < maxDate; i++) { + int m = (int) ((startDay - 1) / 7) + 1; + int n = (startDay - 1) % 7; + tableModel.setValueAt(String.valueOf(i + 1), m, n); + startDay = startDay + 1; + if (date != -1 && date == i + 1) { + selectRow = m; + selectColumn = n; + } + } + table.changeSelection(selectRow, selectColumn, false, false); + } + + + + private void setSouthPanel() { + + JPanel panel = new JPanel(); + panel.setLayout(new FlowLayout(FlowLayout.RIGHT)); + okButton = new JButton("OK"); + panel.add(okButton); + cancelButton = new JButton("Cancel"); + panel.add(cancelButton); + this.getContentPane().add(panel, BorderLayout.SOUTH); + } + + + private void setCenterPanel() { + + table = new JTable2(); + tableModel = new JTableModel2(); + tableModel.setColumnIdentifiers(days); + tableModel.addRow(days); + table.setModel(tableModel); + for (int i = 0; i < 7; i++) { + table.getColumnModel().getColumn(i).setCellRenderer( + new DefaultTableCellRenderer2() + ); + } + this.getContentPane().add(table, BorderLayout.CENTER); + } + + private void setNorthPanel() { + JPanel panel = new JPanel(); + panel.setLayout(new FlowLayout()); + comboBoxMonth = new JComboBox(); + for (int i = 0; i < months.length; i++) { + comboBoxMonth.addItem(months[i]); + } + comboBoxMonth.setSelectedIndex(-1); + panel.add(comboBoxMonth); + RolloverSpinnerListModel numberModel = new RolloverSpinnerListModel( + 1980, 1980, 2099, 1); + spinnerYear = new JSpinner(numberModel); + JSpinner.NumberEditor numberEditor = new JSpinner.NumberEditor( + spinnerYear, ""); + spinnerYear.setEditor(numberEditor); + panel.add(spinnerYear); + this.getContentPane().add(panel, BorderLayout.NORTH); + } + + public static void main(String[] args) { + + JFrame frame = new JFrame(); + frame.setDefaultCloseOperation(EXIT_ON_CLOSE); + CalendarPanel calendarPanel = new CalendarPanel(frame); + // frame.getContentPane().add(calendarPanel, BorderLayout.CENTER); + // calendarPanel.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + calendarPanel.setVisible(true); + } + + protected void validateTree() { + + super.validateTree(); + if (flag) { + table.requestFocus(); + flag = false; + } + } +} + +class RolloverSpinnerListModel extends SpinnerNumberModel { + + private static final long serialVersionUID = 7366455425120197392L; + + public RolloverSpinnerListModel( + int value, + int minimum, + int maximum, + int stepSize + ) { + super(value, minimum, maximum, stepSize); + } + + public Object getNextValue() { + + Object returnValue = super.getNextValue(); + if (returnValue == null) { + returnValue = super.getMinimum(); + } + return returnValue; + } + + public Object getPreviousValue() { + + Object returnValue = super.getPreviousValue(); + if (returnValue == null) { + returnValue = super.getMaximum(); + } + return returnValue; + } +} + +class JTable2 extends JTable { + + private static final long serialVersionUID = 2092799354481792367L; + + public JTable2() { + this.getTableHeader().setReorderingAllowed(false); + this.getTableHeader().setResizingAllowed(false); + this.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + this.setCellSelectionEnabled(true); + this.setGridColor(Color.white); + } + + public void changeSelection( + int rowIndex, + int columnIndex, + boolean toggle, + boolean extend + ) { + + if (this.getValueAt(rowIndex, columnIndex) == null) { + return; + } + + if (rowIndex == 0) { + return; + } + super.changeSelection(rowIndex, columnIndex, toggle, extend); + } + + public void repaint(int x, int y, int width, int height) { + + super.repaint(x, y, width, height); + if (height > 0) { + makeTableRowHeight(); + } + } + + protected void validateTree() { + super.validateTree(); + makeTableRowHeight(); + } + + private void makeTableRowHeight() { + + int rowHeight = (int) ((this.getHeight() / 7) * 0.6); + if (rowHeight > 0) { + this.setRowHeight(0, rowHeight); + } + + rowHeight = (int) ((this.getHeight() - rowHeight) / 6); + if (rowHeight > 0) { + for (int i = 1; i < 8; i++) { + this.setRowHeight(i, rowHeight); + } + } + } +} + + + +class JTableModel2 extends DefaultTableModel { + + private static final long serialVersionUID = 3655520869200784738L; + public boolean isCellEditable(int row, int column) { + return false; + } +} + +class DefaultTableCellRenderer2 extends DefaultTableCellRenderer { + + private static final long serialVersionUID = -8779549993366848535L; + public Component getTableCellRendererComponent( + JTable table, + Object value, + boolean isSelected, + boolean hasFocus, + int row, + int column + ) { + Component component = + super.getTableCellRendererComponent( + table, + value, + isSelected, + hasFocus, + row, + column + ); + + this.setHorizontalAlignment(SwingConstants.CENTER); + + if (row == 0) { + component.setBackground( + UIManager.getColor("Table.focusCellForeground") + ); + + component.setForeground( + UIManager.getColor("Table.focusCellBackground") + ); + return component; + } else { + if (isSelected) { + component.setBackground( + UIManager.getColor("Table.focusCellForeground") + ); + component.setForeground( + UIManager.getColor("Table.focusCellBackground") + ); + } else { + component.setBackground( + UIManager.getColor("Table.focusCellBackground") + ); + component.setForeground( + UIManager.getColor("Table.focusCellForeground") + ); + } + + if (column == 0 || column == 6) { + component.setForeground(Color.red); + } + } + return component; + } +} + + diff --git a/src/com/connor/jk/plm/report/GroupBean.java b/src/com/connor/jk/plm/report/GroupBean.java new file mode 100644 index 0000000..e6b3fbc --- /dev/null +++ b/src/com/connor/jk/plm/report/GroupBean.java @@ -0,0 +1,44 @@ +package com.connor.jk.plm.report; + +import java.util.ArrayList; +import java.util.List; + +public class GroupBean { + + private String GroupName; + private String workcode; + private int GroupPeople; + private List GroupPeopleName; + private double hours; + public String getWorkcode() { + return workcode; + } + public void setWorkcode(String workcode) { + this.workcode = workcode; + } + public double getHours() { + return hours; + } + public void setHours(double hours) { + this.hours = hours; + } + public List getGroupPeopleName() { + return GroupPeopleName; + } + public void setGroupPeopleName(List groupPeopleName) { + GroupPeopleName = groupPeopleName; + } + public String getGroupName() { + return GroupName; + } + public void setGroupName(String groupName) { + GroupName = groupName; + } + public int getGroupPeople() { + return GroupPeople; + } + public void setGroupPeople(int groupPeople) { + GroupPeople = groupPeople; + } + +} diff --git a/src/com/connor/jk/plm/report/JspsReport_Action.java b/src/com/connor/jk/plm/report/JspsReport_Action.java new file mode 100644 index 0000000..3d136e7 --- /dev/null +++ b/src/com/connor/jk/plm/report/JspsReport_Action.java @@ -0,0 +1,23 @@ +package com.connor.jk.plm.report; + +//import com.connor.jk.plm.createproject.CreateProjrct_Dialog; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.common.actions.AbstractAIFAction; + +public class JspsReport_Action extends AbstractAIFAction { + private AbstractAIFApplication app; + + public JspsReport_Action(AbstractAIFApplication app, String arg1) { + super(app, arg1); + // TODO Auto-generated constructor stub + this.app = app; + } + + @Override + public void run() { + // TODO Auto-generated method stub + JspsReport_Dialog dia=new JspsReport_Dialog(app); + new Thread(dia).start(); + } + +} diff --git a/src/com/connor/jk/plm/report/JspsReport_Dialog.java b/src/com/connor/jk/plm/report/JspsReport_Dialog.java new file mode 100644 index 0000000..24fd3dd --- /dev/null +++ b/src/com/connor/jk/plm/report/JspsReport_Dialog.java @@ -0,0 +1,152 @@ +package com.connor.jk.plm.report; + +import java.awt.BorderLayout; +import java.awt.Color; +//import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.File; + +import javax.swing.BorderFactory; +import javax.swing.JButton; +import javax.swing.JFileChooser; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; +import javax.swing.border.TitledBorder; +import javax.swing.filechooser.FileSystemView; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; + +public class JspsReport_Dialog extends AbstractAIFDialog { + private AbstractAIFApplication app; + private TCSession session; + private InterfaceAIFComponent targetComp; + private TCComponentForm form; + + private JTextField textField; + private JButton okButton; + private JButton celButton; + private JButton pathButton; + // ļѡ + private JFileChooser jFileChooser; + + public JspsReport_Dialog(AbstractAIFApplication app) { + this.app = app; + this.session = (TCSession) app.getSession(); + this.targetComp = app.getTargetComponent(); + } + + public void run() { + //TODO ȷ + if (targetComp.getType().equals("JK8TecReviewRevisionMaster")) { + form=(TCComponentForm)targetComp; + init(); + } else { + MessageBox.post("ѡ", "", MessageBox.ERROR); + } + + } + JLabel nameLabel=new JLabel("Զļ"); + JTextField nameField=new JTextField(16); + String xlsmNam="󱨱"; + private void init() { + FileSystemView fsv = FileSystemView.getFileSystemView(); // õϵͳfileview + String deskPath = fsv.getHomeDirectory().getPath(); // ǰû· + + this.setTitle("ɱ"); + this.textField = new JTextField(deskPath); + + jFileChooser = new JFileChooser(); + this.jFileChooser.setCurrentDirectory(new File(deskPath));// ļѡijʼĿ¼Ϊǰû + this.jFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + + this.pathButton = new JButton("..."); + this.okButton = new JButton("ȷ"); + this.celButton = new JButton("ȡ"); + + + JPanel midJPanel = new JPanel(new PropertyLayout()); + midJPanel.setBorder(new TitledBorder(BorderFactory + .createLineBorder(Color.WHITE), "ѡ񵼳·Ʒ")); // ߿ + // TitleBorder + midJPanel.add("1.1.left.top", new JLabel(" ")); + midJPanel.add("2.1.left.top", nameLabel); + midJPanel.add("2.2.left.top", nameField); + midJPanel.add("3.1.left.top", new JLabel("·")); + midJPanel.add("3.2.left.top", this.textField); + midJPanel.add("3.3.left.top", this.pathButton); + JPanel rootJPanel = new JPanel(new FlowLayout()); + rootJPanel.add(this.okButton); + rootJPanel.add(this.celButton); + + pathButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent arg0) { + selectFileButtonEvent(); + } + + }); + okButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + if (textField.getText().contains(".")) { + MessageBox.post("ѡļУ", "", MessageBox.WARNING); + } else { + okEvent(); + } + } + + }); + celButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + disposeDialog(); + dispose(); + } + }); + + this.setLayout(new BorderLayout()); + this.add(midJPanel, BorderLayout.CENTER); + this.add(rootJPanel, BorderLayout.SOUTH); + + this.setAlwaysOnTop(true); + this.showDialog(); + } + + private void okEvent() { + disposeDialog(); + dispose(); + + try { + + String pathfield = this.textField.getText(); + xlsmNam=nameField.getText(); + JspsReport_Operation operation = new JspsReport_Operation( + pathfield,xlsmNam,form,session); + operation.executeOperation(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + private void selectFileButtonEvent() { + int state = jFileChooser.showOpenDialog(null);// ˾ǴļѡĴ + if (state == 1) { + return; + } else { + File f = jFileChooser.getSelectedFile();// fΪѡ񵽵Ŀ¼ + textField.setText(f.getAbsolutePath()); + } + } +} diff --git a/src/com/connor/jk/plm/report/JspsReport_Handler.java b/src/com/connor/jk/plm/report/JspsReport_Handler.java new file mode 100644 index 0000000..155a098 --- /dev/null +++ b/src/com/connor/jk/plm/report/JspsReport_Handler.java @@ -0,0 +1,22 @@ +package com.connor.jk.plm.report; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.connor.jk.plm.report.JspsReport_Action; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aifrcp.AIFUtility; + +public class JspsReport_Handler extends AbstractHandler { + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + // TODO Auto-generated method stub + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + JspsReport_Action action=new JspsReport_Action(app,null); + new Thread(action).start(); + return null; + } + +} diff --git a/src/com/connor/jk/plm/report/JspsReport_Operation.java b/src/com/connor/jk/plm/report/JspsReport_Operation.java new file mode 100644 index 0000000..264236f --- /dev/null +++ b/src/com/connor/jk/plm/report/JspsReport_Operation.java @@ -0,0 +1,295 @@ +package com.connor.jk.plm.report; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.util.Arrays; +import java.util.List; + +import org.apache.poi.ss.usermodel.CellStyle; +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.apache.poi.xssf.usermodel.extensions.XSSFCellAlignment; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.AbstractAIFOperation; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponentDataset; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCComponentTcFile; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class JspsReport_Operation extends AbstractAIFOperation { + private TCComponentForm form; + private TCSession session; + private String pathfield; + private FileInputStream fis; + private FileOutputStream fos; + private XSSFWorkbook workBook; + private String xlsmNam; + + public JspsReport_Operation(String pathfield, String xlsmNam, TCComponentForm form, TCSession session) { + this.form = form; + this.pathfield = pathfield; + this.xlsmNam = xlsmNam; + this.session = session; + } + + @Override + public void executeOperation() throws Exception { + String ssx = "jk_JspsReport_uid";//A$clMvXdYvbLjA + File fmsFile = getExcle(ssx);// ģ + if (fmsFile == null) { + MessageBox.post("ģϵԱ", "", MessageBox.ERROR); + return; + } + // String[] lcjd = form.getTCProperty("δ").getStringValueArray();// ̽ڵ + String[] psr = form.getTCProperty("jk8Reviewer").getStringValueArray();// + String[] jd = form.getTCProperty("jk8Decision").getStringValueArray();// + String[] tcrq = form.getTCProperty("jk8ProposedDate").getStringValueArray();// + String[] wtszwz = form.getTCProperty("jk8ProbLocation").getStringValueArray();// λ + String[] wtms = form.getTCProperty("jk8ProbDesc").getStringValueArray();// + String[] jy = form.getTCProperty("jk8Proposal").getStringValueArray();// + String[] zt = form.getTCProperty("jk8Status").getStringValueArray();// ״̬ + String[] cljg = form.getTCProperty("jk8TreatResult").getStringValueArray();// ˵ + int col = psr.length; + + fis = new FileInputStream(fmsFile); + workBook = new XSSFWorkbook(fis); + XSSFSheet sheet = workBook.getSheetAt(0); + sheet.setColumnWidth(1, 1500); + sheet.setColumnWidth(5, 5000); + sheet.setColumnWidth(6, 5000); + sheet.setColumnWidth(7, 5000); + sheet.setColumnWidth(9, 5000); + XSSFCellStyle sty = workBook.createCellStyle();//״̬ + sty.setWrapText(true);// Զ + sty.setAlignment(XSSFCellStyle.ALIGN_CENTER); + sty.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER); + sty.setBorderBottom((short) 1); + sty.setBorderRight((short) 1); + sty.setBorderLeft((short) 1); + sty.setBorderTop((short) 1); + XSSFCellStyle sty1 = workBook.createCellStyle();//һ״̬ + sty1.setWrapText(true);// Զ + sty1.setAlignment(XSSFCellStyle.ALIGN_CENTER); + sty1.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER); + sty1.setBorderBottom((short) 2); + sty1.setBorderRight((short) 1); + sty1.setBorderLeft((short) 1); + sty1.setBorderTop((short) 1); + XSSFCellStyle sty2 = workBook.createCellStyle();//Bб + sty2.setBorderBottom((short) 1); + sty2.setBorderRight((short) 1); + sty2.setBorderLeft((short) 2); + sty2.setBorderTop((short) 1); + sty2.setWrapText(true);// Զ + sty2.setAlignment(XSSFCellStyle.ALIGN_CENTER); + sty2.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER); + XSSFCellStyle sty3 = workBook.createCellStyle();//CI + sty3.setBorderBottom((short) 1); + sty3.setBorderRight((short) 1); + sty3.setBorderLeft((short) 1); + sty3.setBorderTop((short) 1); + sty3.setWrapText(true);// Զ + sty3.setAlignment(XSSFCellStyle.ALIGN_LEFT); + sty3.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER); + XSSFCellStyle sty4 = workBook.createCellStyle();//J + sty4.setBorderBottom((short) 1); + sty4.setBorderRight((short) 2); + sty4.setBorderLeft((short) 1); + sty4.setBorderTop((short) 1); + sty4.setWrapText(true);// Զ + sty4.setAlignment(XSSFCellStyle.ALIGN_LEFT); + sty4.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER); + XSSFCellStyle sty5 = workBook.createCellStyle();//һB + sty5.setBorderBottom((short) 2); + sty5.setBorderRight((short) 1); + sty5.setBorderLeft((short) 2); + sty5.setBorderTop((short) 1); + sty5.setWrapText(true);// Զ + sty5.setAlignment(XSSFCellStyle.ALIGN_CENTER); + sty5.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER); + XSSFCellStyle sty6 = workBook.createCellStyle();//һCI + sty6.setBorderBottom((short) 2); + sty6.setBorderRight((short) 1); + sty6.setBorderLeft((short) 1); + sty6.setBorderTop((short) 1); + sty6.setWrapText(true);// Զ + sty6.setAlignment(XSSFCellStyle.ALIGN_LEFT); + sty6.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER); + XSSFCellStyle sty7 = workBook.createCellStyle();//һJ + sty7.setBorderBottom((short) 2); + sty7.setBorderRight((short) 2); + sty7.setBorderLeft((short) 1); + sty7.setBorderTop((short) 1); + sty7.setWrapText(true);// Զ + sty7.setAlignment(XSSFCellStyle.ALIGN_LEFT); + sty7.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER); + for (int i = 0; i < col; i++) { + XSSFRow r = null; + if (i >= 1) { + + r = sheet.createRow(i + 2); + } else { + r = sheet.getRow(i + 2); + } + XSSFCell ce = null; + if (i >= 1) { + + for (int j = 1; j < 10; j++) { + ce = r.createCell(j); +// ce.setCellStyle(sty); + } + } else { + for (int j = 1; j < 10; j++) { + ce = r.getCell(j); +// ce.setCellStyle(sty); + } + } + // иߺԶ +// if (i < col) { +// +// int rwsTemp = wtszwz[i].length() / 10 + 1;// λ +// int rwsTemp1 = wtms[i].length() / 10 + 1;// +// int rwsTemp2 = jy[i].length() / 10 + 1;// +// int rwsTemp3 = cljg[i]==null?1: cljg[i].length()/ 10 + 1;// ˵ +// int temp; +// +// int a[] = new int[] { rwsTemp, rwsTemp1, rwsTemp2, rwsTemp3 }; +// Arrays.sort(a); +//// for (int i1 = 0; i1 < a.length; i1++) { +//// System.out.println(a[i1]); +//// } +// temp = a[a.length-1]; +// +// r.setHeight((short) (temp * 260+45)); +// ce.getCellStyle().setWrapText(true); +// ce.getCellStyle().setAlignment(CellStyle.ALIGN_LEFT); +// } + + r.getCell(1).setCellValue((i + 1) + ""); + r.getCell(2).setCellValue(psr[i]); + r.getCell(3).setCellValue(jd[i]); + r.getCell(4).setCellValue(tcrq[i]); + r.getCell(5).setCellValue(wtszwz[i]); + r.getCell(6).setCellValue(wtms[i]); + r.getCell(7).setCellValue(jy[i]); + r.getCell(8).setCellValue(zt[i]);// ״̬ + r.getCell(9).setCellValue(cljg[i]);// ˵ + } + + int startLine=2; + for (int j = 0+startLine; j < col+startLine; j++) { + XSSFRow r=sheet.getRow(j); + XSSFCell cell=null; + for (int k = 1; k < 10; k++) { + cell=r.getCell(k); + switch(k) { + case 1: + cell.setCellStyle(sty2); + if(j==col+startLine-1) { + cell.setCellStyle(sty5); + } + break; + case 2: + cell.setCellStyle(sty3); + if(j==col+startLine-1) { + cell.setCellStyle(sty6); + } + break; + case 3: + cell.setCellStyle(sty3); + if(j==col+startLine-1) { + cell.setCellStyle(sty6); + } + break; + case 4: + cell.setCellStyle(sty3); + if(j==col+startLine-1) { + cell.setCellStyle(sty6); + } + break; + case 5: + cell.setCellStyle(sty3); + if(j==col+startLine-1) { + cell.setCellStyle(sty6); + } + break; + case 6: + cell.setCellStyle(sty3); + if(j==col+startLine-1) { + cell.setCellStyle(sty6); + } + break; + case 7: + cell.setCellStyle(sty3); + if(j==col+startLine-1) { + cell.setCellStyle(sty6); + } + break; + case 8: + cell.setCellStyle(sty); + if(j==col+startLine-1) { + cell.setCellStyle(sty1); + } + break; + case 9: + cell.setCellStyle(sty4); + if(j==col+startLine-1) { + cell.setCellStyle(sty7); + } + break; + + } + } + } + File file = new File(pathfield + "\\" + xlsmNam + ".xlsx"); + fos = new FileOutputStream(file); + workBook.write(fos); + MessageBox.post("Ѿ", "ɹ", MessageBox.INFORMATION); + Runtime.getRuntime().exec(new String[] { "cmd.exe", "/c", pathfield + "\\" + xlsmNam + ".xlsx" });// ɺֱӴ + + } + + private File getExcle(String ssx) { + File fmsFile = null; + try { + TCPreferenceService pref = session.getPreferenceService(); + String puid = pref.getStringValue(ssx); + if (puid == null) { + MessageBox.post("ѡδҵϵԱ", "", MessageBox.ERROR); + return null; + } + TCComponentDataset dat; + + dat = (TCComponentDataset) session.stringToComponent(puid);// gbRlRh8uaTDHqA + + if (dat == null) { + MessageBox.post("ģδҵϵԱ", "", MessageBox.ERROR); + return null; + } + + TCComponentTcFile[] file = dat.getTcFiles(); + if (file.length == 0 || file.length != 1) { + MessageBox.post("ݼûõļļ࣬飡", "WARNING", MessageBox.WARNING); + return null; + } else { + fmsFile = file[0].getFmsFile(); + } + + } catch (TCException e) { + e.printStackTrace(); + MessageBox.post("ûҵҪݼ", "", 1); + return null; + } + return fmsFile; + } + +} diff --git a/src/com/connor/jk/plm/report/ProgressBar.java b/src/com/connor/jk/plm/report/ProgressBar.java new file mode 100644 index 0000000..9bea3a1 --- /dev/null +++ b/src/com/connor/jk/plm/report/ProgressBar.java @@ -0,0 +1,171 @@ +/** + * @file ProgressBar.java + * + * @brief Create progress bar + * + * @author Yanghui + * + * @history + * ================================================================ + * Date Name Description of Change + * 25-July-2008 Yanghui this class is used to create + * progress bar. + */ +package com.connor.jk.plm.report; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JProgressBar; +import javax.swing.Timer; +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.util.PropertyLayout; +import com.teamcenter.rac.util.Registry; + +/** + * @class ProgressBar + * @brief Create progress bar + * @author Yanghui + */ +public class ProgressBar extends AbstractAIFDialog implements ActionListener { + /** + * @var ProgressBar.progressbar + * @brief JProgressBar + */ + private JProgressBar progressbar; + + /** + * @var ProgressBar.label + * @brief label used to tips + */ + private JLabel label; + + /** + * @var ProgressBar.timer + * @brief timer used to timing operation + */ + private Timer timer; + + /** + * @var ProgressBar.bool + * @brief bool used to flag thread return + */ + private boolean bool = false; + + /** + * @var Progressbar.registry + * @brief Registry + */ + private Registry registry; + + /** + * @fn public ProgressBar() + * @brief constructor + * @param[in] null + */ + private String showLable = null ; + public ProgressBar(String showlable) { + super(true); + showLable = showlable; + this.setAlwaysOnTop(true); + } + + /** + * @fn public void setBool(boolean bool) + * @brief set bool value + * @param[in] bool + * @param[out] null + */ + public void setBool(boolean bool) { + this.bool = bool; + } + + /** + * @fn private void initUI() + * @brief createDialog method + * @param[in] null + * @param[out] null + */ + public void initUI() { + Container container = getContentPane(); + JPanel mainPanel = new JPanel(new PropertyLayout()); + this.label = new JLabel(showLable, JLabel.CENTER); + this.progressbar = new JProgressBar(); + this.progressbar.setOrientation(JProgressBar.HORIZONTAL); + this.progressbar.setMinimum(0); + this.progressbar.setMaximum(100); + this.progressbar.setValue(0); + this.progressbar.setPreferredSize(new Dimension(200, 15)); + this.progressbar.setBorderPainted(true); + this.timer = new Timer(50, (ActionListener) this); + this.timer.setRepeats(false); + mainPanel.add("1.1.center", new JLabel(" ")); + mainPanel.add("2.1.center", label); + mainPanel.add("3.1.center", progressbar); + mainPanel.add("4.1.center", new JLabel(" ")); + container.add(mainPanel); + pack(); + setLocation(500, 200); + TaskThread thread = new TaskThread(this); + thread.start(); + addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + bool = true; + } + }); + this.setVisible(true); + } + + /** + * @class TaskThread + * @brief Create progressbar + * + */ + class TaskThread extends Thread { + private ProgressBar bar; + + public TaskThread(ProgressBar bar) { + this.bar = bar; + } + + public void run() { + if (bool == false) { + // Set Status is running. + // session.setStatus(registry.getString("export Running")); + } + for (int i = 0; i < i + 1; i++) { + timer.start(); + int value = progressbar.getValue(); + if (value < 100) { + value = value + 5; + progressbar.setValue(value); + } else { + timer.stop(); + progressbar.setValue(0); + } + try { + sleep(100); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + if (bool == true) { + bar.setVisible(false); + bar.dispose(); + return; + + } + + } + } + } + + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + + } +} diff --git a/src/com/connor/jk/plm/report/ProgressBarThread.java b/src/com/connor/jk/plm/report/ProgressBarThread.java new file mode 100644 index 0000000..070d9ba --- /dev/null +++ b/src/com/connor/jk/plm/report/ProgressBarThread.java @@ -0,0 +1,41 @@ +/** + * @file ProgressBarThread.java + * + * @brief control progressBar. + * + * @author Yanghui + * + * @history + * ================================================================ + * Date Name Description of Change + * 08-Auguest-2008 Yanghui this class is used to control + * progress bar. + */ +package com.connor.jk.plm.report; + +/** + * @class ProgressBarThread + * @brief Create progress bar thread + * @author Yanghui + */ +public class ProgressBarThread extends Thread { + + private ProgressBar bar; + + private String title; + + public ProgressBarThread(String title,String showLable) { + this.title = title; + bar = new ProgressBar(showLable); + } + + public void run() { + bar.setTitle(title); + bar.initUI(); + } + + public void setBool(boolean bool) { + bar.setBool(true); + bar.setAlwaysOnTop(false); + } +} diff --git a/src/com/connor/jk/plm/report/SqlUtil.java b/src/com/connor/jk/plm/report/SqlUtil.java new file mode 100644 index 0000000..d7adfe5 --- /dev/null +++ b/src/com/connor/jk/plm/report/SqlUtil.java @@ -0,0 +1,633 @@ +package com.connor.jk.plm.report; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; + +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.Registry; + +/** + * ֹ̳final,ֹ󽨶˽й췽,ΪʹС PreparedStatementResultSetС + * + * @author hub 2015-02-06 + */ +public final class SqlUtil { + public static Connection connection = null; + public static PreparedStatement ps = null; + public static ResultSet rs = null; + private static Registry reg = Registry.getRegistry("com.connor.jk.plm.report.database"); + + /** + * ˽йnew󣬷ֹö + */ + private SqlUtil() { + + } + + static { + String driver = reg.getString("ORACEL_DRIVER"); // Util.getProperties("DRIVER"); + if (driver == null) { + driver = "oracle.jdbc.driver.OracleDriver"; + } + + System.out.println("driver " + driver); + try { + Class.forName(driver); + } catch (ClassNotFoundException e) { + System.out.println("ORACEL DRIVER IS EXCEPTION"); + e.printStackTrace(); + } + } + + /** + * ݿ + */ + public static Connection getConnection() { + try { + String driver_temp = reg.getString("ORACEL_DRIVER"); + String url = reg.getString("ORACEL_URL");// getProperties("URL"); + String dbName = reg.getString("ORACEL_NAME");// Util.getProperties("dbName"); + String dbPassword = reg.getString("ORACEL_PASSWORD");// Util.getProperties("dbPassword"); +// String driver_temp = "oracle.jdbc.driver.OracleDriver"; +// String url = "jdbc:oracle:thin:@localhost:1521:local ";// getProperties("URL"); +// String dbName = "GOLD_CARD";// Util.getProperties("dbName"); +// String dbPassword = "jk300349";// Util.getProperties("dbPassword"); + System.out.println("ORACEL_DRIVER:"+driver_temp); + System.out.println("ORACEL_URL:"+url); + System.out.println("ORACEL_NAME:"+dbName); + System.out.println("ORACEL_PASSWORD:"+dbPassword); +// int a=1; +// if(a==1){ +// return connection; +// } + + if (driver_temp == null || url == null || dbName == null + || dbPassword == null) { + + MessageBox.post("ݿѡǷȷ", "ʾ", MessageBox.ERROR); + + } + // else{ + // MessageBox.post(driver_temp+" | "+url+" | "+dbName+" | "+dbPassword,"ʾ",MessageBox.ERROR); + // + // } + System.out.println(url + dbName + dbPassword); + connection = DriverManager.getConnection(url, dbName, dbPassword); +// connection.setAutoCommit(false); + } catch (SQLException e) { + System.out.println("ORACEL CONNECT EXCEPTION"); + e.printStackTrace(); + return null; + // MessageBox.post("ORACEL CONNECT EXCEPTION \n"+e.getMessage(),"ERROR",MessageBox.ERROR); + } + return connection; + } + + /** + * ݿ + */ + public static Connection getConnection(String dbName,String dbPassword,String url,String driver_temp) { + try { + + System.out.println("ORACEL_DRIVER:"+driver_temp); + System.out.println("ORACEL_URL:"+url); + System.out.println("ORACEL_NAME:"+dbName); + System.out.println("ORACEL_PASSWORD:"+dbPassword); + if (driver_temp == null || url == null || dbName == null + || dbPassword == null) { + + MessageBox.post("ݿѡǷȷ", "ʾ", MessageBox.ERROR); + + } + // else{ + // MessageBox.post(driver_temp+" | "+url+" | "+dbName+" | "+dbPassword,"ʾ",MessageBox.ERROR); + // + // } + System.out.println(url + dbName + dbPassword); + connection = DriverManager.getConnection(url, dbName, dbPassword); +// connection.setAutoCommit(false); + } catch (SQLException e) { + System.out.println("ORACEL CONNECT EXCEPTION"); + e.printStackTrace(); + return null; + // MessageBox.post("ORACEL CONNECT EXCEPTION \n"+e.getMessage(),"ERROR",MessageBox.ERROR); + } + return connection; + } + + /** + * ݿ + */ + public static Connection getConnection(String url, String dbName, + String dbPassword) { + try { + String driver_temp = reg.getString("ORACEL_DRIVER"); + + System.out.println(url + dbName + dbPassword); + connection = DriverManager.getConnection(url, dbName, dbPassword); + connection.setAutoCommit(false); + } catch (SQLException e) { + System.out.println("ORACEL CONNECT EXCEPTION"); + e.printStackTrace(); + // MessageBox.post("ORACEL CONNECT EXCEPTION \n"+e.getMessage(),"ERROR",MessageBox.ERROR); + return null; + } + return connection; + } + + /** + * ƴSELECT + * + * @param tableName + * @param selectElement + * @param args + * @return + */ + public static String getSelectSql(String tableName, String[] selectElement, + String... args) { + StringBuffer valuesSB = new StringBuffer("SELECT "); + if (selectElement != null) { + for (String element : selectElement) { + valuesSB.append(element).append(","); + } + valuesSB.delete(valuesSB.length() - 1, valuesSB.length()); + } + valuesSB.append(" FROM "); + valuesSB.append(tableName); + valuesSB.append(" WHERE"); + for (int i = 0; i < args.length; i++) { + valuesSB.append(" "); + valuesSB.append(args[i]); + valuesSB.append("=? "); + valuesSB.append("AND"); + } + + valuesSB.delete(valuesSB.length() - 3, valuesSB.length()); + return valuesSB.toString(); + } + + + /** + * ƴSELECT + * + * @param tableName + * @param selectElement + * @param args + * @return + */ + public static String getSelectSql_1(String tableName, String selectElement, + String keyword ) { + StringBuffer valuesSB = new StringBuffer("SELECT *"); + + valuesSB.append(" FROM "); + valuesSB.append(tableName); + valuesSB.append(" WHERE "); + valuesSB.append(selectElement); + valuesSB.append(" = '"); + valuesSB.append(keyword); + valuesSB.append("'"); + return valuesSB.toString(); + } + + /** + * ƴSELECT + * + * @param tableName + * @param selectElement + * @param args + * @return + */ + public static String getSelectSql_id(String tableName, String selectElement, + int keyword ) { + StringBuffer valuesSB = new StringBuffer("SELECT *"); + + valuesSB.append(" FROM "); + valuesSB.append(tableName); + valuesSB.append(" WHERE "); + valuesSB.append(selectElement); + valuesSB.append(" = "); + valuesSB.append(keyword); +// valuesSB.append(""); + return valuesSB.toString(); + } + /** + * ƴSELECT + * + * @param tableName + * @param selectElement + * @param args + * @return + */ + public static String getSelectSql_3(String tableName, String selectElement, + int keyword ) { + StringBuffer valuesSB = new StringBuffer("SELECT *"); + + valuesSB.append(" FROM "); + valuesSB.append(tableName); + valuesSB.append(" WHERE "); + valuesSB.append(selectElement); + valuesSB.append(" = "); + valuesSB.append(keyword); + return valuesSB.toString(); + } + /** + * ƴSELECT + * + * @param tableName + * @param selectElement + * @param args + * @return + */ + public static String getSelectSql_2(String tableName ) { + StringBuffer valuesSB = new StringBuffer("SELECT *"); + valuesSB.append(" FROM "); + valuesSB.append(tableName); + return valuesSB.toString(); + } + + /** + * ƴSELECT + * + * @param tableName + * @param args + * @return + */ + public static String getSelectSql(String tableName, String... args) { + StringBuffer valuesSB = new StringBuffer("SELECT * FROM "); + valuesSB.append(tableName); + valuesSB.append(" WHERE"); + for (int i = 0; i < args.length; i++) { + valuesSB.append(" "); + valuesSB.append(args[i]); + valuesSB.append("=? "); + valuesSB.append("AND"); + } + + valuesSB.delete(valuesSB.length() - 3, valuesSB.length()); + return valuesSB.toString(); + } + + /** + * ƴӸ + * + * @param tableName + * @param args + * @param args2 + * @return + */ + public static String getUpdataSQL(String tableName, String[] args, + String[] args2) { + StringBuffer updateSB = new StringBuffer("UPDATE "); + updateSB.append(tableName); + updateSB.append(" SET "); + // ƴӸ + for (int i = 0; i < args.length; i++) { + if (args[i].toUpperCase().equals("OPERATE_TIME") + || args[i].toUpperCase().equals("LAST_UPDATE_DATE")) { + updateSB.append(args[i]).append( + "=to_date(?,'yyyy-MM-dd HH24:mi:ss') ,"); + } else { + updateSB.append(args[i]).append("=? ,"); + } + } + updateSB.delete(updateSB.length() - 2, updateSB.length()); + ; + updateSB.append(" WHERE "); + for (int i = 0; i < args2.length; i++) { + updateSB.append(args2[i]).append("=? AND "); + } + updateSB.delete(updateSB.length() - 4, updateSB.length()); + return updateSB.toString(); + } + + /** + * ƴSQLinsert + * + * @param tableName + * @param args + * @return + */ + public static String getInsertSql(String tableName, String... args) { + StringBuffer insertSql = new StringBuffer("insert into "); + StringBuffer values = new StringBuffer("values("); + + if (tableName != null && args != null && args.length > 0) { + insertSql.append(tableName); + insertSql.append("("); + for (int i = 0; i < args.length; i++) { + insertSql.append(args[i]); + insertSql.append(", "); + if (args[i].toUpperCase().equals("COMMIT_TIME") + || args[i].toUpperCase().equals("CREATE_DATE") + || args[i].toUpperCase().equals("INVALID_DATE")) { + values.append("to_date(?,'yyyy-MM-dd HH24:mi:ss'), "); + } else { + values.append("?, "); + } + + } + } else { + return null; + } + insertSql.delete(insertSql.length() - 2, insertSql.length()); + values.delete(values.length() - 2, values.length()); + insertSql.append(") ").append(values).append(")"); + return insertSql.toString(); + } + + /** + * õݿ + * + * @param tableName + * @param args + * + * @param args2 + * + * @return ƴӺĴݿ + */ + public final static String GetCreateTableSQL(String tableName, + String[] args, String[] args2) { + + if (args == null || args2 == null || args.length != args2.length) { + System.out.println("THE INPUT PRAGREMS IS ERROR"); + return null; + } + StringBuffer createSQL = new StringBuffer("create table "); + createSQL.append(tableName); + createSQL.append("("); + for (int i = 0; i < args.length; i++) { + createSQL.append(args[i] + " "); + createSQL.append(args2[i] + ", "); + } + createSQL.delete(createSQL.length() - 2, createSQL.length()); + createSQL.append(")"); + return createSQL.toString(); + } + + /** + * õStatement + */ + public final static PreparedStatement getPs(String sql) throws SQLException { + return getPs(sql, null); + } + + /** + * õStatement + */ + public final static PreparedStatement getPs(Object[] argments, String sql) + throws SQLException { +// System.out.println("PreparedStatement getPs"); + return getPs(sql, argments); + } + + /** + * õStatement + */ + public final static PreparedStatement getPs(String sql, Object[] argments) + throws SQLException { +// System.out.println("PreparedStatement getPs2"); + SqlUtil.ps = SqlUtil.connection.prepareStatement(sql); + if (argments != null) { + for (int i = 0; i < argments.length; i++) { + SqlUtil.ps.setObject(i + 1, argments[i]); + } + } + return SqlUtil.ps; + } + + + /** + * + */ + public final static int write(String sql) { + return write(sql, null); + } + + /** + * + */ + public final static int write(Object[] argments, String sql) { + return write(sql, argments); + } + + /** + * + */ + public final static int write(String sql, Object[] argments) { + + return update(sql, argments); + } + + /** + * ɾ + */ + public final static int delete(String sql) { + return delete(sql, null); + } + + /** + * ɾ + */ + public final static int delete(Object[] argments, String sql) { + return delete(sql, argments); + } + + /** + * ɾ + */ + public final static int delete(String sql, Object[] argments) { + return update(sql, argments); + } + + /** + * ޸ + */ + public final static int update(String sql) { + return update(sql, null); + } + + /** + * ޸ + */ + public final static int update(String[] argments, String sql) { + return update(sql, argments); + } + + /** + * ޸(ɾնҪô˷˴쳣رճConnectionΪĶ) + */ + public final static int update(String sql, Object[] argments) { + int i = -1; + try { + i = SqlUtil.getPs(argments, sql).executeUpdate(); + // 2015-11-19 + // SqlUtil.connection.commit(); + } catch (SQLException e) { + e.printStackTrace(); + } finally { + free(SqlUtil.rs, SqlUtil.ps); + } + return i; + } + + /** + * ѯ + */ + public final static ResultSet read(String sql) throws SQLException { +// System.out.println("ResultSet read"); + return read(sql, null); + } + + /** + * ѯ + */ + public final static ResultSet read(Object[] argments, String sql) + throws SQLException { + return read(sql, argments); + } + + /** + * ѯ(вѯնҪô˷治쳣׳ɵߴfinallyͷԴ) + * + * @throws SQLException + */ + public final static ResultSet read(String sql, Object[] argments) + throws SQLException { +// System.out.println("ResultSet read2"); + return SqlUtil.rs = SqlUtil.getPs(argments, sql).executeQuery(); + } + + /** + * + */ + public final static boolean createTable(String sql) { + return go(sql, null); + } + + /** + * ɾ + */ + public final static boolean dropTable(String sql) { + return go(sql, null); + } + + /** + * ޸ı + */ + public final static boolean alterTable(String sql) { + return go(sql, null); + } + + /** + * ˷ִDDL(,޸ı,ɾ) + */ + private final static boolean go(String sql, Object[] argments) { + boolean flag = false; + try { + flag = SqlUtil.getPs(sql, argments).execute(); + } catch (SQLException e) { + e.printStackTrace(); + } finally { + free(SqlUtil.rs, SqlUtil.ps); + } + if (flag) { + try { + SqlUtil.connection.commit(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return flag; + } + + /** + * ͷԴ + */ + public final static void free(ResultSet resultSet) { + free(resultSet, null, null); + } + + /** + * ͷԴ + */ + public final static void free(Statement statement) { + free(null, statement, null); + } + + /** + * ͷԴ + */ + public final static void free(Connection connection) { + free(null, null, connection); + } + + /** + * ͷԴ + */ + public final static void free(ResultSet resultSet, Statement statement) { + free(resultSet, statement, null); + } + + /** + * ͷԴ + */ + public final static void free(Statement statement, Connection connection) { + free(null, statement, connection); + } + + /** + * ͷԴ(Ĭϲ) + */ + public final static void free() { + free(SqlUtil.rs, SqlUtil.ps); + } + + /** + * ͷԴ(ȫͷ) + */ + public final static void freeAll() { + free(SqlUtil.rs, SqlUtil.ps, SqlUtil.connection); + } + + /** + * ͷԴ(ҲҪȫͷ) + */ + public final static void free(ResultSet resultSet, Statement statement, + Connection connection) { + try { + if (resultSet != null) { + try { + resultSet.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } finally { + try { + if (statement != null) { + try { + statement.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } finally { + if (connection != null) { + try { + connection.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + } + } + +// public void findsth(String searchpart){ +// +// } +} diff --git a/src/com/connor/jk/plm/report/WorkHour_Dialog.java b/src/com/connor/jk/plm/report/WorkHour_Dialog.java new file mode 100644 index 0000000..0d583b9 --- /dev/null +++ b/src/com/connor/jk/plm/report/WorkHour_Dialog.java @@ -0,0 +1,259 @@ +package com.connor.jk.plm.report; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.File; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; + +import javax.swing.JButton; +import javax.swing.JFileChooser; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; +import javax.swing.filechooser.FileSystemView; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; + +public class WorkHour_Dialog extends AbstractAIFDialog implements +ActionListener{ + private AbstractAIFApplication app; + private TCSession session; + private JPanel mainJpanel; + private JLabel pathJlabel; + private JTextField pathJTextField; + private JFileChooser chooser; + + private JButton okButton; + private JButton celButton; + + + JLabel userLabel; + JLabel user; + JLabel startLabel; + JTextField startField = new JTextField(20); + JLabel endLabel; + JTextField endField = new JTextField(20); + JButton startSelect; + JButton endSelect; + + + private JButton pathButton; + + private JPanel bottomJpanel; + + private String exportFile; + + private ProgressBarThread wait; + String opType; + public WorkHour_Dialog(String opType, AbstractAIFApplication app) { + // TODO Auto-generated constructor stub + + this.app=app; + this.opType=opType; + this.session=(TCSession) app.getSession(); + } + + @Override + public void run() { +// super.run();//ע򴰿ʾ + initUI(); + } + + private void initUI() { + this.setTitle("ɹʱ"); + pathJlabel=new JLabel("ѡ񵼳·"); + pathJTextField=new JTextField(20); + FileSystemView fileSystemView=FileSystemView.getFileSystemView(); + String route=fileSystemView.getHomeDirectory().getPath(); + pathJTextField.setText(route); + + chooser=new JFileChooser(); + this.chooser.setCurrentDirectory(new File(route)); + this.chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + + String userName=""; + try { + userName = session.getUser().getProperty("user_name"); + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + userLabel=new JLabel("Ȩ:"); + user=new JLabel(userName); + startLabel=new JLabel("ʼʱ:"); + endLabel=new JLabel("ʱ:"); + startField.setEditable(false); + endField.setEditable(false); + + startSelect=new JButton("ѡ "); + startSelect.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent arg0) { + CalendarPanel ca = new CalendarPanel(startField, 1); + } + }); + + endSelect=new JButton("ѡ "); + endSelect.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent arg0) { + CalendarPanel ca = new CalendarPanel(endField, 1); + } + }); + + pathButton=new JButton("..."); + pathButton.addActionListener(this); + okButton=new JButton("ȷ"); + okButton.addActionListener(this); + this.getRootPane().setDefaultButton(okButton);//õǰĬѡаť + celButton=new JButton("ȡ"); + celButton.addActionListener(this); + + + this.setLayout(new BorderLayout()); + this.setAlwaysOnTop(true); + mainJpanel=new JPanel(new PropertyLayout()); + + + + mainJpanel.add("1.1.left.top",userLabel); + mainJpanel.add("1.2.left.top",user); + mainJpanel.add("2.1.left.top",startLabel); + mainJpanel.add("2.2.left.top",startField); + mainJpanel.add("2.3.left.top",startSelect); + mainJpanel.add("3.1.left.top",endLabel); + mainJpanel.add("3.2.left.top",endField); + mainJpanel.add("3.3.left.top",endSelect); + mainJpanel.add("4.1.left.top",pathJlabel); + mainJpanel.add("4.2.left.top",pathJTextField); + mainJpanel.add("4.3.left.top",pathButton); + bottomJpanel=new JPanel(new FlowLayout()); + bottomJpanel.add(okButton); + bottomJpanel.add(celButton); + + + this.add(mainJpanel,BorderLayout.CENTER); + this.add(bottomJpanel,BorderLayout.SOUTH); + this.pack(); + this.centerToScreen(); + this.showDialog(); + } + + @Override + public void actionPerformed(ActionEvent e) { + Object sourceObj = e.getSource(); + if(sourceObj.equals(pathButton)){ + selectFileButtonEvent(); + }else if(sourceObj.equals(okButton)){ + String startDate=startField.getText(); + String endDate=endField.getText(); + System.out.println(startDate); +// if(true) { +// return; +// } + long startLong=0; + long endLong=0; + if(startDate.equals("")||endDate.equals("")) { + this.disposeDialog(); + this.dispose(); +// this.setAlwaysOnTop(false); + MessageBox.post("ѡ","",MessageBox.INFORMATION); + return; + }else if(!startDate.equals("")&&!endDate.equals("")) { + startLong=getDate(startDate); + endLong=getDate(endDate); + if(startLong>=endLong) { + this.disposeDialog(); + this.dispose(); + MessageBox.post("ڱʼ","",MessageBox.INFORMATION); + return; + }else { + this.disposeDialog(); + this.dispose(); + System.out.println(startLong); + System.out.println(endLong); + this.wait = new ProgressBarThread("", "ȡУԵ..."); + this.wait.start(); + exportFile=pathJTextField.getText(); + WorkHour_Operation operation=new WorkHour_Operation(startDate,endDate,startLong,endLong,this.wait,app,exportFile,opType); + this.session.queueOperation(operation); + } + } +// else { +// +// this.disposeDialog(); +// this.dispose(); +// System.out.println(startLong); +// System.out.println(endLong); +// this.wait = new ProgressBarThread("", "ȡУԵ..."); +// this.wait.start(); +// exportFile=pathJTextField.getText(); +// WorkHour_Operation operation=new WorkHour_Operation(startLong,endLong,this.wait,app,exportFile,opType); +// this.session.queueOperation(operation); +// } +// try { +// operation.executeOperation(); +// } catch (Exception e1) { +// e1.printStackTrace(); +// } + }else if(sourceObj.equals(celButton)){ +// System.out.println(startField.getText()); +// //ַתΪ +// SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");//СдmmʾǷ +// String dstr=startField.getText(); +// Date date=null; +// try { +// date = sdf.parse(dstr); +// } catch (ParseException e1) { +// e1.printStackTrace(); +// } +// //ȡ +// long longDate = date.getTime(); +// +// System.out.println(longDate); + this.disposeDialog(); + this.dispose(); + } + + } + + public long getDate(String dstr) { + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");//СдmmʾǷ +// String dstr=startField.getText(); + Date date=null; + try { + date = sdf.parse(dstr); + } catch (ParseException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + //ȡ + long longDate = date.getTime(); + return longDate; + } + private void selectFileButtonEvent() { + this.setAlwaysOnTop(false); + int state = chooser.showOpenDialog(null);// ˾ǴļѡĴ + if (state == 1) { + return; + } else { + File f = chooser.getSelectedFile();// fΪѡ񵽵Ŀ¼ + pathJTextField.setText(f.getAbsolutePath()); + this.setAlwaysOnTop(true); + } + + } + + + +} diff --git a/src/com/connor/jk/plm/report/WorkHour_Operation.java b/src/com/connor/jk/plm/report/WorkHour_Operation.java new file mode 100644 index 0000000..a88e7df --- /dev/null +++ b/src/com/connor/jk/plm/report/WorkHour_Operation.java @@ -0,0 +1,785 @@ +package com.connor.jk.plm.report; + +import java.awt.Color; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.sql.ResultSet; +import java.text.DecimalFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.xssf.usermodel.XSSFCell; +import org.apache.poi.xssf.usermodel.XSSFCellStyle; +import org.apache.poi.xssf.usermodel.XSSFColor; +import org.apache.poi.xssf.usermodel.XSSFRow; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.AbstractAIFOperation; +import com.teamcenter.rac.kernel.TCComponentDataset; +import com.teamcenter.rac.kernel.TCComponentTcFile; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class WorkHour_Operation extends AbstractAIFOperation { + private AbstractAIFApplication app; + private String exportFile; + private TCSession session; + private TCPreferenceService tcPreferenceService; + private List valueLists = new ArrayList();//йʱϢļ + private List valueListsNew = new ArrayList(); + + private List groupList = new ArrayList();//ţʱ + + + private List group = new ArrayList<>();// + private List groupMemger = new ArrayList<>();//Ա + private int totalPeople=0;//һ֯ڵ + private double totalhour=0;//һ֯ڵܹʱ + + private Map map=new HashMap(); + + private WorkHoursBean bean; + private GroupBean groupBean; + + private FileInputStream fis; + private FileOutputStream fos; + private XSSFWorkbook workBook; + private ProgressBarThread wait; + private String startDate; + private String endDate; + long startLong; + long endLong; + String opType; + int total=0; + + public WorkHour_Operation(String startDate, String endDate, long startLong, long endLong, ProgressBarThread wait, + AbstractAIFApplication app, String exportFile, String opType) { + this.startDate = startDate; + this.endDate = endDate; + this.startLong = startLong; + this.endLong = endLong; + this.app = app; + this.exportFile = exportFile; + this.session = (TCSession) app.getSession(); + this.wait = wait; + this.opType = opType;// ƣ + } + + @Override + public void executeOperation() throws Exception { + // Ԥ̨ + int day = (int) ((endLong - startLong) / 86400000)+1;//ѡ + int holiday = 0; + + for (int i = 0; i < day; i++) { + String startDateString = longToString(startLong + 86400000 * i); + if (getWeekDay(startDateString)) { + holiday++; + } + } + +// if (true) { +// return; +// } + //TODO + + + + + + + + + + + long start = System.currentTimeMillis(); + String ssx = "jk_workHours_uid";// ģѡwhdlh$E4aTDHqA AzWlG7qWYvbLjA + if (opType.equals("ʱ") || opType.contains("ʱ")) { + ssx = "jk_workHours_uid"; + } else { + ssx = "jk_workHours_uid_indivisual";// ֯ģѡ¸wpeln$ufYvbLjA + } + File fmsFile = getExcle(ssx);// ģ + int num = 0; + + if (fmsFile == null) { + MessageBox.post("ģϵԱ", "", MessageBox.ERROR); + return; + } + tcPreferenceService = session.getPreferenceService(); + String driver_temp = ""; + String url = ""; + String dbName = ""; + String dbPassword = ""; + try { + String[] connect = tcPreferenceService.getStringValue("jk_work_hour_report").split("&"); + if (connect.length == 0) { + System.out.println("ѡ"); + return; + } + dbName = connect[0]; + dbPassword = connect[1]; + url = connect[2]; + driver_temp = connect[3]; + } catch (Exception e1) { + MessageBox.post("ѡjk_work_hour_report", "", MessageBox.ERROR); + e1.printStackTrace(); + return; + } + SqlUtil.getConnection(dbName, dbPassword, url, driver_temp); + +// searchQuestion2= "select * from all_tab_columns where Table_Name='view_TC_gongshi_Detailed'"; +// searchQuestion2= "select * from view_TC_gongshi_Detailed"; +//// searchQuestion2= "SELECT count(*) FROM all_tab_columns where Table_Name='view_TC_gongshi_Detailed'"; +// System.out.println(searchQuestion2); +// ResultSet setw = SqlUtil.read(searchQuestion2);// ѯ +// ResultSetMetaData data = setw.getMetaData(); +// for (int i = 1; i <= data.getColumnCount(); i++) { +// // еĿʵ +// int columnCount = data.getColumnCount(); +// // ָе +// String columnName = data.getColumnName(i); +// System.out.println(columnCount); +// System.out.println("" + i + "ֶ:" + columnName); +// } +// if(true){ +// return; +// } +// searchQuestion= "select * from view_TC_gongshi_Detailed where sdate is not NULL and edate is not NULL and ltrim(rtrim(sdate)) >='" +// +startDate+"' and ltrim(rtrim(edate))<='"+endDate+"'"; + String[] sd=startDate.split("-"); + if(sd[1].length()==1){ + sd[1]="0"+sd[1]; + } + if(sd[2].length()==1){ + sd[2]="0"+sd[2]; + } + startDate=sd[0]+"-"+sd[1]+"-"+sd[2]; + String[] ed=endDate.split("-"); + if(ed[1].length()==1){ + ed[1]="0"+ed[1]; + } + if(ed[2].length()==1){ + ed[2]="0"+ed[2]; + } + endDate=ed[0]+"-"+ed[1]+"-"+ed[2]; + System.out.println("ʼ==========="+startDate); + System.out.println("==========="+endDate); + //2018.07.02 ֻʱ +// searchQuestion= "select * from view_TC_gongshi_Detailed where sdate is not NULL and edate is not NULL and ltrim(rtrim(sdate)) >='" +// +startDate+"' and ltrim(rtrim(edate)) <='"+endDate+"' "; +// String searchQuestion= "select * from view_TC_gongshi_Detailed where sdate is not NULL and edate is not NULL and ltrim(rtrim(sdate)) >='" + String searchQuestion= "select * from view_TC_gongshi_Detailed where sdate is not NULL and edate is not NULL and ltrim(rtrim(edate)) >='" + +startDate+"' and ltrim(rtrim(edate)) <='"+endDate+"' "; +// searchQuestion = "select * from view_TC_gongshi_Detailed where deptName = '" + opType + "' and sdate is not NULL and edate is not NULL and ltrim(rtrim(sdate)) >='" + searchQuestion = "select * from view_TC_gongshi_Detailed where deptName = '" + opType + "' and sdate is not NULL and edate is not NULL and ltrim(rtrim(edate)) >='" + +startDate+"' and ltrim(rtrim(edate)) <='"+endDate+"' ";; + if (opType.equals("ʱ")) { + searchQuestion = "select * from view_TC_gongshi_Detailed where sdate is not NULL and edate is not NULL and ltrim(rtrim(edate)) >='" +// searchQuestion = "select * from view_TC_gongshi_Detailed where sdate is not NULL and edate is not NULL and ltrim(rtrim(sdate)) >='" + +startDate+"' and ltrim(rtrim(edate)) <='"+endDate+"' "; + } + String searchQuestion2 = ""; + System.out.println(searchQuestion); + try { + ResultSet set = SqlUtil.read(searchQuestion);// ѯ + total=0; + while (set.next()) { + total++; + + } + System.out.println("--------------"+total); + ResultSet set2 = null; + // System.out.println(set.next()==true); + set = SqlUtil.read(searchQuestion); + while (set.next()) { + num++; + // System.out.println("num--------------------------->"+num); + bean = new WorkHoursBean(); + groupBean = new GroupBean(); + String flowno; + String gh; + String lastname = ""; + String sdate; + String edate; + String p_num; + String xmmc; + String ifxm; + String schedduleTask; + String work_nr; + String typename; + String closeTime; + String gongshi; + String jbgs;//Ӱ๤ʱ + String bzgs;//׼ʱ + // String temp; + + String originalDepartmenName="";//ڴ洢ʱϢIJ + + String p_manager; + String departmentName = "";//ڴ洢ŶӦIJ + try { + flowno = set.getString("flowno"); + } catch (Exception e) { + flowno = " "; + e.printStackTrace(); + } + if (flowno == null || flowno.trim().equals("")) { + flowno = " "; + } + try { + gh = set.getString("gh"); + } catch (Exception e) { + gh = " "; + e.printStackTrace(); + } + if (gh == null || gh.trim().equals("")) { + gh = " "; + } + // + try { + originalDepartmenName = set.getString("deptname"); + } catch (Exception e) { + originalDepartmenName = " "; + e.printStackTrace(); + } + if (originalDepartmenName == null || originalDepartmenName.trim().equals("")) { + originalDepartmenName = " "; + } + // TODO ѹźӦ + try { + searchQuestion2 = SqlUtil.getSelectSql_1("view_TC_humres", "workcode", gh); + // System.out.println(searchQuestion2); + set2 = SqlUtil.read(searchQuestion2); + if (set2.next()) { + lastname = set2.getString("lastname"); + departmentName = set2.getString("departmentname").equals("") ? "" + : set2.getString("departmentname"); + } + // System.out.println(lastname); + // int a=1; + // if(a==1){ + // return; + // } + } catch (Exception e1) { + e1.printStackTrace(); + } + try { + sdate = set.getString("sdate"); + } catch (Exception e) { + sdate = " "; + e.printStackTrace(); + } + if (sdate == null || sdate.trim().equals("")) { + sdate = " "; + } + try { + edate = set.getString("edate"); + } catch (Exception e) { + edate = " "; + e.printStackTrace(); + } + if (edate == null || edate.trim().equals("")) { + edate = " "; + } + try { + p_num = set.getString("p_num"); + } catch (Exception e) { + p_num = " "; + e.printStackTrace(); + } + if (p_num == null || p_num.trim().equals("")) { + p_num = " "; + } + try { + xmmc = set.getString("xmname");//2017.9.27 + } catch (Exception e) { + xmmc = " "; + e.printStackTrace(); + } + if (xmmc == null || xmmc.trim().equals("")) { + xmmc = " "; + } + try { + p_manager = set.getInt("p_manager")+"";//2017.9.27 + } catch (Exception e) { + p_manager = " "; + // System.out.println("p_manager-------------->"+p_manager+"end"); + e.printStackTrace(); + } + try { + ifxm = set.getString("ifxm"); + if (ifxm == null) { + ifxm = ""; + } else if (ifxm.equals("0")) { + ifxm = ""; + } else if (ifxm.equals("1")) { + ifxm = ""; + } + + } catch (Exception e) { + ifxm = " "; + e.printStackTrace(); + } + //ʱ + try { + typename = set.getString("typename");// TODO Underlying input stream returned zero bytes + } catch (Exception e) { + typename = " "; + System.out.println("num--------------------------->" + num); + e.printStackTrace(); + } + if (typename == null || typename.equals("") || typename.trim().equals("")) { + typename = " "; + } + try { + work_nr = set.getString("work_nr");// TODO Underlying input stream returned zero bytes + } catch (Exception e) { + work_nr = " "; + System.out.println("num--------------------------->" + num); + e.printStackTrace(); + } + if (work_nr == null || work_nr.equals("") || work_nr.trim().equals("")) { + work_nr = " "; + } + try { + gongshi = set.getString("gongshi"); + // gongshi =String.valueOf(set.getDouble("gongshi")); + } catch (Exception e) { + gongshi = " "; + e.printStackTrace(); + } + if (gongshi == null || gongshi.trim().equals("")) { + gongshi = " "; + } + //Ӱ๤ʱͱ׼ʱ + try { + jbgs = set.getString("jbgs");// TODO ˴޸ + } catch (Exception e) { + jbgs = " "; + System.out.println("num--------------------------->" + num); + e.printStackTrace(); + } + try { + bzgs = set.getString("bzgs");// TODO ˴޸ + } catch (Exception e) { + bzgs = " "; + System.out.println("num--------------------------->" + num); + e.printStackTrace(); + } + if (bzgs == null || bzgs.equals("") || bzgs.trim().equals("")) { + bzgs = " "; + } + if (jbgs == null || jbgs.equals("") || jbgs.trim().equals("")) { + jbgs = " "; + } + try { + schedduleTask = set.getString("SchedualTask"); + } catch (Exception e) { + schedduleTask = " "; + e.printStackTrace(); + } + if (schedduleTask == null || schedduleTask.trim().equals("")) { + schedduleTask = " "; + } +// //ʱʱ䣨Ԥ +// try { +// closeTime = set.getString("closeTime");// TODO ˴޸ +// } catch (Exception e) { +// closeTime = " "; +// System.out.println("num--------------------------->" + num); +// e.printStackTrace(); +// } +// if (closeTime == null || closeTime.equals("") || closeTime.trim().equals("")) { +// closeTime = " "; +// } + + + // TODO ĿźӦ + try { + if (p_manager == null || p_manager.trim().equals("")) { + p_manager = " "; + } else { + + int number = Integer.valueOf(p_manager); + + searchQuestion2 = SqlUtil.getSelectSql_id("view_TC_humres", "id", number); + set2 = SqlUtil.read(searchQuestion2); + if (set2.next()) { + p_manager = set2.getString("lastname"); + } + // System.out.println(p_manager); + } + // int a=1; + // if(a==1){ + // return; + // } + } catch (Exception e1) { + e1.printStackTrace(); + } + // bean.setDepartment(flowno);//TODO Ŵ + bean.setWorkNumber(gh);// + bean.setName(lastname);// + // System.out.println(bean.getWorkNumber()); + bean.setStartTime(sdate);// ʼʱ + bean.setEndTime(edate);// ʱ + bean.setProjectNumber(p_num);// Ŀ + bean.setProjectName(xmmc);// Ŀ + bean.setDoResearch(ifxm);// Ƿз + bean.setSchedualTask(schedduleTask);// TODO ʱ + bean.setJobContent(work_nr);// + bean.setHours(gongshi);// ʱ + bean.setTypename(typename);//ʱ +// bean.setCloseTime(closeTime);//ʱرʱ + bean.setBzgs(bzgs); + bean.setJbgs(jbgs); + + //֯ϢʱԱţ֯ ҪΪ nullӦԣ + + groupBean.setGroupName(originalDepartmenName); + if(!group.contains(originalDepartmenName)) { + group.add(originalDepartmenName); + } + groupBean.setWorkcode(gh); + + if(gongshi.trim().equals("")) { + groupBean.setHours(0);// ʱ + }else { + + groupBean.setHours(Double.valueOf(gongshi));// ʱ + } + + String smonth = null; + try { + smonth = sdate.split("-")[0] + "-" + sdate.split("-")[1];// TODO д ±Խ + } catch (Exception e) { + sdate = " "; + // e.printStackTrace(); + } + // System.out.println(sdate); + bean.setMonth(smonth);// ·(ʼʱ·) + // System.out.println(p_manager); + // int a=1; + // if(a==1){ + // return; + // } + bean.setProjectManager(p_manager);// Ŀ + bean.setDepartment(departmentName); + this.valueLists.add(bean); + this.groupList.add(groupBean); +// if (!sdate.trim().equals("") && !edate.trim().equals("")) { +// // jkhkjhjk +// long sdateLong = getDate(sdate); +// long edateLong = getDate(edate); +// if (sdateLong >= startLong && edateLong <= endLong) { +// this.valueLists.add(bean); +// this.groupList.add(groupBean); +// } +// +// } + } + } catch (Exception e) { + System.out.println("ѯ"); + e.printStackTrace(); + } + + // for(int i=0;i" + row); + // int a = 1; + // if (a == 1) { + // this.wait.setBool(true); + // this.wait.interrupt(); + // return; + // } + fis = new FileInputStream(fmsFile); + workBook = new XSSFWorkbook(fis); + XSSFSheet sheet = workBook.getSheet("ʱԴ"); + XSSFCellStyle sty = sheet.getRow(0).getCell(0).getCellStyle(); + XSSFCellStyle sty2 = workBook.createCellStyle(); +// sty2.setDataFormat(XSSFDataFormat); + for (int i = 0; i < row; i++) { + XSSFRow r = sheet.createRow(i + 1); + for (int j = 0; j < 18; j++) { + XSSFCell ce = r.createCell(j); + ce.setCellStyle(sty); + } + r.getCell(0).setCellValue((i + 1) + "");// + r.getCell(1).setCellValue(valueLists.get(i).getWorkNumber());// + r.getCell(2).setCellValue(valueLists.get(i).getName());// + r.getCell(3).setCellValue(valueLists.get(i).getDepartment());// + r.getCell(4).setCellValue(valueLists.get(i).getProjectNumber());// Ŀ + r.getCell(5).setCellValue(valueLists.get(i).getProjectName());// Ŀ + r.getCell(6).setCellValue(valueLists.get(i).getDoResearch());// Ƿз + r.getCell(7).setCellValue(valueLists.get(i).getProjectManager());// Ŀ + r.getCell(8).setCellValue(valueLists.get(i).getJobContent());// + r.getCell(9).setCellValue(valueLists.get(i).getStartTime());// ʼʱ + r.getCell(10).setCellValue(valueLists.get(i).getEndTime());// ʱ + r.getCell(11).setCellValue(valueLists.get(i).getMonth());// · + r.getCell(12).setCellType(Cell.CELL_TYPE_NUMERIC); + r.getCell(12).setCellValue(Double.valueOf(valueLists.get(i).getHours()));// ʱ + r.getCell(13).setCellValue(valueLists.get(i).getSchedualTask());// ʱ + r.getCell(14).setCellValue(valueLists.get(i).getTypename());// ʱ + r.getCell(15).setCellValue(valueLists.get(i).getCloseTime());// رչʱʱ + r.getCell(16).setCellValue(valueLists.get(i).getBzgs());// ׼ʱ + r.getCell(17).setCellValue(valueLists.get(i).getJbgs());// Ӱ๤ʱ + } + + +// //Ԥ̨ +// int day=(int) ((endLong-startLong)/864000000); +// int holiday=0; +// for (int i = 0; i < day; i++) { +// String startDateString=longToString(startLong+86400000*i); +// if(getWeekDay(startDateString)) { +// holiday++; +// } +// } +// System.out.println("holiday---------------->"+holiday); + //Ԥ̨ + //TODO ҪеIJżӵһ + for (int i = 0; i < group.size(); i++) { + String groupname=group.get(i); + totalPeople=0; + totalhour=0; + GroupBean bean=new GroupBean(); + groupMemger = new ArrayList<>(); + for (int j = 0; j < groupList.size(); j++) { + + if(groupname.equals(groupList.get(j).getGroupName())) { + if(!groupMemger.contains(groupList.get(j).getWorkcode())) { + groupMemger.add(groupList.get(j).getWorkcode()); + totalPeople++; + } + System.out.println("totalPeople---------------->"+totalPeople); + totalhour=totalhour+groupList.get(j).getHours(); + } + + } + totalPeople=groupMemger.size(); + System.out.println("groupMemger.size()-------->"+groupMemger.size()); + bean.setHours(totalhour); + bean.setGroupPeople(totalPeople); + map.put(groupname, bean); + //map + + } + + //TODO 㲿 + //TODO 㲿ܹʱ(һŵһmapУmap<ƣbean(ܹʱ)>) + XSSFSheet sheet1 = workBook.getSheet("Ԥ̨"); + XSSFCellStyle sty1 = workBook.createCellStyle(); +// XSSFCellStyle sty2 = sheet1.getRow(0).getCell(0).getCellStyle(); + sty1.setFillPattern(XSSFCellStyle.SOLID_FOREGROUND); +// sty1.set +// sty1.setFillBackgroundColor(new XSSFColor(Color.RED));//ȫ + sty1.setFillForegroundColor(new XSSFColor(Color.RED));// +// sty1.setFillBackgroundColor(new XSSFColor(Color.GREEN));// + +// sty2.setFillBackgroundColor(new XSSFColor(Color.WHITE)); +// sty2.setFillForegroundColor(new XSSFColor(Color.RED)); + int rowNumber=1; + for (String groupName : map.keySet()) { + XSSFRow r = sheet1.createRow(rowNumber); + for (int j = 0; j < 9; j++) { + XSSFCell ce = r.createCell(j); +// ce.setCellStyle(sty1); + } + r.getCell(0).setCellValue(groupName);// + GroupBean bean=map.get(groupName); + r.getCell(1).setCellValue(bean.getGroupPeople());// + r.getCell(2).setCellValue(day);// + r.getCell(3).setCellValue(holiday);// Ϣ + r.getCell(4).setCellValue(day-holiday);// + r.getCell(5).setCellValue((day-holiday)*8*bean.getGroupPeople());// ܹʱ + r.getCell(6).setCellValue(bean.getHours());// ʵɹʱ + if(bean.getGroupPeople()==0) { + r.getCell(7).setCellValue(0);// + }else { + DecimalFormat dcmFmt = new DecimalFormat("0.00"); + double db = bean.getHours()/((day-holiday)*8*bean.getGroupPeople())*100; + r.getCell(7).setCellValue(dcmFmt.format(db));// λС + } + if(bean.getHours()/((day-holiday)*8*bean.getGroupPeople())>=1||bean.getGroupPeople()==0) { + r.getCell(8).setCellValue("");// Ԥ +// r.getCell(8).setCellStyle(sty2); + }else { + r.getCell(8).setCellValue("");// Ԥ + r.getCell(0).setCellStyle(sty1); + r.getCell(1).setCellStyle(sty1); + r.getCell(2).setCellStyle(sty1); + r.getCell(3).setCellStyle(sty1); + r.getCell(4).setCellStyle(sty1); + r.getCell(5).setCellStyle(sty1); + r.getCell(6).setCellStyle(sty1); + r.getCell(7).setCellStyle(sty1); + r.getCell(8).setCellStyle(sty1); + } + rowNumber++; + + } +// for (int i = 0; i < row; i++) { +// XSSFRow r = sheet1.createRow(i + 1); +// for (int j = 0; j < 9; j++) { +// XSSFCell ce = r.createCell(j); +// ce.setCellStyle(sty); +// } +// r.getCell(0).setCellValue((i + 1) + "");// +// r.getCell(1).setCellValue(valueLists.get(i).getWorkNumber());// +// r.getCell(2).setCellValue(valueLists.get(i).getName());// +// r.getCell(3).setCellValue(valueLists.get(i).getDepartment());// +// r.getCell(4).setCellValue(valueLists.get(i).getProjectNumber());// Ŀ +// r.getCell(5).setCellValue(valueLists.get(i).getProjectName());// Ŀ +// r.getCell(6).setCellValue(valueLists.get(i).getDoResearch());// Ƿз +// r.getCell(7).setCellValue(valueLists.get(i).getProjectManager());// Ŀ +// r.getCell(8).setCellValue(valueLists.get(i).getJobContent());// +// r.getCell(9).setCellValue(valueLists.get(i).getStartTime());// ʼʱ +// r.getCell(10).setCellValue(valueLists.get(i).getEndTime());// ʱ +// r.getCell(11).setCellValue(valueLists.get(i).getMonth());// · +// r.getCell(12).setCellValue(valueLists.get(i).getHours());// ʱ +// r.getCell(13).setCellValue(valueLists.get(i).getSchedualTask());// ʱ +// } + + + + + + + File file = null; + if (opType.equals("ʱ")) { + file = new File(exportFile + "\\" + "𿨹ʱ" + ".xlsm"); + } else { + file = new File(exportFile + "\\" + "" + opType + "ʱ" + ".xlsm"); + } + fos = new FileOutputStream(file); + workBook.write(fos); + + + + + + long end = System.currentTimeMillis(); + float time = (end - start) / 1000.00f; + System.out.println("ʱ" + time + ""); + this.wait.setBool(true); + this.wait.interrupt(); + System.out.println("2018.11.3"); + if(total==row){ + MessageBox.post("Ѿ,"+total+""+row+"", "ɹ", MessageBox.INFORMATION); + }else{ + MessageBox.post("Ѿ,"+total+""+row+"", "ʧ", MessageBox.INFORMATION); + } + + if (opType.equals("ʱ")) { + Runtime.getRuntime().exec(new String[] { "cmd.exe", "/c", exportFile + "\\" + "𿨹ʱ" + ".xlsm" });// ɺֱӴ + + } else if (!opType.equals("ʱ")) { + Runtime.getRuntime() + .exec(new String[] { "cmd.exe", "/c", exportFile + "\\" + "" + opType + "ʱ" + ".xlsm" });// ɺֱӴ + + } + + } + + private File getExcle(String ssx) { + File fmsFile = null; + tcPreferenceService = session.getPreferenceService(); + String puid = tcPreferenceService.getStringValue(ssx); + // System.out.println("puid=================>" + puid); + if (puid == null) { + MessageBox.post("ϵԱѡ", "", MessageBox.ERROR); + return null; + } + TCComponentDataset dateset = null; + + try { + dateset = (TCComponentDataset) session.stringToComponent(puid); + } catch (TCException e) { + e.printStackTrace(); + } + if (dateset == null) { + MessageBox.post("δҵݼϵԱѡ", "", MessageBox.ERROR); + return null; + } + try { + TCComponentTcFile[] file = dateset.getTcFiles(); + if (file.length == 0 || file.length != 1) { + MessageBox.post("ݼûõļļ࣬飡", "WARNING", MessageBox.WARNING); + return null; + } else { + fmsFile = file[0].getFmsFile(); + } + } catch (Exception e) { + e.printStackTrace(); + } + return fmsFile; + } + + public long getDate(String dstr) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");// СдmmʾǷ + // String dstr=startField.getText(); + Date date = null; + try { + date = sdf.parse(dstr); + } catch (ParseException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + // ȡ + long longDate = date.getTime(); + return longDate; + } + + public boolean getWeekDay(String day) { + boolean isWeekDay = false; + long time = System.currentTimeMillis(); + time = getDate(day); + Date date = new Date(time); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + + int s = calendar.get(Calendar.DAY_OF_WEEK);// ==Calendar.SATURDAY + if (s == Calendar.SATURDAY || s == Calendar.SUNDAY) { + System.out.println("bingo"); + isWeekDay = true; + } + return isWeekDay; + + } + + // long͵תΪ2017-09-12͵ַ + public String longToString(long longdate) { + String stringDate = ""; + Date date = new Date(longdate); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + stringDate = sdf.format(date); + return stringDate; + + } + +} diff --git a/src/com/connor/jk/plm/report/WorkHoursBean.java b/src/com/connor/jk/plm/report/WorkHoursBean.java new file mode 100644 index 0000000..771e7db --- /dev/null +++ b/src/com/connor/jk/plm/report/WorkHoursBean.java @@ -0,0 +1,129 @@ +package com.connor.jk.plm.report; + +public class WorkHoursBean { + + private String workNumber;// + private String name;// + private String department;// + private String projectNumber;//Ŀ + private String projectName;//Ŀ + private String doResearch;//Ƿз + private String projectManager;//Ŀ + private String jobContent;// + private String startTime;//ʼʱ + private String endTime;//ʱ + private String month;//· + //2017.9.26 ԣʱtypename + private String typename;//ʱ + private String closeTime;//رչʱʱ + //2018.3.21ԣӰ๤ʱ׼ʱ + private String jbgs; + private String bzgs; + + public String getJbgs() { + return jbgs; + } + public void setJbgs(String jbgs) { + this.jbgs = jbgs; + } + public String getBzgs() { + return bzgs; + } + public void setBzgs(String bzgs) { + this.bzgs = bzgs; + } + public String getCloseTime() { + return closeTime; + } + public void setCloseTime(String closeTime) { + this.closeTime = closeTime; + } + public String getTypename() { + return typename; + } + public void setTypename(String typename) { + this.typename = typename; + } + public String getMonth() { + return month; + } + public void setMonth(String month) { + this.month = month; + } + private String hours;//ʱ + private String schedualTask;//ʱ + public String getSchedualTask() { + return schedualTask; + } + public void setSchedualTask(String schedualTask) { + this.schedualTask = schedualTask; + } + public String getWorkNumber() { + return workNumber; + } + public void setWorkNumber(String workNumber) { + this.workNumber = workNumber; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public String getDepartment() { + return department; + } + public void setDepartment(String department) { + this.department = department; + } + public String getProjectNumber() { + return projectNumber; + } + public void setProjectNumber(String projectNumber) { + this.projectNumber = projectNumber; + } + public String getProjectName() { + return projectName; + } + public void setProjectName(String projectName) { + this.projectName = projectName; + } + public String getDoResearch() { + return doResearch; + } + public void setDoResearch(String doResearch) { + this.doResearch = doResearch; + } + public String getProjectManager() { + return projectManager; + } + public void setProjectManager(String projectManager) { + this.projectManager = projectManager; + } + public String getJobContent() { + return jobContent; + } + public void setJobContent(String jobContent) { + this.jobContent = jobContent; + } + public String getStartTime() { + return startTime; + } + public void setStartTime(String startTime) { + this.startTime = startTime; + } + public String getEndTime() { + return endTime; + } + public void setEndTime(String endTime) { + this.endTime = endTime; + } + public String getHours() { + return hours; + } + public void setHours(String hours) { + this.hours = hours; + } + + +} diff --git a/src/com/connor/jk/plm/report/WorkHours_Action.java b/src/com/connor/jk/plm/report/WorkHours_Action.java new file mode 100644 index 0000000..45497ed --- /dev/null +++ b/src/com/connor/jk/plm/report/WorkHours_Action.java @@ -0,0 +1,29 @@ +package com.connor.jk.plm.report; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.common.actions.AbstractAIFAction; + +public class WorkHours_Action extends AbstractAIFAction { +private AbstractAIFApplication app; +String opType; + + public WorkHours_Action(String opType, AbstractAIFApplication app, String String) { + super(app, String); + this.opType=opType; + this.app=app; + } + + + @Override + public void run() { + WorkHour_Dialog dialog=new WorkHour_Dialog(opType,app); + new Thread(dialog).start(); + + } + +} diff --git a/src/com/connor/jk/plm/report/WorkHours_Handler.java b/src/com/connor/jk/plm/report/WorkHours_Handler.java new file mode 100644 index 0000000..9f455b2 --- /dev/null +++ b/src/com/connor/jk/plm/report/WorkHours_Handler.java @@ -0,0 +1,32 @@ +package com.connor.jk.plm.report; + +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.aifrcp.AIFUtility; + +public class WorkHours_Handler extends AbstractHandler { + ; + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + String opType = ""; + try { + opType=arg0.getCommand().getName(); + } catch (NotDefinedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + System.out.println("------------"+opType); +// if(true) { +// return 0; +// } + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + WorkHours_Action action=new WorkHours_Action(opType,app,null); + new Thread(action).start(); + return null; + } + +} diff --git a/src/com/connor/jk/plm/report/database.properties b/src/com/connor/jk/plm/report/database.properties new file mode 100644 index 0000000..9222a25 --- /dev/null +++ b/src/com/connor/jk/plm/report/database.properties @@ -0,0 +1,21 @@ + +#ORACEL_NAME=tc +# +#ORACEL_PASSWORD=Tc123456 +# +##ORACEL_URL=jdbc:oracle:thin:@192.168.1.248:1521:TOPPROD +# +#ORACEL_URL=jdbc:microsoft:sqlserver://10.200.1.33:1433;DatabaseName=ecology +# +#ORACEL_DRIVER=com.microsoft.jdbc.sqlserver.SQLServerDriver + +ORACEL_NAME=tc + +ORACEL_PASSWORD=Tc_1234 + +#ORACEL_URL=jdbc:oracle:thin:@192.168.1.248:1521:TOPPROD + +ORACEL_URL=jdbc:microsoft:sqlserver://10.200.1.66:1433;DatabaseName=ecology +#ORACEL_URL=jdbc:jtds:sqlserver://10.200.1.66:1433;DatabaseName=ecology + +ORACEL_DRIVER=com.microsoft.jdbc.sqlserver.SQLServerDriver \ No newline at end of file diff --git a/src/com/connor/jk/plm/search/ExCPPZGZ_Dialog.java b/src/com/connor/jk/plm/search/ExCPPZGZ_Dialog.java new file mode 100644 index 0000000..019da72 --- /dev/null +++ b/src/com/connor/jk/plm/search/ExCPPZGZ_Dialog.java @@ -0,0 +1,153 @@ +package com.connor.jk.plm.search; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.File; + +import javax.swing.BorderFactory; +import javax.swing.JButton; +import javax.swing.JFileChooser; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; +import javax.swing.border.TitledBorder; +import javax.swing.filechooser.FileSystemView; + +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; + +public class ExCPPZGZ_Dialog extends AbstractAIFDialog { + + private JTextField textField; + private JButton okButton; + private JButton celButton; + private JButton pathButton; + // ļѡ + private JFileChooser jFileChooser; + private InterfaceAIFComponent com; + + private TCSession session; + + public ExCPPZGZ_Dialog(TCSession session,InterfaceAIFComponent com) { + // TODO Auto-generated constructor stub + this.session=session; + this.com=com; + } + + public void run() { + initUI(); + + } + private void initUI() { + // TODO Auto-generated method stub + FileSystemView fsv = FileSystemView.getFileSystemView(); // õϵͳfileview + String deskPath = fsv.getHomeDirectory().getPath(); // ǰû· + + this.setSize(new Dimension(600, 400)); + this.setTitle(""); + this.textField = new JTextField(deskPath); + + jFileChooser = new JFileChooser(); + this.jFileChooser.setCurrentDirectory(new File(deskPath));// ļѡijʼĿ¼Ϊǰû + this.jFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + + this.pathButton = new JButton("..."); + this.okButton = new JButton("ȷ"); + this.celButton = new JButton("ȡ"); + + JPanel midJPanel = new JPanel(new PropertyLayout()); + midJPanel.setBorder(new TitledBorder(BorderFactory + .createLineBorder(Color.WHITE), "ѡ񵼳·")); // ߿ TitleBorder + + midJPanel.add("1.1.left.top", new JLabel("·")); + midJPanel.add("1.2.left.top", this.textField); + midJPanel.add("1.3.left.top", this.pathButton); + JPanel rootJPanel = new JPanel(new FlowLayout()); + rootJPanel.add(this.okButton); + rootJPanel.add(this.celButton); + + pathButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + selectFileButtonEvent(); + } + }); + okButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + if (textField.getText().contains(".")) { + MessageBox.post("ѡļУ", "", MessageBox.WARNING); + } else { + okEvent(); + } + } + }); + celButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + celEvent(); + + } + }); + + this.setLayout(new BorderLayout()); + this.add(midJPanel, BorderLayout.CENTER); + this.add(rootJPanel, BorderLayout.SOUTH); + + this.centerToScreen(); + this.pack(); + this.setVisible(true); + this.showDialog(); + } + + public void celEvent() { + // TODO Auto-generated method stub + this.disposeDialog(); + this.dispose(); + } + + public void selectFileButtonEvent() { + int state = jFileChooser.showOpenDialog(null);// ˾ǴļѡĴ + if (state == 1) { + return; + } else { + File f = jFileChooser.getSelectedFile();// fΪѡ񵽵Ŀ¼ + textField.setText(f.getAbsolutePath()); + } + } + + public void okEvent() { + + this.disposeDialog(); + this.dispose(); + + try { + String path=textField.getText(); + System.out.println("ok"); + + ExCPPZGZ_Operation op=new ExCPPZGZ_Operation(session,com,path); + session.queueOperation(op); + + + + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + +} diff --git a/src/com/connor/jk/plm/search/ExCPPZGZ_Handler.java b/src/com/connor/jk/plm/search/ExCPPZGZ_Handler.java new file mode 100644 index 0000000..5cce384 --- /dev/null +++ b/src/com/connor/jk/plm/search/ExCPPZGZ_Handler.java @@ -0,0 +1,42 @@ +package com.connor.jk.plm.search; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCComponentFolder; +import com.teamcenter.rac.kernel.TCComponentProject; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class ExCPPZGZ_Handler extends AbstractHandler { + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + // TODO Auto-generated method stub + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + TCSession session = (TCSession) app.getSession(); + InterfaceAIFComponent targetComp = app.getTargetComponent(); + if(targetComp==null){ + MessageBox.post("ѡʶļлĿִв!!","",MessageBox.ERROR); + return null; + } + if((targetComp instanceof TCComponentFolder)||(targetComp instanceof TCComponentProject)){ + System.out.println("start"); + ExCPPZGZ_Dialog action=new ExCPPZGZ_Dialog(session,targetComp); + new Thread(action).start(); + + }else{ + MessageBox.post("ѡʶļлĿִв!!","",MessageBox.ERROR); + } + + + + + return null; + } + +} diff --git a/src/com/connor/jk/plm/search/ExCPPZGZ_Operation.java b/src/com/connor/jk/plm/search/ExCPPZGZ_Operation.java new file mode 100644 index 0000000..a3c46eb --- /dev/null +++ b/src/com/connor/jk/plm/search/ExCPPZGZ_Operation.java @@ -0,0 +1,397 @@ +package com.connor.jk.plm.search; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Vector; + +import org.apache.poi.xssf.usermodel.XSSFRow; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + +import com.connor.jk.plm.bom.until.ProgressBarThread; +import com.teamcenter.rac.aif.AbstractAIFOperation; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentDataset; +import com.teamcenter.rac.kernel.TCComponentFolder; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCComponentProject; +import com.teamcenter.rac.kernel.TCComponentProjectSmartFolder; +import com.teamcenter.rac.kernel.TCComponentTcFile; +import com.teamcenter.rac.kernel.TCComponentUser; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class ExCPPZGZ_Operation extends AbstractAIFOperation { + + private TCSession session; + private String[] types; + private ProgressBarThread wait; + private TCComponent[] foldcoms; + private String cppz = "JK8CPPZGLJH";// Ʒùƻ + private String path; + private Vector vetbean; + private ItemBean bean; + private File fmsFile; + private XSSFSheet sheet; + private XSSFWorkbook workBook; + private FileInputStream fis; + private FileOutputStream fos; + private String excelPath; + private Vector tcVct=new Vector(); + private InterfaceAIFComponent targetComp; + private TCProperty obj; + private TCComponent[] compS; + + // JK8AssiblyDraw JK8PartDraw_CAD JK8Material + // ṹ3Dͼ + // ṹ2Dͼ + // װͼֽ + // ṹǩͼֽ + // B.O.M + // װͼ + + public ExCPPZGZ_Operation(TCSession session, InterfaceAIFComponent targetComp, + String path) { + // TODO Auto-generated constructor stub + this.session = session; + this.targetComp = targetComp; + this.path = path; + } + + @Override + public void executeOperation() throws Exception { + // TODO Auto-generated method stub + wait = new ProgressBarThread("", "ڵݣԵ..."); + wait.start();// + if(targetComp instanceof TCComponentFolder){ + foldcoms = ((TCComponentFolder)targetComp).getReferenceListProperty("contents"); + for(TCComponent com:foldcoms){ + tcVct.add(com); + } + + } + if(targetComp instanceof TCComponentProject){ + obj = ((TCComponentProject)targetComp).getTCProperty("project_data");// ȡĿµļ + compS = obj.getReferenceValueArray();// Զɶ + + for (int i = 0; i < compS.length; i++) { + TCComponentProjectSmartFolder SmartFolder = (TCComponentProjectSmartFolder) compS[i]; + getMsg(SmartFolder); + } + } + + + TCPreferenceService pref = session.getPreferenceService(); + types = pref.getStringValues("JK_CPPZGL_TYPE");// ѡ + if (types != null && types.length > 0) { +// for(String s:types){ +// System.out.println(s); +// } +// + } else { + MessageBox.post("ѡJK_CPPZGL_TYPEڻô,ϵԱ!!!", "", + MessageBox.ERROR); + return; + } + + if (tcVct != null && tcVct.size() > 0) { + TCComponent cppzcom = null; + int cppzcould = 0; + for (TCComponent fcom : tcVct) { + if (cppz.equals(fcom.getType())) { + cppzcould++; + cppzcom = fcom; + } + } + if (cppzcould > 1) { + wait.setBool(true);// رս + wait.interrupt(); + MessageBox + .post("ļ´ڶƷùƻ!!!", "", MessageBox.ERROR); + return; + } else if (cppzcould <= 0) { + wait.setBool(true);// رս + wait.interrupt(); + MessageBox.post("ļȱٲƷùƻ!!!", "", MessageBox.ERROR); + return; + } else { + try { + TCComponentItemRevision revnew = getNewRelRev((TCComponentItem) cppzcom); + if (revnew != null) { + TCComponent[] dats = revnew + .getReferenceListProperty("IMAN_specification"); + if (dats == null || dats.length != 1) { + wait.setBool(true);// رս + wait.interrupt(); + MessageBox.post("ȷƷùƻ·汾ݼΪһ!!", + "", MessageBox.ERROR); + return; + } + TCComponentDataset dataset = (TCComponentDataset) dats[0]; + + if (dataset != null) { + TCComponentTcFile[] file = dataset.getTcFiles(); + if (file.length == 0 || file.length != 1) { + wait.setBool(true);// رս + wait.interrupt(); + MessageBox.post("ݼûõļļ࣬飡", + "WARNING", MessageBox.WARNING); + + return; + } else { + fmsFile = file[0].getFmsFile(); + + } + getBean(); + if (vetbean != null && vetbean.size() > 0) { + writeExcel(); + } else { + wait.setBool(true);// رս + wait.interrupt(); + MessageBox.post("ʶļ²ڷϵĶ!!!", "", + MessageBox.ERROR); + return; + } + + } + }else{ + wait.setBool(true);// رս + wait.interrupt(); + MessageBox.post("Ʒùƻȱٷ汾!!!", "", MessageBox.ERROR); + return; + } + + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + wait.setBool(true);// رս + wait.interrupt(); + MessageBox.post("ʧ:" + e.getMessage(), "", + MessageBox.ERROR); + return; + } + + } + + } else { + MessageBox.post("ѡļûж򷢲汾!!!", "", MessageBox.ERROR); + } + + wait.setBool(true);// رս + wait.interrupt(); + + } + + // ļ¶ + private void getBean() { + // TODO Auto-generated method stub + vetbean = new Vector(); + try { + for (TCComponent com : tcVct) { + + String itemType = com.getType(); + String itemid = com.getTCProperty("item_id").getStringValue(); + if(!(com instanceof TCComponentItem)){ + continue; + } + TCComponentItemRevision revnew = getNewRelRev((TCComponentItem) com); + String revid = ""; + if (revnew != null) { + revid = revnew.getTCProperty("item_revision_id") + .getStringValue(); + } else { + continue; + } + String itemName = com.getTCProperty("object_name") + .getStringValue(); + bean = new ItemBean(); + bean.setItemid(itemid + "/" + revid); + bean.setProjid(com.getTCProperty("project_ids") == null ? "" + : com.getTCProperty("project_ids").getStringValue()); + String user = ((TCComponentUser) com + .getReferenceProperty("owning_user")).getProperty("user_name"); + bean.setUser(user); + if (types != null && types.length > 0) { + if (itemType.equals("JK8AssiblyDraw")) { + bean.setName("װͼ"); + vetbean.add(bean); + } else if (itemType.equals("JK8PartDraw") + || itemType.equals("JK8PartDraw_CAD")) { + bean.setName("ͼ"); + vetbean.add(bean); + } else if (itemType.equals("JK8Material")) { + if (itemid.startsWith("8")) { + bean.setName("BOM"); + vetbean.add(bean); + } else if (itemid.startsWith("7")) { + bean.setName("ӲBOM"); + vetbean.add(bean); + } + } else { + for (String t : types) { + if (itemType.equals(t)) { + bean.setName(itemName); + vetbean.add(bean); + } + + } + } + + } + + } + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + MessageBox.post("ʧ:" + e.getMessage(), "", MessageBox.ERROR); + } + + } + + // дexcel + private void writeExcel() { + // TODO Auto-generated method stub + try { + fis = new FileInputStream(fmsFile); + workBook = new XSSFWorkbook(fis); + if (workBook != null) { + + sheet = workBook.getSheetAt(0); + int rowNum = sheet.getLastRowNum(); + if (rowNum > 3) { + for (int i = 3; i < rowNum; i++) { + + XSSFRow row = sheet.getRow(i); + if (row != null) { + + String jfjName = row.getCell(3) != null ? row + .getCell(3).getStringCellValue() : ""; + if (jfjName == null || jfjName.equals("")) { + continue; + } + boolean is = false; + String itemid = ""; + String proid = ""; + String user = ""; + for (ItemBean bean : vetbean) { + if (jfjName.trim().equals(bean.getName())) { + is = true; + if (itemid.equals("")) { + itemid = itemid + bean.getItemid(); + proid = proid + bean.getProjid(); + user = user + bean.getUser(); + } else { + itemid = itemid + "|" + + bean.getItemid(); + proid = proid + "|" + bean.getProjid(); + user = user + "|" + bean.getUser(); + } + } + } + if (is) { + row.getCell(2).setCellValue(itemid); + row.getCell(6).setCellValue(proid); + row.getCell(8).setCellValue(user); + } + + } + + } + + } + + SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");// ڸʽ + String time = df.format(new Date()); + excelPath = path + File.separator + "Ʒùƻ" + time + ".xlsx"; + File fileout = new File(excelPath); + fos = new FileOutputStream(fileout); + workBook.write(fos); + MessageBox.post("ɹ","ɹ", MessageBox.INFORMATION); + + + } + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + wait.setBool(true);// رս + wait.interrupt(); + MessageBox.post("ɱʧ," + e.getMessage(), "", MessageBox.ERROR); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + wait.setBool(true);// رս + wait.interrupt(); + MessageBox.post("ɱʧ" + e.getMessage(), "", MessageBox.ERROR); + } + } + + // ·汾 + public TCComponentItemRevision getNewRelRev(TCComponentItem com) { + TCComponentItemRevision revnew = null; + int revid = 0; + try { + + TCComponentItemRevision[] revs; + + revs = com.getReleasedItemRevisions(); + + if (revs == null || revs.length < 1) { + + return null; + } + for (TCComponentItemRevision rev : revs) { + if (revnew == null) { + revnew = rev; + String id = rev.getTCProperty("item_revision_id") + .getStringValue(); + revid = Integer.parseInt(id); + } else { + String id = rev.getTCProperty("item_revision_id") + .getStringValue(); + int i = Integer.parseInt(id); + if (revid < i) { + revnew = rev; + } + } + + } + + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return revnew; + } + + + public void getMsg(TCComponentProjectSmartFolder SmartFolder) throws TCException { + // TODO ҪжĵǷѾ + try { + TCProperty obj2 = SmartFolder.getTCProperty("project_data");// TODO + // ȡĵ + TCComponent[] compS2 = obj2.getReferenceValueArray();// + for (int j = 0; j < compS2.length; j++) { + if (compS2[j] instanceof TCComponentProjectSmartFolder) { + getMsg((TCComponentProjectSmartFolder) compS2[j]); + } else{ + tcVct.add(compS2[j]); + } + + } + } catch (Exception e) { + e.printStackTrace(); + } + + } + +} diff --git a/src/com/connor/jk/plm/search/ItemBean.java b/src/com/connor/jk/plm/search/ItemBean.java new file mode 100644 index 0000000..ff0522b --- /dev/null +++ b/src/com/connor/jk/plm/search/ItemBean.java @@ -0,0 +1,41 @@ +package com.connor.jk.plm.search; + +public class ItemBean { + private String no; + private String name; + private String itemid; + private String projid; + private String user; + public String getNo() { + return no; + } + public void setNo(String no) { + this.no = no; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public String getItemid() { + return itemid; + } + public void setItemid(String itemid) { + this.itemid = itemid; + } + public String getProjid() { + return projid; + } + public void setProjid(String projid) { + this.projid = projid; + } + public String getUser() { + return user; + } + public void setUser(String user) { + this.user = user; + } + + +} diff --git a/src/com/connor/jk/plm/search/SearchSBH_Handler.java b/src/com/connor/jk/plm/search/SearchSBH_Handler.java new file mode 100644 index 0000000..386bc7f --- /dev/null +++ b/src/com/connor/jk/plm/search/SearchSBH_Handler.java @@ -0,0 +1,45 @@ +package com.connor.jk.plm.search; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.connor.jk.plm.exportForm.ExportHZB_Dialog; +import com.connor.jk.plm.xmkb.ExportXMKB_Operation; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCComponentBOMLine; +import com.teamcenter.rac.kernel.TCComponentFolder; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class SearchSBH_Handler extends AbstractHandler { + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + // TODO Auto-generated method stub + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + TCSession session = (TCSession) app.getSession(); + InterfaceAIFComponent targetComp = app.getTargetComponent(); + if(targetComp==null){ + MessageBox.post("ѡʶļִв!!","",MessageBox.ERROR); + return null; + } + if(targetComp instanceof TCComponentFolder){ + System.out.println("start"); + SearchSBH_Operation op=new SearchSBH_Operation(session,(TCComponentFolder)targetComp); + session.queueOperation(op); + + }else{ + MessageBox.post("ѡʶļִв!!","",MessageBox.ERROR); + } + + + + + return null; + } + +} diff --git a/src/com/connor/jk/plm/search/SearchSBH_Operation.java b/src/com/connor/jk/plm/search/SearchSBH_Operation.java new file mode 100644 index 0000000..d7c1770 --- /dev/null +++ b/src/com/connor/jk/plm/search/SearchSBH_Operation.java @@ -0,0 +1,131 @@ +package com.connor.jk.plm.search; + +import com.connor.jk.plm.bom.until.ProgressBarThread; +import com.teamcenter.rac.aif.AbstractAIFOperation; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentFolder; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class SearchSBH_Operation extends AbstractAIFOperation { + + private TCSession session; + private TCComponentFolder fold; + private String sbhid; + private String[] types; + private ProgressBarThread wait; + private TCComponent[] foldcoms; + private int cou=0; + + public SearchSBH_Operation(TCSession session, TCComponentFolder fold) { + // TODO Auto-generated constructor stub + this.session = session; + this.fold = fold; + + } + + @Override + public void executeOperation() throws Exception { + // TODO Auto-generated method stub + try { + sbhid = fold.getTCProperty("object_name").getDisplayValue(); + System.out.println("sbhid=" + sbhid); + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + MessageBox.post("ʧ:" + e.getMessage(), "", MessageBox.ERROR); + } + foldcoms = fold.getReferenceListProperty("contents"); + TCPreferenceService pref = session.getPreferenceService(); + types = pref.getStringValues("JK_CPPZGL_TYPE");// ѡ + if (types != null && types.length > 0) { + + if (sbhid != null && !sbhid.equals("")) { + wait = new ProgressBarThread("ѯ", "ڲѯݣԵ..."); + wait.start();// + try { + + TCComponent[] coms1 = session.search("ĵѯ", + new String[] { "Ʒʶ" }, new String[] { sbhid }); + TCComponent[] coms2 = session.search("ͼѯ", + new String[] { "Ʒʶ" }, new String[] { sbhid }); + TCComponent[] coms3 = session.search("װͼѯ", + new String[] { "Ʒʶ" }, new String[] { sbhid }); + TCComponent[] coms4 = session.search("U8", + new String[] { "Ʒʶ" }, new String[] { sbhid }); + + addfold(coms1); + addfold(coms2); + addfold(coms3); + addfold(coms4); + + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + wait.setBool(true);// رս + wait.interrupt(); + MessageBox + .post("ѯʧ" + e.getMessage(), "", MessageBox.ERROR); + return; + } + wait.setBool(true);// رս + wait.interrupt(); + if(cou>0){ + MessageBox.post("ѯʶ"+sbhid+","+cou+"ѡļ,鿴", "", + MessageBox.INFORMATION); + }else{ + MessageBox.post("ѯʶ"+sbhid+",û¶", "", + MessageBox.INFORMATION); + } + + } else { + MessageBox.post("ļƲΪ!!!", "", MessageBox.ERROR); + } + + } else { + MessageBox.post("ѡJK_CPPZGL_TYPEڻô,ϵԱ!!!", "", + MessageBox.ERROR); + } + + + + } + + public void addfold(TCComponent[] coms) { + if (coms != null && coms.length > 0) { + for (TCComponent com : coms) { + String type = com.getType(); + System.out.println("type=" + type); + for (int i = 0; i < types.length; i++) { + if (types[i].equals(type)) { + try { + if (foldcoms != null && foldcoms.length > 0) { + boolean is=true; + for (TCComponent fcom : foldcoms) { + if(fcom.getUid().equals(com.getUid())){ + is=false; + break; + } + } + if(is){ + fold.add("contents", com); + cou++; + } + } else { + fold.add("contents", com); + cou++; + } + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + break; + } + } + } + } + } + +} diff --git a/src/com/connor/jk/plm/sendToClassification/ClassProperty.java b/src/com/connor/jk/plm/sendToClassification/ClassProperty.java new file mode 100644 index 0000000..9b96b83 --- /dev/null +++ b/src/com/connor/jk/plm/sendToClassification/ClassProperty.java @@ -0,0 +1,42 @@ +package com.connor.jk.plm.sendToClassification; + +/** + * @copyRight 㽭տƼ޹˾ + * @author E-mail:hub@connor.net.cn + * @date ʱ䣺2017-7-3 11:47:03 + * @version v1.0 + * @parameter + * @since + * @return + */ + +public class ClassProperty { + private int propertyID; + private String value; + + public ClassProperty() { + + } + + public ClassProperty(int propertyID, String value) { + this.propertyID = propertyID; + this.value = value; + } + + public int getPropertyID() { + return propertyID; + } + + public void setPropertyID(int propertyID) { + this.propertyID = propertyID; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + +} diff --git a/src/com/connor/jk/plm/sendToClassification/SendToClassification_Action.java b/src/com/connor/jk/plm/sendToClassification/SendToClassification_Action.java new file mode 100644 index 0000000..43ca289 --- /dev/null +++ b/src/com/connor/jk/plm/sendToClassification/SendToClassification_Action.java @@ -0,0 +1,265 @@ +/** + * + */ +package com.connor.jk.plm.sendToClassification; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.common.actions.AbstractAIFAction; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCAccessControlService; +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.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.kernel.TCTypeService; +import com.teamcenter.rac.util.MessageBox; + +/** + * @author Administrator + * + */ +public class SendToClassification_Action extends AbstractAIFAction { + private AbstractAIFApplication app; + private InterfaceAIFComponent targetComp; + private TCSession session; + +// private TCProperty[] props; +// private String[] prop = new String[8]; +// private AIFComponentContext aif;// °汾 + + public SendToClassification_Action(AbstractAIFApplication arg0, String arg1) { + super(arg0, arg1); + this.app = arg0; + this.session = (TCSession) app.getSession(); + this.targetComp = app.getTargetComponent(); + + + } + + @Override + public void run() { + if (!targetComp.getType().equals("JK8MaterialRevision")&&!targetComp.getType().equals("JK8LSMaterialRevision")&&!targetComp.getType().equals("JK8EmbSoftwareRevision") + &&!targetComp.getType().equals("TX2FinalProductRevision")&&!targetComp.getType().equals("TX2ComponentRevision")&&!targetComp.getType().equals("TX2SemiProductRevision") + &&!targetComp.getType().equals("TX2RawMaterialRevision")) { + MessageBox.post("ѡJK8MaterialRevisionJK8LSMaterialRevisionJK8EmbSoftwareRevisionTX2FinalProductRevisionTX2ComponentRevisionTX2SemiProductRevisionTX2RawMaterialRevisionִд˲", "", MessageBox.ERROR); + return; + } else if (targetComp.getType().equals("JK8MaterialRevision")||targetComp.getType().equals("JK8LSMaterialRevision")||targetComp.getType().equals("JK8EmbSoftwareRevision") + ||targetComp.getType().equals("TX2FinalProductRevision")||targetComp.getType().equals("TX2ComponentRevision")||targetComp.getType().equals("TX2SemiProductRevision") + ||targetComp.getType().equals("TX2RawMaterialRevision") + ) { +// items_tag + try { + System.out.println(((TCComponentItemRevision)targetComp).getReferenceProperty("owning_group").getUid()); + System.out.println(session.getGroup().getUid()); + //2019.1.28 ͬжȥ + /*if(!((TCComponentItemRevision)targetComp).getReferenceProperty("owning_group").getUid().equals( session.getGroup().getUid())) { + MessageBox.post("ֻ߻ͬ֯ijԱܽд˲", "", MessageBox.INFORMATION); + return; + }*/ + /* ޶߼ + TCComponentUser loginUser = session.getUser(); + String loginUserId = loginUser.getUserId(); + // + TCComponentItemRevision rev = (TCComponentItemRevision)targetComp; + TCComponentUser ownUser = (TCComponentUser)rev.getTCProperty("owning_user").getReferenceValue(); + String ownUserId = ownUser.getUserId(); + if(!(loginUserId.equals(ownUserId))) { + MessageBox.post("߲޶", "", MessageBox.INFORMATION); + return; + }*/ + + if(((TCComponentItemRevision)targetComp).getProperty("release_status_list").equals("") ) { + MessageBox.post("汾δ޶", "", MessageBox.INFORMATION); + return; + } + } catch (TCException e3) { + e3.printStackTrace(); + } + + String class_id="" ; + try { + class_id = ((TCComponent) targetComp).getClassificationClass(); + } catch (TCException e2) { + e2.printStackTrace(); + } + if(class_id==""){ + MessageBox.post((TCComponentItemRevision)targetComp+"δִ࣬д˲", "", MessageBox.ERROR); + return; + } + + TCComponentItemRevision targetItemRevision=((TCComponentItemRevision)targetComp); + TCComponentItem componentItem=null; + try { + componentItem=targetItemRevision.getItem(); + } catch (TCException e1) { + e1.printStackTrace(); + } + TCComponentItemRevision componentItemRevision=null; + //20200330ʶȨޣԶдȨޣͿ· + + TCAccessControlService aclService = session.getTCAccessControlService(); + boolean s=false; + try { + s=aclService.checkUsersPrivilege(session.getUser(), componentItem, "WRITE"); + System.out.println("дȨ"); + } catch (TCException e1) { + e1.printStackTrace(); + } + if(s==true) { + try { + Util.setByPass(true); + } catch (TCException e) { + e.printStackTrace(); + } + }else { + try { + String personName=session.getUser().getProperty("person"); + String itemId=componentItem.getProperty("item_id"); + + MessageBox.post("û"+personName+"Զ"+itemId+"ûдȨޣ޶","",MessageBox.INFORMATION); + } catch (TCException e) { + e.printStackTrace(); + } + return; + } + try { + componentItemRevision=targetItemRevision.saveAs(componentItem.getNewRev()); + //componentItemRevision=targetItemRevision.getItem().revise(componentItem.getNewRev(), targetItemRevision.getTCProperty("object_name").getStringValue(), targetItemRevision.getTCProperty("object_desc").getStringValue()); + } catch (TCException e) { + e.printStackTrace(); + } + if(s==true) { + try { + Util.setByPass(false); + } catch (TCException e) { + e.printStackTrace(); + } + } + + /*//TODO 2017.11.2ͼ + System.out.println("BOM"); + setbom(componentItemRevision,targetItemRevision,targetItemRevision); + + //޶İ汾ֵ + TCComponentForm form=null; + TCComponentForm newform=null; + try { + form=(TCComponentForm) targetItemRevision.getReferenceListProperty("IMAN_master_form_rev")[0]; + newform=(TCComponentForm) componentItemRevision.getReferenceListProperty("IMAN_master_form_rev")[0]; +// String jk8TechModel=form.getTCProperty("jk8SpecModel").getDisplayableValue(); + form.getAllTCProperties(); + try { + newform.setTCProperties(form.getAllTCProperties()); + } catch (Exception e) { + e.printStackTrace(); + } + //2017.11.2 ԣ汾ͬԭ汾һ + newform.getTCProperty("object_name").setStringValue(componentItemRevision.getTCProperty("item_id").getStringValue()+"/"+componentItemRevision.getTCProperty("item_revision_id")); +// System.out.println(jk8TechModel); + } catch (TCException e) { + e.printStackTrace(); + }*/ + SendToClassification_Operation operation = new SendToClassification_Operation(app, componentItemRevision, targetComp, session); + this.session.queueOperation(operation); + + + } + } + public TCComponentBOMLine getTopLineByRev(TCComponentItemRevision rev) {//öbomline + TCComponentBOMLine line = null; + try { + TCTypeService service = session.getTypeService(); + TCComponentBOMWindowType winType = (TCComponentBOMWindowType) service + .getTypeComponent("BOMWindow"); + TCComponentBOMWindow window = winType.create(null); + line = window.setWindowTopLine(rev.getItem(), rev, null, null); + } catch (TCException e) { + e.printStackTrace(); + } + + return line; + } + + /* + private void setbom(TCComponentItemRevision componentItemRevision ,TCComponentItemRevision targetItemRevision ,TCComponentItemRevision rev) {//bom + try { + //BOMLine + TCTypeService service1 = session.getTypeService(); + TCComponentBOMWindowType winType1 = (TCComponentBOMWindowType) service1 + .getTypeComponent("BOMWindow"); + TCComponentBOMWindow view1 = winType1.create(null); + TCComponentBOMLine line1 = view1.setWindowTopLine(componentItemRevision.getItem(), + componentItemRevision, null, null); + //BOMLine + TCTypeService service2 = session.getTypeService(); + TCComponentBOMWindowType winType2 = (TCComponentBOMWindowType) service2 + .getTypeComponent("BOMWindow"); + TCComponentBOMWindow view2 = winType2.create(null); + TCComponentBOMLine line2 = view2.setWindowTopLine(targetItemRevision.getItem(), + targetItemRevision, null, null); + + AIFComponentContext[] lins = line2.getChildren(); + view2.lock(); + view1.lock(); + if (lins == null || lins.length <= 0) { + return; + } + for (AIFComponentContext l : lins) { + TCComponent lt = (TCComponent) l.getComponent(); + //bl_substitute_listԣб + String bl_substitute_list=((TCComponentBOMLine) lt).getProperty("bl_substitute_list"); + System.out.println("bl_substitute_list---->"+bl_substitute_list); + String[] substitute_list=bl_substitute_list.split(","); + System.out.println("bl_substitute_list=========>"+substitute_list.length); + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------1----------"+substitute_list[i]); + } + TCProperty[] tcs = ((TCComponentBOMLine) lt) + .getTCProperties(new String[] { + "bl_quantity","bl_sequence_no", +// "jk8SubstitRatio", "jk8SubstitOrder","jk8EffectiveDate","jk8SubCompLossRate",//治˻ȡ +// "bl_item_uom_tag","jk8TechnicModel","jk8SpecificModel",// + "JK8Remark","JK8SupplyType","JK8Warehouse", + "JK8RemarkDesc","jk8SubCompLossRate" + + });//ֿ⡢Ӧͣbl_substituteȣjk8SubstitRatiojk8SubstitOrderЧڣjk8EffectiveDate + line1.lock(); +// line.remove("", lt); + +// TCComponentItem chitem = ((TCComponentBOMLine) lt).getItem() +// .getLatestItemRevision().saveAsItem(null, null); +// TCComponentItemRevision r = chitem.getLatestItemRevision(); +// TCComponentItemRevision r=((TCComponentBOMLine) lt).getItem().getLatestItemRevision(); + TCComponentItemRevision r=((TCComponentBOMLine) lt).getItemRevision();//BOMLineӦItemRevision + + TCComponentBOMLine childBomLine = line1.add(r.getItem(), r, + null, false, ""); + if(substitute_list.length>0&&!bl_substitute_list.trim().equals("")){ + + for (int i = 0; i < substitute_list.length; i++) { + System.out.println("--------------"+substitute_list[i]+"----------"); + TCComponentItemRevision itemRevision=((TCComponentItem)(session.search(" ID",new String[]{ " ID"}, new String[]{substitute_list[i].trim()})[0])).getLatestItemRevision(); + childBomLine.add(null, itemRevision, null, true); + } + } + childBomLine.setTCProperties(tcs); + + setbom(childBomLine.getItemRevision(),childBomLine.getItemRevision(),r); + line1.save(); + line1.unlock(); + } + view1.save(); + view1.unlock(); + view1.close(); + view2.save(); + view2.unlock(); + view2.close(); + } catch (Exception e) { + e.printStackTrace(); + } + }*/ +} diff --git a/src/com/connor/jk/plm/sendToClassification/SendToClassification_Handler.java b/src/com/connor/jk/plm/sendToClassification/SendToClassification_Handler.java new file mode 100644 index 0000000..b9608a8 --- /dev/null +++ b/src/com/connor/jk/plm/sendToClassification/SendToClassification_Handler.java @@ -0,0 +1,22 @@ +package com.connor.jk.plm.sendToClassification; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.connor.jk.plm.sqb.Generate_Action; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aifrcp.AIFUtility; + +public class SendToClassification_Handler extends AbstractHandler{ + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + // TODO Auto-generated method stub + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + SendToClassification_Action action=new SendToClassification_Action(app,null); + new Thread(action).start(); + return null; + } + +} diff --git a/src/com/connor/jk/plm/sendToClassification/SendToClassification_Operation.java b/src/com/connor/jk/plm/sendToClassification/SendToClassification_Operation.java new file mode 100644 index 0000000..0443c35 --- /dev/null +++ b/src/com/connor/jk/plm/sendToClassification/SendToClassification_Operation.java @@ -0,0 +1,257 @@ +package com.connor.jk.plm.sendToClassification; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.swing.JTextField; + +//import com.connor.jk.plm.tempToFormal.ClassProperty; +//import com.connor.jk.plm.tempToFormal.SoaServerUtil; +import com.teamcenter.rac.aif.AbstractAIFApplication; +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.TCComponentBOMViewRevision; +import com.teamcenter.rac.kernel.TCComponentBOMWindow; +import com.teamcenter.rac.kernel.TCComponentBOMWindowType; +import com.teamcenter.rac.kernel.TCComponentFolder; +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.TCComponentItemType; +import com.teamcenter.rac.kernel.TCComponentUser; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.kernel.TCTypeService; +import com.teamcenter.rac.kernel.TCUserService; +import com.teamcenter.rac.kernel.ics.ICSApplicationObject; +import com.teamcenter.rac.kernel.ics.ICSProperty; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.schemas.soa._2006_03.exceptions.ServiceException; + +public class SendToClassification_Operation extends AbstractAIFOperation { + private AbstractAIFApplication app; + private TCSession session; + private InterfaceAIFComponent targetComp; + private TCComponentItemRevision aif; +// private String[] prop; +// private TCProperty[] props; +// private TCUserService userService; + private TCPreferenceService service; +// private TCComponentItem target; + +// private List childRevList;//봴JListй + + public SendToClassification_Operation(AbstractAIFApplication app2, TCComponentItemRevision componentItemRevision, InterfaceAIFComponent targetComp, + TCSession session2) { + this.app = app2; + this.targetComp = targetComp; + this.aif = componentItemRevision; + this.session = session2; + } + +// private String itemId;// ʽϵID +// private String itemRev;// ʽϵİ汾 +// private String itemName;// ʽϵ +// +// private TCComponentItemRevision itemRevision;// ʽϵİ汾 + + private TCComponentItemRevision rev; +// private TCComponentBOMViewRevision bomViewRevision; +// private AIFComponentContext[] Context2; + String class_id ; + Integer[] keys = null; + String[] vals = null; + String url=""; + + StringBuilder logContent = new StringBuilder(); + + @Override + public void executeOperation() throws Exception { + logContent.append("INFO־ʼ!\n"); + service=session.getPreferenceService(); + url= service.getStringValue("Autocode_SendClassServer_URL"); + // TODO + // 1.ȡѷ°汾ķ + class_id = ((TCComponent) targetComp).getClassificationClass(); + + logContent.append("INFOǰʱ䣺").append(new Date()).append("\n"); + + + + if(class_id==""){ + MessageBox.post((TCComponentItemRevision)targetComp+"δִ࣬д˲", "", MessageBox.ERROR); + logContent.append("INFO="+(TCComponentItemRevision)targetComp+"δִ࣬д˲"+"\n"); + log(); + return; + } + logContent.append("INFOurl="+url+"\n"); + logContent.append("INFOclass_id="+class_id+"\n"); +// else { +// MessageBox.post("ѷ࣡", "", MessageBox.INFORMATION); +// return; +// } +// int a=1; +// target = (TCComponentItem) targetComp; + // TODO ѡ +// service = session.getPreferenceService(); + // String class_id=service.getStringValue(""); + if (((TCComponent) targetComp) instanceof TCComponentItemRevision) { + rev = (TCComponentItemRevision) targetComp; + + +// AIFComponentd + // object_name +// props = rev.getTCProperties(new String[] { "object_name" }); +// itemName = props[0].getStringValue(); +// +// // ID +// props = rev.getTCProperties(new String[] { "item_id" }); +// itemId = props[0].getStringValue().substring(2); + + } + + TCComponentICO[] icoS = rev.getClassificationObjects(); + + int count=0; + int count1=0; + for (int i = 0; i < icoS.length; i++) { + ICSProperty[] cPropS = icoS[i].getICSProperties(true); + for (int j = 0; j < cPropS.length; j++) { + System.out.println(count); + count++; + } + keys=new Integer[count]; + vals = new String[count]; + for (int j = 0; j < cPropS.length; j++) { + System.out.println(count); + keys[count1] = cPropS[j].getId(); + System.out.println("keys["+count1+"]================>"+keys[count1]); + vals[count1] = cPropS[j].getValue(); + System.out.println("vals["+count1+"]================>"+vals[count1]+"oo"); + count1++; + } + icoS[i].setICSProperties(cPropS);//÷Գ + break; + } +// if(a==1){ +// return; +// } + // TODO 2.,°汾͵ + // class_id = "";// TODO дѡ + try { +// createICS(class_id, newrev, newrev.getTCProperty("item_id").getStringValue(), keys, vals); + sendObjToClassficationByWebService(aif); + if(isSuccess==false) { + MessageBox.post("ʧ,ϵϵͳԱ","",MessageBox.INFORMATION); + logContent.append("INFOʧ,ϵϵͳԱ"+"\n"); + log(); + return; + } + } catch (Exception e) { + MessageBox.post("ʧ","",MessageBox.INFORMATION); + e.printStackTrace(); + logContent.append("INFOʧ"+"\n"); + log(); + return; + } +System.out.println("2017.11.2"); + MessageBox.post(""+aif+"ͷɹ", "", MessageBox.INFORMATION); + logContent.append("INFO"+aif+"ͷɹ\n"); + log(); + } + + boolean isSuccess=true; + // ϰ汾͵ + public void createICS(String class_id, TCComponentItemRevision target, String partid, Integer[] integers, + String[] vals) throws TCException { + TCClassificationService myService = session.getClassificationService(); + ICSApplicationObject icsAppObj = myService.newICSApplicationObject("ICM"); + icsAppObj.create(partid, target.getUid()); + icsAppObj.setView(class_id); + ICSProperty icspro[] = new ICSProperty[integers.length]; + + for (int i = 0; i < icspro.length; i++) { + System.out.println(" CLASS ID = " + integers[i] + " =" + vals[i]); + icspro[i] = new ICSProperty(integers[i], vals[i]); + } + icsAppObj.setProperties(icspro); +// icsAppObj.save();TODO ʲôã + } + + + + + //͵ class_id=codeRemarkˮ룿 + public void sendObjToClassficationByWebService(TCComponentItemRevision rev){ + try { + System.out.println("class_id-----dddddd----->"+class_id); + if( !class_id.replace(" ", "").equals("") ){ + + List propList = new ArrayList<>(); + + for(int i = 0; i < keys.length; i++){ + + + if(vals[i]!=null) { + ClassProperty prop = new ClassProperty(keys[i], vals[i]);// + propList.add(prop); + + } + } + String json = SoaServerUtil.objectToJson(propList);//JavaתΪjson + logContent.append("INFOjson="+json+"\n"); + SoaServerUtil.grantWritePrivilege(session, rev);//дȨ + SoaServerUtil.sendToClass(rev.getUid(), class_id, json,url);//͵ + logContent.append("INFOִ˷!\n"); + SoaServerUtil.grantReadPrivilege(session, rev);//Ȩ + } + + } catch (Exception e) { + e.printStackTrace(); + isSuccess=false; +// MessageBox.post("ͷʧܣϵϵͳԱ","",MessageBox.INFORMATION); + return; + + } + + } + + public void log() { + // ļ·ļ + String folderPath = "C:\\classlog"; + String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); + String fileName = "ClassLog_" + timeStamp + ".txt"; + + // ļж + File folder = new File(folderPath); + if (!folder.exists()) { + folder.mkdirs(); // ༶Ŀ¼ + } + + // ļ· + File logFile = new File(folder, fileName); + + // д־ļ + try (BufferedWriter writer = new BufferedWriter(new FileWriter(logFile))) { + writer.write(logContent.toString()); + System.out.println("־ѳɹд뵽ļ" + logFile.getAbsolutePath()); + } catch (IOException e) { + System.err.println("д־ļʱ"); + e.printStackTrace(); + } + } + +} diff --git a/src/com/connor/jk/plm/sendToClassification/SoaServerUtil.java b/src/com/connor/jk/plm/sendToClassification/SoaServerUtil.java new file mode 100644 index 0000000..944d3ac --- /dev/null +++ b/src/com/connor/jk/plm/sendToClassification/SoaServerUtil.java @@ -0,0 +1,227 @@ +package com.connor.jk.plm.sendToClassification; + +import java.util.ArrayList; +import java.util.List; + +import net.sf.json.JSONArray; + +import org.apache.axiom.om.OMAbstractFactory; +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.OMFactory; +import org.apache.axiom.om.OMNamespace; +import org.apache.axis2.AxisFault; +import org.apache.axis2.addressing.EndpointReference; +import org.apache.axis2.client.Options; +import org.apache.axis2.client.ServiceClient; +import org.apache.axis2.transport.http.HTTPConstants; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCAccessControlService; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCComponentUser; +import com.teamcenter.rac.kernel.TCComponentUserType; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.kernel.TCUserService; + +public class SoaServerUtil { + + public static void sendToClass(String wsoPUID, String classID, String json, String url) { + // AbstractAIFApplication app; + // app=AIFUtility.getCurrentApplication(); + // TCSession session; + // session=(TCSession) app.getSession(); + // TCPreferenceService preferenceService; + // preferenceService=session.getPreferenceService(); + // String account=preferenceService.getStringValue("Autocode_PriverUser_ID"); + // String url; + // url = preferenceService.getStringValue("Autocode_SendClassServer_URL"); + try { + ServiceClient sc = new ServiceClient(); + Options opts = new Options(); + // url = "http://10.201.5.203:19090/ErpWebService.asmx?WSDL"; + EndpointReference end = new EndpointReference(url); + opts.setTo(end); + opts.setAction("SendToClass"); + sc.setOptions(opts); + + OMFactory fac = OMAbstractFactory.getOMFactory(); + OMNamespace omNs = fac.createOMNamespace("http://tempuri.org/", ""); + OMElement method = fac.createOMElement("SendToClass", omNs); + OMElement value = fac.createOMElement("wsoPuiid", omNs); + value.setText(wsoPUID); + OMElement value1 = fac.createOMElement("classID", omNs); + value1.setText(classID); + OMElement value2 = fac.createOMElement("JsonContainer", omNs); + // "[{\"value\":\"1\",\"propertyID\":-500003},{\"value\":\"1\",\"propertyID\":-500011}]" + value2.setText(json); + + method.addChild(value); + method.addChild(value1); + method.addChild(value2); + + OMElement res = sc.sendReceive(method); + res.getFirstElement().getText(); + System.out.println(res.getFirstElement().getText()); + } catch (AxisFault e) { + e.printStackTrace(); + } + + } + + // public static void main(String[] args) { + // deleteClass("1111", ""); + // } + // ɾʱ + public static void deleteClass(String icoPUID, String url) { + try { + ServiceClient sc = new ServiceClient(); + Options opts = new Options(); + // url = "http://10.201.5.203:19090/ErpWebService.asmx?WSDL";//TODO + // ѡAutocode_SendClassServer_URL + // url = preferenceService.getStringValue("Autocode_SendClassServer_URL");//TODO + // ѡAutocode_SendClassServer_URL + EndpointReference end = new EndpointReference(url); + opts.setTo(end); + opts.setAction("DeleteClass"); + opts.setProperty(HTTPConstants.CHUNKED, "false"); + sc.setOptions(opts); + + OMFactory fac = OMAbstractFactory.getOMFactory(); + OMNamespace omNs = fac.createOMNamespace("http://tempuri.org/", ""); + OMElement method = fac.createOMElement("DeleteClass", omNs); + OMElement value = fac.createOMElement("icoPuid", omNs); + value.setText(icoPUID); + // OMElement value1 = fac.createOMElement("classID", omNs); + //// value1.setText(classID); + // OMElement value2 = fac.createOMElement("JsonContainer", omNs); + // "[{\"value\":\"1\",\"propertyID\":-500003},{\"value\":\"1\",\"propertyID\":-500011}]" + // value2.setText(json); + + method.addChild(value); + // method.addChild(value1); + // method.addChild(value2); + + OMElement res = sc.sendReceive(method); + res.getFirstElement().getText(); + System.out.println(res.getFirstElement().getText()); + } catch (AxisFault e) { + e.printStackTrace(); + } + + } + + public static String objectToJson(List props) { + String str = null; + try { + JSONArray json = JSONArray.fromObject(props);// javaתΪjson + str = json.toString();// jsonתΪַ + } catch (Exception e) { + e.printStackTrace(); + } + System.out.println("JSON =>" + str); + return str; + } + + public static void grantReadPrivilege(TCSession tcSession, TCComponent tccomponent) { + AbstractAIFApplication app; + app = AIFUtility.getCurrentApplication(); + TCSession session; + session = (TCSession) app.getSession(); + TCPreferenceService preferenceService; + preferenceService = session.getPreferenceService(); + String account = preferenceService.getStringValue("Autocode_PriverUser_ID"); + try { + TCAccessControlService accessControlService = tcSession.getTCAccessControlService(); + TCComponentUserType type = (TCComponentUserType) tcSession.getTypeComponent("User"); + TCComponentUser user = type.find(account); + + if (user == null) { + return; + } + if (tcSession.getUser().equals(user)) { + return; + } + + String[] as2 = new String[] { "READ" }; + + if (tccomponent instanceof TCComponentItemRevision) { + TCComponentItem tempItem = ((TCComponentItemRevision) tccomponent).getItem(); + openByPass(tcSession); + accessControlService.grantPrivilege(tempItem, user, as2); + closeByPass(tcSession); + + openByPass(tcSession); + accessControlService.grantPrivilege(tccomponent, user, as2); + closeByPass(tcSession); + } else { + openByPass(tcSession); + accessControlService.grantPrivilege(tccomponent, user, as2); + closeByPass(tcSession); + } + } catch (TCException e) { + e.printStackTrace(); + } + } + + public static void grantWritePrivilege(TCSession tcSession, TCComponent tccomponent) { + AbstractAIFApplication app; + app = AIFUtility.getCurrentApplication(); + TCSession session; + session = (TCSession) app.getSession(); + TCPreferenceService preferenceService; + preferenceService = session.getPreferenceService(); + String account = preferenceService.getStringValue("Autocode_PriverUser_ID"); + try { + TCAccessControlService accessControlService = tcSession.getTCAccessControlService(); + TCComponentUserType type = (TCComponentUserType) tcSession.getTypeComponent("User"); + + TCComponentUser user = type.find(account); + if (user == null) { + return; + } + if (tcSession.getUser().equals(user)) { + return; + } + + String[] as2 = new String[] { "READ", "WRITE", "DELETE" }; + + if (tccomponent instanceof TCComponentItemRevision) { + TCComponentItem tempItem = ((TCComponentItemRevision) tccomponent).getItem(); + openByPass(tcSession); + accessControlService.grantPrivilege(tempItem, user, as2); + closeByPass(tcSession); + + openByPass(tcSession); + accessControlService.grantPrivilege(tccomponent, user, as2); + closeByPass(tcSession); + } else { + openByPass(tcSession); + accessControlService.grantPrivilege(tccomponent, user, as2); + closeByPass(tcSession); + } + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public static void openByPass(TCSession session) throws TCException { + TCUserService userservice = session.getUserService(); + Object[] obj = new Object[1]; + obj[0] = "origin"; + userservice.call("ORIGIN_set_bypass", obj); + } + + public static void closeByPass(TCSession session) throws TCException { + TCUserService userservice = session.getUserService(); + Object[] obj = new Object[1]; + obj[0] = "origin"; + userservice.call("ORIGIN_close_bypass", obj); + } + +} diff --git a/src/com/connor/jk/plm/sendToClassification/Util.java b/src/com/connor/jk/plm/sendToClassification/Util.java new file mode 100644 index 0000000..7a66a15 --- /dev/null +++ b/src/com/connor/jk/plm/sendToClassification/Util.java @@ -0,0 +1,137 @@ +package com.connor.jk.plm.sendToClassification; +import java.util.List; + +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.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +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.TCUserService; +import com.teamcenter.rac.util.MessageBox; + +public class Util { + public static TCPreferenceService service; + public static TCSession session; + public static TCUserService userservice;; + + static { + if (session == null) { + session = (TCSession) (AIFUtility.getCurrentApplication() + .getSession()); + } + if (service == null) + service = session.getPreferenceService(); + } + + public static void setByPass(boolean val) throws TCException { + if (userservice == null) { + userservice = session.getUserService(); + } + Object[] obj = new Object[1]; + obj[0] = "origin"; + if (val) { + userservice.call("ORIGIN_set_bypass", obj); + } else { + userservice.call("ORIGIN_close_bypass", obj); + } + } + + /** + * bom + * + * @param selectIndex + * @throws TCException + */ + + public static InterfaceAIFComponent[] searchComponentsCollection( + TCSession session, String searchName, String[] keys, String[] values) { + // Ϣ + InterfaceAIFComponent[] result = new InterfaceAIFComponent[0]; + + try { + System.out.println("ʼִ"); + // õѯķ +// TCTextService textService = session.getTextService(); + // ȡquerytype + // ̶дImanQuery + TCComponentQueryType querytype = (TCComponentQueryType) session + .getTypeComponent("ImanQuery"); + // ͨquerytypeҵsearchNameIJѯ + TCComponentQuery query = (TCComponentQuery) querytype + .find(searchName); +// if (query == null) { +// MessageBox.post("ͨѯ" + searchName + "", "", 1); +// return null; +// }else{ +// MessageBox.post("ͨѯҵ" + searchName, "ɹ", 2); +// } + querytype.clearCache(); + String[] as = new String[keys.length]; + for (int i = 0; i < keys.length; i++) { +// as[i] = textService.getTextValue(keys[i]); + as[i] = keys[i]; + System.out.println("ûѯĿas["+i+"]="+as[i]); + } + + String[] as1 = new String[values.length]; + for (int i = 0; i < values.length; i++) { +// as1[i] = textService.getTextValue(values[i]); + as1[i] = values[i]; + System.out.println("ûѯĿӦֵas1["+i+"]="+as1[i]); + } + query.clearCache();//ҵջ + // ͨѯõѯϢ + TCQueryClause[] clauses = query.describe(); + + // ѯϢѯĿǷȷ + for (int i = 0; i < clauses.length; i++) { + // õѯ + clauses[i].getAttributeName();//item_id + // õûĿ + clauses[i].getUserEntryName();//ItemID + // õûػĿ + clauses[i].getUserEntryNameDisplay();// ID + System.out.println(clauses[i].getAttributeName()+"\t"+ + clauses[i].getUserEntryName()+"\t"+ + clauses[i].getUserEntryNameDisplay()); + + } + // ִвѯ +// TCComponentContextList list = query.getExecuteResultsList(as, as1); + TCComponentContextList list = query.getExecuteResultsList(keys, values); + if (list != null) { + // õѯĶ + int count = list.getListCount(); + // صγ + result = new InterfaceAIFComponent[count]; + // ѯĽص鸳ֵ + for (int i = 0; i < count; i++) { + // õѯ +// AIFComponentContext context = list.get(i); + // ͨĵõӦĶ󣬲ֵص + result[i] = list.get(i).getComponent(); + System.out.println("result["+i+"]="+result[i]); + } + } + } catch (TCException e) { + e.printStackTrace(); +// MessageBox.post("ͨѯ" + searchName + "ѯ.", "", 1); + } + + return result; + } + +} \ No newline at end of file diff --git a/src/com/connor/jk/plm/setBomline/AddCommand.java b/src/com/connor/jk/plm/setBomline/AddCommand.java new file mode 100644 index 0000000..6d4d579 --- /dev/null +++ b/src/com/connor/jk/plm/setBomline/AddCommand.java @@ -0,0 +1,48 @@ +/*jadclipse*/// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov. + +package com.connor.jk.plm.setBomline; + +import com.teamcenter.rac.aif.AIFDesktop; +import com.teamcenter.rac.aif.AbstractAIFCommand; +import com.teamcenter.rac.kernel.TCComponentBOMLine; +import com.teamcenter.rac.pse.AbstractPSEApplication; +import com.teamcenter.rac.util.MessageBox; + +public class AddCommand extends AbstractAIFCommand +{ + + public AddCommand(TCComponentBOMLine tccomponentbomline, AbstractPSEApplication abstractpseapplication, Boolean boolean1) + { + initialize(tccomponentbomline, boolean1); + } + + public AddCommand(TCComponentBOMLine tccomponentbomline, Boolean boolean1) + { + initialize(tccomponentbomline, boolean1); + } + + private void initialize(TCComponentBOMLine tccomponentbomline, Boolean boolean1) + { + try + { + System.out.println("AddCommand"); + Runnable runnable =new AddDialog(tccomponentbomline, AIFDesktop.getActiveDesktop(), Boolean.valueOf(boolean1.booleanValue())); + setRunnable(runnable); + } + catch(Exception exception) + { + MessageBox.post(exception); + } + } +} + + +/* + DECOMPILATION REPORT + + Decompiled from: C:\JKTC11\Siemens\Teamcenter\OTW11\rac\plugins\com.teamcenter.rac.tcapps_11000.2.0.jar + Total time: 1070 ms + Jad reported messages/errors: + Exit status: 0 + Caught exceptions: +*/ \ No newline at end of file diff --git a/src/com/connor/jk/plm/setBomline/AddDialog.java b/src/com/connor/jk/plm/setBomline/AddDialog.java new file mode 100644 index 0000000..1aeb710 --- /dev/null +++ b/src/com/connor/jk/plm/setBomline/AddDialog.java @@ -0,0 +1,1001 @@ +package com.connor.jk.plm.setBomline; + +import com.teamcenter.rac.aif.*; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.*; +import com.teamcenter.rac.kernel.bom.BOMMarkupHelper; +import com.teamcenter.rac.pse.common.InterfacePSEValid; +import com.teamcenter.rac.pse.common.PSEItemPanel; +import com.teamcenter.rac.pse.dialogs.AddDialog.ActionOption; +import com.teamcenter.rac.util.*; +import com.teamcenter.services.internal.rac.structuremanagement.BOMMarkupService; +import com.teamcenter.services.internal.rac.structuremanagement.RestructureService; +import com.teamcenter.services.internal.rac.structuremanagement._2007_06.Restructure; +import com.teamcenter.services.internal.rac.structuremanagement._2010_04.BOMMarkup; +import com.teamcenter.services.rac.structuremanagement.StructureService; +import com.teamcenter.services.rac.structuremanagement._2012_09.Structure; +import com.teamcenter.soa.client.model.ErrorStack; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.List; + +import javax.swing.*; + +import org.apache.log4j.Logger; + +public class AddDialog extends AbstractAIFDialog + implements InterfacePSEValid +{ + private static final Logger logger = Logger.getLogger(com.teamcenter.rac.pse.dialogs.AddDialog.class); + private final TCComponentBOMLine target; + private final TCComponentBOMLine[] targets; + private final boolean asSubstituteOnly; + private JButton okButton; + private JButton applyButton; + private JButton clearButton; + private JButton cancelButton; + private iTextField numOccsField; + private iTextField qtyField; + private iTextField seqnoField; + private PSEItemPanel addPanel; + private ActionOption asOption; + private boolean asMarkup; + private final TCComponent[] toPaste; + private final Registry reg = Registry.getRegistry(com.teamcenter.rac.pse.dialogs.AddDialog.class); + private TCSession m_session; + private TCComponentBOMWindow bomWindow; + private static final String PSEAUTOPACKPREF = "PSEAutoPackPref"; + private final boolean packDef; + private JRadioButton subButt; + private JRadioButton newLevelButt; + private String title; + private JPanel jpnew; + + private iTextField tdsxText; + private iTextField tdblText; + private JLabel sxsjText; + + public AddDialog(TCComponentBOMLine paramTCComponentBOMLine, Frame paramFrame) + throws TCException + { + this(paramTCComponentBOMLine, paramFrame, null, false); + } + + public AddDialog(TCComponentBOMLine paramTCComponentBOMLine, Frame paramFrame, boolean paramBoolean) + throws TCException + { + this(paramTCComponentBOMLine, paramFrame, null, paramBoolean); + } + + public AddDialog(TCComponentBOMLine paramTCComponentBOMLine, Frame paramFrame, TCComponent[] paramArrayOfTCComponent) + throws TCException + { + this(paramTCComponentBOMLine, paramFrame, paramArrayOfTCComponent, false); + } + + public AddDialog(TCComponentBOMLine paramTCComponentBOMLine, Frame paramFrame, TCComponent[] paramArrayOfTCComponent, boolean paramBoolean) + throws TCException + { + this(paramFrame, paramTCComponentBOMLine, new TCComponentBOMLine[] { paramTCComponentBOMLine }, paramArrayOfTCComponent, ActionOption.AS_COMPONENT, paramBoolean); + } + + public AddDialog(TCComponentBOMLine[] paramArrayOfTCComponentBOMLine, Frame paramFrame, TCComponent[] paramArrayOfTCComponent) + throws TCException + { + this(paramFrame, null, paramArrayOfTCComponentBOMLine, paramArrayOfTCComponent, ActionOption.AS_NEW_LEVEL, false); + } + + private AddDialog(Frame paramFrame, TCComponentBOMLine paramTCComponentBOMLine, TCComponentBOMLine[] paramArrayOfTCComponentBOMLine, TCComponent[] paramArrayOfTCComponent, ActionOption paramActionOption, boolean paramBoolean) + throws TCException + { + super(paramFrame, true); + System.out.println("AddDialog"); + this.target = paramTCComponentBOMLine; + this.targets = paramArrayOfTCComponentBOMLine; + this.toPaste = paramArrayOfTCComponent; + this.asOption = paramActionOption; + this.asSubstituteOnly = paramBoolean; + if (paramTCComponentBOMLine != null) + { + this.m_session = paramTCComponentBOMLine.getSession(); + this.bomWindow = paramTCComponentBOMLine.window(); + } + else if (paramArrayOfTCComponentBOMLine[0] != null) + { + this.m_session = paramArrayOfTCComponentBOMLine[0].getSession(); + this.bomWindow = paramArrayOfTCComponentBOMLine[0].window(); + } + this.asMarkup = this.bomWindow.getMarkupMode(); + this.packDef = packDefault(this.m_session); + createDialog(this.m_session); + } + + private void createDialog(TCSession paramTCSession) + throws TCException + { + tdsxText = new iTextField(28); + tdblText = new iTextField(28); + tdblText.setText("1"); + sxsjText = new JLabel(""); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + String time=formatter.format(new Date()); + sxsjText.setText(time); + TCComponentBOMLine[] sulines = target.listSubstitutes(); + int sulin=sulines==null?0:sulines.length; + int newsulin=sulin+1; + tdsxText.setText(newsulin+""); + jpnew=new JPanel(new PropertyLayout()); + jpnew.add("1.1.left", new JLabel("˳:")); + jpnew.add("2.1.left", new JLabel(":")); + jpnew.add("3.1.left", new JLabel("Чʱ:")); + jpnew.add("1.2.left", tdsxText); + jpnew.add("2.2.left", tdblText); + jpnew.add("3.2.left", sxsjText); + + + getContentPane().setLayout(new VerticalLayout(4, 4, 4, 4, 1)); + if (this.asOption != ActionOption.AS_NEW_LEVEL) + { + this.title = this.reg.getString(this.toPaste == null ? "add.addTitle" : "add.pasteTitle"); + setTitle(this.title); + this.addPanel = new PSEItemPanel(paramTCSession, this.reg.getString("add.toAdd")); + } + else + { + + this.title = this.reg.getString("add.insertLevelTitle"); + setTitle(this.title); + this.addPanel = new PSEItemPanel(paramTCSession, this.reg.getString("add.toInsert")); + } + this.addPanel.setCallback(this); + JPanel localJPanel = null; + JRadioButton localJRadioButton = null; + TCComponentBOMLine localTCComponentBOMLine = this.bomWindow.getTopBOMLine(); + + if (this.asSubstituteOnly) + { + this.asOption = ActionOption.AS_SUBSTITUTE; + } + else if (this.asOption != ActionOption.AS_NEW_LEVEL) + { + localJRadioButton = new JRadioButton(this.reg.getString("add.asComponent"), true); + localJRadioButton.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent paramActionEvent) + { + setAsOption(AddDialog.ActionOption.AS_COMPONENT); + } + }); + this.subButt = new JRadioButton(this.reg.getString("add.asSubstitute"), false); + this.subButt.setEnabled(localTCComponentBOMLine != this.target); + this.subButt.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent paramActionEvent) + { + setAsOption(AddDialog.ActionOption.AS_SUBSTITUTE); + numOccsField.setEnabled(false); + qtyField.setEnabled(false); + seqnoField.setEnabled(false); + if (!BOMMarkupHelper.allowStructureEdit(AIFUtility.getActiveDesktop().getShell(), target)) + disposeDialog(); + } + }); + this.newLevelButt = new JRadioButton(this.reg.getString("add.asNewLevel"), false); + this.newLevelButt.setEnabled((localTCComponentBOMLine != this.target) && (!this.target.window().getRedliningMode()) && (!this.asMarkup)); + this.newLevelButt.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent paramActionEvent) + { + applyButton.setEnabled(false); + setAsOption(AddDialog.ActionOption.AS_NEW_LEVEL); + } + }); + ButtonGroup localObject1 = new ButtonGroup(); + ((ButtonGroup)localObject1).add(localJRadioButton); + ((ButtonGroup)localObject1).add(this.subButt); + ((ButtonGroup)localObject1).add(this.newLevelButt); + FilterDocument localObject21 = new FilterDocument("0123456789", 19); + numOccsField = new iTextField(localObject21, "1", 4); + qtyField = new iTextField(15, 32, false); + seqnoField = new iTextField(5, 15, false); + System.out.println("ddddd"); + + localJPanel = new JPanel(new PropertyLayout()); + localJPanel.add("1.1.left", this.numOccsField.createLabel(this.reg.getString("add.num"))); + localJPanel.add("2.1.left", this.qtyField.createLabel(this.reg.getString("add.qty"))); + localJPanel.add("3.1.left", this.seqnoField.createLabel(this.reg.getString("add.seq"))); + localJPanel.add("1.2.left", this.numOccsField); + localJPanel.add("2.2.left", this.qtyField); + localJPanel.add("3.2.left", this.seqnoField); + + + } + JPanel newadd=new JPanel(new PropertyLayout()); + newadd.add("1.1.left",addPanel); + newadd.add("2.1.left",jpnew); + Object localObject1 = new JPanel(new ButtonLayout()); + this.applyButton = new JButton(this.reg.getString("apply")); + this.clearButton = new JButton(this.reg.getString("clear")); + this.okButton = new JButton(this.reg.getString("ok")); + this.okButton.setEnabled(false); + this.cancelButton = new JButton(this.reg.getString("cancel")); + this.okButton.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent paramActionEvent) + { + okButton.setEnabled(false); + applyButton.setEnabled(false); + cancelButton.setEnabled(false); + + m_session.queueOperation(new AbstractAIFOperation() + { + public void executeOperation() + { + System.out.println("ok"); + dialogResultId = 0; + doAdd(); + } + }); + } + }); + ((JPanel)localObject1).add("horizonal.left", this.okButton); + this.applyButton.setEnabled(false); + this.applyButton.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent paramActionEvent) + { + applyButton.setEnabled(false); + cancelButton.setEnabled(false); + + m_session.queueOperation(new AbstractAIFOperation() + { + public void executeOperation() + { + System.out.println("apply1"); + dialogResultId = 1; + doAdd(); + } + }); + } + }); + ((JPanel)localObject1).add("horizonal.left", this.applyButton); + this.clearButton.setEnabled(true); + this.clearButton.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent paramActionEvent) + { + okButton.setEnabled(false); + applyButton.setEnabled(false); + cancelButton.setEnabled(false); + m_session.queueOperation(new AbstractAIFOperation() + { + public void executeOperation() + { + doClear(); + } + }); + } + }); + ((JPanel)localObject1).add("horizonal.left", this.clearButton); + this.cancelButton.addActionListener(new com.teamcenter.rac.aif.AbstractAIFDialog.IC_DisposeActionListener()); + ((JPanel)localObject1).add("horizonal.right", this.cancelButton); + getContentPane().add("top.bind.left.center", new JLabel(this.reg.getString(this.asOption != ActionOption.AS_NEW_LEVEL ? "add.addTo" : "add.insert"))); + getContentPane().add("top.bind.center.center", newadd); + if (localJRadioButton != null) + getContentPane().add("top.bind.center.center", localJRadioButton); + if (this.subButt != null) + getContentPane().add("top.bind.center.center", this.subButt); + if (this.newLevelButt != null) + getContentPane().add("top.bind.center.center", this.newLevelButt); + if (localJPanel != null) + getContentPane().add("top.nobind.left.center", localJPanel); + getContentPane().add("bottom.bind.center.center", (Component)localObject1); + getContentPane().add("bottom.bind.center.center", new Separator()); + if (this.asOption != ActionOption.AS_SUBSTITUTE) + { + TCComponent localObject2 = null; + if (this.toPaste != null) + localObject2 = setupPaste(); + try + { + if (this.seqnoField != null) + this.seqnoField.setText(this.target.getNewSequenceNumber((TCComponent)localObject2)); + } + catch (TCException localTCException) + { + } + } + setAsOption(this.asOption); + } + + private boolean packDefault(TCSession paramTCSession) + { + TCPreferenceService localTCPreferenceService = paramTCSession.getPreferenceService(); + return localTCPreferenceService.isTrue(0, "PSEAutoPackPref"); + } + + protected void doAdd() + { + System.out.println(""); + this.okButton.setEnabled(false); + this.applyButton.setEnabled(false); + this.cancelButton.setEnabled(false); + this.m_session.queueOperation(new AbstractAIFOperation() + { + public void executeOperation() + { + if ((target instanceof TCComponentGDELine)){ + doAddGDELine(); + System.out.println("11111"); + } + else if ((toPaste != null) && (((toPaste[0] instanceof TCComponentGDELine)) || ((toPaste[0] instanceof TCComponentGDE)))){ + doAddGDELine(); + System.out.println("2222"); + } + else + try + { + System.out.println("3333"); + TCComponentItemRevision localTCComponentItemRevision = addPanel.getItemRev(); + if (localTCComponentItemRevision == null) + return; + String str = localTCComponentItemRevision.getProperty("object_type"); + if ((str.equalsIgnoreCase("WeldPointRevision")) || (str.equalsIgnoreCase("DatumPointRevision")) || (str.equalsIgnoreCase("ArcWeldRevision"))) + { + System.out.println("aaaa1"); + Toolkit.getDefaultToolkit().beep(); + MessageBox.post(getOwner(), reg.getString("mfgPasteBlock.MSG"),reg.getString("mfgpointPasteBlock.Error"), 1); + dialogResultId = 1; + return; + } + if (asOption == ActionOption.AS_SUBSTITUTE) + { + System.out.println("aaaa2"); + if (asMarkup){ + markupAddSubstitutes(localTCComponentItemRevision); + } + else{ + //˴Ϊ + System.out.println(localTCComponentItemRevision+"++++++++++++++"+addPanel.getViewType()); + + target.add(null, localTCComponentItemRevision, addPanel.getViewType(), true); + System.out.println("sssaaaa"); + // target.getTCProperty("bl_quantity").setStringValue("1"); + String id=addPanel.getItem().getTCProperty("item_id").getStringValue(); + + System.out.println("id="+id+","+tdsxText.getText()+","+tdblText.getText()+","+sxsjText.getText()); + String[] tdsxs=target.getTCProperty("JK8SubstitOrder").getStringValue().split(",");//˳ + target.getTCProperty("JK8SubstitOrder").setStringValue(getNewStr1(tdsxs,id+"&"+tdsxText.getText())); +// String[] tdsxs=target.getTCProperty("jk8SubstitOrder").getStringValueArray();//˳ +// target.getTCProperty("jk8SubstitOrder").setStringValueArray(getNewStr(tdsxs,id+"&"+tdsxText.getText())); +// String[] tdbls=target.getTCProperty("jk8SubstitRatio").getStringValueArray();// +// target.getTCProperty("jk8SubstitRatio").setStringValueArray(getNewStr(tdbls,id+"&"+tdblText.getText())); + String[] tdbls=target.getTCProperty("JK8SubstitRatio").getStringValue().split(",");// + target.getTCProperty("JK8SubstitRatio").setStringValue(getNewStr1(tdbls,id+"&"+tdblText.getText())); +// String[] sxsj=target.getTCProperty("jk8EffectiveDate").getStringValueArray();//ʱ +// target.getTCProperty("jk8EffectiveDate").setStringValueArray(getNewStr(sxsj,id+"&"+sxsjText.getText())); + String[] sxsj=target.getTCProperty("JK8EffectiveDate").getStringValue().split(",");//ʱJK8EffectiveDateJK8test + target.getTCProperty("JK8EffectiveDate").setStringValue(getNewStr1(sxsj,id+"&"+sxsjText.getText())); + } + } + else + { + + if (asOption == AddDialog.ActionOption.AS_NEW_LEVEL) + { + + TCComponentBOMWindow localTCComponentBOMWindow = targets[0].window(); + for (TCComponentBOMLine localObject1 :targets) + { + if (localTCComponentItemRevision != ((TCComponentBOMLine)localObject1).getItemRevision()) + continue; + Toolkit.getDefaultToolkit().beep(); + MessageBox.post(getOwner(), reg.getString("add.cyclic.MSG"),reg.getString("add.cyclic.TITLE"), 4); + dialogResultId = 1; + return; + } + m_session.setStatus(reg.getString("pastingNewItem") + " " + localTCComponentItemRevision.toString() + " ..."); + TCComponentBOMLine localObject1 = targets[0].parent(); + if ((localObject1 != null) && (localTCComponentItemRevision == ((TCComponentBOMLine)localObject1).getItemRevision())) + { + Toolkit.getDefaultToolkit().beep(); + MessageBox.post(getCurrentDesktop(), reg.getString("add.cyclic.MSG"), reg.getString("add.cyclic.TITLE"), 4); + dialogResultId = 1; + return; + } + RestructureService localObject2 = RestructureService.getService(m_session); + Restructure.InsertLevelParameter[] arrayOfInsertLevelParameter = new Restructure.InsertLevelParameter[1]; + arrayOfInsertLevelParameter[0] = new Restructure.InsertLevelParameter(); + arrayOfInsertLevelParameter[0].bomLines = new TCComponentBOMLine[targets.length]; + for (int n = 0; n < targets.length; n++) + arrayOfInsertLevelParameter[0].bomLines[n] = targets[n]; + arrayOfInsertLevelParameter[0].itemRevision = localTCComponentItemRevision; + arrayOfInsertLevelParameter[0].viewType =addPanel.getViewType(); + ServiceData localObject3 = ((RestructureService)localObject2).insertLevel(arrayOfInsertLevelParameter); + if (SoaUtil.handlePartialErrors((com.teamcenter.soa.client.model.ServiceData)localObject3, this)) + { + localTCComponentBOMWindow.fireComponentChangeEvent(); + } + else + { + dialogResultId = 1; + return; + } + } + else + { + if (localTCComponentItemRevision == target.getItemRevision()) + { + Toolkit.getDefaultToolkit().beep(); + MessageBox.post(getOwner(), reg.getString("add.cyclic.MSG"), reg.getString("add.cyclic.TITLE"), 4); + dialogResultId = 1; + return; + } + int i = numOccsField != null ? Integer.parseInt(numOccsField.getText()) : 1; + if (asMarkup) + { + target.addNewMarkupChild(localTCComponentItemRevision, numOccsField.getText(), seqnoField.getText(), qtyField.getText()); + } + else + { + System.out.println("aaaa5"); + ArrayList localObject1 = new ArrayList(); + Structure.AddParam localObject2 = null; + for (int m = 0; m < i; m++) + { + Structure.AddInformation localObject3 = null; + + if ((toPaste != null) && ((toPaste[0] instanceof TCComponentBOMLine))) + { + TCComponentBOMLine localObject4 = (TCComponentBOMLine)toPaste[0]; + if ((((TCComponentBOMLine)localObject4).getPendingCut()) && (((TCComponentBOMLine)localObject4).getCachedWindow() == target.getCachedWindow())) + { + RestructureService localObject5 = RestructureService.getService(target.getSession()); + Restructure.MoveNodeParameter[] arrayOfMoveNodeParameter = new Restructure.MoveNodeParameter[1]; + arrayOfMoveNodeParameter[0] = new Restructure.MoveNodeParameter(); + arrayOfMoveNodeParameter[0].newParent = target; + arrayOfMoveNodeParameter[0].bomLines = new TCComponentBOMLine[1]; + arrayOfMoveNodeParameter[0].bomLines[0] = localObject4; + com.teamcenter.rac.kernel.ServiceData localServiceData = ((RestructureService)localObject5).moveNode(arrayOfMoveNodeParameter); + if (localServiceData.sizeOfPartialErrors() > 0) + { + int i1 = 0; + for (int i2 = 0; (i2 < localServiceData.sizeOfPartialErrors()) && (i1 == 0); i2++) + { + ErrorStack localErrorStack = localServiceData.getPartialError(i2); + int[] arrayOfInt = localErrorStack.getLevels(); + for (int i3 = 0; i3 < arrayOfInt.length; i3++) + { + if (arrayOfInt[i3] != 3) + continue; + AIFPortal.getClipboard().clearClipboard(); + i1 = 1; + break; + } + } + SoaUtil.checkPartialErrors(localServiceData); + } + } + else if (((TCComponentBOMLine)localObject4).getPendingCut()) + { + if (localObject2 == null) + { + localObject2 = new Structure.AddParam(); + ((Structure.AddParam)localObject2).parent = target; + ((Structure.AddParam)localObject2).flags = 6; + ((Structure.AddParam)localObject2).toBeAdded = new Structure.AddInformation[i]; + } + if (localObject3 == null) + localObject3 = new Structure.AddInformation(); + HashMap localObject5 = new HashMap(); + ((Structure.AddInformation)localObject3).initialValues = ((Map)localObject5); + ((Structure.AddInformation)localObject3).bomView = null; + ((Structure.AddInformation)localObject3).element = null; + ((Structure.AddInformation)localObject3).line = ((TCComponentBOMLine)localObject4); + ((Structure.AddInformation)localObject3).item = null; + ((Structure.AddInformation)localObject3).itemRev = null; + } + else + { + if (localObject2 == null) + { + localObject2 = new Structure.AddParam(); + ((Structure.AddParam)localObject2).parent = target; + ((Structure.AddParam)localObject2).flags = 2; + ((Structure.AddParam)localObject2).toBeAdded = new Structure.AddInformation[i]; + } + if (localObject3 == null) + localObject3 = new Structure.AddInformation(); + HashMap localObject5 = new HashMap(); + ((Structure.AddInformation)localObject3).initialValues = ((Map)localObject5); + ((Structure.AddInformation)localObject3).bomView = null; + ((Structure.AddInformation)localObject3).element = null; + ((Structure.AddInformation)localObject3).line = ((TCComponentBOMLine)localObject4); + ((Structure.AddInformation)localObject3).item = null; + ((Structure.AddInformation)localObject3).itemRev = null; + } + } + else + { + if (localObject2 == null) + { + localObject2 = new Structure.AddParam(); + ((Structure.AddParam)localObject2).parent = target; + ((Structure.AddParam)localObject2).flags = 0; + ((Structure.AddParam)localObject2).toBeAdded = new Structure.AddInformation[i]; + } + if (localObject3 == null) + localObject3 = new Structure.AddInformation(); + HashMap localObject4 = new HashMap(); + ((Structure.AddInformation)localObject3).initialValues = ((Map)localObject4); + ((Structure.AddInformation)localObject3).bomView = addPanel.getViewType(); + ((Structure.AddInformation)localObject3).element = null; + ((Structure.AddInformation)localObject3).line = null; + ((Structure.AddInformation)localObject3).item = null; + ((Structure.AddInformation)localObject3).itemRev = localTCComponentItemRevision; + } + if (localObject3 != null) + { + String localObject4 = qtyField.getText(); + if ((localObject4 != null) && (((String)localObject4).length() > 0)) + ((Structure.AddInformation)localObject3).initialValues.put("bl_quantity", localObject4); + String localObject5 = seqnoField.getText(); + if ((localObject5 != null) && (((String)localObject5).length() > 0) && (seqnoField.isEnabled())) + ((Structure.AddInformation)localObject3).initialValues.put("bl_sequence_no", localObject5); + } + if (localObject2 == null) + continue; + localObject2.toBeAdded[m] = localObject3; + } + if (localObject2 != null) + { + System.out.println("aaaaa11"); + ((ArrayList)localObject1).add(localObject2); + StructureService localStructureService = StructureService.getService(m_session); + Structure.AddResponse localObject3 = localStructureService.add((Structure.AddParam[])((ArrayList)localObject1).toArray(new Structure.AddParam[((ArrayList)localObject1).size()])); + if (SoaUtil.handlePartialErrors(((Structure.AddResponse)localObject3).serviceData, this)) + { + bomWindow.fireComponentChangeEvent(); + } + else + { + dialogResultId = 1; + return; + } + } + } + } + } + if (dialogResultId == 0) + { + disposeDialog(); + } + else + { + if (asOption == AddDialog.ActionOption.AS_COMPONENT) + { + TCComponentItem localTCComponentItem = null; + if (toPaste != null) + localTCComponentItem = setupPaste(); + try + { + seqnoField.setText(target.getNewSequenceNumber(localTCComponentItem)); + } + catch (TCException localTCException) + { + } + } + validCallback(); + } + } + catch (Exception localException) + { + MessageBox.post(getOwner(), localException); + } + finally + { + okButton.setEnabled(true); + applyButton.setEnabled(true); + cancelButton.setEnabled(true); + } + } + + + }); + } + private String[] getNewStr(String[] oldstrs, String text) { + // TODO Auto-generated method stub + String[] strs; + if(oldstrs==null&&oldstrs.length<1){ + strs=new String[]{text}; + }else{ + strs=new String[oldstrs.length+1]; + for(int i=0;i 0) + { + int k = 0; + for (int m = 0; (m < localServiceData.sizeOfPartialErrors()) && (k == 0); m++) + { + ErrorStack localErrorStack = localServiceData.getPartialError(m); + int[] arrayOfInt = localErrorStack.getLevels(); + for (int n = 0; n < arrayOfInt.length; n++) + { + if (arrayOfInt[n] != 3) + continue; + AIFPortal.getClipboard().clearClipboard(); + k = 1; + break; + } + } + SoaUtil.checkPartialErrors(localServiceData); + } + } + else + { + if (localAddParam == null) + { + localAddParam = new Structure.AddParam(); + localAddParam.parent = this.target; + localAddParam.flags = (localTCComponentGDELine.getPendingCut() ? 4 : 0); + localAddParam.toBeAdded = new Structure.AddInformation[i]; + } + if (localObject1 == null) + localObject1 = new Structure.AddInformation(); + HashMap localObject2 = new HashMap(); + ((Structure.AddInformation)localObject1).initialValues = ((Map)localObject2); + ((Structure.AddInformation)localObject1).bomView = null; + ((Structure.AddInformation)localObject1).element = null; + ((Structure.AddInformation)localObject1).line = localTCComponentGDELine; + ((Structure.AddInformation)localObject1).item = null; + ((Structure.AddInformation)localObject1).itemRev = null; + } + } + else + { + if (localAddParam == null) + { + localAddParam = new Structure.AddParam(); + localAddParam.parent = this.target; + localAddParam.flags = 0; + localAddParam.toBeAdded = new Structure.AddInformation[i]; + } + if (localObject1 == null) + localObject1 = new Structure.AddInformation(); + HashMap localObject2 = new HashMap(); + ((Structure.AddInformation)localObject1).initialValues = ((Map)localObject2); + ((Structure.AddInformation)localObject1).bomView = this.addPanel.getViewType(); + ((Structure.AddInformation)localObject1).element = localTCComponentGDE; + ((Structure.AddInformation)localObject1).line = null; + ((Structure.AddInformation)localObject1).item = null; + ((Structure.AddInformation)localObject1).itemRev = null; + } + if (localObject1 != null) + { + String localObject2 = this.qtyField.getText(); + if ((localObject2 != null) && (((String)localObject2).length() > 0)) + ((Structure.AddInformation)localObject1).initialValues.put("bl_quantity", localObject2); + String localObject3 = this.seqnoField.getText(); + if ((localObject3 != null) && (((String)localObject3).length() > 0) && (this.seqnoField.isEnabled())) + ((Structure.AddInformation)localObject1).initialValues.put("bl_sequence_no", localObject3); + } + if (localAddParam == null) + continue; + localAddParam.toBeAdded[j] = localObject1; + } + if (localAddParam != null) + { + localArrayList.add(localAddParam); + StructureService localStructureService = StructureService.getService(this.m_session); + Structure.AddResponse localObject11 = localStructureService.add((Structure.AddParam[])localArrayList.toArray(new Structure.AddParam[localArrayList.size()])); + if (SoaUtil.handlePartialErrors(((Structure.AddResponse)localObject11).serviceData, this)) + { + this.bomWindow.fireComponentChangeEvent(); + } + else + { + this.dialogResultId = 1; + return; + } + } + if (this.dialogResultId == 0) + { + disposeDialog(); + break label782; + } + validCallback(); + } + } + catch (Exception localException) + { + MessageBox.post(getOwner(), localException); + } + finally + { + this.okButton.setEnabled(true); + this.applyButton.setEnabled(true); + this.cancelButton.setEnabled(true); + } + } + + private void doClear() + { + this.okButton.setEnabled(false); + this.applyButton.setEnabled(false); + this.clearButton.setEnabled(true); + this.cancelButton.setEnabled(true); + if (this.numOccsField != null) + this.numOccsField.setText("1"); + if (this.qtyField != null) + this.qtyField.setText(""); + this.addPanel.clear(); + if (this.seqnoField != null) + try + { + this.seqnoField.setText(this.target.getNewSequenceNumber(null)); + } + catch (TCException localTCException) + { + MessageBox.post(getOwner(), localTCException); + } + this.tdblText.setText(""); + this.tdsxText.setText(""); + } + + public void validCallback() + { + this.okButton.setEnabled(true); + if (this.asOption != ActionOption.AS_NEW_LEVEL) + this.applyButton.setEnabled(true); + else + this.applyButton.setEnabled(false); + getRootPane().setDefaultButton(this.applyButton); + this.applyButton.requestFocusInWindow(); + pack(); + if (this.toPaste != null) + if (this.addPanel.getGDELine() != null) + this.toPaste[0] = this.addPanel.getGDELine(); + else if (this.addPanel.getGDE() != null) + { + if ((this.toPaste[0] instanceof TCComponentGDELine)) + try + { + if (((TCComponentGDELine)this.toPaste[0]).getGDE() == this.addPanel.getGDE()) + return; + this.toPaste[0] = this.addPanel.getGDE(); + } + catch (TCException localTCException1) + { + MessageBox.post(getOwner(), localTCException1); + } + else + this.toPaste[0] = this.addPanel.getGDE(); + } + else if (this.addPanel.getItemRev() != null) + { + if ((this.toPaste[0] instanceof TCComponentBOMLine)) + try + { + if (((TCComponentBOMLine)this.toPaste[0]).getItemRevision() == this.addPanel.getItemRev()) + return; + this.toPaste[0] = this.addPanel.getItemRev(); + } + catch (TCException localTCException2) + { + MessageBox.post(getOwner(), localTCException2); + } + else + this.toPaste[0] = this.addPanel.getItemRev(); + } + else if (this.addPanel.getItem() != null) + if ((this.toPaste[0] instanceof TCComponentBOMLine)) + try + { + if (((TCComponentBOMLine)this.toPaste[0]).getItem() == this.addPanel.getItem()) + return; + this.toPaste[0] = this.addPanel.getItem(); + } + catch (TCException localTCException3) + { + MessageBox.post(getOwner(), localTCException3); + } + else + this.toPaste[0] = this.addPanel.getItem(); + } + + public void invalidCallback() + { + this.okButton.setEnabled(false); + this.applyButton.setEnabled(false); + getRootPane().setDefaultButton(this.cancelButton); + } + + private void setAsOption(ActionOption paramActionOption) + { + this.asOption = paramActionOption; + boolean bool1 = paramActionOption == ActionOption.AS_COMPONENT; + try + { + bool1 = ((this.toPaste == null) || (!(this.toPaste[0] instanceof TCComponentBOMLine)) || (!this.toPaste[0].getPendingCut())) && (bool1); + } + catch (Exception localException) + { + this.dialogResultId = 1; + return; + } + if (this.numOccsField != null) + this.numOccsField.setEnabled(bool1); + if (this.qtyField != null) + this.qtyField.setEnabled(bool1); + if (this.seqnoField != null) + this.seqnoField.setEnabled(bool1); + if (this.applyButton != null) + { + boolean bool2 = (paramActionOption != ActionOption.AS_NEW_LEVEL) && ((this.addPanel.getItemRev() != null) || (this.addPanel.getGDE() != null) || (this.addPanel.getGDE() != null)); + this.applyButton.setEnabled(bool2); + } + } + + private TCComponentItem setupPaste() + throws TCException + { + this.addPanel.clear(); + try + { + if ((this.target instanceof TCComponentGDELine)) + setupPasteForGDE(); + else if ((this.toPaste[0] instanceof TCComponentItem)) + this.addPanel.setItem((TCComponentItem)this.toPaste[0]); + else if ((this.toPaste[0] instanceof TCComponentItemRevision)) + this.addPanel.setItemRev((TCComponentItemRevision)this.toPaste[0]); + else if (((this.toPaste[0] instanceof TCComponentBOMLine)) && (!(this.toPaste[0] instanceof TCComponentGDELine))) + this.addPanel.setBOMLine((TCComponentBOMLine)this.toPaste[0]); + else + setupPasteForGDE(); + } + catch (Exception localException1) + { + logger.info(localException1.getClass().getName(), localException1); + throw new TCException(this.reg.getString("cantConvert")); + } + if (this.toPaste.length != 1) + try + { + SwingUtilities.invokeAndWait(new Runnable() + { + public void run() + { + MessageBox localMessageBox = new MessageBox(reg.getString("add.clipWarning"), reg.getString("warning.TITLE"), 4); + localMessageBox.setModal(true); + localMessageBox.setVisible(true); + } + }); + } + catch (Exception localException2) + { + logger.error(localException2.getClass().getName(), localException2); + } + return this.addPanel.getItem(); + } + + private void setupPasteForGDE() + throws TCException + { + String str = this.target.getProperty("bl_view_type"); + if ((this.toPaste[0] instanceof TCComponentGDE)) + { + this.addPanel.setGDE((TCComponentGDE)this.toPaste[0], str); + this.subButt.setEnabled(false); + this.qtyField.setText(""); + this.seqnoField.setText(""); + this.qtyField.setEnabled(false); + this.seqnoField.setEnabled(false); + } + else if ((this.toPaste[0] instanceof TCComponentGDELine)) + { + this.addPanel.setGDELine((TCComponentGDELine)this.toPaste[0], str); + this.subButt.setEnabled(false); + this.qtyField.setText(""); + this.seqnoField.setText(""); + this.qtyField.setEnabled(false); + this.seqnoField.setEnabled(false); + } + } + + public static enum ActionOption + { + AS_COMPONENT, AS_SUBSTITUTE, AS_NEW_LEVEL; + } +} \ No newline at end of file diff --git a/src/com/connor/jk/plm/setBomline/MyTable.java b/src/com/connor/jk/plm/setBomline/MyTable.java new file mode 100644 index 0000000..d5add62 --- /dev/null +++ b/src/com/connor/jk/plm/setBomline/MyTable.java @@ -0,0 +1,22 @@ +package com.connor.jk.plm.setBomline; + +import javax.swing.JTable; +import javax.swing.table.DefaultTableModel; + +public class MyTable extends JTable { + public MyTable(Object[][] data, Object[] columnNames) { + super(data, columnNames);// һҪǸĹ췽ʵ + } + + public MyTable(DefaultTableModel table) { + super(table);// һҪǸĹ췽ʵ + } + public boolean isCellEditable(int row, int column) { + // ķ return trueģԾͿԱ༭~~~ + if(column<2){ + return false; + }else{ + return true; + } + } +} diff --git a/src/com/connor/jk/plm/setBomline/SetBomline_Action.java b/src/com/connor/jk/plm/setBomline/SetBomline_Action.java new file mode 100644 index 0000000..0260512 --- /dev/null +++ b/src/com/connor/jk/plm/setBomline/SetBomline_Action.java @@ -0,0 +1,26 @@ +package com.connor.jk.plm.setBomline; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.common.actions.AbstractAIFAction; + +public class SetBomline_Action extends AbstractAIFAction { +private AbstractAIFApplication app; + public SetBomline_Action(AbstractAIFApplication arg0, String arg1) { + super(arg0, arg1); + // TODO Auto-generated constructor stub + this.app=arg0; + } + + @Override + public void run() { + // TODO Auto-generated method stub + SetBomline_Command com=new SetBomline_Command(app); + try { + com.executeModal(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + +} diff --git a/src/com/connor/jk/plm/setBomline/SetBomline_Command.java b/src/com/connor/jk/plm/setBomline/SetBomline_Command.java new file mode 100644 index 0000000..c322cf0 --- /dev/null +++ b/src/com/connor/jk/plm/setBomline/SetBomline_Command.java @@ -0,0 +1,56 @@ +package com.connor.jk.plm.setBomline; + +import com.teamcenter.rac.aif.AIFDesktop; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.AbstractAIFCommand; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentBOMLine; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCComponentItemType; +import com.teamcenter.rac.kernel.TCSession; + +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.Registry; + +public class SetBomline_Command extends AbstractAIFCommand { + private AbstractAIFApplication app; + private InterfaceAIFComponent targetComp; + private TCSession session; + public SetBomline_Command(AbstractAIFApplication app) { + // TODO Auto-generated constructor stub + this.app=app; + this.targetComp = app.getTargetComponent(); + this.session = (TCSession) app.getSession(); + } + public void executeModal() throws Exception { + // TODO Auto-generated method stub + super.executeModal(); + if(targetComp==null){ + MessageBox.post("ѡbomlinִв","",MessageBox.ERROR); + return; + } + if(targetComp instanceof TCComponentBOMLine){ + System.out.println("aaa"); + +// AbstractAIFCommand abstractaifcommand = new com.connor.jk.plm.setBomline.AddCommand((TCComponentBOMLine)targetComp, true); +// abstractaifcommand.executeModeless(); + +// TCComponentItemRevision tc0=((TCComponentBOMLine)targetComp[1]).getItem().getLatestItemRevision(); +// TCComponent tc1=((TCComponentBOMLine)targetComp[1]).getItem().getReferenceListProperty("bom_view_tags")[0]; +// +// ((TCComponentBOMLine)targetComp[0]).add(null, tc0, tc1, true); + SetBomline_Dialog dialog = new SetBomline_Dialog(targetComp, + session); + new Thread(dialog).start(); + + + }else{ + MessageBox.post("ѡbomlinִв","",MessageBox.ERROR); + return; + } + + } + +} diff --git a/src/com/connor/jk/plm/setBomline/SetBomline_Dialog.java b/src/com/connor/jk/plm/setBomline/SetBomline_Dialog.java new file mode 100644 index 0000000..eac2c55 --- /dev/null +++ b/src/com/connor/jk/plm/setBomline/SetBomline_Dialog.java @@ -0,0 +1,563 @@ +package com.connor.jk.plm.setBomline; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.swing.CellEditor; +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.JTextField; +import javax.swing.table.DefaultTableModel; +import javax.swing.table.TableColumn; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.AbstractAIFCommand; +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.RelatedSubstituteComp; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentBOMLine; +import com.teamcenter.rac.kernel.TCComponentBOMLineType; +import com.teamcenter.rac.kernel.TCComponentBOMWindow; +import com.teamcenter.rac.kernel.TCComponentBOMWindowType; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +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.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; + +public class SetBomline_Dialog extends AbstractAIFDialog { + private InterfaceAIFComponent targetComp; + private TCSession session; + private JPanel jp1; + private JPanel jp2; + private JTable jtable; + private JScrollPane jsp; + private JButton addBut = new JButton(""); + private JButton saveBut = new JButton(""); + private JButton clBut = new JButton(""); + private JButton canBut = new JButton("ȡ"); + private JButton preferBut = new JButton("ѡ"); + + private String[] title = { "", "б", "˳", "Чʱ", "" }; + private Object[][] obj; + private TCComponentBOMLine bomline; + + private DefaultTableModel tableModel; + private List subBean = new ArrayList<>();; + + private Map tdsxMap; + private Map sxsjMap; + private Map tdblMap; + + public SetBomline_Dialog(InterfaceAIFComponent targetComp, TCSession session) { + this.targetComp = targetComp; + this.session = session; + this.bomline = (TCComponentBOMLine) targetComp; + } + + @Override + public void run() { + // super.run(); + System.out.println("run"); + load(); + init(); + } + + public void load() { + try { + TCComponentBOMLine[] sulines = bomline.listSubstitutes(); + System.out.println("sulines.length-------------->"+sulines.length); + for (int i = 0; i < sulines.length; i++) { + System.out.println(sulines[i].toString()); + } +// String[] tdsx = bomline.getTCProperty("jk8SubstitOrder") +// .getStringArrayValue();// ˳ + String[] tdsx = bomline.getTCProperty("JK8SubstitOrder") + .getStringValue().split(",");// ˳ + tdsxMap = new HashMap<>(); + for (String s : tdsx) { + String[] sp = s.split("&"); + if (sp != null && sp.length > 1) { + tdsxMap.put(sp[0], sp[1]); + } + } +// String[] sxsj = bomline.getTCProperty("jk8EffectiveDate")//jk8EffectiveDateJK8EffectiveDateJK8test +// .getStringArrayValue();// Чʱ + String[] sxsj = bomline.getTCProperty("JK8EffectiveDate").getStringValue().split(",");// Чʱ + sxsjMap = new HashMap<>(); + for (String s : sxsj) { + String[] sp = s.split("&"); + if (sp != null && sp.length > 1) { + sxsjMap.put(sp[0], sp[1]); + } + } +// String[] tdbl = bomline.getTCProperty("jk8SubstitRatio") +// .getStringArrayValue();// + String[] tdbl = bomline.getTCProperty("JK8SubstitRatio") + .getStringValue().split(",");// + tdblMap = new HashMap<>(); + for (String s : tdbl) { + String[] sp = s.split("&"); + if (sp != null && sp.length > 1) { + tdblMap.put(sp[0], sp[1]); + } + } + + // 뼯ϲɱ + if (sulines != null && sulines.length > 0) { + int len = sulines.length; + for (int i = 0; i < len; i++) { + SubstituteBean bean = new SubstituteBean(); + bean.setSulines(sulines[i]); + String id = sulines[i].getItem().getTCProperty("item_id") + .getDisplayValue(); + if (tdsxMap.containsKey(id)) { + bean.setTdsx(tdsxMap.get(id)); + } else { + bean.setTdsx(""); + } + if (sxsjMap.containsKey(id)) { + bean.setSxsj(sxsjMap.get(id)); + } else { + bean.setSxsj(""); + } + if (tdblMap.containsKey(id)) { + bean.setTdbl(tdblMap.get(id)); + } else { + bean.setTdbl(""); + } + subBean.add(bean); + } + System.out.println("len=" + len); + obj = new Object[len][5]; + for (int i = 0; i < len; i++) { + obj[i][0] = i + 1 + ""; + obj[i][1] = subBean.get(i).getSulines(); + obj[i][2] = subBean.get(i).getTdsx(); + obj[i][3] = subBean.get(i).getSxsj(); + obj[i][4] = subBean.get(i).getTdbl(); + } + } else { + obj = new Object[0][5]; + } + + // Լ뼯 + SubstituteBean bean = new SubstituteBean(); + bean.setSulines(bomline); + String id = bomline.getItem().getTCProperty("item_id") + .getStringValue(); + if (tdsxMap.containsKey(id)) { + bean.setTdsx(tdsxMap.get(id)); + } else { + bean.setTdsx(""); + } + if (sxsjMap.containsKey(id)) { + bean.setSxsj(sxsjMap.get(id)); + } else { + bean.setSxsj(""); + } + if (tdblMap.containsKey(id)) { + bean.setTdbl(tdblMap.get(id)); + } else { + bean.setTdbl(""); + } + subBean.add(bean); + + tableModel = new DefaultTableModel(obj, title); + jtable = new MyTable(tableModel); + + } catch (TCException e) { + System.out.println("TC"); + e.printStackTrace(); + } + } + + public void init() { + setTitle("б"); + setSize(new Dimension(800, 300)); + setLayout(new BorderLayout()); + jp1 = new JPanel(new PropertyLayout()); + jsp = new JScrollPane(jtable);// + jsp.setPreferredSize(new Dimension(300, 300)); + jp1.add("1.1.left.top", jsp); + jp2 = new JPanel(); + addBut.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent arg0) { + add(); + setVisible(false); + } + }); + clBut.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + removeSelectedSubstitutes(); + } + }); + canBut.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + setVisible(false); + } + }); + preferBut.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent arg0) { + preferSelectedSubstitutes(); + } + }); + saveBut.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + save(); + } + }); + jp2.add(preferBut); + jp2.add(addBut); + jp2.add(saveBut); + jp2.add(clBut); + jp2.add(canBut); + add(jsp, BorderLayout.CENTER); + add(jp2, BorderLayout.SOUTH); + // setAlwaysOnTop(true); + setLocationRelativeTo(null); + setVisible(true); + TableColumn firsetColumn = jtable.getColumnModel().getColumn(0); + firsetColumn.setMaxWidth(50); + + } + + public void save() { + // TODO Auto-generated method stub + System.out.println("save"); + try { + int count = jtable.getRowCount(); + if (count > 0) { + String[] so = new String[count]; + String[] sd = new String[count]; + String[] sr = new String[count]; + for (int i = 0; i < count; i++) { + for (int j = 1; j < 4; j++) { + CellEditor ce = jtable.getCellEditor(i, j); + ce.stopCellEditing(); + } + + TCComponentBOMLine line = (TCComponentBOMLine) jtable + .getValueAt(i, 1); + + String id = line.getItem().getTCProperty("item_id") + .getStringValue(); + + so[i] = id + "&" + (String) jtable.getValueAt(i, 2); + sd[i] = id + "&" + (String) jtable.getValueAt(i, 3); + sr[i] = id + "&" + (String) jtable.getValueAt(i, 4); + System.out.println(so[i] + "--" + sd[i] + "--" + sr[i]); + + } + String SubstitOrder=""; + for (int i = 0; i < so.length; i++) { + SubstitOrder=SubstitOrder+so[i]; + if(i < so.length-1) { + SubstitOrder=SubstitOrder+","; + } + } + if (so != null) { + +// bomline.getTCProperty("jk8SubstitOrder") +// .setStringValueArray(so); + bomline.getTCProperty("JK8SubstitOrder") + .setStringValue(SubstitOrder); + } + String effectiveDate=""; + for (int i = 0; i < sd.length; i++) { + effectiveDate=effectiveDate+sd[i]; + if(i < sd.length-1) { + effectiveDate=effectiveDate+","; + } + } + if (sd != null) { +// bomline.getTCProperty("jk8EffectiveDate") +// .setStringValueArray(sd); + bomline.getTCProperty("JK8EffectiveDate").setStringValue(effectiveDate); + } + String substitRatio=""; + for (int i = 0; i < sr.length; i++) { + substitRatio=substitRatio+sr[i]; + if(i= 0) { + so[j] = newid + "&" + so[j].split("&")[1]; + } + } +// sd = bomline.getTCProperty("jk8EffectiveDate") +// .getStringArrayValue(); + sd = bomline.getTCProperty("JK8EffectiveDate") + .getStringValue().split(","); + for (int j = 0; j < sd.length; j++) { + if (sd[j].indexOf(oldid) >= 0) { + sd[j] = newid + "&" + sd[j].split("&")[1]; + } + } +// sr = bomline.getTCProperty("jk8SubstitRatio").getStringArrayValue(); + sr = bomline.getTCProperty("JK8SubstitRatio").getStringValue().split(","); + for (int j = 0; j < sr.length; j++) { + if (sr[j].indexOf(oldid) >= 0) { + sr[j] = newid + "&" + sr[j].split("&")[1]; + } + } + } catch (TCException e) { + e.printStackTrace(); + } + System.out.println(tccomponentbomline); + if (tccomponentbomline != null) { + try { + for (int j = 0; j < sr.length; j++) { + System.out.println(so[j] + "--" + sd[j] + "--" + sr[j]); + } + // TCProperty[] tcs=bomline.getTCProperties(new + // String[]{"jk8SubstitOrder","jk8EffectiveDate","jk8SubstitRatio"}); + // String[] + // st=bomline.getTCProperty("jk8SubstitOrder").getStringArrayValue(); + String SubstitOrder=""; + for (int j = 0; j < so.length; j++) { + SubstitOrder=SubstitOrder+so[j]; + if(j= 0; j--) { + + TCComponentBOMLine tccomponentbomline = (TCComponentBOMLine) tableModel + .getValueAt(row[j], 1); + + System.out.println(tccomponentbomline); + for (int k = 0; k < subBean.size(); k++) { + System.out.println("===========>"+subBean.get(k).getSxsj()); + } +// if(true) { +// return; +// } + if (tccomponentbomline != null) { + try { + + subBean.remove(row[j]);// ȥѾɾ + if(subBean.size()-1>=0) { + + if(subBean.get(subBean.size()-1).getSulines().getItem() + .getTCProperty("item_id").getStringValue().equals(bomline.getItemRevision().getTCProperty("item_id").getStringValue())) { + + subBean.remove(subBean.size()-1); + } + } + String[] sxsjs = new String[subBean.size()]; + String[] tdbls = new String[subBean.size()]; + String[] tdsxs = new String[subBean.size()]; + for (int t = 0; t < subBean.size(); t++) { + String id = subBean.get(t).getSulines().getItem() + .getTCProperty("item_id").getStringValue(); + sxsjs[t] = id + "&" + subBean.get(t).getSxsj(); + tdbls[t] = id + "&" + subBean.get(t).getTdbl(); + tdsxs[t] = id + "&" + subBean.get(t).getTdsx(); + } + String EffectiveDate=""; + for (int k = 0; k < sxsjs.length; k++) { + EffectiveDate=EffectiveDate+sxsjs[k]; + if(k"+EffectiveDate); + } + String SubstitRatio=""; + for (int k = 0; k < tdbls.length; k++) { + SubstitRatio=SubstitRatio+tdbls[k]; + if(k"+SubstitRatio); + } + String SubstitOrder=""; + for (int k = 0; k < tdsxs.length; k++) { + SubstitOrder=SubstitOrder+tdsxs[k]; + if(k"+SubstitOrder); + } + tccomponentbomline.cut();// ɾ + bomline.getTCProperty("JK8EffectiveDate") + .setStringValue(EffectiveDate);// ¸3Ըֵ //Чʱ +// bomline.getTCProperty("jk8EffectiveDate") +// .setStringValueArray(sxsjs);// ¸3Ըֵ //Чʱ + bomline.getTCProperty("JK8SubstitRatio") + .setStringValue(SubstitRatio); // +// bomline.getTCProperty("jk8SubstitRatio") +// .setStringValueArray(tdbls); // + bomline.getTCProperty("JK8SubstitOrder") + .setStringValue(SubstitOrder);// ˳ +// bomline.getTCProperty("jk8SubstitOrder") +// .setStringValueArray(tdsxs);// ˳ + + tableModel.removeRow(row[j]);// ɾѡ + + } catch (TCException tcexception) { + return; + } + } else { + MessageBox.post("Error", "Error", 1); + return; + } + } + } + + } + + // private void removeRelatedSubstitute(TCComponentBOMLine + // tccomponentbomline) { + // try { + // + // RelatedSubstituteComp relatedsubstitutecomp = new RelatedSubstituteComp( + // bomline.getTCProperty("bl_occurrence").getReferenceValue(), + // bomline.getTCProperty("bl_item").getReferenceValue(), + // bomline, bomline); + // System.out.println("relatedsubstitutecomp="+relatedsubstitutecomp); + // RelatedSubstituteComp arelatedsubstitutecomp[] = new + // RelatedSubstituteComp[1]; + // arelatedsubstitutecomp[0] = relatedsubstitutecomp; + // TCComponentBOMLineType tccomponentbomlinetype = (TCComponentBOMLineType) + // bomline + // .getSession().getTypeComponent("BOMLine"); + // tccomponentbomlinetype + // .removeRelatedSubstitutes(arelatedsubstitutecomp); + // } catch (Exception exception) { + // System.out.println(""); + // } + // } + +} diff --git a/src/com/connor/jk/plm/setBomline/SetBomline_Handler.java b/src/com/connor/jk/plm/setBomline/SetBomline_Handler.java new file mode 100644 index 0000000..3ed871a --- /dev/null +++ b/src/com/connor/jk/plm/setBomline/SetBomline_Handler.java @@ -0,0 +1,21 @@ +package com.connor.jk.plm.setBomline; + +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.aifrcp.AIFUtility; + +public class SetBomline_Handler extends AbstractHandler { + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + // TODO Auto-generated method stub + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + SetBomline_Action action=new SetBomline_Action(app,null); + new Thread(action).start(); + return null; + } + +} diff --git a/src/com/connor/jk/plm/setBomline/SubstituteBean.java b/src/com/connor/jk/plm/setBomline/SubstituteBean.java new file mode 100644 index 0000000..9f453ef --- /dev/null +++ b/src/com/connor/jk/plm/setBomline/SubstituteBean.java @@ -0,0 +1,42 @@ +package com.connor.jk.plm.setBomline; + +import com.teamcenter.rac.kernel.TCComponentBOMLine; + +public class SubstituteBean { + private TCComponentBOMLine sulines; + private String tdsx;// ˳ + private String sxsj;// Чʱ + private String tdbl;// + + public TCComponentBOMLine getSulines() { + return sulines; + } + + public void setSulines(TCComponentBOMLine sulines) { + this.sulines = sulines; + } + + public String getTdsx() { + return tdsx; + } + + public void setTdsx(String tdsx) { + this.tdsx = tdsx; + } + + public String getSxsj() { + return sxsj; + } + + public void setSxsj(String sxsj) { + this.sxsj = sxsj; + } + + public String getTdbl() { + return tdbl; + } + + public void setTdbl(String tdbl) { + this.tdbl = tdbl; + } +} diff --git a/src/com/connor/jk/plm/sign/JK8_JSPSPropBean.java b/src/com/connor/jk/plm/sign/JK8_JSPSPropBean.java new file mode 100644 index 0000000..2473c1e --- /dev/null +++ b/src/com/connor/jk/plm/sign/JK8_JSPSPropBean.java @@ -0,0 +1,44 @@ +package com.connor.jk.plm.sign; + +import java.util.Date; + + +public class JK8_JSPSPropBean implements Comparable{ + +// public static final int COUNT = 8; + public static final int COUNT = 9; +// public String jk8_bh = "";// "", + public String jk8_psr = "";// "", + public String jk8_jd = "";// "", + public String jk8_tcrq = "";// "", + public String jk8_wtszwz = "";// "λ",// 5 + public String jk8_wtms = "";// "", + public String jk8_jy = "";// "", + public String jk8_cljg = "";// "", + public String jk8_zt = "";// "״̬", + @Override + public int compareTo(Object o) { + // TODO Auto-generated method stub + if(o ==null){ + return 0; + } + JK8_JSPSPropBean bean = (JK8_JSPSPropBean) o; + if(this.jk8_psr == null){ + if(bean.jk8_psr!=null){ + //111 + return "".compareTo(bean.jk8_psr); + }else{ + return 0; + } + }else{ + if(bean.jk8_psr!=null){ + //111 + return this.jk8_psr.compareTo(bean.jk8_psr); + }else{ + return this.jk8_psr.compareTo(""); + } + //return this.hx3_gxhh.compareTo(bean.hx3_gxhh); + } + } + +} diff --git a/src/com/connor/jk/plm/sign/Sign_Action.java b/src/com/connor/jk/plm/sign/Sign_Action.java new file mode 100644 index 0000000..fdc1ce1 --- /dev/null +++ b/src/com/connor/jk/plm/sign/Sign_Action.java @@ -0,0 +1,115 @@ +package com.connor.jk.plm.sign; + +import java.util.HashMap; +import java.util.Map; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.common.actions.AbstractAIFAction; +import com.teamcenter.rac.aif.kernel.AIFComponentContext; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCComponentItemType; +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.util.MessageBox; + +public class Sign_Action extends AbstractAIFAction { + AbstractAIFApplication app; + TCSession session; + TCComponent formComp; + String decision; + boolean loadAddInfo=true; + TCComponentUser user; + TCComponent[] signPeople ; + Map nameDecision=new HashMap<>(); + public Sign_Action(AbstractAIFApplication arg0, String arg1) { + super(arg0, arg1); + this.app = arg0; + this.session = (TCSession) app.getSession(); + } + + @Override + public void run() { +// ڵ㲻ˣͲ󣨸parent_name + try { + if(!app.getTargetComponent().getProperty("parent_name").equals("ǩ")) {//ǩ + MessageBox.post("̽ڵ㲻ǩ","",MessageBox.INFORMATION); + return; + } + } catch (Exception e2) { + e2.printStackTrace(); + } + user=session.getUser(); + String usernamme=""; + try { + usernamme=user.getTCProperty("user_name").getStringValue(); +// usernamme=session.getUserName(); + } catch (Exception e1) { + e1.printStackTrace(); + } + try { + System.out.println(app.getTargetComponent().getType()); + } catch (Exception e1) { + MessageBox.post("ȷѾѡлǩڵ", "", MessageBox.ERROR); + return; + } +// &&(!app.getTargetComponent().getType().equals("EPMRouteTask"))EPMRouteTask +// ( !app.getTargetComponent().getType().equals("EPMPerformSignoffTask") ) + if( !app.getTargetComponent().getType().equals("EPMPerformSignoffTask")){// EPMPerformSignoffTaskEPMRouteTask + MessageBox.post("ȷѡе̽ڵ", "", MessageBox.ERROR); + return; + } else if ( app.getTargetComponent().getType().equals("EPMPerformSignoffTask") ) { + try { +// decision = ((TCComponent) app.getTargetComponent()).getTCProperty("fnd0Status").getStringValue(); + signPeople = ((TCComponent) app.getTargetComponent()).getReferenceListProperty("signoff_attachments");//fnd0ActuatedInteractiveTsks +// TCComponent[] signPeople = ((TCComponent) app.getTargetComponent()).getReferenceListProperty("valid_signoffs"); +// TCComponent[] signPeople = ((TCComponent) app.getTargetComponent()).getReferenceListProperty("signoff_attachments"); + for (int i = 0; i < signPeople.length; i++) { +// System.out.println(signPeople.length); +// System.out.println(signPeople[i].getProperty("owning_user").split(" ")[0]); +// System.out.println(signPeople[i].getTCProperty("fnd0Status").getStringValue()); +// nameDecision.put(signPeople[i].getProperty("owning_user").split(" ")[0], signPeople[i].getTCProperty("fnd0Status").getStringValue()); + if(signPeople[i].getTCProperty("object_type").getStringValue().equals("Signoff")&&signPeople[i].getProperty("owning_user").contains(usernamme)) { + decision=signPeople[i].getTCProperty("fnd0Status").getStringValue(); +// System.out.println("decision---------------->"+decision); +// if(decision.equals("׼")) { +// loadAddInfo=false; +// } + break; + } + } + + TCComponent[] components = ((TCComponent) app.getTargetComponent()) + .getReferenceListProperty("root_target_attachments"); + for (int i = 0; i < components.length; i++) { + if (components[i].getType().equals("JK8TecReviewRevision")) { + formComp = ((TCComponentItemRevision) components[i]) + .getReferenceListProperty("IMAN_master_form_rev")[0]; + break; + } + // TODO ̵itemͣȡ°汾ٽ + else if (components[i].getType().equals("JK8TecReview")) { + TCComponentItem componentItem = (TCComponentItem) components[i]; + formComp = componentItem.getLatestItemRevision() + .getReferenceListProperty("IMAN_master_form_rev")[0]; + break; + } + else if(!components[i].getType().equals("JK8TecReviewRevision")){ + MessageBox.post("ȷ̵Ǽ","",MessageBox.ERROR); + return; + } + } + } catch (Exception e) { + e.printStackTrace(); + return; + } + new Thread(new Sign_Dialog(signPeople,nameDecision,loadAddInfo,decision, session, formComp)).run(); + ; + } + + } + +} diff --git a/src/com/connor/jk/plm/sign/Sign_Dialog.java b/src/com/connor/jk/plm/sign/Sign_Dialog.java new file mode 100644 index 0000000..65d0918 --- /dev/null +++ b/src/com/connor/jk/plm/sign/Sign_Dialog.java @@ -0,0 +1,766 @@ +package com.connor.jk.plm.sign; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.swing.CellEditor; +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.JTextField; +import javax.swing.RowSorter; +import javax.swing.table.DefaultTableModel; +import javax.swing.table.TableModel; +import javax.swing.table.TableRowSorter; + +import com.connor.jk.plm.util.JkomMethodUtil; +import com.teamcenter.rac.aif.AbstractAIFDialog; +//import com.teamcenter.rac.aif.kernel.AIFComponentContext; +import com.teamcenter.rac.form.JK8_JSPSPropBean; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; + +public class Sign_Dialog extends AbstractAIFDialog { + private TCSession session; + private JPanel mainJPanel; + private JPanel tableJPanel; + private JPanel buttonJPanel; + private JPanel fillJpanel; + + private JButton saveButton; + private JButton exitButton; + private JButton delButton; + + private JLabel probLocationJLabel; + private JTextField probLocationJText; + + private JLabel probDescJLabel; + private JTextField probDescJText; + + private JLabel ProposalJLabel; + private JTextField ProposalJText; + + private JLabel TreatResultJLabel; + private JTextField TreatResultJText; + + private TCComponent formComp; + + private List valueLists; + private List myValueLists; + private List otherValueLists; + private String decision; + boolean loadAddInfo=false; + Map nameDecision; + TCComponent[] signPeople; + private int countNumber; + private boolean isRefresh = false; + //2017.9.5 ¼״̬jk8Status + public static final String[] PROP_NAMES = { // + "jk8Reviewer", "jk8Decision", "jk8ProposedDate", "jk8ProbLocation", // 4 + "jk8ProbDesc", "jk8Proposal","jk8Status", "jk8TreatResult" }; + + private TCProperty[] propertiesArray; + + private JTable jTable; + private Object[] obj = new Object[] { "", "", "", "", "λ", "", "","״̬" , "˵"}; + + public Sign_Dialog(TCComponent[] signPeople,Map nameDecision,boolean loadAddInfo,String decision, TCSession session, TCComponent formComp2) { + this.signPeople=signPeople; + this.nameDecision=nameDecision; +// this.loadAddInfo=loadAddInfo; + this.session = session; + this.formComp = formComp2; + this.decision = decision; + } + + @Override + public void run() { + this.setAlwaysOnTop(true); + initUI(); + } + + public void initUI() { + this.setPreferredSize(new Dimension(718, 600)); + this.setLayout(new BorderLayout()); +// setMaximumSize(new Dimension(1000,1000) ); +// setMinimumSize(new Dimension(80, 80) ); +// this.setSize(new Dimension(800,200)); + init(); + mainJPanel = new JPanel(new BorderLayout()); +// mainJPanel = new JPanel(new PropertyLayout()); +// mainJPanel.setSize(new Dimension(800, 800)); + +// buttonJPanel = new JPanel(new BorderLayout()); + buttonJPanel = new JPanel(new FlowLayout()); + buttonJPanel.add(saveButton); + buttonJPanel.add(new JLabel(" ")); + buttonJPanel.add(delButton); + buttonJPanel.add(new JLabel(" ")); + buttonJPanel.add(exitButton); +// buttonJPanel=new JPanel(new PropertyLayout()); +// buttonJPanel.add("1.1.left.top",saveButton); +// buttonJPanel.add("1.2.left.top",new JLabel(" ")); +// buttonJPanel.add("1.3.left.top",delButton); +// buttonJPanel.add("1.4.left.top",new JLabel(" ")); +// buttonJPanel.add("1.5.left.top",exitButton); + + fillJpanel = new JPanel(new PropertyLayout()); + probLocationJLabel = new JLabel(" λ"); + int x=55; + probLocationJText = new JTextField(x); + + probDescJLabel = new JLabel(" "); + probDescJText = new JTextField(x); + + ProposalJLabel = new JLabel(" "); + ProposalJText = new JTextField(x); + + TreatResultJLabel = new JLabel(" ˵"); + TreatResultJText = new JTextField(x); + + if(!problemLocation.trim().equals("")&&reload==true) { + + probLocationJText.setText(problemLocation); + } + if(!problemDesc.trim().equals("")&&reload==true) { + + probDescJText.setText(problemDesc); + } + if(!Proposal.trim().equals("")&&reload==true) { + + ProposalJText.setText(Proposal); + } + reload=false; + fillJpanel.add("1.1.left.top", probLocationJLabel); + fillJpanel.add("1.2.left.top", probLocationJText); + + fillJpanel.add("2.1.left.top", probDescJLabel); + fillJpanel.add("2.2.left.top", probDescJText); + + fillJpanel.add("3.1.left.top", ProposalJLabel); + fillJpanel.add("3.2.left.top", ProposalJText); + + if(loadAddInfo ==false) { + saveButton.setEnabled(false); + probLocationJText.setEditable(false); + probDescJText.setEditable(false); + ProposalJText.setEditable(false); + + } +// fillJpanel.add("4.1.left.top", TreatResultJLabel); +// fillJpanel.add("4.2.left.top", TreatResultJText); + + mainJPanel.add(tableJPanel, BorderLayout.NORTH); + mainJPanel.add(fillJpanel, BorderLayout.CENTER); + mainJPanel.add(buttonJPanel, BorderLayout.SOUTH); +// mainJPanel.add("1.1.left.top",tableJPanel); +// mainJPanel.add("2.1.left.top",fillJpanel); +// mainJPanel.add("3.1.left.top",buttonJPanel); + + this.add(mainJPanel, BorderLayout.CENTER); + + // ȡǰ״̬ + // this.setAlwaysOnTop(true); + this.setVisible(true); + this.centerToScreen(); + this.pack(); + System.out.println(valueLists.size()); + } + + public void init() { + if (isRefresh == true) { + this.remove(mainJPanel); + isRefresh = false; + } +// int a = 1; + // valueLists = new ArrayList(); + try { + getFormVlue(); + } catch (Exception e1) { + e1.printStackTrace(); + } + tableJPanel = new JPanel(new BorderLayout()); + tableJPanel.setSize(718,200); +// tableJPanel.setSize(200, 200); +// this.jTable.setSize(new Dimension(200, 200)); + + this.jTable = getjTable(this.jTable, null, obj, null); + jTable.setDefaultRenderer(Object.class, new TableComboxRender()); + tableJPanel.add(new JScrollPane(this.jTable), BorderLayout.CENTER); + int rowCount = this.jTable.getRowCount(); + Object[][] values = new Object[valueLists.size()][9]; + countNumber = 0; + for (int i = 0; i < valueLists.size(); i++) { + countNumber++; + values[i][0] = countNumber + "";// + values[i][1] = valueLists.get(i).jk8_psr;// + values[i][2] = valueLists.get(i).jk8_jd;// + values[i][3] = valueLists.get(i).jk8_tcrq;// + values[i][4] = valueLists.get(i).jk8_wtszwz;// λ + values[i][5] = valueLists.get(i).jk8_wtms;// + values[i][6] = valueLists.get(i).jk8_jy;// + values[i][7] = valueLists.get(i).jk8_zt;// ״̬ + values[i][8] = valueLists.get(i).jk8_cljg;// ˵ + } + for (int i = rowCount - 1; i >= 0; i--) { + ((DefaultTableModel) this.jTable.getModel()).removeRow(i); + } + for (int i = 0; i < values.length; i++) { + if (values[i][1] != null) { + ((DefaultTableModel) this.jTable.getModel()).addRow(values[i]); + } + } + // if(a==1){ + // return; + // } + saveButton = new JButton("ύ"); + this.getRootPane().setDefaultButton(saveButton);// õǰĬѡаť + saveButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + saveWLProps(); + if(isCheckedOut==false) { + + setAlwaysOnTop(true); + initUI(); + } +// if (problemLocation.equals("") || problemDesc.equals("") || Proposal.equals("") ) { +// setAlwaysOnTop(false); +// MessageBox.post("ȷλáд", "", MessageBox.INFORMATION); +// }else { +// +// saveWLProps(); +// setAlwaysOnTop(true); +// initUI(); +// } + // exit(); + } + }); + delButton = new JButton("ɾ"); + delButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { +// delRow(e); + saveWLProps2(); + initUI(); + } + }); + exitButton = new JButton("˳"); + exitButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + exit(); + } + }); + + } + + public void exit() { + this.disposeDialog(); + this.dispose(); + } + + protected void addRow(ActionEvent e) { + countNumber++; + JK8_JSPSPropBean bean = new JK8_JSPSPropBean(); + bean.jk8_psr = session.getUserName(); + // ȡϵͳǰʱ䣬ұȽ + Calendar calendar = Calendar.getInstance(); + String year = String.valueOf(calendar.get(Calendar.YEAR));// ȡ + String month = String.valueOf(calendar.get(Calendar.MONTH) + 1);// ȡ· + String day = String.valueOf(calendar.get(Calendar.DATE));// ȡ + String today = year + "/" + month + "/" + day; + bean.jk8_tcrq = today; + bean.jk8_jd = decision; + Object[] objs = new Object[] { countNumber + "", bean.jk8_psr, bean.jk8_jd, bean.jk8_tcrq, bean.jk8_wtszwz, + bean.jk8_wtms, bean.jk8_jy,bean.jk8_zt, bean.jk8_cljg }; + valueLists.add(bean); + ((DefaultTableModel) this.jTable.getModel()).addRow(objs); + + ((DefaultTableModel) this.jTable.getModel()).fireTableStructureChanged(); + ((DefaultTableModel) this.jTable.getModel()).fireTableDataChanged(); + + } + + protected void delRow(ActionEvent arg0) { + int index = jTable.getSelectedRow(); + if (index == -1) { + MessageBox.post("ѡִɾ", "", MessageBox.INFORMATION); + return; + } + String userName=""; + try { + userName=session.getUser().getTCProperty("user_name").getStringValue(); + System.out.println("userName--->"+userName); + } catch (TCException e) { + e.printStackTrace(); + } + if (valueLists.get(index).jk8_psr != userName) { + MessageBox.post("ֻɾԼĻǩѡִɾ", "", MessageBox.INFORMATION); + return; + } + valueLists.remove(index); + System.out.println("ɾvalueLists-----"+valueLists.size()); +// ((DefaultTableModel) this.jTable.getModel()).removeRow(index); +// ((DefaultTableModel) this.jTable.getModel()).fireTableStructureChanged(); +// ((DefaultTableModel) this.jTable.getModel()).fireTableDataChanged(); + // scrollPanel.validate(); + + } + + // Jtableͨ÷ + public JTable getjTable(JTable partsTable, DefaultTableModel dtm, Object[] titleNames, Object[][] values) { + int simpleLen = 105; + int totleLen = 700; + if (partsTable == null) { + partsTable = new JTable(getTableModel(dtm, titleNames, values)) { + @Override + public boolean isCellEditable(int row, int column) { + return false; + } + }; +// partsTable.setAutoResizeMode(2); +// partsTable.setRowHeight(110, 20); + partsTable.setRowHeight(20);//и +// partsTable.setSize(new Dimension(200, 200)); +// partsTable.setBounds(100, 10, 2000, 200); + // partsTable.setAlignmentX(partsTable.getRowHeight()/2); +// partsTable.setAlignmentY(partsTable.getRowHeight()/2); + if (simpleLen * titleNames.length >= totleLen) { + for (int i = 0; i < titleNames.length; i++) { + partsTable.getColumnModel().getColumn(i).setPreferredWidth(100); + if(i==0) { + + partsTable.getColumnModel().getColumn(i).setPreferredWidth(40); + }else if(i==1||i==2) { + partsTable.getColumnModel().getColumn(i).setPreferredWidth(60); + + }else if(i==3) { + partsTable.getColumnModel().getColumn(i).setPreferredWidth(80); + + }else if(i==8) { + partsTable.getColumnModel().getColumn(i).setPreferredWidth(60); + + } + } + partsTable.setAutoResizeMode(0); + } else { + partsTable.setAutoResizeMode(0);//0Զ1 + } + } + return partsTable; + } + + // tableؼ + public DefaultTableModel getTableModel(DefaultTableModel dtm, Object[] columnNameObjects, Object[][] objects) { + if (dtm == null) { + dtm = new DefaultTableModel(objects, columnNameObjects); + } + return dtm; + } + + /** + * FORMʱȡ + * + * @throws Exception + */ + public void getFormVlue() throws Exception { + for (int i = 0; i < signPeople.length; i++) { + if(signPeople[i].getTCProperty("fnd0AliasTaskName").getStringValue().equals("ǩ : ǩ")) { + + nameDecision.put(signPeople[i].getProperty("owning_user").split(" ")[0], signPeople[i].getTCProperty("fnd0Status").getStringValue()); + } + } + if(nameDecision.containsValue("׼")&&nameDecision.containsValue("")) { + loadAddInfo=true; + } + if(!nameDecision.containsValue("")) { + loadAddInfo=false; + } + if(!nameDecision.containsValue("׼")) { + loadAddInfo=true; + } + try { + this.formComp.refresh();//Dzִд˲裬ܸ£ͬ + } catch (Exception e1) { + MessageBox.post("ȷ㷢̵ĶǼİ汾","",MessageBox.INFORMATION); + e1.printStackTrace(); + } + + this.valueLists = new ArrayList(); + + try { + // ȡֵ + propertiesArray = formComp.getTCProperties(PROP_NAMES); + // дֵԵ + if (propertiesArray != null) { + String[] valueStrs0 = propertiesArray[0] == null ? new String[0] + : propertiesArray[0].getStringArrayValue();//еֵ + String[] valueStrs1 = propertiesArray[1] == null ? new String[0] + : propertiesArray[1].getStringArrayValue(); + String[] valueStrs2 = propertiesArray[2] == null ? new String[0] + : propertiesArray[2].getStringArrayValue(); + String[] valueStrs3 = propertiesArray[3] == null ? new String[0] + : propertiesArray[3].getStringArrayValue(); + String[] valueStrs4 = propertiesArray[4] == null ? new String[0] + : propertiesArray[4].getStringArrayValue(); + String[] valueStrs5 = propertiesArray[5] == null ? new String[0] + : propertiesArray[5].getStringArrayValue(); + String[] valueStrs6 = propertiesArray[6] == null ? new String[0] + : propertiesArray[6].getStringArrayValue(); + String[] valueStrs7 = propertiesArray[7] == null ? new String[0] + : propertiesArray[7].getStringArrayValue();//״̬ + + if (valueStrs0.length == valueStrs1.length && valueStrs0.length == valueStrs2.length + && valueStrs0.length == valueStrs3.length && valueStrs0.length == valueStrs4.length + && valueStrs0.length == valueStrs5.length && valueStrs0.length == valueStrs6.length + && valueStrs0.length == valueStrs7.length + && valueStrs0.length != 0) { + for (int i = 0; i < valueStrs0.length; i++) { + JK8_JSPSPropBean bean = new JK8_JSPSPropBean(); + + bean.jk8_psr = valueStrs0[i];// "", + bean.jk8_jd = valueStrs1[i];// "", + bean.jk8_tcrq = valueStrs2[i];// "", + bean.jk8_wtszwz = valueStrs3[i];// "λ",// 5 + bean.jk8_wtms = valueStrs4[i];// "", + bean.jk8_jy = valueStrs5[i];// "", + bean.jk8_zt = valueStrs6[i];// "״̬", + bean.jk8_cljg = valueStrs7[i];// "˵", + +// if(loadAddInfo==false&& valueStrs0[i]==session.getUserName()) { +// bean.jk8_jd=decision; +// } + + if(nameDecision.containsKey(bean.jk8_psr)) { + bean.jk8_jd=nameDecision.get(bean.jk8_psr); + } +// System.out.println(bean.jk8_psr); + this.valueLists.add(bean); + } + } + } + // Collections.sort(this.valueLists); + } catch (TCException e) { + e.printStackTrace(); + } + + } + + private String reviewer = ""; + private String proposedDate = ""; + private String problemLocation = ""; + private String problemDesc = ""; + private String Proposal = ""; + private String TreatResult = ""; + + public void submitInfomation() { + try { + reviewer = this.session.getUser().getTCProperty("user_name").getStringValue(); + } catch (TCException e) { + e.printStackTrace(); + } + // ȡϵͳǰʱ + Calendar calendar = Calendar.getInstance(); + String year = String.valueOf(calendar.get(Calendar.YEAR));// ȡ + String month = String.valueOf(calendar.get(Calendar.MONTH) + 1);// ȡ· + String day = String.valueOf(calendar.get(Calendar.DATE));// ȡ + proposedDate = year + "/" + month + "/" + day; + problemLocation = probLocationJText.getText().trim(); + problemDesc = probDescJText.getText().trim(); + Proposal = ProposalJText.getText().trim(); + TreatResult = TreatResultJText.getText().trim(); + + } + + /** + * + */ + private boolean reload=false; + boolean isCheckedOut=false; + public void saveWLProps() { + try { +// formComp.refresh(); + if(formComp.getStringProperty("checked_out").equals("Y")) { + isCheckedOut=true; + }else { + isCheckedOut=false; + } + } catch (TCException e) { + e.printStackTrace(); + } + try { + if(isCheckedOut==true) { + setAlwaysOnTop(false); + MessageBox.post("汾"+formComp.getProperty("checked_out_user")+"ǨϵǨǨٱ档","",MessageBox.INFORMATION); + disposeDialog(); + dispose(); +// return; + } + } catch (SecurityException e4) { + // TODO Auto-generated catch block + e4.printStackTrace(); + } catch (TCException e4) { + // TODO Auto-generated catch block + e4.printStackTrace(); + } + System.out.println(isCheckedOut); + if(isCheckedOut==false) { + + try { + this.formComp.lock(); + } catch (TCException e3) { + e3.printStackTrace(); + }//ֹûͬʱ + isRefresh = true; + submitInfomation(); + if (problemLocation.equals("") || problemDesc.equals("") || Proposal.equals("") ) { + this.setAlwaysOnTop(false); + reload=true; + MessageBox.post("ȷλáд", "", MessageBox.INFORMATION); + return; + } + try { + getFormVlue(); + } catch (Exception e2) { + e2.printStackTrace(); + } + // ѵǰǩ˵ʷǩ¼ȡ + JK8_JSPSPropBean bean0 = new JK8_JSPSPropBean(); + + bean0.jk8_psr = reviewer;// "", + System.out.println("--------------------------------"+reviewer); + bean0.jk8_jd = decision;// "", + System.out.println("---------------ľ-----------------"+decision); + bean0.jk8_tcrq = proposedDate;// "", + bean0.jk8_wtszwz = problemLocation;// "λ",// 5 + bean0.jk8_wtms = problemDesc;// "", + bean0.jk8_jy = Proposal;// "", + bean0.jk8_zt = "";// "״̬", + bean0.jk8_cljg = TreatResult;// "˵", + + this.valueLists.add(bean0); +// int count = 0; + // if(count==0){ + // return; + // } + // /** + String[] valueStrs0 = new String[valueLists.size()];// + String[] valueStrs1 = new String[valueLists.size()];// + String[] valueStrs2 = new String[valueLists.size()];// + String[] valueStrs3 = new String[valueLists.size()];// λ + String[] valueStrs4 = new String[valueLists.size()];// + String[] valueStrs5 = new String[valueLists.size()];// + String[] valueStrs6 = new String[valueLists.size()];// ״̬ + String[] valueStrs7 = new String[valueLists.size()];// ˵ + + for (int i = 0; i < valueLists.size(); i++) { + JK8_JSPSPropBean bean = valueLists.get(i); + valueStrs0[i] = bean.jk8_psr == null ? "" : bean.jk8_psr; + valueStrs1[i] = bean.jk8_jd == null ? "" : bean.jk8_jd; + valueStrs2[i] = bean.jk8_tcrq == null ? "" : bean.jk8_tcrq; + valueStrs3[i] = bean.jk8_wtszwz == null ? "" : bean.jk8_wtszwz; + valueStrs4[i] = bean.jk8_wtms == null ? "" : bean.jk8_wtms; + valueStrs5[i] = bean.jk8_jy == null ? "" : bean.jk8_jy; + System.out.println(bean.jk8_jy+"-------------->"+bean.jk8_jy.length()); + if(bean.jk8_jy.length()>256) { + this.setAlwaysOnTop(false); + reload=true; + MessageBox.post("ܳ256","",MessageBox.INFORMATION); + return; + } + valueStrs6[i] = bean.jk8_zt == null ? "" : bean.jk8_zt;//״̬ + valueStrs7[i] = bean.jk8_cljg == null ? "" : bean.jk8_cljg;//˵ + } + if(reload==true) { + return; + } + // **/ + + // try { + // JkomMethodUtil.setByPass(true); + // } catch (TCException e2) { + // e2.printStackTrace(); + // } + try { + // if (propertiesArray[0] != null) + propertiesArray[0].setStringValueArray(valueStrs0); + // if (propertiesArray[1] != null) + propertiesArray[1].setStringValueArray(valueStrs1); + // if (propertiesArray[2] != null) + propertiesArray[2].setStringValueArray(valueStrs2); + // if (propertiesArray[3] != null) + propertiesArray[3].setStringValueArray(valueStrs3); + // if (propertiesArray[4] != null) + propertiesArray[4].setStringValueArray(valueStrs4); + // if (propertiesArray[5] != null) + propertiesArray[5].setStringValueArray(valueStrs5); + // if (propertiesArray[6] != null) + propertiesArray[6].setStringValueArray(valueStrs6); + propertiesArray[7].setStringValueArray(valueStrs7); + + formComp.setTCProperties(propertiesArray); + + } catch (TCException e) { + e.printStackTrace(); + } catch (Exception e1) { + e1.printStackTrace(); + } + // try { + // JkomMethodUtil.setByPass(false); + // } catch (TCException e2) { + // e2.printStackTrace(); + // } + try { + this.formComp.unlock(); + } catch (TCException e) { + e.printStackTrace(); + } + System.out.println(valueLists.size()); + } + + + } + + + //ɾĿ󣬱һ + public void saveWLProps2() { + try { + this.formComp.lock(); + } catch (TCException e3) { + e3.printStackTrace(); + }//ֹûͬʱ + isRefresh = true; +// submitInfomation(); +// if (problemLocation.equals("") || problemDesc.equals("") || Proposal.equals("") ) { +// this.setAlwaysOnTop(false); +// MessageBox.post("ȷλáд", "", MessageBox.ERROR); +// return; +// } + try { + getFormVlue(); + } catch (Exception e2) { + e2.printStackTrace(); + } + // ѵǰǩ˵ʷǩ¼ȡ +// JK8_JSPSPropBean bean0 = new JK8_JSPSPropBean(); +// +// bean0.jk8_psr = reviewer;// "", +// System.out.println("--------------------------------"+reviewer); +// bean0.jk8_jd = decision;// "", +// System.out.println("---------------ľ-----------------"+decision); +// bean0.jk8_tcrq = proposedDate;// "", +// bean0.jk8_wtszwz = problemLocation;// "λ",// 5 +// bean0.jk8_wtms = problemDesc;// "", +// bean0.jk8_jy = Proposal;// "", +// bean0.jk8_cljg = TreatResult;// "", +// +// this.valueLists.add(bean0); +// int count = 0; + // if(count==0){ + // return; + // } + // /** + int index = jTable.getSelectedRow(); + if (index == -1) { + this.setAlwaysOnTop(false); + MessageBox.post("ѡִɾ", "", MessageBox.INFORMATION); + return; + } + String userName=""; + try { + userName=session.getUser().getTCProperty("user_name").getStringValue(); + System.out.println("userName--->"+userName); + } catch (TCException e) { + e.printStackTrace(); + } + if (valueLists.get(index).jk8_psr != userName) { + this.setAlwaysOnTop(false); + MessageBox.post("ֻɾԼĻǩѡִɾ", "", MessageBox.INFORMATION); + return; + }else { + + valueLists.remove(index); + } + String[] valueStrs0 = new String[valueLists.size()];// + String[] valueStrs1 = new String[valueLists.size()];// + String[] valueStrs2 = new String[valueLists.size()];// + String[] valueStrs3 = new String[valueLists.size()];// λ + String[] valueStrs4 = new String[valueLists.size()];// + String[] valueStrs5 = new String[valueLists.size()];// + String[] valueStrs6 = new String[valueLists.size()];// ״̬ + String[] valueStrs7 = new String[valueLists.size()];// ˵ + + for (int i = 0; i < valueLists.size(); i++) { + JK8_JSPSPropBean bean = valueLists.get(i); + valueStrs0[i] = bean.jk8_psr == null ? "" : bean.jk8_psr; + valueStrs1[i] = bean.jk8_jd == null ? "" : bean.jk8_jd; + valueStrs2[i] = bean.jk8_tcrq == null ? "" : bean.jk8_tcrq; + valueStrs3[i] = bean.jk8_wtszwz == null ? "" : bean.jk8_wtszwz; + valueStrs4[i] = bean.jk8_wtms == null ? "" : bean.jk8_wtms; + valueStrs5[i] = bean.jk8_jy == null ? "" : bean.jk8_jy; + valueStrs6[i] = bean.jk8_zt == null ? "" : bean.jk8_zt; + valueStrs7[i] = bean.jk8_cljg == null ? "" : bean.jk8_cljg;//˵ + } + // **/ + + // try { + // JkomMethodUtil.setByPass(true); + // } catch (TCException e2) { + // e2.printStackTrace(); + // } + try { + // if (propertiesArray[0] != null) + propertiesArray[0].setStringValueArray(valueStrs0); + // if (propertiesArray[1] != null) + propertiesArray[1].setStringValueArray(valueStrs1); + // if (propertiesArray[2] != null) + propertiesArray[2].setStringValueArray(valueStrs2); + // if (propertiesArray[3] != null) + propertiesArray[3].setStringValueArray(valueStrs3); + // if (propertiesArray[4] != null) + propertiesArray[4].setStringValueArray(valueStrs4); + // if (propertiesArray[5] != null) + propertiesArray[5].setStringValueArray(valueStrs5); + // if (propertiesArray[6] != null) + propertiesArray[6].setStringValueArray(valueStrs6); + propertiesArray[7].setStringValueArray(valueStrs7); + + formComp.setTCProperties(propertiesArray); + + } catch (TCException e) { + e.printStackTrace(); + } catch (Exception e1) { + e1.printStackTrace(); + } + // try { + // JkomMethodUtil.setByPass(false); + // } catch (TCException e2) { + // e2.printStackTrace(); + // } + try { + this.formComp.unlock(); + } catch (TCException e) { + e.printStackTrace(); + } +System.out.println(valueLists.size()); + } + +} diff --git a/src/com/connor/jk/plm/sign/Sign_Handler.java b/src/com/connor/jk/plm/sign/Sign_Handler.java new file mode 100644 index 0000000..4567c36 --- /dev/null +++ b/src/com/connor/jk/plm/sign/Sign_Handler.java @@ -0,0 +1,17 @@ +package com.connor.jk.plm.sign; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.teamcenter.rac.aifrcp.AIFUtility; + +public class Sign_Handler extends AbstractHandler { + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + new Thread(new Sign_Action(AIFUtility.getCurrentApplication(), null)).run();; + return null; + } + +} diff --git a/src/com/connor/jk/plm/sign/TableComboxRender.java b/src/com/connor/jk/plm/sign/TableComboxRender.java new file mode 100644 index 0000000..5b74c51 --- /dev/null +++ b/src/com/connor/jk/plm/sign/TableComboxRender.java @@ -0,0 +1,92 @@ +package com.connor.jk.plm.sign; + +import java.awt.Color; +import java.awt.Component; +import java.awt.Font; +//import java.awt.event.ItemListener; +//import java.awt.event.MouseAdapter; +//import java.awt.event.MouseEvent; +//import java.util.ArrayList; +//import java.util.HashMap; +//import java.util.Map; + +//import javax.swing.JComboBox; +import javax.swing.JComponent; +import javax.swing.JTable; +import javax.swing.JTextArea; +import javax.swing.table.TableCellRenderer; + +/** + * @author duchao + * + */ +class TableComboxRender extends JComponent implements TableCellRenderer { + /** + * + */ + private static final long serialVersionUID = 1L; +// private JComboBox combox = null; + private JTextArea text; + private JTextArea text1; +// private Map comboxMap = new HashMap<>(); + + public TableComboxRender() { + + } + + int index4 = 0; + + @Override + public Component getTableCellRendererComponent(final JTable jtable, + Object obj, boolean isSelected, boolean hasFocus, final int row, + final int column) { + JComponent component1 = null; +// JComponent component0 = null; + if (column == 0) { + text1 = new JTextArea(); + text1.setText(obj != null ? obj.toString() : ""); + text1.setEditable(false); + component1 = text1; + } + + text = new JTextArea(); + text.setText(obj != null ? obj.toString() : ""); + text.setEditable(false); + component1 = text; + // 趨 + Font fp = new Font("΢ź", Font.PLAIN, 12); + Font fb = new Font("΢ź", Font.BOLD, 13); + if (isSelected) { + // TODO ȡ +// ChangeDbomDialogInput.inputButton.setEnabled(true); +// ChangeDbomDialogInput.selectedId = text1.getText(); + component1.setFont(fb); + + } else { + component1.setFont(fp); + } + // 趨ɫ + if (isSelected) { + + // 2.õǰCellɫ + Color mycolor2 = new Color(10, 36, 106); + component1.setBackground(mycolor2);// ñɫ + // component1.setBackground(mycolor);// ñɫ + component1.setForeground(Color.WHITE);// ǰɫ + } else { + + // 3.õУżеɫ + Color mycolor = new Color(232, 242, 254); + if (row % 2 == 0) {// żʱɫ + component1.setBackground(mycolor); + component1.setForeground(Color.BLACK);// ǰɫ + } else if (row % 2 == 1) {// õеɫ + component1.setBackground(Color.WHITE); + component1.setForeground(Color.BLACK);// ǰɫ + } + } + + + return component1; + } +} \ No newline at end of file diff --git a/src/com/connor/jk/plm/sqb/DataBaseControl.java b/src/com/connor/jk/plm/sqb/DataBaseControl.java new file mode 100644 index 0000000..15896c1 --- /dev/null +++ b/src/com/connor/jk/plm/sqb/DataBaseControl.java @@ -0,0 +1,193 @@ +package com.connor.jk.plm.sqb; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.HashMap; +import java.util.Vector; + +public class DataBaseControl { + + /** ************************ݿ:*********************************** */ + /** + * kelsen .... + */ + Connection conn; + + ResultSet rs; + + PreparedStatement pstmt; + + Statement stmt; + + String strUrl, strUserName, strPassword, strSQLQuery, strDriver; + + public String str_Information=""; + + + /** + * + */ + public DataBaseControl(String strDriver, String strUrl, String strUserName, + String strPassword) { + this.strDriver = strDriver; // "oracle.jdbc.driver.OracleDriver";// + this.strUrl = strUrl; // "jdbc:oracle:thin:@127.0.0.1:1521:tceng";//· + this.strUserName = strUserName; // "infodba";//ݿû + this.strPassword = strPassword; // "infodba";//ݿ + // strSQLQuery="select * from LABELID";//ѯ + + // + try { + Class.forName(strDriver);// ͨڴ + } catch (ClassNotFoundException cnfe) { + cnfe.printStackTrace(); + } + } + + /** + * + * @param strSQLQuery + */ + public void dbModify(String strSQLQuery) { + + openDataBase(); + + try { + stmt = conn.createStatement(); + stmt.executeUpdate(strSQLQuery); + } catch (SQLException sqle2) { + sqle2.printStackTrace(); + } + + closeDataBase(); + } + + /** + * ѯ + * @param strSQLQuery + * @return + */ + public ResultSet dbQuery(String strSQLQuery) { + ResultSet rs_result = null; + if (conn == null) + openDataBase(); + try { + stmt = conn.createStatement(); + rs_result = stmt.executeQuery(strSQLQuery); + + } catch (SQLException sqle2) { + sqle2.printStackTrace(); + } + return rs_result; + } + + /** + * + * + */ + public void openDataBase() { + try { + //this.strUrl="jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.29)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=tcprod)))"; + if (conn == null || conn.isClosed()) + conn = DriverManager.getConnection(strUrl, strUserName, + strPassword); + } catch (SQLException sqle) { + sqle.printStackTrace(); + } + } + + /** + * رݿ + * + */ + public void closeDataBase() { + try { + if (rs != null) { + try { + rs.close(); + } catch (SQLException sqlec) { + sqlec.printStackTrace(); + } + } + if (conn != null && !conn.isClosed()) { + try { + conn.close(); + } catch (SQLException sqlecon) { + sqlecon.printStackTrace(); + } + + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * 䴫ݿвѯ + * ѯõĽÿһ¼װһHashMap,keyԱֶ + * ѯ¼VectorжٸHasnMapԪ + * @param strSQLQuery + * @return + * @author xuk + */ + public Vector orgQuery(String strSQLQuery){ + openDataBase(); + Vector v_result=new Vector(); + try{ + ResultSet rs_get=dbQuery(strSQLQuery); +// System.out.println("RS_GET:"+rs_get); + if(rs_get!=null){ + ResultSetMetaData metaData = rs_get.getMetaData(); + + int i_ColumnCount=metaData.getColumnCount(); +// System.out.println("i_ColumnCount:"+i_ColumnCount); + while(rs_get.next()){ +// System.out.println("BJZJ2"+rs_get.getString("BJZJ2"));; + HashMap hm_unit=new HashMap(); + for(int i=1;i<=i_ColumnCount;i++){ + hm_unit.put(metaData.getColumnName(i), rs_get.getString(i)); +// System.out.println("metaData.getColumnName(i):"+metaData.getColumnName(i)); +// System.out.println("rs_get.getString(i):"+rs_get.getString(i)); + } + v_result.add(hm_unit); + } + }else{ + str_Information=""+strSQLQuery+""+"ѯĽΪ\n"; + } + }catch(Exception e){ + e.printStackTrace(); + } + return v_result; + } + + + /** + * + * @param args + */ + public static void main(String args[]) { + try{ + /*String str_DataBaseDriver = "oracle.jdbc.driver.OracleDriver"; + String str_URL = "jdbc:oracle:thin:@origin-667aaf64:1521:TCENG"; + String str_UserName = "kelsen"; + String str_Password = "kelsen"; + DataBaseControl dbc = new DataBaseControl(str_DataBaseDriver, str_URL, + str_UserName, str_Password); + String str_Query=" select * from YLCSB where YLZCID='000001' and YLZCBBH='A'"; + Vector v_get=dbc.orgQuery(str_Query); + System.out.println("v_get:"+v_get.size()); + for(int i=0;i realNameMap;// ѡֵ +// private DataBaseControl dbc = null; + private String[] sbhall;// ʶ + private String[] cpxhall;// Ʒͺ + private String allSBH = ""; + private String allCPXH = ""; + + public Generate_Operation(AbstractAIFApplication app) { +// this.app = app; + this.targetComp = app.getTargetComponent(); + this.session = (TCSession) app.getSession(); + this.type = targetComp.getType(); + String[] names =null; + System.out.println("Generate_Operation type is:"+type); + if(type!=null && (type.equals("JK8WarnrNPINOAppForm")||type.equals("JK8WarnrModINAppForm"))){ + names = session.getPreferenceService().getStringValues("JK_WARNER_SQB_GZ"); + }else{ + names = session.getPreferenceService().getStringValues("JK_SQB_GZ"); + } + if (names != null) { + realNameMap = new HashMap<>(); + for (int i = 0; i < names.length; i++) { + String[] s = names[i].split(":"); + if (s != null && s.length == 2) { + String key = s[0]; + String value = s[1]; + realNameMap.put(key, value); + } else { + MessageBox.post("ѡ JK_SQB_GZ ôϵԱ", "", MessageBox.ERROR); + return; + } + + } + + } else { + MessageBox.post("ѡ JK_SQB_GZ ڣϵԱ", "", MessageBox.ERROR); + } + TCPreferenceService pref = session.getPreferenceService(); + String puid = pref.getStringValue("JK_SQB_FORM_PUID");// ѡpuid + if (puid == null) { + MessageBox.post("ѡδҵϵԱ", "", MessageBox.ERROR); + } + + TCComponentForm formAll; + try { + formAll = (TCComponentForm) session.stringToComponent(puid); + if (formAll == null) { + MessageBox.post("δҵϵԱ", "", MessageBox.ERROR); + } + + sbhall = formAll.getTCProperty("jk8ProductIdentifyNO").getStringArrayValue(); + cpxhall = formAll.getTCProperty("jk8ProductModNO").getStringArrayValue(); + + if (sbhall != null) + for (String s : sbhall) { + allSBH = allSBH + s + ","; // ʶһַ + } + if (cpxhall != null) + for (String s : cpxhall) { + allCPXH = allCPXH + s + "&"; // вƷͺһַ + } + + } catch (Exception e) { + // Auto-generated catch block + e.printStackTrace(); + } + } + + @Override + public void executeOperation() throws Exception { + // Auto-generated method stub + if (targetComp instanceof TCComponentForm) { + form = (TCComponentForm) targetComp; + } else { + MessageBox.post("ѡбִв", "", 0); + return; + } + GetLsmUtil ge = new GetLsmUtil(); + String xh = "";// ͺ + String sbh = "";// ʶ + if ("JK8NPModINOAppForm".equals(type)) {// "²Ʒͺšʶ"; +// String sbh_old = form.getTCProperty("jk8ProductIdentifyNO").getStringValue();// ʶ + // if (sbh_old != null && !sbh_old.equals("")) { + // MessageBox.post("ʶѴ޷ظ", "ʾ", MessageBox.INFORMATION); + // return; + // } + String str_jcb = form.getTCProperty("jk8ApplyType").getStringValue();// ѡ + String jbcj = form.getTCProperty("jk8BMManufactor").getStringValue();// / + String cplx2 = form.getTCProperty("jk8ProductType").getStringValue();// Ʒ + String gzqzj = form.getTCProperty("jk8ContrlCompType").getStringValue();// + + String jbcj_gz = setVal(jbcj, "/"); + String cplx2_gz = setVal(cplx2, "Ʒ"); + String gzqzj_gz = setVal(gzqzj, ""); + sbh = jbcj_gz + cplx2_gz + gzqzj_gz; + // GetLsmUtil getlsm=new GetLsmUtil(); + // sbh = getlsm.getLsm("sbhlsm", sbh, "00");//getCodeNumber(sbh, 6, + // 1, 99, 1, ""); + + for (int i = 0; i < 99; i++) { + String str = ge.getLsm("sbhlsm", sbh, "00");// getCodeNumber(sbh, + // 6, 1, 99, 1, ""); + if (!allSBH.contains(str)) { + sbh = str; + System.out.println("sbh=" + sbh); + break; + } + } + + if (str_jcb.equals("ȼƷͺϢǼ")) { + String cplx1 = form.getTCProperty("jk8ProductType1").getStringValue();// Ʒ1 + String jlylfl = form.getTCProperty("jk8MeasureType").getStringValue();// ԭ + String jbwklx = form.getTCProperty("jk8BaseMeterShellType").getStringValue();// + String sfklc = form.getTCProperty("jk8WideRange").getStringValue();// + String ickyfgn = form.getTCProperty("jk8ICCardPrepaidFunc").getStringValue();// ICԤ + String wlwgn = form.getTCProperty("jk8InternetOfThingFunc").getStringValue(); // + String wybcgn = form.getTCProperty("jk8TempPressCompFunc").getStringValue(); // ¶ѹ + String abgn = form.getTCProperty("jk8SecurityFunc").getStringValue(); // + + String llgg = ""; + if (cplx1.equals("ñ")) { + llgg = form.getTCProperty("jk8CivilMeter").getStringValue();// ñ + } else if (cplx1.equals("ҵ")) { + llgg = form.getTCProperty("jk8IndustrialMater").getStringValue();// ҵ + } else if (cplx1.equals("")) { + llgg = form.getTCProperty("jk8FowMeter").getStringValue();// + } + String jlylfl_gz = setVal(jlylfl, "ԭ"); + String jbwklx_gz = setVal(jbwklx, ""); + String sfklc_gz = setVal(sfklc, ""); + String ickyfgn_gz = setVal(ickyfgn, "ICԤ"); + String wlwgn_gz = setVal(wlwgn, ""); + String wybcgn_gz = setVal(wybcgn, "¶ѹ"); + String abgn_gz = setVal(abgn, ""); + xh = "JG" + jlylfl_gz; + if (!wlwgn_gz.equals("")) {// ͨŷʽ()ICԤܺ󵽼ʽ 2019.7.16 + xh = xh + "-" + wlwgn_gz; + } + xh = xh + llgg + sfklc_gz + jbwklx_gz; + if (!ickyfgn_gz.equals("")) { + xh = xh + "-" + ickyfgn_gz; + } + if (!wybcgn_gz.equals("")) { + xh = xh + "-" + wybcgn_gz; + } + if (!abgn_gz.equals("")) { + xh = xh + "-" + abgn_gz; + } + if (cplx1.equals("ñ") || cplx1.equals("ҵ")) { + for (int i = 0; i < 99; i++) { + String str = ge.getLsm4("cpxhlsm", xh, null);// getCodeNumber(sbh, + // 6, 1, 99, + // 1, ""); + if (!allCPXH.contains(str)) { + xh = str; + System.out.println("xh=" + xh); + break; + } + } + + } + + } else if (str_jcb.equals("ɼƷͺϢǼ")) { + // String txms = form.getTCProperty("jk8CommunicateMode") + // .getStringValue();// ͨģʽ + // String wglx = form.getTCProperty("jk8ShellType") + // .getStringValue();// + // String txms_gz = setVal(txms, "ͨģʽ"); + // String wglx_gz = setVal(wglx, ""); + // xh = "JP" + txms_gz + wglx_gz; + if ("ɼ".equals(cplx2)) { + xh = sbh; + } else { + MessageBox.post("ʧ,ѡƷɼ", "", MessageBox.ERROR); + return; + } + + } else if (str_jcb.equals("еƷͺϢǼ")) { + if ("Ĥʽ".equals(cplx2)) { + String blx = form.getTCProperty("jk8MeterTypeShellMaterial").getStringValue();// ͼ + String llgg = form.getTCProperty("jk8FlowSpecification").getStringValue();// + form.getTCProperty("jk8ProductType1").setStringValue("tb1");// + String bmc_gz = setVal(blx, "ȼƴ"); + String gtcl_gz = setVal(blx, ""); + xh = bmc_gz + llgg + gtcl_gz; + } else { + MessageBox.post("ʧ,ѡƷе", "", MessageBox.ERROR); + return; + } + + } else if (str_jcb.equals("")) { + + if ((!"".equals(cplx2)) && (!"ʽ".equals(cplx2)) && (!"".equals(cplx2)) && (!"".equals(cplx2)) + && (!"Ĥʽ".equals(cplx2)) && (!"ɼ".equals(cplx2))) {// "".equals(cplx2) || + // "".equals(cplx2)|| + // "ֵ".equals(cplx2) || + // "ֳֻ".equals(cplx2)|| + // "ģ".equals(cplx2) + xh = sbh; + } else { + MessageBox.post("ʧ,ѡƷͲ", "", MessageBox.ERROR); + } + } + + boolean is = isha(sbh); + if (is) { + MessageBox.post("òƷʶ²ƷͺŵǼDZѴڣȷдȷ", "", MessageBox.ERROR); + return; + } + + if (!xh.equals("")) {// && !sbh.equals("") + form.getTCProperty("jk8ProductModNO").setStringValue(xh);// Ʒͺ +// form.getTCProperty("jk8ProductIdentifyNO").setStringValue(sbh);// ʶ + MessageBox.post("ͺʶ,鿴", "ʾ", MessageBox.INFORMATION); + } else { + MessageBox.post("ͺʶʧ,", "", MessageBox.ERROR); + } + + } + // + else if ("JK8WarnrModINAppForm".equals(type)) { + + if (true) { + //洢Form + ArrayList formList = new ArrayList(); + + String qtzl = form.getTCProperty("jk8Gas").getStringValue();// ̽ + String sycs = form.getTCProperty("jk8ApplicationPlace").getStringValue();// Ӧó + + // 2020-03-25 + String sccj = form.getTCProperty("jk8Manufacturer").getStringValue();// + String cplx = form.getTCProperty("jk8ProductType").getStringValue();// Ʒ + String txfs2 = form.getTCProperty("jk8CommunicateMode2").getStringValue();// ͨŷʽ2 + + /* String productName = form.getTCProperty("jk8ProductName").getStringValue(); // Ʒ + String projectName = form.getTCProperty("jk8ProjectName").getStringValue(); // Ŀ + String projectID = form.getTCProperty("jk8ProjectNO").getStringValue(); // Ŀ + */ + + String gdfs = form.getTCProperty("jk8PowerSupplyMode").getStringValue(); // 緽ʽ + String scxh = form.getTCProperty("jk8OutputSignal").getStringValue(); // ź + String txfs = form.getTCProperty("jk8CommunicateMode").getStringValue(); // ͨŷʽ + + formList.add(sycs); + formList.add(qtzl); + formList.add(sccj); + formList.add(cplx); + formList.add(txfs2); + + //ʶŲ + + String qtzl_gz = setVal(qtzl, "̽"); + String sycs_gz = setVal(sycs, "Ӧó"); + String sccj_gz = setVal(sccj, ""); + String cplx_gz = setVal(cplx, "Ʒ"); + String txfs2_gz = setVal(txfs2, "ͨŷʽ2"); + + + String gdfs_gz = setVal(gdfs, "緽ʽ"); + String scxh_gz = setVal(scxh, "ź"); + String txfs_gz = setVal(txfs, "ͨŷʽ"); + + String xhtzm = sycs_gz + qtzl_gz + "-" + sccj_gz + cplx_gz + txfs2_gz; + + for (int i = 0; i < 9; i++) { + String str = ge.getLsm6("cpxhlsm", xhtzm, "0");// getCodeNumber(sbh, + // 6, 1, 99, + // 1, ""); + if (!allCPXH.contains(str)) { + xh = str; + System.out.println("xh=" + xh); + break; + } + } + String sbhtzm = gdfs_gz + scxh_gz + txfs_gz ; + for (int i = 0; i < 99; i++) { + String str = ge.getLsm("sbhlsm", sbhtzm, "00");// getCodeNumber(sbh, + // 6, 1, 99, 1, ""); + if (!allSBH.contains(str)) { + sbh = str; + System.out.println("sbh=" + sbh); + break; + } + } + + } + + // ͺ = Ӧó + ̽ + + Ʒ + ͨŷʽ + ˮ + + + if (!xh.equals("")) { + form.getTCProperty("jk8ProductModNO").setStringValue(xh);// Ʒͺ + form.getTCProperty("jk8ProductIdentifyNO").setStringValue(sbh);// ʶ + MessageBox.post("ͺ,鿴", "ʾ", MessageBox.INFORMATION); + } else { + MessageBox.post("ͺʧ,", "", MessageBox.ERROR); + } + + } + // ʶ + else if ("JK8WarnrNPINOAppForm".equals(type)) { + + if (true) { + //洢Form + ArrayList formList = new ArrayList(); + + //String qtzl = form.getTCProperty("jk8Gas").getStringValue();// ̽ + //String sycs = form.getTCProperty("jk8ApplicationPlace").getStringValue();// Ӧó + + // 2020-03-25 + //String sccj = form.getTCProperty("jk8Manufacturer").getStringValue();// + //String cplx = form.getTCProperty("jk8ProductType").getStringValue();// Ʒ + //String txfs2 = form.getTCProperty("jk8CommunicateMode2").getStringValue();// ͨŷʽ2 + + //String productName = form.getTCProperty("jk8ProductName").getStringValue(); // Ʒ + //String projectName = form.getTCProperty("jk8ProjectName").getStringValue(); // Ŀ + //String projectID = form.getTCProperty("jk8ProjectNO").getStringValue(); // Ŀ + + + String gdfs = form.getTCProperty("jk8PowerSupplyMode").getStringValue(); // 緽ʽ + String scxh = form.getTCProperty("jk8OutputSignal").getStringValue(); // ź + String txfs = form.getTCProperty("jk8CommunicateMode").getStringValue(); // ͨŷʽ + + //String cpxh = form.getTCProperty("jk8ProductModNO").getStringValue(); // Ʒͺ + // String sbh_old = form.getTCProperty("jk8ProductIdentifyNO").getStringValue(); // Ʒʶ + + +// formList.add(cpxh); +// formList.add(productName); +// formList.add(projectName); +// formList.add(projectID); +// formList.add(qtzl); +// formList.add(sycs); +// formList.add(sccj); +// formList.add(cplx); +// formList.add(txfs2); + formList.add(gdfs); + formList.add(scxh); + formList.add(txfs); + + String gdfsT = setVal(gdfs, "緽ʽ"); + String scxhT = setVal(scxh, "ź"); + String txfsT = setVal(txfs, "ͨŷʽ"); + + String sbhtzm = gdfsT + scxhT + txfsT; + for (int i = 0; i < 99; i++) { + String str = ge.getLsm("sbhlsm", sbhtzm, "00");// getCodeNumber(sbh, + // 6, 1, 99, 1, ""); + if (!allSBH.contains(str)) { + sbh = str; + System.out.println("sbh=" + sbh); + break; + } + } + //ʶ + + //sbh = gdfsT + scxhT + txfsT + resLsm ; + + } + // ʶ = 緽ʽ + ź + ͨŷʽ + ˮ + + if (!sbh.equals("")) { + + form.getTCProperty("jk8ProductIdentifyNO").setStringValue(sbh);// ʶ + MessageBox.post("ʶ,鿴", "ʾ", MessageBox.INFORMATION); + } else { + MessageBox.post("ʶʧ,", "", MessageBox.ERROR); + } + + } else if ("JK8NewPIdenNOAppForm".equals(type)) {// "²Ʒʶ"; +// String sbh_old = form.getTCProperty("jk8ProductIdentifyNO").getStringValue();// ʶ + // if (sbh_old != null && !sbh_old.equals("")) { + // MessageBox.post("ʶѴ޷ظ", "ʾ", MessageBox.INFORMATION); + // return; + // } + xh = form.getTCProperty("jk8ProductModNO").getStringValue();// Ʒͺ + + String jbcj = form.getTCProperty("jk8BMManufactor").getStringValue();// / + String cplx2 = form.getTCProperty("jk8ProductType_select").getStringValue();// Ʒ + String gzqzj = form.getTCProperty("jk8ContrlCompType").getStringValue();// + String lsm = form.getTCProperty("jk8SerialCode").getStringValue();// ˮ + String jbcj_gz = setVal(jbcj, "/"); + String cplx2_gz = setVal(cplx2, "Ʒ"); + String gzqzj_gz = setVal(gzqzj, ""); + String lsm_gz = setVal(lsm, "ˮ"); + sbh = jbcj_gz + cplx2_gz + gzqzj_gz +lsm_gz; + // GetLsmUtil getlsm=new GetLsmUtil(); + // sbh = getlsm.getLsm("sbhlsm", sbh, "00");// + // sbh = getCodeNumber(sbh, 6, 1, 99, 1, ""); +// for (int i = 0; i < 99; i++) { +// String str = ge.getLsm("sbhlsm", sbh, "00");// getCodeNumber(sbh, +// // 6, 1, 99, 1, ""); +// if (!allSBH.contains(str)) { +// sbh = str; +// System.out.println("sbh=" + sbh); +// break; +// } +// } + + boolean is = isha(sbh); + if (is) { + MessageBox.post("òƷʶ²ƷͺŵǼDZѴڣȷдȷ", "", MessageBox.ERROR); + return; + } + + if (!sbh.equals("")) { + form.getTCProperty("jk8ProductIdentifyNO").setStringValue(sbh);// ʶ + MessageBox.post("ʶ,鿴", "ʾ", MessageBox.INFORMATION); + } else { + MessageBox.post("ʶʧ,", "", MessageBox.ERROR); + } + + } else if ("JK8ExtPIdenNOAppForm".equals(type)) {//TODO չʶ +// String sbh_old = form.getTCProperty("jk8ProductIdentifyNO").getStringValue();// ʶ + // if (sbh_old != null && !sbh_old.equals("")) { + // MessageBox.post("ʶѴ޷ظ", "ʾ", MessageBox.INFORMATION); + // return; + // } +// Jjk8BMManufactor +// D : jk8ProductType Ʒ +// 01 : jk8ContrlCompType +// 02 jk8SerialCode ˮ + String oldsbh = form.getTCProperty("jk8BaseIdentifyNO").getStringValue();// ׼ʶ + xh = form.getTCProperty("jk8ProductModNO").getStringValue();// Ʒͺ + + String jbcj_gz = setVal(form.getTCProperty("jk8BMManufactor").getStringValue(), "/"); +// String cplx2 = form.getTCProperty("jk8ProductType").getStringValue();// Ʒjk8ProductType_select setVal(cplx2, "Ʒ") + String gzqzj = form.getTCProperty("jk8ContrlCompType").getStringValue();// +// String jk8SerialCode = form.getTCProperty("jk8SerialCode").getStringValue();// ˮ + String gzqzj_gz = setVal(gzqzj, ""); + +// if (oldsbh != null && oldsbh.length() > 1) { +//// String cplx = oldsbh.substring(1,2); +// String lsm = oldsbh.substring(4,6); +// sbh = jbcj_gz + oldsbh.substring(1) + gzqzj_gz + lsm; +// } + sbh = jbcj_gz + oldsbh.substring(1, 2) + gzqzj_gz + oldsbh.substring(4, 6); + + // GetLsmUtil getlsm=new GetLsmUtil(); + // sbh = getlsm.getLsm("sbhlsm", sbh, "00");// + // sbh = getCodeNumber(sbh, 6, 1, 99, 1, ""); + + boolean is = isha(sbh); + if (is) { + MessageBox.post("òƷʶ²ƷͺŵǼDZѴڣȷдȷ", "", MessageBox.ERROR); + return; + } + + if (!sbh.equals("")) { + form.getTCProperty("jk8ProductIdentifyNO").setStringValue(sbh);// ʶ + MessageBox.post("ʶ,鿴", "ʾ", MessageBox.INFORMATION); + } else { + MessageBox.post("ʶʧ,", "", MessageBox.ERROR); + } + + } else if ("JK8DerPIdenNOAppForm".equals(type)) {// "Ʒʶ"; +// String sbh_old = form.getTCProperty("jk8ProductIdentifyNO").getStringValue();// ʶ + // if (sbh_old != null && !sbh_old.equals("")) { + // MessageBox.post("ʶѴ޷ظ", "ʾ", MessageBox.INFORMATION); + // return; + // } + // xh=form.getTCProperty("jk_xcp_cpxh").getStringValue(); + sbh = form.getTCProperty("jk8BaseIdentifyNO").getStringValue();// ׼ʶ + +// String end = ""; +// if (sbh.endsWith("S") || sbh.endsWith("W")) { +// end = sbh.substring(sbh.length() - 1, sbh.length()); +// sbh = sbh.substring(0, sbh.length() - 1); +// +// } +// String[] sp = sbh.split("."); +// if (sp != null && sp.length == 2) { +// sbh = sp[0]; +// } + //sbh = sbh + "."; + // GetLsmUtil getlsm=new GetLsmUtil(); + // sbh = getlsm.getLsm("sbhlsm", sbh, "00");// + // sbh = getCodeNumber(sbh, 9, 1, 99, 1, ""); + for (int i = 0; i < 99; i++) { + String str = ge.getLsm("sbhlsm", sbh, "00");// getCodeNumber(sbh, + // 6, 1, 99, 1, ""); + if (!allSBH.contains(str)) { + sbh = str; + System.out.println("sbh=" + sbh); + break; + } + } +// sbh = sbh + end; + boolean is = isha(sbh); + if (is) { + MessageBox.post("òƷʶ²ƷͺŵǼDZѴڣȷдȷ", "", MessageBox.ERROR); + return; + } + + if (!sbh.equals("")) { + form.getTCProperty("jk8ProductIdentifyNO").setStringValue(sbh);// ʶform + form.refresh(); + MessageBox.post("ʶ,鿴", "ʾ", MessageBox.INFORMATION); + } else { + MessageBox.post("ʶʧ,", "", MessageBox.ERROR); + } + + } else if ("JK8SpecPINOAppForm".equals(type)) {// "ҪƷʶ"; +// String sbh_old = form.getTCProperty("jk8ProductIdentifyNO").getStringValue();// ʶ + // if (sbh_old != null && !sbh_old.equals("")) { + // MessageBox.post("ʶѴ޷ظ", "ʾ", MessageBox.INFORMATION); + // return; + // } + // xh=form.getTCProperty("jk_xcp_cpxh").getStringValue(); + sbh = form.getTCProperty("jk8BaseIdentifyNO").getStringValue();// ׼ʶ + String tsyq = form.getTCProperty("jk8SpecRequirements").getStringValue();// Ҫ + String tsyq_gz = setVal(tsyq, "Ҫ"); + sbh = sbh + tsyq_gz; + boolean is = isha(sbh); + if (is) { + MessageBox.post("òƷʶ²ƷͺŵǼDZѴڣȷдȷ", "", MessageBox.ERROR); + return; + } + if (!sbh.equals("")) { + form.getTCProperty("jk8ProductIdentifyNO").setStringValue(sbh);// ʶ + MessageBox.post("ʶ,鿴", "ʾ", MessageBox.INFORMATION); + } else { + MessageBox.post("ʶʧ,", "", MessageBox.ERROR); + } + + } else if ("JK8CotlerPModAppForm".equals(type)) {// "Ʒͺ"; + + String type = form.getTCProperty("jk8InduOrCivil").getStringValue();// + System.out.println("type=" + type); + String jbcj = form.getTCProperty("jk8BMManufactor").getStringValue();// + + String txfs = form.getTCProperty("jk8CommunicateMode").getStringValue(); // ͨŷʽ() + + String gczj = form.getTCProperty("jk8NomDiameter").getStringValue(); // ֱ + + String jbcj_gz = setVal(jbcj, "/"); + String txfs_gz = setVal(txfs, ""); + String gczj_gz = setVal(gczj, "ֱ"); + + if ("ñ".equals(type)) { + xh = "EI" + jbcj_gz + txfs_gz + "."; + + for (int i = 0; i < 99; i++) { + String str = ge.getLsm("cpxhlsm", xh, "00");// getCodeNumber(sbh, + // 6, 1, 99, + // 1, ""); + if (!allCPXH.contains(str)) { + xh = str; + System.out.println("xh=" + xh); + break; + } + } + } else { + xh = "JGC" + txfs_gz + gczj_gz; + + } + + if (!xh.equals("")) { + form.getTCProperty("jk8ProductModNO").setStringValue(xh);// ʶ + MessageBox.post("Ʒͺ,鿴", "ʾ", MessageBox.INFORMATION); + } else { + MessageBox.post("Ʒͺʧ,", "", MessageBox.ERROR); + } + + } else if ("JK8ColPIdenNOAppForm".equals(type)) {// "ʶ"; + +// String sbh_old = form.getTCProperty("jk8ProductIdentifyNO").getStringValue();// ʶ + // if (sbh_old != null && !sbh_old.equals("")) { + // MessageBox.post("ʶѴ޷ظ", "ʾ", MessageBox.INFORMATION); + // return; + // } + // xh=form.getTCProperty("jk_xcp_cpxh").getStringValue(); + String fmlx = form.getTCProperty("jk8ValveType").getStringValue();// + String txfs = form.getTCProperty("jk8CommunicateMode").getStringValue();// ͨŷʽ + String gdfs = form.getTCProperty("jk8PowerSupplyMode").getStringValue();// 緽ʽ + + String jbcj_gz = setVal(fmlx, ""); + String txfs_gz = setVal(txfs, "ͨŷʽ"); + String gdfs_gz = setVal(gdfs, "緽ʽ"); + + sbh = "JK/C" + jbcj_gz + txfs_gz + gdfs_gz; + for (int i = 0; i < 99; i++) { + String str = ge.getLsm5("sbhlsm", sbh, "00");//// רtest + + if (!allCPXH.contains(str)) { + sbh = str; + System.out.println("sbh=" + sbh); + break; + } + } + + if (!sbh.equals("")) { + form.getTCProperty("jk8ProductIdentifyNO").setStringValue(sbh);// ʶ + MessageBox.post("ʶ,鿴", "ʾ", MessageBox.INFORMATION); + } else { + MessageBox.post("ʶʧ,", "", MessageBox.ERROR); + } + form.refresh(); + + } else { + MessageBox.post("ѡƷͺʶִв", "", MessageBox.ERROR); + } + + } + + private boolean isha(String sbh) { + if (!sbh.equals("")) { + if (sbhall != null) + for (String s : sbhall) { + if (sbh.equals(s)) { + System.out.println("ͬʶ"); + return true; + } + } + } + return false; + } + + private String setVal(String key, String Allkey) { + // TODO Auto-generated method stub + String[] all = realNameMap.get(Allkey).split(","); + HashMap Map_all = new HashMap<>(); + for (int i = 0; i < all.length; i++) { + System.out.println("ss=" + all[i]); + Map_all.put(all[i].split("=")[0], all[i].split("=")[1]); + } + if (Map_all.containsKey(key)) { + System.out.println(Allkey + "=" + Map_all.get(key)); + return Map_all.get(key).trim(); + } else { + System.out.println(Allkey + "="); + return ""; + } + + } + + public String getCodeNumber(String patternCode, int codeLength, int startIndex, int maxValue, int increaseStep, + String excludeStr) { + + TCUserService userService = session.getUserService(); + + codeLength = String.valueOf(maxValue).length(); + Object[] params = { patternCode.trim(), codeLength, startIndex, maxValue, increaseStep, excludeStr }; + + try { + String str = ""; + str = (String) userService.call("queryPartNo", params); + return str; + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + +} diff --git a/src/com/connor/jk/plm/sqb/Generate_OperationNew.java b/src/com/connor/jk/plm/sqb/Generate_OperationNew.java new file mode 100644 index 0000000..6931673 --- /dev/null +++ b/src/com/connor/jk/plm/sqb/Generate_OperationNew.java @@ -0,0 +1,615 @@ +package com.connor.jk.plm.sqb; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.HashMap; + +import com.connor.jk.plm.createproject.GetLsmUtil; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.AbstractAIFOperation; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.kernel.TCUserService; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.Registry; + +//ʶšƷͺ +public class Generate_OperationNew extends AbstractAIFOperation { + private AbstractAIFApplication app; + private InterfaceAIFComponent targetComp; + private TCSession session; + private String type; + private TCComponentForm form; + private HashMap realNameMap;// ѡֵ + private DataBaseControl dbc = null; + private String[] sbhall;// ʶ + private String[] cpxhall;// Ʒͺ + private String allSBH = ""; + private String allCPXH = ""; + + public Generate_OperationNew(AbstractAIFApplication app) { + this.app = app; + this.targetComp = app.getTargetComponent(); + this.session = (TCSession) app.getSession(); + this.type = targetComp.getType(); + String[] names = session.getPreferenceService().getStringValues( + "JK_SQB_GZ"); + if (names != null) { + realNameMap = new HashMap<>(); + for (int i = 0; i < names.length; i++) { + String[] s = names[i].split(":"); + if (s != null && s.length == 2) { + String key = s[0]; + String value = s[1]; + realNameMap.put(key, value); + } else { + MessageBox.post("ѡ JK_SQB_GZ ôϵԱ", "", + MessageBox.ERROR); + return; + } + + } + + } else { + MessageBox + .post("ѡ JK_SQB_GZ ڣϵԱ", "", MessageBox.ERROR); + } + TCPreferenceService pref = session.getPreferenceService(); + String puid = pref.getStringValue("JK_SQB_FORM_PUID");// ѡpuid + if (puid == null) { + MessageBox.post("ѡδҵϵԱ", "", MessageBox.ERROR); + } + + TCComponentForm formAll; + try { + formAll = (TCComponentForm) session.stringToComponent(puid); + if (formAll == null) { + MessageBox.post("δҵϵԱ", "", MessageBox.ERROR); + } + + sbhall = formAll.getTCProperty("jk8ProductIdentifyNO") + .getStringArrayValue(); + cpxhall = formAll.getTCProperty("jk8ProductModNO") + .getStringArrayValue(); + + if (sbhall != null) + for (String s : sbhall) { + allSBH = allSBH + s + ","; // ʶһַ + } + if (cpxhall != null) + for (String s : cpxhall) { + allCPXH = allCPXH + s + "&"; // вƷͺһַ + } + + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + @Override + public void executeOperation() throws Exception { + // TODO Auto-generated method stub + if (targetComp instanceof TCComponentForm) { + form = (TCComponentForm) targetComp; + } else { + MessageBox.post("ѡбִв", "", 0); + return; + } + GetLsmUtil ge = new GetLsmUtil(); + String xh = "";// ͺ + String sbh = "";// ʶ + if ("JK8NPModINOAppForm".equals(type)) {// "²Ʒͺšʶ"; + String sbh_old = form.getTCProperty("jk8ProductIdentifyNO") + .getStringValue();// ʶ + // if (sbh_old != null && !sbh_old.equals("")) { + // MessageBox.post("ʶѴ޷ظ", "ʾ", MessageBox.INFORMATION); + // return; + // } + String str_jcb = form.getTCProperty("jk8ApplyType") + .getStringValue();// ѡ + String jbcj = form.getTCProperty("jk8BMManufactor") + .getStringValue();// / + String cplx2 = form.getTCProperty("jk8ProductType") + .getStringValue();// Ʒ + String gzqzj = form.getTCProperty("jk8ContrlCompType") + .getStringValue();// + + String jbcj_gz = setVal(jbcj, "/"); + String cplx2_gz = setVal(cplx2, "Ʒ"); + String gzqzj_gz = setVal(gzqzj, ""); + sbh = jbcj_gz + cplx2_gz + gzqzj_gz; + // GetLsmUtil getlsm=new GetLsmUtil(); + // sbh = getlsm.getLsm("sbhlsm", sbh, "00");//getCodeNumber(sbh, 6, + // 1, 99, 1, ""); + + for (int i = 0; i < 99; i++) { + String str = ge.getLsm("sbhlsm", sbh, "00");// getCodeNumber(sbh, + // 6, 1, 99, 1, ""); + if (!allSBH.contains(str)) { + sbh = str; + System.out.println("sbh=" + sbh); + break; + } + } + + if (str_jcb.equals("ȼƷͺϢǼ")) { + String cplx1 = form.getTCProperty("jk8ProductType1") + .getStringValue();// Ʒ1 + String jlylfl = form.getTCProperty("jk8MeasureType") + .getStringValue();// ԭ + String jbwklx = form.getTCProperty("jk8BaseMeterShellType") + .getStringValue();// + String sfklc = form.getTCProperty("jk8WideRange") + .getStringValue();// + String ickyfgn = form.getTCProperty("jk8ICCardPrepaidFunc") + .getStringValue();// ICԤ + String wlwgn = form.getTCProperty("jk8InternetOfThingFunc") + .getStringValue(); // + String wybcgn = form.getTCProperty("jk8TempPressCompFunc") + .getStringValue(); // ¶ѹ + String abgn = form.getTCProperty("jk8SecurityFunc") + .getStringValue(); // + + String llgg = ""; + if (cplx1.equals("ñ")) { + llgg = form.getTCProperty("jk8CivilMeter").getStringValue();// ñ + } else if (cplx1.equals("ҵ")) { + llgg = form.getTCProperty("jk8IndustrialMater") + .getStringValue();// ҵ + } else if (cplx1.equals("")) { + llgg = form.getTCProperty("jk8FowMeter").getStringValue();// + } + String jlylfl_gz = setVal(jlylfl, "ԭ"); + String jbwklx_gz = setVal(jbwklx, ""); + String sfklc_gz=setVal(sfklc, ""); + String ickyfgn_gz = setVal(ickyfgn, "ICԤ"); + String wlwgn_gz = setVal(wlwgn, ""); + String wybcgn_gz = setVal(wybcgn, "¶ѹ"); + String abgn_gz = setVal(abgn, ""); + xh = "JG" + jlylfl_gz; + if (!wlwgn_gz.equals("")) {//ͨŷʽ()ICԤܺ󵽼ʽ 2019.7.16 + xh = xh + "-" + wlwgn_gz; + } + xh= xh+ llgg +sfklc_gz+ jbwklx_gz; + if (!ickyfgn_gz.equals("")) { + xh = xh + "-" + ickyfgn_gz; + } + if (!wybcgn_gz.equals("")) { + xh = xh + "-" + wybcgn_gz; + } + if (!abgn_gz.equals("")) { + xh = xh + "-" + abgn_gz; + } + if (cplx1.equals("ñ") || cplx1.equals("ҵ")) { + for (int i = 0; i < 99; i++) { + String str = ge.getLsm4("cpxhlsm", xh, null);// getCodeNumber(sbh, + // 6, 1, 99, + // 1, ""); + if (!allCPXH.contains(str)) { + xh = str; + System.out.println("xh=" + xh); + break; + } + } + + } + + } else if (str_jcb.equals("ɼƷͺϢǼ")) { + // String txms = form.getTCProperty("jk8CommunicateMode") + // .getStringValue();// ͨģʽ + // String wglx = form.getTCProperty("jk8ShellType") + // .getStringValue();// + // String txms_gz = setVal(txms, "ͨģʽ"); + // String wglx_gz = setVal(wglx, ""); + // xh = "JP" + txms_gz + wglx_gz; + if ("ɼ".equals(cplx2)) { + xh = sbh; + } else { + MessageBox + .post("ʧ,ѡƷɼ", "", MessageBox.ERROR); + return; + } + + } else if (str_jcb.equals("еƷͺϢǼ")) { + if ("Ĥʽ".equals(cplx2)) { + String blx = form + .getTCProperty("jk8MeterTypeShellMaterial") + .getStringValue();// ͼ + String llgg = form.getTCProperty("jk8FlowSpecification") + .getStringValue();// + form.getTCProperty("jk8ProductType1").setStringValue("tb1");// + String bmc_gz = setVal(blx, "ȼƴ"); + String gtcl_gz = setVal(blx, ""); + xh = bmc_gz + llgg + gtcl_gz; + } else { + MessageBox + .post("ʧ,ѡƷе", "", MessageBox.ERROR); + return; + } + + } else if (str_jcb.equals("")) { + + + if ((!"".equals(cplx2))&&(!"ʽ".equals(cplx2))&&(!"".equals(cplx2))&&(!"".equals(cplx2))&&(!"Ĥʽ".equals(cplx2))&&(!"ɼ".equals(cplx2))) {//"".equals(cplx2) || "".equals(cplx2)|| "ֵ".equals(cplx2) || "ֳֻ".equals(cplx2)|| "ģ".equals(cplx2) + xh = sbh; + } else { + MessageBox + .post("ʧ,ѡƷͲ", "", MessageBox.ERROR); + } + } + + boolean is=isha(sbh); + if(is){ + MessageBox.post("òƷʶ²ƷͺŵǼDZѴڣȷдȷ", + "", MessageBox.ERROR); + return; + } + + + if (!xh.equals("") && !sbh.equals("")) { + form.getTCProperty("jk8ProductModNO").setStringValue(xh);// Ʒͺ + form.getTCProperty("jk8ProductIdentifyNO").setStringValue(sbh);// ʶ + MessageBox.post("ͺʶ,鿴", "ʾ", MessageBox.INFORMATION); + } else { + MessageBox.post("ͺʶʧ,", "", MessageBox.ERROR); + } + + } + // + else if ("JK8ALPModAppForm".equals(type)) {// ""; + /* + * String sbh_old = form.getTCProperty("jk8ProductIdentifyNO") + * .getStringValue();// ʶ + * + * String jbcj = form.getTCProperty("jk8BMManufactor") .getStringValue();// + * / String cplx2 = form.getTCProperty("jk8ProductType") + * .getStringValue();// Ʒ String gzqzj = + * form.getTCProperty("jk8ContrlCompType") .getStringValue();// + * + * String jbcj_gz = setVal(jbcj, "/"); String cplx2_gz = setVal(cplx2, + * "Ʒ"); String gzqzj_gz = setVal(gzqzj, ""); sbh = jbcj_gz + cplx2_gz + * + gzqzj_gz; // GetLsmUtil getlsm=new GetLsmUtil(); // sbh = + * getlsm.getLsm("sbhlsm", sbh, "00");//getCodeNumber(sbh, 6, // 1, 99, 1, ""); + * + * for (int i = 0; i < 99; i++) { String str = ge.getLsm("sbhlsm", sbh, "00");// + * getCodeNumber(sbh, // 6, 1, 99, 1, ""); if (!allSBH.contains(str)) { sbh = + * str; System.out.println("sbh=" + sbh); break; } } + */ + + if (true) {// Ʒͺ + String qtzl = form.getTCProperty("jk8GasType").getStringValue();// + String sycs = form.getTCProperty("jk8UsePlace").getStringValue();// ʹó + String bjbf = form.getTCProperty("jk8AlaDectRelation").getStringValue();// ⲿֵĹϵ + String scxh = form.getTCProperty("jk8OutputSignal").getStringValue();// ź + String cptzh = form.getTCProperty("jk8ProFeatNum").getStringValue();// Ʒ + + String qtzl_gz = setVal(qtzl, ""); + String sycs_gz = setVal(sycs, "ʹó"); + String bjbf_gz = setVal(bjbf, "ⲿֵĹϵ"); + String scxh_gz = setVal(scxh, "ź"); + String cptzh_gz = setVal(cptzh, "Ʒ"); + xh = "JKB" + qtzl_gz + sycs_gz + bjbf_gz + scxh_gz + "-" + cptzh_gz; + + } + + /* + * boolean is=isha(sbh); if(is){ + * MessageBox.post("òƷʶ²ƷͺŵǼDZѴڣȷдȷ", "", MessageBox.ERROR); + * return; } + */ + + if (!xh.equals("")) { + form.getTCProperty("jk8ProductModNO").setStringValue(xh);// Ʒͺ + // form.getTCProperty("jk8ProductIdentifyNO").setStringValue(sbh);// ʶ + MessageBox.post("ͺ,鿴", "ʾ", MessageBox.INFORMATION); + } else { + MessageBox.post("ͺʧ,", "", MessageBox.ERROR); + } + + } + + + else if ("JK8NewPIdenNOAppForm".equals(type)) {// "²Ʒʶ"; + String sbh_old = form.getTCProperty("jk8ProductIdentifyNO") + .getStringValue();// ʶ + // if (sbh_old != null && !sbh_old.equals("")) { + // MessageBox.post("ʶѴ޷ظ", "ʾ", MessageBox.INFORMATION); + // return; + // } + xh = form.getTCProperty("jk8ProductModNO").getStringValue();// Ʒͺ + + String jbcj = form.getTCProperty("jk8BMManufactor") + .getStringValue();// / + String cplx2 = form.getTCProperty("jk8ProductType_select") + .getStringValue();// Ʒ + String gzqzj = form.getTCProperty("jk8ContrlCompType") + .getStringValue();// + String jbcj_gz = setVal(jbcj, "/"); + String cplx2_gz = setVal(cplx2, "Ʒ"); + String gzqzj_gz = setVal(gzqzj, ""); + sbh = jbcj_gz + cplx2_gz + gzqzj_gz; + // GetLsmUtil getlsm=new GetLsmUtil(); + // sbh = getlsm.getLsm("sbhlsm", sbh, "00");// + // sbh = getCodeNumber(sbh, 6, 1, 99, 1, ""); + for (int i = 0; i < 99; i++) { + String str = ge.getLsm("sbhlsm", sbh, "00");// getCodeNumber(sbh, + // 6, 1, 99, 1, ""); + if (!allSBH.contains(str)) { + sbh = str; + System.out.println("sbh=" + sbh); + break; + } + } + + boolean is=isha(sbh); + if(is){ + MessageBox.post("òƷʶ²ƷͺŵǼDZѴڣȷдȷ", + "", MessageBox.ERROR); + return; + } + + if (!sbh.equals("")) { + form.getTCProperty("jk8ProductIdentifyNO").setStringValue(sbh);// ʶ + MessageBox.post("ʶ,鿴", "ʾ", MessageBox.INFORMATION); + } else { + MessageBox.post("ʶʧ,", "", MessageBox.ERROR); + } + + } else if ("JK8ExtPIdenNOAppForm".equals(type)) {// "²Ʒʶ Ҳͬ"; + String sbh_old = form.getTCProperty("jk8ProductIdentifyNO") + .getStringValue();// ʶ + // if (sbh_old != null && !sbh_old.equals("")) { + // MessageBox.post("ʶѴ޷ظ", "ʾ", MessageBox.INFORMATION); + // return; + // } + String oldsbh = form.getTCProperty("jk8BaseIdentifyNO") + .getStringValue();// ׼ʶ + xh = form.getTCProperty("jk8ProductModNO").getStringValue();// Ʒͺ + + String jbcj = form.getTCProperty("jk8BMManufactor") + .getStringValue();// / + String cplx2 = form.getTCProperty("jk8ProductType_select") + .getStringValue();// Ʒ + String gzqzj = form.getTCProperty("jk8ContrlCompType") + .getStringValue();// + String jbcj_gz = setVal(jbcj, "/"); + + if (oldsbh != null && oldsbh.length() > 1) { + sbh = jbcj_gz + oldsbh.substring(1); + } + + // GetLsmUtil getlsm=new GetLsmUtil(); + // sbh = getlsm.getLsm("sbhlsm", sbh, "00");// + // sbh = getCodeNumber(sbh, 6, 1, 99, 1, ""); + + boolean is=isha(sbh); + if(is){ + MessageBox.post("òƷʶ²ƷͺŵǼDZѴڣȷдȷ", + "", MessageBox.ERROR); + return; + } + + if (!sbh.equals("")) { + form.getTCProperty("jk8ProductIdentifyNO").setStringValue(sbh);// ʶ + MessageBox.post("ʶ,鿴", "ʾ", MessageBox.INFORMATION); + } else { + MessageBox.post("ʶʧ,", "", MessageBox.ERROR); + } + + } else if ("JK8DerPIdenNOAppForm".equals(type)) {// "Ʒʶ"; + String sbh_old = form.getTCProperty("jk8ProductIdentifyNO") + .getStringValue();// ʶ + // if (sbh_old != null && !sbh_old.equals("")) { + // MessageBox.post("ʶѴ޷ظ", "ʾ", MessageBox.INFORMATION); + // return; + // } + // xh=form.getTCProperty("jk_xcp_cpxh").getStringValue(); + sbh = form.getTCProperty("jk8BaseIdentifyNO").getStringValue();// ׼ʶ + String end = ""; + if (sbh.endsWith("S") || sbh.endsWith("W")) { + end = sbh.substring(sbh.length() - 1, sbh.length()); + sbh = sbh.substring(0, sbh.length() - 1); + + } + String[] sp = sbh.split("."); + if (sp != null && sp.length == 2) { + sbh = sp[0]; + } + sbh = sbh + "."; + // GetLsmUtil getlsm=new GetLsmUtil(); + // sbh = getlsm.getLsm("sbhlsm", sbh, "00");// + // sbh = getCodeNumber(sbh, 9, 1, 99, 1, ""); + for (int i = 0; i < 99; i++) { + String str = ge.getLsm("sbhlsm", sbh, "00");// getCodeNumber(sbh, + // 6, 1, 99, 1, ""); + if (!allSBH.contains(str)) { + sbh = str; + System.out.println("sbh=" + sbh); + break; + } + } + sbh = sbh + end; + boolean is=isha(sbh); + if(is){ + MessageBox.post("òƷʶ²ƷͺŵǼDZѴڣȷдȷ", + "", MessageBox.ERROR); + return; + } + + if (!sbh.equals("")) { + form.getTCProperty("jk8ProductIdentifyNO").setStringValue(sbh);// ʶ + MessageBox.post("ʶ,鿴", "ʾ", MessageBox.INFORMATION); + } else { + MessageBox.post("ʶʧ,", "", MessageBox.ERROR); + } + + } else if ("JK8SpecPINOAppForm".equals(type)) {// "ҪƷʶ"; + String sbh_old = form.getTCProperty("jk8ProductIdentifyNO") + .getStringValue();// ʶ + // if (sbh_old != null && !sbh_old.equals("")) { + // MessageBox.post("ʶѴ޷ظ", "ʾ", MessageBox.INFORMATION); + // return; + // } + // xh=form.getTCProperty("jk_xcp_cpxh").getStringValue(); + sbh = form.getTCProperty("jk8BaseIdentifyNO").getStringValue();// ׼ʶ + String tsyq = form.getTCProperty("jk8SpecRequirements") + .getStringValue();// Ҫ + String tsyq_gz = setVal(tsyq, "Ҫ"); + sbh = sbh + tsyq_gz; + boolean is=isha(sbh); + if(is){ + MessageBox.post("òƷʶ²ƷͺŵǼDZѴڣȷдȷ", + "", MessageBox.ERROR); + return; + } + if (!sbh.equals("")) { + form.getTCProperty("jk8ProductIdentifyNO").setStringValue(sbh);// ʶ + MessageBox.post("ʶ,鿴", "ʾ", MessageBox.INFORMATION); + } else { + MessageBox.post("ʶʧ,", "", MessageBox.ERROR); + } + + + } else if ("JK8CotlerPModAppForm".equals(type)) {// "Ʒͺ"; + + String type=form.getTCProperty("jk8InduOrCivil") + .getStringValue();// + System.out.println("type="+type); + String jbcj = form.getTCProperty("jk8BMManufactor") + .getStringValue();// + + String txfs = form.getTCProperty("jk8CommunicateMode") + .getStringValue(); // ͨŷʽ() + + String gczj = form.getTCProperty("jk8NomDiameter") + .getStringValue(); // ֱ + + String jbcj_gz = setVal(jbcj, "/"); + String txfs_gz = setVal(txfs, ""); + String gczj_gz = setVal(gczj, "ֱ"); + + if ("ñ".equals(type)) { + xh = "EI" + jbcj_gz + txfs_gz + "."; + + for (int i = 0; i < 99; i++) { + String str = ge.getLsm("cpxhlsm", xh, "00");// getCodeNumber(sbh, + // 6, 1, 99, + // 1, ""); + if (!allCPXH.contains(str)) { + xh = str; + System.out.println("xh=" + xh); + break; + } + } + }else{ + xh = "JGC" +txfs_gz + gczj_gz; + + } + + if (!xh.equals("")) { + form.getTCProperty("jk8ProductModNO").setStringValue(xh);// ʶ + MessageBox.post("Ʒͺ,鿴", "ʾ", MessageBox.INFORMATION); + } else { + MessageBox.post("Ʒͺʧ,", "", MessageBox.ERROR); + } + + + } else if ("JK8ColPIdenNOAppForm".equals(type)) {// "ʶ"; + + + String sbh_old = form.getTCProperty("jk8ProductIdentifyNO") + .getStringValue();// ʶ + // if (sbh_old != null && !sbh_old.equals("")) { + // MessageBox.post("ʶѴ޷ظ", "ʾ", MessageBox.INFORMATION); + // return; + // } + // xh=form.getTCProperty("jk_xcp_cpxh").getStringValue(); + String fmlx=form.getTCProperty("jk8ValveType").getStringValue();// + String txfs=form.getTCProperty("jk8CommunicateMode").getStringValue();// ͨŷʽ + String gdfs=form.getTCProperty("jk8PowerSupplyMode").getStringValue();// 緽ʽ + + String jbcj_gz = setVal(fmlx, ""); + String txfs_gz = setVal(txfs, "ͨŷʽ"); + String gdfs_gz = setVal(gdfs, "緽ʽ"); + + sbh = "JK/C" + jbcj_gz + txfs_gz +gdfs_gz; + for (int i = 0; i < 99; i++) { + String str = ge.getLsm5("sbhlsm", sbh, "00");////רtest + + if (!allCPXH.contains(str)) { + sbh = str; + System.out.println("sbh=" + sbh); + break; + } + } + + if (!sbh.equals("")) { + form.getTCProperty("jk8ProductIdentifyNO").setStringValue(sbh);// ʶ + MessageBox.post("ʶ,鿴", "ʾ", MessageBox.INFORMATION); + } else { + MessageBox.post("ʶʧ,", "", MessageBox.ERROR); + } + form.refresh(); + + }else { + MessageBox.post("ѡƷͺʶִв", "", MessageBox.ERROR); + } + + } + + private boolean isha(String sbh) { + if (!sbh.equals("")) { + if (sbhall != null) + for (String s : sbhall) { + if (sbh.equals(s)) { + System.out.println("ͬʶ"); + return true; + } + } + } + return false; + } + + private String setVal(String key, String Allkey) { + // TODO Auto-generated method stub + String[] all = realNameMap.get(Allkey).split(","); + HashMap Map_all = new HashMap<>(); + for (int i = 0; i < all.length; i++) { + System.out.println("ss=" + all[i]); + Map_all.put(all[i].split("=")[0], all[i].split("=")[1]); + } + if (Map_all.containsKey(key)) { + System.out.println(Allkey + "=" + Map_all.get(key)); + return Map_all.get(key).trim(); + } else { + System.out.println(Allkey + "="); + return ""; + } + + } + + public String getCodeNumber(String patternCode, int codeLength, + int startIndex, int maxValue, int increaseStep, String excludeStr) { + + TCUserService userService = session.getUserService(); + + codeLength = String.valueOf(maxValue).length(); + Object[] params = { patternCode.trim(), codeLength, startIndex, + maxValue, increaseStep, excludeStr }; + + try { + String str = ""; + str = (String) userService.call("queryPartNo", params); + return str; + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + +} diff --git a/src/com/connor/jk/plm/sqb/JK8_SBH_Action.java b/src/com/connor/jk/plm/sqb/JK8_SBH_Action.java new file mode 100644 index 0000000..3174c0d --- /dev/null +++ b/src/com/connor/jk/plm/sqb/JK8_SBH_Action.java @@ -0,0 +1,28 @@ +package com.connor.jk.plm.sqb; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.common.actions.AbstractAIFAction; + +public class JK8_SBH_Action extends AbstractAIFAction{ + private AbstractAIFApplication app; + private String type; + public JK8_SBH_Action( AbstractAIFApplication arg0,String arg2) { + super(arg0, arg2); + this.type=arg2; + this.app=arg0; + + } + + @Override + public void run() { + + try { + JK8_SBH_Command command = new JK8_SBH_Command(type,app); + command.executeModal(); + } catch (Exception e) { + // Auto-generated catch block + e.printStackTrace(); + } + } + +} diff --git a/src/com/connor/jk/plm/sqb/JK8_SBH_Command.java b/src/com/connor/jk/plm/sqb/JK8_SBH_Command.java new file mode 100644 index 0000000..5af1564 --- /dev/null +++ b/src/com/connor/jk/plm/sqb/JK8_SBH_Command.java @@ -0,0 +1,43 @@ +package com.connor.jk.plm.sqb; + +import java.text.SimpleDateFormat; +import java.util.Date; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.AbstractAIFCommand; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCSession; + +public class JK8_SBH_Command extends AbstractAIFCommand { +// private AbstractAIFApplication app; + private InterfaceAIFComponent targetComp; + private TCSession session; + private String type; + + public JK8_SBH_Command(String type, AbstractAIFApplication app) { +// this.app = app; + this.type = type; + this.targetComp = app.getTargetComponent(); + this.session = (TCSession) app.getSession(); + } + + @Override + public void executeModal() throws Exception { + super.executeModal(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss"); + String time = formatter.format(new Date()); +// Calendar calendar = Calendar.getInstance(); +// String year = String.valueOf(calendar.get(Calendar.YEAR));// ȡ +// String month = String.valueOf(calendar.get(Calendar.MONTH) + 1);// ȡ· +// String day = String.valueOf(calendar.get(Calendar.DATE));// ȡ +// String time = String.valueOf(calendar.get(Calendar.HOUR_OF_DAY)) +// + String.valueOf(calendar.get(Calendar.MINUTE)) +// + String.valueOf(calendar.get(Calendar.SECOND));// ȡ + //String name ="Ʒͺʶ"+ time; + System.out.println("------------------------------------"+time); + JK8_SBH_Operation operation = new JK8_SBH_Operation(type, time, session, targetComp); + session.queueOperation(operation); + + } + +} diff --git a/src/com/connor/jk/plm/sqb/JK8_SBH_Operation.java b/src/com/connor/jk/plm/sqb/JK8_SBH_Operation.java new file mode 100644 index 0000000..f6a991c --- /dev/null +++ b/src/com/connor/jk/plm/sqb/JK8_SBH_Operation.java @@ -0,0 +1,74 @@ +package com.connor.jk.plm.sqb; + +import com.teamcenter.rac.aif.AbstractAIFOperation; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponentFolder; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCComponentFormType; +import com.teamcenter.rac.kernel.TCComponentUser; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class JK8_SBH_Operation extends AbstractAIFOperation{ + private String time; + private String type; + private TCSession session; + private InterfaceAIFComponent targetComp; + public JK8_SBH_Operation(String type, String time, TCSession session, InterfaceAIFComponent targetComp) { + this.type=type; + this.time=time; + this.session=session; + this.targetComp = targetComp; + } + + @Override + public void executeOperation() throws Exception { + TCComponentFormType formType=(TCComponentFormType) session.getTypeComponent("Form"); + if(formType == null){ + System.out.println("formTypeΪ"); + } + String leiXin = ""; + String name = ""; + if("JK8NPModINOAppForm".equals(type)){ + leiXin="²Ʒͺɹ"; + name="²Ʒͺ"; + }else if("JK8NewPIdenNOAppForm".equals(type)){ + leiXin="²Ʒʶɹ"; + name="²Ʒʶ"; + }else if("JK8DerPIdenNOAppForm".equals(type)){ + leiXin="Ʒʶɹ"; + name="Ʒʶ"; + }else if("JK8SpecPINOAppForm".equals(type)){ + leiXin="ҪƷʶɹ"; + name="ҪƷʶ"; + }else if("JK8ExtPIdenNOAppForm".equals(type)){ + leiXin="չƷʶɹ"; + name="չƷʶ"; + }else if("JK8CotlerPModAppForm".equals(type)){ + leiXin="Ʒͺɹ"; + name="Ʒͺ"; + }else if("JK8ColPIdenNOAppForm".equals(type)){ + leiXin="ҵÿƷʶɹ"; + name="ҵÿƷʶ"; + }else if("JK8CJQIdenNOAppForm".equals(type)){ + leiXin="ɼʶɹ"; + name="ɼʶ"; + } + + + + name = name+time; + TCComponentForm form = formType.create(name, "", type); + + if(targetComp instanceof TCComponentFolder){ + ((TCComponentFolder) targetComp).add("contents", form); + MessageBox.post(leiXin,"ɹ",MessageBox.INFORMATION); + }else{ + TCComponentUser user = this.session.getUser(); + TCComponentFolder newStuff = user.getNewStuffFolder(); + newStuff.add("contents", form); + MessageBox.post(leiXin+"\nNewStuffļ","ɹ",MessageBox.INFORMATION); + } + } + +} diff --git a/src/com/connor/jk/plm/sqb/Sethzbform_Handler.java b/src/com/connor/jk/plm/sqb/Sethzbform_Handler.java new file mode 100644 index 0000000..4607ce4 --- /dev/null +++ b/src/com/connor/jk/plm/sqb/Sethzbform_Handler.java @@ -0,0 +1,56 @@ +package com.connor.jk.plm.sqb; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.kernel.AbstractAIFSession; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCSession; + +public class Sethzbform_Handler extends AbstractHandler { + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + InterfaceAIFComponent targetComponent = app.getTargetComponent(); + TCSession session = (TCSession) app.getSession(); + if(session.getUser().toString().startsWith("admin")&&targetComponent.getType().equals("JK8NewPModNORegForm")){ + System.out.println("Կʼ"); + TCComponent form=(TCComponent)targetComponent; + try { + String[] lxs= form.getTCProperty("jk8ProductType").getStringArrayValue(); + if(lxs!=null&&lxs.length>0){ + System.out.println(""+lxs.length+""); + String[] status=new String[lxs.length]; + String[] fmlx=new String[lxs.length]; + String[] txfs=new String[lxs.length]; + String[] gdlx=new String[lxs.length]; + for (int i = 0; i < lxs.length; i++) { + status[i]=""; + fmlx[i]=""; + txfs[i]=""; + gdlx[i]=""; + } + form.getTCProperty("jk8Status").setStringValueArray(status); + form.getTCProperty("jk8ValveType").setStringValueArray(fmlx); + form.getTCProperty("jk8CommunicateMode").setStringValueArray(txfs); + form.getTCProperty("jk8PowerSupplyMode").setStringValueArray(gdlx); + } + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + }else{ + System.out.println(""); + } + + return null; + } + +} diff --git a/src/com/connor/jk/plm/tallySheet/CM-02 配置管理计划模板V1.5.xlsx b/src/com/connor/jk/plm/tallySheet/CM-02 配置管理计划模板V1.5.xlsx new file mode 100644 index 0000000..01252a1 Binary files /dev/null and b/src/com/connor/jk/plm/tallySheet/CM-02 配置管理计划模板V1.5.xlsx differ diff --git a/src/com/connor/jk/plm/tallySheet/ProcessBarDialog.java b/src/com/connor/jk/plm/tallySheet/ProcessBarDialog.java new file mode 100644 index 0000000..15f0ad5 --- /dev/null +++ b/src/com/connor/jk/plm/tallySheet/ProcessBarDialog.java @@ -0,0 +1,61 @@ +package com.connor.jk.plm.tallySheet; + +import javax.swing.Box; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JLabel; + +import java.awt.Dimension; +import java.util.TimerTask; +import java.util.Timer; +import javax.swing.*; + +public class ProcessBarDialog extends JFrame { + + private JProgressBar progressBar = new JProgressBar(); + + private Box box = Box.createVerticalBox(); + + private Box box2 = Box.createHorizontalBox(); + private String name; + + public ProcessBarDialog(String name) { + this.name = name; + } + + public void open() { + this.setTitle("..."); + + //Ҫý̵ + + setBounds(200, 200, 300, 100); + + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + setLocationRelativeTo(null); + progressBar.setIndeterminate(true);// ýʽΪȷĽʽ(ع)falseΪȷĽʽ(ͷβʾ) + + progressBar.setStringPainted(true);// ýʾʾϢ + + progressBar.setString(name);// ʾϢ + progressBar.setPreferredSize(new Dimension(300, 100)); + + box2.add(progressBar); + box.add(box2); + add(box); + setVisible(true); + // Timer timer = new Timer(); + // TimerTask timerTask = new TimerTask(){ + // @Override + // public void run() { + // System.out.println("ԓУ"); + // dispose(); + // } + // }; + // timer.schedule(timerTask,5000);//5000Ϊ5 + } + + public void close() { + dispose(); + } + +} diff --git a/src/com/connor/jk/plm/tallySheet/ProgressBar.java b/src/com/connor/jk/plm/tallySheet/ProgressBar.java new file mode 100644 index 0000000..851dee5 --- /dev/null +++ b/src/com/connor/jk/plm/tallySheet/ProgressBar.java @@ -0,0 +1,171 @@ +/** + * @file ProgressBar.java + * + * @brief Create progress bar + * + * @author Yanghui + * + * @history + * ================================================================ + * Date Name Description of Change + * 25-July-2008 Yanghui this class is used to create + * progress bar. + */ +package com.connor.jk.plm.tallySheet; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JProgressBar; +import javax.swing.Timer; +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.util.PropertyLayout; +import com.teamcenter.rac.util.Registry; + +/** + * @class ProgressBar + * @brief Create progress bar + * @author Yanghui + */ +public class ProgressBar extends AbstractAIFDialog implements ActionListener { + /** + * @var ProgressBar.progressbar + * @brief JProgressBar + */ + private JProgressBar progressbar; + + /** + * @var ProgressBar.label + * @brief label used to tips + */ + private JLabel label; + + /** + * @var ProgressBar.timer + * @brief timer used to timing operation + */ + private Timer timer; + + /** + * @var ProgressBar.bool + * @brief bool used to flag thread return + */ + private boolean bool = false; + + /** + * @var Progressbar.registry + * @brief Registry + */ + private Registry registry; + + /** + * @fn public ProgressBar() + * @brief constructor + * @param[in] null + */ + private String showLable = null ; + public ProgressBar(String showlable) { + super(true); + showLable = showlable; + this.setAlwaysOnTop(true); + } + + /** + * @fn public void setBool(boolean bool) + * @brief set bool value + * @param[in] bool + * @param[out] null + */ + public void setBool(boolean bool) { + this.bool = bool; + } + + /** + * @fn private void initUI() + * @brief createDialog method + * @param[in] null + * @param[out] null + */ + public void initUI() { + Container container = getContentPane(); + JPanel mainPanel = new JPanel(new PropertyLayout()); + this.label = new JLabel(showLable, JLabel.CENTER); + this.progressbar = new JProgressBar(); + this.progressbar.setOrientation(JProgressBar.HORIZONTAL); + this.progressbar.setMinimum(0); + this.progressbar.setMaximum(100); + this.progressbar.setValue(0); + this.progressbar.setPreferredSize(new Dimension(200, 15)); + this.progressbar.setBorderPainted(true); + this.timer = new Timer(50, (ActionListener) this); + this.timer.setRepeats(false); + mainPanel.add("1.1.center", new JLabel(" ")); + mainPanel.add("2.1.center", label); + mainPanel.add("3.1.center", progressbar); + mainPanel.add("4.1.center", new JLabel(" ")); + container.add(mainPanel); + pack(); + setLocation(500, 200); + TaskThread thread = new TaskThread(this); + thread.start(); + addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + bool = true; + } + }); + this.setVisible(true); + } + + /** + * @class TaskThread + * @brief Create progressbar + * + */ + class TaskThread extends Thread { + private ProgressBar bar; + + public TaskThread(ProgressBar bar) { + this.bar = bar; + } + + public void run() { + if (bool == false) { + // Set Status is running. + // session.setStatus(registry.getString("export Running")); + } + for (int i = 0; i < i + 1; i++) { + timer.start(); + int value = progressbar.getValue(); + if (value < 100) { + value = value + 5; + progressbar.setValue(value); + } else { + timer.stop(); + progressbar.setValue(0); + } + try { + sleep(100); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + if (bool == true) { + bar.setVisible(false); + bar.dispose(); + return; + + } + + } + } + } + + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + + } +} diff --git a/src/com/connor/jk/plm/tallySheet/ProgressBarThread.java b/src/com/connor/jk/plm/tallySheet/ProgressBarThread.java new file mode 100644 index 0000000..ac87772 --- /dev/null +++ b/src/com/connor/jk/plm/tallySheet/ProgressBarThread.java @@ -0,0 +1,41 @@ +/** + * @file ProgressBarThread.java + * + * @brief control progressBar. + * + * @author Yanghui + * + * @history + * ================================================================ + * Date Name Description of Change + * 08-Auguest-2008 Yanghui this class is used to control + * progress bar. + */ +package com.connor.jk.plm.tallySheet; + +/** + * @class ProgressBarThread + * @brief Create progress bar thread + * @author Yanghui + */ +public class ProgressBarThread extends Thread { + + private ProgressBar bar; + + private String title; + + public ProgressBarThread(String title,String showLable) { + this.title = title; + bar = new ProgressBar(showLable); + } + + public void run() { + bar.setTitle(title); + bar.initUI(); + } + + public void setBool(boolean bool) { + bar.setBool(true); + bar.setAlwaysOnTop(true); + } +} diff --git a/src/com/connor/jk/plm/tallySheet/ScheduleReportAction.java b/src/com/connor/jk/plm/tallySheet/ScheduleReportAction.java new file mode 100644 index 0000000..bc76b4c --- /dev/null +++ b/src/com/connor/jk/plm/tallySheet/ScheduleReportAction.java @@ -0,0 +1,155 @@ +package com.connor.jk.plm.tallySheet; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.common.actions.AbstractAIFAction; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentDataset; +import com.teamcenter.rac.kernel.TCComponentDatasetType; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemType; +import com.teamcenter.rac.kernel.TCComponentListOfValuesType; +import com.teamcenter.rac.kernel.TCComponentProject; +import com.teamcenter.rac.kernel.TCComponentProjectType; +import com.teamcenter.rac.kernel.TCComponentScheduleTask; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class ScheduleReportAction extends AbstractAIFAction { + AbstractAIFApplication app; + TCSession session; + + public ScheduleReportAction(AbstractAIFApplication arg0, String arg1) { + super(arg0, arg1); + this.app = arg0; + session = (TCSession) app.getSession(); + // TODO Auto-generated constructor stub + } + + @Override + public void run() { + // TODO Auto-generated method stub + if (!(app.getTargetComponent() instanceof TCComponentScheduleTask)) { + MessageBox.post("ѡʱ", "", 2); + return; + } + TCComponentScheduleTask task = (TCComponentScheduleTask) app.getTargetComponent(); + + FileInputStream fis = null; + FileOutputStream fos = null; + File file; + + try { + String name = task.getProperty("object_name"); + switch (name.charAt(1)) { + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + break; + default: + MessageBox.post("ѡȷʱ", "", 2); + return; + } + TCComponent[] property = task.getTCProperty("schedule_tag").getReferenceValue() + .getTCProperty("schedule_deliverable_list").getReferenceValueArray(); + System.out.println(task.getTCProperty("schedule_tag").getReferenceValue().getTCProperty("schedule_deliverable_list")); + TCComponent excelData = null; + for (int i = 0; i < property.length; i++) { + System.out.println(property[i].toDisplayString()); + if(("Ŀ嵥".equals(property[i].toDisplayString()))|| ("Ŀ嵥".equals(property[i].toDisplayString()))) { + excelData = property[i]; + break; + } + } + if (excelData == null) { + MessageBox.post("Ŀ嵥", "", 2); + return; + } + excelData = ((TCComponentItem) excelData.getTCProperty("deliverable_inst").getReferenceValue() + .getChildren()[0].getComponent()).getLatestItemRevision().getTCProperty("IMAN_specification") + .getReferenceValueArray()[0]; + file = ((TCComponentDataset) excelData).getTcFiles()[0].getFmsFile(); + System.out.println("file==========>"+file); + System.out.println(file); + + String projectID = task.getTCProperty("schedule_tag").getReferenceValue().getProperty("project_ids"); + System.out.println("project_id:" + projectID); + TCComponentProjectType projectType = (TCComponentProjectType) session.getTypeComponent("TC_Project"); + TCComponentProject project = projectType.find(projectID); + System.out.println("TC_project:" + project); + if (project == null) { + MessageBox.post("Ŀ", "", 2); + return; + } + fis = new FileInputStream(file); + System.out.println("fis:" + fis); + XSSFWorkbook workbook = new XSSFWorkbook(fis); + if (workbook == null) { + MessageBox.post("excelļ", "", 2); + return; + } + System.out.println("workBook:" + workbook); + String syb=project.getProperty("JYunit"); + XSSFSheet sheet = workbook.getSheet(syb+"Ŀ嵥"); + if (sheet == null) { + MessageBox.post("sheet", "", 2); + return; + } + System.out.println("sheet:" + sheet); +// if (!TallySheetUtil2.writeToExcel(task, sheet)) { +// return; +// } + String outpath = System.getProperty("user.home") + "\\Ŀ嵥.xlsx"; + fos = new FileOutputStream(new File(outpath)); + workbook.write(fos); + TCComponentDatasetType dataType = (TCComponentDatasetType) session.getTypeComponent("Dataset"); + TCComponentDataset tcData = dataType.create(name + "", "description", "MSExcelX"); + + tcData.setFiles(new String[] { outpath }, new String[] { "excel" }); + tcData.getTcFiles()[0].setOriginalFileName(tcData, name + ""); + TCComponentItemType itemType = (TCComponentItemType) session.getTypeComponent("Item"); + TCComponentItem addItem = itemType.create(null, null, "JY8CheckDoc", name + "", null, null); + addItem.getLatestItemRevision().add("IMAN_specification", tcData); + TCComponent comForm=(TCComponent)addItem.getLatestItemRevision().getChildren("IMAN_master_form_rev")[0].getComponent(); + System.out.println("table:"+comForm.getTCProperty("ProducePhase").getLOV().getListOfValues().getValueTable()); + + name=(String) comForm.getTCProperty("ProducePhase").getLOV().getListOfValues().getRealValue(name); + comForm.setStringProperty("ProducePhase", name);; + + session.getUser().getHomeFolder().add("contents", addItem); + + project.assignToProject(new TCComponent[] { addItem }); + Runtime.getRuntime().exec((new StringBuilder("cmd /c \"")).append(outpath).append("\"").toString()); + } catch (Exception e1) { + MessageBox.post("ʧ","",2); + e1.printStackTrace(); + } finally { + if (fis != null) { + + try { + fis.close(); + if (fos != null) + fos.close(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + + } + +} diff --git a/src/com/connor/jk/plm/tallySheet/ScheduleReportHandler.java b/src/com/connor/jk/plm/tallySheet/ScheduleReportHandler.java new file mode 100644 index 0000000..a8bc336 --- /dev/null +++ b/src/com/connor/jk/plm/tallySheet/ScheduleReportHandler.java @@ -0,0 +1,18 @@ +package com.connor.jk.plm.tallySheet; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.teamcenter.rac.aifrcp.AIFUtility; + +public class ScheduleReportHandler extends AbstractHandler { + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + // TODO Auto-generated method stub + new Thread(new ScheduleReportAction(AIFUtility.getCurrentApplication(), null)).run(); + return null; + } + +} diff --git a/src/com/connor/jk/plm/tallySheet/TallySheetAction.java b/src/com/connor/jk/plm/tallySheet/TallySheetAction.java new file mode 100644 index 0000000..a6a1834 --- /dev/null +++ b/src/com/connor/jk/plm/tallySheet/TallySheetAction.java @@ -0,0 +1,57 @@ +package com.connor.jk.plm.tallySheet; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.common.actions.AbstractAIFAction; +import com.teamcenter.rac.aif.kernel.AIFComponentContext; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentFolder; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCComponentSchedule; +import com.teamcenter.rac.kernel.TCComponentScheduleTask; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class TallySheetAction extends AbstractAIFAction { + AbstractAIFApplication app; + TCSession session; + public TallySheetAction(AbstractAIFApplication arg0, String arg1) { + super(arg0, arg1); + app=arg0; + session=(TCSession) app.getSession(); + } + + @Override + public void run() { +// //ѡʱʱܽ +// TCComponentSchedule schedule = null; +//// System.out.println(app.getTargetComponent().getType()); +// if((app.getTargetComponent() instanceof TCComponentSchedule)){ +// schedule = (TCComponentSchedule) app.getTargetComponent(); +// }else if((app.getTargetComponent() instanceof TCComponentScheduleTask)){ +// try { +// schedule =(TCComponentSchedule) ((TCComponentScheduleTask) app.getTargetComponent()).getReferenceProperty("schedule_tag"); +// } catch (Exception e) { +// e.printStackTrace(); +// MessageBox.post(e.getLocalizedMessage(),"쳣",MessageBox.ERROR); +// return; +// } +// }else{ +// MessageBox.post("ѡʱ","",2); +// return; +// } + TCComponentItemRevision compRev=null; + if(app.getTargetComponent()==null) { + MessageBox.post("ѡĿµƱ棡", "", MessageBox.ERROR); + return; + } + if(app.getTargetComponent().getType().indexOf("JK8PZSJBGRevision")>=0) { + compRev=(TCComponentItemRevision) app.getTargetComponent(); + }else { + MessageBox.post("ѡĿµƱ汾", "", MessageBox.ERROR); + return; + } + new Thread(new TallySheetDialog(app, session,compRev)).run(); + } + +} diff --git a/src/com/connor/jk/plm/tallySheet/TallySheetBean.java b/src/com/connor/jk/plm/tallySheet/TallySheetBean.java new file mode 100644 index 0000000..25ce6c6 --- /dev/null +++ b/src/com/connor/jk/plm/tallySheet/TallySheetBean.java @@ -0,0 +1,5 @@ +package com.connor.jk.plm.tallySheet; + +public class TallySheetBean { + public String deliverableNew;//½ +} diff --git a/src/com/connor/jk/plm/tallySheet/TallySheetDialog.java b/src/com/connor/jk/plm/tallySheet/TallySheetDialog.java new file mode 100644 index 0000000..18cfbb6 --- /dev/null +++ b/src/com/connor/jk/plm/tallySheet/TallySheetDialog.java @@ -0,0 +1,270 @@ +package com.connor.jk.plm.tallySheet; + +import java.awt.BorderLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import javax.naming.InitialContext; +import javax.swing.JButton; +import javax.swing.JFileChooser; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; +import javax.swing.filechooser.FileSystemView; + +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + +import com.connor.jk.plm.DbomToEbom.ProgressBarThread; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.aif.kernel.AIFComponentContext; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentDataset; +import com.teamcenter.rac.kernel.TCComponentFolder; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCComponentProject; +import com.teamcenter.rac.kernel.TCComponentSchedule; +import com.teamcenter.rac.kernel.TCComponentScheduleTask; +import com.teamcenter.rac.kernel.TCComponentScheduleTaskType; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; + +public class TallySheetDialog extends AbstractAIFDialog { + AbstractAIFApplication app; + TCSession session; + private JLabel pathLabel; + private JTextField pathField; + private JButton pathButton; + private JFileChooser jFileChooser; + private JButton okButton; +// TCComponentSchedule schedule; + ProgressBarThread wait; + private TCComponentItemRevision compRev; + public TallySheetDialog(AbstractAIFApplication app,TCSession session,TCComponentItemRevision compRev){ + this.app=app; + this.session=session; + this.compRev = compRev; + } + public void run(){ + //initUI(); + Init(); + } + public void Init() { + try { + //TCComponentSchedule schedule=(TCComponentSchedule) app.getTargetComponent(); + + wait=new ProgressBarThread("", "ִУԵ..."); + //String projectID=schedule.getProperty("project_ids"); + + //TCComponent[] project=session.search("Ŀ...", new String[]{"Ŀ ID"}, new String[]{projectID}); + TCComponent[] project=compRev.getReferenceListProperty("project_list"); + if(project==null){ + MessageBox.post("δָĿ","",2); + }else if(project.length>1) { + MessageBox.post("ڶָĿ","",2); + }else{ + //wait.start(); + TallySheetOperation operation=new TallySheetOperation("",session,wait,(TCComponentProject)project[0],compRev); + session.queueOperation(operation); +// writeToExcel((TCComponentProject)project[0]); + } + System.out.println("project:"+project); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void initUI(){ + this.setAlwaysOnTop(true); + setTitle("Լ"); + setLayout(new BorderLayout()); + JPanel mainPanel=new JPanel(new PropertyLayout()); + pathLabel=new JLabel("·"); + pathField=new JTextField(FileSystemView.getFileSystemView().getHomeDirectory() + .getPath());//ǰû· + pathField.setEditable(false); + pathButton=new JButton("ѡļ"); + okButton=new JButton("ȷ"); + jFileChooser=new JFileChooser(FileSystemView.getFileSystemView().getHomeDirectory() + .getPath()); + jFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + pathButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent actionevent) { + setAlwaysOnTop(false); + if (jFileChooser.showOpenDialog(null) != 1) + pathField.setText(jFileChooser.getSelectedFile() + .getAbsolutePath()); + setAlwaysOnTop(true); + } + }); + okButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent arg0) { + setAlwaysOnTop(false); + try { + //TCComponentSchedule schedule=(TCComponentSchedule) app.getTargetComponent(); + + wait=new ProgressBarThread("", "ִУԵ..."); + //String projectID=schedule.getProperty("project_ids"); + + //TCComponent[] project=session.search("Ŀ...", new String[]{"Ŀ ID"}, new String[]{projectID}); + TCComponent[] project=compRev.getReferenceListProperty("project_list"); + if(project==null){ + MessageBox.post("δָĿ","",2); + }else if(project.length>1) { + MessageBox.post("ڶָĿ","",2); + }else{ + disposeDialog(); +// String pathRoute=pathField.getText()+"\\CM-02 ùƻģV1.5.xlsm"; + xlsmNam=nameField.getText();//\/*<>| + if(xlsmNam.contains("\\")||xlsmNam.contains("/")||xlsmNam.contains(":")||xlsmNam.contains("*")||xlsmNam.contains("?")||xlsmNam.contains("\"")||xlsmNam.contains("<")||xlsmNam.contains(">")||xlsmNam.contains("|")) { + MessageBox.post("ļܰκַ \\/*<>|","",MessageBox.INFORMATION); + return; + } + String pathRoute=pathField.getText()+"\\"+xlsmNam+".xlsm"; + wait.start(); + TallySheetOperation operation=new TallySheetOperation(pathRoute,session,wait,(TCComponentProject)project[0],compRev); + session.queueOperation(operation); +// writeToExcel((TCComponentProject)project[0]); + } + System.out.println("project:"+project); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + + mainPanel.add("1.1.left.top",pathLabel); + mainPanel.add("1.2.left.top",pathField); + mainPanel.add("1.3.left.top",pathButton); + nameField.setText(""); + mainPanel.add("2.1.left.top",nameLabel); + mainPanel.add("2.2.left.top",nameField); + add(mainPanel,BorderLayout.CENTER); + add(okButton,BorderLayout.SOUTH); + centerToScreen(); + pack(); + showDialog(); + } + JLabel nameLabel=new JLabel("Զļ"); + JTextField nameField=new JTextField(16); + String xlsmNam=""; + private void writeToExcel(TCComponentProject project){ + FileInputStream fis=null; + FileOutputStream fos=null; + + try { + AIFComponentContext[] children=project.getChildren("project_data")[0].getComponent().getChildren();//ȡʱµļУ + TCComponentSchedule schedule=null; + for(int i=children.length-1;i>=0;i--){ + TCComponent[] component=((TCComponent)children[i].getComponent()).getTCProperty("project_data").getReferenceValueArray();//ļµʱ + if(component!=null&&component.length>0&&(component[0] instanceof TCComponentSchedule)){ + schedule=(TCComponentSchedule) component[0];//ֻȡһʱ + } + } + TCComponent[] tasks=schedule.getAllTasks();//ȡʱµ +// TCComponent[] property=schedule.getTCProperty("schedule_deliverable_list").getReferenceValueArray();//ʱҲexcelģ + TCComponent[] property=schedule.getReferenceListProperty("schedule_deliverable_list");//ʱҲexcelģ + TCComponent excelData=null; + for(int i=0;i"+excelData.getType()); +// excelData=(TCComponentItem)excelData.getTCProperty("deliverable_inst").getReferenceValue(); + break; + } + } + if(excelData==null){ + MessageBox.post("ʱµschedule_deliverable_listеĿüƻб","",2); + return; + } + TCComponent component=excelData.getReferenceProperty("deliverable_inst"); + TCComponent[] components=((TCComponentFolder)component).getTCProperty("contents").getReferenceValueArray(); + +// excelData=((TCComponentItem) excelData.getTCProperty("deliverable_inst").getReferenceValue().getChildren()[0].getComponent()).getLatestItemRevision().getTCProperty("IMAN_specification").getReferenceValueArray()[0]; + excelData=components[0].getTCProperty("IMAN_specification").getReferenceValueArray()[0]; + System.out.println(); + File file=((TCComponentDataset)excelData).getTcFiles()[0].getFmsFile(); +// File file=components[0].getTcFiles()[0].getFmsFile(); + + fis = new FileInputStream(file); + System.out.println("fis:"+fis); + XSSFWorkbook workbook = new XSSFWorkbook(fis); + if (workbook == null) { + MessageBox.post("excelļ", "", 2); + return; + } + + System.out.println("workBook:"+workbook);//TODO ҪȷJYunit +// String syb=project.getProperty("JYunit"); + XSSFSheet sheet = workbook.getSheet("ùƻ"); + if (sheet == null) { + MessageBox.post("sheet", "", 2); + return; + } + System.out.println("sheet:"+sheet); + StringBuffer sbUnknow = new StringBuffer(); + sbUnknow.append("½δģ¼ʵ:\n\n"); + boolean isdisplay=false; + boolean other=true; + for(int i=0;i DeliverablesType=new ArrayList();//ѡнĵ + private HashMap DeliverableNameToType=new HashMap();//ѡнϢ + private HashMap> TypeToValues=new HashMap>();//ѡнϢ + private HashMap> TypeToRevs=new HashMap>();//ѡнϢ + + + private String object_Name=""; + private String object_Manager=""; + private String object_Level=""; + + + public TallySheetOperation(String pathRoute, TCSession session, ProgressBarThread wait, TCComponentProject tcComponentProject,TCComponentItemRevision compRev) { + this.pathRoute=pathRoute; + this.session=session; + this.wait=wait; + this.tcComponentProject=tcComponentProject; + this.compRev=compRev; + } + + @Override + public void executeOperation() throws Exception { + //writeToExcel(tcComponentProject); + writeToExcel2(tcComponentProject); + } + + + //+++ + private void writeToExcel2(TCComponentProject project){ + + new Thread() { + public void run() { + FileInputStream fis=null; + FileOutputStream fos=null; + File file=null; + + //ȡѡJK_PZSJBG_Template_UID + String[] PreValues = session.getPreferenceService().getStringValues( + "JK_PZSJBG_Template_UID"); + if(PreValues==null||PreValues.length==0) { + MessageBox.post("ѡJK_PZSJBG_Template_UID","",MessageBox.ERROR); + return; + } + System.out.println("ѡֵΪ"+Arrays.toString(PreValues)); + +// //ݼuid,ҵݼ +// String excelUid=PreValues[0]; +// TCComponentDataset dat; +// try { +// dat = (TCComponentDataset)session +// .stringToComponent(excelUid); +// TCComponentTcFile[] tcFile = dat.getTcFiles(); +// if(tcFile != null && tcFile.length == 0) +// { +// MessageBox.post("ѡJK_PZSJBG_Template_UIDãδҵݼ","",MessageBox.ERROR); +// return; +// } +// else +// { +// file=tcFile[0].getFmsFile(); +// } +// } catch (TCException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } + //ֱӻȡѡеİ汾µݼ޸ + file=getExcelToItem(session,compRev,"IMAN_specification"); + if(file==null) { + MessageBox.post("Ʊ汾ݼڶݼȼ飡","",MessageBox.ERROR); + } + + + // + ProcessBarDialog processBar=new ProcessBarDialog("ڵƱ"); + processBar.open(); + + //ȡ̶ԣĿȡ object_stringĿjk8ProjectManagerĿȼjk8ProjectLevel + try { + object_Name=tcComponentProject.getPropertyDisplayableValue("object_string"); + object_Manager=tcComponentProject.getPropertyDisplayableValue("jk8ProjectManager"); + object_Level=tcComponentProject.getPropertyDisplayableValue("jk8ProjectLevel"); + } catch (NotLoadedException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + + //ȡTCϵͳж͵Ķչϵ + for(int i=0;i> entry : TypeToRevs.entrySet()) { + String type=entry.getKey(); + List revs=entry.getValue(); + List list=new ArrayList(); + System.out.println("Ϊ"+type+"İ汾У"+revs); + try { + //ֻһʱ + if(revs.size()==1) { +// // +// list.add(revs.get(0).getReferenceProperty("owning_user").getStringProperty("user_name")); + //״̬ + if(type.equals("JK8Material2")) {//gerberݼ + System.out.println(revs.get(0).getStringProperty("object_name")+"===>gerberݼ"); + list.add(getGerberStatus(revs.get(0))); + + list.add(getGerberInfomation(revs.get(0))); + }else { + if(revs.get(0).getProperty("release_status_list") == "") {//δ + list.add("δ"); + //汾 + list.add(revs.get(0).getStringProperty("item_id")+"/"+revs.get(0).getStringProperty("item_revision_id")+";δ"); + }else { + list.add("ѷ"); + //汾 + list.add(revs.get(0).getStringProperty("item_id")+"/"+revs.get(0).getStringProperty("item_revision_id")+";ѷ"); + } + + } + + }else {//ж,汾 + + String value1=""; + String value2="ѷ"; + String value3=""; + for(int i=0;i values=new ArrayList(); + values=TypeToValues.get(type); + // + //˲ +// row.getCell(6).setCellStyle(cellStyle); +// row.getCell(6).setCellValue(values.get(0)); + if(values.get(1).contains("")) { + row.getCell(7).setCellValue(getvalue(false,values.get(0),workbook,true)); + row.getCell(7).setCellStyle(cellStyle); + row.getCell(8).setCellValue(getvalue(false,values.get(1),workbook,false)); + row.getCell(8).setCellStyle(cellStyle); + }else { + if(values.get(0).contains("ѷ")) { + row.getCell(7).setCellValue(getvalue(false,values.get(0),workbook,true)); + row.getCell(7).setCellStyle(cellStyle); + row.getCell(8).setCellValue(getvalue(true,values.get(1),workbook,false)); + row.getCell(8).setCellStyle(cellStyle); + }else { + row.getCell(7).setCellValue(getvalue(false,values.get(0),workbook,true)); + row.getCell(7).setCellStyle(cellStyle); + row.getCell(8).setCellValue(getvalue(false,values.get(1),workbook,false)); + row.getCell(8).setCellStyle(cellStyle); + } + + } + + + }else { + row.getCell(7).setCellValue("ȱʧ"); + row.getCell(7).setCellStyle(cellStyle); + System.out.println("==>Ԫ񽻸ƣ"+rowValue+",δҵӦͶ."); + } + }else if(rowValue.equals("ݱ")){//ݱĬΪѷ + System.out.println("++++ݱ++++Ĭѷ."); + row.getCell(7).setCellValue(getvalue(false,"ѷ",workbook,true)); + row.getCell(7).setCellStyle(cellStyle); + }else { + System.out.println("==>Ԫ񽻸ƣ"+rowValue+",δѡ."); + } + } + String outPathString = String.valueOf(System.getenv("TEMP")) + "\\"+compRev.getStringProperty("object_name")+".xlsx"; + //String nameString=compRev.getStringProperty("object_name")+"Ʊ"; + fos = new FileOutputStream(new File(outPathString)); + workbook.write(fos); + if(fis!=null) + fis.close(); + if(fos!=null) + fos.close(); + + + //滻Ѵڵݼ + changeDataSet(getExcelToDataset(session,compRev,"IMAN_specification"), "excel", "MSExcelX",outPathString); + + + //ɾļ + if(new File(outPathString).exists()) { + new File(outPathString).delete(); + } + + processBar.close(); + MessageBox.post("Ʊ浼ɹ", "ʾ", 2); + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + }; + }.start(); + + } + + // + public void getDeliverables(AIFComponentContext comp,HashMap DeliverableNameToType) { + if(comp==null) { + return; + } + boolean isContinue=true; + boolean isSearch=false; + try { + +// if(comp.getComponent() instanceof TCComponentItem) { +// TCComponentItem item=(TCComponentItem) comp.getComponent(); +// int flag=0; +// //+++ +// if(item.getType().equals("JK8Material")) { +// if(item.getStringProperty("object_name").indexOf("")>=0) { +// isSearch=true; +// flag=1; +// }else if(item.getStringProperty("item_id").startsWith("3")) { +// isSearch=true; +// flag=3; +// } +// }else if(item.getType().equals("JK8PartDraw_CAD")) { +// if(item.getStringProperty("item_id").startsWith("DWG")) { +// isSearch=true; +// } +// }else if(DeliverableNameToType.containsKey(item.getProperty("object_name"))) { +// if(item.getType().equals(DeliverableNameToType.get(item.getProperty("object_name")))) { +// isSearch=true; +// } +// } +// +// //+++ +// if(isSearch) { +// if(flag==0) { +// addItem(item.getType(),item.getLatestItemRevision(),TypeToRevs); +// }else if(flag==1) { +// if(getRelationItemGerber(item.getLatestItemRevision())) {//汾°gerberͷݼ +// addItem(item.getType()+2,item.getLatestItemRevision(),TypeToRevs);//ƺgerberݼļ¼ΪJK8Material2 +// }else { +// addItem(item.getType()+1,item.getLatestItemRevision(),TypeToRevs);//""Ʋgerberݼļ¼ΪJK8Material1 +// } +// }else if(flag==3) { +// addItem(item.getType()+3,item.getLatestItemRevision(),TypeToRevs);//ID3ͷļ¼ΪJK8Material1 +// } +// isContinue=false; +// return; +// } +// +// } + if(comp.getComponent() instanceof TCComponentItem) { + TCComponentItem item=(TCComponentItem) comp.getComponent(); + int flag=0; + //+++ + if(item.getType().equals("JK8Material")) { + if(item.getStringProperty("object_name").indexOf("")>=0) { + if(getRelationItemGerber(item.getLatestItemRevision())) {//汾°gerberͷݼ + addItem(item.getType()+2,item.getLatestItemRevision(),TypeToRevs);//ƺgerberݼļ¼ΪJK8Material2 + } + addItem(item.getType()+1,item.getLatestItemRevision(),TypeToRevs);//""Ƶļ¼ΪJK8Material1 + }else if(item.getStringProperty("item_id").startsWith("3")) { + addItem(item.getType()+3,item.getLatestItemRevision(),TypeToRevs);//ID3ͷļ¼ΪJK8Material1 + isContinue=false; + return; + } + }else if(item.getType().equals("JK8PartDraw_CAD")) { + if(item.getStringProperty("item_id").startsWith("DWG")) { + TCComponentItemRevision[] revS=item.getWorkingItemRevisions(); + TCComponentItemRevision revision=null; + for(TCComponentItemRevision rev:revS) { + if(!rev.getStringProperty("item_revision_id").contains(".")) { + revision=rev; + } + } + if(revision!=null) { + addItem(item.getType(),revision,TypeToRevs); + } + isContinue=false; + return; + } + }else if(DeliverablesType.contains(item.getType())) { + addItem(item.getType(),item.getLatestItemRevision(),TypeToRevs); + isContinue=false; + return; + } + + //+++ +// if(isSearch) { +// if(flag==0) { +// addItem(item.getType(),item.getLatestItemRevision(),TypeToRevs); +// }else if(flag==1) { +// if(getRelationItemGerber(item.getLatestItemRevision())) {//汾°gerberͷݼ +// addItem(item.getType()+2,item.getLatestItemRevision(),TypeToRevs);//ƺgerberݼļ¼ΪJK8Material2 +// }else { +// addItem(item.getType()+1,item.getLatestItemRevision(),TypeToRevs);//""Ʋgerberݼļ¼ΪJK8Material1 +// } +// }else if(flag==3) { +// addItem(item.getType()+3,item.getLatestItemRevision(),TypeToRevs);//ID3ͷļ¼ΪJK8Material1 +// } +// isContinue=false; +// return; +// } + + } + + if(!isContinue) { + return; + } + try { +// int childCount=comp.getComponent().getChildrenCount(); +// if(childCount<=0) {//Ӷ򷵻 +// return; +// } + //if(comp.getComponent() instanceof TCComponentProject) { + AIFComponentContext[] children=((TCComponent)comp.getComponent()).getChildren("project_data"); + for(int i=0;i"+item.getStringProperty("object_name")+"GERBERͷ"); + return true; + } + } + } + } + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return false; + } + + + /** + * ȡ汾´õ״̬ + * @param rev + * @return + */ + public String getGerberStatus(TCComponentItemRevision rev) { + String value="δҵ"; + TCComponent[] items; + try { + TCComponent secRev=rev.getRelatedComponent("EDAHasPWB");//secRevǴ + items = secRev.getRelatedComponents("JK8MaterialRelation"); + for(TCComponent item:items) { + if(item instanceof TCComponentDataset) { + if(item.getStringProperty("object_name").toUpperCase().startsWith("GERBER")) { + System.out.println("===>ȡ"+rev.getStringProperty("object_name")+"һgerberϲõķ״̬"); + value=secRev.getProperty("release_status_list") == ""?"δ":"ѷ"; + } + } + } + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return value; + } + + public String getGerberInfomation(TCComponentItemRevision rev) { + String value=""; + TCComponent[] items; + try { + TCComponent secRev=rev.getRelatedComponent("EDAHasPWB");//secRevǴ + items = secRev.getRelatedComponents("JK8MaterialRelation"); + for(TCComponent item:items) { + if(item instanceof TCComponentDataset) { + if(item.getStringProperty("object_name").toUpperCase().startsWith("GERBER")) { + System.out.println("===>ȡ"+rev.getStringProperty("object_name")+"һgerberϢ"); + value=item.getStringProperty("object_name"); + System.out.println("ȡݼΪ"+item.getStringProperty("object_name")); + break; + } + } + } + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return value; + } + + public void addItem(String type,TCComponentItemRevision Rev,HashMap> TypeToRevs) { + + if(TypeToRevs.containsKey(type)) { + List revs=TypeToRevs.get(type); + if(!revs.contains(Rev)) { + revs.add(Rev); + TypeToRevs.put(type, revs); + } + }else { + List revs=new ArrayList(); + //if(!Rev.getStringProperty("item_revision_id").contains(".")) { + revs.add(Rev); + TypeToRevs.put(type, revs); + //} + + } + + } + + + /** + * δΪɫ + * @param realText + * @param workbook + * @param isStu + * @return + */ + private XSSFRichTextString getvalue(boolean isCon,String realText,XSSFWorkbook workbook,boolean isStu){ + // һı + XSSFRichTextString xssfRichTextString = new XSSFRichTextString(realText); + // һʽ + XSSFFont font= (XSSFFont)workbook.createFont();//Ĭʽ + XSSFFont fontRed = (XSSFFont)workbook.createFont();//ɫʽ + + // ʽ + font.setFontName(""); + fontRed.setFontName(""); + // С + font.setFontHeightInPoints((short) 12); + fontRed.setFontHeightInPoints((short) 12); + //font2Ϊɫ + XSSFColor xssfColor = new XSSFColor(Color.red); + fontRed.setColor(xssfColor); + + if(isCon) { + xssfRichTextString.applyFont(0, realText.length(), font); + return xssfRichTextString; + } + + if(isStu) { + if(realText.equals("ѷ")){ + xssfRichTextString.applyFont(0, realText.length(), font); + }else{ + xssfRichTextString.applyFont(0, realText.length(), fontRed); + } + }else{ + String[] values=realText.split("\n"); +// if(values.length==1){ +// if(values[0].contains("ѷ")){ +// xssfRichTextString.applyFont(0, realText.length(), font); +// }else{ +// xssfRichTextString.applyFont(0, realText.length(), fontRed); +// } +// }else{ + xssfRichTextString.applyFont(0, realText.length(), font); + for (int i = 0; i < values.length; i++) { + if(!values[i].contains("ѷ")){ + xssfRichTextString.applyFont(realText.indexOf(values[i]), realText.indexOf(values[i])+values[i].length(), fontRed); + } + } +// } + + } + + return xssfRichTextString; + } + + + + /** + * + * + * @param session + * @param item İ汾 + * @param tcResource ļ· + * @param relationType ϵ + * @param fileName ļ + */ + public void setExcelToItem(TCSession session, TCComponentItemRevision item, String tcResource, + String fileName, String relationType, String excelType, boolean isDelete) { + try { + String as1[] = { tcResource };// ļ· + String as2[] = { "excel" }; + String as3[] = { excelType }; + String as4[] = { "Plain" }; + TCComponentDatasetType tccomponentDatasetType = (TCComponentDatasetType) session + .getTypeComponent("Dataset"); + TCComponentDataset tccomponentDataset = tccomponentDatasetType.create(fileName, "excel", excelType); + tccomponentDataset.setFiles(as1, as3, as4, as2); + AIFComponentContext[] zyzdsChildrens = item.getChildren(); + TCComponentItemRevision zyzdsRev = item; + for (AIFComponentContext zyzdsChildren : zyzdsChildrens) {// + if (excelType.equals(zyzdsChildren.getComponent().getType())) { + TCComponentDataset dateSet = (TCComponentDataset) zyzdsChildren.getComponent(); + if (dateSet.getStringProperty("object_name").equals(fileName)) { + dateSet.delete(); + zyzdsRev.remove(relationType, dateSet); + } + } + } + item.add(relationType, tccomponentDataset); + if (isDelete) { + new File(tcResource).delete(); + } + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + + + + /** + * ȡ + * + * @param session + * @param item İ汾 + * @param relationType ϵ + */ + public TCComponentDataset getExcelToDataset(TCSession session, TCComponentItemRevision item, + String relationType) { + try { + TCComponent[] zyzdsChildrens = item.getRelatedComponents(relationType); + if (zyzdsChildrens == null || zyzdsChildrens.length!=1) { + return null; + } + return (TCComponentDataset) zyzdsChildrens[0]; + + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return null; + } + + + + /** + * ȡ + * + * @param session + * @param item İ汾 + * @param relationType ϵ + */ + public File getExcelToItem(TCSession session, TCComponentItemRevision item, String relationType) { + try { + TCComponent[] zyzdsChildrens = item.getRelatedComponents(relationType); + if (zyzdsChildrens == null || zyzdsChildrens.length!=1) { + return null; + } + TCComponentDataset dateSet = (TCComponentDataset) zyzdsChildrens[0]; + TCComponentTcFile[] tcFile = dateSet.getTcFiles(); + return tcFile[0].getFmsFile(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return null; + } + + + + /** + * ıݼ + * + * @param tccomponentDataset + * @param quote + * @param type + * @param path + * @throws TCException + */ + public void changeDataSet(TCComponentDataset tccomponentDataset, String quote, String type, String path) + throws TCException { + String myPath[] = { path }; + String myQuote[] = { quote };// "excel" + String myType[] = { type };// "MSExcelX" + String myPlain[] = { "Plain" }; + + // ɾݼ + deleDateSetRef(tccomponentDataset);//ɾݼ + // ݼ滻 + tccomponentDataset.setFiles(myPath, myType, myPlain, myQuote);//ӵݼ + + } + + /** + * ɾݼ + * + * @param dataset + * @throws TCException + */ + private void deleDateSetRef(TCComponentDataset dataset) throws TCException { + + TCComponentTcFile[] tcFiles = dataset.getTcFiles(); + for (int i = 0; i < tcFiles.length; i++) { + // õݼ + String str_temp = getNamedRefType(dataset, tcFiles[i]); + // ɾ + dataset.removeNamedReference(str_temp); + } + + } + + + /** + * õݼ + * + * @param datasetComponent + * @param tccomponent + * @return + * @throws TCException + */ + private String getNamedRefType(TCComponentDataset datasetComponent, TCComponentTcFile tccomponent) + throws TCException { + String s; + s = ""; + TCProperty tcproperty; + TCProperty tcproperty1; + TCComponent atccomponent[]; + String as[]; + int i; + int j; + int k; + try { + tcproperty = datasetComponent.getTCProperty("ref_list"); + tcproperty1 = datasetComponent.getTCProperty("ref_names"); + if (tcproperty == null || tcproperty1 == null) + return s; + } catch (TCException tcexception) { + return s; + } + atccomponent = tcproperty.getReferenceValueArray(); + as = tcproperty1.getStringValueArray(); + if (atccomponent == null || as == null) + return s; + i = atccomponent.length; + if (i != as.length) + return s; + j = -1; + k = 0; + do { + if (k >= i) + break; + if (tccomponent == atccomponent[k]) { + j = k; + break; + } + k++; + } while (true); + if (j != -1) + s = as[j]; + return s; + } + + //+++ + + + private void writeToExcel(TCComponentProject project){ + FileInputStream fis=null; + FileOutputStream fos=null; + + + try { + AIFComponentContext[] children=project.getChildren("project_data")[0].getComponent().getChildren();//ȡʱµļУ + TCComponentSchedule schedule=null; + for(int i=children.length-1;i>=0;i--){ + TCComponent[] component=((TCComponent)children[i].getComponent()).getTCProperty("project_data").getReferenceValueArray();//ļµʱ + if(component!=null&&component.length>0&&(component[0] instanceof TCComponentSchedule)){ + schedule=(TCComponentSchedule) component[0];//ֻȡһʱ + } + } + TCComponent[] tasks=schedule.getAllTasks();//ȡʱµ +// TCComponent[] property=schedule.getTCProperty("schedule_deliverable_list").getReferenceValueArray();//ʱҲexcelģ + TCComponent[] property=schedule.getReferenceListProperty("schedule_deliverable_list");//ʱб + TCComponent excelData=null; + for(int i=0;i"+excelData.getType()); +// excelData=(TCComponentItem)excelData.getTCProperty("deliverable_inst").getReferenceValue(); + break; + } + } + if(excelData==null){ + wait.setBool(true); + wait.interrupt(); + MessageBox.post("ʱвΪ\"ƶĵƽƻ\"","",2); + return; + } + TCComponent component=excelData.getReferenceProperty("deliverable_inst"); + if(component==null){ + MessageBox.post("顰ƶĵƽƻܡĽüƻ","",MessageBox.ERROR); + wait.setBool(true); + wait.interrupt(); + } + TCComponent[] components=((TCComponentFolder)component).getTCProperty("contents").getReferenceValueArray(); +// if(!components[0].getType().equals("JK8PZGLJHRevision")) { +// wait.setBool(true); +// wait.interrupt(); +// MessageBox.post("¹Ҳùƻ汾","",2); +// return; +// } +// excelData=((TCComponentItem) excelData.getTCProperty("deliverable_inst").getReferenceValue().getChildren()[0].getComponent()).getLatestItemRevision().getTCProperty("IMAN_specification").getReferenceValueArray()[0]; + //2018.2.24 ùƻж汾ȡ·汾 + TCComponentItemRevision rev=(TCComponentItemRevision) components[0]; + for (int i = 0; i < components.length; i++) { + if(Integer.valueOf(components[i].getTCProperty("item_revision_id").getStringValue())>Integer.valueOf(rev.getTCProperty("item_revision_id").getStringValue())) { + if(!components[i].getProperty("release_status_list").equals("")) { + + rev=(TCComponentItemRevision) components[i]; + } + } + } + + + System.out.println("ȡ汾Ϊ"+rev.getProperty("item_revision_id")); + + try { + if(rev instanceof TCComponentItemRevision) { + + excelData=rev.getTCProperty("IMAN_specification").getReferenceValueArray()[0]; + } +// else if(components[0] instanceof TCComponentItem) { +// excelData=((TCComponentItem)components[0]).getLatestItemRevision().getTCProperty("IMAN_specification").getReferenceValueArray()[0]; +// } + } catch (Exception e) { + MessageBox.post("뽫ùƻ\"ƶĵƽƻ\"񽻸","",MessageBox.INFORMATION); + e.printStackTrace(); + return; + } + File file=((TCComponentDataset)excelData).getTcFiles()[0].getFmsFile(); +// File file=components[0].getTcFiles()[0].getFmsFile(); + + fis = new FileInputStream(file); + System.out.println("fis:"+fis); + XSSFWorkbook workbook = new XSSFWorkbook(fis); + if (workbook == null) { + MessageBox.post("excelļ", "", 2); + return; + } + + System.out.println("workBook:"+workbook);//TODO ҪȷJYunit +// String syb=project.getProperty("JYunit"); +// XSSFSheet sheet = workbook.getSheet("ùƻ"); + XSSFSheet sheet = workbook.getSheetAt(0);//2019.1.11 + if (sheet == null) { + MessageBox.post("sheet", "", 2); + return; + } + System.out.println("sheet:"+sheet); + StringBuffer sbUnknow = new StringBuffer(); + sbUnknow.append("½δģ¼ʵ:\n\n"); + boolean isdisplay=false; + boolean other=true; + for(int i=0;i"+sbUnknow.toString().equals("½δģ¼ʵ:\n\n")); + wait.setBool(true); + wait.interrupt(); + try { + if (!sbUnknow.toString().trim().equals("½δģ¼ʵ:")) { + String sbUnknowMessage = sbUnknow.toString(); + sbUnknowMessage = sbUnknowMessage.replace("½δģ¼ʵ:", + "½δģ¼ʵ:־ļ־.txt" + "\n"); + MessageBox.post(sbUnknowMessage, "ʾ", 2); + // 2018.1.15 ·µtxtļУʾûȥǶ + String message = sbUnknow.toString(); + FileSystemView fsv = FileSystemView.getFileSystemView(); // õϵͳfileview + String deskPath = fsv.getHomeDirectory().getPath(); // ǰû· + deskPath = deskPath + "\\־.txt"; + File f = new File(deskPath); + try { + if (f.exists()) { + System.out.print("ļ"); + } else { + System.out.print("ļ"); + f.createNewFile();// 򴴽 + } + } catch (IOException e) { + e.printStackTrace(); + } + FileWriter fw; + try { + fw = new FileWriter(f, true); + + BufferedWriter bw = new BufferedWriter(fw); + String[] messages = message.split("\n"); + for (int i = 0; i < message.split("\n").length; i++) { + String mes = messages[i]; + bw.write(mes); + bw.newLine(); + } + bw.flush(); + bw.close(); + fw.close(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + fos = new FileOutputStream(new File(pathRoute)); + workbook.write(fos); + Runtime.getRuntime().exec((new StringBuilder("cmd /c \"")).append(pathRoute).append("\"").toString()); +// TCComponent schedule=(TCComponent)((TCComponent)project.getChildren("Ŀ")[1].getComponent()).getChildren("ʱ")[0].getComponent().getChildren()[0].getComponent(); +// MessageBox.post(""+schedule,"",2); + } catch (Exception e) { + e.printStackTrace(); +// disposeDialog(); + MessageBox.post("ʧ","",2); + return; + }finally{ + try { + if(fis!=null) + fis.close(); + if(fos!=null) + fos.close(); + } catch (IOException e) { + e.printStackTrace(); + } + + } + + } + + + +} diff --git a/src/com/connor/jk/plm/tallySheet/TallySheetUtil2.java b/src/com/connor/jk/plm/tallySheet/TallySheetUtil2.java new file mode 100644 index 0000000..d77ac95 --- /dev/null +++ b/src/com/connor/jk/plm/tallySheet/TallySheetUtil2.java @@ -0,0 +1,311 @@ +package com.connor.jk.plm.tallySheet; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.poi.xssf.usermodel.XSSFRow; +import org.apache.poi.xssf.usermodel.XSSFSheet; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.kernel.AIFComponentContext; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentScheduleTask; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class TallySheetUtil2 { + static AbstractAIFApplication app = AIFUtility.getCurrentApplication(); + static TCSession session = (TCSession) app.getSession(); + + public static void writeToExcel(boolean other,boolean isdisplay,StringBuffer sbUnknow,TCComponentScheduleTask task, XSSFSheet sheet) { + + try { + List list = new ArrayList(); + Map indexMap = new HashMap(); + String name = task.getProperty("object_name"); + // System.out.println("name:" + name); + boolean flag = false; + String temp = ""; + for (int i = 3; i < sheet.getLastRowNum()+1; i++) { + //ڴкźͽƵmap + if (sheet.getRow(i) == null) + break;//Ϊգ + if (sheet.getRow(i).getCell(5) == null) { + break;//Ϊգ + } + String cellValue = sheet.getRow(i).getCell(5).getStringCellValue();// + // System.out.println(i + cellValue); + // TODO + String cName = + sheet.getRow(i).getCell(2).getStringCellValue();// ׶ + String cYewu = + sheet.getRow(i).getCell(3).getStringCellValue();// + String diliverableName = sheet.getRow(i).getCell(5).getStringCellValue();// + // System.out.println("cYewu=========>"+"*"+cYewu+"*"); + if (!cYewu.equals("")) { + temp = cYewu; + } + if (cName == null) + break; + if (cName.endsWith(name)) + flag = true; + else if (cName.length() > 0) + flag = false; +// if (flag && cellValue != null && cellValue.length() > 0) { +// +//// indexMap.put(i, cellValue + "&" + temp);// &ߣi +// indexMap.put(i, cellValue);// &ߣi +// System.out.println(cellValue+"<=cellValue+&+temp========i=>"+i); +// +// } + indexMap.put(i, cellValue);// &ߣi +// System.out.println(cellValue+"<=cellValue+&+temp========i=>"+i); + } + if (indexMap.size() == 0) + return ; + // ||name.equals(cName) + // System.out.println(indexMap); +// System.out.println("task-------------->"+task); +// System.out.println(task.getChildren("child_task_taglist")[0]+"999999999999999"); + if(task.getChildren("child_task_taglist").length==0){ + TCComponent[] cs2=task.getReferenceListProperty("sch_task_deliverable_list"); + String[] setProp = { "ResourceAssignment", "finish_date", "actual_finish_date" };// ʱˣʱ䣬ʵʱ + SimpleDateFormat format = new SimpleDateFormat("yy-MM-dd hh:mm"); + String iName = null; + for (int j = 0; j < cs2.length; j++) { + TCProperty property = cs2[j].getTCProperty("fnd0DeliverableInstance"); +// System.out.println( property.getReferenceValue().getChildren()[0].getComponent()); + AIFComponentContext[] items = property == null ? null + : (property.getReferenceValue() == null ? null + : property.getReferenceValue().getChildren()); + if (items != null && items.length > 0) { + for (int k = 0; k < items.length; k++) { + /** + * iName = ((TCComponentItem) + * items[k].getComponent()) .getLatestItemRevision() + * .getTCProperty("IMAN_master_form_rev") + * .getReferenceValueArray()[0] + * .getProperty("JyDocType"); + **/ + iName = items[k].getComponent() + .getProperty("object_name"); + String wzmc = iName + "&" + task; + String weizhi = task + "--Ϊ\"" + iName+"\""; + String jfwId = items[k].getComponent() + .getProperty("item_id") + "-" + + items[k].getComponent() + .getProperty("item_revision_id"); + // String jfwId = ((TCComponentItem) items[k] + // .getComponent()).getLatestItemRevision() + // .getProperty("item_id")+"-"+((TCComponentItem) + // items[k] + // .getComponent()).getLatestItemRevision() + // .getProperty("item_revision_id"); + if (indexMap.containsValue(iName)) { + // System.out.println("InIname:" + iName); + int index = 0; + for (int f = 3; f < sheet.getLastRowNum()+1; f++) { + if (indexMap.get(f) != null && indexMap.get(f).equals(iName)) { + index = f; + break; + } + + } + if (index != 0) { + XSSFRow row = sheet.getRow(index); + String data[] = task.getProperties(setProp); + System.out.println("data:" + Arrays.toString(data)); + + row.getCell(8).setCellValue(data[0]);// + +// System.out.println("******************************************"); +// System.out.println(data[0]); +// System.out.println("******************************************"); + row.getCell(9).setCellValue(jfwId);// 汾 + row.getCell(10).setCellValue(data[1]);// ʱ + row.getCell(11).setCellValue(data[2]);// ʵʱ + // TODO °汾 ޸ʱ + String revisionNew =""; + TCComponent components1= session.search("...", new String[] { " ID" }, + new String[] { items[k].getComponent() + .getProperty("item_id") })[0]; + TCComponentItem item1=(TCComponentItem)components1; + revisionNew=item1.getLatestItemRevision().getTCProperty("item_revision_id").getStringValue(); + String jfwNew = items[k].getComponent() + .getProperty("item_id") + "-" + +revisionNew ; + if (data[2] != null && data[2].length() > 0) { + long duration = format.parse(data[2]).getTime() + - format.parse(data[1]).getTime(); + if (duration > 0) { + row.getCell(12).setCellValue("ӳ" + (duration / 1000 / 60 / 60 / 24) + ""); + } else if (duration == 0) { + row.getCell(12).setCellValue("ʱ"); + } else { + row.getCell(12) + .setCellValue("ǰ" + -(duration / 1000 / 60 / 60 / 24) + ""); + } + + } + row.getCell(13).setCellValue(jfwNew);// °汾 + // TODO + // Ҫȷ޸ʱȡ°汾ϴ޸ڣlast_mod_dateǴʱ䣨creation_date + String date=item1.getLatestItemRevision().getTCProperty("last_mod_date").getDisplayableValue(); + System.out.println("---------------------------------------------------------------->"+date); + row.getCell(17).setCellValue(item1.getLatestItemRevision().getTCProperty("last_mod_date").getDisplayableValue());// °汾޸ʱ + + indexMap.remove(index); + + } + } else { + System.out.println(weizhi + "(" + jfwId + ")"); + list.add(weizhi + "(" + jfwId + ")"); + + } + } + + break; + } + } +// return true; + }else{ + + AIFComponentContext[] children = task.getChildren("child_task_taglist")[0].getComponent().getChildren(); + System.out.println("taskchildrenLength:" + task.getChildren().length); + String[] setProp = { "ResourceAssignment", "finish_date", "actual_finish_date" };// ʱˣʱ䣬ʵʱ + SimpleDateFormat format = new SimpleDateFormat("yy-MM-dd hh:mm"); + for (int i = 0; i < children.length; i++) { + System.out.println("children[i]---------------->"+children[i]); + TCComponentScheduleTask cTask = (TCComponentScheduleTask) children[i].getComponent(); + System.out.println("cTask:" + cTask);// ҵ + + String iName = null; +// AIFComponentContext[] cs2 = cTask.getChildren()[1].getComponent().getChildren(); + TCComponent[] cs2 = cTask.getReferenceListProperty("sch_task_deliverable_list"); + for (int j = 0; j < cs2.length; j++) { + TCProperty property = cs2[j].getTCProperty("fnd0DeliverableInstance"); +// System.out.println( property.getReferenceValue().getChildren()[0].getComponent()); + AIFComponentContext[] items = property == null ? null + : (property.getReferenceValue() == null ? null + : property.getReferenceValue().getChildren()); + if (items != null && items.length > 0) { + for (int k = 0; k < items.length; k++) { + /** + * iName = ((TCComponentItem) + * items[k].getComponent()) .getLatestItemRevision() + * .getTCProperty("IMAN_master_form_rev") + * .getReferenceValueArray()[0] + * .getProperty("JyDocType"); + **/ + iName = items[k].getComponent() + .getProperty("object_name"); + String wzmc = iName + "&" + cTask; + String weizhi = task + "--" + cTask + "--\"" + iName+"\""; + String jfwId = items[k].getComponent() + .getProperty("item_id") + "-" + + items[k].getComponent() + .getProperty("item_revision_id"); + // String jfwId = ((TCComponentItem) items[k] + // .getComponent()).getLatestItemRevision() + // .getProperty("item_id")+"-"+((TCComponentItem) + // items[k] + // .getComponent()).getLatestItemRevision() + // .getProperty("item_revision_id"); + if (indexMap.containsValue(iName)) { + // System.out.println("InIname:" + iName); + int index = 0; + System.out.println(""+sheet.getLastRowNum()+""); + for (int f = 3; f < sheet.getLastRowNum()+1; f++) { + if (indexMap.get(f) != null && indexMap.get(f).equals(iName)) { + index = f; + break; + } + + } + if (index != 0) { + XSSFRow row = sheet.getRow(index); + String data[] = cTask.getProperties(setProp); + System.out.println("data:" + Arrays.toString(data)); + + row.getCell(8).setCellValue(data[0]);// + String id_rev=row.getCell(9).getStringCellValue(); + if(id_rev.length()>0) { + int old_rev=Integer.valueOf(id_rev.split("-")[1]); + int new_rev=Integer.valueOf(jfwId.split("-")[1]); + if(new_rev>old_rev) { + + row.getCell(9).setCellValue(jfwId);// 汾 + } + }else { + + row.getCell(9).setCellValue(jfwId);// 汾 + } + row.getCell(10).setCellValue(data[1]);// ʱ + row.getCell(11).setCellValue(data[2]);// ʵʱ + // TODO °汾 ޸ʱ + String revisionNew = session.search("...", new String[] { " ID" }, + new String[] { items[k].getComponent() + .getProperty("item_id") })[0] + .toDisplayString(); + TCComponent components1= session.search("...", new String[] { " ID" }, + new String[] { items[k].getComponent() + .getProperty("item_id") })[0]; + TCComponentItem item1=(TCComponentItem)components1; + revisionNew=item1.getLatestItemRevision().getTCProperty("item_revision_id").getStringValue(); + String jfwNew = items[k].getComponent() + .getProperty("item_id") + "-" + revisionNew; + if (data[2] != null && data[2].length() > 0) { + long duration = format.parse(data[2]).getTime() + - format.parse(data[1]).getTime(); + if (duration > 0) { + row.getCell(12).setCellValue("ӳ" + (duration / 1000 / 60 / 60 / 24) + ""); + } else if (duration == 0) { + row.getCell(12).setCellValue("ʱ"); + } else { + row.getCell(12) + .setCellValue("ǰ" + -(duration / 1000 / 60 / 60 / 24) + ""); + } + + } + row.getCell(13).setCellValue(jfwNew);// °汾 + // TODO + // Ҫȷ޸ʱȡ°汾ϴ޸ڣlast_mod_dateǴʱ䣨creation_date + row.getCell(14).setCellValue(items[k].getComponent().getProperty("last_mod_date"));// °汾޸ʱ + +// indexMap.remove(index); + + } + } else { +// list.add(weizhi + "(" + jfwId + ")"); + + } + } + + break; + } + } + + } + } + if (list != null && list.size() > 0) { +// StringBuffer sb = new StringBuffer(); + System.out.println("kkkkkkkkkkkkkkkkkkkkkkkkkkkkk"); + isdisplay=true; + sbUnknow.append( list + "\n\n"); +// sb.append("½δģ¼ʵ:\n\n" + list + "\n\n"); +// MessageBox.post(sb.toString(), "ʾ", 2); + } + } catch (Exception e) { + other= false; + e.printStackTrace(); + } + other= true; + } +} diff --git a/src/com/connor/jk/plm/tallySheet/TallySheetUtil2_2.java b/src/com/connor/jk/plm/tallySheet/TallySheetUtil2_2.java new file mode 100644 index 0000000..9ba0295 --- /dev/null +++ b/src/com/connor/jk/plm/tallySheet/TallySheetUtil2_2.java @@ -0,0 +1,323 @@ +package com.connor.jk.plm.tallySheet; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.poi.xssf.usermodel.XSSFRow; +import org.apache.poi.xssf.usermodel.XSSFSheet; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.kernel.AIFComponentContext; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentScheduleTask; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class TallySheetUtil2_2 { + static AbstractAIFApplication app = AIFUtility.getCurrentApplication(); + static TCSession session = (TCSession) app.getSession(); + + public static void writeToExcel(boolean other,boolean isdisplay,StringBuffer sbUnknow,TCComponentScheduleTask task, XSSFSheet sheet) { + + try { + List list = new ArrayList(); + Map indexMap = new HashMap(); + String name = task.getProperty("object_name"); + // System.out.println("name:" + name); + boolean flag = false; + String temp = ""; + for (int i = 3; i < sheet.getLastRowNum()+1; i++) { + //ڴкźͽƵmap + if (sheet.getRow(i) == null) + break;//Ϊգ + if (sheet.getRow(i).getCell(5) == null) { + break;//Ϊգ + } + String cellValue = sheet.getRow(i).getCell(5).getStringCellValue();// + // System.out.println(i + cellValue); + // TODO + String cName = + sheet.getRow(i).getCell(2).getStringCellValue();// ׶ + String cYewu = + sheet.getRow(i).getCell(3).getStringCellValue();// + String diliverableName = sheet.getRow(i).getCell(5).getStringCellValue();// + // System.out.println("cYewu=========>"+"*"+cYewu+"*"); + if (!cYewu.equals("")) { + temp = cYewu; + } + if (cName == null) + break; + if (cName.endsWith(name)) + flag = true; + else if (cName.length() > 0) + flag = false; +// if (flag && cellValue != null && cellValue.length() > 0) { +// +//// indexMap.put(i, cellValue + "&" + temp);// &ߣi +// indexMap.put(i, cellValue);// &ߣi +// System.out.println(cellValue+"<=cellValue+&+temp========i=>"+i); +// +// } + indexMap.put(i, cellValue);// &ߣi +// System.out.println(cellValue+"<=cellValue+&+temp========i=>"+i); + } + if (indexMap.size() == 0) + return ; + // ||name.equals(cName) + // System.out.println(indexMap); +// System.out.println("task-------------->"+task); +// System.out.println(task.getChildren("child_task_taglist")[0]+"999999999999999"); + if(task.getChildren("child_task_taglist").length==0){ + TCComponent[] cs2=task.getReferenceListProperty("sch_task_deliverable_list"); + String[] setProp = { "ResourceAssignment", "finish_date", "actual_finish_date" };// ʱˣʱ䣬ʵʱ + SimpleDateFormat format = new SimpleDateFormat("yy-MM-dd hh:mm"); + String iName = null; + for (int j = 0; j < cs2.length; j++) { + TCProperty property = cs2[j].getTCProperty("fnd0DeliverableInstance"); +// System.out.println( property.getReferenceValue().getChildren()[0].getComponent()); + AIFComponentContext[] items = property == null ? null + : (property.getReferenceValue() == null ? null + : property.getReferenceValue().getChildren()); + System.out.println("н--------------"+items.length); + if (items != null && items.length > 0) { + for (int k = 0; k < items.length; k++) { + /** + * iName = ((TCComponentItem) + * items[k].getComponent()) .getLatestItemRevision() + * .getTCProperty("IMAN_master_form_rev") + * .getReferenceValueArray()[0] + * .getProperty("JyDocType"); + **/ + iName = items[k].getComponent() + .getProperty("object_name"); + String wzmc = iName + "&" + task; + String weizhi = task + "--Ϊ\"" + iName+"\""; + String jfwId = items[k].getComponent() + .getProperty("item_id") + "-" + + items[k].getComponent() + .getProperty("item_revision_id"); + // String jfwId = ((TCComponentItem) items[k] + // .getComponent()).getLatestItemRevision() + // .getProperty("item_id")+"-"+((TCComponentItem) + // items[k] + // .getComponent()).getLatestItemRevision() + // .getProperty("item_revision_id"); + if (indexMap.containsValue(iName)) { + // System.out.println("InIname:" + iName); + int index = 0; + for (int f = 3; f < sheet.getLastRowNum()+1; f++) { + if (indexMap.get(f) != null && indexMap.get(f).equals(iName)) { + index = f; + break; + } + + } + if (index != 0) { + XSSFRow row = sheet.getRow(index); + String data[] = task.getProperties(setProp); + System.out.println("data:" + Arrays.toString(data)); + + row.getCell(8).setCellValue(data[0]);// + +// System.out.println("******************************************"); +// System.out.println(data[0]); +// System.out.println("******************************************"); + String id_rev=row.getCell(9).getStringCellValue(); + if(id_rev.length()>0) { + int old_rev=Integer.valueOf(id_rev.split("-")[1]); + int new_rev=Integer.valueOf(jfwId.split("-")[1]); + if(new_rev>old_rev) { + + row.getCell(9).setCellValue(jfwId);// 汾 + } + }else { + + row.getCell(9).setCellValue(jfwId);// 汾 + } + row.getCell(10).setCellValue(data[1]);// ʱ + row.getCell(11).setCellValue(data[2]);// ʵʱ + // TODO °汾 ޸ʱ + String revisionNew =""; + TCComponent components1= session.search("...", new String[] { " ID" }, + new String[] { items[k].getComponent() + .getProperty("item_id") })[0]; + TCComponentItem item1=(TCComponentItem)components1; + revisionNew=item1.getLatestItemRevision().getTCProperty("item_revision_id").getStringValue(); + String jfwNew = items[k].getComponent() + .getProperty("item_id") + "-" + +revisionNew ; + if (data[2] != null && data[2].length() > 0) { + long duration = format.parse(data[2]).getTime() + - format.parse(data[1]).getTime(); + if (duration > 0) { + row.getCell(12).setCellValue("ӳ" + (duration / 1000 / 60 / 60 / 24) + ""); + } else if (duration == 0) { + row.getCell(12).setCellValue("ʱ"); + } else { + row.getCell(12) + .setCellValue("ǰ" + -(duration / 1000 / 60 / 60 / 24) + ""); + } + + } + row.getCell(13).setCellValue(jfwNew);// °汾 + // TODO + // Ҫȷ޸ʱȡ°汾ϴ޸ڣlast_mod_dateǴʱ䣨creation_date + String date=item1.getLatestItemRevision().getTCProperty("last_mod_date").getDisplayableValue(); + System.out.println("---------------------------------------------------------------->"+date); + row.getCell(17).setCellValue(item1.getLatestItemRevision().getTCProperty("last_mod_date").getDisplayableValue());// °汾޸ʱ + +// indexMap.remove(index); + + } + } else { + System.out.println(weizhi + "(" + jfwId + ")"); + list.add(weizhi + "(" + jfwId + ")"); + + } + } + + break; + } + } +// return true; + }else{ + + AIFComponentContext[] children = task.getChildren("child_task_taglist")[0].getComponent().getChildren(); + System.out.println("taskchildrenLength:" + task.getChildren().length); + String[] setProp = { "ResourceAssignment", "finish_date", "actual_finish_date" };// ʱˣʱ䣬ʵʱ + SimpleDateFormat format = new SimpleDateFormat("yy-MM-dd hh:mm"); + for (int i = 0; i < children.length; i++) { + System.out.println("children[i]---------------->"+children[i]); + TCComponentScheduleTask cTask = (TCComponentScheduleTask) children[i].getComponent(); + System.out.println("cTask:" + cTask);// ҵ + + String iName = null; +// AIFComponentContext[] cs2 = cTask.getChildren()[1].getComponent().getChildren(); + TCComponent[] cs2 = cTask.getReferenceListProperty("sch_task_deliverable_list"); + for (int j = 0; j < cs2.length; j++) { + TCProperty property = cs2[j].getTCProperty("fnd0DeliverableInstance"); +// System.out.println( property.getReferenceValue().getChildren()[0].getComponent()); + AIFComponentContext[] items = property == null ? null + : (property.getReferenceValue() == null ? null + : property.getReferenceValue().getChildren()); + if (items != null && items.length > 0) { + for (int k = 0; k < items.length; k++) { + /** + * iName = ((TCComponentItem) + * items[k].getComponent()) .getLatestItemRevision() + * .getTCProperty("IMAN_master_form_rev") + * .getReferenceValueArray()[0] + * .getProperty("JyDocType"); + **/ + iName = items[k].getComponent() + .getProperty("object_name"); + String wzmc = iName + "&" + cTask; + String weizhi = task + "--" + cTask + "--\"" + iName+"\""; + String jfwId = items[k].getComponent() + .getProperty("item_id") + "-" + + items[k].getComponent() + .getProperty("item_revision_id"); + // String jfwId = ((TCComponentItem) items[k] + // .getComponent()).getLatestItemRevision() + // .getProperty("item_id")+"-"+((TCComponentItem) + // items[k] + // .getComponent()).getLatestItemRevision() + // .getProperty("item_revision_id"); + if (indexMap.containsValue(iName)) { + // System.out.println("InIname:" + iName); + int index = 0; + System.out.println(""+sheet.getLastRowNum()+""); + for (int f = 3; f < sheet.getLastRowNum()+1; f++) { + if (indexMap.get(f) != null && indexMap.get(f).equals(iName)) { + index = f; + break; + } + + } + if (index != 0) { + XSSFRow row = sheet.getRow(index); + String data[] = cTask.getProperties(setProp); + System.out.println("data:" + Arrays.toString(data)); + + row.getCell(8).setCellValue(data[0]);// + String id_rev=row.getCell(9).getStringCellValue(); + if(id_rev.length()>0) { + int old_rev=Integer.valueOf(id_rev.split("-")[1]); + int new_rev=Integer.valueOf(jfwId.split("-")[1]); + if(new_rev>old_rev) { + + row.getCell(9).setCellValue(jfwId);// 汾 + } + }else { + + row.getCell(9).setCellValue(jfwId);// 汾 + } + row.getCell(10).setCellValue(data[1]);// ʱ + row.getCell(11).setCellValue(data[2]);// ʵʱ + // TODO °汾 ޸ʱ + String revisionNew = session.search("...", new String[] { " ID" }, + new String[] { items[k].getComponent() + .getProperty("item_id") })[0] + .toDisplayString(); + TCComponent components1= session.search("...", new String[] { " ID" }, + new String[] { items[k].getComponent() + .getProperty("item_id") })[0]; + TCComponentItem item1=(TCComponentItem)components1; + revisionNew=item1.getLatestItemRevision().getTCProperty("item_revision_id").getStringValue(); + String jfwNew = items[k].getComponent() + .getProperty("item_id") + "-" + revisionNew; + if (data[2] != null && data[2].length() > 0) { + long duration = format.parse(data[2]).getTime() + - format.parse(data[1]).getTime(); + if (duration > 0) { + row.getCell(12).setCellValue("ӳ" + (duration / 1000 / 60 / 60 / 24) + ""); + } else if (duration == 0) { + row.getCell(12).setCellValue("ʱ"); + } else { + row.getCell(12) + .setCellValue("ǰ" + -(duration / 1000 / 60 / 60 / 24) + ""); + } + + } + row.getCell(13).setCellValue(jfwNew);// °汾 + // TODO + // Ҫȷ޸ʱȡ°汾ϴ޸ڣlast_mod_dateǴʱ䣨creation_date + row.getCell(14).setCellValue(items[k].getComponent().getProperty("last_mod_date"));// °汾޸ʱ + +// indexMap.remove(index); + + } + } else { +// list.add(weizhi + "(" + jfwId + ")"); + + } + } + + break; + } + } + + } + } + if (list != null && list.size() > 0) { +// StringBuffer sb = new StringBuffer(); + System.out.println("kkkkkkkkkkkkkkkkkkkkkkkkkkkkk"); + isdisplay=true; + sbUnknow.append( list + "\n\n"); +// sb.append("½δģ¼ʵ:\n\n" + list + "\n\n"); +// MessageBox.post(sb.toString(), "ʾ", 2); + } + } catch (Exception e) { + other= false; + e.printStackTrace(); + } + other= true; + } +} diff --git a/src/com/connor/jk/plm/tempToFormal/ClassProperty.java b/src/com/connor/jk/plm/tempToFormal/ClassProperty.java new file mode 100644 index 0000000..57a0088 --- /dev/null +++ b/src/com/connor/jk/plm/tempToFormal/ClassProperty.java @@ -0,0 +1,42 @@ +package com.connor.jk.plm.tempToFormal; + +/** + * @copyRight 㽭տƼ޹˾ + * @author E-mail:hub@connor.net.cn + * @date ʱ䣺2017-7-3 11:47:03 + * @version v1.0 + * @parameter + * @since + * @return + */ + +public class ClassProperty { + private int propertyID; + private String value; + + public ClassProperty() { + + } + + public ClassProperty(int propertyID, String value) { + this.propertyID = propertyID; + this.value = value; + } + + public int getPropertyID() { + return propertyID; + } + + public void setPropertyID(int propertyID) { + this.propertyID = propertyID; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + +} diff --git a/src/com/connor/jk/plm/tempToFormal/SoaServerUtil.java b/src/com/connor/jk/plm/tempToFormal/SoaServerUtil.java new file mode 100644 index 0000000..35ea778 --- /dev/null +++ b/src/com/connor/jk/plm/tempToFormal/SoaServerUtil.java @@ -0,0 +1,234 @@ +package com.connor.jk.plm.tempToFormal; + +import java.util.ArrayList; +import java.util.List; + +import net.sf.json.JSONArray; + +import org.apache.axiom.om.OMAbstractFactory; +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.OMFactory; +import org.apache.axiom.om.OMNamespace; +import org.apache.axis2.AxisFault; +import org.apache.axis2.addressing.EndpointReference; +import org.apache.axis2.client.Options; +import org.apache.axis2.client.ServiceClient; +import org.apache.axis2.transport.http.HTTPConstants; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCAccessControlService; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCComponentUser; +import com.teamcenter.rac.kernel.TCComponentUserType; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.kernel.TCUserService; + +public class SoaServerUtil { + + public static void sendToClass(String wsoPUID, String classID, String json,String url) { +// AbstractAIFApplication app; +// app=AIFUtility.getCurrentApplication(); +// TCSession session; +// session=(TCSession) app.getSession(); +// TCPreferenceService preferenceService; +// preferenceService=session.getPreferenceService(); +// String account=preferenceService.getStringValue("Autocode_PriverUser_ID"); +// String url; +// url = preferenceService.getStringValue("Autocode_SendClassServer_URL"); + try { + ServiceClient sc = new ServiceClient(); + Options opts = new Options(); +// url = "http://10.201.5.203:19090/ErpWebService.asmx?WSDL"; + EndpointReference end = new EndpointReference(url); + opts.setTo(end); + opts.setAction("SendToClass"); + sc.setOptions(opts); + + OMFactory fac = OMAbstractFactory.getOMFactory(); + OMNamespace omNs = fac.createOMNamespace("http://tempuri.org/", ""); + OMElement method = fac.createOMElement("SendToClass", omNs); + OMElement value = fac.createOMElement("wsoPuiid", omNs); + value.setText(wsoPUID); + OMElement value1 = fac.createOMElement("classID", omNs); + value1.setText(classID); + OMElement value2 = fac.createOMElement("JsonContainer", omNs); + // "[{\"value\":\"1\",\"propertyID\":-500003},{\"value\":\"1\",\"propertyID\":-500011}]" + value2.setText(json); + + method.addChild(value); + method.addChild(value1); + method.addChild(value2); + + OMElement res = sc.sendReceive(method); + res.getFirstElement().getText(); + System.out.println(res.getFirstElement().getText()); + } catch (AxisFault e) { + e.printStackTrace(); + } + + } +// public static void main(String[] args) { +// deleteClass("1111", ""); +// } + //ɾʱ + public static void deleteClass(String icoPUID,String url) { + try { + ServiceClient sc = new ServiceClient(); + Options opts = new Options(); +// url = "http://10.201.5.203:19090/ErpWebService.asmx?WSDL";//TODO ѡAutocode_SendClassServer_URL +// url = preferenceService.getStringValue("Autocode_SendClassServer_URL");//TODO ѡAutocode_SendClassServer_URL + EndpointReference end = new EndpointReference(url); + opts.setTo(end); + opts.setAction("DeleteClass"); + opts.setProperty(HTTPConstants.CHUNKED, "false"); + sc.setOptions(opts); + + OMFactory fac = OMAbstractFactory.getOMFactory(); + OMNamespace omNs = fac.createOMNamespace("http://tempuri.org/", ""); + OMElement method = fac.createOMElement("DeleteClass", omNs); + OMElement value = fac.createOMElement("icoPuid", omNs); + value.setText(icoPUID); +// OMElement value1 = fac.createOMElement("classID", omNs); +//// value1.setText(classID); +// OMElement value2 = fac.createOMElement("JsonContainer", omNs); + // "[{\"value\":\"1\",\"propertyID\":-500003},{\"value\":\"1\",\"propertyID\":-500011}]" +// value2.setText(json); + + method.addChild(value); +// method.addChild(value1); +// method.addChild(value2); + + OMElement res = sc.sendReceive(method); + res.getFirstElement().getText(); + System.out.println(res.getFirstElement().getText()); + } catch (AxisFault e) { + e.printStackTrace(); + } + + } + + public static String objectToJson(List props) { + String str = null; + try { + JSONArray json = JSONArray.fromObject(props);// javaתΪjson + str = json.toString();// jsonתΪַ + } catch (Exception e) { + e.printStackTrace(); + } + System.out.println("JSON =>"+str); + return str; + } + + + + public static void grantReadPrivilege(TCSession tcSession, TCComponent tccomponent + ) { + AbstractAIFApplication app; + app=AIFUtility.getCurrentApplication(); + TCSession session; + session=(TCSession) app.getSession(); + TCPreferenceService preferenceService; + preferenceService=session.getPreferenceService(); + String account=preferenceService.getStringValue("Autocode_PriverUser_ID"); + try { + TCAccessControlService accessControlService = tcSession + .getTCAccessControlService(); + TCComponentUserType type = (TCComponentUserType) tcSession.getTypeComponent("User"); + TCComponentUser user = type.find(account); + + if(user ==null){ + return; + } + if(tcSession.getUser().equals(user)){ + return; + } + + String[] as2 = new String[] { "READ" }; + + if (tccomponent instanceof TCComponentItemRevision) { + TCComponentItem tempItem = ((TCComponentItemRevision) tccomponent) + .getItem(); + openByPass(tcSession); + accessControlService.grantPrivilege(tempItem, user, as2); + closeByPass(tcSession); + + + openByPass(tcSession); + accessControlService.grantPrivilege(tccomponent, user, as2); + closeByPass(tcSession); + } else { + openByPass(tcSession); + accessControlService.grantPrivilege(tccomponent, user, as2); + closeByPass(tcSession); + } + } catch (TCException e) { + e.printStackTrace(); + } + } + + public static void grantWritePrivilege(TCSession tcSession, TCComponent tccomponent + ) { + AbstractAIFApplication app; + app=AIFUtility.getCurrentApplication(); + TCSession session; + session=(TCSession) app.getSession(); + TCPreferenceService preferenceService; + preferenceService=session.getPreferenceService(); + String account=preferenceService.getStringValue("Autocode_PriverUser_ID"); + try { + TCAccessControlService accessControlService = tcSession + .getTCAccessControlService(); + TCComponentUserType type = (TCComponentUserType) tcSession.getTypeComponent("User"); + + TCComponentUser user = type.find(account); + if(user ==null){ + return; + } + if(tcSession.getUser().equals(user)){ + return; + } + + String[] as2 = new String[] { "READ", "WRITE","DELETE" }; + + if (tccomponent instanceof TCComponentItemRevision) { + TCComponentItem tempItem = ((TCComponentItemRevision) tccomponent) + .getItem(); + openByPass(tcSession); + accessControlService.grantPrivilege(tempItem, user, as2); + closeByPass(tcSession); + + + openByPass(tcSession); + accessControlService.grantPrivilege(tccomponent, user, as2); + closeByPass(tcSession); + } else { + openByPass(tcSession); + accessControlService.grantPrivilege(tccomponent, user, as2); + closeByPass(tcSession); + } + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public static void openByPass(TCSession session) throws TCException { + TCUserService userservice = session.getUserService(); + Object[] obj = new Object[1]; + obj[0] = "origin"; + userservice.call("ORIGIN_set_bypass", obj); + } + + public static void closeByPass(TCSession session) throws TCException { + TCUserService userservice = session.getUserService(); + Object[] obj = new Object[1]; + obj[0] = "origin"; + userservice.call("ORIGIN_close_bypass", obj); + } + +} diff --git a/src/com/connor/jk/plm/tempToFormal/Util.java b/src/com/connor/jk/plm/tempToFormal/Util.java new file mode 100644 index 0000000..f680364 --- /dev/null +++ b/src/com/connor/jk/plm/tempToFormal/Util.java @@ -0,0 +1,53 @@ +package com.connor.jk.plm.tempToFormal; +import java.util.List; + +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.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +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.TCUserService; +import com.teamcenter.rac.util.MessageBox; + +public class Util { + public static TCPreferenceService service; + public static TCSession session; + public static TCUserService userservice;; + + static { + if (session == null) { + session = (TCSession) (AIFUtility.getCurrentApplication() + .getSession()); + } + if (service == null) + service = session.getPreferenceService(); + } + + public static void setByPass(boolean val) throws TCException { + if (userservice == null) { + userservice = session.getUserService(); + } + Object[] obj = new Object[1]; + obj[0] = "origin"; + if (val) { + userservice.call("ORIGIN_set_bypass", obj); + } else { + userservice.call("ORIGIN_close_bypass", obj); + } + } + + +} diff --git a/src/com/connor/jk/plm/tempToFormal/tempToFormal_Action.java b/src/com/connor/jk/plm/tempToFormal/tempToFormal_Action.java new file mode 100644 index 0000000..a9f8cd0 --- /dev/null +++ b/src/com/connor/jk/plm/tempToFormal/tempToFormal_Action.java @@ -0,0 +1,197 @@ +/** + * + */ +package com.connor.jk.plm.tempToFormal; + +//import java.awt.event.ActionEvent; +import java.util.HashMap; +import java.util.Map; + +import com.connor.jk.plm.DbomToEbom.ChangeDbomUtil; + +//import javax.swing.AbstractAction; + +//import org.eclipse.core.commands.AbstractHandler; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.common.actions.AbstractAIFAction; +import com.teamcenter.rac.aif.kernel.AIFComponentContext; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentFolder; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCException; +//import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +//import com.teamcenter.rac.kernel.TCUserService; +import com.teamcenter.rac.util.MessageBox; + +/** + * @author Administrator + * + */ +public class tempToFormal_Action extends AbstractAIFAction { + private AbstractAIFApplication app; + private InterfaceAIFComponent targetComp; + private TCSession session; + + private TCProperty[] props; + private String[] prop = new String[8]; + private AIFComponentContext aif;// °汾 + + boolean jk8IsRollout=false; + + public tempToFormal_Action(AbstractAIFApplication arg0, String arg1) { + super(arg0, arg1); + this.app = arg0; + this.session = (TCSession) app.getSession(); + this.targetComp = app.getTargetComponent(); + } + + public void getPropMsg(AIFComponentContext aif2) throws Exception { + if (aif2.getComponent() instanceof TCComponentItemRevision) { + TCComponentItemRevision rev = (TCComponentItemRevision) aif2.getComponent(); + // ȡһ + props = rev.getTCProperties(new String[] { "cd9_codeDesc", "cd9_codeId", "cd9_codePattern", + "cd9_codeRuleName", "cd9_codeStyle", "cd9_codeValue1", "cd9_codeValueDesc1", "cd9_generateID" }); + for (int i = 0; i < prop.length; i++) { + prop[i] = props[i].getStringValue(); + + } + } + } + + @Override + public void run() { + if (!targetComp.getType().equals("JK8LSMaterial")) { + MessageBox.post("ѡʱִд˲", "", MessageBox.ERROR); + return; + } else if (targetComp.getType().equals("JK8LSMaterial")) { + // ȡµķ汾Уȡԣûʾ + try { + AIFComponentContext[] aifComponentContextsTemp = targetComp.getChildren(); + int num = 0; + for (int i = 0; i < aifComponentContextsTemp.length; i++) { + if ((aifComponentContextsTemp[i].getComponent().getType().equals("JK8LSMaterialRevision")) + && (aifComponentContextsTemp[i].getComponent().getProperty("release_status_list") != "")) { + num++; + } + } + if (num == 0) { + MessageBox.post("δתʽ", "", MessageBox.ERROR); + return; + } + // 汾ŵ + int k = 0; + AIFComponentContext[] aifComponentContexts = new AIFComponentContext[num]; + for (int i = 0; i < aifComponentContextsTemp.length; i++) { + if ((aifComponentContextsTemp[i].getComponent().getType().equals("JK8LSMaterialRevision")) + && (aifComponentContextsTemp[i].getComponent().getProperty("release_status_list") != "")) { + aifComponentContexts[k] = aifComponentContextsTemp[i]; + if (k < num - 1) { + k++; + } else { + break; + } + } + } + // ȡ°汾 + String revision = ""; + String rev[] = new String[num]; + AIFComponentContext aifComponentContext; + Map map = new HashMap(); + String temp = ""; + for (int i = 0; i < aifComponentContexts.length; i++) { + revision = aifComponentContexts[i].getComponent().getProperty("item_revision_id"); + aifComponentContext = aifComponentContexts[i]; + rev[i] = revision; + map.put(revision, aifComponentContext); + } +// for (int i = 0; i < rev.length; i++) { +// temp = rev[0]; +// // System.out.println(rev[i]); +// if ((temp.charAt(0) + 0) < (rev[i].charAt(0) + 0)) { +// temp = rev[i]; +// } +// } + boolean isNum=false; + //TODO ֻһ汾ô죬Ҫ + for (int i = 0; i < rev.length; i++) { + temp = rev[0]; +// System.out.println("rev["+i+"]--------------->"+rev[i]); +// System.out.println(Integer.valueOf(temp)); +// System.out.println(Integer.valueOf(rev[i])); + try{ + + System.out.println("Ƚְ汾"); + //Ƚϣ汾01,02,03,04 + if(Integer.valueOf(temp)"+IsRollout); + if(IsRollout.equals("true")) { + MessageBox.post("ʱתתΪʽ","",MessageBox.INFORMATION); + return; + } + //ΪѾԸҪ· + try { + Util.setByPass(true); + } catch (TCException e2) { + e2.printStackTrace(); + } + ((TCComponent) aif2[i].getComponent()).getTCProperty("jk8IsRollout").setStringValue("true");; + try { + Util.setByPass(false); + } catch (TCException e2) { + e2.printStackTrace(); + } + + break; + } + } + } catch (Exception e) { + e.printStackTrace(); + } +// int a = 1; +// if (a == 1) { +// return; +// } + tempToFormal_Operation operation = new tempToFormal_Operation(app, aif, targetComp, session); + this.session.queueOperation(operation); + + } + + } + +} diff --git a/src/com/connor/jk/plm/tempToFormal/tempToFormal_Handler.java b/src/com/connor/jk/plm/tempToFormal/tempToFormal_Handler.java new file mode 100644 index 0000000..1aebef1 --- /dev/null +++ b/src/com/connor/jk/plm/tempToFormal/tempToFormal_Handler.java @@ -0,0 +1,33 @@ +package com.connor.jk.plm.tempToFormal; + +import java.util.Vector; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.connor.jk.plm.sqb.Generate_Action; +import com.teamcenter.rac.aif.AIFClipboard; +import com.teamcenter.rac.aif.AIFPortal; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aifrcp.AIFUtility; + +public class tempToFormal_Handler extends AbstractHandler{ + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + // TODO Auto-generated method stub + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + tempToFormal_Action action=new tempToFormal_Action(app,null); +// AIFClipboard aifclipboard = AIFPortal.getClipboard(); +// Vector vec = aifclipboard.toVector(); +// System.out.println(vec==null); +// if(vec!=null){ +// +// System.out.println("-----------"+vec.size()); +// } + new Thread(action).start(); + return null; + } + +} diff --git a/src/com/connor/jk/plm/tempToFormal/tempToFormal_Operation.java b/src/com/connor/jk/plm/tempToFormal/tempToFormal_Operation.java new file mode 100644 index 0000000..a0b21de --- /dev/null +++ b/src/com/connor/jk/plm/tempToFormal/tempToFormal_Operation.java @@ -0,0 +1,362 @@ +package com.connor.jk.plm.tempToFormal; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +//import com.connor.hx3.plm.hxom042.ClassReportChildClassBean; +//import com.connor.hx3.plm.hxom042.ReportBean; + +//import java.util.HashMap; +//import java.util.List; +//import java.util.Map; +// +//import javax.swing.JTextField; + +//import com.connor.hx3.plm.hxom042.ClassReportChildClassBean; +//import com.connor.hx3.plm.hxom042.ReportBean; +import com.teamcenter.rac.aif.AbstractAIFApplication; +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.TCComponentFolder; +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.TCComponentItemType; +import com.teamcenter.rac.kernel.TCComponentType; +//import com.teamcenter.rac.kernel.TCComponentType; +import com.teamcenter.rac.kernel.TCComponentUser; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.kernel.TCUserService; +import com.teamcenter.rac.kernel.ics.ICSApplicationObject; +import com.teamcenter.rac.kernel.ics.ICSProperty; +//import com.teamcenter.rac.kernel.ics.ICSPropertyDescription; +//import com.teamcenter.rac.kernel.ics.ICSView; +//import com.teamcenter.rac.kernel.services.impl.TCServerService; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.schemas.soa._2006_03.exceptions.ServiceException; + +public class tempToFormal_Operation extends AbstractAIFOperation { + private AbstractAIFApplication app; + private TCSession session; + private InterfaceAIFComponent targetComp; + private AIFComponentContext aif; + private String[] prop; + private TCProperty[] props; + private TCUserService userService; + private TCPreferenceService service; + String url=""; + + public tempToFormal_Operation(AbstractAIFApplication app2, AIFComponentContext aif, + InterfaceAIFComponent targetComp, TCSession session2) { + this.app = app2; + this.targetComp = targetComp; + this.aif = aif; + this.session = session2; + } + + private String itemId;// ʽϵID +// private String itemDesc;// ʽϵ + private String itemRev;// ʽϵİ汾 + private String itemName;// ʽϵ + private TCComponentItem target; + + private TCComponentItemRevision itemRevision;// ʽϵİ汾 + + private TCComponentItemRevision rev; + String class_id; + Integer[] keys = null; + String[] vals = null; + @Override + public void executeOperation() throws Exception { + // setPropMsg(aif); + // 1.ȡѷ°汾ķ + class_id=((TCComponent) aif.getComponent()).getClassificationClass(); + if(class_id==""){ + MessageBox.post("·汾δִ࣬д˲", "", MessageBox.ERROR); + return; + } + //TODO idѡ + service = this.session.getPreferenceService(); + url= service.getStringValue("Autocode_SendClassServer_URL"); +// String class_id= service.getStringValue(""); + target=(TCComponentItem) targetComp; + System.out.println(target.getTCProperty("cd9_codeID")); + + //ID + props=target.getTCProperties(new String[]{"cd9_codePattern"}); + itemId = props[0].getStringValue().toString().split("\\$")[0].split("-")[1];//ָ$,ǰҪתַ\\ + //TODO + itemId=getCodeNumber(itemId,4,1,9999,1,""); + System.out.println("itemId==========>"+itemId); + + + TCComponentItemType itemType = (TCComponentItemType) session.getTypeComponent("Item"); + // :ID汾͡ + + itemRev = itemType.getNewRev(null);// Ĭ + props=target.getTCProperties(new String[]{"object_name"}); + itemName=props[0].getStringValue(); + TCComponentItem item = itemType.create(itemId, itemRev, "JK8Material", itemName, "", null); + + +// // newstuffļ +// TCComponentUser user = this.session.getUser(); +// TCComponentFolder newStuff = user.getNewStuffFolder(); +// newStuff.add("contents", item); + + //ڵǰ汾αļ£αļеĹϵΪJK8FormalMaterial + ((TCComponentItemRevision)aif.getComponent()).add("JK8FormalMaterial", item);//itemҵaifĹϵΪJK8FormalMaterialαļ + + + + // TODO ʱԸʽ + // (ͺjk8SpecModelͺjk8TecModel) + AIFComponentContext[] components=aif.getComponent().getChildren(); + String SpecModel=""; + String TecModel=""; + for(int i=0;i"+class_id); + if( !class_id.replace(" ", "").equals("") ){ + + List propList = new ArrayList<>(); +// for (int i = 0; i < classPropList.size(); i++) { +// //System.out.println(" CLASS ID = " + integers[i] + " =" + vals[i]); +// CNClassPropBean bean = classPropList.get(i); +// String value = ""; +// if(bean.isLov){ +// value =((Combo)classTextList.get(i)).getText(); +// value = bean.lovMapping.get(value); +// }else{ +// value = ((Text)classTextList.get(i)).getText(); +// } +// //icspro[i] = new ICSProperty(bean.propID, value); +// } + + for(int i = 0; i < keys.length; i++){ + + ClassProperty prop = new ClassProperty(keys[i], vals[i]);// + propList.add(prop); + } + String json = SoaServerUtil.objectToJson(propList);//JavaתΪjson + SoaServerUtil.grantWritePrivilege(session, rev);//дȨ + SoaServerUtil.sendToClass(rev.getUid(), class_id, json,url);//͵ + + SoaServerUtil.grantReadPrivilege(session, rev);//Ȩ + } + + } catch (Exception e) { + e.printStackTrace(); + } + + } +} diff --git a/src/com/connor/jk/plm/test20200415/test20200415_Handler.java b/src/com/connor/jk/plm/test20200415/test20200415_Handler.java new file mode 100644 index 0000000..74bebce --- /dev/null +++ b/src/com/connor/jk/plm/test20200415/test20200415_Handler.java @@ -0,0 +1,83 @@ +package com.connor.jk.plm.test20200415; + +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.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCProperty; + +public class test20200415_Handler extends AbstractHandler{ + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + TCComponent form=(TCComponent) app.getTargetComponent(); + try { + String[] propertie=new String[] { + "jk8ProductType","jk8Manufacturer","jk8CommunicateMode2" + /*,"jk8ProductModNO","jk8ProductIdentifyNO","jk8ProductName","jk8BaseMeterManufactor", + "jk8ICCardType","jk8CircBoardModNO","jk8ProgramFeatures","jk8InsteadType","jk8FunctionOverview", + "jk8CustSpecRequirements","jk8Valve","jk8EncryptType","jk8Applicant","jk8RecordDate", + "jk8ApplyMarket","jk8BMManfMatched","jk8ProjectName","jk8ProjectNO","jk8Status", + "jk8ValveType","jk8CommunicateMode","jk8PowerSupplyMode","jk8GasType","jk8AlaDectRelation", + "jk8UsePlace","jk8OutputSignal","jk8ProFeatNum","jk8Manufacturer","jk8CommunicateMode2"*/ + }; + TCProperty[] pro=form.getTCProperties(propertie); + for (int i = 0; i < pro.length; i++) { + System.out.println(propertie[i]+"============"+pro[i].getStringValueArray().length); + + } + String[] jk8Manufacturer=new String[pro[0].getStringValueArray().length]; + String[] jk8CommunicateMode2=new String[pro[0].getStringValueArray().length]; + for (int i = 0; i < jk8CommunicateMode2.length; i++) { + if(i==jk8CommunicateMode2.length-1) { + + jk8Manufacturer[i]=""; + jk8CommunicateMode2[i]=""; + }else { + if(i infos; + + public List regularList = new ArrayList<>(); + public List regularUserList = new ArrayList<>(); + public List privUserList = new ArrayList<>(); + public List teamAdminUserList = new ArrayList<>(); + + public ProjBean(TCComponentProject project) { + this.project = project; + loadProjTeam(); + } + + /** + * ѡûĿеĽɫ + * + * @param selectUser + * @return + */ + public int checkSelectUserLev(TCComponentUser selectUser) { + int lev = -1; + if (this.regularUserList.contains(selectUser)) { + lev = 0; + } + if (this.privUserList.contains(selectUser)) { + lev = 1; + } + if (this.teamAdminUserList.contains(selectUser)) { + lev = 2; + } + return lev; + } + + /** + * û + * + * @param selectUser + * @param groupMember + * @param lev + */ + public void setUserLev(TCComponentUser selectUser, + TCComponentGroupMember groupMember, int lev) { + switch (lev) { + case 0: + if (groupMember == null) { + try { + groupMember = selectUser.getGroupMembers()[0]; + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + this.regularList.add(groupMember); + break; + case 1: + this.privUserList.add(selectUser); + break; + case 2: + this.teamAdminUserList.add(selectUser); + break; + default: + break; + } + + } + + /** + * TeamϢ + */ + private void loadProjTeam() { + + regularList = new ArrayList<>(); + regularUserList = new ArrayList<>(); + privUserList = new ArrayList<>(); + teamAdminUserList = new ArrayList<>(); + + ProjectLevelSecurityService prjLevelSecurityService = ProjectLevelSecurityService + .getService(RACUIUtil.getTCSession()); + com.teamcenter.services.rac.core._2012_09.ProjectLevelSecurity.ProjectClientId[] arrayOfProjectClientId = new com.teamcenter.services.rac.core._2012_09.ProjectLevelSecurity.ProjectClientId[1]; + arrayOfProjectClientId[0] = new com.teamcenter.services.rac.core._2012_09.ProjectLevelSecurity.ProjectClientId(); + arrayOfProjectClientId[0].clientId = "PLS-RAC-SESSION"; + arrayOfProjectClientId[0].tcProject = project; + + com.teamcenter.services.rac.core._2012_09.ProjectLevelSecurity.ProjectTeamsResponse localProjectTeamsResponse = prjLevelSecurityService + .getProjectTeams(arrayOfProjectClientId); + com.teamcenter.services.rac.core._2012_09.ProjectLevelSecurity.ProjectTeamData projectTeams = localProjectTeamsResponse.projectTeams[0]; + + // + TCComponent[] regularMembers = projectTeams.regularMembers; + System.out.println("regularMembers =" + regularMembers == null ? "null" + : regularMembers.length); + // + for (TCComponent regularMember : regularMembers) { + System.out.println("regularMember type =" + regularMember.getType() + + " | regularMember =" + regularMember); + + if (regularMember instanceof TCComponentGroupMember) { + regularList.add(regularMember); + try { + regularUserList + .add(((TCComponentGroupMember) regularMember) + .getUser()); + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } else if (regularMember instanceof TCComponentGroup) { + regularList.add(regularMember); + getUsers(regularUserList, (TCComponentGroup) regularMember, + null); + } else if (regularMember instanceof TCComponentUser) { + regularList.add(regularMember); + regularUserList.add((TCComponentUser) regularMember); + } + + } + + // + TCComponent[] privMembers = projectTeams.privMembers; + System.out.println("privMembers =" + privMembers == null ? "null" + : privMembers.length); + for (TCComponent privMember : privMembers) { + System.out.println("privMember type =" + privMember.getType() + + " | privMember =" + privMember); + if (privMember instanceof TCComponentUser) { + privUserList.add((TCComponentUser) privMember); + } + } + + // + TCComponent[] teamAdminMembers = projectTeams.projectTeamAdmins; + System.out + .println("teamAdminMembers =" + teamAdminMembers == null ? "null" + : teamAdminMembers.length); + for (TCComponent teamAdminMember : teamAdminMembers) { + System.out.println("teamAdminMembers type =" + + teamAdminMember.getType() + " | teamAdminMember=" + + teamAdminMember); + if (teamAdminMember instanceof TCComponentUser) { + teamAdminUserList.add((TCComponentUser) teamAdminMember); + } + } + + } + + /** + * ȡ֯µûϢ + * + * @param userList + * @param comp + * @param parent + */ + private void getUsers(List userList, TCComponent comp, + TCComponent parent) { + try { + if (comp instanceof TCComponentGroup) { + TCComponent[] comps = ((TCComponentGroup) comp) + .getRolesAndGroups(); + for (int i = 0; i < comps.length; i++) { + + getUsers(userList, comps[i], comp); + } + } else if (comp instanceof TCComponentRole) { + TCComponent[] comps = ((TCComponentRole) comp) + .getUsers((TCComponentGroup) parent); + for (int i = 0; i < comps.length; i++) { + TCComponentUser user = (TCComponentUser) comps[i]; + userList.add(user); + } + } + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + /** + * ȡĿϢ + */ + public void getProjTeamInfo() { + + infos = new ArrayList<>(); + for (TCComponent user : regularList) { + System.out.println("regularUserList =" + user); + ProjectLevelSecurity.TeamMemberInfo info = new ProjectLevelSecurity.TeamMemberInfo(); + info.teamMember = user; + info.teamMemberType = 0;// ProjectConstants.UNPRIVILEGED; + infos.add(info); + } + for (TCComponentUser user : privUserList) { + System.out.println("privUserList =" + user); + ProjectLevelSecurity.TeamMemberInfo info = new ProjectLevelSecurity.TeamMemberInfo(); + info.teamMember = user; + info.teamMemberType = 1;// ProjectConstants.PRIVILEGED; + infos.add(info); + } + for (TCComponentUser user : teamAdminUserList) { + System.out.println("teamAdminUserList =" + user); + ProjectLevelSecurity.TeamMemberInfo info = new ProjectLevelSecurity.TeamMemberInfo(); + info.teamMember = user; + info.teamMemberType = 2;// ProjectConstants.TEAMADMIN; + infos.add(info); + } + } + + @Override + public String toString() { + // TODO Auto-generated method stub + return this.project.toString(); + } + + @Override + public int compareTo(Object o) { + ProjBean sdto = (ProjBean) o; + + return this.toString().compareTo(sdto.toString()); + } + +} diff --git a/src/com/connor/jk/plm/transfer/Util.java b/src/com/connor/jk/plm/transfer/Util.java new file mode 100644 index 0000000..9dc1836 --- /dev/null +++ b/src/com/connor/jk/plm/transfer/Util.java @@ -0,0 +1,53 @@ +package com.connor.jk.plm.transfer; +import java.util.List; + +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.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +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.TCUserService; +import com.teamcenter.rac.util.MessageBox; + +public class Util { + public static TCPreferenceService service; + public static TCSession session; + public static TCUserService userservice;; + + static { + if (session == null) { + session = (TCSession) (AIFUtility.getCurrentApplication() + .getSession()); + } + if (service == null) + service = session.getPreferenceService(); + } + + public static void setByPass(boolean val) throws TCException { + if (userservice == null) { + userservice = session.getUserService(); + } + Object[] obj = new Object[1]; + obj[0] = "origin"; + if (val) { + userservice.call("ORIGIN_set_bypass", obj); + } else { + userservice.call("ORIGIN_close_bypass", obj); + } + } + + +} diff --git a/src/com/connor/jk/plm/transfer/transfer_Action.java b/src/com/connor/jk/plm/transfer/transfer_Action.java new file mode 100644 index 0000000..abb278e --- /dev/null +++ b/src/com/connor/jk/plm/transfer/transfer_Action.java @@ -0,0 +1,398 @@ +/** + * + */ +package com.connor.jk.plm.transfer; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.poi.xssf.usermodel.XSSFCell; +import org.apache.poi.xssf.usermodel.XSSFRow; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + +import com.connor.jk.plm.DbomToEbom.ChangeDbomUtil; +import com.connor.jk.plm.DbomToEbom.ProgressBarThread; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.common.actions.AbstractAIFAction; +import com.teamcenter.rac.aif.kernel.AIFComponentContext; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentDataset; +import com.teamcenter.rac.kernel.TCComponentFolder; +import com.teamcenter.rac.kernel.TCComponentGroup; +import com.teamcenter.rac.kernel.TCComponentGroupMember; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCComponentMSWordX; +import com.teamcenter.rac.kernel.TCComponentPart; +import com.teamcenter.rac.kernel.TCComponentProject; +import com.teamcenter.rac.kernel.TCComponentProjectSmartFolder; +import com.teamcenter.rac.kernel.TCComponentRole; +import com.teamcenter.rac.kernel.TCComponentSchedule; +import com.teamcenter.rac.kernel.TCComponentTcFile; +import com.teamcenter.rac.kernel.TCComponentUser; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.kernel.TCUserService; +import com.teamcenter.rac.ui.common.RACUIUtil; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.services.rac.core.ProjectLevelSecurityService; +import com.teamcenter.services.rac.core._2012_09.ProjectLevelSecurity; + +/** + * @author Administrator + * + */ +public class transfer_Action extends AbstractAIFAction { + private AbstractAIFApplication app; + private TCSession session; + private InterfaceAIFComponent targetComp; + private TCComponentProject project; + private TCProperty obj; + private TCComponent[] compS; + private TCPreferenceService service; +// private String[] docTypeS; + TCComponent[] regularMembers; + private ProgressBarThread wait; + private TCPreferenceService preferenceService; + + protected ArrayList infos; + public List regularList = new ArrayList<>(); + public List regularUserList = new ArrayList<>(); + public List privUserList = new ArrayList<>(); + public List teamAdminUserList = new ArrayList<>(); + + /** + * ѡûĿеĽɫ + * + * @param selectUser + * @return + */ + public int checkSelectUserLev(TCComponentUser selectUser) { + int lev = -1; + if (this.regularUserList.contains(selectUser)) { + lev = 0; + } + if (this.privUserList.contains(selectUser)) { + lev = 1; + } + if (this.teamAdminUserList.contains(selectUser)) { + lev = 2; + } + return lev; + } + + /** + * TeamϢ + */ + private void loadProjTeam() { + ProjectLevelSecurityService prjLevelSecurityService = ProjectLevelSecurityService + .getService(RACUIUtil.getTCSession()); + com.teamcenter.services.rac.core._2012_09.ProjectLevelSecurity.ProjectClientId[] arrayOfProjectClientId = new com.teamcenter.services.rac.core._2012_09.ProjectLevelSecurity.ProjectClientId[1]; + arrayOfProjectClientId[0] = new com.teamcenter.services.rac.core._2012_09.ProjectLevelSecurity.ProjectClientId(); + arrayOfProjectClientId[0].clientId = "PLS-RAC-SESSION"; + arrayOfProjectClientId[0].tcProject = project; + + com.teamcenter.services.rac.core._2012_09.ProjectLevelSecurity.ProjectTeamsResponse localProjectTeamsResponse = prjLevelSecurityService + .getProjectTeams(arrayOfProjectClientId); + com.teamcenter.services.rac.core._2012_09.ProjectLevelSecurity.ProjectTeamData projectTeams = localProjectTeamsResponse.projectTeams[0]; + + regularMembers = projectTeams.regularMembers;// гԱ + + } + + public transfer_Action(AbstractAIFApplication arg0, String arg1) { + super(arg0, arg1); + this.app = arg0; + this.session = (TCSession) app.getSession(); + this.targetComp = app.getTargetComponent(); + } + + TCComponentGroup group = null; + TCComponentUser user = null; + private XSSFWorkbook workbook=null; + private FileInputStream fis; + Map> map=new HashMap<>(); + @Override + public void run() { + service = this.session.getPreferenceService(); + + + if (!targetComp.getType().equals("TC_Project")) { + MessageBox.post("ѡĿٽв", "", MessageBox.ERROR); + return; + } + + //ȡĿ׶κĿ׶ζӦĵ͵ѡ + String sxx = "jk_doc_uid";// G8TlM0X6YvbLjA + File file = getExcel(sxx); + int rowNum=0; + int sheetNum=0; + String sheetName; + XSSFRow row; + XSSFSheet sheet; + List list=new ArrayList<>(); + if (file == null) { + return; + } + try { + fis = new FileInputStream(file); + workbook = new XSSFWorkbook(fis); + sheetNum=workbook.getNumberOfSheets(); + for (int i = 0; i < sheetNum; i++) { + sheet = workbook.getSheetAt(i); + sheetName = workbook.getSheetAt(i).getSheetName(); + rowNum = sheet.getLastRowNum(); + list = new ArrayList<>(); + for (int k = 1; k < rowNum; k++) { + row = sheet.getRow(k); + String value = row.getCell(1).getStringCellValue().trim(); + if (!value.equals("") && value != null) { + list.add(value); + } else { + break; + + } + } + map.put(sheetName, list); + } + } catch (Exception e2) { + e2.printStackTrace(); + } + + + if(map.size()>0) { + new Thread(new transfer_Dialog(app,targetComp,map)).run(); + }else { + MessageBox.post("üƻ","",MessageBox.INFORMATION); + return; + } + + + + + +// docTypeS = service.getStringArray(4, "Doc_type"); +// if (!targetComp.getType().equals("TC_Project")) { +// MessageBox.post("ѡĿٽв", "", MessageBox.ERROR); +// return; +// } +// this.wait = new ProgressBarThread("ĵȨת", "ִУԵ..."); +// this.wait.start(); +// project = (TCComponentProject) targetComp; +// // TODO жĿԱûùԱ +// loadProjTeam(); +// boolean find = false; +// for (TCComponent regularMember : regularMembers) { +// System.out +// .println("regularMember type =" + regularMember.getType() + " | regularMember =" + regularMember); +// System.out.println(regularMember.toDisplayString()); +// String[] groups = regularMember.toDisplayString().split("/"); +// System.out.println("groups.length---->" + groups.length); +// if (groups.length > 0) { +// +// if (groups.length == 3 && (!groups[2].trim().equals("")) +// && (groups[1].trim().equals("Configuration Manager") +// && (groups[0].trim().equals("ù.оԺ")))) { +// System.out.println("ùԱ" + groups[2]); +// try { +// user = (TCComponentUser) this.session.search(" - ԱϢ", new String[] { "Ա", "û ID" }, +// new String[] { groups[2], "*" })[0]; +// group = (TCComponentGroup) this.session.search("ѯ", new String[] { "" }, +// new String[] { "ù" })[0]; +// } catch (Exception e) { +// e.printStackTrace(); +// } +// // System.out.println("user.toString()------------------>"+user.toString()); +// // System.out.println("group.toString()------------------>"+group.toString()); +// find = true; +// break; +// } +// } +// +// } +// if (find == false) { +// +// this.wait.setBool(true); +// this.wait.interrupt(); +// MessageBox.post("ûнùԱָΪĿСԱ", "", MessageBox.INFORMATION); +// return; +// } +// +// try { +// obj = project.getTCProperty("project_data");// ȡĿµļ +// compS = obj.getReferenceValueArray();// Զɶ +// +// for (int i = 0; i < compS.length; i++) { +// TCComponentProjectSmartFolder SmartFolder = (TCComponentProjectSmartFolder) compS[i]; +// getMsg(SmartFolder); +// } +// this.wait.setBool(true); +// this.wait.interrupt(); +// MessageBox.post("ĵȨת", "ɹ", MessageBox.INFORMATION); +// return; +// } catch (TCException e1) { +// e1.printStackTrace(); +// } + + } + /** + * c÷״̬ + * + * @param item + * ҪĶ + * @param statusName + * ״̬ + * @throws TCException + */ + public void setReleaseStatus(TCComponent item, String statusName) throws TCException { + TCUserService userservice = this.session.getUserService(); + + Object[] obj = new Object[2]; + obj[0] = item; + obj[1] = statusName; + userservice.call("connor_set_release_status", obj); + + } + public void getMsg(TCComponentProjectSmartFolder SmartFolder) throws TCException { + // TODO ҪжĵǷѾ + try { + TCProperty obj2 = SmartFolder.getTCProperty("project_data");// TODO + // ȡĵ + TCComponent[] compS2 = obj2.getReferenceValueArray();// + for (int j = 0; j < compS2.length; j++) { + if (compS2[j] instanceof TCComponentProjectSmartFolder) { + getMsg((TCComponentProjectSmartFolder) compS2[j]); + } else if (compS2[j] instanceof TCComponentSchedule) { + + } else if (compS2[j] instanceof TCComponentItemRevision) { + + } else if (compS2[j] instanceof TCComponentMSWordX) { + + } else if (compS2[j] instanceof TCComponentFolder) { + + } else if (compS2[j] instanceof TCComponentDataset) { + + } else { + // ĵѷİ汾ȨתԼ¹ҵйϵݼȣ + // TODO + // ޸߼ļ¹ҵĶǰ汾µ°汾ѾǾͰȨתƸùԱȻͲת + TCComponentItem items = (TCComponentItem) compS2[j]; + if (items.getLatestItemRevision().getReferenceListProperty("release_status_list").length > 0) { + //2017.9.11 JK8MaterialҲתùԱ + if (!items.isTypeOf("Part") + && (items.getType().equals("JK8Material")||items.isTypeOf("JK8Document") || items.isTypeOf("Design"))) { + try { + + ChangeDbomUtil.setByPass(true); + } catch (TCException e2) { + e2.printStackTrace(); + } + items.changeOwner(user, group); +// setReleaseStatus(items, "JK8Disabled");// ٷУ + setReleaseStatus(items, "Baselined");// ѻ() +// setReleaseStatus(items, "JK8Baselined");// ѻ() + try { + ChangeDbomUtil.setByPass(false); + } catch (TCException e2) { + e2.printStackTrace(); + } + } + + +// TCComponentItemRevision[] componentItems = ((TCComponentItem) compS2[j]) +// .getReleasedItemRevisions(); +// if (componentItems.length > 0) { +// for (int i = 0; i < componentItems.length; i++) { +// System.out.println(componentItems[i]); +// } +// } +// if (componentItems.length > 0 && (!compS2[j].getType().equals("JK8Material")) +// && (!compS2[j].isTypeOf("Part")) +// && (compS2[j].isTypeOf("JK8Document") || compS2[j].isTypeOf("Design"))) { +// try { +// +// ChangeDbomUtil.setByPass(true); +// } catch (TCException e2) { +// e2.printStackTrace(); +// } +// items.changeOwner(user, group); +// for (int i = 0; i < componentItems.length; i++) { +// if (!((TCComponentItemRevision) componentItems[i]).getTCProperty("release_status_list") +// .getReferenceValueInString().equals("")) { +// System.out.println("-----------------------------"); +// componentItems[i].changeOwner(user, group); +// // ((TCComponentItemRevision)componentItems[i])getT +// TCComponent[] components = componentItems[i].getTCProperty("IMAN_specification") +// .getReferenceValueArray(); +// if (components.length > 0) { +// for (int k = 0; k < components.length; k++) { +// components[k].changeOwner(user, group); +// } +// } +// } +// } +// try { +// ChangeDbomUtil.setByPass(false); +// } catch (TCException e2) { +// e2.printStackTrace(); +// } +// } + } + + } + + } + } catch (Exception e) { + e.printStackTrace(); + } + + } + + private File getExcel(String ssx) { + File file = null; + preferenceService = session.getPreferenceService(); + String puid = preferenceService.getStringValue(ssx); + if (puid == null) { + MessageBox.post("ϵԱѡ", "", MessageBox.ERROR); + return null; + } + TCComponentDataset dataset = null; + try { + dataset = (TCComponentDataset) session.stringToComponent(puid); + } catch (TCException e) { + e.printStackTrace(); + } + if (dataset == null) { + MessageBox.post("ݼڣϵԱѡ", "", MessageBox.ERROR); + return null; + } + try { + TCComponentTcFile[] files = dataset.getTcFiles(); + if (files.length == 0) { + MessageBox.post("ݼûõļ,", "", MessageBox.ERROR); + return null; + } else if (files.length > 1) { + MessageBox.post("ݼõļ", "", MessageBox.ERROR); + return null; + } else { + file = files[0].getFmsFile(); + } + } catch (TCException e) { + e.printStackTrace(); + } + + return file; + } + + + +} diff --git a/src/com/connor/jk/plm/transfer/transfer_Dialog.java b/src/com/connor/jk/plm/transfer/transfer_Dialog.java new file mode 100644 index 0000000..e2173c4 --- /dev/null +++ b/src/com/connor/jk/plm/transfer/transfer_Dialog.java @@ -0,0 +1,193 @@ +package com.connor.jk.plm.transfer; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.swing.ButtonGroup; +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JRadioButton; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.PropertyLayout; + +public class transfer_Dialog extends AbstractAIFDialog implements ActionListener{ + AbstractAIFApplication app; + private TCSession session; + private JLabel titleJlabel; + + private JButton okJbutton; + private JButton cancelJbutton; + + + private JPanel mainJpanel; + private JPanel titleJpanel; + private JPanel resultJpanel; + private JPanel exportJpanel; + private JRadioButton phaseButton[] ; + private Map> map; + private ProgressBarThread wait; + private InterfaceAIFComponent targetComp; + public transfer_Dialog(AbstractAIFApplication app, InterfaceAIFComponent targetComp, Map> map){ + this.app=app; + this.session=(TCSession) this.app.getSession(); + this.map=map; + map.put("ԤĿ", null); + this.targetComp=targetComp; + phaseButton =new JRadioButton[this.map.size()]; + } + public void run(){ + + try { + initUI(); + } catch (Exception e) { + e.printStackTrace(); + } + } + private ButtonGroup g= new ButtonGroup(); + private String finalSelect=""; + public void initUI() throws Exception{ + + this.setTitle("Ŀ׶"); + this.setSize(new Dimension(300, 300)); + this.setLayout(new BorderLayout()); + this.setAlwaysOnTop(true); + initMainJpanel(); + + + mainJpanel=new JPanel(new PropertyLayout()); + mainJpanel.setSize(new Dimension(300, 300)); + titleJlabel=new JLabel("ѡ׶"); + + + okJbutton=new JButton("ȷ"); + cancelJbutton=new JButton("ȡ"); + + okJbutton.addActionListener(this); + cancelJbutton.addActionListener(this); + + titleJpanel = new JPanel(new BorderLayout()); + titleJpanel.add(titleJlabel, BorderLayout.CENTER); + int mapSize=0; + phaseButton=new JRadioButton[this.map.size()]; + for (String in : map.keySet()) { + // map.keySet()صkeyֵ + List str = map.get(in);// õÿkeyvalueֵ + System.out.println(in + " " + str); + final String decision = in; + phaseButton[mapSize] = new JRadioButton(); + phaseButton[mapSize].setText(in); + phaseButton[mapSize].addActionListener(new ActionListener() { // ѡťѡе¼ + public void actionPerformed(ActionEvent e) { + System.out.println("ѡ" + decision); + finalSelect=decision; + } + }); + g.add(phaseButton[mapSize]); + mapSize++; + } + + + + + resultJpanel=new JPanel(new PropertyLayout()); + if(g.getButtonCount()>0||g!=null) { + System.out.println("еѡ"+g.getButtonCount()); + for (int i = 0; i < g.getButtonCount(); i++) { + int no=i+1; + if(no%3==1) { +// if(i==4) { +// continue; +// } + System.out.println(no+""+phaseButton[i].getText()); + resultJpanel.add((no+2)/3 + ".1.left.top", new JLabel(" ")); + resultJpanel.add((no+2)/3 + ".2.left.top", phaseButton[i]); + resultJpanel.add((no+2)/3 + ".3.left.top", new JLabel(" ")); + }else if(no%3==2) { + System.out.println(no+""+phaseButton[i].getText()); + resultJpanel.add((no+1)/3 + ".4.left.top", new JLabel(" ")); + resultJpanel.add((no+1)/3 + ".5.left.top", phaseButton[i]); + resultJpanel.add((no+1)/3 + ".6.left.top", new JLabel(" ")); + }else if(no%3==0) { + System.out.println(no+""+phaseButton[i].getText()); + resultJpanel.add((no+0)/3 + ".7.left.top", new JLabel(" ")); + resultJpanel.add((no+0)/3 + ".8.left.top", phaseButton[i]); + resultJpanel.add((no+0)/3 + ".9.left.top", new JLabel(" ")); + } + } + } + + exportJpanel=new JPanel(new FlowLayout()); + exportJpanel.add(new JLabel(" ")); + exportJpanel.add(okJbutton); + exportJpanel.add(cancelJbutton); + + + if(g==null||g.getButtonCount()==0) { + mainJpanel.add("1.1.left.top.preferred.preferred",titleJpanel); + mainJpanel.add("2.1.left.top.preferred.preferred",resultJpanel); + mainJpanel.add("3.1.left.top.preferred.preferred",exportJpanel); + }else { + mainJpanel.add("1.1.left.top.preferred.preferred",titleJpanel); + mainJpanel.add("2.1.left.top.preferred.preferred",resultJpanel); + mainJpanel.add("3.1.left.top.preferred.preferred",exportJpanel); + } + this.add(mainJpanel, BorderLayout.CENTER); + this.pack(); + this.centerToScreen(); + this.showDialog(); + + } + + protected void judgCheckBox() { + + + } + + private boolean isRefresh=false; + private void initMainJpanel() { + if (isRefresh == true) { + this.remove(mainJpanel); + isRefresh = false; + } + } + + + + @Override + public void actionPerformed(ActionEvent e) { + Object sourceObj = e.getSource(); + if(sourceObj.equals(okJbutton)) { + this.disposeDialog(); + this.dispose(); + List docTypeList=new ArrayList<>(); + if(map.get(finalSelect)!=null) { + docTypeList=map.get(finalSelect); + }else { + docTypeList=null; + } + this.wait = new ProgressBarThread("ĵȨת", "ִУԵ..."); + this.wait.start(); + transfer_Operation operation=new transfer_Operation(session,app,targetComp,docTypeList,this.wait); + this.session.queueOperation(operation); + + + }else if(sourceObj.equals(cancelJbutton)) { + this.disposeDialog(); + this.dispose(); + } + + } + +} diff --git a/src/com/connor/jk/plm/transfer/transfer_Handler.java b/src/com/connor/jk/plm/transfer/transfer_Handler.java new file mode 100644 index 0000000..54fc302 --- /dev/null +++ b/src/com/connor/jk/plm/transfer/transfer_Handler.java @@ -0,0 +1,19 @@ +package com.connor.jk.plm.transfer; + +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.aifrcp.AIFUtility; + +public class transfer_Handler extends AbstractHandler{ + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + transfer_Action action=new transfer_Action(app,null); + new Thread(action).start(); + return null; + } + +} diff --git a/src/com/connor/jk/plm/transfer/transfer_Operation.java b/src/com/connor/jk/plm/transfer/transfer_Operation.java new file mode 100644 index 0000000..ed0000c --- /dev/null +++ b/src/com/connor/jk/plm/transfer/transfer_Operation.java @@ -0,0 +1,260 @@ +package com.connor.jk.plm.transfer; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.apache.poi.ss.usermodel.BorderStyle; +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.eclipse.ui.internal.menus.TrimAdditionCacheEntry; + +import com.connor.jk.plm.DbomToEbom.ChangeDbomUtil; +//import com.connor.jk.plm.TC_OA_Integration.SqlUtil; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.AbstractAIFOperation; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentDataset; +import com.teamcenter.rac.kernel.TCComponentFolder; +import com.teamcenter.rac.kernel.TCComponentGroup; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCComponentMSWordX; +import com.teamcenter.rac.kernel.TCComponentProject; +import com.teamcenter.rac.kernel.TCComponentProjectSmartFolder; +import com.teamcenter.rac.kernel.TCComponentSchedule; +import com.teamcenter.rac.kernel.TCComponentTcFile; +import com.teamcenter.rac.kernel.TCComponentUser; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.kernel.TCUserService; +import com.teamcenter.rac.kernel.tcservices.TcServicesService; +import com.teamcenter.rac.ui.common.RACUIUtil; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.services.rac.core.ProjectLevelSecurityService; + +public class transfer_Operation extends AbstractAIFOperation { + private AbstractAIFApplication app; + private String exportFile; + private TCSession session; + private TCPreferenceService tcPreferenceService; + + private FileInputStream fis; + private FileOutputStream fos; + private XSSFWorkbook workBook; + private TCComponentProject project; + TCComponent[] regularMembers; + TCComponentGroup group = null; + TCComponentUser user = null; + private ProgressBarThread wait; + private InterfaceAIFComponent targetComp; + private TCComponent[] compS; + private TCProperty obj; + private List docTypeList; + long startLong; + long endLong; + + + + public transfer_Operation(TCSession session, AbstractAIFApplication app, InterfaceAIFComponent targetComp, + List docTypeList, ProgressBarThread wait) { + this.session=session; + this.app = app; + this.targetComp=targetComp; + this.wait = wait; + this.docTypeList=docTypeList; + } + /** + * TeamϢ + */ + private void loadProjTeam() { + ProjectLevelSecurityService prjLevelSecurityService = ProjectLevelSecurityService + .getService(RACUIUtil.getTCSession()); + com.teamcenter.services.rac.core._2012_09.ProjectLevelSecurity.ProjectClientId[] arrayOfProjectClientId = new com.teamcenter.services.rac.core._2012_09.ProjectLevelSecurity.ProjectClientId[1]; + arrayOfProjectClientId[0] = new com.teamcenter.services.rac.core._2012_09.ProjectLevelSecurity.ProjectClientId(); + arrayOfProjectClientId[0].clientId = "PLS-RAC-SESSION"; + arrayOfProjectClientId[0].tcProject = project; + + com.teamcenter.services.rac.core._2012_09.ProjectLevelSecurity.ProjectTeamsResponse localProjectTeamsResponse = prjLevelSecurityService + .getProjectTeams(arrayOfProjectClientId); + com.teamcenter.services.rac.core._2012_09.ProjectLevelSecurity.ProjectTeamData projectTeams = localProjectTeamsResponse.projectTeams[0]; + + regularMembers = projectTeams.regularMembers;// гԱ + + } + + @Override + public void executeOperation() throws Exception { + Util.setByPass(true); + project = (TCComponentProject) targetComp; + // TODO жĿԱûùԱ + loadProjTeam(); + boolean find = false; + for (TCComponent regularMember : regularMembers) { + System.out.println("regularMember type =" + regularMember.getType() + " | regularMember =" + regularMember); + System.out.println(regularMember.toDisplayString()); + String[] groups = regularMember.toDisplayString().split("/"); + System.out.println("groups.length---->" + groups.length); + if (groups.length > 0) { + + if (groups.length == 3 && (!groups[2].trim().equals("")) + && (groups[1].trim().equals("Configuration Manager") + && (groups[0].trim().equals("ù.оԺ")||groups[0].trim().equals("Group15.Group111")))) { + System.out.println("ùԱ" + groups[2]); + try { + System.out.println(this.session==null); + user = (TCComponentUser) this.session.search(" - ԱϢ", new String[] { "Ա", "û ID" }, + new String[] { groups[2], "*" })[0]; + group = (TCComponentGroup) this.session.search("ѯ", new String[] { "" }, + new String[] { "ù" })[0]; + } catch (Exception e) { + e.printStackTrace(); + } + // System.out.println("user.toString()------------------>"+user.toString()); + // System.out.println("group.toString()------------------>"+group.toString()); + find = true; + break; + } + } + + } + if (find == false) { + + this.wait.setBool(true); + this.wait.interrupt(); + MessageBox.post("ûнùԱָΪĿСԱ", "", MessageBox.INFORMATION); + return; + } + + try { + obj = project.getTCProperty("project_data");// ȡĿµļ + compS = obj.getReferenceValueArray();// Զɶ + + for (int i = 0; i < compS.length; i++) { + TCComponentProjectSmartFolder SmartFolder = (TCComponentProjectSmartFolder) compS[i]; + getMsg(SmartFolder); + } + this.wait.setBool(true); + this.wait.interrupt(); + MessageBox.post("ĵȨת", "ɹ", MessageBox.INFORMATION); + Util.setByPass(false); + return; + } catch (TCException e1) { + e1.printStackTrace(); + } + } + + public void getMsg(TCComponentProjectSmartFolder SmartFolder) throws TCException { + // TODO ҪжĵǷѾ + try { + TCProperty obj2 = SmartFolder.getTCProperty("project_data");// TODO + // ȡĵ + TCComponent[] compS2 = obj2.getReferenceValueArray();// + for (int j = 0; j < compS2.length; j++) { + if (compS2[j] instanceof TCComponentProjectSmartFolder) { + getMsg((TCComponentProjectSmartFolder) compS2[j]); + } else if (compS2[j] instanceof TCComponentSchedule) { + + } else if (compS2[j] instanceof TCComponentItemRevision) { + + } else if (compS2[j] instanceof TCComponentMSWordX) { + + } else if (compS2[j] instanceof TCComponentFolder) { + + } else if (compS2[j] instanceof TCComponentDataset) { + + } else { + // ĵѷİ汾ȨתԼ¹ҵйϵݼȣ + // TODO + // ޸߼ļ¹ҵĶǰ汾µ°汾ѾǾͰȨתƸùԱȻͲת + TCComponentItem items = (TCComponentItem) compS2[j]; + if (items.getLatestItemRevision().getReferenceListProperty("release_status_list").length > 0) { + //2017.9.11 JK8MaterialҲתùԱ + //2018.3.21 ݵǰ׶תĵȨ + //2018.3.27ԤĿͲжͣȨת + if(docTypeList==null) { + try { + System.out.println("ԤĿ--------"); + System.out.println(items.getProperty("object_string")); + ChangeDbomUtil.setByPass(true); + } catch (TCException e2) { + e2.printStackTrace(); + } + items.changeOwner(user, group); +// setReleaseStatus(items, "JK8Disabled");// ٷУ + setReleaseStatus(items, "Baselined");// ѻ() +// setReleaseStatus(items, "JK8Baselined");// ѻ() + try { + ChangeDbomUtil.setByPass(false); + } catch (TCException e2) { + e2.printStackTrace(); + } + }else { + + for (int i = 0; i < docTypeList.size(); i++) { + if(items.getType().equals(docTypeList.get(i))) { + + try { + + ChangeDbomUtil.setByPass(true); + } catch (TCException e2) { + e2.printStackTrace(); + } + items.changeOwner(user, group); +// setReleaseStatus(items, "JK8Disabled");// ٷУ + setReleaseStatus(items, "Baselined");// ѻ() +// setReleaseStatus(items, "JK8Baselined");// ѻ() + try { + ChangeDbomUtil.setByPass(false); + } catch (TCException e2) { + e2.printStackTrace(); + } + break; + } + } + } + + + } + + } + + } + } catch (Exception e) { + e.printStackTrace(); + } + + } + + /** + * c÷״̬ + * + * @param item + * ҪĶ + * @param statusName + * ״̬ + * @throws TCException + */ + public void setReleaseStatus(TCComponent item, String statusName) throws TCException { + TCUserService userservice = this.session.getUserService(); + + Object[] obj = new Object[2]; + obj[0] = item; + obj[1] = statusName; + userservice.call("connor_set_release_status", obj); + + } +} diff --git a/src/com/connor/jk/plm/util/JkomMethodUtil.java b/src/com/connor/jk/plm/util/JkomMethodUtil.java new file mode 100644 index 0000000..5da1c83 --- /dev/null +++ b/src/com/connor/jk/plm/util/JkomMethodUtil.java @@ -0,0 +1,712 @@ +package com.connor.jk.plm.util; + +import java.io.File; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import com.connor.jk.plm.form.BOM; +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.TCComponentDataset; +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.TCComponentTcFile; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCProperty; +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.TCUserService; +import com.teamcenter.rac.util.FileUtility; +import com.teamcenter.rac.util.MessageBox; + +public class JkomMethodUtil { + + public static TCPreferenceService service; + public static TCSession session; + public static TCUserService userservice;; + + static { + if (session == null) { + session = (TCSession) (AIFUtility.getCurrentApplication() + .getSession()); + } + if (service == null) + service = session.getPreferenceService(); + } + + /** + * ȡֵѡ + * + * @param prefName + * @return + */ + public static String[] getPrefStrArray(String prefName) { + String[] strs = service.getStringArray( + TCPreferenceService.TC_preference_site, prefName); + if (strs == null) { + strs = new String[] { "" }; + } + return strs; + } + + public static TCComponentBOMLine getTopline(TCComponentItemRevision rev) { + TCComponentBOMLine topLine = null; + + return topLine; + } + + public static List getPrefIntArray(String prefName) { + List intList = new ArrayList<>(); + String[] strs = service.getStringArray( + TCPreferenceService.TC_preference_site, prefName); + if (strs != null) { + for (String str : strs) { + try { + int index = Integer.parseInt(str.trim()); + intList.add(index); + } catch (NumberFormatException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + return null; + } + } + } + return intList; + } + + public static HashMap getPrefStrArrayReturn( + String prefName, String split) { + HashMap map = new HashMap(); + // map.put("", " "); + String[] strs = service.getStringArray( + TCPreferenceService.TC_preference_site, prefName); + if (strs != null) { + for (String str : strs) { + String temp[] = str.split(split); + map.put(temp[1], temp[0]); + } + } + return map; + } + + public static HashMap getPrefStrArray(String prefName, + String split) { + HashMap map = new HashMap(); + + // map.put("", " "); + + String[] strs = service.getStringArray( + TCPreferenceService.TC_preference_site, prefName); + if (strs != null) { + for (String str : strs) { + String temp[] = str.split(split); + map.put(temp[0], temp[1]); + } + } + return map; + } + + /** + * ȡֵѡ + * + * @param prefName + * @return + */ + public static String getPrefStr(String prefName) { + String str = service.getString(TCPreferenceService.TC_preference_site, + prefName); + if (str == null) { + str = new String(""); + } + return str; + } + + /** + * ͨѯ,ҷİ汾 + * + * @param session + * @param searchName + * @param keys + * @param values + * @return + */ + public static InterfaceAIFComponent[] searchComponentsCollection( + TCSession session, String searchName, String[] keys, String[] values) { + // Ϣ + InterfaceAIFComponent[] result = new InterfaceAIFComponent[0]; + + try { + // õѯķ + TCTextService textService = session.getTextService(); + // ȡquerytype + // ̶дImanQuery + TCComponentQueryType querytype = (TCComponentQueryType) session + .getTypeComponent("ImanQuery"); + // ͨquerytypeҵsearchNameIJѯ + TCComponentQuery query = (TCComponentQuery) querytype + .find(searchName); + if (query == null) { + MessageBox.post("ͨѯ" + searchName + "", "", 1); + return null; + } + querytype.clearCache(); + // String[] as = new String[keys.length]; + // for (int i = 0; i < keys.length; i++) { + // as[i] = textService.getTextValue(keys[i]); + // } + + // String[] as1 = new String[values.length]; + // for (int i = 0; i < values.length; i++) { + // as1[i] = textService.getTextValue(values[i]); + // } + + query.clearCache(); + // ͨѯõѯϢ + TCQueryClause[] clauses = query.describe(); + + // ѯϢѯĿǷȷ + for (int i = 0; i < clauses.length; i++) { + // õѯ + System.out.println(clauses[i].getAttributeName()); + // õûĿ + System.out.println(clauses[i].getUserEntryName()); + // õûػĿ + System.out.println(clauses[i].getUserEntryNameDisplay()); + + } + + TCComponentContextList list = query.getExecuteResultsList(keys, + values); + if (list != null) { + int count = list.getListCount(); + result = new InterfaceAIFComponent[count]; + + for (int i = 0; i < count; i++) { + result[i] = list.get(i).getComponent(); + } + } + } catch (TCException e) { + e.printStackTrace(); + MessageBox.post("ͨѯ" + searchName + "ѯ.", "", 1); + } + + return result; + } + + /***************** BOM ***************/ + + public static TCComponentBOMWindow getBomwindow(TCComponentItemRevision rev) { + TCComponentBOMWindow window = null; + try { + TCTypeService service = session.getTypeService(); + // TCComponentBOMViewRevisionType bvr_type = + // (TCComponentBOMViewRevisionType) + // service.getTypeComponent("PSBOMViewRevision"); + + TCComponentBOMWindowType winType = (TCComponentBOMWindowType) service + .getTypeComponent("BOMWindow"); + window = winType.create(null); + window.setWindowTopLine(rev.getItem(), rev, null, null); + + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + return window; + } + + /** + * ȡBOMLINE + * + * @param rev + * @return + */ + public static TCComponentBOMLine getTopLineByRev(TCComponentItemRevision rev) { + TCComponentBOMLine line = null; + try { + TCTypeService service = session.getTypeService(); + // TCComponentBOMViewRevisionType bvr_type = + // (TCComponentBOMViewRevisionType) + // service.getTypeComponent("PSBOMViewRevision"); + + TCComponentBOMWindowType winType = (TCComponentBOMWindowType) service + .getTypeComponent("BOMWindow"); + TCComponentBOMWindow window = winType.create(null); + + line = window.setWindowTopLine(rev.getItem(), rev, null, null); + + } catch (TCException e) { + e.printStackTrace(); + } + + return line; + } + + /** + * ȡBOMLINE + * + * @param rev + * @return + */ + public static BOM getTopLineByRev2(TCComponentItemRevision rev) { + BOM bom = new BOM(); + TCComponentBOMLine line = null; + try { + TCTypeService service = session.getTypeService(); + // TCComponentBOMViewRevisionType bvr_type = + // (TCComponentBOMViewRevisionType) + // service.getTypeComponent("PSBOMViewRevision"); + + TCComponentBOMWindowType winType = (TCComponentBOMWindowType) service + .getTypeComponent("BOMWindow"); + TCComponentBOMWindow window = winType.create(null); + + line = window.setWindowTopLine(rev.getItem(), rev, null, null); + bom.line = line; + bom.window = window; + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + return bom; + } + + /** + * if (window != null) { TCComponentBOMViewRevision bvr = window.askBvr(); + * if (bvr != null) { TCComponent[] status = bvr + * .getReferenceListProperty("release_status_list"); if (status != null && + * status.length != 0) { isReleased = true; } } + */ + public static TCComponentBOMLine getReleasedTopLineByRev( + TCComponentItemRevision rev) { + TCComponentBOMLine line = null; + try { + TCTypeService service = session.getTypeService(); + // TCComponentBOMViewRevisionType bvr_type = + // (TCComponentBOMViewRevisionType) + // service.getTypeComponent("PSBOMViewRevision"); + + TCComponentBOMWindowType winType = (TCComponentBOMWindowType) service + .getTypeComponent("BOMWindow"); + TCComponentBOMWindow window = winType.create(null); + if (window != null) { + TCComponentBOMViewRevision bvr = window.askBvr(); + if (bvr != null) { + TCComponent[] status = bvr + .getReferenceListProperty("release_status_list"); + if (status == null || status.length == 0) { + return null; + } + } + } else { + return null; + } + line = window.setWindowTopLine(rev.getItem(), rev, null, null); + + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + return line; + } + + /** + * bom + * + * @param selectIndex + * @throws TCException + */ + public static void createBom(TCComponentItemRevision parentRev, + List childRevList, + List queryNoList, List countNoList) + throws TCException { + if (childRevList == null || childRevList.size() == 0) { + return; + } + if (parentRev == null) + return; + String[] setProps = { JkomStaticFinal.JF3_BOM_QUERY_NO, + JkomStaticFinal.JF3_BOM_COUNT_NO }; + TCTypeService service = session.getTypeService(); + TCComponentBOMWindowType winType = (TCComponentBOMWindowType) service + .getTypeComponent("BOMWindow"); + TCComponentBOMWindow view = winType.create(null); + TCComponentBOMLine line = view.setWindowTopLine(parentRev.getItem(), + parentRev, null, null); + AIFComponentContext[] childrenContext = line.getChildren(); + + view.lock(); + // Ƴеbomline + if (childrenContext.length != 0) { + for (AIFComponentContext child : childrenContext) { + line.lock(); + line.remove("", (TCComponent) child.getComponent()); + line.save(); + line.unlock(); + } + + // return; + } +// setProperties +// Sets the property values associated with the real property names. +// Parameters: +// propNames - the string array of real property names. +// uifValues - the string array of values. + for (int i = 0; i < childRevList.size(); i++) { + TCComponentItemRevision rev = childRevList.get(i); + line.lock(); + TCComponentBOMLine childBomLine = line.add(rev.getItem(), rev, + null, false, ""); + line.save(); + line.unlock(); + childBomLine.lock(); + // + childBomLine.setProperties(setProps, + new String[] { queryNoList.get(i), countNoList.get(i) }); + childBomLine.save(); + childBomLine.unlock(); + + } + view.save(); + view.unlock(); + view.close(); + + } + + /** + * ļ + * + * @param comps + * @return + * @throws TCException + * @throws IOException + */ + public static String downLoadFile(TCComponent comp) { + if (comp == null) { + return ""; + } + String value = ""; + String tempPath = System.getenv("TEMP"); + // MessageBox.post(" tempPath = + // "+tempPath,"INFO",MessageBox.INFORMATION); + if (tempPath == null) { + tempPath = ""; + } else if (!tempPath.endsWith("\\")) { + tempPath = tempPath + "\\"; + } + SimpleDateFormat sdf = new SimpleDateFormat( + JkomStaticFinal.TIME_FORMAT2); + // for(TCComponent comp : comps){ + try { + if (comp instanceof TCComponentDataset) { + TCComponentTcFile[] tcFiles = ((TCComponentDataset) comp) + .getTcFiles(); + File file = null; + if (tcFiles != null && tcFiles.length != 0) { + file = tcFiles[0].getFmsFile(); + String fileName = file.getName(); + String fileDix = fileName.substring( + fileName.lastIndexOf("."), fileName.length()); + fileName = tempPath + sdf.format(new Date()) + fileDix; + File dirFile = new File(fileName); + FileUtility.copyFile(file, dirFile); + + return fileName; + } + } + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + // } + return value; + } + + /** + * ǷѾ + * + * @param comp + * @return + * @throws TCException + */ + public static boolean isCompReleased(TCComponent comp) throws TCException { + //ȡ״̬Ƿ񷢲,ΪվûΪվѾ + TCComponent[] comps = comp.getRelatedComponents("release_status_list"); + if (comps != null && comps.length > 0) { + return true; + } + return false; + } + + /** + * ǷBOM + * + * @param rev + * @return + */ + public static boolean isRevHadBom(TCComponentItemRevision rev) { + boolean isHad = false; + if (rev != null) { + TCComponentBOMWindow window = null; + try { + TCTypeService service = session.getTypeService(); + TCComponentBOMWindowType winType = (TCComponentBOMWindowType) service + .getTypeComponent("BOMWindow"); + window = winType.create(null); + TCComponentBOMLine topLine = window.setWindowTopLine( + rev.getItem(), rev, null, null); + if (topLine != null) { + if (topLine.getChildren().length > 0) { + isHad = true; + } + } + window.close(); + } catch (TCException e) { + e.printStackTrace(); + } + } + return isHad; + } + + /** + * жѾĶǷBOM + * + * @param rev + * @return + */ + public static boolean isRevBomReleased(TCComponentItemRevision rev) { + boolean isReleased = false; + try { + //жǷ񷢲 + if (isCompReleased(rev)) { + TCComponentBOMWindow window = getBomwindow(rev); + // TCComponentBOMLine line = window.getTopBOMLine(); + // if(line.getChildren().length!=0){ + // isReleased = true; + // } + if (window != null) { + TCComponentBOMViewRevision bvr = window.askBvr(); + if (bvr != null) { + TCComponent[] status = bvr + .getReferenceListProperty("release_status_list"); + if (status != null && status.length != 0) { + isReleased = true; + } + } + window.close(); + } + } + } catch (TCException e) { + e.printStackTrace(); + isReleased = true; + } + return isReleased; + + } + + /** + * ȡеѡĶİ汾 + * + * @param comps + * @return + */ + public static List getAllRevComp( + InterfaceAIFComponent comps[]) { + List revList = new ArrayList(); + for (InterfaceAIFComponent comp : comps) { + if (comp instanceof TCComponentItemRevision) { + // revList.add((TCComponentItemRevision) comp); + try { + revList.add(((TCComponentItemRevision) comp).getItem() + .getLatestItemRevision()); + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } else if (comp instanceof TCComponentItem) { + try { + revList.add(((TCComponentItem) comp) + .getLatestItemRevision()); + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } else { + return null; + } + } + return revList; + } + + /** + * ȡеѡĶİ汾 + * + * @param comps + * @return + */ + public static List getAllRevComp2( + InterfaceAIFComponent comps[]) { + List revList = new ArrayList(); + for (InterfaceAIFComponent comp : comps) { + if (comp instanceof TCComponentItemRevision) { + // revList.add((TCComponentItemRevision) comp); + try { + // ((TCComponentItemRevision) comp).getItem().get + revList.add(((TCComponentItemRevision) comp).getItem() + .getLatestItemRevision()); + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } else if (comp instanceof TCComponentItem) { + try { + revList.add(((TCComponentItem) comp) + .getLatestItemRevision()); + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } else { + return null; + } + } + return revList; + } + + /** + * ıݼ + * + * @param tccomponentDataset + * @param quote + * @param type + * @param path + * @throws TCException + */ + public static void changeDataSet(TCComponentDataset tccomponentDataset, + String quote, String type, String path) throws TCException { + String myPath[] = { path }; + String myQuote[] = { quote };// "excel" + String myType[] = { type };// "MSExcelX" + String myPlain[] = { "Plain" }; + + // ɾݼ + deleDateSetRef(tccomponentDataset); + // ݼ滻 + tccomponentDataset.setFiles(myPath, myType, myPlain, myQuote); + + } + + /** + * ɾݼ + * + * @param dataset + * @throws TCException + */ + private static void deleDateSetRef(TCComponentDataset dataset) + throws TCException { + + TCComponentTcFile[] tcFiles = dataset.getTcFiles(); + for (int i = 0; i < tcFiles.length; i++) { + // õݼ + String str_temp = getNamedRefType(dataset, tcFiles[i]); + // ɾ + dataset.removeNamedReference(str_temp); + } + + } + + /** + * õݼ + * + * @param datasetComponent + * @param tccomponent + * @return + * @throws TCException + */ + private static String getNamedRefType(TCComponentDataset datasetComponent, + TCComponentTcFile tccomponent) throws TCException { + String s; + s = ""; + TCProperty tcproperty; + TCProperty tcproperty1; + TCComponent atccomponent[]; + String as[]; + int i; + int j; + int k; + try { + tcproperty = datasetComponent.getTCProperty("ref_list"); + tcproperty1 = datasetComponent.getTCProperty("ref_names"); + if (tcproperty == null || tcproperty1 == null) + return s; + } catch (TCException tcexception) { + return s; + } + // ref_list:123.xlsx + // datasetComponent.getRelatedComponents("ref_list") + atccomponent = tcproperty.getReferenceValueArray(); + // õǰref_names:excel + as = tcproperty1.getStringValueArray(); + if (atccomponent == null || as == null) + return s; + i = atccomponent.length; + if (i != as.length) + return s; + j = -1; + k = 0; + do { + if (k >= i) + break; + if (tccomponent == atccomponent[k]) { + j = k; + break; + } + k++; + } while (true); + if (j != -1) + s = as[j]; + return s; + } + + /** + * + * @param val + * @throws TCException + * getUserService:Returns:the user services object + * call: + */ + public static void setByPass(boolean val) throws TCException { + if (userservice == null) { + userservice = session.getUserService(); + } + Object[] obj = new Object[1]; + obj[0] = "origin"; + if (val) { + userservice.call("ORIGIN_set_bypass", obj); + } else { + userservice.call("ORIGIN_close_bypass", obj); + } + } +} diff --git a/src/com/connor/jk/plm/util/JkomStaticFinal.java b/src/com/connor/jk/plm/util/JkomStaticFinal.java new file mode 100644 index 0000000..f6e6f2e --- /dev/null +++ b/src/com/connor/jk/plm/util/JkomStaticFinal.java @@ -0,0 +1,16 @@ +package com.connor.jk.plm.util; + +public class JkomStaticFinal { + + public static final String TIME_FORMAT2 = "yyyyMMddHHmmssSSS"; + + public static final String JF3_BOM_QUERY_NO = "bl_sequence_no"; + public static final String JF3_BOM_COUNT_NO = "bl_quantity"; + + /**************** ճ **************************/ + public static final String HX3_PASTE_PARENT_TYPE = "HX3_SJFFDXRevision";// ݷż¼ + public static final String hx3_PASTE_GRM = "HX3_ffsj"; + public static final String TC_Attaches = "TC_Attaches"; + /************************************************/ + +} diff --git a/src/com/connor/jk/plm/view/MaterialStorageAction.java b/src/com/connor/jk/plm/view/MaterialStorageAction.java new file mode 100644 index 0000000..6a3c039 --- /dev/null +++ b/src/com/connor/jk/plm/view/MaterialStorageAction.java @@ -0,0 +1,24 @@ +package com.connor.jk.plm.view; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.common.actions.AbstractAIFAction; +import com.teamcenter.rac.util.Registry; + +public class MaterialStorageAction extends AbstractAIFAction { + private AbstractAIFApplication app; + String s; + public MaterialStorageAction(AbstractAIFApplication abstractaifapplication,String s) { + super(abstractaifapplication, s); + this.app=abstractaifapplication; + this.s=s; + } + + @Override + public void run() { + // TODO Auto-generated method stub + MaterialStorageDialog dialog=new MaterialStorageDialog(app,s); + new Thread(dialog).start(); + + } + +} diff --git a/src/com/connor/jk/plm/view/MaterialStorageBean.java b/src/com/connor/jk/plm/view/MaterialStorageBean.java new file mode 100644 index 0000000..624ae44 --- /dev/null +++ b/src/com/connor/jk/plm/view/MaterialStorageBean.java @@ -0,0 +1,111 @@ +package com.connor.jk.plm.view; + +public class MaterialStorageBean { + + private String materialCode;//ϱ + private String materialName;// + private String techModel;//ͺ + private String specModel;//ͺ + private String purchasingCycle;//ɹ + private String unitPrice;// + private String quantity;// + private String inQuantity;// + public String getMaterialCode() { + return materialCode; + } + public void setMaterialCode(String materialCode) { + this.materialCode = materialCode; + } + public String getMaterialName() { + return materialName; + } + public void setMaterialName(String materialName) { + this.materialName = materialName; + } + public String getTechModel() { + return techModel; + } + public void setTechModel(String techModel) { + this.techModel = techModel; + } + public String getSpecModel() { + return specModel; + } + public void setSpecModel(String specModel) { + this.specModel = specModel; + } + public String getPurchasingCycle() { + return purchasingCycle; + } + public void setPurchasingCycle(String purchasingCycle) { + this.purchasingCycle = purchasingCycle; + } + public String getUnitPrice() { + return unitPrice; + } + public void setUnitPrice(String unitPrice) { + this.unitPrice = unitPrice; + } + public String getQuantity() { + return quantity; + } + public void setQuantity(String quantity) { + this.quantity = quantity; + } + public String getInQuantity() { + return inQuantity; + } + public void setInQuantity(String inQuantity) { + this.inQuantity = inQuantity; + } + +// public String getMaterialCode() { +// return materialCode; +// } +// public void setMaterialCode(String materialCode) { +// this.materialCode = materialCode; +// } +// public String getMaterialName() { +// return materialName; +// } +// public void setMaterialName(String materialName) { +// this.materialName = materialName; +// } +// public String getTechModel() { +// return techModel; +// } +// public void setTechModel(String techModel) { +// this.techModel = techModel; +// } +// public String getSpecModel() { +// return specModel; +// } +// public void setSpecModel(String specModel) { +// this.specModel = specModel; +// } +// public String getPurchasingCycle() { +// return purchasingCycle; +// } +// public void setPurchasingCycle(String purchasingCycle) { +// this.purchasingCycle = purchasingCycle; +// } +// public String getUnitPrice() { +// return unitPrice; +// } +// public void setUnitPrice(String unitPrice) { +// this.unitPrice = unitPrice; +// } +// public String getQuantity() { +// return quantity; +// } +// public void setQuantity(String quantity) { +// this.quantity = quantity; +// } +// public String getInQuantity() { +// return inQuantity; +// } +// public void setInQuantity(String inQuantity) { +// this.inQuantity = inQuantity; +// } + +} diff --git a/src/com/connor/jk/plm/view/MaterialStorageDialog.java b/src/com/connor/jk/plm/view/MaterialStorageDialog.java new file mode 100644 index 0000000..c9d902f --- /dev/null +++ b/src/com/connor/jk/plm/view/MaterialStorageDialog.java @@ -0,0 +1,237 @@ +package com.connor.jk.plm.view; + +import java.awt.BorderLayout; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.JTextField; +import javax.swing.ListSelectionModel; +import javax.swing.table.DefaultTableModel; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; + +public class MaterialStorageDialog extends AbstractAIFDialog implements ActionListener{ + private AbstractAIFApplication app; + private TCSession session; + private TCPreferenceService preferenceService; + String s; + ProgressBarThread wait; + boolean isSearchContentNull=false; + public MaterialStorageDialog(AbstractAIFApplication app, String s) { + // TODO Auto-generated constructor stub + this.app = app; + this.session=(TCSession) app.getSession(); + this.s=s; + } + + public MaterialStorageDialog(TCSession session2, List valueLists2, boolean isrefresh2, String title) { + this.session=session2; + this.valueLists=valueLists2; + this.isrefresh=isrefresh2; + this.s=title; + } + + private JLabel jLabel; + private JTextField field; + private JLabel jLabel2; + private JTextField field2; + private JLabel jLabel3; + private JTextField field3; + private JLabel jLabel4; + private JTextField field4; + private JButton search; + private JButton cel; + private JPanel searchJpanel; + private JPanel tableJpanel; + private String code = "";// ϱ + private String name = "";// + private String tec = "";// ͺ + private String spec = "";// ͺ + private String[] id=null;//ڴ洢id + + private boolean isrefresh = false; + private JPanel buttoJpanel; + private MaterialStorageBean bean; + + private List valueLists = new ArrayList(); + + private JTable jTable; + private Object[] obj ; + + public void initUI() { + this.setLayout(new BorderLayout()); + jLabel = new JLabel(" ϱ"); + field = new JTextField(30); + jLabel2 = new JLabel(" "); + field2 = new JTextField(30); + jLabel3 = new JLabel(" ͺ"); + field3 = new JTextField(30); + jLabel4 = new JLabel(" ͺ"); + field4 = new JTextField(30); + search = new JButton(" ѯ"); + search.addActionListener(this); + this.wait=new ProgressBarThread("ִ", "ݲѯУԵ..."); + + cel = new JButton("˳"); + cel.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + exit(); + } + }); + searchJpanel = new JPanel(new PropertyLayout()); + searchJpanel.add("1.1.left.top", jLabel); + searchJpanel.add("1.2.left.top", field); + searchJpanel.add("1.3.left.top", jLabel2); + searchJpanel.add("1.4.left.top", field2); + searchJpanel.add("2.1.left.top", jLabel3); + searchJpanel.add("2.2.left.top", field3); + searchJpanel.add("2.3.left.top", jLabel4); + searchJpanel.add("2.4.left.top", field4); + + tableJpanel = new JPanel(new BorderLayout()); + this.jTable = getjTable(this.jTable, null, obj, null); + jTable.setDefaultRenderer(Object.class, new TableComboxRender()); + jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);//Ŀֻܵѡ + tableJpanel.add(new JScrollPane(this.jTable), BorderLayout.CENTER); + + if(isrefresh==true){ + + int rowCount = this.jTable.getRowCount(); + Object[][] values = new Object[valueLists.size()][5]; + if(s.equals("TCȡU8ɹǰVIEW")){ + values = new Object[valueLists.size()][5]; + for (int i = 0; i < valueLists.size(); i++) { + values[i][0] = valueLists.get(i).getMaterialCode() + "";// ϱ + values[i][1] = valueLists.get(i).getMaterialName();// + values[i][2] = valueLists.get(i).getTechModel();// ͺ + values[i][3] = valueLists.get(i).getSpecModel();// ͺ + values[i][4] = valueLists.get(i).getPurchasingCycle();// ɹ + } + }else if(s.equals("TCȡU8Ͽ")){ + values = new Object[valueLists.size()][6]; + for (int i = 0; i < valueLists.size(); i++) { + values[i][0] = valueLists.get(i).getMaterialCode() + "";// ϱ + values[i][1] = valueLists.get(i).getMaterialName();// + values[i][2] = valueLists.get(i).getTechModel();// ͺ + values[i][3] = valueLists.get(i).getSpecModel();// ͺ + values[i][4] = valueLists.get(i).getQuantity();// + values[i][5] = valueLists.get(i).getInQuantity();// + } + } + for (int i = rowCount - 1; i >= 0; i--) { + ((DefaultTableModel) this.jTable.getModel()).removeRow(i); + } + for (int i = 0; i < values.length; i++) { + if (values[i][1] != null) { + ((DefaultTableModel) this.jTable.getModel()).addRow(values[i]); + } + } + } + buttoJpanel = new JPanel(new FlowLayout()); + buttoJpanel.add(search); + this.getRootPane().setDefaultButton(search);// õǰĬѡаť + buttoJpanel.add(cel); + this.add(searchJpanel, BorderLayout.NORTH); + this.add(tableJpanel, BorderLayout.CENTER); + this.add(buttoJpanel, BorderLayout.SOUTH); + this.pack(); + this.centerToScreen(); + this.showDialog(); + + } + + @Override + public void run() { + this.setAlwaysOnTop(true); + if(s.equals("TCȡU8ɹǰVIEW")){ + obj = new Object[] { "ϱ", "", "ͺ", "ͺ", "ɹ" }; + this.setTitle("TCȡU8ɹǰVIEW"); + }else if(s.equals("TCȡU8Ͽ")){ + obj = new Object[] { "ϱ", "", "ͺ", "ͺ", "", "" }; + this.setTitle("TCȡU8Ͽ"); + } + + initUI(); + } + + public void exit() { + this.disposeDialog(); + this.dispose(); + } + + // Jtableͨ÷ + public JTable getjTable(JTable partsTable, DefaultTableModel dtm, Object[] titleNames, Object[][] values) { + int simpleLen = 105; + int totleLen = 900; + if (partsTable == null) { + partsTable = new JTable(getTableModel(dtm, titleNames, values)) { + @Override + public boolean isCellEditable(int row, int column) { + return false; + } + }; + partsTable.setRowHeight(20); + if (simpleLen * titleNames.length >= totleLen) { + for (int i = 0; i < titleNames.length; i++) { + partsTable.getColumnModel().getColumn(i).setPreferredWidth(105); + } + partsTable.setAutoResizeMode(0); + } else { + partsTable.setAutoResizeMode(1); + } + } + return partsTable; + } + + // tableؼ + public DefaultTableModel getTableModel(DefaultTableModel dtm, Object[] columnNameObjects, Object[][] objects) { + if (dtm == null) { + dtm = new DefaultTableModel(objects, columnNameObjects); + } + return dtm; + } + + + @Override + public void actionPerformed(ActionEvent e) { + code = field.getText(); + name=field2.getText(); + tec=field3.getText(); + spec=field4.getText(); + if (code.trim().equals("")&& + name.trim().equals("")&& + tec.trim().equals("")&& + spec.trim().equals("")) { + isSearchContentNull=true; +// MessageBox.post("ȷһѯݲΪ", "", MessageBox.ERROR); +// return; + } + this.setAlwaysOnTop(false); + this.setVisible(false); + Operation ope=new Operation(isSearchContentNull,session,code,name,tec,spec,wait,s); + this.session.queueOperation(ope); + + } + +} diff --git a/src/com/connor/jk/plm/view/MaterielStorageHandler.java b/src/com/connor/jk/plm/view/MaterielStorageHandler.java new file mode 100644 index 0000000..7c4d597 --- /dev/null +++ b/src/com/connor/jk/plm/view/MaterielStorageHandler.java @@ -0,0 +1,21 @@ +package com.connor.jk.plm.view; + +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.aifrcp.AIFUtility; + +public class MaterielStorageHandler extends AbstractHandler { + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + String title="TCȡU8Ͽ"; + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + MaterialStorageAction action=new MaterialStorageAction(app, title); + new Thread(action).start(); + return null; + } + +} diff --git a/src/com/connor/jk/plm/view/Operation.java b/src/com/connor/jk/plm/view/Operation.java new file mode 100644 index 0000000..5c03c36 --- /dev/null +++ b/src/com/connor/jk/plm/view/Operation.java @@ -0,0 +1,179 @@ +package com.connor.jk.plm.view; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.List; + +import com.teamcenter.rac.aif.AbstractAIFOperation; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class Operation extends AbstractAIFOperation { + TCSession session; + String code; + String name; + String tec; + String spec; + ProgressBarThread wait; + TCPreferenceService preferenceService; + List valueLists = new ArrayList(); + MaterialStorageBean bean; + String[] id=null;//ڴ洢id + boolean isrefresh = false; + String title; + boolean isSearchContentNull; + public Operation(boolean isSearchContentNull, TCSession session, String code, String name, String tec, String spec, ProgressBarThread wait, String s) { + this.isSearchContentNull=isSearchContentNull; + this.session=session; + this.code=code; + this.name=name; + this.tec=tec; + this.spec=spec; + this.wait=wait; + this.title=s; + } + + @Override + public void executeOperation() throws Exception { + // TODO Auto-generated method stub + this.wait.start(); + doSearch(code,name,tec,spec); + + } + private void doSearch(String code, String name, String tec, String spec) { + // TODO ͨѯҵIDٽIDݿѯ + + isrefresh=true; + if(isSearchContentNull==false){ + + if(code.trim().equals("")){ + code="*"; + } + if(name.trim().equals("")){ + name="*"; + } + InterfaceAIFComponent[] aifComponent=null; + InterfaceAIFComponent[] aifComponent2=null; + + //ļͺź͹ͺΪջûֵôͨ* + if(tec.trim().equals("")&&spec.trim().equals("")){ + try { + aifComponent=this.session.search("U8",new String[]{"ID",""},new String[]{code,name}); + aifComponent2=this.session.search("U8ʱ",new String[]{"ID",""},new String[]{code,name}); + } catch (Exception e) { + e.printStackTrace(); + } + + } + if(!tec.trim().equals("")&&spec.trim().equals("")){ + aifComponent=SearchUtil.searchComponentsCollection(session,"U8",new String[]{"ID","","ͺ"},new String[]{code,name,tec}); + aifComponent2=SearchUtil.searchComponentsCollection(session,"U8ʱ",new String[]{"ID","","ͺ"},new String[]{code,name,tec}); + + } + if(tec.trim().equals("")&&!spec.trim().equals("")){ + aifComponent=SearchUtil.searchComponentsCollection(session,"U8",new String[]{"ID","","ͺ"},new String[]{code,name,spec}); + aifComponent2=SearchUtil.searchComponentsCollection(session,"U8ʱ",new String[]{"ID","","ͺ"},new String[]{code,name,spec}); + + } + if(!tec.trim().equals("")&&!spec.trim().equals("")){ + aifComponent=SearchUtil.searchComponentsCollection(session,"U8",new String[]{"ID","","ͺ","ͺ"},new String[]{code,name,spec,tec}); + aifComponent2=SearchUtil.searchComponentsCollection(session,"U8ʱ",new String[]{"ID","","ͺ","ͺ"},new String[]{code,name,tec,spec}); + + } + + id=new String[aifComponent.length+aifComponent2.length]; + for (int i = 0; i < aifComponent.length; i++) { + try { + id[i]=((TCComponentItemRevision)aifComponent[i]).getTCProperty("item_id").getStringValue(); +// System.out.println("id----------->"+id[i]); + } catch (Exception e) { + e.printStackTrace(); + } + } + for (int i = 0; i < aifComponent2.length; i++) { + try { + id[i+aifComponent.length]=((TCComponentItemRevision)aifComponent2[i]).getTCProperty("item_id").getStringValue(); + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + preferenceService=this.session.getPreferenceService(); + String[] connect=preferenceService.getStringValue("jk_tc_u8_infomation_cycle").split("&"); +// String[] connect=preferenceService.getStringValue("tx_tc_k3_infomation_cycle").split("&"); + String driver_temp =""; + String url = ""; + String dbName = ""; + String dbPassword = ""; + dbName=connect[0]; + dbPassword=connect[1]; + url=connect[2]; + driver_temp=connect[3]; + SqlUtil.getConnection(dbName,dbPassword,url,driver_temp); + + this.valueLists = new ArrayList(); + for (int i = 0; i < id.length; i++) { + String searchQuestion = SqlUtil.getSelectSql_1("JK_PURCHASING_CYCLE_VIEW","JK_MATERIAL_CODE",id[i]); + System.out.println(searchQuestion); + + try { + ResultSet set = SqlUtil.read(searchQuestion);// ѯ + DecimalFormat df = new DecimalFormat("0.00"); + if (set.next()) { + bean = new MaterialStorageBean(); + System.out.println("ϱ----"+set.getString("JK_MATERIAL_CODE")); + bean.setMaterialCode(set.getString("JK_MATERIAL_CODE"));// ϱ + bean.setMaterialName(set.getString("JK_MATERIAL_NAME"));// + System.out.println("ͺ---"+set.getString("JK_TECH_MODEL")); + bean.setTechModel(set.getString("JK_TECH_MODEL"));// ͺ + bean.setSpecModel(set.getString("JK_SPEC_MODEL"));// ͺ + bean.setPurchasingCycle(set.getString("JK_PURCHASING_CYCLE"));// ɹ + bean.setUnitPrice(set.getString("JK_UNIT_PRICE"));// + bean.setQuantity(set.getDouble("JK_QUANTITY")+"");// JK_QUANTITY +// bean.setQuantity(df.format(Double.valueOf(set.getString("JK_QUANTITY"))));// JK_QUANTITY +// bean.setInQuantity(df.format(Double.valueOf(set.getString("JK_IN_QUANTITY"))));// + bean.setInQuantity(set.getDouble("JK_IN_QUANTITY")+"");// + this.valueLists.add(bean); + } + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + if (this.valueLists.size() == 0||isSearchContentNull==true) { + this.wait.setBool(true); + this.wait.interrupt(); + + bean = new MaterialStorageBean(); + bean.setMaterialCode("޴");// ϱ + if(isSearchContentNull==true){ + + bean.setMaterialCode("ѯݲȫΪ");// ϱ + } + bean.setMaterialName("");// + bean.setTechModel("");// ͺ + bean.setSpecModel("");// ͺ + bean.setPurchasingCycle("");// ɹ + bean.setUnitPrice("");// + bean.setQuantity("");// + bean.setInQuantity("");// + this.valueLists.add(bean); +// this.setAlwaysOnTop(false); +// MessageBox.post("ѯϢڣ˶Բѯ", "", MessageBox.ERROR); + +// return; + } + this.wait.setBool(true); + this.wait.interrupt(); + MaterialStorageDialog dialog=new MaterialStorageDialog(session, valueLists,isrefresh,title); + new Thread(dialog).start(); + } + + +} diff --git a/src/com/connor/jk/plm/view/Operation2.java b/src/com/connor/jk/plm/view/Operation2.java new file mode 100644 index 0000000..ebb4814 --- /dev/null +++ b/src/com/connor/jk/plm/view/Operation2.java @@ -0,0 +1,119 @@ +package com.connor.jk.plm.view; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +import com.teamcenter.rac.aif.AbstractAIFOperation; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponentProject; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class Operation2 extends AbstractAIFOperation { + TCSession session; + ProgressBarThread wait; + String code = ""; + String[] ss = null; + String id = ""; + TCPreferenceService preferenceService; + List valueLists = new ArrayList(); + ProjectCostBean bean; + boolean isSearchContentNull; + boolean isRefresh; + public Operation2(boolean isSearchContentNull,boolean isRefresh, TCSession session, ProgressBarThread wait, String code2) { + this.isSearchContentNull=isSearchContentNull; + this.isRefresh=isRefresh; + this.session=session; + this.wait=wait; + this.code=code2; + } + @Override + public void executeOperation() throws Exception { + wait.start(); + + doSearch(code); + } + private void doSearch(String code2) { + // TODO + isRefresh = true; + // Ϊ֧ģѯҪڲѯѯ + TCComponentProject[] proj = null; + if(!code2.equals("")){ + + InterfaceAIFComponent[] aifComponents = SearchUtil.searchComponentsCollection(session, "Ŀ...", + new String[] { "Ŀ ID" }, new String[] { code2 }); + ss = new String[aifComponents.length]; + for (int i = 0; i < aifComponents.length; i++) { + try { + id = ((TCComponentProject) aifComponents[i]).getTCProperty("project_id").getStringValue(); + ss[i] = id; + } catch (Exception e) { + e.printStackTrace(); + } + } + + int a = 1; + preferenceService = this.session.getPreferenceService(); + String[] connect = preferenceService.getStringValue("jk_tc_u8_infomation").split("&"); + String driver_temp = ""; + String url = ""; + String dbName = ""; + String dbPassword = ""; + dbName = connect[0]; + dbPassword = connect[1]; + url = connect[2]; + driver_temp = connect[3]; + SqlUtil.getConnection(dbName, dbPassword, url, driver_temp); + + this.valueLists = new ArrayList(); + String searchQuestion = ""; + for (int i = 0; i < ss.length; i++) { + System.out.println("ѯ---------------->" + ss[i]); + searchQuestion = SqlUtil.getSelectSql_1("JK_PROJECT_COST_VIEW", "JK_BOM_ID", ss[i]); + System.out.println(searchQuestion); + + try { + ResultSet set = SqlUtil.read(searchQuestion);// ѯ + while (set.next()) { + bean = new ProjectCostBean(); + bean.setProjectCode(set.getString("JK_BOM_ID")); + ;// Ŀ + bean.setCostDetail(set.getString("JK_BOM_REV"));// ϸ + bean.setCost(set.getString("JK_BOM_CID"));// + this.valueLists.add(bean); + } + } catch (SQLException e) { + System.out.println("ѯ"); + e.printStackTrace(); + } + // if(a==1){ + // return; + // } + } + } + if (isSearchContentNull==true||valueLists.size() == 0) { + + wait.setBool(true); + wait.interrupt(); + bean = new ProjectCostBean(); + bean.setProjectCode("޴Ŀ"); + if(isSearchContentNull==true){ + bean.setProjectCode("ȷѯݲΪ"); + } + ;// Ŀ + bean.setCostDetail("");// ϸ + bean.setCost("");// + this.valueLists.add(bean); +// this.setAlwaysOnTop(false); +// MessageBox.post("º˶ԲѯϢ", "", MessageBox.ERROR); +// return; + } + wait.setBool(true); + wait.interrupt(); + ProjectCostDialog dialog=new ProjectCostDialog(session,valueLists,isRefresh); + new Thread(dialog).start(); + } +} diff --git a/src/com/connor/jk/plm/view/ProgressBar.java b/src/com/connor/jk/plm/view/ProgressBar.java new file mode 100644 index 0000000..395638e --- /dev/null +++ b/src/com/connor/jk/plm/view/ProgressBar.java @@ -0,0 +1,174 @@ +/** + * @file ProgressBar.java + * + * @brief Create progress bar + * + * @author Yanghui + * + * @history + * ================================================================ + * Date Name Description of Change + * 25-July-2008 Yanghui this class is used to create + * progress bar. + */ +package com.connor.jk.plm.view; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JProgressBar; +import javax.swing.Timer; +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.util.PropertyLayout; +import com.teamcenter.rac.util.Registry; + +/** + * @class ProgressBar + * @brief Create progress bar + * @author Yanghui + */ +public class ProgressBar extends AbstractAIFDialog implements ActionListener { + /** + * @var ProgressBar.progressbar + * @brief JProgressBar + */ + private JProgressBar progressbar; + + /** + * @var ProgressBar.label + * @brief label used to tips + */ + private JLabel label; + + /** + * @var ProgressBar.timer + * @brief timer used to timing operation + */ + private Timer timer; + + /** + * @var ProgressBar.bool + * @brief bool used to flag thread return + */ + private boolean bool = false; + + /** + * @var Progressbar.registry + * @brief Registry + */ + private Registry registry; + + /** + * @fn public ProgressBar() + * @brief constructor + * @param[in] null + */ + private String showLable = null ; + public ProgressBar(String showlable) { +// super(true); + showLable = showlable; + this.setAlwaysOnTop(true); + } + + /** + * @fn public void setBool(boolean bool) + * @brief set bool value + * @param[in] bool + * @param[out] null + */ + public void setBool(boolean bool) { + this.bool = bool; + } + + /** + * @fn private void initUI() + * @brief createDialog method + * @param[in] null + * @param[out] null + */ + public void initUI() { + System.out.println("--------------------------------------------------------------------------"); +// Container container = getContentPane(); + JPanel mainPanel = new JPanel(new PropertyLayout()); + this.label = new JLabel(showLable, JLabel.CENTER); + this.progressbar = new JProgressBar(); + this.progressbar.setOrientation(JProgressBar.HORIZONTAL); + this.progressbar.setMinimum(0); + this.progressbar.setMaximum(100); + this.progressbar.setValue(0); + this.progressbar.setPreferredSize(new Dimension(200, 15)); + this.progressbar.setBorderPainted(true); + this.timer = new Timer(50, (ActionListener) this); + this.timer.setRepeats(false); + mainPanel.add("1.1.center", new JLabel(" ")); + mainPanel.add("2.1.center", label); + mainPanel.add("3.1.center", progressbar); + mainPanel.add("4.1.center", new JLabel(" ")); +// container.add(mainPanel); + this.add(mainPanel); + pack(); + setLocation(500, 200); + TaskThread thread = new TaskThread(this); + thread.start(); + addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + bool = true; + } + }); + this.setVisible(true); + this.setLocationRelativeTo(null); + } + + /** + * @class TaskThread + * @brief Create progressbar + * + */ + class TaskThread extends Thread { + private ProgressBar bar; + + public TaskThread(ProgressBar bar) { + this.bar = bar; + } + + public void run() { + if (bool == false) { + // Set Status is running. + // session.setStatus(registry.getString("export Running")); + } + for (int i = 0; i < i + 1; i++) { + timer.start(); + int value = progressbar.getValue(); + if (value < 100) { + value = value + 5; + progressbar.setValue(value); + } else { + timer.stop(); + progressbar.setValue(0); + } + try { + sleep(100); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + if (bool == true) { + bar.setVisible(false); + bar.dispose(); + return; + + } + + } + } + } + + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + + } +} diff --git a/src/com/connor/jk/plm/view/ProgressBarThread.java b/src/com/connor/jk/plm/view/ProgressBarThread.java new file mode 100644 index 0000000..ee80de7 --- /dev/null +++ b/src/com/connor/jk/plm/view/ProgressBarThread.java @@ -0,0 +1,41 @@ +/** + * @file ProgressBarThread.java + * + * @brief control progressBar. + * + * @author Yanghui + * + * @history + * ================================================================ + * Date Name Description of Change + * 08-Auguest-2008 Yanghui this class is used to control + * progress bar. + */ +package com.connor.jk.plm.view; + +/** + * @class ProgressBarThread + * @brief Create progress bar thread + * @author Yanghui + */ +public class ProgressBarThread extends Thread { + + private ProgressBar bar; + + private String title; + + public ProgressBarThread(String title,String showLable) { + this.title = title; + bar = new ProgressBar(showLable); + } + + public void run() { + bar.setTitle(title); + bar.initUI(); + } + + public void setBool(boolean bool) { + bar.setBool(true); + bar.setAlwaysOnTop(false); + } +} diff --git a/src/com/connor/jk/plm/view/ProjectCostAction.java b/src/com/connor/jk/plm/view/ProjectCostAction.java new file mode 100644 index 0000000..98f8830 --- /dev/null +++ b/src/com/connor/jk/plm/view/ProjectCostAction.java @@ -0,0 +1,22 @@ +package com.connor.jk.plm.view; + +import com.connor.jk.plm.report.JspsReport_Dialog; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.common.actions.AbstractAIFAction; + +public class ProjectCostAction extends AbstractAIFAction { +private AbstractAIFApplication app; + public ProjectCostAction(AbstractAIFApplication arg0, String arg2) { + super(arg0, arg2); + // TODO Auto-generated constructor stub + this.app=arg0; + } + + @Override + public void run() { + // TODO Auto-generated method stub + ProjectCostDialog dia=new ProjectCostDialog(app); + new Thread(dia).start(); + } + +} diff --git a/src/com/connor/jk/plm/view/ProjectCostBean.java b/src/com/connor/jk/plm/view/ProjectCostBean.java new file mode 100644 index 0000000..02282b1 --- /dev/null +++ b/src/com/connor/jk/plm/view/ProjectCostBean.java @@ -0,0 +1,26 @@ +package com.connor.jk.plm.view; + +public class ProjectCostBean { + private String projectCode; + public String getProjectCode() { + return projectCode; + } + public void setProjectCode(String projectCode) { + this.projectCode = projectCode; + } + private String costDetail; + private String cost; + public String getCostDetail() { + return costDetail; + } + public void setCostDetail(String costDetail) { + this.costDetail = costDetail; + } + public String getCost() { + return cost; + } + public void setCost(String cost) { + this.cost = cost; + } + +} diff --git a/src/com/connor/jk/plm/view/ProjectCostDialog.java b/src/com/connor/jk/plm/view/ProjectCostDialog.java new file mode 100644 index 0000000..5ef0bc9 --- /dev/null +++ b/src/com/connor/jk/plm/view/ProjectCostDialog.java @@ -0,0 +1,302 @@ +package com.connor.jk.plm.view; + +import java.awt.BorderLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.JTextField; +import javax.swing.ListSelectionModel; +import javax.swing.RowSorter; +import javax.swing.table.DefaultTableModel; +import javax.swing.table.TableModel; +import javax.swing.table.TableRowSorter; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.form.JK8_JSPSPropBean; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemType; +import com.teamcenter.rac.kernel.TCComponentProject; +import com.teamcenter.rac.kernel.TCComponentProjectType; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; +import com.teamcenter.soaictstubs.propertyData_u; + +public class ProjectCostDialog extends AbstractAIFDialog implements ActionListener { + private AbstractAIFApplication app; + private TCSession session; + private TCPreferenceService preferenceService; + private JLabel jLabel; + private JTextField field; + private JButton search; + public static JButton assign;//ֵĿִз jk8ImplementBudget + public static String projectID;//ֵĿִз jk8ImplementBudget + public static String jk8ImplementBudget;//ִз + private JPanel searchJpanel; + private JPanel tableJpanel; + private String code = ""; + + private ProjectCostBean bean; + private String[] ss = null; + private String id = ""; + ProgressBarThread wait; + private List valueLists = new ArrayList(); + + private JTable jTable; + private Object[] obj = new Object[] { "Ŀ", "ϸ", "" }; + + boolean isRefresh = false; + private Object[][] values; + boolean isSearchContentNull=false; + + public ProjectCostDialog(AbstractAIFApplication app) { + super(); + this.app = app; + this.session = (TCSession) app.getSession(); + } + + public ProjectCostDialog(TCSession session2, List valueLists2, boolean isRefresh2) { + this.session=session2; + this.valueLists=valueLists2; + this.isRefresh=isRefresh2; + } + // JTable + DefaultTableModel model = new DefaultTableModel(); + public void initUI() { +// if (isRefresh == true) { +// +// this.remove(searchJpanel); +// this.remove(tableJpanel); +// } + this.setTitle("TCȡU8ĿVIEW"); + this.setLayout(new BorderLayout()); + this.setAlwaysOnTop(true); + jLabel = new JLabel("Ŀ"); + field = new JTextField(32); + + assign = new JButton(" ִз"); + assign.setEnabled(false); + assign.addActionListener(this); + search = new JButton("ѯ"); + search.addActionListener(this); +// search.addActionListener(new ActionListener() { +// @Override +// public void actionPerformed(ActionEvent e) { +// // code=field.getText(); +// // if(code.trim().equals("")){ +// // MessageBox.post("ȷѯݲΪ","",MessageBox.ERROR); +// // return; +// // } +// // wait=new ProgressBarThread("ִ", "ݲѯУԵ..."); +// // wait.start(); +// // doSearch(code); +// // initUI(); +// } +// +// }); + searchJpanel = new JPanel(new PropertyLayout()); + searchJpanel.add("1.1.left.top", jLabel); + searchJpanel.add("1.2.left.top", field); + searchJpanel.add("1.3.left.top", assign); + searchJpanel.add("1.4.left.top", search); + this.getRootPane().setDefaultButton(search);// õǰĬѡаť + + + tableJpanel = new JPanel(new BorderLayout()); + this.jTable = getjTable(this.jTable, null, obj, null); + jTable.setDefaultRenderer(Object.class, new ProjectCostTableComboxRender()); + jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);// Ŀֻܵѡ + + + tableJpanel.add(new JScrollPane(this.jTable), BorderLayout.CENTER); + + if (isRefresh == true) { + + int rowCount = this.jTable.getRowCount(); + values = new Object[valueLists.size()][3]; + for (int i = 0; i < valueLists.size(); i++) { + values[i][0] = valueLists.get(i).getProjectCode() + "";// Ŀ + values[i][1] = valueLists.get(i).getCostDetail() + "";// ϸ + values[i][2] = valueLists.get(i).getCost() + "";// + } + for (int i = rowCount - 1; i >= 0; i--) { + ((DefaultTableModel) this.jTable.getModel()).removeRow(i); + } + for (int i = 0; i < values.length; i++) { + if (values[i][1] != null) { + ((DefaultTableModel) this.jTable.getModel()).addRow(values[i]); + } + } + + + } + + this.add(searchJpanel, BorderLayout.NORTH); + this.add(tableJpanel, BorderLayout.CENTER); + this.pack(); + this.centerToScreen(); + this.showDialog(); + + } + + @Override + public void run() { + + initUI(); + + } + + // Jtableͨ÷ + public JTable getjTable(JTable partsTable, DefaultTableModel dtm, Object[] titleNames, Object[][] values) { + int simpleLen = 105; + int totleLen = 900; + if (partsTable == null) { + DefaultTableModel dtm1=getTableModel(dtm, titleNames, values); + partsTable = new JTable(dtm1) {//dtm1=getTableModel(dtm, titleNames, values) + @Override + public boolean isCellEditable(int row, int column) { + return false; + } + }; + // + RowSorter sorter = new TableRowSorter(dtm1); + partsTable.setRowSorter(sorter); + + partsTable.setRowHeight(20); + // partsTable.setAlignmentX(partsTable.getRowHeight()/2); + // partsTable.setAlignmentY(partsTable.getRowHeight()/2); + if (simpleLen * titleNames.length >= totleLen) { + for (int i = 0; i < titleNames.length; i++) { + partsTable.getColumnModel().getColumn(i).setPreferredWidth(105); + } + partsTable.setAutoResizeMode(0); + } else { + partsTable.setAutoResizeMode(1); + } + } + return partsTable; + } + + // tableؼ + public DefaultTableModel getTableModel(DefaultTableModel dtm, Object[] columnNameObjects, Object[][] objects) { + if (dtm == null) { + dtm = new DefaultTableModel(objects, columnNameObjects); + } + return dtm; + } + + private void doSearch(String code2) { + // TODO + isRefresh = true; + // Ϊ֧ģѯҪڲѯѯ + TCComponentProject[] proj = null; + InterfaceAIFComponent[] aifComponents = SearchUtil.searchComponentsCollection(session, "Ŀ...", + new String[] { "Ŀ ID" }, new String[] { code2 }); + ss = new String[aifComponents.length]; + for (int i = 0; i < aifComponents.length; i++) { + try { + id = ((TCComponentProject) aifComponents[i]).getTCProperty("project_id").getStringValue(); + ss[i] = id; + } catch (Exception e) { + e.printStackTrace(); + } + } + + int a = 1; + preferenceService = this.session.getPreferenceService(); + String[] connect = preferenceService.getStringValue("jk_tc_u8_infomation").split("&"); + String driver_temp = ""; + String url = ""; + String dbName = ""; + String dbPassword = ""; + dbName = connect[0]; + dbPassword = connect[1]; + url = connect[2]; + driver_temp = connect[3]; + SqlUtil.getConnection(dbName, dbPassword, url, driver_temp); + + this.valueLists = new ArrayList(); + String searchQuestion = ""; + for (int i = 0; i < ss.length; i++) { + System.out.println("ѯ---------------->" + ss[i]); + searchQuestion = SqlUtil.getSelectSql_1("JK_PROJECT_COST_VIEW", "JK_BOM_ID", ss[i]); + System.out.println(searchQuestion); + + try { + ResultSet set = SqlUtil.read(searchQuestion);// ѯ + while (set.next()) { + bean = new ProjectCostBean(); + bean.setProjectCode(set.getString("JK_BOM_ID")); + ;// Ŀ + bean.setCostDetail(set.getString("JK_BOM_REV"));// ϸ + bean.setCost(set.getString("JK_BOM_CID"));// + this.valueLists.add(bean); + } + } catch (SQLException e) { + System.out.println("ѯ"); + e.printStackTrace(); + } + // if(a==1){ + // return; + // } + } + if (valueLists.size() == 0) { + wait.setBool(true); + wait.interrupt(); + this.setAlwaysOnTop(false); + MessageBox.post("º˶ԲѯϢ", "", MessageBox.ERROR); + return; + } + wait.setBool(true); + wait.interrupt(); + } + + @Override + public void actionPerformed(ActionEvent e) { + Object obj = e.getSource(); + if (obj.equals(search)) { + code = field.getText(); + this.setAlwaysOnTop(false); + if (code.trim().equals("")) { +// MessageBox.post("ȷѯݲΪ", "", MessageBox.ERROR); + isSearchContentNull=true; +// return; + } + this.setVisible(false); + this.wait = new ProgressBarThread("ִ", "ݲѯУԵ..."); + Operation2 ope=new Operation2(isSearchContentNull,isRefresh,session,wait,code); + this.session.queueOperation(ope); + }else if(obj.equals(assign)) { + System.out.println(ProjectCostDialog.projectID); + TCComponent project; + try { + project=session.search("Ŀ...", new String[] {"Ŀ ID"}, new String[] {ProjectCostDialog.projectID})[0]; + System.out.println(jk8ImplementBudget); + Util.setByPass(true); + project.getTCProperty("jk8ImplementBudget").setDoubleValue(Double.valueOf(jk8ImplementBudget)); + Util.setByPass(false); + this.setAlwaysOnTop(false); + this.disposeDialog(); + MessageBox.post("ѽøֵĿ","",MessageBox.INFORMATION); + } catch (Exception e1) { + e1.printStackTrace(); + } + } + + } + +} diff --git a/src/com/connor/jk/plm/view/ProjectCostHandler.java b/src/com/connor/jk/plm/view/ProjectCostHandler.java new file mode 100644 index 0000000..e01b927 --- /dev/null +++ b/src/com/connor/jk/plm/view/ProjectCostHandler.java @@ -0,0 +1,22 @@ +package com.connor.jk.plm.view; + +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.aifrcp.AIFUtility; +import com.teamcenter.rac.commands.project.ProjectDialog; + +public class ProjectCostHandler extends AbstractHandler { + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + // TODO Auto-generated method stub + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + ProjectCostAction action=new ProjectCostAction(app, null); + new Thread(action).start(); + + return null; + } + +} diff --git a/src/com/connor/jk/plm/view/ProjectCostTableComboxRender.java b/src/com/connor/jk/plm/view/ProjectCostTableComboxRender.java new file mode 100644 index 0000000..511b801 --- /dev/null +++ b/src/com/connor/jk/plm/view/ProjectCostTableComboxRender.java @@ -0,0 +1,99 @@ +package com.connor.jk.plm.view; +import java.awt.Color; +import java.awt.Component; +import java.awt.Font; +//import java.awt.event.ItemListener; +//import java.awt.event.MouseAdapter; +//import java.awt.event.MouseEvent; +//import java.util.ArrayList; +//import java.util.HashMap; +//import java.util.Map; + +//import javax.swing.JComboBox; +import javax.swing.JComponent; +import javax.swing.JTable; +import javax.swing.JTextArea; +import javax.swing.table.TableCellRenderer; + +/** + * @author duchao + * + */ +class ProjectCostTableComboxRender extends JComponent implements TableCellRenderer { + /** + * + */ + private static final long serialVersionUID = 1L; +// private JComboBox combox = null; + private JTextArea text; + private JTextArea text1; + private JTextArea text2; +// private Map comboxMap = new HashMap<>(); + + public ProjectCostTableComboxRender() { + + } + + int index4 = 0; + + @Override + public Component getTableCellRendererComponent(final JTable jtable, + Object obj, boolean isSelected, boolean hasFocus, final int row, + final int column) { + JComponent component1 = null; +// JComponent component0 = null; + if (column == 0) { + text1 = new JTextArea(); + text1.setText(obj != null ? obj.toString() : ""); + text1.setEditable(false); + component1 = text1; + } + if (column == 2) { + text2 = new JTextArea(); + text2.setText(obj != null ? obj.toString() : ""); + text2.setEditable(false); + component1 = text2; + } + + text = new JTextArea(); + text.setText(obj != null ? obj.toString() : ""); + text.setEditable(false); + component1 = text; + // 趨 + Font fp = new Font("΢ź", Font.PLAIN, 10); + Font fb = new Font("΢ź", Font.BOLD, 11); + if (isSelected) { + // TODO ȡ + ProjectCostDialog.assign.setEnabled(true); + ProjectCostDialog.projectID = text1.getText(); + ProjectCostDialog.jk8ImplementBudget = text2.getText(); + component1.setFont(fb); + + } else { + component1.setFont(fp); + } + // 趨ɫ + if (isSelected) { + + // 2.õǰCellɫ + Color mycolor2 = new Color(10, 36, 106); + component1.setBackground(mycolor2);// ñɫ + // component1.setBackground(mycolor);// ñɫ + component1.setForeground(Color.WHITE);// ǰɫ + } else { + + // 3.õУżеɫ + Color mycolor = new Color(232, 242, 254); + if (row % 2 == 0) {// żʱɫ + component1.setBackground(mycolor); + component1.setForeground(Color.BLACK);// ǰɫ + } else if (row % 2 == 1) {// õеɫ + component1.setBackground(Color.WHITE); + component1.setForeground(Color.BLACK);// ǰɫ + } + } + + + return component1; + } +} \ No newline at end of file diff --git a/src/com/connor/jk/plm/view/PurchasingCycleHandler.java b/src/com/connor/jk/plm/view/PurchasingCycleHandler.java new file mode 100644 index 0000000..5c0b00d --- /dev/null +++ b/src/com/connor/jk/plm/view/PurchasingCycleHandler.java @@ -0,0 +1,21 @@ +package com.connor.jk.plm.view; + +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.aifrcp.AIFUtility; + +public class PurchasingCycleHandler extends AbstractHandler { + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + String title="TCȡU8ɹǰVIEW"; + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + MaterialStorageAction action=new MaterialStorageAction(app, title); + new Thread(action).start(); + return null; + } + +} diff --git a/src/com/connor/jk/plm/view/SearchUtil.java b/src/com/connor/jk/plm/view/SearchUtil.java new file mode 100644 index 0000000..483b473 --- /dev/null +++ b/src/com/connor/jk/plm/view/SearchUtil.java @@ -0,0 +1,93 @@ +package com.connor.jk.plm.view; + +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponentContextList; +import com.teamcenter.rac.kernel.TCComponentQuery; +import com.teamcenter.rac.kernel.TCComponentQueryType; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCQueryClause; +import com.teamcenter.rac.kernel.TCSession; + +public class SearchUtil { + public static InterfaceAIFComponent[] searchComponentsCollection( + TCSession session, String searchName, String[] keys, String[] values) { + // Ϣ + InterfaceAIFComponent[] result = new InterfaceAIFComponent[0]; + + try { + System.out.println("ʼִ"); + // õѯķ +// TCTextService textService = session.getTextService(); + // ȡquerytype + // ̶дImanQuery + TCComponentQueryType querytype = (TCComponentQueryType) session + .getTypeComponent("ImanQuery"); + // ͨquerytypeҵsearchNameIJѯ + TCComponentQuery query = (TCComponentQuery) querytype + .find(searchName); +// if (query == null) { +// MessageBox.post("ͨѯ" + searchName + "", "", 1); +// return null; +// }else{ +// MessageBox.post("ͨѯҵ" + searchName, "ɹ", 2); +// } + querytype.clearCache(); + String[] as = new String[keys.length]; + for (int i = 0; i < keys.length; i++) { +// as[i] = textService.getTextValue(keys[i]); + as[i] = keys[i]; + System.out.println("ûѯĿas["+i+"]="+as[i]); + } + + String[] as1 = new String[values.length]; + for (int i = 0; i < values.length; i++) { +// as1[i] = textService.getTextValue(values[i]); + as1[i] = values[i]; + System.out.println("ûѯĿӦֵas1["+i+"]="+as1[i]); + } + query.clearCache();//ҵջ + // ͨѯõѯϢ + TCQueryClause[] clauses = query.describe(); + + // ѯϢѯĿǷȷ + for (int i = 0; i < clauses.length; i++) { + // õѯ + clauses[i].getAttributeName();//item_id + // õûĿ + clauses[i].getUserEntryName();//ItemID + // õûػĿ + clauses[i].getUserEntryNameDisplay();// ID + System.out.println(clauses[i].getAttributeName()+"\t"+ + clauses[i].getUserEntryName()+"\t"+ + clauses[i].getUserEntryNameDisplay()); + + } + // ִвѯ + TCComponentContextList list = query.getExecuteResultsList(as, as1); + System.out.println("list==null"); + System.out.println(list==null); +// TCComponentContextList list = query.getExecuteResultsList(keys, values); + if (list != null) { + // õѯĶ + int count = list.getListCount(); + System.out.println("count--------->"+count); + // صγ + result = new InterfaceAIFComponent[count]; + // ѯĽص鸳ֵ + for (int i = 0; i < count; i++) { + // õѯ +// AIFComponentContext context = list.get(i); + // ͨĵõӦĶ󣬲ֵص + result[i] = list.get(i).getComponent(); + System.out.println("result["+i+"]="+result[i]); + } + } + } catch (TCException e) { + e.printStackTrace(); +// MessageBox.post("ͨѯ" + searchName + "ѯ.", "", 1); + } + + return result; + } + +} diff --git a/src/com/connor/jk/plm/view/SqlUtil.java b/src/com/connor/jk/plm/view/SqlUtil.java new file mode 100644 index 0000000..6baa865 --- /dev/null +++ b/src/com/connor/jk/plm/view/SqlUtil.java @@ -0,0 +1,566 @@ +package com.connor.jk.plm.view; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; + +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.Registry; + +/** + * ֹ̳final,ֹ󽨶˽й췽,ΪʹС PreparedStatementResultSetС + * + * @author hub 2015-02-06 + */ +public final class SqlUtil { + public static Connection connection = null; + public static PreparedStatement ps = null; + public static ResultSet rs = null; + private static Registry reg = Registry.getRegistry("com.connor.jk.plm.view.database"); + + /** + * ˽йnew󣬷ֹö + */ + private SqlUtil() { + + } + + static { + String driver = reg.getString("ORACEL_DRIVER"); // Util.getProperties("DRIVER"); + if (driver == null) { + driver = "oracle.jdbc.driver.OracleDriver"; + } + + System.out.println("driver " + driver); + try { + Class.forName(driver); + } catch (ClassNotFoundException e) { + System.out.println("ORACEL DRIVER IS EXCEPTION"); + e.printStackTrace(); + } + } + /** + * ݿ + */ + public static Connection getConnection(String dbName,String dbPassword,String url,String driver_temp) { + try { + + if (driver_temp == null || url == null || dbName == null + || dbPassword == null) { + + MessageBox.post("ݿѡǷȷ", "ʾ", MessageBox.ERROR); + + } + System.out.println(url + dbName + dbPassword); + connection = DriverManager.getConnection(url, dbName, dbPassword); +// connection.setAutoCommit(false); + } catch (SQLException e) { + System.out.println("ORACEL CONNECT EXCEPTION"); + e.printStackTrace(); + return null; + // MessageBox.post("ORACEL CONNECT EXCEPTION \n"+e.getMessage(),"ERROR",MessageBox.ERROR); + } + return connection; + } + + /** + * ݿ + */ + public static Connection getConnection() { + try { + String driver_temp = reg.getString("ORACEL_DRIVER"); +// String url = reg.getString("ORACEL_URL");// getProperties("URL"); +// String dbName = reg.getString("ORACEL_NAME");// Util.getProperties("dbName"); +// String dbPassword = reg.getString("ORACEL_PASSWORD");// Util.getProperties("dbPassword"); + String url = reg.getString("ORACEL_URL");// getProperties("URL"); + String dbName = "GOLD_CARD";// Util.getProperties("dbName"); + String dbPassword = "jk300349";// Util.getProperties("dbPassword"); + System.out.println("ORACEL_DRIVER:"+driver_temp); + System.out.println("ORACEL_URL:"+url); + System.out.println("ORACEL_NAME:"+dbName); + System.out.println("ORACEL_PASSWORD:"+dbPassword); +// int a=1; +// if(a==1){ +// return connection; +// } + + if (driver_temp == null || url == null || dbName == null + || dbPassword == null) { + + MessageBox.post("ݿѡǷȷ", "ʾ", MessageBox.ERROR); + + } + // else{ + // MessageBox.post(driver_temp+" | "+url+" | "+dbName+" | "+dbPassword,"ʾ",MessageBox.ERROR); + // + // } + System.out.println(url + dbName + dbPassword); + connection = DriverManager.getConnection(url, dbName, dbPassword); + connection.setAutoCommit(false); + } catch (SQLException e) { + System.out.println("ORACEL CONNECT EXCEPTION"); + e.printStackTrace(); + return null; + // MessageBox.post("ORACEL CONNECT EXCEPTION \n"+e.getMessage(),"ERROR",MessageBox.ERROR); + } + return connection; + } + + /** + * ݿ + */ + public static Connection getConnection(String url, String dbName, + String dbPassword) { + try { + String driver_temp = reg.getString("ORACEL_DRIVER"); + + System.out.println(url + dbName + dbPassword); + connection = DriverManager.getConnection(url, dbName, dbPassword); + connection.setAutoCommit(false); + } catch (SQLException e) { + System.out.println("ORACEL CONNECT EXCEPTION"); + e.printStackTrace(); + // MessageBox.post("ORACEL CONNECT EXCEPTION \n"+e.getMessage(),"ERROR",MessageBox.ERROR); + return null; + } + return connection; + } + + /** + * ƴSELECT + * + * @param tableName + * @param selectElement + * @param args + * @return + */ + public static String getSelectSql(String tableName, String[] selectElement, + String... args) { + StringBuffer valuesSB = new StringBuffer("SELECT "); + if (selectElement != null) { + for (String element : selectElement) { + valuesSB.append(element).append(","); + } + valuesSB.delete(valuesSB.length() - 1, valuesSB.length()); + } + valuesSB.append(" FROM "); + valuesSB.append(tableName); + valuesSB.append(" WHERE"); + for (int i = 0; i < args.length; i++) { + valuesSB.append(" "); + valuesSB.append(args[i]); + valuesSB.append("=? "); + valuesSB.append("AND"); + } + + valuesSB.delete(valuesSB.length() - 3, valuesSB.length()); + return valuesSB.toString(); + } + + + /** + * ƴSELECT + * + * @param tableName + * @param selectElement + * @param args + * @return + */ + public static String getSelectSql_1(String tableName, String selectElement, + String keyword ) { + StringBuffer valuesSB = new StringBuffer("SELECT *"); + + valuesSB.append(" FROM "); + valuesSB.append(tableName); + valuesSB.append(" WHERE "); + valuesSB.append(selectElement); + valuesSB.append(" = '"); + valuesSB.append(keyword); + valuesSB.append("'"); + return valuesSB.toString(); + } + + /** + * ƴSELECT + * + * @param tableName + * @param args + * @return + */ + public static String getSelectSql(String tableName, String... args) { + StringBuffer valuesSB = new StringBuffer("SELECT * FROM "); + valuesSB.append(tableName); + valuesSB.append(" WHERE"); + for (int i = 0; i < args.length; i++) { + valuesSB.append(" "); + valuesSB.append(args[i]); + valuesSB.append("=? "); + valuesSB.append("AND"); + } + + valuesSB.delete(valuesSB.length() - 3, valuesSB.length()); + return valuesSB.toString(); + } + + /** + * ƴӸ + * + * @param tableName + * @param args + * @param args2 + * @return + */ + public static String getUpdataSQL(String tableName, String[] args, + String[] args2) { + StringBuffer updateSB = new StringBuffer("UPDATE "); + updateSB.append(tableName); + updateSB.append(" SET "); + // ƴӸ + for (int i = 0; i < args.length; i++) { + if (args[i].toUpperCase().equals("OPERATE_TIME") + || args[i].toUpperCase().equals("LAST_UPDATE_DATE")) { + updateSB.append(args[i]).append( + "=to_date(?,'yyyy-MM-dd HH24:mi:ss') ,"); + } else { + updateSB.append(args[i]).append("=? ,"); + } + } + updateSB.delete(updateSB.length() - 2, updateSB.length()); + ; + updateSB.append(" WHERE "); + for (int i = 0; i < args2.length; i++) { + updateSB.append(args2[i]).append("=? AND "); + } + updateSB.delete(updateSB.length() - 4, updateSB.length()); + return updateSB.toString(); + } + + /** + * ƴSQLinsert + * + * @param tableName + * @param args + * @return + */ + public static String getInsertSql(String tableName, String... args) { + StringBuffer insertSql = new StringBuffer("insert into "); + StringBuffer values = new StringBuffer("values("); + + if (tableName != null && args != null && args.length > 0) { + insertSql.append(tableName); + insertSql.append("("); + for (int i = 0; i < args.length; i++) { + insertSql.append(args[i]); + insertSql.append(", "); + if (args[i].toUpperCase().equals("COMMIT_TIME") + || args[i].toUpperCase().equals("CREATE_DATE") + || args[i].toUpperCase().equals("INVALID_DATE")) { + values.append("to_date(?,'yyyy-MM-dd HH24:mi:ss'), "); + } else { + values.append("?, "); + } + + } + } else { + return null; + } + insertSql.delete(insertSql.length() - 2, insertSql.length()); + values.delete(values.length() - 2, values.length()); + insertSql.append(") ").append(values).append(")"); + return insertSql.toString(); + } + + /** + * õݿ + * + * @param tableName + * @param args + * + * @param args2 + * + * @return ƴӺĴݿ + */ + public final static String GetCreateTableSQL(String tableName, + String[] args, String[] args2) { + + if (args == null || args2 == null || args.length != args2.length) { + System.out.println("THE INPUT PRAGREMS IS ERROR"); + return null; + } + StringBuffer createSQL = new StringBuffer("create table "); + createSQL.append(tableName); + createSQL.append("("); + for (int i = 0; i < args.length; i++) { + createSQL.append(args[i] + " "); + createSQL.append(args2[i] + ", "); + } + createSQL.delete(createSQL.length() - 2, createSQL.length()); + createSQL.append(")"); + return createSQL.toString(); + } + + /** + * õStatement + */ + public final static PreparedStatement getPs(String sql) throws SQLException { + return getPs(sql, null); + } + + /** + * õStatement + */ + public final static PreparedStatement getPs(Object[] argments, String sql) + throws SQLException { +// System.out.println("PreparedStatement getPs"); + return getPs(sql, argments); + } + + /** + * õStatement + */ + public final static PreparedStatement getPs(String sql, Object[] argments) + throws SQLException { +// System.out.println("PreparedStatement getPs2"); + SqlUtil.ps = SqlUtil.connection.prepareStatement(sql); + if (argments != null) { + for (int i = 0; i < argments.length; i++) { + SqlUtil.ps.setObject(i + 1, argments[i]); + } + } + return SqlUtil.ps; + } + + /** + * + */ + public final static int write(String sql) { + return write(sql, null); + } + + /** + * + */ + public final static int write(Object[] argments, String sql) { + return write(sql, argments); + } + + /** + * + */ + public final static int write(String sql, Object[] argments) { + + return update(sql, argments); + } + + /** + * ɾ + */ + public final static int delete(String sql) { + return delete(sql, null); + } + + /** + * ɾ + */ + public final static int delete(Object[] argments, String sql) { + return delete(sql, argments); + } + + /** + * ɾ + */ + public final static int delete(String sql, Object[] argments) { + return update(sql, argments); + } + + /** + * ޸ + */ + public final static int update(String sql) { + return update(sql, null); + } + + /** + * ޸ + */ + public final static int update(String[] argments, String sql) { + return update(sql, argments); + } + + /** + * ޸(ɾնҪô˷˴쳣رճConnectionΪĶ) + */ + public final static int update(String sql, Object[] argments) { + int i = -1; + try { + i = SqlUtil.getPs(argments, sql).executeUpdate(); + // 2015-11-19 + // SqlUtil.connection.commit(); + } catch (SQLException e) { + e.printStackTrace(); + } finally { + free(SqlUtil.rs, SqlUtil.ps); + } + return i; + } + + /** + * ѯ + */ + public final static ResultSet read(String sql) throws SQLException { +// System.out.println("ResultSet read"); + return read(sql, null); + } + + /** + * ѯ + */ + public final static ResultSet read(Object[] argments, String sql) + throws SQLException { + return read(sql, argments); + } + + /** + * ѯ(вѯնҪô˷治쳣׳ɵߴfinallyͷԴ) + * + * @throws SQLException + */ + public final static ResultSet read(String sql, Object[] argments) + throws SQLException { +// System.out.println("ResultSet read2"); + return SqlUtil.rs = SqlUtil.getPs(argments, sql).executeQuery(); + } + + /** + * + */ + public final static boolean createTable(String sql) { + return go(sql, null); + } + + /** + * ɾ + */ + public final static boolean dropTable(String sql) { + return go(sql, null); + } + + /** + * ޸ı + */ + public final static boolean alterTable(String sql) { + return go(sql, null); + } + + /** + * ˷ִDDL(,޸ı,ɾ) + */ + private final static boolean go(String sql, Object[] argments) { + boolean flag = false; + try { + flag = SqlUtil.getPs(sql, argments).execute(); + } catch (SQLException e) { + e.printStackTrace(); + } finally { + free(SqlUtil.rs, SqlUtil.ps); + } + if (flag) { + try { + SqlUtil.connection.commit(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + return flag; + } + + /** + * ͷԴ + */ + public final static void free(ResultSet resultSet) { + free(resultSet, null, null); + } + + /** + * ͷԴ + */ + public final static void free(Statement statement) { + free(null, statement, null); + } + + /** + * ͷԴ + */ + public final static void free(Connection connection) { + free(null, null, connection); + } + + /** + * ͷԴ + */ + public final static void free(ResultSet resultSet, Statement statement) { + free(resultSet, statement, null); + } + + /** + * ͷԴ + */ + public final static void free(Statement statement, Connection connection) { + free(null, statement, connection); + } + + /** + * ͷԴ(Ĭϲ) + */ + public final static void free() { + free(SqlUtil.rs, SqlUtil.ps); + } + + /** + * ͷԴ(ȫͷ) + */ + public final static void freeAll() { + free(SqlUtil.rs, SqlUtil.ps, SqlUtil.connection); + } + + /** + * ͷԴ(ҲҪȫͷ) + */ + public final static void free(ResultSet resultSet, Statement statement, + Connection connection) { + try { + if (resultSet != null) { + try { + resultSet.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } finally { + try { + if (statement != null) { + try { + statement.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } finally { + if (connection != null) { + try { + connection.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + } + } + +// public void findsth(String searchpart){ +// +// } +} diff --git a/src/com/connor/jk/plm/view/TableComboxRender.java b/src/com/connor/jk/plm/view/TableComboxRender.java new file mode 100644 index 0000000..62d57dd --- /dev/null +++ b/src/com/connor/jk/plm/view/TableComboxRender.java @@ -0,0 +1,92 @@ +package com.connor.jk.plm.view; + +import java.awt.Color; +import java.awt.Component; +import java.awt.Font; +//import java.awt.event.ItemListener; +//import java.awt.event.MouseAdapter; +//import java.awt.event.MouseEvent; +//import java.util.ArrayList; +//import java.util.HashMap; +//import java.util.Map; + +//import javax.swing.JComboBox; +import javax.swing.JComponent; +import javax.swing.JTable; +import javax.swing.JTextArea; +import javax.swing.table.TableCellRenderer; + +/** + * @author duchao + * + */ +class TableComboxRender extends JComponent implements TableCellRenderer { + /** + * + */ + private static final long serialVersionUID = 1L; +// private JComboBox combox = null; + private JTextArea text; + private JTextArea text1; +// private Map comboxMap = new HashMap<>(); + + public TableComboxRender() { + + } + + int index4 = 0; + + @Override + public Component getTableCellRendererComponent(final JTable jtable, + Object obj, boolean isSelected, boolean hasFocus, final int row, + final int column) { + JComponent component1 = null; +// JComponent component0 = null; + if (column == 0) { + text1 = new JTextArea(); + text1.setText(obj != null ? obj.toString() : ""); + text1.setEditable(false); + component1 = text1; + } + + text = new JTextArea(); + text.setText(obj != null ? obj.toString() : ""); + text.setEditable(false); + component1 = text; + // 趨 + Font fp = new Font("΢ź", Font.PLAIN, 12); + Font fb = new Font("΢ź", Font.BOLD, 13); + if (isSelected) { + // TODO ȡ +// ChangeDbomDialogInput.inputButton.setEnabled(true); +// ChangeDbomDialogInput.selectedId = text1.getText(); + component1.setFont(fb); + + } else { + component1.setFont(fp); + } + // 趨ɫ + if (isSelected) { + + // 2.õǰCellɫ + Color mycolor2 = new Color(10, 36, 106); + component1.setBackground(mycolor2);// ñɫ + // component1.setBackground(mycolor);// ñɫ + component1.setForeground(Color.WHITE);// ǰɫ + } else { + + // 3.õУżеɫ + Color mycolor = new Color(232, 242, 254); + if (row % 2 == 0) {// żʱɫ + component1.setBackground(mycolor); + component1.setForeground(Color.BLACK);// ǰɫ + } else if (row % 2 == 1) {// õеɫ + component1.setBackground(Color.WHITE); + component1.setForeground(Color.BLACK);// ǰɫ + } + } + + + return component1; + } +} \ No newline at end of file diff --git a/src/com/connor/jk/plm/view/Util.java b/src/com/connor/jk/plm/view/Util.java new file mode 100644 index 0000000..6679eb6 --- /dev/null +++ b/src/com/connor/jk/plm/view/Util.java @@ -0,0 +1,54 @@ +package com.connor.jk.plm.view; +import java.util.List; + +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.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +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.TCUserService; +import com.teamcenter.rac.util.MessageBox; + +public class Util { + public static TCPreferenceService service; + public static TCSession session; + public static TCUserService userservice;; + + static { + if (session == null) { + session = (TCSession) (AIFUtility.getCurrentApplication() + .getSession()); + } + if (service == null) + service = session.getPreferenceService(); + } + + public static void setByPass(boolean val) throws TCException { + if (userservice == null) { + userservice = session.getUserService(); + } + Object[] obj = new Object[1]; + obj[0] = "origin"; + if (val) { + userservice.call("ORIGIN_set_bypass", obj); + } else { + userservice.call("ORIGIN_close_bypass", obj); + } + } + + + +} \ No newline at end of file diff --git a/src/com/connor/jk/plm/view/database.properties b/src/com/connor/jk/plm/view/database.properties new file mode 100644 index 0000000..dd28fdf --- /dev/null +++ b/src/com/connor/jk/plm/view/database.properties @@ -0,0 +1,20 @@ + +#ORACEL_NAME=tc +# +#ORACEL_PASSWORD=Tc123456 +# +##ORACEL_URL=jdbc:oracle:thin:@192.168.1.248:1521:TOPPROD +# +#ORACEL_URL=jdbc:microsoft:sqlserver://10.200.1.33:1433;DatabaseName=ecology +# +#ORACEL_DRIVER=com.microsoft.jdbc.sqlserver.SQLServerDriver + +ORACEL_NAME=sa + +ORACEL_PASSWORD=Gold123card + +#ORACEL_URL=jdbc:oracle:thin:@192.168.1.248:1521:TOPPROD + +ORACEL_URL=jdbc:microsoft:sqlserver://10.200.1.33:1433;DatabaseName=UFDATA_110_2014 + +ORACEL_DRIVER=com.microsoft.jdbc.sqlserver.SQLServerDriver \ No newline at end of file diff --git a/src/com/connor/jk/plm/waterMeter/DataBaseControl.java b/src/com/connor/jk/plm/waterMeter/DataBaseControl.java new file mode 100644 index 0000000..31ea966 --- /dev/null +++ b/src/com/connor/jk/plm/waterMeter/DataBaseControl.java @@ -0,0 +1,193 @@ +package com.connor.jk.plm.waterMeter; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.HashMap; +import java.util.Vector; + +public class DataBaseControl { + + /** ************************ݿ:*********************************** */ + /** + * kelsen .... + */ + Connection conn; + + ResultSet rs; + + PreparedStatement pstmt; + + Statement stmt; + + String strUrl, strUserName, strPassword, strSQLQuery, strDriver; + + public String str_Information=""; + + + /** + * + */ + public DataBaseControl(String strDriver, String strUrl, String strUserName, + String strPassword) { + this.strDriver = strDriver; // "oracle.jdbc.driver.OracleDriver";// + this.strUrl = strUrl; // "jdbc:oracle:thin:@127.0.0.1:1521:tceng";//· + this.strUserName = strUserName; // "infodba";//ݿû + this.strPassword = strPassword; // "infodba";//ݿ + // strSQLQuery="select * from LABELID";//ѯ + + // + try { + Class.forName(strDriver);// ͨڴ + } catch (ClassNotFoundException cnfe) { + cnfe.printStackTrace(); + } + } + + /** + * + * @param strSQLQuery + */ + public void dbModify(String strSQLQuery) { + + openDataBase(); + + try { + stmt = conn.createStatement(); + stmt.executeUpdate(strSQLQuery); + } catch (SQLException sqle2) { + sqle2.printStackTrace(); + } + + closeDataBase(); + } + + /** + * ѯ + * @param strSQLQuery + * @return + */ + public ResultSet dbQuery(String strSQLQuery) { + ResultSet rs_result = null; + if (conn == null) + openDataBase(); + try { + stmt = conn.createStatement(); + rs_result = stmt.executeQuery(strSQLQuery); + + } catch (SQLException sqle2) { + sqle2.printStackTrace(); + } + return rs_result; + } + + /** + * + * + */ + public void openDataBase() { + try { + //this.strUrl="jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.29)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=tcprod)))"; + if (conn == null || conn.isClosed()) + conn = DriverManager.getConnection(strUrl, strUserName, + strPassword); + } catch (SQLException sqle) { + sqle.printStackTrace(); + } + } + + /** + * رݿ + * + */ + public void closeDataBase() { + try { + if (rs != null) { + try { + rs.close(); + } catch (SQLException sqlec) { + sqlec.printStackTrace(); + } + } + if (conn != null && !conn.isClosed()) { + try { + conn.close(); + } catch (SQLException sqlecon) { + sqlecon.printStackTrace(); + } + + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * 䴫ݿвѯ + * ѯõĽÿһ¼װһHashMap,keyԱֶ + * ѯ¼VectorжٸHasnMapԪ + * @param strSQLQuery + * @return + * @author xuk + */ + public Vector orgQuery(String strSQLQuery){ + openDataBase(); + Vector v_result=new Vector(); + try{ + ResultSet rs_get=dbQuery(strSQLQuery); +// System.out.println("RS_GET:"+rs_get); + if(rs_get!=null){ + ResultSetMetaData metaData = rs_get.getMetaData(); + + int i_ColumnCount=metaData.getColumnCount(); +// System.out.println("i_ColumnCount:"+i_ColumnCount); + while(rs_get.next()){ +// System.out.println("BJZJ2"+rs_get.getString("BJZJ2"));; + HashMap hm_unit=new HashMap(); + for(int i=1;i<=i_ColumnCount;i++){ + hm_unit.put(metaData.getColumnName(i), rs_get.getString(i)); +// System.out.println("metaData.getColumnName(i):"+metaData.getColumnName(i)); +// System.out.println("rs_get.getString(i):"+rs_get.getString(i)); + } + v_result.add(hm_unit); + } + }else{ + str_Information=""+strSQLQuery+""+"ѯĽΪ\n"; + } + }catch(Exception e){ + e.printStackTrace(); + } + return v_result; + } + + + /** + * + * @param args + */ + public static void main(String args[]) { + try{ + /*String str_DataBaseDriver = "oracle.jdbc.driver.OracleDriver"; + String str_URL = "jdbc:oracle:thin:@origin-667aaf64:1521:TCENG"; + String str_UserName = "kelsen"; + String str_Password = "kelsen"; + DataBaseControl dbc = new DataBaseControl(str_DataBaseDriver, str_URL, + str_UserName, str_Password); + String str_Query=" select * from YLCSB where YLZCID='000001' and YLZCBBH='A'"; + Vector v_get=dbc.orgQuery(str_Query); + System.out.println("v_get:"+v_get.size()); + for(int i=0;i realNameMap;// ѡֵ + private DataBaseControl dbc = null; + private String[] sbhall;// ʶ + private String[] cpxhall;// Ʒͺ + private String allSBH = ""; + private String allCPXH = ""; + + public GenerateWater_Operation(AbstractAIFApplication app) { + this.app = app; + this.targetComp = app.getTargetComponent(); + this.session = (TCSession) app.getSession(); + this.type = targetComp.getType(); + this.uid = targetComp.getUid(); //BGU1$kbBYvbLjA RVX5AkERYvbLjA + String[] names = session.getPreferenceService().getStringValues("JK_WATER_SQB_GZ"); + if (names != null) { + realNameMap = new HashMap<>(); + for (int i = 0; i < names.length; i++) { + String[] s = names[i].split(":"); + if (s != null && s.length == 2) { + String key = s[0]; + String value = s[1]; + realNameMap.put(key, value); + } else { + MessageBox.post("ѡ JK_WATER_SQB_GZ ôϵԱ", "", + MessageBox.ERROR); + return; + } + + } + + } else { + MessageBox + .post("ѡ JK_WATER_SQB_GZ ڣϵԱ", "", MessageBox.ERROR); + } + TCPreferenceService pref = session.getPreferenceService(); + String puid = pref.getStringValue("JK_WATER_SQB_FORM_PUID");// ѡpuid 0610 + if (puid == null) { + MessageBox.post("ѡδҵϵԱ", "", MessageBox.ERROR); + } + + TCComponentForm formAll; + try { + formAll = (TCComponentForm) session.stringToComponent(puid); + if (formAll == null) { + MessageBox.post("δҵϵԱ", "", MessageBox.ERROR); + } + + sbhall = formAll.getTCProperty("jk8ProductIdentifyNO").getStringArrayValue(); + cpxhall = formAll.getTCProperty("jk8ProductModNO").getStringArrayValue(); + + if (sbhall != null) + for (String s : sbhall) { + allSBH = allSBH + s + ","; // ʶһַ + } + if (cpxhall != null) + for (String s : cpxhall) { + allCPXH = allCPXH + s + "&"; // вƷͺһַ + } + + } catch (TCException e) { + + e.printStackTrace(); + } + } + + // + public String createLSM2(String itemID0) { + String newID = ""; + String JdbcDriverClass = "oracle.jdbc.driver.OracleDriver"; + //String strUrl = "jdbc:oracle:thin:@10.201.5.202:1521:jktc";// + String strUrl = "jdbc:oracle:thin:@10.200.2.43:1521:jktc";//ʽ + String strUserName = "infodba"; + String strPassword = "infodba"; + try { + try { + Class.forName(JdbcDriverClass); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } + Connection conn = DriverManager.getConnection(strUrl, strUserName, strPassword); + + String query = "select * from JK_WATER_TABLE where JK_SBH='" + itemID0 + "'"; + Statement stmt = conn.createStatement(); + + ResultSet rs_get = stmt.executeQuery(query); + int rowCount = 0; + if (rs_get.next()) { + rowCount++; + String SBH = rs_get.getString("JK_SBH");// ȡ + if (itemID0.equals(SBH)) { +// int LSM =Integer.valueOf(rs_get.getString("JK_LSM")) ;// ȡˮ + String LSMString = rs_get.getString("JK_LSM"); + LSMString=Integer.valueOf(LSMString)+1+""; + int length = LSMString.length(); + if(length<2) { + LSMString = "0" + LSMString; + } + // ѯǰ+ˮ빹ɵidǷ +// newID = SBH + LSMString; + + + + + newID=loop( rs_get, query, itemID0, LSMString, SBH, stmt, conn); + + /*if (rs_get != null) { + rs_get.close(); + } + query= "select * from JK_WATER_TABLE where JK_SBH='" + itemID0 + "' and JK_LSM='"+LSMString+"'"; + System.out.println(query); + rs_get = stmt.executeQuery(query); + if (rs_get.next()) { + + LSMString = rs_get.getString("JK_LSM"); + LSMString=Integer.valueOf(LSMString)+1+""; + length = LSMString.length(); + if(length<2) { + LSMString = "0" + LSMString; + } + + }else { + newID = SBH + LSMString; + if (rs_get != null) { + rs_get.close(); + } +// query = "insert into JK_WATER_TABLE set JK_LSM='" + LSMString + "' , JK_BASE='"+newID+"' WHERE JK_SBH='"+SBH+"'" ; + query = "insert into JK_WATER_TABLE (JK_SBH,JK_LSM,JK_BASE) values('" + SBH + "', '"+LSMString+"' ,'"+newID+"')"; + System.out.println(query); + try { + rs_get = stmt.executeQuery(query); + } catch (Exception e) { + if (rs_get != null) { + rs_get.close(); + } + if (stmt != null) { + stmt.close(); + } + if (conn != null) { + } + e.printStackTrace(); + } + }*/ + + + + + + + + /*//ˮд + if (rs_get != null) { + rs_get.close(); + } +// query = "insert into JK_WATER_TABLE set JK_LSM='" + LSMString + "' , JK_BASE='"+newID+"' WHERE JK_SBH='"+SBH+"'" ; + query = "insert into JK_WATER_TABLE (JK_SBH,JK_LSM,JK_BASE) values('" + SBH + "', '"+LSMString+"' ,'"+newID+"')"; + System.out.println(query); + try { + rs_get = stmt.executeQuery(query); + } catch (Exception e) { + if (rs_get != null) { + rs_get.close(); + } + if (stmt != null) { + stmt.close(); + } + if (conn != null) { + } + e.printStackTrace(); + }*/ + } + + if (rs_get != null) { + rs_get.close(); + } + if (stmt != null) { + stmt.close(); + } + if (conn != null) { + conn.close(); + } + // дмеˮ + return newID; + + } else { + if (rs_get != null) { + rs_get.close(); + } + query = "insert into JK_WATER_TABLE (JK_SBH,JK_LSM,JK_BASE) values('" + itemID0 + "', '0' ,'"+itemID0+"00')"; + System.out.println(query); + try { + rs_get = stmt.executeQuery(query); + } catch (Exception e) { + if (rs_get != null) { + rs_get.close(); + } + if (stmt != null) { + stmt.close(); + } + if (conn != null) { + } + e.printStackTrace(); + } + if (rs_get.next()) { + System.out.println("OK"); + } + newID = itemID0 + "00"; + if (rs_get != null) { + rs_get.close(); + } + } + System.out.println(rowCount); + if (rs_get != null) { + rs_get.close(); + } + if (stmt != null) { + stmt.close(); + } + if (conn != null) { + conn.close(); + } + } catch (SQLException e) { + e.printStackTrace(); + } + + // дмеˮ + return newID; + + } +public String loop(ResultSet rs_get, String query,String itemID0,String LSMString, String SBH,Statement stmt,Connection conn) throws SQLException { + String newID=""; + if (rs_get != null) { + rs_get.close(); + } + query= "select * from JK_WATER_TABLE where JK_SBH='" + itemID0 + "' and JK_LSM='"+LSMString+"'"; + System.out.println(query); + rs_get = stmt.executeQuery(query); + if (rs_get.next()) { + + LSMString = rs_get.getString("JK_LSM"); + LSMString=Integer.valueOf(LSMString)+1+""; + int length = LSMString.length(); + if(length<2) { + LSMString = "0" + LSMString; + } + newID=loop(rs_get,query,itemID0,LSMString,SBH,stmt,conn); + + }else { + newID = SBH + LSMString; + if (rs_get != null) { + rs_get.close(); + } +// query = "insert into JK_WATER_TABLE set JK_LSM='" + LSMString + "' , JK_BASE='"+newID+"' WHERE JK_SBH='"+SBH+"'" ; + query = "insert into JK_WATER_TABLE (JK_SBH,JK_LSM,JK_BASE) values('" + SBH + "', '"+LSMString+"' ,'"+newID+"')"; + System.out.println(query); + try { + rs_get = stmt.executeQuery(query); + } catch (Exception e) { + if (rs_get != null) { + rs_get.close(); + } + if (stmt != null) { + stmt.close(); + } + if (conn != null) { + } + e.printStackTrace(); + } + } + return newID; + +} + + public String createLSM3(String jzsbh) { + String newID = ""; + String JdbcDriverClass = "oracle.jdbc.driver.OracleDriver"; +// String strUrl = "jdbc:oracle:thin:@10.201.5.202:1521:jktc";// + String strUrl = "jdbc:oracle:thin:@10.200.2.43:1521:jktc";//ʽ + String strUserName = "infodba"; + String strPassword = "infodba"; + try { + try { + Class.forName(JdbcDriverClass); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } + Connection conn = DriverManager.getConnection(strUrl, strUserName, strPassword); + + String query = "select * from JK_WATER_TABLE where JK_BASE='" + jzsbh + "'"; + Statement stmt = conn.createStatement(); + + ResultSet rs_get = stmt.executeQuery(query); + int rowCount = 0; + if (rs_get.next()) { + rowCount++; + String BASE = rs_get.getString("JK_BASE");// ȡ + if (jzsbh.equals(BASE)) { +// int LSM =Integer.valueOf(rs_get.getString("JK_LSM")) ;// ȡˮ + String YSMString = rs_get.getString("JK_YSM"); + if(YSMString==null||YSMString.equals("")) { + YSMString="0"; + }else { + + YSMString=Integer.valueOf(YSMString)+1+""; + } + + int length = YSMString.length(); + if(length<2) { + YSMString = "0" + YSMString; + } + // ѯǰ+ˮ빹ɵidǷ + newID = jzsbh +"."+ YSMString; + //ˮд + if (rs_get != null) { + rs_get.close(); + } + query = "update JK_WATER_TABLE set JK_YSM='" + YSMString +"' where JK_BASE='"+jzsbh+"'"; + System.out.println(query); + try { + rs_get = stmt.executeQuery(query); + } catch (Exception e) { + if (rs_get != null) { + rs_get.close(); + } + if (stmt != null) { + stmt.close(); + } + if (conn != null) { + } + e.printStackTrace(); + } + } + + } else { + + } + System.out.println(rowCount); + if (rs_get != null) { + rs_get.close(); + } + if (stmt != null) { + stmt.close(); + } + if (conn != null) { + conn.close(); + } + } catch (SQLException e) { + e.printStackTrace(); + } + + // дмеˮ + return newID; + + } + + + @Override + public void executeOperation() throws Exception { + + if (targetComp instanceof TCComponentForm) { + form = (TCComponentForm) targetComp; + } else { + MessageBox.post("ѡбִв", "", 0); + return; + } + GetLsmUtil ge = new GetLsmUtil(); + String xh = "";// ͺ + String sbh = "";// ʶ + if ("JK8WaterPModAppForm".equals(type)) {// "²Ʒͺšʶ"; + //TODO Ʒͺ + String cplx = form.getTCProperty("jk8ProductTypePMN").getStringValue();// Ʒͺ֮Ʒ + String gjgg = form.getTCProperty("jk8PipeDSpec").getStringValue();// ܾ + // String txfs = form.getTCProperty("jk8CommunicateMode").getStringValue();// ͨŷʽ + /** add **/ + String tz = form.getTCProperty("jk8Feature").getStringValue();// + String cz = form.getTCProperty("jk8Texture").getStringValue();// + //ܾв + String[] gjggList = null; + if(gjgg.contains(",")){ + gjggList = gjgg.split(",", -1); + + } + if(!cplx.equals("")) { + String jg = form.getTCProperty("jk8Structure").getStringValue();// ṹ + // xh = "LX" + setVal(cplx, "Ʒ") + setVal(jg, "ṹ")+"-"+gjgg +setVal(txfs, "ͨŷʽ"); + + xh = "LX" + setVal(cplx, "Ʒ") + setVal(jg, "ṹ")+"-"+gjgg +setVal(tz, "") +setVal(cz, ""); + + if(gjggList != null){ + for (int i = 0; i < gjggList.length; i++) { + String xhSplit = gjggList[i]; + if(i == 0){ + // xh = "LX" + setVal(cplx, "Ʒ") + setVal(jg, "ṹ")+"-"+xhSplit +setVal(txfs, "ͨŷʽ"); + xh = "LX" + setVal(cplx, "Ʒ") + setVal(jg, "ṹ")+"-"+xhSplit +setVal(tz, "") +setVal(cz, ""); + }else{ + // xh = xh + "," + "LX" + setVal(cplx, "Ʒ") + setVal(jg, "ṹ")+"-"+xhSplit +setVal(txfs, "ͨŷʽ"); + xh = xh + "," + "LX" + setVal(cplx, "Ʒ") + setVal(jg, "ṹ")+"-"+xhSplit +setVal(tz, "") +setVal(cz, ""); + + } + } + }else{ + // xh = "LX" + setVal(cplx, "Ʒ") + setVal(jg, "ṹ")+"-"+gjgg +setVal(txfs, "ͨŷʽ"); + xh = "LX" + setVal(cplx, "Ʒ") + setVal(jg, "ṹ")+"-"+gjgg +setVal(tz, "") +setVal(cz, ""); + } + + }else { + // xh = "LX" + setVal(cplx, "Ʒ") +"-"+gjgg +setVal(txfs, "ͨŷʽ"); + xh = "LX" + setVal(cplx, "Ʒ") +"-"+gjgg +setVal(tz, "") +setVal(cz, ""); + if(gjggList != null){ + for (int i = 0; i < gjggList.length; i++) { + String xhSplit = gjggList[i]; + if(i == 0){ + // xh = "LX" + setVal(cplx, "Ʒ") +"-"+xhSplit +setVal(txfs, "ͨŷʽ"); + xh = "LX" + setVal(cplx, "Ʒ") +"-"+xhSplit +setVal(tz, "") +setVal(cz, ""); + }else{ + // xh = xh + "," + "LX" + setVal(cplx, "Ʒ") +"-"+xhSplit +setVal(txfs, "ͨŷʽ"); + xh = xh + "," + "LX" + setVal(cplx, "Ʒ") +"-"+xhSplit +setVal(tz, "") +setVal(cz, ""); + } + } + }else{ + // xh = "LX" + setVal(cplx, "Ʒ") +"-"+gjgg +setVal(txfs, "ͨŷʽ"); + xh = "LX" + setVal(cplx, "Ʒ") +"-"+gjgg +setVal(tz, "") +setVal(cz, ""); + } + + } + // ˮʶű +// String sbh_cplx=form.getTCProperty("jk8ProductTypePIN").getStringValue();// ʶ֮Ʒ + String sbh_jbcj=form.getTCProperty("jk8BMManufactor").getStringValue();// + String sbh_jbcz=form.getTCProperty("jk8BMMaterial").getStringValue();// + String sbh_kzq=form.getTCProperty("jk8ContrlCompType").getStringValue();// + + // ȡˮ + /** add ʶŶܾӦв 2020-01-07 **/ + String sbhNew = "" ; + if(gjggList == null){ + sbhNew=createLSM2("W"+setVal(cplx, "Ʒ")+ setVal(sbh_jbcj, "")+ setVal(sbh_jbcz, "")+ setVal(sbh_kzq, "") ); + // жʶڵǼDZǷ + boolean is=isha(sbhNew); + if(is){ + MessageBox.post("òƷʶ²ƷͺŵǼDZѴڣȷдȷ","", MessageBox.ERROR); + return; + } + }else{ + for (int i = 0; i < gjggList.length; i++) { + String sbhNew2 = createLSM2("W"+setVal(cplx, "Ʒ")+ setVal(sbh_jbcj, "")+ setVal(sbh_jbcz, "")+ setVal(sbh_kzq, "") ); + boolean is=isha(sbhNew2); + if(is){ + MessageBox.post("òƷʶ²ƷͺŵǼDZѴڣȷдȷ","", MessageBox.ERROR); + return; + } + if(i==0){ + sbhNew = sbhNew2; + }else{ + sbhNew = sbhNew + "," + sbhNew2; + } + } + } + + if (!xh.equals("") && !sbhNew.equals("")) { + form.getTCProperty("jk8ProductModNO").setStringValue(xh);// Ʒͺ + form.getTCProperty("jk8ProductIdentifyNO").setStringValue(sbhNew);// ʶ + MessageBox.post("ͺʶ,鿴", "ʾ", MessageBox.INFORMATION); + } else { + MessageBox.post("ͺʶʧ,", "", MessageBox.ERROR); + } + + + } else if ("JK8NWPIdenNOAppForm".equals(type)) {// "ˮƷʶ"; + // ˮʶű + String cplx=form.getTCProperty("jk8ProductTypePMN").getStringValue();// Ʒ + String sbh_jbcj=form.getTCProperty("jk8BMManufactor").getStringValue();// + String sbh_jbcz=form.getTCProperty("jk8BMMaterial").getStringValue();// + String sbh_kzq=form.getTCProperty("jk8ContrlCompType").getStringValue();// + + // ȡˮ + String sbhNew=createLSM2("W"+setVal(cplx, "Ʒ")+ setVal(sbh_jbcj, "")+ setVal(sbh_jbcz, "")+ setVal(sbh_kzq, "") ); + // жʶڵǼDZǷ + boolean is=isha(sbhNew); + if(is){ + MessageBox.post("òƷʶ²ƷͺŵǼDZѴڣȷдȷ","", MessageBox.ERROR); + return; + } + + if ( !sbhNew.equals("")) { +// form.getTCProperty("jk8ProductModNO").setStringValue(xh);// Ʒͺ + form.getTCProperty("jk8ProductIdentifyNO").setStringValue(sbhNew);// ʶ + MessageBox.post("ͺʶ,鿴", "ʾ", MessageBox.INFORMATION); + } else { + MessageBox.post("ͺʶʧ,", "", MessageBox.ERROR); + } + + } else if ("JK8DWPIdenNOAppForm".equals(type)) {// ƷˮƷʶ + String jzsbh = form.getTCProperty("jk8BaseIdentifyNO").getStringValue();// ʶ֮Ʒ + + String sbhNew = createLSM3(jzsbh); + // ȡˮ + // жʶڵǼDZǷ + boolean is = isha(sbhNew); + if (is) { + MessageBox.post("òƷʶ²ƷͺŵǼDZѴڣȷдȷ", "", MessageBox.ERROR); + return; + } + + if (!sbhNew.equals("")) { + // form.getTCProperty("jk8ProductModNO").setStringValue(xh);// Ʒͺ + form.getTCProperty("jk8ProductIdentifyNO").setStringValue(sbhNew);// ʶ + MessageBox.post("ͺʶ,鿴", "ʾ", MessageBox.INFORMATION); + } else { + MessageBox.post("ͺʶʧ,", "", MessageBox.ERROR); + } + + } else if ("JK8WSpecPINOAppForm".equals(type)) {// "ҪƷʶ"; + String jzsbh = form.getTCProperty("jk8BaseIdentifyNO").getStringValue();// ʶ֮Ʒ + String tsyq=form.getTCProperty("jk8Specialrequirements").getStringValue();//ϵͳjk8SpecialRequirements + String sbhNew = jzsbh +setVal(tsyq, "Ҫ"); + boolean is = isha(sbhNew); + if (is) { + MessageBox.post("òƷʶ²ƷͺŵǼDZѴڣȷдȷ", "", MessageBox.ERROR); + return; + } + + if (!sbhNew.equals("")) { + // form.getTCProperty("jk8ProductModNO").setStringValue(xh);// Ʒͺ + form.getTCProperty("jk8ProductIdentifyNO").setStringValue(sbhNew);// ʶ + MessageBox.post("ͺʶ,鿴", "ʾ", MessageBox.INFORMATION); + } else { + MessageBox.post("ͺʶʧ,", "", MessageBox.ERROR); + } + } else { + MessageBox.post("ѡƷͺʶִв", "", MessageBox.ERROR); + } + + } + + private boolean isha(String sbh) { + if (!sbh.equals("")) { + if (sbhall != null) + for (String s : sbhall) { + if (sbh.equals(s)) { + System.out.println("ͬʶ"); + return true; + } + } + } + return false; + } + + private String setVal(String key, String Allkey) { + String[] all = realNameMap.get(Allkey).split(","); + HashMap Map_all = new HashMap<>(); + for (int i = 0; i < all.length; i++) { + System.out.println("ss=" + all[i]); + Map_all.put(all[i].split("=")[0], all[i].split("=")[1]); + } + if (Map_all.containsKey(key)) { + System.out.println(Allkey + "=" + Map_all.get(key)); + return Map_all.get(key).trim(); + } else { + System.out.println(Allkey + "="); + return ""; + } + + } + + +} diff --git a/src/com/connor/jk/plm/waterMeter/GenerateWater_Operation_old.java b/src/com/connor/jk/plm/waterMeter/GenerateWater_Operation_old.java new file mode 100644 index 0000000..e39ae2d --- /dev/null +++ b/src/com/connor/jk/plm/waterMeter/GenerateWater_Operation_old.java @@ -0,0 +1,538 @@ +package com.connor.jk.plm.waterMeter; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.HashMap; + +import com.connor.jk.plm.createproject.GetLsmUtil; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.AbstractAIFOperation; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.Registry; + +//ʶšƷͺ +public class GenerateWater_Operation_old extends AbstractAIFOperation { + private AbstractAIFApplication app; + private InterfaceAIFComponent targetComp; + private TCSession session; + private String type; + private TCComponentForm form; + private HashMap realNameMap;// ѡֵ + private DataBaseControl dbc = null; + private String[] sbhall;// ʶ + private String[] cpxhall;// Ʒͺ + private String allSBH = ""; + private String allCPXH = ""; + + public GenerateWater_Operation_old(AbstractAIFApplication app) { + this.app = app; + this.targetComp = app.getTargetComponent(); + this.session = (TCSession) app.getSession(); + this.type = targetComp.getType(); + String[] names = session.getPreferenceService().getStringValues( + "JK_WATER_SQB_GZ"); + if (names != null) { + realNameMap = new HashMap<>(); + for (int i = 0; i < names.length; i++) { + String[] s = names[i].split(":"); + if (s != null && s.length == 2) { + String key = s[0]; + String value = s[1]; + realNameMap.put(key, value); + } else { + MessageBox.post("ѡ JK_WATER_SQB_GZ ôϵԱ", "", + MessageBox.ERROR); + return; + } + + } + + } else { + MessageBox + .post("ѡ JK_WATER_SQB_GZ ڣϵԱ", "", MessageBox.ERROR); + } + TCPreferenceService pref = session.getPreferenceService(); + String puid = pref.getStringValue("JK_WATER_SQB_FORM_PUID");// ѡpuid + if (puid == null) { + MessageBox.post("ѡδҵϵԱ", "", MessageBox.ERROR); + } + + TCComponentForm formAll; + try { + formAll = (TCComponentForm) session.stringToComponent(puid); + if (formAll == null) { + MessageBox.post("δҵϵԱ", "", MessageBox.ERROR); + } + + sbhall = formAll.getTCProperty("jk8ProductIdentifyNO") + .getStringArrayValue(); + cpxhall = formAll.getTCProperty("jk8ProductModNO") + .getStringArrayValue(); + + if (sbhall != null) + for (String s : sbhall) { + allSBH = allSBH + s + ","; // ʶһַ + } + if (cpxhall != null) + for (String s : cpxhall) { + allCPXH = allCPXH + s + "&"; // вƷͺһַ + } + + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + // + public String createLSM2(String itemID0) { + String newID = ""; + String JdbcDriverClass = "oracle.jdbc.driver.OracleDriver"; + //String strUrl = "jdbc:oracle:thin:@10.201.5.202:1521:jktc";// + String strUrl = "jdbc:oracle:thin:@10.200.2.43:1521:jktc";//ʽ + String strUserName = "infodba"; + String strPassword = "infodba"; + try { + try { + Class.forName(JdbcDriverClass); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } + Connection conn = DriverManager.getConnection(strUrl, strUserName, strPassword); + + String query = "select * from JK_WATER_TABLE where JK_SBH='" + itemID0 + "'"; + Statement stmt = conn.createStatement(); + + ResultSet rs_get = stmt.executeQuery(query); + int rowCount = 0; + if (rs_get.next()) { + rowCount++; + String SBH = rs_get.getString("JK_SBH");// ȡ + if (itemID0.equals(SBH)) { +// int LSM =Integer.valueOf(rs_get.getString("JK_LSM")) ;// ȡˮ + String LSMString = rs_get.getString("JK_LSM"); + LSMString=Integer.valueOf(LSMString)+1+""; + int length = LSMString.length(); + if(length<2) { + LSMString = "0" + LSMString; + } + // ѯǰ+ˮ빹ɵidǷ +// newID = SBH + LSMString; + + + + + newID=loop( rs_get, query, itemID0, LSMString, SBH, stmt, conn); + + /*if (rs_get != null) { + rs_get.close(); + } + query= "select * from JK_WATER_TABLE where JK_SBH='" + itemID0 + "' and JK_LSM='"+LSMString+"'"; + System.out.println(query); + rs_get = stmt.executeQuery(query); + if (rs_get.next()) { + + LSMString = rs_get.getString("JK_LSM"); + LSMString=Integer.valueOf(LSMString)+1+""; + length = LSMString.length(); + if(length<2) { + LSMString = "0" + LSMString; + } + + }else { + newID = SBH + LSMString; + if (rs_get != null) { + rs_get.close(); + } +// query = "insert into JK_WATER_TABLE set JK_LSM='" + LSMString + "' , JK_BASE='"+newID+"' WHERE JK_SBH='"+SBH+"'" ; + query = "insert into JK_WATER_TABLE (JK_SBH,JK_LSM,JK_BASE) values('" + SBH + "', '"+LSMString+"' ,'"+newID+"')"; + System.out.println(query); + try { + rs_get = stmt.executeQuery(query); + } catch (Exception e) { + if (rs_get != null) { + rs_get.close(); + } + if (stmt != null) { + stmt.close(); + } + if (conn != null) { + } + e.printStackTrace(); + } + }*/ + + + + + + + + /*//ˮд + if (rs_get != null) { + rs_get.close(); + } +// query = "insert into JK_WATER_TABLE set JK_LSM='" + LSMString + "' , JK_BASE='"+newID+"' WHERE JK_SBH='"+SBH+"'" ; + query = "insert into JK_WATER_TABLE (JK_SBH,JK_LSM,JK_BASE) values('" + SBH + "', '"+LSMString+"' ,'"+newID+"')"; + System.out.println(query); + try { + rs_get = stmt.executeQuery(query); + } catch (Exception e) { + if (rs_get != null) { + rs_get.close(); + } + if (stmt != null) { + stmt.close(); + } + if (conn != null) { + } + e.printStackTrace(); + }*/ + } + + if (rs_get != null) { + rs_get.close(); + } + if (stmt != null) { + stmt.close(); + } + if (conn != null) { + conn.close(); + } + // дмеˮ + return newID; + + } else { + if (rs_get != null) { + rs_get.close(); + } + query = "insert into JK_WATER_TABLE (JK_SBH,JK_LSM,JK_BASE) values('" + itemID0 + "', '0' ,'"+itemID0+"00')"; + System.out.println(query); + try { + rs_get = stmt.executeQuery(query); + } catch (Exception e) { + if (rs_get != null) { + rs_get.close(); + } + if (stmt != null) { + stmt.close(); + } + if (conn != null) { + } + e.printStackTrace(); + } + if (rs_get.next()) { + System.out.println("OK"); + } + newID = itemID0 + "00"; + if (rs_get != null) { + rs_get.close(); + } + } + System.out.println(rowCount); + if (rs_get != null) { + rs_get.close(); + } + if (stmt != null) { + stmt.close(); + } + if (conn != null) { + conn.close(); + } + } catch (SQLException e) { + e.printStackTrace(); + } + + // дмеˮ + return newID; + + } +public String loop(ResultSet rs_get, String query,String itemID0,String LSMString, String SBH,Statement stmt,Connection conn) throws SQLException { + String newID=""; + if (rs_get != null) { + rs_get.close(); + } + query= "select * from JK_WATER_TABLE where JK_SBH='" + itemID0 + "' and JK_LSM='"+LSMString+"'"; + System.out.println(query); + rs_get = stmt.executeQuery(query); + if (rs_get.next()) { + + LSMString = rs_get.getString("JK_LSM"); + LSMString=Integer.valueOf(LSMString)+1+""; + int length = LSMString.length(); + if(length<2) { + LSMString = "0" + LSMString; + } + newID=loop(rs_get,query,itemID0,LSMString,SBH,stmt,conn); + + }else { + newID = SBH + LSMString; + if (rs_get != null) { + rs_get.close(); + } +// query = "insert into JK_WATER_TABLE set JK_LSM='" + LSMString + "' , JK_BASE='"+newID+"' WHERE JK_SBH='"+SBH+"'" ; + query = "insert into JK_WATER_TABLE (JK_SBH,JK_LSM,JK_BASE) values('" + SBH + "', '"+LSMString+"' ,'"+newID+"')"; + System.out.println(query); + try { + rs_get = stmt.executeQuery(query); + } catch (Exception e) { + if (rs_get != null) { + rs_get.close(); + } + if (stmt != null) { + stmt.close(); + } + if (conn != null) { + } + e.printStackTrace(); + } + } + return newID; + +} + + public String createLSM3(String jzsbh) { + String newID = ""; + String JdbcDriverClass = "oracle.jdbc.driver.OracleDriver"; +// String strUrl = "jdbc:oracle:thin:@10.201.5.202:1521:jktc";// + String strUrl = "jdbc:oracle:thin:@10.200.2.43:1521:jktc";//ʽ + String strUserName = "infodba"; + String strPassword = "infodba"; + try { + try { + Class.forName(JdbcDriverClass); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } + Connection conn = DriverManager.getConnection(strUrl, strUserName, strPassword); + + String query = "select * from JK_WATER_TABLE where JK_BASE='" + jzsbh + "'"; + Statement stmt = conn.createStatement(); + + ResultSet rs_get = stmt.executeQuery(query); + int rowCount = 0; + if (rs_get.next()) { + rowCount++; + String BASE = rs_get.getString("JK_BASE");// ȡ + if (jzsbh.equals(BASE)) { +// int LSM =Integer.valueOf(rs_get.getString("JK_LSM")) ;// ȡˮ + String YSMString = rs_get.getString("JK_YSM"); + if(YSMString==null||YSMString.equals("")) { + YSMString="0"; + }else { + + YSMString=Integer.valueOf(YSMString)+1+""; + } + + int length = YSMString.length(); + if(length<2) { + YSMString = "0" + YSMString; + } + // ѯǰ+ˮ빹ɵidǷ + newID = jzsbh +"."+ YSMString; + //ˮд + if (rs_get != null) { + rs_get.close(); + } + query = "update JK_WATER_TABLE set JK_YSM='" + YSMString +"' where JK_BASE='"+jzsbh+"'"; + System.out.println(query); + try { + rs_get = stmt.executeQuery(query); + } catch (Exception e) { + if (rs_get != null) { + rs_get.close(); + } + if (stmt != null) { + stmt.close(); + } + if (conn != null) { + } + e.printStackTrace(); + } + } + + } else { + + } + System.out.println(rowCount); + if (rs_get != null) { + rs_get.close(); + } + if (stmt != null) { + stmt.close(); + } + if (conn != null) { + conn.close(); + } + } catch (SQLException e) { + e.printStackTrace(); + } + + // дмеˮ + return newID; + + } + + + @Override + public void executeOperation() throws Exception { + // TODO Auto-generated method stub + if (targetComp instanceof TCComponentForm) { + form = (TCComponentForm) targetComp; + } else { + MessageBox.post("ѡбִв", "", 0); + return; + } + GetLsmUtil ge = new GetLsmUtil(); + String xh = "";// ͺ + String sbh = "";// ʶ + if ("JK8WaterPModAppForm".equals(type)) {// "²Ʒͺšʶ"; + //TODO Ʒͺ + String cplx = form.getTCProperty("jk8ProductTypePMN").getStringValue();// Ʒͺ֮Ʒ + String gjgg = form.getTCProperty("jk8PipeDSpec").getStringValue();// ܾ + String txfs = form.getTCProperty("jk8CommunicateMode").getStringValue();// ͨŷʽ + if(!cplx.equals("")) { + String jg = form.getTCProperty("jk8Structure").getStringValue();// ṹ + xh = "LX" + setVal(cplx, "Ʒ") + setVal(jg, "ṹ")+"-"+gjgg +setVal(txfs, "ͨŷʽ"); + }else { + xh = "LX" + setVal(cplx, "Ʒ") +"-"+gjgg +setVal(txfs, "ͨŷʽ"); + + } + //TODO ˮʶű +// String sbh_cplx=form.getTCProperty("jk8ProductTypePIN").getStringValue();// ʶ֮Ʒ + String sbh_jbcj=form.getTCProperty("jk8BMManufactor").getStringValue();// + String sbh_jbcz=form.getTCProperty("jk8BMMaterial").getStringValue();// + String sbh_kzq=form.getTCProperty("jk8ContrlCompType").getStringValue();// + + //TODO ȡˮ + String sbhNew=createLSM2("W"+setVal(cplx, "Ʒ") + +setVal(sbh_jbcj, "") + +setVal(sbh_jbcz, "") + +setVal(sbh_kzq, "") ); + //TODO жʶڵǼDZǷ + boolean is=isha(sbhNew); + if(is){ + MessageBox.post("òƷʶ²ƷͺŵǼDZѴڣȷдȷ", + "", MessageBox.ERROR); + return; + } + + if (!xh.equals("") && !sbhNew.equals("")) { + form.getTCProperty("jk8ProductModNO").setStringValue(xh);// Ʒͺ + form.getTCProperty("jk8ProductIdentifyNO").setStringValue(sbhNew);// ʶ + MessageBox.post("ͺʶ,鿴", "ʾ", MessageBox.INFORMATION); + } else { + MessageBox.post("ͺʶʧ,", "", MessageBox.ERROR); + } + + + } else if ("JK8NWPIdenNOAppForm".equals(type)) {// "ˮƷʶ"; + //TODO ˮʶű + String cplx=form.getTCProperty("jk8ProductTypePMN").getStringValue();// Ʒ + String sbh_jbcj=form.getTCProperty("jk8BMManufactor").getStringValue();// + String sbh_jbcz=form.getTCProperty("jk8BMMaterial").getStringValue();// + String sbh_kzq=form.getTCProperty("jk8ContrlCompType").getStringValue();// + + //TODO ȡˮ + String sbhNew=createLSM2("W"+setVal(cplx, "Ʒ") + +setVal(sbh_jbcj, "") + +setVal(sbh_jbcz, "") + +setVal(sbh_kzq, "") ); + //TODO жʶڵǼDZǷ + boolean is=isha(sbhNew); + if(is){ + MessageBox.post("òƷʶ²ƷͺŵǼDZѴڣȷдȷ","", MessageBox.ERROR); + return; + } + + if ( !sbhNew.equals("")) { +// form.getTCProperty("jk8ProductModNO").setStringValue(xh);// Ʒͺ + form.getTCProperty("jk8ProductIdentifyNO").setStringValue(sbhNew);// ʶ + MessageBox.post("ͺʶ,鿴", "ʾ", MessageBox.INFORMATION); + } else { + MessageBox.post("ͺʶʧ,", "", MessageBox.ERROR); + } + + } else if ("JK8DWPIdenNOAppForm".equals(type)) {// ƷˮƷʶ + String jzsbh = form.getTCProperty("jk8BaseIdentifyNO").getStringValue();// ʶ֮Ʒ + + String sbhNew = createLSM3(jzsbh); + // TODO ȡˮ + // TODO жʶڵǼDZǷ + boolean is = isha(sbhNew); + if (is) { + MessageBox.post("òƷʶ²ƷͺŵǼDZѴڣȷдȷ", "", MessageBox.ERROR); + return; + } + + if (!sbhNew.equals("")) { + // form.getTCProperty("jk8ProductModNO").setStringValue(xh);// Ʒͺ + form.getTCProperty("jk8ProductIdentifyNO").setStringValue(sbhNew);// ʶ + MessageBox.post("ͺʶ,鿴", "ʾ", MessageBox.INFORMATION); + } else { + MessageBox.post("ͺʶʧ,", "", MessageBox.ERROR); + } + + } else if ("JK8WSpecPINOAppForm".equals(type)) {// "ҪƷʶ"; + String jzsbh = form.getTCProperty("jk8BaseIdentifyNO").getStringValue();// ʶ֮Ʒ + String tsyq=form.getTCProperty("jk8Specialrequirements").getStringValue();//ϵͳjk8SpecialRequirements + String sbhNew = jzsbh +setVal(tsyq, "Ҫ"); + boolean is = isha(sbhNew); + if (is) { + MessageBox.post("òƷʶ²ƷͺŵǼDZѴڣȷдȷ", "", MessageBox.ERROR); + return; + } + + if (!sbhNew.equals("")) { + // form.getTCProperty("jk8ProductModNO").setStringValue(xh);// Ʒͺ + form.getTCProperty("jk8ProductIdentifyNO").setStringValue(sbhNew);// ʶ + MessageBox.post("ͺʶ,鿴", "ʾ", MessageBox.INFORMATION); + } else { + MessageBox.post("ͺʶʧ,", "", MessageBox.ERROR); + } + } else { + MessageBox.post("ѡƷͺʶִв", "", MessageBox.ERROR); + } + + } + + private boolean isha(String sbh) { + if (!sbh.equals("")) { + if (sbhall != null) + for (String s : sbhall) { + if (sbh.equals(s)) { + System.out.println("ͬʶ"); + return true; + } + } + } + return false; + } + + private String setVal(String key, String Allkey) { + String[] all = realNameMap.get(Allkey).split(","); + HashMap Map_all = new HashMap<>(); + for (int i = 0; i < all.length; i++) { + System.out.println("ss=" + all[i]); + Map_all.put(all[i].split("=")[0], all[i].split("=")[1]); + } + if (Map_all.containsKey(key)) { + System.out.println(Allkey + "=" + Map_all.get(key)); + return Map_all.get(key).trim(); + } else { + System.out.println(Allkey + "="); + return ""; + } + + } + + +} diff --git a/src/com/connor/jk/plm/waterMeter/JK8DWPIdenNOAppForm_Handler.java b/src/com/connor/jk/plm/waterMeter/JK8DWPIdenNOAppForm_Handler.java new file mode 100644 index 0000000..96571d8 --- /dev/null +++ b/src/com/connor/jk/plm/waterMeter/JK8DWPIdenNOAppForm_Handler.java @@ -0,0 +1,23 @@ +package com.connor.jk.plm.waterMeter; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.connor.jk.plm.sqb.JK8_SBH_Action; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCSession; + +public class JK8DWPIdenNOAppForm_Handler extends AbstractHandler { + + private String type="JK8DWPIdenNOAppForm"; + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + JK8_water_Action action=new JK8_water_Action(app, type); + new Thread(action).start(); + return null; + } + +} diff --git a/src/com/connor/jk/plm/waterMeter/JK8NWPIdenNOAppForm_Handler.java b/src/com/connor/jk/plm/waterMeter/JK8NWPIdenNOAppForm_Handler.java new file mode 100644 index 0000000..39c6c61 --- /dev/null +++ b/src/com/connor/jk/plm/waterMeter/JK8NWPIdenNOAppForm_Handler.java @@ -0,0 +1,23 @@ +package com.connor.jk.plm.waterMeter; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.connor.jk.plm.sqb.JK8_SBH_Action; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCSession; + +public class JK8NWPIdenNOAppForm_Handler extends AbstractHandler { + + private String type="JK8NWPIdenNOAppForm"; + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + JK8_water_Action action=new JK8_water_Action(app, type); + new Thread(action).start(); + return null; + } + +} diff --git a/src/com/connor/jk/plm/waterMeter/JK8WSpecPINOAppForm_Handler.java b/src/com/connor/jk/plm/waterMeter/JK8WSpecPINOAppForm_Handler.java new file mode 100644 index 0000000..5abe8d5 --- /dev/null +++ b/src/com/connor/jk/plm/waterMeter/JK8WSpecPINOAppForm_Handler.java @@ -0,0 +1,23 @@ +package com.connor.jk.plm.waterMeter; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.connor.jk.plm.sqb.JK8_SBH_Action; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCSession; + +public class JK8WSpecPINOAppForm_Handler extends AbstractHandler { + + private String type="JK8WSpecPINOAppForm"; + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + JK8_water_Action action=new JK8_water_Action(app, type); + new Thread(action).start(); + return null; + } + +} diff --git a/src/com/connor/jk/plm/waterMeter/JK8WaterPModAppForm_Handler.java b/src/com/connor/jk/plm/waterMeter/JK8WaterPModAppForm_Handler.java new file mode 100644 index 0000000..8fc20d6 --- /dev/null +++ b/src/com/connor/jk/plm/waterMeter/JK8WaterPModAppForm_Handler.java @@ -0,0 +1,23 @@ +package com.connor.jk.plm.waterMeter; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +import com.connor.jk.plm.sqb.JK8_SBH_Action; +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCSession; + +public class JK8WaterPModAppForm_Handler extends AbstractHandler { + + private String type="JK8WaterPModAppForm"; + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + JK8_water_Action action=new JK8_water_Action(app, type); + new Thread(action).start(); + return null; + } + +} diff --git a/src/com/connor/jk/plm/waterMeter/JK8_water_Action.java b/src/com/connor/jk/plm/waterMeter/JK8_water_Action.java new file mode 100644 index 0000000..365f97e --- /dev/null +++ b/src/com/connor/jk/plm/waterMeter/JK8_water_Action.java @@ -0,0 +1,29 @@ +package com.connor.jk.plm.waterMeter; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.common.actions.AbstractAIFAction; +import com.teamcenter.rac.util.Registry; + +public class JK8_water_Action extends AbstractAIFAction{ + private AbstractAIFApplication app; + private String type; + public JK8_water_Action( AbstractAIFApplication arg0,String arg2) { + super(arg0, arg2); + this.type=arg2; + this.app=arg0; + + } + + @Override + public void run() { + + try { + JK8_water_Command command=new JK8_water_Command(type,app); + command.executeModal(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + +} diff --git a/src/com/connor/jk/plm/waterMeter/JK8_water_Command.java b/src/com/connor/jk/plm/waterMeter/JK8_water_Command.java new file mode 100644 index 0000000..1517430 --- /dev/null +++ b/src/com/connor/jk/plm/waterMeter/JK8_water_Command.java @@ -0,0 +1,45 @@ +package com.connor.jk.plm.waterMeter; + +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.AbstractAIFCommand; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCSession; + +public class JK8_water_Command extends AbstractAIFCommand { + private AbstractAIFApplication app; + private InterfaceAIFComponent targetComp; + private TCSession session; + private String type; + + public JK8_water_Command(String type, AbstractAIFApplication app) { + this.app = app; + this.type=type; + this.targetComp = app.getTargetComponent(); + this.session = (TCSession) app.getSession(); + } + + @Override + public void executeModal() throws Exception { + super.executeModal(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss"); + String time=formatter.format(new Date()); +// Calendar calendar = Calendar.getInstance(); +// String year = String.valueOf(calendar.get(Calendar.YEAR));// ȡ +// String month = String.valueOf(calendar.get(Calendar.MONTH) + 1);// ȡ· +// String day = String.valueOf(calendar.get(Calendar.DATE));// ȡ +// String time = String.valueOf(calendar.get(Calendar.HOUR_OF_DAY)) +// + String.valueOf(calendar.get(Calendar.MINUTE)) +// + String.valueOf(calendar.get(Calendar.SECOND));// ȡ + //String name ="Ʒͺʶ"+ time; + System.out.println("------------------------------------"+time); + JK8_water_Operation operation = new JK8_water_Operation(type,time, session, + targetComp); + session.queueOperation(operation); + + } + +} diff --git a/src/com/connor/jk/plm/waterMeter/JK8_water_Operation.java b/src/com/connor/jk/plm/waterMeter/JK8_water_Operation.java new file mode 100644 index 0000000..8d174eb --- /dev/null +++ b/src/com/connor/jk/plm/waterMeter/JK8_water_Operation.java @@ -0,0 +1,63 @@ +package com.connor.jk.plm.waterMeter; + +import com.teamcenter.rac.aif.AbstractAIFOperation; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.TCComponentFolder; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCComponentFormType; +import com.teamcenter.rac.kernel.TCComponentUser; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class JK8_water_Operation extends AbstractAIFOperation{ + private String time; + private String type; + private TCSession session; + private InterfaceAIFComponent targetComp; + public JK8_water_Operation(String type,String time, TCSession session, + InterfaceAIFComponent targetComp) { + this.type=type; + this.time=time; + this.session=session; + this.targetComp = targetComp; + } + + @Override + public void executeOperation() throws Exception { + TCComponentFormType formType=(TCComponentFormType) session.getTypeComponent("Form"); + if(formType==null){ + System.out.println("formTypeΪ"); + } + String leiXin=""; + String name=""; + if("JK8WaterPModAppForm".equals(type)){ + leiXin="ˮƷͺšʶɹ"; + name="ˮƷͺšʶ"; + }else if("JK8NWPIdenNOAppForm".equals(type)){ + leiXin="ˮƷʶɹ"; + name="ˮƷʶ"; + }else if("JK8DWPIdenNOAppForm".equals(type)){ + leiXin="ˮƷʶɹ"; + name="ˮƷʶ"; + }else if("JK8WSpecPINOAppForm".equals(type)){ + leiXin="ҪƷʶɹ"; + name="ҪƷʶ"; + } + + + + name=name+time; + TCComponentForm form=formType.create(name, "", type); + + if(targetComp instanceof TCComponentFolder){ + ((TCComponentFolder) targetComp).add("contents", form); + MessageBox.post(leiXin,"ɹ",MessageBox.INFORMATION); + }else{ + TCComponentUser user=this.session.getUser(); + TCComponentFolder newStuff=user.getNewStuffFolder(); + newStuff.add("contents", form); + MessageBox.post(leiXin+"\nNewStuffļ","ɹ",MessageBox.INFORMATION); + } + } + +} diff --git a/src/com/connor/jk/plm/xmkb/ExportXMKB_Dialog.java b/src/com/connor/jk/plm/xmkb/ExportXMKB_Dialog.java new file mode 100644 index 0000000..3ffdbc1 --- /dev/null +++ b/src/com/connor/jk/plm/xmkb/ExportXMKB_Dialog.java @@ -0,0 +1,165 @@ +package com.connor.jk.plm.xmkb; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.File; + +import javax.swing.BorderFactory; +import javax.swing.JButton; +import javax.swing.JFileChooser; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; +import javax.swing.border.TitledBorder; +import javax.swing.filechooser.FileSystemView; + +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.kernel.TCComponentDataset; +import com.teamcenter.rac.kernel.TCComponentTcFile; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; +import com.teamcenter.rac.util.combobox.iComboBox; + +public class ExportXMKB_Dialog extends AbstractAIFDialog { + + private JTextField textField; + private JButton okButton; + private JButton celButton; + private JButton pathButton; + // ļѡ + private JFileChooser jFileChooser; + + private TCSession session; + + public ExportXMKB_Dialog(TCSession session) { + // TODO Auto-generated constructor stub + this.session=session; + //ExportHZB_Operation ex=new ExportHZB_Operation(maptab); + //session.queueOperation(ex); + } + + public void run() { + initUI(); + + } + private void initUI() { + // TODO Auto-generated method stub + FileSystemView fsv = FileSystemView.getFileSystemView(); // õϵͳfileview + String deskPath = fsv.getHomeDirectory().getPath(); // ǰû· + + this.setSize(new Dimension(600, 400)); + this.setTitle(""); + this.textField = new JTextField(deskPath); + + jFileChooser = new JFileChooser(); + this.jFileChooser.setCurrentDirectory(new File(deskPath));// ļѡijʼĿ¼Ϊǰû + this.jFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + + this.pathButton = new JButton("..."); + this.okButton = new JButton("ȷ"); + this.celButton = new JButton("ȡ"); + String name=""; + try { + name=session.getUser().getProperty("user_name"); + } catch (TCException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + + JPanel midJPanel = new JPanel(new PropertyLayout()); + midJPanel.setBorder(new TitledBorder(BorderFactory + .createLineBorder(Color.WHITE), "ѡ񵼳·")); // ߿ TitleBorder + midJPanel.add("1.1.left.top", new JLabel("Ȩ:")); + midJPanel.add("1.2.left.top", new JLabel(name)); + midJPanel.add("2.1.left.top", new JLabel("·")); + midJPanel.add("2.2.left.top", this.textField); + midJPanel.add("2.3.left.top", this.pathButton); + JPanel rootJPanel = new JPanel(new FlowLayout()); + rootJPanel.add(this.okButton); + rootJPanel.add(this.celButton); + + pathButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent arg0) { + // TODO Auto-generated method stub + selectFileButtonEvent(); + } + }); + okButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + if (textField.getText().contains(".")) { + MessageBox.post("ѡļУ", "", MessageBox.WARNING); + } else { + okEvent(); + } + } + }); + celButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + celEvent(); + + } + }); + + this.setLayout(new BorderLayout()); + this.add(midJPanel, BorderLayout.CENTER); + this.add(rootJPanel, BorderLayout.SOUTH); + + this.centerToScreen(); + this.pack(); + this.setVisible(true); + this.showDialog(); + } + + public void celEvent() { + // TODO Auto-generated method stub + this.disposeDialog(); + this.dispose(); + } + + public void selectFileButtonEvent() { + int state = jFileChooser.showOpenDialog(null);// ˾ǴļѡĴ + if (state == 1) { + return; + } else { + File f = jFileChooser.getSelectedFile();// fΪѡ񵽵Ŀ¼ + textField.setText(f.getAbsolutePath()); + } + } + + public void okEvent() { + + this.disposeDialog(); + this.dispose(); + + try { + String path=textField.getText(); + System.out.println("ok"); + + ExportXMKB_Operation op=new ExportXMKB_Operation(session,path); + session.queueOperation(op); + + + + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + +} diff --git a/src/com/connor/jk/plm/xmkb/ExportXMKB_Handler.java b/src/com/connor/jk/plm/xmkb/ExportXMKB_Handler.java new file mode 100644 index 0000000..8d2ace2 --- /dev/null +++ b/src/com/connor/jk/plm/xmkb/ExportXMKB_Handler.java @@ -0,0 +1,26 @@ +package com.connor.jk.plm.xmkb; + +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.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCSession; + +public class ExportXMKB_Handler extends AbstractHandler { + + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + // TODO Auto-generated method stub + AbstractAIFApplication app=AIFUtility.getCurrentApplication(); + TCSession session = (TCSession) app.getSession(); + + ExportXMKB_Dialog action=new ExportXMKB_Dialog(session); + new Thread(action).start(); + + + return null; + } + +} diff --git a/src/com/connor/jk/plm/xmkb/ExportXMKB_Operation.java b/src/com/connor/jk/plm/xmkb/ExportXMKB_Operation.java new file mode 100644 index 0000000..8411ae3 --- /dev/null +++ b/src/com/connor/jk/plm/xmkb/ExportXMKB_Operation.java @@ -0,0 +1,203 @@ +package com.connor.jk.plm.xmkb; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +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 com.connor.jk.plm.bom.until.ProgressBarThread; +import com.teamcenter.rac.aif.AbstractAIFOperation; +import com.teamcenter.rac.kernel.TCComponentDataset; +import com.teamcenter.rac.kernel.TCComponentTcFile; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.util.MessageBox; + +public class ExportXMKB_Operation extends AbstractAIFOperation { + + private TCSession session; + private String path; + private File file; + private String name; + + private XSSFSheet sheet; + private XSSFWorkbook workBook; + private FileInputStream fis; + private FileOutputStream fos; + private String excelPath; + private ProgressBarThread wait; + private boolean is=false; + + public ExportXMKB_Operation( TCSession session, + String path) { + // TODO Auto-generated constructor stub + this.session = session; + this.path = path; + + } + + + @Override + public void executeOperation() throws Exception { + // TODO Auto-generated method stub + name=session.getUser().getProperty("user_name"); + System.out.println("name="+name); + TCPreferenceService pref = session.getPreferenceService(); + String[] names = pref.getStringValues("JK_XMKB_Power");// ѡȨû + if (names != null) { + for(int i=0;i1){ + for(int i=rowNum;i>0;i--){ + + XSSFRow row=sheet.getRow(i); + if(row!=null){ + System.out.println(""+i+""); + String xmjl=row.getCell(19)!=null?row.getCell(19).getStringCellValue():""; + System.out.println("xmjl="+xmjl); + String cpjl=row.getCell(20)!=null?row.getCell(20).getStringCellValue():""; + System.out.println("cpjl="+cpjl); + String cpzj=row.getCell(21)!=null?row.getCell(21).getStringCellValue():""; + System.out.println("cpzj="+cpzj); + if(!(name.equals(xmjl.trim())||name.equals(cpjl.trim())||name.equals(cpzj.trim()))){ + System.out.println("ɾ"+i+""); + sheet.removeRow(row); + if(i<=sheet.getLastRowNum()){ + sheet.shiftRows(i+1, sheet.getLastRowNum()+1,-1,true,false); + } + } + } + + } + } + } + + SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");// ڸʽ + String time = df.format(new Date()); + excelPath = path + File.separator + "Ŀ" + + time + ".xlsm"; + File fileout = new File(excelPath); + fos = new FileOutputStream(fileout); + workBook.write(fos); + // Runtime.getRuntime().exec(excelPath); + + + + } + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + wait.setBool(true);// رս + wait.interrupt(); + MessageBox.post("ɿʧ,"+e.getMessage(),"",MessageBox.ERROR); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + wait.setBool(true);// رս + wait.interrupt(); + MessageBox.post("ɿʧ"+e.getMessage(),"",MessageBox.ERROR); + } + + } + + public void writeSheet(XSSFSheet sheet, List> list) { + // TODO Auto-generated method stub + for (int i = 0; i < list.size(); i++) { + XSSFRow rowm = sheet.createRow(i + 1); + XSSFCellStyle sty =workBook.createCellStyle(); //sheet.getRow(0).getCell(0).getCellStyle(); + for (int j = 0; j < list.get(i).size(); j++) { + XSSFCell c = rowm.createCell(j); + c.setCellStyle(sty); + c.setCellValue(list.get(i).get(j)); + + + } + + } + + } + +} diff --git a/src/com/teamcenter/rac/commands/cut/CutOperation.java b/src/com/teamcenter/rac/commands/cut/CutOperation.java new file mode 100644 index 0000000..bfe2779 --- /dev/null +++ b/src/com/teamcenter/rac/commands/cut/CutOperation.java @@ -0,0 +1,454 @@ +/*jadclipse*/// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov. + +package com.teamcenter.rac.commands.cut; + +import com.teamcenter.rac.aif.AbstractAIFOperation; +import com.teamcenter.rac.aif.kernel.*; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.common.IMultiTarget; +import com.teamcenter.rac.kernel.*; +import com.teamcenter.rac.util.Registry; +import com.teamcenter.rac.util.log.Debug; +import java.util.*; +import org.apache.log4j.Logger; + +public class CutOperation extends AbstractAIFOperation implements IMultiTarget { + // ·ķ + public static TCPreferenceService service; + public static TCSession session; + public static TCUserService userservice;; + + static { + if (session == null) { + session = (TCSession) (AIFUtility.getCurrentApplication().getSession()); + } + if (service == null) + service = session.getPreferenceService(); + } + + public static void setByPass(boolean val) throws TCException { + if (userservice == null) { + userservice = session.getUserService(); + } + Object[] obj = new Object[1]; + obj[0] = "origin"; + if (val) { + userservice.call("ORIGIN_set_bypass", obj); + } else { + userservice.call("ORIGIN_close_bypass", obj); + } + } + + public CutOperation(TCComponent tccomponent, TCComponent tccomponent1, String s) { + m_pendingCut = false; + m_parentCmp = tccomponent; + m_childCmps = (new TCComponent[] { tccomponent1 }); + m_contextString = s; + } + + public CutOperation(AIFComponentContext aifcomponentcontext, boolean flag) { + m_pendingCut = false; + m_parentCmp = (TCComponent) aifcomponentcontext.getParentComponent(); + m_childCmps = (new TCComponent[] { (TCComponent) aifcomponentcontext.getComponent() }); + m_contextString = (String) aifcomponentcontext.getContext(); + m_pendingCut = flag; + } + + public CutOperation(TCComponent tccomponent, AIFComponentContext aaifcomponentcontext[], boolean flag) { + m_pendingCut = false; + m_parentCmp = tccomponent; + if (aaifcomponentcontext != null) { + ArrayList arraylist = new ArrayList(); + for (int i = 0; i < aaifcomponentcontext.length; i++) + arraylist.add((TCComponent) aaifcomponentcontext[i].getComponent()); + + m_childCmps = (TCComponent[]) arraylist.toArray(new TCComponent[arraylist.size()]); + m_contextString = (String) aaifcomponentcontext[0].getContext(); + } + m_pendingCut = flag; + } + + private void getMsg() { + // TODO Auto-generated method stub + + try { + if (m_parentCmp.toString().equals("ṩ")) { + System.out.println("is ṩ"); + for (InterfaceAIFComponent c : m_childCmps) { + TCComponent cm = (TCComponent) c; + if (cm.isTypeOf(new String[] { "JK8AssiblyDrawRevision", "JK8PartDrawRevision", + "JK8PartDraw_CADRevision" })) { + System.out.println("is DrawRevision"); + cm.refresh(); + TCComponent[] tcs = cm.getReferenceListProperty("representation_for"); + String str = ""; + if (tcs != null && tcs.length >= 0) { + for (TCComponent tc : tcs) { + str = str + tc.getTCProperty("item_id").getStringValue() + ","; + } + if (str.endsWith(",")) { + str = str.substring(0, str.length() - 1); + } + } + + cm.getTCProperty("jk8U8NO").setStringValue(str); + cm.refresh(); + System.out.println(str); + } + } + } + + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public void executeOperation() throws TCException { + if (m_parentCmp == null) + return; + System.out.println("cut"); +// System.out.println(m_parentCmp.toString()); +// System.out.println(m_parentCmp.getType()); +// TCComponent component=m_parentCmp.getTCProperty("owning_object").getReferenceValue(); + TCSession tcsession = m_parentCmp.getSession(); + Registry registry = Registry.getRegistry(this); + boolean flag = false; + StringBuilder stringbuilder = new StringBuilder(); + if (m_childCmps != null) { + for (int i = 0; i < m_childCmps.length; i++) { + System.out.println("m_childCmps" + i + "=" + m_childCmps[i]); + stringbuilder.append( + (new StringBuilder(String.valueOf(i != 0 ? ", " : ""))).append(m_childCmps[i]).toString()); + if (!flag && (m_childCmps[i] instanceof TCComponentWorkContext)) + flag = true; + } + + } + tcsession.setStatus((new StringBuilder(String.valueOf(registry.getString("cutting")))).append(" ") + .append(stringbuilder.toString()).append(" ").append(registry.getString("from")).append(" ") + .append(m_parentCmp.toString()).toString()); + if (!m_pendingCut && m_childCmps != null) { + // ↑bypass + boolean isDraw = false; +// if(true) { +// return; +// } +// AbstractAIFApplication app = AIFUtility.getCurrentApplication(); +// TCSession session = (TCSession) app.getSession(); + String group = session.getCurrentGroup().toString(); + if (group.equals("ṹ.оԺ")) { + for (InterfaceAIFComponent c : m_childCmps) { + TCComponent cm = (TCComponent) c; + if (cm.isTypeOf(new String[] { "JK8AssiblyDrawRevision", "JK8PartDrawRevision", + "JK8PartDraw_CADRevision" })) { + isDraw = true; + + } + String userid=cm.getProperty("owning_user").split(" ")[1]; + System.out.println(userid); + userid=userid.substring(1, userid.length()-1); + System.out.println(userid); + + //2017.8.31ֻҪǽṹĶ + +// //DZ˵ͼֽͲ +// if(!userid.equals(session.getUser().getUserId())) { +// isDraw = false; +// } + //ӲͲ + if(m_parentCmp.toString().equals("ṩ")&&m_parentCmp instanceof TCComponentPseudoFolder) { + TCComponent component=((TCComponent) m_parentCmp).getTCProperty("owning_object").getReferenceValue(); + String hardWareGroupUserId=component.getProperty("owning_user").split(" ")[1]; + hardWareGroupUserId=hardWareGroupUserId.substring(1, hardWareGroupUserId.length()-1); + TCComponentUser user=null; + try { + user=(TCComponentUser) session.search(" - ԱϢ", new String[] {"û ID"}, new String[] {hardWareGroupUserId})[0]; + System.out.println(user.getLoginGroup().getGroupName()); + + System.out.println(user.getUserId()); + System.out.println(session.getUser().getUserId()); + System.out.println(user.getLoginGroup().getGroupName()); + if(!user.getLoginGroup().getGroupName().equals("Ӳ")&&!user.getLoginGroup().getGroupName().equals("ṹ")) { + System.out.println("bingo"); + isDraw = false; + } +// if(!user.getLoginGroup().getGroupName().equals("Ӳ")) { +// System.out.println("bingo"); +// isDraw = false; +// } + } catch (Exception e1) { + e1.printStackTrace(); + } + } +// String hardWareGroupUserId=m_parentCmp.getProperty("owning_user").split(" ")[1]; +// hardWareGroupUserId=hardWareGroupUserId.substring(1,5); +// TCComponentUser user=null; +// try { +// user=(TCComponentUser) session.search(" - ԱϢ", new String[] {"û ID"}, new String[] {hardWareGroupUserId})[0]; +//// System.out.println(user.getLoginGroup().getGroupName()); +//// +//// System.out.println(user.getUserId()); +//// System.out.println(session.getUser().getUserId()); +// } catch (Exception e1) { +// e1.printStackTrace(); +// } +// if(!user.getLoginGroup().getGroupName().equals("Ӳ")) { +// isDraw = false; +// } + } + } + if(isDraw == true) { + System.out.println("---------------------------------·"); + setByPass(true); + try { + TCComponent tccomponent = null; + Object obj = null; + if (m_parentCmp instanceof TCComponentPseudoFolder) + tccomponent = ((TCComponentPseudoFolder) m_parentCmp).getOwningComponent(); + if ((m_parentCmp instanceof TCComponentPseudoFolder) + && (tccomponent instanceof TCComponentCba0PartProxy)) { + ((TCComponentCba0PartProxy) tccomponent).cutOperation(m_contextString, m_childCmps); + Object obj1 = null; + for (int k = 0; k < m_childCmps.length; k++) { + TCComponent tccomponent1 = m_childCmps[k]; + AIFComponentContext aaifcomponentcontext[] = tccomponent1.getChildren(); + Object obj3 = null; + AIFComponentContext aaifcomponentcontext2[]; + int k1 = (aaifcomponentcontext2 = aaifcomponentcontext).length; + for (int i1 = 0; i1 < k1; i1++) { + AIFComponentContext aifcomponentcontext = aaifcomponentcontext2[i1]; + InterfaceAIFComponent interfaceaifcomponent = aifcomponentcontext.getComponent(); + if (interfaceaifcomponent instanceof TCComponentPseudoFolder) + ((TCComponent) interfaceaifcomponent).refresh(); + } + + } + + m_parentCmp.refresh(); + m_parentCmp.fireComponentChangeEvent(); + } else if ((m_parentCmp instanceof TCComponentPseudoFolder) + && (tccomponent instanceof TCComponentDrawingProxy)) { + ((TCComponentDrawingProxy) tccomponent).cutOperation(m_contextString, m_childCmps); + Object obj2 = null; + for (int l = 0; l < m_childCmps.length; l++) { + TCComponent tccomponent2 = m_childCmps[l]; + AIFComponentContext aaifcomponentcontext1[] = tccomponent2.getChildren(); + Object obj4 = null; + AIFComponentContext aaifcomponentcontext3[]; + int l1 = (aaifcomponentcontext3 = aaifcomponentcontext1).length; + for (int j1 = 0; j1 < l1; j1++) { + AIFComponentContext aifcomponentcontext1 = aaifcomponentcontext3[j1]; + InterfaceAIFComponent interfaceaifcomponent1 = aifcomponentcontext1.getComponent(); + if (interfaceaifcomponent1 instanceof TCComponentPseudoFolder) + ((TCComponent) interfaceaifcomponent1).refresh(); + } + + } + + m_parentCmp.refresh(); + m_parentCmp.fireComponentChangeEvent(); + } else if ((m_parentCmp instanceof TCComponentPseudoFolder) && (tccomponent instanceof TCComponentTask) + && m_parentCmp.toString().equals("Parent Processes")) + try { + TCComponentProcess tccomponentprocess = ((TCComponentTask) tccomponent).getProcess(); + for (int j = 0; j < m_childCmps.length; j++) { + TCComponentProcess tccomponentprocess1 = (TCComponentProcess) m_childCmps[j]; + TCComponent tccomponent3 = ((TCComponentPseudoFolder) m_parentCmp).getOwningComponent(); + tccomponentprocess1.removeSubProcess(tccomponentprocess, tccomponent3); + } + + m_parentCmp.refresh(); + m_parentCmp.fireComponentChangeEvent(); + } catch (Exception exception) { + setByPass(false); + Debug.println(exception.getClass().getName(), exception); + } + else if ((m_parentCmp instanceof TCComponentPseudoFolder) && (tccomponent instanceof TCComponentDataset) + || (m_parentCmp instanceof TCComponentDataset) && m_contextString.equals("ref_list")) { + removeDatasetNamedReference(); + } else { + if ((m_parentCmp instanceof TCComponentTraceLink) + && m_childCmps[0].isTypeOf("Fnd0CustomNoteRevision")) + m_contextString = "fnd0CustomNotes"; + m_parentCmp.cutOperation(m_contextString, m_childCmps); + } + tcsession.setReadyStatus(); + if (flag) + clearWorkContextProperty(tcsession); + + getMsg(); + } catch (TCException tcexception) { + setByPass(false); + tcsession.setStatus(tcexception.toString()); + throw tcexception; + } + setByPass(false); + }else { + System.out.println("---------------------------------û·"); + try { + TCComponent tccomponent = null; + Object obj = null; + if (m_parentCmp instanceof TCComponentPseudoFolder) + tccomponent = ((TCComponentPseudoFolder) m_parentCmp).getOwningComponent(); + if ((m_parentCmp instanceof TCComponentPseudoFolder) + && (tccomponent instanceof TCComponentCba0PartProxy)) { + ((TCComponentCba0PartProxy) tccomponent).cutOperation(m_contextString, m_childCmps); + Object obj1 = null; + for (int k = 0; k < m_childCmps.length; k++) { + TCComponent tccomponent1 = m_childCmps[k]; + AIFComponentContext aaifcomponentcontext[] = tccomponent1.getChildren(); + Object obj3 = null; + AIFComponentContext aaifcomponentcontext2[]; + int k1 = (aaifcomponentcontext2 = aaifcomponentcontext).length; + for (int i1 = 0; i1 < k1; i1++) { + AIFComponentContext aifcomponentcontext = aaifcomponentcontext2[i1]; + InterfaceAIFComponent interfaceaifcomponent = aifcomponentcontext.getComponent(); + if (interfaceaifcomponent instanceof TCComponentPseudoFolder) + ((TCComponent) interfaceaifcomponent).refresh(); + } + + } + + m_parentCmp.refresh(); + m_parentCmp.fireComponentChangeEvent(); + } else if ((m_parentCmp instanceof TCComponentPseudoFolder) + && (tccomponent instanceof TCComponentDrawingProxy)) { + ((TCComponentDrawingProxy) tccomponent).cutOperation(m_contextString, m_childCmps); + Object obj2 = null; + for (int l = 0; l < m_childCmps.length; l++) { + TCComponent tccomponent2 = m_childCmps[l]; + AIFComponentContext aaifcomponentcontext1[] = tccomponent2.getChildren(); + Object obj4 = null; + AIFComponentContext aaifcomponentcontext3[]; + int l1 = (aaifcomponentcontext3 = aaifcomponentcontext1).length; + for (int j1 = 0; j1 < l1; j1++) { + AIFComponentContext aifcomponentcontext1 = aaifcomponentcontext3[j1]; + InterfaceAIFComponent interfaceaifcomponent1 = aifcomponentcontext1.getComponent(); + if (interfaceaifcomponent1 instanceof TCComponentPseudoFolder) + ((TCComponent) interfaceaifcomponent1).refresh(); + } + + } + + m_parentCmp.refresh(); + m_parentCmp.fireComponentChangeEvent(); + } else if ((m_parentCmp instanceof TCComponentPseudoFolder) && (tccomponent instanceof TCComponentTask) + && m_parentCmp.toString().equals("Parent Processes")) + try { + TCComponentProcess tccomponentprocess = ((TCComponentTask) tccomponent).getProcess(); + for (int j = 0; j < m_childCmps.length; j++) { + TCComponentProcess tccomponentprocess1 = (TCComponentProcess) m_childCmps[j]; + TCComponent tccomponent3 = ((TCComponentPseudoFolder) m_parentCmp).getOwningComponent(); + tccomponentprocess1.removeSubProcess(tccomponentprocess, tccomponent3); + } + + m_parentCmp.refresh(); + m_parentCmp.fireComponentChangeEvent(); + } catch (Exception exception) { + Debug.println(exception.getClass().getName(), exception); + } + else if ((m_parentCmp instanceof TCComponentPseudoFolder) && (tccomponent instanceof TCComponentDataset) + || (m_parentCmp instanceof TCComponentDataset) && m_contextString.equals("ref_list")) { + removeDatasetNamedReference(); + } else { + if ((m_parentCmp instanceof TCComponentTraceLink) + && m_childCmps[0].isTypeOf("Fnd0CustomNoteRevision")) + m_contextString = "fnd0CustomNotes"; + m_parentCmp.cutOperation(m_contextString, m_childCmps); + } + tcsession.setReadyStatus(); + if (flag) + clearWorkContextProperty(tcsession); + + getMsg(); + } catch (TCException tcexception) { + tcsession.setStatus(tcexception.toString()); + throw tcexception; + } + } + // bypass + + } + } + + private void clearWorkContextProperty(AbstractAIFSession abstractaifsession) { + if (abstractaifsession != null && (abstractaifsession instanceof TCSession)) { + TCSession tcsession = (TCSession) abstractaifsession; + TCComponentUser tccomponentuser = tcsession.getUser(); + if (tccomponentuser != null) + tccomponentuser.clearCache("work_contexts"); + } + } + + private void removeDatasetNamedReference() { + ArrayList arraylist = new ArrayList(); + ArrayList arraylist1 = new ArrayList(); + TCComponent tccomponent = null; + if (m_parentCmp instanceof TCComponentPseudoFolder) + tccomponent = ((TCComponentPseudoFolder) m_parentCmp).getOwningComponent(); + TCComponentDataset tccomponentdataset; + if (m_parentCmp instanceof TCComponentDataset) + tccomponentdataset = (TCComponentDataset) m_parentCmp; + else + tccomponentdataset = (TCComponentDataset) tccomponent; + try { + TCProperty tcproperty = tccomponentdataset.getTCProperty("ref_list"); + TCComponent atccomponent[] = tcproperty.getReferenceValueArray(); + TCProperty tcproperty1 = tccomponentdataset.getTCProperty("ref_names"); + String as[] = tcproperty1.getStringValueArray(); + if (atccomponent != null && atccomponent.length != 0 && as != null && as.length != 0) { + for (int i = 0; i < m_childCmps.length; i++) { + for (int j = 0; j < atccomponent.length; j++) { + if (m_childCmps[i] != atccomponent[j]) + continue; + if (m_childCmps[i] instanceof TCComponentTcFile) { + arraylist.add(atccomponent[j].toString()); + arraylist1.add(as[j]); + TCComponentTcFile tccomponenttcfile = (TCComponentTcFile) atccomponent[j]; + tccomponenttcfile.setRefDatasetNamedReferences(as[j]); + } else { + tccomponentdataset.removeNamedReference(as[j]); + TCComponentForm tccomponentform = (TCComponentForm) atccomponent[j]; + tccomponentform.setRefDatasetNamedReferences(as[j]); + m_parentCmp.refresh(); + } + break; + } + + } + + } + if (arraylist.size() != 0) { + String as1[] = (String[]) arraylist.toArray(new String[arraylist.size()]); + String as2[] = (String[]) arraylist1.toArray(new String[arraylist1.size()]); + tccomponentdataset.removeFiles(as1, as2); + m_parentCmp.refresh(); + } + } catch (Exception exception) { + Logger.getLogger(CutOperation.class).error(exception.getLocalizedMessage(), exception); + } + } + + public AIFComponentContext[] getTargetContexts() { + return (new AIFComponentContext[] { new AIFComponentContext(null, m_parentCmp, "context") }); + } + + public Map getPartialFailedTargets() { + return Collections.emptyMap(); + } + + private final TCComponent m_parentCmp; + private TCComponent m_childCmps[]; + private String m_contextString; + private boolean m_pendingCut; +} + +/* + * DECOMPILATION REPORT + * + * Decompiled from: + * C:\JKTC11\Siemens\Teamcenter\OTW11\rac\plugins\com.teamcenter.rac. + * common_11000.2.0.jar Total time: 1128 ms Jad reported messages/errors: Exit + * status: 0 Caught exceptions: + */ \ No newline at end of file diff --git a/src/com/teamcenter/rac/commands/cut/cut_user.properties b/src/com/teamcenter/rac/commands/cut/cut_user.properties new file mode 100644 index 0000000..cec9003 --- /dev/null +++ b/src/com/teamcenter/rac/commands/cut/cut_user.properties @@ -0,0 +1,2 @@ +cutOperation=com.connor.jk.plm.cut.JKCutOperation +\u8BE5\u6269\u5C55\u70B9\u5E76\u6CA1\u6709 \ No newline at end of file diff --git a/src/com/teamcenter/rac/commands/paste/paste_user.properties b/src/com/teamcenter/rac/commands/paste/paste_user.properties new file mode 100644 index 0000000..e0cf5b4 --- /dev/null +++ b/src/com/teamcenter/rac/commands/paste/paste_user.properties @@ -0,0 +1,2 @@ +#import=com.teamcenter.rac.common.common,com.teamcenter.rac.kernel.kernel +pasteOperation=com.connor.jk.plm.paste.JKPasteOperation \ No newline at end of file diff --git a/src/com/teamcenter/rac/commands/revise/ReviseCommand.java b/src/com/teamcenter/rac/commands/revise/ReviseCommand.java new file mode 100644 index 0000000..ec2b9fe --- /dev/null +++ b/src/com/teamcenter/rac/commands/revise/ReviseCommand.java @@ -0,0 +1,395 @@ +/*jadclipse*/// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov. + +package com.teamcenter.rac.commands.revise; + +import com.teamcenter.rac.aif.*; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.kernel.*; +import com.teamcenter.rac.util.*; +import java.awt.Frame; +import java.beans.*; +import org.apache.log4j.Logger; + +public class ReviseCommand extends AbstractAIFCommand + implements PropertyChangeListener +{ +//if (!targetComp.getType().equals("JK8MaterialRevision")&&!targetComp.getType().equals("JK8LSMaterialRevision")&&!targetComp.getType().equals("JK8EmbSoftwareRevision") ) { + public ReviseCommand(Frame frame, AbstractAIFApplication abstractaifapplication) + { + System.out.println("޶!"); + targetArray = null; + bomLineComp = null; + actionName = "ReviseItemRev"; + parentFrame = frame; + application = abstractaifapplication; + session = (TCSession)application.getSession(); + + InterfaceAIFComponent[] coms=application.getTargetComponents(); + if(coms!=null&&coms.length>0){ + System.out.println(":"+coms[0].getType()); + if (coms[0].getType().equals("JK8MaterialRevision")||coms[0].getType().equals("JK8LSMaterialRevision")||coms[0].getType().equals("JK8EmbSoftwareRevision") + ||coms[0].getType().equals("TX2FinalProductRevision")||coms[0].getType().equals("TX2ComponentRevision")||coms[0].getType().equals("TX2SemiProductRevision") + ||coms[0].getType().equals("TX2RawMaterialRevision")) { + System.out.println("!!"); + MessageBox.post("ù޷޶,ʹ޶!","ʾ",MessageBox.INFORMATION); + return; + } + } + + try + { + targetArray = checkComponents(application.getTargetComponents()); + } + catch(Exception exception) + { + logger.error(exception.getClass().getName(), exception); + MessageBox.post(frame, exception); + } + if(targetArray == null) + return; + if(targetArray[0] == null) + { + Registry registry = Registry.getRegistry(this); + MessageBox.post(frame, registry.getString("invalidObject"), registry.getString("warning.TITLE"), 4); + return; + } + if(!isItemReviseAllowed()) + { + Registry registry1 = Registry.getRegistry(this); + MessageBox.post(frame, registry1.getString("unableToReviseReplica.MSG"), registry1.getString("unableToRevise.TITLE"), 1); + return; + } + AbstractAIFDialog abstractaifdialog = constructDialog(frame, actionName, null); + if(abstractaifdialog != null) + { + abstractaifdialog.addPropertyChangeListener(this); + propertySupport = new PropertyChangeSupport(this); + setRunnable(abstractaifdialog); + } else + { + Registry registry2 = Registry.getRegistry(this); + MessageBox.post(frame, registry2.getString("failFindDialog"), registry2.getString("error.TITLE"), 1); + } + } + + public ReviseCommand(Frame frame, InterfaceAIFComponent ainterfaceaifcomponent[]) + { + System.out.println("222"); + targetArray = null; + bomLineComp = null; + actionName = "ReviseItemRev"; + parentFrame = frame; + try + { + targetArray = checkComponents(ainterfaceaifcomponent); + } + catch(Exception exception) + { + logger.error(exception.getClass().getName(), exception); + MessageBox.post(frame, exception); + } + if(targetArray == null) + { + return; + } else + { + session = (TCSession)targetArray[0].getSession(); + return; + } + } + + public ReviseCommand(Frame frame, InterfaceAIFComponent ainterfaceaifcomponent[], Boolean boolean1) + { + + this(frame, ainterfaceaifcomponent); + System.out.println("333"); + if(!isItemReviseAllowed()) + { + Registry registry = Registry.getRegistry(this); + MessageBox.post(frame, registry.getString("unableToReviseReplica.MSG"), registry.getString("unableToRevise.TITLE"), 1); + return; + } + AbstractAIFDialog abstractaifdialog = constructDialog(frame, actionName, boolean1); + if(abstractaifdialog != null) + { + abstractaifdialog.addPropertyChangeListener(this); + propertySupport = new PropertyChangeSupport(this); + setRunnable(abstractaifdialog); + } else + { + Registry registry1 = Registry.getRegistry(this); + MessageBox.post(frame, registry1.getString("failFindDialog"), registry1.getString("error.TITLE"), 1); + } + } + + public ReviseCommand(TCSession tcsession, String s, String s1, String s2, String s3, String s4, InterfaceAIFComponent ainterfaceaifcomponent[]) + { + System.out.println("444"); + targetArray = null; + bomLineComp = null; + actionName = "ReviseItemRev"; + session = tcsession; + itemName = s; + itemId = s1; + itemRevId = s2; + itemDesc = s3; + itemType = s4; + try + { + targetArray = checkComponents(ainterfaceaifcomponent); + } + catch(Exception exception) + { + logger.error(exception.getClass().getName(), exception); + MessageBox.post(exception); + } + if(targetArray != null) + { + Registry registry = Registry.getRegistry(this); + registry.newInstanceFor("reviseOperation", new Object[] { + this + }); + } + } + + protected AbstractAIFDialog constructDialog(Frame frame, String s, Boolean boolean1) + { + AbstractAIFDialog abstractaifdialog = null; + Registry registry = Registry.getRegistry(this); + Object aobj[] = { + this + }; + if(s.equals("reviseArchitecture")) + abstractaifdialog = (AbstractAIFDialog)registry.newInstanceFor("reviseArchitectureDialog", aobj); + else + if(s.equals("ReviseItemRev") || s.equals("ReviseItem")) + abstractaifdialog = (AbstractAIFDialog)registry.newInstanceFor("reviseDialog", aobj); + else + if(s.equals("ReviseEngChange")) + abstractaifdialog = (AbstractAIFDialog)Instancer.newInstance("com.teamcenter.rac.commands.create.CreateECDialog", new Object[] { + frame, targetArray[0], Boolean.valueOf(true) + }); + else + if(s.equals("ReviseGDELine")) + abstractaifdialog = (AbstractAIFDialog)registry.newInstanceFor("reviseGDEDialog", aobj); + else + if(s.equals("ReviseCAEBCItem") || s.equals("ReviseCAELoadItem")) + abstractaifdialog = (AbstractAIFDialog)registry.newInstanceFor("reviseCAEDialog", aobj); + else + if(s.equals("ReviseCAEItem")) + abstractaifdialog = (AbstractAIFDialog)registry.newInstanceFor("reviseCAEItemDialog", aobj); + else + abstractaifdialog = (AbstractAIFDialog)registry.newInstanceFor("reviseIdDialog", aobj); + return abstractaifdialog; + } + + public InterfaceAIFComponent[] checkComponents(InterfaceAIFComponent ainterfaceaifcomponent[]) + throws Exception + { + InterfaceAIFComponent ainterfaceaifcomponent1[] = super.checkComponents(ainterfaceaifcomponent); + Registry registry = Registry.getRegistry(this); + if(ainterfaceaifcomponent1 == null) + { + MessageBox.post(parentFrame, registry.getString("noObjectsSelected"), registry.getString("reviseNoSelection.TITLE"), 4); + return null; + } + if(ainterfaceaifcomponent1.length != 1) + { + MessageBox.post(parentFrame, registry.getString("tooManyObjects"), registry.getString("error.TITLE"), 4); + return null; + } + if(!(ainterfaceaifcomponent1[0] instanceof TCComponentItem) && !(ainterfaceaifcomponent1[0] instanceof TCComponentItemRevision) && !(ainterfaceaifcomponent1[0] instanceof TCComponentBOMLine) && !(ainterfaceaifcomponent1[0] instanceof TCComponentIdentifier)) + { + MessageBox.post(parentFrame, registry.getString("unableToRevise.MSG"), registry.getString("unableToRevise.TITLE"), 4); + return null; + } + if(ainterfaceaifcomponent1[0] instanceof TCComponentItemRevision) + { + TCComponent tccomponent = (TCComponent)ainterfaceaifcomponent1[0]; + if(tccomponent.isTypeOf("EngChange") || tccomponent.isTypeOf("EngChange Revision")) + actionName = "reviseEngChange"; + else + if(tccomponent.isTypeOf("Architecture") || tccomponent.isTypeOf("ArchitectureRevision")) + actionName = "reviseArchitecture"; + } else + if(ainterfaceaifcomponent1[0] instanceof TCComponentItem) + { + actionName = "ReviseItem"; + itemType = ainterfaceaifcomponent1[0].getType(); + } else + if(ainterfaceaifcomponent1[0] instanceof TCComponentGDELine) + { + bomLineComp = (TCComponentBOMLine)ainterfaceaifcomponent1[0]; + ainterfaceaifcomponent1 = (new InterfaceAIFComponent[] { + ((TCComponentGDELine)bomLineComp).getGDE() + }); + actionName = "ReviseGDELine"; + } else + if(ainterfaceaifcomponent1[0] instanceof TCComponentBOMLine) + { + bomLineComp = (TCComponentBOMLine)ainterfaceaifcomponent1[0]; + if(bomLineComp.loadState() == com.teamcenter.rac.kernel.TCComponentBOMLine.LoadState.NO_READ_ACCESS) + { + MessageBox.post(parentFrame, registry.getString("unableToReviseUnreadable.MSG"), registry.getString("unableToRevise.TITLE"), 4); + return null; + } + if(bomLineComp.getItemRevision() == null) + { + MessageBox.post(parentFrame, registry.getString("unableToRevise.MSG"), registry.getString("unableToRevise.TITLE"), 4); + return null; + } + ainterfaceaifcomponent1 = (new InterfaceAIFComponent[] { + bomLineComp.getItemRevision() + }); + if(bomLineComp.getItem().isTypeOf("Architecture") || bomLineComp.getItemRevision().isTypeOf("ArchitectureRevision")) + actionName = "reviseArchitecture"; + else + actionName = "ReviseItemRev"; + } else + if(ainterfaceaifcomponent1[0] instanceof TCComponentCAEBCItemRevision) + { + actionName = "ReviseCAEBCItem"; + itemType = "TCComponentCAEBCItemRevision"; + } else + if(ainterfaceaifcomponent1[0] instanceof TCComponentCAELoadItemRevision) + { + actionName = "ReviseCAELoadItem"; + itemType = "TCComponentCAELoadItemRevision"; + } + if(ainterfaceaifcomponent1[0] instanceof TCComponentCAEItemRevision) + actionName = "ReviseCAEItem"; + if(ainterfaceaifcomponent1[0] instanceof TCComponentIdentifier) + return checkIdentifierComponents(ainterfaceaifcomponent1); + else + return ainterfaceaifcomponent1; + } + + public void propertyChange(PropertyChangeEvent propertychangeevent) + { + String s = propertychangeevent.getPropertyName(); + if(s.equals("Tc Stop Operation")) + propertySupport.firePropertyChange("Tc Stop Operation", null, null); + } + + public void addPropertyChangeListener(PropertyChangeListener propertychangelistener) + { + propertySupport.addPropertyChangeListener(propertychangelistener); + } + + public void removePropertyChangeListener(PropertyChangeListener propertychangelistener) + { + propertySupport.removePropertyChangeListener(propertychangelistener); + } + + private InterfaceAIFComponent[] checkIdentifierComponents(InterfaceAIFComponent ainterfaceaifcomponent[]) + throws Exception + { + Registry registry = Registry.getRegistry(this); + TCComponentIdentifier tccomponentidentifier = (TCComponentIdentifier)ainterfaceaifcomponent[0]; + TCComponent tccomponent = tccomponentidentifier.getReferenceProperty("altid_of"); + if(tccomponent instanceof TCComponentItemRevision) + { + actionName = "ReviseId"; + return ainterfaceaifcomponent; + } + if(tccomponent instanceof TCComponentItem) + { + TCComponentIdContext tccomponentidcontext = (TCComponentIdContext)tccomponentidentifier.getReferenceProperty("idcontext"); + TCComponentItemType tccomponentitemtype = (TCComponentItemType)tccomponent.getTypeComponent(); + TCComponentType tccomponenttype = session.getTypeComponent(tccomponentitemtype.getRevisionTypeName(tccomponentitemtype.getTypeName())); + TCComponentIdentifierType tccomponentidentifiertype = null; + try + { + tccomponentidentifiertype = (TCComponentIdentifierType)session.getTypeComponent((new StringBuilder(String.valueOf(tccomponentidentifier.getProperty("object_type")))).append("Rev").toString()); + } + catch(TCException _ex) + { + MessageBox.post(parentFrame, registry.getString("idReviseNoRuleError.MSG"), registry.getString("unableToRevise.TITLE"), 4); + return null; + } + TCComponentIdContextRuleType tccomponentidcontextruletype = (TCComponentIdContextRuleType)session.getTypeComponent("IdContextRule"); + if(!tccomponentidcontextruletype.isAltIDRuleValid(tccomponentidcontext, tccomponenttype, tccomponentidentifiertype)) + { + MessageBox.post(parentFrame, registry.getString("idReviseNoRuleError.MSG"), registry.getString("unableToRevise.TITLE"), 4); + return null; + } + String s = tccomponent.getProperty("revision_list"); + if(s == null || s.length() == 0) + { + MessageBox.post(parentFrame, registry.getString("itemNoRevError.MSG"), registry.getString("unableToRevise.TITLE"), 4); + return null; + } else + { + actionName = "ReviseId"; + return ainterfaceaifcomponent; + } + } else + { + MessageBox.post(parentFrame, registry.getString("unableToRevise.MSG"), registry.getString("unableToRevise.TITLE"), 4); + return null; + } + } + + private boolean isItemReviseAllowed() + { + boolean flag = false; + if(targetArray[0] instanceof TCComponentItemRevision) + try + { + TCComponentItemRevision tccomponentitemrevision = (TCComponentItemRevision)targetArray[0]; + String s = tccomponentitemrevision.getProperty("owning_site"); + if(s != null && !s.equals("")) + { + TCComponentItem tccomponentitem = tccomponentitemrevision.getItem(); + TCReservationService tcreservationservice = session.getReservationService(); + boolean flag1 = tcreservationservice.isReserved(tccomponentitem); + if(flag1) + { + TCProperty atcproperty[] = tcreservationservice.getReservationProperties(tccomponentitem, new String[] { + "site_reserved" + }); + if(atcproperty != null && atcproperty[0] != null && atcproperty[0].getLogicalValue()) + flag = false; + else + flag = true; + } + } else + { + flag = true; + } + } + catch(TCException tcexception) + { + logger.error(tcexception.getClass().getName(), tcexception); + } + else + flag = true; + return flag; + } + + private static Logger logger = Logger.getLogger(com.teamcenter.rac.commands.revise.ReviseCommand.class); + protected PropertyChangeSupport propertySupport; + public TCSession session; + private AbstractAIFApplication application; + protected Frame parentFrame; + public InterfaceAIFComponent targetArray[]; + public String itemName; + public String itemId; + public String itemRevId; + public String itemDesc; + public String itemType; + public TCComponentBOMLine bomLineComp; + public String actionName; + +} + + +/* + DECOMPILATION REPORT + + Decompiled from: C:\Siemens\Teamcenter\OTW11\rac\plugins\com.teamcenter.rac.common_11000.2.0.jar + Total time: 198 ms + Jad reported messages/errors: + Exit status: 0 + Caught exceptions: +*/ \ No newline at end of file diff --git a/src/com/teamcenter/rac/form/CalendarPanel.java b/src/com/teamcenter/rac/form/CalendarPanel.java new file mode 100644 index 0000000..b2a4d57 --- /dev/null +++ b/src/com/teamcenter/rac/form/CalendarPanel.java @@ -0,0 +1,613 @@ +package com.teamcenter.rac.form; +/** + + * Calender + + * @author BAOMH www.hotheme.com + + */ + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Toolkit; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.util.Calendar; +import java.util.Date; +import javax.swing.AbstractAction; +import javax.swing.InputMap; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JComponent; +import javax.swing.JDialog; +import javax.swing.JFrame; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JSpinner; +import javax.swing.JTable; +import javax.swing.KeyStroke; +import javax.swing.ListSelectionModel; +import javax.swing.SpinnerNumberModel; +import javax.swing.SwingConstants; +import javax.swing.UIManager; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import javax.swing.table.DefaultTableCellRenderer; +import javax.swing.table.DefaultTableModel; + +public class CalendarPanel extends JDialog { + private JComboBox comboBoxMonth; + private JSpinner spinnerYear; + private JTable2 table; + private JTableModel2 tableModel; + private Calendar calendar; + public Date selecttime; + private String[] days = { "", "һ", "ڶ", "", "", "", "" }; + private String[] months = { "һ", + "", + "", + "", + "", + "", + "", + "", + "", + "ʮ", + "ʮһ", + "ʮ" + }; + private int year = -1; + private int month = -1; + private int date = -1; + private int oldYear = -1; + private int oldMonth = -1; + private int oldDate = -1; + private boolean flag = true; + private JButton okButton; + private JButton cancelButton; + private TableWithRowHead twrh; + private boolean bo; + public Date getSelecttime() { + return selecttime; +} + +public void setSelecttime(Date selecttime) { + this.selecttime = selecttime; +} + +public CalendarPanel(JFrame frame) { + + super(frame, true); + this.setTitle("ѡ"); + calendar = Calendar.getInstance(); + initComponent(); + setSize(350, 300); + center(); + setVisible(true); + } +public CalendarPanel(TableWithRowHead twrh,boolean bo) { + this.twrh = twrh; + this.bo=bo; + this.setTitle("ѡ"); + calendar = Calendar.getInstance(); + initComponent(); + setSize(350, 300); + center(); + setAlwaysOnTop(true); + setVisible(true); +} +public CalendarPanel() { + this.setTitle("ѡ"); + calendar = Calendar.getInstance(); + initComponent(); + setSize(350, 300); + center(); + setVisible(true); +} + public CalendarPanel(Calendar calendar) { + + super(); + this.calendar = calendar; + initComponent(); + setSize(350, 300); + center(); + setVisible(true); + } + + public CalendarPanel(Date date) { + + super(); + this.calendar = Calendar.getInstance(); + this.calendar.setTime(date); + initComponent(); + setSize(350, 300); + center(); + setVisible(true); + } + + public CalendarPanel(int year, int month, int date) { + + super(); + this.calendar = Calendar.getInstance(); + calendar.set(Calendar.YEAR, year); + calendar.set(Calendar.MONTH, month - 1); + calendar.set(Calendar.DATE, date); + oldYear = calendar.get(Calendar.YEAR); + oldMonth = calendar.get(Calendar.MONTH); + oldDate = calendar.get(Calendar.DATE); + initComponent(); + setSize(350, 300); + center(); + setVisible(true); + } + + public void center() { + + Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); + Dimension frameSize = getSize(); + + if (frameSize.height > screenSize.height) { + frameSize.height = screenSize.height; + } + if (frameSize.width > screenSize.width) { + frameSize.width = screenSize.width; + } + + super.setLocation( + (screenSize.width - frameSize.width) / 2, + (screenSize.height - frameSize.height) / 2 + ); + } + + public Calendar getCalendar() { + return calendar; + } + + public String getCalendarByDate(String tag) { + + StringBuffer strRet = new StringBuffer(); + if (calendar != null) { + oldYear = calendar.get(Calendar.YEAR); + oldMonth = calendar.get(Calendar.MONTH)+1; + oldDate = calendar.get(Calendar.DATE); + + strRet.append(oldYear); + strRet.append(tag); + if (oldMonth < 10) + strRet.append("0" + oldMonth); + else + strRet.append(oldMonth); + strRet.append(tag); + if (oldDate < 10) + strRet.append("0" + oldDate); + else + strRet.append(oldDate); + + return strRet.toString(); + } + return null; + } + + public Date getCalendarByDate() { + if (calendar != null) + return calendar.getTime(); + return null; + } + //ʼpanel + private void initComponent() { + oldYear = calendar.get(Calendar.YEAR); + oldMonth = calendar.get(Calendar.MONTH); + oldDate = calendar.get(Calendar.DATE); + // this.setBorder(new TitledBorder("Date")); + this.getContentPane().setLayout(new BorderLayout()); + setNorthPanel(); + setCenterPanel(); + setSouthPanel(); + eventListenter(); + setData(); + } + //Ĭϵʱ伴Ϊǰʱ + private void setData() { + + year = calendar.get(Calendar.YEAR); + month = calendar.get(Calendar.MONTH); + date = calendar.get(Calendar.DATE); + comboBoxMonth.setSelectedIndex(month); + spinnerYear.setValue(new Integer(year)); + } + + private void eventListenter() { + + spinnerYear.addChangeListener(new ChangeListener() { + public void stateChanged(ChangeEvent e) { + year = Integer.parseInt(String.valueOf(spinnerYear.getValue())); + refreshTable(); + } + }); + + comboBoxMonth.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + month = comboBoxMonth.getSelectedIndex(); + refreshTable(); + } + }); + + table.getSelectionModel().addListSelectionListener( + new ListSelectionListener() { + public void valueChanged(ListSelectionEvent e) { + if (table.getSelectedRow()>-1&&table.getSelectedColumn()>-1) { + date = Integer.parseInt( + String.valueOf( + table.getValueAt( + table.getSelectedRow(), + table.getSelectedColumn() + ) + ) + ); + calendar.set(Calendar.YEAR, year); + calendar.set(Calendar.MONTH, month); + calendar.set(Calendar.DATE, date); + } + } + } + ); + + AbstractAction right = (new AbstractAction() { + private static final long serialVersionUID = -3429888240127305492L; + public void actionPerformed(ActionEvent e) { + if (table.getColumnCount() == table.getSelectedColumn() + 1) { + table.changeSelection( + table.getSelectedRow() + 1, + 0, + false, + false + ); + } else { + table.changeSelection( + table.getSelectedRow(), + table.getSelectedColumn() + 1, + false, + false + ); + } + } + }); + + AbstractAction left = (new AbstractAction() { + private static final long serialVersionUID = -2487040789339112435L; + public void actionPerformed(ActionEvent e) { + if (0 > table.getSelectedColumn() - 1) { + table.changeSelection( + table.getSelectedRow() - 1, + table.getColumnCount() - 1, + false, + false + ); + } else { + table.changeSelection( + table.getSelectedRow(), + table.getSelectedColumn() - 1, + false, + false + ); + } + } + }); + + InputMap inputMap = table.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); + KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0); + table.getActionMap().put(inputMap.get(keyStroke), right); + keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0); + table.getActionMap().put(inputMap.get(keyStroke), left); + okButton.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) { + calendar.set( + Calendar.YEAR, + Integer.parseInt( + String.valueOf(spinnerYear.getValue()) + ) + ); + calendar.set( + Calendar.MONTH, + comboBoxMonth.getSelectedIndex() + ); + calendar.set( + Calendar.DATE, + Integer.parseInt( + String.valueOf( + table.getValueAt( + table.getSelectedRow(), + table.getSelectedColumn() + ) + ) + ) + ); + + oldYear = calendar.get(Calendar.YEAR); + oldMonth = calendar.get(Calendar.MONTH); + oldDate = calendar.get(Calendar.DATE); + selecttime = CalendarPanel.this.getCalendarByDate(); + TableWithRowHead tw = new TableWithRowHead(twrh,selecttime,bo); + setVisible(false); + } + + }); + + cancelButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + setVisible(false); + } + }); + /* + addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + calendar = null; + super.windowClosing(e); + } + }); + */ + + } + + private void refreshTable() { + for (int i = tableModel.getRowCount() - 1; i > 0; i--) { + tableModel.removeRow(i); + } + calendar.set(Calendar.YEAR, year); + calendar.set(Calendar.MONTH, month); + int maxDate = calendar.getActualMaximum(Calendar.DATE); + calendar.set(Calendar.DATE, 1); + int startDay = calendar.get(Calendar.DAY_OF_WEEK); + for (int i = 0; i < 6; i++) { + tableModel.addRow(new Object[7]); + } + int selectRow = -1; + int selectColumn = -1; + for (int i = 0; i < maxDate; i++) { + int m = (int) ((startDay - 1) / 7) + 1; + int n = (startDay - 1) % 7; + tableModel.setValueAt(String.valueOf(i + 1), m, n); + startDay = startDay + 1; + if (date != -1 && date == i + 1) { + selectRow = m; + selectColumn = n; + } + } + table.changeSelection(selectRow, selectColumn, false, false); + } + + + + private void setSouthPanel() { + + JPanel panel = new JPanel(); + panel.setLayout(new FlowLayout(FlowLayout.RIGHT)); + okButton = new JButton("OK"); + panel.add(okButton); + cancelButton = new JButton("Cancel"); + panel.add(cancelButton); + this.getContentPane().add(panel, BorderLayout.SOUTH); + } + + + private void setCenterPanel() { + + table = new JTable2(); + tableModel = new JTableModel2(); + tableModel.setColumnIdentifiers(days); + tableModel.addRow(days); + table.setModel(tableModel); + for (int i = 0; i < 7; i++) { + table.getColumnModel().getColumn(i).setCellRenderer( + new DefaultTableCellRenderer2() + ); + } + this.getContentPane().add(table, BorderLayout.CENTER); + } + + private void setNorthPanel() { + JPanel panel = new JPanel(); + panel.setLayout(new FlowLayout()); + comboBoxMonth = new JComboBox(); + for (int i = 0; i < months.length; i++) { + comboBoxMonth.addItem(months[i]); + } + comboBoxMonth.setSelectedIndex(-1); + panel.add(comboBoxMonth); + RolloverSpinnerListModel numberModel = new RolloverSpinnerListModel( + 1980, 1980, 2099, 1); + spinnerYear = new JSpinner(numberModel); + JSpinner.NumberEditor numberEditor = new JSpinner.NumberEditor( + spinnerYear, ""); + spinnerYear.setEditor(numberEditor); + panel.add(spinnerYear); + this.getContentPane().add(panel, BorderLayout.NORTH); + } + + public static void main(String[] args) { + + JFrame frame = new JFrame(); + frame.setDefaultCloseOperation(EXIT_ON_CLOSE); + CalendarPanel calendarPanel = new CalendarPanel(frame); + // frame.getContentPane().add(calendarPanel, BorderLayout.CENTER); + // calendarPanel.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + calendarPanel.setVisible(true); + } + + protected void validateTree() { + + super.validateTree(); + if (flag) { + table.requestFocus(); + flag = false; + } + } +} + +class RolloverSpinnerListModel extends SpinnerNumberModel { + + private static final long serialVersionUID = 7366455425120197392L; + + public RolloverSpinnerListModel( + int value, + int minimum, + int maximum, + int stepSize + ) { + super(value, minimum, maximum, stepSize); + } + + public Object getNextValue() { + + Object returnValue = super.getNextValue(); + if (returnValue == null) { + returnValue = super.getMinimum(); + } + return returnValue; + } + + public Object getPreviousValue() { + + Object returnValue = super.getPreviousValue(); + if (returnValue == null) { + returnValue = super.getMaximum(); + } + return returnValue; + } +} + +class JTable2 extends JTable { + + private static final long serialVersionUID = 2092799354481792367L; + + public JTable2() { + this.getTableHeader().setReorderingAllowed(false); + this.getTableHeader().setResizingAllowed(false); + this.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + this.setCellSelectionEnabled(true); + this.setGridColor(Color.white); + } + + public void changeSelection( + int rowIndex, + int columnIndex, + boolean toggle, + boolean extend + ) { + + if (this.getValueAt(rowIndex, columnIndex) == null) { + return; + } + + if (rowIndex == 0) { + return; + } + super.changeSelection(rowIndex, columnIndex, toggle, extend); + } + + public void repaint(int x, int y, int width, int height) { + + super.repaint(x, y, width, height); + if (height > 0) { + makeTableRowHeight(); + } + } + + protected void validateTree() { + super.validateTree(); + makeTableRowHeight(); + } + + private void makeTableRowHeight() { + + int rowHeight = (int) ((this.getHeight() / 7) * 0.6); + if (rowHeight > 0) { + this.setRowHeight(0, rowHeight); + } + + rowHeight = (int) ((this.getHeight() - rowHeight) / 6); + if (rowHeight > 0) { + for (int i = 1; i < 8; i++) { + this.setRowHeight(i, rowHeight); + } + } + } +} + + + +class JTableModel2 extends DefaultTableModel { + + private static final long serialVersionUID = 3655520869200784738L; + public boolean isCellEditable(int row, int column) { + return false; + } +} + +class DefaultTableCellRenderer2 extends DefaultTableCellRenderer { + + private static final long serialVersionUID = -8779549993366848535L; + public Component getTableCellRendererComponent( + JTable table, + Object value, + boolean isSelected, + boolean hasFocus, + int row, + int column + ) { + Component component = + super.getTableCellRendererComponent( + table, + value, + isSelected, + hasFocus, + row, + column + ); + + this.setHorizontalAlignment(SwingConstants.CENTER); + + if (row == 0) { + component.setBackground( + UIManager.getColor("Table.focusCellForeground") + ); + + component.setForeground( + UIManager.getColor("Table.focusCellBackground") + ); + return component; + } else { + if (isSelected) { + component.setBackground( + UIManager.getColor("Table.focusCellForeground") + ); + component.setForeground( + UIManager.getColor("Table.focusCellBackground") + ); + } else { + component.setBackground( + UIManager.getColor("Table.focusCellBackground") + ); + component.setForeground( + UIManager.getColor("Table.focusCellForeground") + ); + } + + if (column == 0 || column == 6) { + component.setForeground(Color.red); + } + } + return component; + } +} + + diff --git a/src/com/teamcenter/rac/form/ConnorForm.java b/src/com/teamcenter/rac/form/ConnorForm.java new file mode 100644 index 0000000..a1e001c --- /dev/null +++ b/src/com/teamcenter/rac/form/ConnorForm.java @@ -0,0 +1,376 @@ +package com.teamcenter.rac.form; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.swing.JComboBox; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.JTextField; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.kernel.AIFComponentContext; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCComponentListOfValues; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.stylesheet.AbstractRendering; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; + +public class ConnorForm extends AbstractRendering implements ItemListener { + private TCComponentForm form = null; + private TCComponentItemRevision rev = null; + private TCComponentItem item = null; + + private AbstractAIFApplication app = AIFUtility.getCurrentApplication(); + private TCSession session; + private TCPreferenceService service; + private List listbeans=new ArrayList(); + private boolean iseditall=true; + + /** + * "connor_"+type+"_props"; + * ѡ: ITEM:object_name:true Ͷ汾Item rev form Ƿɱ༭ + * + * + * @param arg0 + * @throws Exception + */ + public ConnorForm(TCComponentForm arg0) throws Exception { + super(arg0); + // TODO Auto-generated constructor stub + this.form = arg0; + this.session = (TCSession) app.getSession(); + this.service = session.getPreferenceService(); + + AIFComponentContext[] whereReferenced = form.whereReferenced(); + for (int i = 0; i < whereReferenced.length; i++) { + InterfaceAIFComponent aif = whereReferenced[i].getComponent(); + if (aif instanceof TCComponentItemRevision) { + rev=(TCComponentItemRevision)aif; + } + } + if (rev!=null) { + item = rev.getItem(); + boolean checkPrivilege = session.getTCAccessControlService().checkPrivilege(rev, "WRITE"); + System.out.println("жϰ汾ǷдȨ:"+checkPrivilege); + if (!checkPrivilege) { + iseditall=false; + } +// TCComponent[] reles = rev.getReferenceListProperty("release_status_list"); +// if (reles!=null&&reles.length>0) { +// iseditall=false; +// } + + } + loadRendering(); + } + + @Override + public void loadRendering() throws TCException { + String type = form.getType(); + String propname="connor_"+type+"_props"; + String[] form_props = service.getStringValues(propname); + if (form_props==null||form_props.length<=0) { + MessageBox.post("δҵѡ"+propname,"",MessageBox.INFORMATION); + return; + } + + for (int i = 0; i < form_props.length; i++) { + System.out.println("ѡ:"+form_props[i]); + String[] str=form_props[i].split(":"); + if (str.length==3) { + FormPropBean bean=new FormPropBean(); + bean.setType(str[0]); + bean.setPropname(str[1]); + boolean isedit=false; + if (str[2].toUpperCase().equals("TRUE")) { + isedit=true; + }else { + isedit=false; + } + bean.setIsedit(isedit); + TCComponent com=null; + if (str[0].toUpperCase().equals("ITEM")) { + com=item; + }else if (str[0].toUpperCase().equals("REV")) { + com=rev; + }else if (str[0].toUpperCase().equals("FORM")) { + com=form; + } + if (com==null) { + continue; + } + TCProperty tcProperty = com.getTCProperty(str[1]); + if (tcProperty==null) { + System.out.println("δҵ"+str[1]); + continue; + } + bean.setCom(com); + String name = tcProperty.getName(); + int propertyType = tcProperty.getPropertyType(); + bean.setDisname(name); + bean.setPropertyType(propertyType); + JLabel lable=new JLabel(name+":"); + bean.setLable(lable); + String disval = tcProperty.getDisplayValue(); + bean.setDisval(disval); + TCComponentListOfValues lov = tcProperty.getLOV(); + System.out.println(name+"Ƿɱ༭:"+isedit); + if (!iseditall) {//жϰ汾ɱ༭ + isedit=false; + } + if (lov==null) { + bean.setLov(false); + JTextArea field=new JTextArea("",3,50); + field.setLineWrap(true); //ıеıΪԶ + if (disval!=null) { + field.setText(disval); + } + field.setEnabled(isedit); + bean.setComp(field); + bean.setIsedit(isedit); + }else { + bean.setLov(true); + Map map=new HashMap<>(); + Object[] listOfValues = lov.getListOfValues().getListOfValues(); + for(Object s1:listOfValues){ + String a1 = lov.getListOfValues().getDisplayableValue(s1);//ʵֵӦʾֵ + map.put(a1, s1);//ʾ:ʵ + } +// String[] strs=lov.getListOfValues().getStringListOfValues();//ʵֵ +// for(String s1:strs){ +// String a1 = lov.getListOfValues().getDisplayableValue(s1);//ʵֵӦʾֵ +// map.put(a1, s1);//ʾ:ʵ +// } + bean.setMap(map); + bean.setIsedit(isedit); + JComboBox box = new JComboBox(); + box.setEnabled(isedit);//òɱ༭޷Ч + if (map != null) { + box.addItem(""); + for (String s1 : map.keySet()) { + box.addItem(s1); + } + if (disval!=null&&!disval.equals("")) { + if (map.containsKey(disval)) { + box.setSelectedItem(disval); + } + }else { + box.setSelectedItem(""); + } + bean.setComp(box); + } + if (!isedit) {//ɱ༭ı + JTextField jtext=new JTextField(12); + jtext.setText(disval); + jtext.setEnabled(isedit); + bean.setComp2(jtext); + } + + + } + listbeans.add(bean); + } + + } + + initPanel(); + } + + private JPanel mainPanel; + + + private void initPanel() { + setLayout(new BorderLayout()); + this.setSize(new Dimension(650, 260)); + mainPanel = new JPanel(new PropertyLayout()); + int cout=0; + for (int i = 0; i < listbeans.size(); i++) { + cout++; + if (listbeans.get(i).isLov()) { + JComboBox comp=(JComboBox)listbeans.get(i).getComp(); + comp.setEnabled(listbeans.get(i).isIsedit()); + if (listbeans.get(i).isIsedit()) { + mainPanel.add(cout+".1.left.top", listbeans.get(i).getLable()); + mainPanel.add(cout+".2.left.top", comp); + }else { + mainPanel.add(cout+".1.left.top", listbeans.get(i).getLable()); + mainPanel.add(cout+".2.left.top", (JTextField)listbeans.get(i).getComp2()); + } + + }else { + JTextArea comp=(JTextArea)listbeans.get(i).getComp(); + comp.setEnabled(listbeans.get(i).isIsedit()); + mainPanel.add(cout+".1.left.top", listbeans.get(i).getLable()); + mainPanel.add(cout+".2.left.top",comp); + } + + +// int d=i%2; +// if (d==0) { +// cout++; +// mainPanel.add(cout+".1.left.top", listbeans.get(i).getLable()); +// mainPanel.add(cout+".2.left.top", listbeans.get(i).getComp()); +// }else if (d==1) { +// mainPanel.add(cout+".3.left.top", listbeans.get(i).getLable()); +// mainPanel.add(cout+".4.left.top", listbeans.get(i).getComp()); +// } + + } + JScrollPane jsp = new JScrollPane(mainPanel); + jsp.setPreferredSize(new Dimension(450, 490)); + jsp.getVerticalScrollBar().setUnitIncrement(20); + + this.add(jsp,"Center"); + + this.setVisible(true); + this.setBackground(Color.lightGray); + + } + + public boolean isRenderingModified() { + System.out.println("isRenderingModified"); + if (listbeans!=null) { + for (int i = 0; i < listbeans.size(); i++) { + FormPropBean formPropBean = listbeans.get(i); + if (!formPropBean.isIsedit()) { + //ɱ༭ + continue; + } + TCComponent com = formPropBean.getCom(); + Object comp = formPropBean.getComp(); + if (formPropBean.isLov()) { + String val=((JComboBox)comp).getSelectedItem()==null?"":((JComboBox)comp).getSelectedItem().toString(); + if (formPropBean.getPropname().equals("uom_tag")) { + if (val.equals("")&&formPropBean.getDisval().equals("ÿ")) { + + }else if(val.equals(formPropBean.getDisval())){ + + }else { + return true; + } + + }else { + if (!val.equals(formPropBean.getDisval())) { + System.out.println(val+"-----"+formPropBean.getDisval()); + return true; + } + } + + }else { + String text = ((JTextArea)comp).getText(); + if (!text.equals(formPropBean.getDisval())) { + System.out.println(text+"-----"+formPropBean.getDisval()); + return true; + } + + } + } + } + + return false; + } + + + private boolean isrend(TCProperty tcProperty, Object str) { + if(str instanceof String){ + if(tcProperty!=null&&str!=null&&(!str.equals(tcProperty.getStringValue()))){ + System.out.println(str); + return true; + } + }else if(str instanceof Double){ + if(tcProperty!=null&&str!=null&&(((Double)str)!=tcProperty.getDoubleValue())){ + System.out.println(str); + return true; + } + } + + return false; + } + + + @Override + public void saveRendering() { + System.out.println("뱣"); + try { + for (int i = 0; i < listbeans.size(); i++) { + FormPropBean formPropBean = listbeans.get(i); + TCComponent com = formPropBean.getCom(); + Object comp = formPropBean.getComp(); + if (formPropBean.isLov()) { + String val=((JComboBox)comp).getSelectedItem()==null?"":((JComboBox)comp).getSelectedItem().toString(); + if (val.equals(formPropBean.getDisval())) { + continue; + } + if (formPropBean.getPropname().equals("uom_tag")) { + if (val.equals("") && formPropBean.getDisval().equals("ÿ")) { + continue; + } + } + if (val.equals("")) { + com.setProperty(formPropBean.getPropname(), ""); + }else { + if (formPropBean.getMap().containsKey(val)) { + Object object = formPropBean.getMap().get(val); + if (object instanceof String) { + com.setStringProperty(formPropBean.getPropname(), object.toString()); + } else if (object instanceof TCComponent) { + + com.setReferenceProperty(formPropBean.getPropname(), (TCComponent) object); + } + + } + } + + + + + }else { + String text = ((JTextArea)comp).getText(); + if (text.equals(formPropBean.getDisval())) { + continue; + } + if (formPropBean.getPropertyType()==8) { + com.setStringProperty(formPropBean.getPropname(), text); + }else if (formPropBean.getPropertyType()==3||formPropBean.getPropertyType()==4) { + if (text!=null&&!text.equals("")) { + com.setDoubleProperty(formPropBean.getPropname(), Double.valueOf(text)); + } + + } + + + } + } + + } catch (TCException e) { + e.printStackTrace(); + MessageBox.post(":"+e.getMessage(),"",MessageBox.ERROR); + } + + } + + @Override + public void itemStateChanged(ItemEvent e) { + + } +} diff --git a/src/com/teamcenter/rac/form/CopyOfJK8_JSPS_Form.java b/src/com/teamcenter/rac/form/CopyOfJK8_JSPS_Form.java new file mode 100644 index 0000000..eddd77f --- /dev/null +++ b/src/com/teamcenter/rac/form/CopyOfJK8_JSPS_Form.java @@ -0,0 +1,460 @@ +//package com.teamcenter.rac.form; +// +//import java.awt.BorderLayout; +//import java.awt.Color; +//import java.awt.Component; +//import java.awt.Font; +//import java.awt.Frame; +//import java.awt.event.ActionEvent; +//import java.awt.event.ActionListener; +//import java.util.ArrayList; +//import java.util.Collections; +//import java.util.Date; +//import java.util.List; +// +//import javax.swing.JButton; +//import javax.swing.JFrame; +//import javax.swing.JPanel; +//import javax.swing.JScrollPane; +//import javax.swing.JTabbedPane; +//import javax.swing.JTable; +//import javax.swing.JTextArea; +//import javax.swing.table.DefaultTableModel; +//import javax.swing.table.TableCellRenderer; +// +//import com.connor.hx3.plm.hxom012.BZGXBean; +//import com.connor.hx3.plm.hxom012.BomStructBean; +//import com.connor.hx3.plm.hxom012.HX3_GYLXRevisionFormPropBean; +//import com.connor.hx3.plm.util.HxomMethodUtil; +//import com.teamcenter.rac.aif.AbstractAIFApplication; +//import com.teamcenter.rac.aif.AbstractAIFDialog; +//import com.teamcenter.rac.kernel.TCComponent; +//import com.teamcenter.rac.kernel.TCComponentForm; +//import com.teamcenter.rac.kernel.TCComponentType; +//import com.teamcenter.rac.kernel.TCException; +//import com.teamcenter.rac.kernel.TCProperty; +//import com.teamcenter.rac.kernel.TCSession; +//import com.teamcenter.rac.stylesheet.AbstractRendering; +//import com.teamcenter.rac.util.AbstractDialog; +//import com.teamcenter.rac.util.MessageBox; +// +//public class CopyOfJK8_JSPS_Form extends AbstractAIFDialog implements ActionListener { +// private AbstractAIFApplication app; +// private TCSession session; +// +// private TCComponent formComp = null; +// private JPanel mainJPanel; +// private JPanel tableJPanel; +// private JPanel buttonJPanel; +// private JButton addButton; +// private JButton saveButton; +// private JButton delButton; +// private JTable jTable; +// private JScrollPane scrollPanel; +// private Object[] obj = new Object[] { "", "", "", "", "λ", +// "", "", "" }; +// +// public static final String[] PROP_NAMES = {// +// "jk8_bh", "jk8_psr", "jk8_jd", "jk8_tcrq", "jk8_wtszwz", // 5 +// "jk8_wtms", "jk8_jy", "jk8_cljg" }; +// +// private List valueLists; +// private TCProperty[] propertiesArray; +// +// public boolean over; +// private TCComponent form; +// +// +// public CopyOfJK8_JSPS_Form(AbstractAIFApplication app,TCSession session) { +// super(true); +// System.out.println("----------------------------run()"); +// this.app=app; +// this.session=session; +// } +// @Override +// public void run() { +// System.out.println("----------------------------run()"); +// initializeUI(); +// } +// public void initializeUI() { +// System.out.println("----------------------------run()"); +// initPanel(); +// +// } +// +// private void initPanel() { +// // TODO Auto-generated method stub +// valueLists = new ArrayList(); +//// getFormVlue(); +// this.setLayout(new BorderLayout()); +// mainJPanel = new JPanel(new BorderLayout()); +// tableJPanel = new JPanel(new BorderLayout()); +// // ñ +// this.jTable = getjTable(this.jTable, null, obj, null); +// tableJPanel.add(new JScrollPane(this.jTable), BorderLayout.CENTER); +// // scrollPanel = new JScrollPane(); +// // scrollPanel.getViewport().add(jTable, null); +// // scrollPanel.validate(); +// int rowCount = this.jTable.getRowCount(); +// Object[][] values = new Object[1][5]; +// +// buttonJPanel = new JPanel(new BorderLayout()); +// addButton = new JButton("+"); +// addButton.setEnabled(true); +// addButton.addActionListener(new ActionListener() { +// @Override +// public void actionPerformed(ActionEvent e) { +// addRow(e); +// } +// }); +// saveButton=new JButton(""); +// saveButton.setEnabled(true); +// saveButton.addActionListener(new ActionListener() { +// +// @Override +// public void actionPerformed(ActionEvent arg0) { +// // TODO Auto-generated method stub +// saveRow(); +// } +// }); +// delButton = new JButton("-"); +// delButton.setEnabled(true); +// delButton.addActionListener(new ActionListener() { +// +// @Override +// public void actionPerformed(ActionEvent arg0) { +// delRow(arg0); +// } +// }); +// buttonJPanel.add(addButton, BorderLayout.NORTH); +// buttonJPanel.add(delButton, BorderLayout.SOUTH); +// mainJPanel.add(tableJPanel, BorderLayout.CENTER); +// mainJPanel.add(buttonJPanel, BorderLayout.EAST); +// +// this.add(mainJPanel, BorderLayout.CENTER); +// } +// +// protected void saveRow() { +// // TODO Auto-generated method stub +// +// } +// +// protected void delRow(ActionEvent arg0) { +// // TODO Auto-generated method stub +// int index = jTable.getSelectedRow(); +// if (index == -1) { +// MessageBox.post("ѡִɾ", "", MessageBox.WARNING); +// return; +// } +// if (valueLists.get(index).jk8_bh != null) { +// if (!valueLists.get(index).jk8_bh.trim().isEmpty()) { +// MessageBox.post("ƳϺִɾ", "", MessageBox.WARNING); +// return; +// } +// } +// valueLists.remove(index); +// ((DefaultTableModel) this.jTable.getModel()).removeRow(index); +// ((DefaultTableModel) this.jTable.getModel()) +// .fireTableStructureChanged(); +// ((DefaultTableModel) this.jTable.getModel()).fireTableDataChanged(); +// scrollPanel.validate(); +// +// } +// +// protected void addRow(ActionEvent e) { +// // TODO Auto-generated method stub +// JS8_JSPSPropBean bean = new JS8_JSPSPropBean(); +// Object[] objs = new Object[] { bean.jk8_bh, bean.jk8_psr, bean.jk8_jd, +// bean.jk8_tcrq, bean.jk8_wtszwz, bean.jk8_wtms, bean.jk8_jy, +// bean.jk8_cljg }; +// valueLists.add(bean); +// ((DefaultTableModel) this.jTable.getModel()).addRow(objs); +// +// ((DefaultTableModel) this.jTable.getModel()) +// .fireTableStructureChanged(); +// ((DefaultTableModel) this.jTable.getModel()).fireTableDataChanged(); +// +// } +// +// // Jtableͨ÷ +// public JTable getjTable(JTable partsTable, DefaultTableModel dtm, +// Object[] titleNames, Object[][] values) { +// int simpleLen = 105; +// int totleLen = 900; +// if (partsTable == null) { +// partsTable = new JTable(getTableModel(dtm, titleNames, values)) { +// public boolean isCelEditable(int row, int column) { +// return false; +// } +// }; +// if (simpleLen * titleNames.length >= totleLen) { +// for (int i = 0; i < titleNames.length; i++) { +// partsTable.getColumnModel().getColumn(i) +// .setPreferredWidth(105); +// } +// partsTable.setAutoResizeMode(0); +// } else { +// partsTable.setAutoResizeMode(1); +// } +// } +// return partsTable; +// } +// +// // tableؼ +// public DefaultTableModel getTableModel(DefaultTableModel dtm, +// Object[] columnNameObjects, Object[][] objects) { +// if (dtm == null) { +// dtm = new DefaultTableModel(objects, columnNameObjects); +// } +// return dtm; +// } +// +//// @Override +//// public void loadRendering() throws TCException { +//// // TODO Auto-generated method stub +//// initializeUI(); +//// +//// } +//// +//// @Override +//// public void saveRendering() { +//// // TODO Auto-generated method stub +//// +//// } +//// +//// /** +//// * ǩ벢 +//// */ +//// @Override +//// public boolean checkForSave(Object obj) { +//// // TODO Auto-generated method stub +//// over = true; +//// saveWLProps(); +//// +//// System.out.println("ǩ벢"); +//// return super.checkForSave(obj); +//// } +//// +//// /** +//// * +//// */ +//// @Override +//// public void save() { +//// // TODO Auto-generated method stub +//// over = true; +//// saveWLProps(); +//// +//// System.out.println(""); +//// super.save(); +//// } +// +// /** +// * +// */ +// public void saveWLProps() { +// if (valueLists == null) { +// System.out.println("бΪ"); +// return; +// } +// Collections.sort(this.valueLists); +// // List gxbbList = new ArrayList<>(); +// // for (int i = 0; i < valueLists.size(); i++) { +// // HX3_GYLXRevisionFormPropBean bean = valueLists.get(i); +// // +// // } +// try { +// HxomMethodUtil.setByPass(true); +// } catch (TCException e2) { +// // TODO Auto-generated catch block +// e2.printStackTrace(); +// } +// String[] valueStrs0 = new String[valueLists.size()];// +// String[] valueStrs1 = new String[valueLists.size()];// +// String[] valueStrs2 = new String[valueLists.size()];// +// String[] valueStrs3 = new String[valueLists.size()];// +// String[] valueStrs4 = new String[valueLists.size()];// λ +// String[] valueStrs5 = new String[valueLists.size()];// +// String[] valueStrs6 = new String[valueLists.size()];// +// String[] valueStrs7 = new String[valueLists.size()];// +// +// for (int i = 0; i < valueLists.size(); i++) { +// JS8_JSPSPropBean bean = valueLists.get(i); +// valueStrs0[i] = bean.jk8_bh == null ? "" : bean.jk8_bh; +// valueStrs1[i] = bean.jk8_psr == null ? "" : bean.jk8_psr; +// valueStrs2[i] = bean.jk8_jd == null ? "" : bean.jk8_jd; +// valueStrs3[i] = bean.jk8_tcrq == null ? "" : bean.jk8_tcrq; +// valueStrs4[i] = bean.jk8_wtszwz == null ? "" : bean.jk8_wtszwz; +// valueStrs5[i] = bean.jk8_wtms == null ? "" : bean.jk8_wtms; +// valueStrs6[i] = bean.jk8_jy == null ? "" : bean.jk8_jy; +// valueStrs7[i] = bean.jk8_cljg == null ? "" : bean.jk8_cljg; +// } +// try { +// if (propertiesArray[0] != null) +// propertiesArray[0].setStringValueArray(valueStrs0); +// if (propertiesArray[1] != null) +// propertiesArray[1].setStringValueArray(valueStrs1); +// if (propertiesArray[2] != null) +// propertiesArray[2].setStringValueArray(valueStrs2); +// if (propertiesArray[3] != null) +// propertiesArray[3].setStringValueArray(valueStrs3); +// if (propertiesArray[4] != null) +// propertiesArray[4].setStringValueArray(valueStrs4); +// if (propertiesArray[5] != null) +// propertiesArray[5].setStringValueArray(valueStrs5); +// if (propertiesArray[6] != null) +// propertiesArray[6].setStringValueArray(valueStrs6); +// if (propertiesArray[7] != null) +// propertiesArray[7].setStringValueArray(valueStrs7); +// +// formComp.setTCProperties(propertiesArray); +// +// } catch (TCException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } catch (Exception e1) { +// e1.printStackTrace(); +// } +// try { +// HxomMethodUtil.setByPass(false); +// } catch (TCException e2) { +// // TODO Auto-generated catch block +// e2.printStackTrace(); +// } +// } +// +// /** +// * FORMʱȡ +// */ +// public void getFormVlue() { +// +// this.valueLists = new ArrayList<>(); +// try { +// +// // ȡֵ +// propertiesArray = formComp.getTCProperties(PROP_NAMES); +// // дֵԵ +// if (propertiesArray != null) { +// String[] valueStrs0 = propertiesArray[0] == null ? new String[0] +// : propertiesArray[0].getStringArrayValue(); +// String[] valueStrs1 = propertiesArray[1] == null ? new String[0] +// : propertiesArray[1].getStringArrayValue(); +// String[] valueStrs2 = propertiesArray[2] == null ? new String[0] +// : propertiesArray[2].getStringArrayValue(); +// String[] valueStrs3 = propertiesArray[3] == null ? new String[0] +// : propertiesArray[3].getStringArrayValue(); +// String[] valueStrs4 = propertiesArray[4] == null ? new String[0] +// : propertiesArray[4].getStringArrayValue(); +// String[] valueStrs5 = propertiesArray[5] == null ? new String[0] +// : propertiesArray[5].getStringArrayValue(); +// String[] valueStrs6 = propertiesArray[6] == null ? new String[0] +// : propertiesArray[6].getStringArrayValue(); +// String[] valueStrs7 = propertiesArray[7] == null ? new String[0] +// : propertiesArray[7].getStringArrayValue(); +// +// if (valueStrs0.length == valueStrs1.length +// && valueStrs0.length == valueStrs2.length +// && valueStrs0.length == valueStrs3.length +// && valueStrs0.length == valueStrs4.length +// && valueStrs0.length == valueStrs5.length +// && valueStrs0.length == valueStrs6.length +// && valueStrs0.length == valueStrs7.length +// +// && valueStrs0.length != 0) { +// for (int i = 0; i < valueStrs0.length; i++) { +// JS8_JSPSPropBean bean = new JS8_JSPSPropBean(); +// bean.jk8_bh = valueStrs0[i];// "", +// +// bean.jk8_psr = valueStrs1[i];// "", +// bean.jk8_jd = valueStrs2[i];// "", +// bean.jk8_tcrq = valueStrs3[i];// "", +// bean.jk8_wtszwz = valueStrs4[i];// "λ",// 5 +// bean.jk8_wtms = valueStrs5[i];// "", +// bean.jk8_jy = valueStrs6[i];// "", +// bean.jk8_cljg = valueStrs7[i];// "", +// +// this.valueLists.add(bean); +// +// } +// } +// } +// Collections.sort(this.valueLists); +// } catch (TCException e) { +// e.printStackTrace(); +// } +// +// } +// +// class TableCellTextAreaRenderer extends JTextArea implements +// TableCellRenderer { +//// private BZGXBean bean = null; +// +// public TableCellTextAreaRenderer() { +// setLineWrap(true); +// setWrapStyleWord(true); +// } +// +// public Component getTableCellRendererComponent(JTable table, +// Object value, boolean isSelected, boolean hasFocus, int row, +// int column) { +// +// // 㵱еѸ߶ +// int maxPreferredHeight = 0; +// for (int i = 0; i < table.getColumnCount(); i++) { +// setText("" + table.getValueAt(row, i)); +// setSize(table.getColumnModel().getColumn(column).getWidth(), 0); +// maxPreferredHeight = Math.max(maxPreferredHeight, +// getPreferredSize().height); +// } +// +// if (table.getRowHeight(row) != maxPreferredHeight) // Ϲæ +// table.setRowHeight(row, maxPreferredHeight); +// +// setText(value == null ? "" : value.toString()); +// // table.setSelectionBackground(Color.yellow); +// Font fp = new Font("Menu.font", Font.PLAIN, 14); +// Font fb = new Font("Menu.font", Font.BOLD, 14); +// if (isSelected) { +// this.setFont(fb); +// +// } else { +// this.setFont(fp); +// } +// +// if (isSelected +// && hasFocus +// && row == table.getSelectedRow() +// && column == table.getSelectedColumn() +// ) { +// +// // 2.õǰCellɫ +// // Component c = super.getTableCellRendererComponent(table, +// // value, +// // isSelected, hasFocus, row, column); +// this.setBackground(Color.yellow);// ñɫ +// this.setForeground(Color.BLACK);// ǰɫ +// return this; +// } else { +// +// // 3.õУżеɫ +// if (row % 2 == 0) {// żʱɫ +// setBackground(Color.white); +// } else if (row % 2 == 1) {// õеɫ +// setBackground(Color.white); +// } +// if (isSelected) { +// this.setBackground(Color.LIGHT_GRAY);// ñɫ +// } +// return this; +// } +// +// // return this; +// } +// } +// +// @Override +// public void actionPerformed(ActionEvent arg0) { +// // TODO Auto-generated method stub +// +// } +// +//} diff --git a/src/com/teamcenter/rac/form/FormPropBean.java b/src/com/teamcenter/rac/form/FormPropBean.java new file mode 100644 index 0000000..c4375cc --- /dev/null +++ b/src/com/teamcenter/rac/form/FormPropBean.java @@ -0,0 +1,98 @@ +package com.teamcenter.rac.form; + +import java.util.Map; + +import javax.swing.JComponent; +import javax.swing.JLabel; + +import com.teamcenter.rac.kernel.TCComponent; + +public class FormPropBean { + private TCComponent com; + private String type; + private String propname; + private String disname; + private String disval; + private int propertyType; + private boolean isedit; + private JLabel lable; + private Object comp; + private Object comp2; + private boolean isLov; + private Map map; + + public TCComponent getCom() { + return com; + } + public void setCom(TCComponent com) { + this.com = com; + } + public String getType() { + return type; + } + public void setType(String type) { + this.type = type; + } + public String getPropname() { + return propname; + } + public void setPropname(String propname) { + this.propname = propname; + } + public String getDisname() { + return disname; + } + public void setDisname(String disname) { + this.disname = disname; + } + public String getDisval() { + return disval; + } + public void setDisval(String disval) { + this.disval = disval; + } + public int getPropertyType() { + return propertyType; + } + public void setPropertyType(int propertyType) { + this.propertyType = propertyType; + } + public boolean isIsedit() { + return isedit; + } + public void setIsedit(boolean isedit) { + this.isedit = isedit; + } + public JLabel getLable() { + return lable; + } + public void setLable(JLabel lable) { + this.lable = lable; + } + public Object getComp() { + return comp; + } + public void setComp(Object comp) { + this.comp = comp; + } + public Object getComp2() { + return comp2; + } + public void setComp2(Object comp2) { + this.comp2 = comp2; + } + public boolean isLov() { + return isLov; + } + public void setLov(boolean isLov) { + this.isLov = isLov; + } + public Map getMap() { + return map; + } + public void setMap(Map map) { + this.map = map; + } + + +} diff --git a/src/com/teamcenter/rac/form/JAutoCompleteComboBox.java b/src/com/teamcenter/rac/form/JAutoCompleteComboBox.java new file mode 100644 index 0000000..16ad901 --- /dev/null +++ b/src/com/teamcenter/rac/form/JAutoCompleteComboBox.java @@ -0,0 +1,269 @@ +package com.teamcenter.rac.form; + +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.util.List; +import java.util.Vector; +import javax.swing.ComboBoxModel; +import javax.swing.DefaultComboBoxModel; +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.JTextField; + +@SuppressWarnings({"rawtypes", "unchecked"}) +public class JAutoCompleteComboBox extends JComboBox { + + /** + * + */ + private static final long serialVersionUID = 1L; + private AutoCompleter completer; + private int textFieldLength = 20; + + public JAutoCompleteComboBox() { + super(); + addCompleter(); + } + + public JAutoCompleteComboBox(int textFieldLength) { + super(); + this.textFieldLength = textFieldLength; + addCompleter(); + } + + public JAutoCompleteComboBox(ComboBoxModel cm) { + super(cm); + addCompleter(); + } + + public JAutoCompleteComboBox(Object[] items) { + super(items); + addCompleter(); + } + + public JAutoCompleteComboBox(List v) { + super((Vector) v); + addCompleter(); + } + + private void addCompleter() { + setEditable(true); + completer = new AutoCompleter(this, textFieldLength); + } + + public void autoComplete(String str) { + this.completer.autoComplete(str, str.length()); + } + + public String getText() { + return ((JTextField) getEditor().getEditorComponent()).getText(); + } + + public void setText(String text) { + ((JTextField) getEditor().getEditorComponent()).setText(text); + } + + public boolean containsItem(String itemString) { + for (int i = 0; i < this.getModel().getSize(); i++) { + String _item = " " + this.getModel().getElementAt(i); + if (_item.equals(itemString)) + return true; + } + return false; + } + + public void setTextLength(int length) { + completer.setTextLength(length); + } + + class AutoCompleter implements KeyListener, ItemListener { + + private JComboBox owner = null; + private JTextField editor = null; + private ComboBoxModel model = null; + + public AutoCompleter(JComboBox comboBox,int columns) { + owner = comboBox; + editor = (JTextField) comboBox.getEditor().getEditorComponent(); + editor.addKeyListener(this); + editor.setColumns(columns); +// editor.getDocument().addDocumentListener(new DocumentListener() { +// @Override +// public void removeUpdate(DocumentEvent e) { +// System.out.println("ɾ"); +// int caretPosition = editor.getCaretPosition(); +// String str = editor.getText(); +// autoComplete(str, caretPosition); +// } +// +// @Override +// public void insertUpdate(DocumentEvent e) { +// System.out.println(""); +// } +// +// @Override +// public void changedUpdate(DocumentEvent e) { +// System.out.println("޸"); +// } +// }); + model = comboBox.getModel(); + + owner.addItemListener(this); + } + + public void keyTyped(KeyEvent e) { + } + + public void keyPressed(KeyEvent e) { + } + + public void keyReleased(KeyEvent e) { +// char ch = e.getKeyChar(); +// if (ch == KeyEvent.CHAR_UNDEFINED || Character.isISOControl(ch) +// || ch == KeyEvent.VK_DELETE) +// return; +// System.out.println("str="+str); +// System.out.println("caretPosition="+caretPosition); +// if (str.length() == 0) +// return; + new Thread(new Runnable() { + @Override + public void run() { + // Auto-generated method stub + try { + Thread.sleep(500); + int caretPosition = editor.getCaretPosition(); + String str = editor.getText(); + autoComplete(str, caretPosition); + } catch (Exception e) { + e.printStackTrace(); + } + } + }).start(); + } + + /** + * ԶɡݣбҵƵĿ. + */ + protected void autoComplete(String strf, int caretPosition) { + System.out.println("ǰ±꣺"+caretPosition); + Object[] opts; + opts = getMatchingOptions(strf.substring(0, caretPosition)); + if (owner != null) { + model = new DefaultComboBoxModel(opts); + owner.setModel(model); + } + if (opts.length > 0) { +// String str = opts[0].toString(); + try { + editor.setCaretPosition(caretPosition); + }catch (Exception e) { + e.printStackTrace(); + } + if (owner != null) { + try { + owner.showPopup(); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + } + } + + /** + * + * ҵƵĿ, ҽ֮еǰ档 + * + * @param str + * @return Ŀб + */ + protected Object[] getMatchingOptions(String str) { +// System.out.println("str2="+str); + List v = new Vector(); + List v1 = new Vector(); + if("".equals(str)) { + boolean hasempty = false; + for (int k = 0; k < model.getSize(); k++) { + Object itemObj = model.getElementAt(k); + if (itemObj != null) { + String item = itemObj.toString(); + if(!"".equals(item)) + item = item.toLowerCase(); + if (item.equals(str)) { + hasempty = true; + v.add(model.getElementAt(k)); + }else { + v1.add(model.getElementAt(k)); + } + } else { + hasempty = true; + v1.add(model.getElementAt(k)); + } + } + if(!hasempty) { + v.add(""); + } + }else { + for (int k = 0; k < model.getSize(); k++) { + Object itemObj = model.getElementAt(k); + if (itemObj != null) { + String item = itemObj.toString().toLowerCase(); + if (item.startsWith(str.toLowerCase())) + v.add(model.getElementAt(k)); + else + v1.add(model.getElementAt(k)); + } else + v1.add(model.getElementAt(k)); + } + } + for (int i = 0; i < v1.size(); i++) { + v.add(v1.get(i)); + } + if (v.isEmpty()) + v.add(str); + return v.toArray(); + } + + public void itemStateChanged(ItemEvent event) { + if (event.getStateChange() == ItemEvent.SELECTED) { + int caretPosition = editor.getCaretPosition(); + if (caretPosition != -1) { + try { + editor.moveCaretPosition(caretPosition); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + } + } + + public void setTextLength(int length) { + editor.setColumns(length); + } + } + + public static void main(String[] args) { + JFrame frame = new JFrame(); +// Object[] items = new Object[] { "", "abc ", "aab ", "aba ", "hpp ", "pp ", "hlp " }; + DefaultComboBoxModel model = new DefaultComboBoxModel(); + JComboBox cmb = new JAutoCompleteComboBox(); +// cmb.addItem(""); + cmb.addItem("Ʒ"); + cmb.addItem("Ʒ"); + cmb.addItem(""); + cmb.addItem(""); + cmb.addItem(""); + model.addElement(""); + model.addElement("abc "); + model.addElement("aab "); + model.addElement("aba "); + model.addElement("hpp "); + model.addElement("pp "); + model.addElement("hlp "); + frame.getContentPane().add(cmb); + frame.setSize(400, 80); + frame.setVisible(true); + } +} \ No newline at end of file diff --git a/src/com/teamcenter/rac/form/JK3_XCPXHFormPropBean.java b/src/com/teamcenter/rac/form/JK3_XCPXHFormPropBean.java new file mode 100644 index 0000000..dc05f80 --- /dev/null +++ b/src/com/teamcenter/rac/form/JK3_XCPXHFormPropBean.java @@ -0,0 +1,40 @@ +package com.teamcenter.rac.form; + +import java.util.Date; + + +public class JK3_XCPXHFormPropBean implements Comparable { + public static final int COUNT = 5;// 5 + public String jk3_xh = "";// "", + public String jk3_cpxh = "";// "Ʒͺ", + public String jk3_sbh = "";// "ʶ", + public String jk3_mc = "";// "", + public String jk3_sysc = "";// "г" + + @Override + public int compareTo(Object o) { + // TODO Auto-generated method stub + if (o == null) { + return 0; + } + JK3_XCPXHFormPropBean bean = (JK3_XCPXHFormPropBean) o; + if (this.jk3_xh == null) { + if (bean.jk3_cpxh != null) { + // 111 + return "".compareTo(bean.jk3_cpxh); + } else { + return 0; + } + } else { + if (bean.jk3_cpxh != null) { + // 111 + return this.jk3_cpxh.compareTo(bean.jk3_cpxh); + } else { + return this.jk3_cpxh.compareTo(""); + } + // return this.hx3_gxhh.compareTo(bean.hx3_gxhh); + + } + + } +} diff --git a/src/com/teamcenter/rac/form/JK3_XCPXHFormStyleSheet.java b/src/com/teamcenter/rac/form/JK3_XCPXHFormStyleSheet.java new file mode 100644 index 0000000..05c1a96 --- /dev/null +++ b/src/com/teamcenter/rac/form/JK3_XCPXHFormStyleSheet.java @@ -0,0 +1,1244 @@ +//package com.teamcenter.rac.form; +// +//import java.awt.BorderLayout; +//import java.awt.Color; +//import java.awt.Component; +//import java.awt.Font; +//import java.awt.Toolkit; +//import java.awt.datatransfer.StringSelection; +//import java.awt.event.ActionEvent; +//import java.awt.event.ActionListener; +//import java.awt.event.MouseEvent; +//import java.awt.event.MouseListener; +//import java.text.ParseException; +//import java.text.SimpleDateFormat; +//import java.util.ArrayList; +//import java.util.Collections; +//import java.util.Date; +//import java.util.HashMap; +//import java.util.List; +// +//import javax.swing.JButton; +//import javax.swing.JComponent; +//import javax.swing.JLabel; +//import javax.swing.JMenu; +//import javax.swing.JMenuItem; +//import javax.swing.JPanel; +//import javax.swing.JPopupMenu; +//import javax.swing.JScrollPane; +//import javax.swing.JTabbedPane; +//import javax.swing.JTable; +//import javax.swing.JTextArea; +//import javax.swing.ListSelectionModel; +//import javax.swing.event.MouseInputListener; +//import javax.swing.table.DefaultTableModel; +//import javax.swing.table.TableCellRenderer; +// +//import com.connor.hx3.plm.hxom012.BOM; +//import com.connor.hx3.plm.hxom012.BZGXBean; +//import com.connor.hx3.plm.hxom012.BomStructBean; +//import com.connor.hx3.plm.hxom012.BomStructTree; +//import com.connor.hx3.plm.hxom012.HX3_GYLXRevisionFormPropBean; +//import com.connor.hx3.plm.util.HxomMethodUtil; +//import com.teamcenter.rac.aif.kernel.AIFComponentContext; +//import com.teamcenter.rac.aifrcp.AIFUtility; +//import com.teamcenter.rac.kernel.TCComponent; +//import com.teamcenter.rac.kernel.TCComponentBOMLine; +//import com.teamcenter.rac.kernel.TCComponentForm; +//import com.teamcenter.rac.kernel.TCComponentItem; +//import com.teamcenter.rac.kernel.TCComponentItemRevision; +//import com.teamcenter.rac.kernel.TCComponentType; +//import com.teamcenter.rac.kernel.TCException; +//import com.teamcenter.rac.kernel.TCProperty; +//import com.teamcenter.rac.kernel.TCSession; +//import com.teamcenter.rac.stylesheet.AbstractRendering; +//import com.teamcenter.rac.util.ButtonLayout; +//import com.teamcenter.rac.util.MessageBox; +// +//public class JK3_XCPXHFormStyleSheet extends AbstractRendering implements +// ActionListener { +// private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); +// private final String HX_BZGX_Option_Name = "HX_BZGX_Option_Name"; +// private String titleName ; +// +// private JPanel rootPanel; +// private JPanel topPanel; +//// private JPanel buttomPanel; +// private JScrollPane scrollPanel; +// private JLabel emptyLable; +//// private JButton addButton; +//// private JButton insertButton; +//// private JButton delButton; +// +// private JTable partsTable; +// public boolean isRefresh; +// public boolean over; +// private List valueLists; +// private HashMap> bzgxMap;//׼ +// private DefaultTableModel dtm; +// private TCComponent formComp; +// +// private TCProperty[] propertiesArray; +// private BomStructTree bomJTree; +// private BomStructBean firstBean; +// private JK3_XCPXHFormPropBean selectTableBean; +// private BOM bomMsg; +// +// private String[] BZGX_LIST = { // +// "hx3_gzbz", // ׼ +// "hx3_gxsm",// ˵ +// "hx3_gzzx",// , +// "hx3_dcgx1",// 幤 bool +// "hx3_bgd1",// bool +// "hx3_wwgx1",// ί⹤ bool +// "hx3_jfd1",// Ʒѵ bool +// "hx3_jhwwgx1"// ƻί⹤ bool +// }; +// private Object[] titleNames = { // +// "", "Ʒͺ", "ʶ", "", "г",// 5 +//// "ģ߱", "幤", "", "ί⹤", "Ʒѵ",// 10 +//// "ƻί⹤", "Ч", "ʧЧ", "ļ", "ļ汾", // 15 +//// "" // 17 +// }; +// public static final String[] TM2_PROCESS_PROP_NAMES = {// +// "jk3_xh", "jk3_cpxh", "jk3_sbh", "jk3_mc","jk3_sysc", // 5 +//// "hx3_mjbh", "hx3_dcgx1", "hx3_bgd1", "hx3_wwgx1", +//// "hx3_jfd1", // 10 +//// "hx3_jhwwgx1", "hx3_sxrq", "hx3_shixrq", "hx3_gywjbh", +//// "hx3_gywjbb",// 15 +//// "hx3_lywl"// 17 +// }; +// +// // =========================== +// +// public JK3_XCPXHFormStyleSheet(TCComponent arg0) throws Exception { +// super(arg0); +// this.formComp = arg0; +// getTitle(); +// this.isRefresh = false; +// this.over = false; +// loadRendering(); +// if (firstBean == null) { +// getFormMsg(); +// bomJTree = new BomStructTree(firstBean, this); +// } +// new Thread() { +// +// @Override +// public void run() { +// // TODO Auto-generated method stub +// // super.run(); +// while (!over) { +// try { +// new Thread().sleep(1000); +// if (selectTableBean != null) { +// +// int index = valueLists.indexOf(selectTableBean); +// +//// if(index !=-1){ +//// ((DefaultTableModel) partsTable.getModel()) +//// .setValueAt(selectTableBean.hx3_lywl, +//// index, 15); +//// } +// +// } +// } catch (InterruptedException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// }catch(Exception e){ +// e.printStackTrace(); +// } +// } +// } +// +// }.start(); +// } +// +// public void getTitle(){ +// try { +// TCComponentItemRevision tempRev = (TCComponentItemRevision) formComp +// .getReferenceProperty("item_revision"); +// if(tempRev == null){ +// return; +// } +// TCComponentItem item = tempRev.getItem(); +// if(item == null){ +// return; +// } +// AIFComponentContext[] contextS = item.whereReferencedByTypeRelation(new String[]{"HX3_WLRevision"},new String[]{ "HX3_GYLXRelation"}); +// System.out.println("count = "+contextS.length); +//// if(contextS!=null && contextS.length>0){ +//// titleName =((TCComponentItemRevision) contextS[0].getComponent()).getStringProperty("object_string")+"·ͼ"; +//// } +// } catch (TCException e) { +// e.printStackTrace(); +// } +// +// } +// +// public void getBZGXList() { +// try { +// bzgxMap = new HashMap<>(); +// String puid = HxomMethodUtil.getPrefStr(HX_BZGX_Option_Name); +// TCSession session = (TCSession) AIFUtility.getCurrentApplication() +// .getSession(); +// +// TCComponentForm form = (TCComponentForm) session +// .stringToComponent(puid); +// TCProperty[] propS = form.getTCProperties(BZGX_LIST); +// if (propS != null) { +// if (propS[0] != null && propS[1] != null && propS[2] != null +// && propS[3] != null && propS[4] != null +// && propS[5] != null && propS[6] != null +// && propS[7] != null) { +// if (propS[0].getStringArrayValue().length == propS[1] +// .getStringArrayValue().length +// && propS[0].getStringArrayValue().length == propS[2] +// .getStringArrayValue().length +// && propS[0].getStringArrayValue().length == propS[3] +// .getLogicalValueArray().length +// && propS[0].getStringArrayValue().length == propS[4] +// .getLogicalValueArray().length +// && propS[0].getStringArrayValue().length == propS[5] +// .getLogicalValueArray().length +// && propS[0].getStringArrayValue().length == propS[6] +// .getLogicalValueArray().length +// && propS[0].getStringArrayValue().length == propS[7] +// .getLogicalValueArray().length) { +// for (int i = 0; i < propS[0].getStringArrayValue().length; i++) { +// BZGXBean bean = new BZGXBean(); +// bean.hx3_gxbz = propS[0].getStringArrayValue()[i]; // ׼ +// bean.hx3_gxsm = propS[1].getStringArrayValue()[i];// ˵ +// bean.hx3_gzzx = propS[2].getStringArrayValue()[i];// , +// bean.hx3_gzzxmc = propS[2].getDisplayableValues() +// .get(i);// +// bean.hx3_dcgx1 = propS[3].getLogicalValueArray()[i];// 幤 +// bean.hx3_bgd1 = propS[4].getLogicalValueArray()[i];// +// bean.hx3_wwgx1 = propS[5].getLogicalValueArray()[i];// ί⹤ +// bean.hx3_jfd1 = propS[6].getLogicalValueArray()[i];// Ʒѵ +//// bean.hx3_jhwwgx1 = propS[7].getLogicalValueArray()[i];// ƻί⹤ +// if (!bzgxMap.containsKey(bean.hx3_gxbz)) { +// System.out.println("׼ =>" + bean.hx3_gxbz); +// List bzgxBeanList = new ArrayList<>(); +// bzgxBeanList.add(bean); +// bzgxMap.put(bean.hx3_gxsm, bzgxBeanList); +// }else{ +// List bzgxBeanList = bzgxMap.get(bean.hx3_gxbz); +// bzgxBeanList.add(bean); +// } +// } +// +// } else { +// System.out.println("׼ijȲͬ"); +// } +// +// } else { +// System.out.println("ȡ׼ִ"); +// } +// +// } +// +// } catch (TCException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } +// +// } +// +// /** +// * ͨFormϹϢ +// * +// * @throws TCException +// */ +// public void getFormMsg() throws TCException { +// getBZGXList(); +// TCComponentItemRevision rev = (TCComponentItemRevision) formComp +// .getReferenceProperty("item_revision");// ȡڵİ汾 +// if (rev == null) { +// System.out.println("ûҵ汾"); +// return; +// } +// TCComponentItem item = rev.getItem(); +// if (item == null) { +// System.out.println("ûҵ"); +// return; +// } +// AIFComponentContext[] aifContext = item.whereReferencedByTypeRelation( +// new String[] { "HX3_WLRevision" }, +// new String[] { "HX3_GYLXRelation" }); +// if (aifContext == null || aifContext.length == 0 +// || aifContext.length > 1) { +// System.out.println("ǰ·߹˶ϰ汾"); +// } +// firstBean = new BomStructBean(); +// TCComponentBOMLine topLine = null; +// if(aifContext != null && aifContext.length>0){ +// TCComponentItemRevision wlRev = ((TCComponentItemRevision) aifContext[0] +// .getComponent()); +// bomMsg = HxomMethodUtil.getTopLineByRev2(wlRev); +// topLine = bomMsg.line; +// } +// if (topLine == null) { +// System.out.println("ǰûBOMϢ"); +// return; +// +// } +// exchangeLineToBean(firstBean, topLine); +// +// } +// +// /** +// * FORMʱȡ +// */ +// public void getFormVlue() { +// +// this.valueLists = new ArrayList<>(); +// try { +// +// // ȡֵ +// propertiesArray = formComp.getTCProperties(TM2_PROCESS_PROP_NAMES); +// // дֵԵ +// if (propertiesArray != null) { +// String[] valueStrs0 = propertiesArray[0] == null ? new String[0] +// : propertiesArray[0].getStringArrayValue(); +// String[] valueStrs1 = propertiesArray[1] == null ? new String[0] +// : propertiesArray[1].getStringArrayValue(); +// String[] valueStrs2 = propertiesArray[2] == null ? new String[0] +// : propertiesArray[2].getStringArrayValue(); +// String[] valueStrs3 = propertiesArray[3] == null ? new String[0] +// : propertiesArray[3].getStringArrayValue(); +// String[] valueStrs4 = propertiesArray[4] == null ? new String[0] +// : propertiesArray[4].getStringArrayValue(); +//// String[] valueStrs5 = propertiesArray[5] == null ? new String[0] +//// : propertiesArray[5].getStringArrayValue(); +//// boolean[] valueStrs6 = propertiesArray[6] == null ? new boolean[0] +//// : propertiesArray[6].getBoolArrayValue(); +//// boolean[] valueStrs7 = propertiesArray[7] == null ? new boolean[0] +//// : propertiesArray[7].getBoolArrayValue(); +//// boolean[] valueStrs8 = propertiesArray[8] == null ? new boolean[0] +//// : propertiesArray[8].getBoolArrayValue(); +//// boolean[] valueStrs9 = propertiesArray[9] == null ? new boolean[0] +//// : propertiesArray[9].getBoolArrayValue(); +//// boolean[] valueStrs10 = propertiesArray[10] == null ? new boolean[0] +//// : propertiesArray[10].getBoolArrayValue(); +//// Date[] valueStrs11 = propertiesArray[11] == null ? new Date[0] +//// : propertiesArray[11].getDateValueArray();// Date +//// Date[] valueStrs12 = propertiesArray[12] == null ? new Date[0] +//// : propertiesArray[12].getDateValueArray();// Date +//// String[] valueStrs13 = propertiesArray[13] == null ? new String[0] +//// : propertiesArray[13].getStringArrayValue(); +//// String[] valueStrs14 = propertiesArray[14] == null ? new String[0] +//// : propertiesArray[14].getStringArrayValue(); +//// String[] valueStrs15 = propertiesArray[15] == null ? new String[0] +//// : propertiesArray[15].getStringArrayValue();// TypedReference +// +// if (valueStrs0.length == valueStrs1.length +// && valueStrs0.length == valueStrs2.length +// && valueStrs0.length == valueStrs3.length +// && valueStrs0.length == valueStrs4.length +//// && valueStrs0.length == valueStrs5.length +//// && valueStrs0.length == valueStrs6.length +//// && valueStrs0.length == valueStrs7.length +//// && valueStrs0.length == valueStrs8.length +//// && valueStrs0.length == valueStrs9.length +//// && valueStrs0.length == valueStrs10.length +//// && valueStrs0.length == valueStrs11.length +//// && valueStrs0.length == valueStrs12.length +//// && valueStrs0.length == valueStrs13.length +//// && valueStrs0.length == valueStrs14.length +//// && valueStrs0.length == valueStrs15.length +// +// && valueStrs0.length != 0) { +// for (int i = 0; i < valueStrs0.length; i++) { +// JK3_XCPXHFormPropBean bean = new JK3_XCPXHFormPropBean(); +// bean.jk3_xh = valueStrs0[i];// "", +// +// bean.jk3_cpxh = valueStrs1[i];// "Ʒͺ", +// bean.jk3_sbh = valueStrs2[i];// "ʶ", +// bean.jk3_mc = valueStrs3[i];// "", +// bean.jk3_sysc = valueStrs4[i];// "г",// 5 +//// bean.hx3_mjbh = valueStrs5[i];// "ģ߱", +//// bean.hx3_dcgx1 = valueStrs6[i];// "幤", +//// bean.hx3_bgd1 = valueStrs7[i];// "", +//// bean.hx3_wwgx1 = valueStrs8[i];// "ί⹤", +//// bean.hx3_jfd1 = valueStrs9[i];// "Ʒѵ",// 10 +//// bean.hx3_jhwwgx1 = valueStrs10[i];// "ƻί⹤", +//// +//// bean.hx3_sxrq = valueStrs11[i];// "Ч", +//// bean.hx3_shixrq = valueStrs12[i];// "ʧЧ", +//// bean.hx3_gywjbh = valueStrs13[i];// "ļ", +//// bean.hx3_gywjbb = valueStrs14[i];// "ļ汾", // 15 +//// bean.hx3_lywl = valueStrs15[i];// "", +// +// this.valueLists.add(bean); +// +// +// } +// } +// } +// Collections.sort(this.valueLists); +// } catch (TCException e) { +// e.printStackTrace(); +// } +// +// } +// +// /** +// * +// */ +// public void saveWLProps() { +// if (valueLists == null) { +// System.out.println("бΪ"); +// return; +// } +// Collections.sort(this.valueLists); +// // List gxbbList = new ArrayList<>(); +// // for (int i = 0; i < valueLists.size(); i++) { +// // HX3_GYLXRevisionFormPropBean bean = valueLists.get(i); +// // +// // } +// try { +// HxomMethodUtil.setByPass(true); +// } catch (TCException e2) { +// // TODO Auto-generated catch block +// e2.printStackTrace(); +// } +// String[] valueStrs0 = new String[valueLists.size()]; +// String[] valueStrs1 = new String[valueLists.size()]; +// String[] valueStrs2 = new String[valueLists.size()]; +// String[] valueStrs3 = new String[valueLists.size()]; +// String[] valueStrs4 = new String[valueLists.size()]; +// String[] valueStrs5 = new String[valueLists.size()]; +// +// boolean[] valueStrs6 = new boolean[valueLists.size()]; +// boolean[] valueStrs7 = new boolean[valueLists.size()]; +// boolean[] valueStrs8 = new boolean[valueLists.size()]; +// boolean[] valueStrs9 = new boolean[valueLists.size()]; +// boolean[] valueStrs10 = new boolean[valueLists.size()]; +// Date[] valueStrs11 = new Date[valueLists.size()]; +// Date[] valueStrs12 = new Date[valueLists.size()]; +// String[] valueStrs13 = new String[valueLists.size()]; +// String[] valueStrs14 = new String[valueLists.size()]; +// String[] valueStrs15 = new String[valueLists.size()]; +// +// for (int i = 0; i < valueLists.size(); i++) { +// JK3_XCPXHFormPropBean bean = valueLists.get(i); +// valueStrs0[i] = bean.jk3_xh == null ? "" : bean.jk3_xh; +// valueStrs1[i] = bean.jk3_cpxh == null ? "" : bean.jk3_cpxh; +// valueStrs2[i] = bean.jk3_sbh == null ? "" : bean.jk3_sbh; +// valueStrs3[i] = bean.jk3_mc == null ? "" : bean.jk3_mc; +// valueStrs4[i] = bean.jk3_sysc == null ? "" : bean.jk3_sysc; +//// valueStrs5[i] = bean.hx3_mjbh == null ? "" : bean.hx3_mjbh; +//// valueStrs6[i] = bean.hx3_dcgx1; +//// valueStrs7[i] = bean.hx3_bgd1; +//// valueStrs8[i] = bean.hx3_wwgx1; +//// valueStrs9[i] = bean.hx3_jfd1; +//// valueStrs10[i] = bean.hx3_jhwwgx1; +//// valueStrs11[i] = bean.hx3_sxrq; +//// valueStrs12[i] = bean.hx3_shixrq; +//// valueStrs13[i] = bean.hx3_gywjbh == null ? "" : bean.hx3_gywjbh; +//// valueStrs14[i] = bean.hx3_gywjbb == null ? "" : bean.hx3_gywjbb; +//// valueStrs15[i] = bean.hx3_lywl == null ? "" : bean.hx3_lywl; +// } +// try { +// if (propertiesArray[0] != null) +// propertiesArray[0].setStringValueArray(valueStrs0); +// if (propertiesArray[1] != null) +// propertiesArray[1].setStringValueArray(valueStrs1); +// if (propertiesArray[2] != null) +// propertiesArray[2].setStringValueArray(valueStrs2); +// if (propertiesArray[3] != null) +// propertiesArray[3].setStringValueArray(valueStrs3); +// if (propertiesArray[4] != null) +// propertiesArray[4].setStringValueArray(valueStrs4); +//// if (propertiesArray[5] != null) +//// propertiesArray[5].setStringValueArray(valueStrs5); +//// if (propertiesArray[6] != null) +//// propertiesArray[6].setLogicalValueArray(valueStrs6); +//// if (propertiesArray[7] != null) +//// propertiesArray[7].setLogicalValueArray(valueStrs7); +//// if (propertiesArray[8] != null) +//// propertiesArray[8].setLogicalValueArray(valueStrs8); +//// if (propertiesArray[9] != null) +//// propertiesArray[9].setLogicalValueArray(valueStrs9); +//// if (propertiesArray[10] != null) +//// propertiesArray[10].setLogicalValueArray(valueStrs10); +//// if (propertiesArray[11] != null) +//// propertiesArray[11].setDateValueArray(valueStrs11); +//// if (propertiesArray[12] != null) +//// propertiesArray[12].setDateValueArray(valueStrs12); +//// if (propertiesArray[13] != null) +//// propertiesArray[13].setStringValueArray(valueStrs13); +//// if (propertiesArray[14] != null) +//// propertiesArray[14].setStringValueArray(valueStrs14); +//// if (propertiesArray[15] != null) +//// propertiesArray[15].setStringValueArray(valueStrs15); +// +// formComp.setTCProperties(propertiesArray); +// +// List lineList = new ArrayList<>(); +// List propList = new ArrayList<>(); +// +// if (this.firstBean != null) { +// +// if (this.firstBean.getChlidLineS() != null) { +// +// for (BomStructBean structBean : this.firstBean +// .getChlidLineS()) { +// setBomlineProp(structBean, lineList, propList); +// } +// } +// +// TCProperty[][] props = new TCProperty[propList.size()][1]; +// +// for (int j = 0; j < propList.size(); j++) { +// props[j][0] = propList.get(j); +// } +// +// if (bomMsg.window != null) { +// bomMsg.window.lock(); +// TCComponentType.setPropertiesSet( +// lineList.toArray(new TCComponent[lineList.size()]), +// props); +// bomMsg.window.save(); +// bomMsg.window.unlock(); +// bomMsg.window.close(); +// +// } +// +// } +// +// } catch (TCException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } catch (Exception e1) { +// e1.printStackTrace(); +// } +// try { +// HxomMethodUtil.setByPass(false); +// } catch (TCException e2) { +// // TODO Auto-generated catch block +// e2.printStackTrace(); +// } +// } +// +// /** +// * +// * @param bean +// * @throws TCException +// */ +// public void setBomlineProp(BomStructBean bean, List lineList, +// List propList) throws TCException { +// +// if (bean == null) { +// return; +// } +// lineList.add(bean.getBomLine()); +// TCProperty prop = bean.getBomLine().getTCProperty("HX3_gxhh"); +// prop.setStringValue(bean.getGxh()); +// // bean.getBomLine().lock(); +// // bean.getBomLine().setTCProperty(prop); +// // bean.getBomLine().save(); +// // bean.getBomLine().unlock(); +// propList.add(prop); +// +// if (bean.getChlidLineS() != null && bean.getChlidLineS().size() > 0) { +// for (BomStructBean child : bean.getChlidLineS()) { +// setBomlineProp(child, lineList, propList); +// } +// } +// +// } +// +// /** +// * ǩ벢 +// */ +// @Override +// public boolean checkForSave(Object obj) { +// // TODO Auto-generated method stub +// over = true; +// saveWLProps(); +// +// System.out.println("ǩ벢"); +// return super.checkForSave(obj); +// } +// +// /** +// * +// */ +// @Override +// public void save() { +// // TODO Auto-generated method stub +// over = true; +// saveWLProps(); +// +// System.out.println(""); +// super.save(); +// } +// +//// public JPanel loadPanel(JPanel jp1,Jpanel jp2 ){ +//// +//// } +// +// +// public void init() { +// System.out.println("====>>>> ʼ a <1>"); +// // clorMap = new HashMap(); +// // fontMap = new HashMap(); +// valueLists = new ArrayList(); +// getFormVlue(); +// this.setLayout(new BorderLayout()); +// this.setBackground(Color.WHITE); +// rootPanel = new JPanel(new BorderLayout()); +//// addButton = new JButton(""); +//// +//// addButton.setEnabled(true); +//// insertButton = new JButton(""); +//// insertButton.setEnabled(true); +//// delButton = new JButton("ɾ"); +//// delButton.setEnabled(true); +// emptyLable = new JLabel(" "); +// +//// addButton.addActionListener(new ActionListener() { +//// @Override +//// public void actionPerformed(ActionEvent e) { +//// addRow(e); +//// } +//// }); +//// +//// insertButton.addActionListener(new ActionListener() { +//// @Override +//// public void actionPerformed(ActionEvent e) { +//// insertRow(e); +//// } +//// }); +//// +//// delButton.addActionListener(new ActionListener() { +//// @Override +//// public void actionPerformed(ActionEvent e) { +//// delRow(e); +//// } +//// }); +// // TODO Table +// this.partsTable = getjTable(partsTable, this.dtm, this.titleNames, +// getValues(valueLists)); +//// final MouseInputListener mouseInputListener = getMouseInputListener(partsTable);// Ҽѡ +// +//// partsTable.addMouseListener(mouseInputListener); +// +// this.topPanel = new JPanel(new BorderLayout()); +// scrollPanel = new JScrollPane(); +// scrollPanel.getViewport().add(partsTable, null); +// scrollPanel.validate(); +// +// this.topPanel.add(BorderLayout.CENTER, scrollPanel); +// +//// this.buttomPanel = new JPanel(new ButtonLayout(ButtonLayout.VERTICAL)); +//// this.buttomPanel.add(addButton); +//// this.buttomPanel.add(new JLabel(" ")); +//// this.buttomPanel.add(insertButton); +//// this.buttomPanel.add(emptyLable); +//// this.buttomPanel.add(delButton); +// +// this.rootPanel = new JPanel(new BorderLayout()); +// this.rootPanel.add(BorderLayout.CENTER, topPanel); +// // this.rootPanel.add(BorderLayout.SOUTH, buttomPanel); +// +// JTabbedPane tabPane = new JTabbedPane(); +// +// +// String title1 = "ñ"; +// String title2="ҵ"; +//// if(titleName!=null) +//// { +//// title = titleName; +//// } +// tabPane.add(title1, new JScrollPane(rootPanel)); +// tabPane.add(title2, new JScrollPane(rootPanel)); +// +// this.setLayout(new BorderLayout()); +//// this.add(buttomPanel, BorderLayout.EAST); +// this.add(tabPane, BorderLayout.CENTER); +// } +//// +//// private void addRow(ActionEvent e) { +//// +//// JK3_XCPXHFormPropBean bean = new JK3_XCPXHFormPropBean(); +//// try { +//// bean.hx3_sxrq = sdf.parse("2000-01-01"); +//// bean.hx3_shixrq = sdf.parse("2099-12-31"); +//// } catch (ParseException e1) { +//// // TODO Auto-generated catch block +//// e1.printStackTrace(); +//// } +//// +//// Object[] objs = new Object[] { bean.hx3_gxhh, bean.hx3_bzgx, +//// bean.hx3_gxsm, bean.hx3_gzzx, bean.hx3_gzzxmc, bean.hx3_mjbh, +//// bean.hx3_dcgx1, bean.hx3_bgd1, bean.hx3_wwgx1, bean.hx3_jfd1, +//// bean.hx3_jhwwgx1, sdf.format(bean.hx3_sxrq), +//// sdf.format(bean.hx3_shixrq), bean.hx3_gywjbh, bean.hx3_gywjbb, +//// bean.hx3_lywl}; +//// +//// valueLists.add(bean); +//// ((DefaultTableModel) this.partsTable.getModel()).addRow(objs); +//// +//// ((DefaultTableModel) this.partsTable.getModel()) +//// .fireTableStructureChanged(); +//// ((DefaultTableModel) this.partsTable.getModel()).fireTableDataChanged(); +//// scrollPanel.validate(); +//// +//// } +//// +//// private void insertRow(ActionEvent e) { +//// int index = partsTable.getSelectedRow(); +//// if (partsTable.getRowCount() == 0) { +//// index = 0; +//// } +//// // if (index == -1) { +//// // MessageBox.post("ѡִɾ", "Warning", MessageBox.WARNING); +//// // return; +//// // } +//// HX3_GYLXRevisionFormPropBean bean = new HX3_GYLXRevisionFormPropBean(); +//// try { +//// bean.hx3_sxrq = sdf.parse("2000-01-01"); +//// bean.hx3_shixrq = sdf.parse("2099-12-31"); +//// } catch (ParseException e1) { +//// // TODO Auto-generated catch block +//// e1.printStackTrace(); +//// } +//// +//// Object[] objs = new Object[] { bean.hx3_gxhh, bean.hx3_bzgx, +//// bean.hx3_gxsm, bean.hx3_gzzx, bean.hx3_gzzxmc, bean.hx3_mjbh, +//// bean.hx3_dcgx1, bean.hx3_bgd1, bean.hx3_wwgx1, bean.hx3_jfd1, +//// bean.hx3_jhwwgx1, sdf.format(bean.hx3_sxrq), +//// sdf.format(bean.hx3_shixrq), bean.hx3_gywjbh, bean.hx3_gywjbb, +//// bean.hx3_lywl }; +//// if (index != -1) { +//// valueLists.add(index, bean); +//// ((DefaultTableModel) this.partsTable.getModel()).insertRow(index, +//// objs); +//// } else { +//// valueLists.add(bean); +//// ((DefaultTableModel) this.partsTable.getModel()).addRow(objs); +//// } +//// +//// ((DefaultTableModel) this.partsTable.getModel()) +//// .fireTableStructureChanged(); +//// ((DefaultTableModel) this.partsTable.getModel()).fireTableDataChanged(); +//// scrollPanel.validate(); +//// } +//// +//// private void delRow(ActionEvent e) { +//// int index = partsTable.getSelectedRow(); +//// if (index == -1) { +//// MessageBox.post("ѡִɾ", "", MessageBox.WARNING); +//// return; +//// } +////// if(valueLists.get(index).hx3_lywl!=null){ +////// if(!valueLists.get(index).hx3_lywl.trim().isEmpty()){ +////// MessageBox.post("ƳϺִɾ", "", MessageBox.WARNING); +////// return; +////// } +////// } +//// valueLists.remove(index); +//// ((DefaultTableModel) this.partsTable.getModel()).removeRow(index); +//// ((DefaultTableModel) this.partsTable.getModel()) +//// .fireTableStructureChanged(); +//// ((DefaultTableModel) this.partsTable.getModel()).fireTableDataChanged(); +//// scrollPanel.validate(); +//// } +// +// /***************************************************/ +// +// /** +// * JTABLEͨ÷ +// * +// * @param partsTable +// * @param titleNames +// * @return +// */ +// public JTable getjTable(JTable partsTable, DefaultTableModel dtm, +// Object[] titleNames, Object[][] values) { +// int simpleLen = 72; +// int totleLen = 900; +// if (partsTable == null) { +// //partsTable.isCellEditable(arg0, arg1) +// +// partsTable = new JTable(getTableModel(dtm, titleNames, values)) { +// @Override +// public boolean isCellEditable(int row, int column) { +// +// if (column == 15|| column == 1|| (column >2 && column < 5) +// || (column > 5 && column < 13)){ +// return false; +// }else if(column == 0){ +//// if(valueLists.get(row).hx3_lywl ==null || valueLists.get(row).hx3_lywl.trim().isEmpty()){ +//// return true; +//// } +// return false; +// } +// else{ +// +// +// +// return true; +// } +// } +// +// }; +// +// partsTable.setDefaultRenderer(Object.class, +// new TableCellTextAreaRenderer()); +// +// partsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); +// +// if (simpleLen * titleNames.length >= totleLen) { +// for (int i = 0; i < titleNames.length; i++) { +// partsTable.getColumnModel().getColumn(i) +// .setPreferredWidth(72); +// } +// partsTable.setAutoResizeMode(0); +// +// } else { +// // System.out.println("auto size"); +// partsTable.setAutoResizeMode(1); +// } +// +// } +// return partsTable; +// } +// +// public DefaultTableModel getTableModel(DefaultTableModel dtm, +// Object[] columNameObjects, Object[][] objects) { +// // Object[] columNameObjects = this.titleNames; //// , +// // Object[][] objects = getValues(this.valueLists); +// if (dtm == null) { +// dtm = new DefaultTableModel(objects, columNameObjects); +// } +// return dtm; +// } +// +// public Object[][] getValues(List beanList) { +// Object[][] objects = new Object[beanList.size()][JK3_XCPXHFormPropBean.COUNT]; +// +// for (int i = 0; i < beanList.size(); i++) { +// // objects[i][0] =beanList.get(i).getIndex(); +// objects[i][0] = beanList.get(i).jk3_xh;// "", +// +// objects[i][1] = beanList.get(i).jk3_cpxh;// "Ʒͺ", +// objects[i][2] = beanList.get(i).jk3_sbh;// "ʶ", +// objects[i][3] = beanList.get(i).jk3_mc;// "", +// objects[i][4] = beanList.get(i).jk3_sysc;// "г",// 5 +//// objects[i][5] = beanList.get(i).hx3_mjbh;// "ģ߱", +//// objects[i][6] = beanList.get(i).hx3_dcgx1;// "幤", +//// objects[i][7] = beanList.get(i).hx3_bgd1;// "", +//// objects[i][8] = beanList.get(i).hx3_wwgx1;// "ί⹤", +//// objects[i][9] = beanList.get(i).hx3_jfd1;// "Ʒѵ",// 10 +//// objects[i][10] = beanList.get(i).hx3_jhwwgx1;// "ƻί⹤", +//// objects[i][11] = sdf.format(beanList.get(i).hx3_sxrq);// "Ч", +//// objects[i][12] = sdf.format(beanList.get(i).hx3_shixrq);// "ʧЧ", +//// objects[i][13] = beanList.get(i).hx3_gywjbh;// "ļ", +//// objects[i][14] = beanList.get(i).hx3_gywjbb;// "ļ汾", // 15 +//// objects[i][15] = beanList.get(i).hx3_lywl;// "", +// // objects[i][16] = beanList.get(i).hx3_lywlid; +// } +// return objects; +// } +// +// public void setClipboard(String str) { +// StringSelection ss = new StringSelection(str); +// Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null); +// } +// +// /**************************************************/ +// @Override +// public void actionPerformed(ActionEvent e) { +// // TODO Auto-generated method stub +// +// } +// +// @Override +// public void loadRendering() throws TCException { +// // TODO Auto-generated method stub +// init(); +// } +// +// @Override +// public void saveRendering() { +// // TODO Auto-generated method stub +// +// } +// +// public static void main(String[] args) { +// +// } +// +// /** +// * BOM +// * +// * @param bean +// * @param line +// * @throws TCException +// */ +// public void exchangeLineToBean(BomStructBean bean, TCComponentBOMLine line) +// throws TCException { +// if (line == null && bean != null) { +// return; +// } +// bean.setBomLine(line); +// List childBeanList = new ArrayList<>(); +// +// AIFComponentContext[] contextS = line.getChildren(); +// if (contextS != null) { +// for (AIFComponentContext context : contextS) { +// BomStructBean childBean = new BomStructBean(); +// TCComponentBOMLine childLine = (TCComponentBOMLine) context +// .getComponent(); +// // childBean.setBomLine(childLine); +// childBeanList.add(childBean); +// exchangeLineToBean(childBean, childLine); +// } +// } +// bean.setChlidLineS(childBeanList); +// +// } +// +// /** +// * +// * ҼѡʾҼ˵ +// */ +// private MouseInputListener getMouseInputListener(final JComponent jTable) { +// return new MouseInputListener() { +// public void mouseClicked(MouseEvent e) { +// processEvent(e); +// System.out.println(" =>>>> mouseClicked"); +// } +// +// public void mousePressed(MouseEvent e) { +// processEvent(e); +// System.out.println(" =>>>> mousePressed"); +// } +// +// public void mouseReleased(MouseEvent e) { +// processEvent(e); +// System.out.println(" =>>> mouseReleased"); +// System.out +// .println(" jTable.isEnabled() =" + jTable.isEnabled()); +// if (!jTable.isEnabled()) { +// System.out.println("ؼʹ"); +// return; +// } +// if ((e.getModifiers() & MouseEvent.BUTTON3_MASK) != 0 +// && !e.isControlDown() && !e.isShiftDown()) { +// // popupMenu.show(tableLyz, e.getX(), e.getY());//Ҽ˵ʾ +// JMenu a = new JMenu(""); +// JMenuItem c = new JMenuItem(""); +// c.addMouseListener(new MouseListener() { +// @Override +// public void mouseReleased(MouseEvent arg0) { +// +// } +// +// @Override +// public void mousePressed(MouseEvent arg0) { +// System.out.println("++++++++++++++"); +// // new Thread(bomJTree).start(); +// selectTableBean = valueLists.get(((JTable) jTable) +// .getSelectedRow()); +// if (selectTableBean.jk3_xh == null +// || selectTableBean.jk3_xh.trim() +// .isEmpty()) { +// MessageBox.post("кΪգдк֮", "", +// MessageBox.WARNING); +// } else { +// bomJTree.showDialog(valueLists +// .get(((JTable) jTable).getSelectedRow())); +// } +// +// } +// +// @Override +// public void mouseExited(MouseEvent arg0) { +// // TODO Auto-generated method stub +// // System.out.println("3333333333"); +// } +// +// @Override +// public void mouseEntered(MouseEvent arg0) { +// // TODO Auto-generated method stub +// // System.out.println("2222222222"); +// } +// +// @Override +// public void mouseClicked(MouseEvent arg0) { +// // TODO Auto-generated method stub +// // System.out.println("1111111111"); +// } +// }); +// //JMenuItem d = new JMenuItem("Ƴ"); +// +// a.add(c); +// //a.add(d); +// JPopupMenu b = new JPopupMenu(); +// b = a.getPopupMenu(); +// b.show(jTable, e.getX(), e.getY()); +// +// } +// +// } +// +// public void mouseEntered(MouseEvent e) { +// +// processEvent(e); +// +// } +// +// public void mouseExited(MouseEvent e) { +// +// processEvent(e); +// +// } +// +// public void mouseDragged(MouseEvent e) { +// +// processEvent(e); +// +// } +// +// public void mouseMoved(MouseEvent e) { +// +// processEvent(e); +// +// } +// +// private void processEvent(MouseEvent e) { +// +// if ((e.getModifiers() & MouseEvent.BUTTON3_MASK) != 0) { +// +// int modifiers = e.getModifiers(); +// +// modifiers -= MouseEvent.BUTTON3_MASK; +// +// modifiers |= MouseEvent.BUTTON1_MASK; +// +// MouseEvent ne = new MouseEvent(e.getComponent(), e.getID(), +// +// e.getWhen(), modifiers, e.getX(), e.getY(), e +// +// .getClickCount(), false); +// +// jTable.dispatchEvent(ne); +// } +// } +// }; +// } +// +// class TableCellTextAreaRenderer extends JTextArea implements +// TableCellRenderer { +// private BZGXBean bean = null; +// +// public TableCellTextAreaRenderer() { +// setLineWrap(true); +// setWrapStyleWord(true); +// } +// +// public Component getTableCellRendererComponent(JTable table, +// Object value, boolean isSelected, boolean hasFocus, int row, +// int column) { +// +// // 㵱еѸ߶ +// int maxPreferredHeight = 0; +// for (int i = 0; i < table.getColumnCount(); i++) { +// setText("" + table.getValueAt(row, i)); +// setSize(table.getColumnModel().getColumn(column).getWidth(), 0); +// maxPreferredHeight = Math.max(maxPreferredHeight, +// getPreferredSize().height); +// } +// +// if (table.getRowHeight(row) != maxPreferredHeight) // Ϲæ +// table.setRowHeight(row, maxPreferredHeight); +// +// setText(value == null ? "" : value.toString()); +// // table.setSelectionBackground(Color.yellow); +// Font fp = new Font("Menu.font", Font.PLAIN, 14); +// Font fb = new Font("Menu.font", Font.BOLD, 14); +// if (isSelected) { +// this.setFont(fb); +// +// } else { +// this.setFont(fp); +// } +// +// if (isSelected +// && hasFocus +// && row == table.getSelectedRow() +// && column == table.getSelectedColumn() +// && !((column ==1)||(column > 2 && column < 5) || (column > 5 && column < 11))) { +// +// bean = null; +// System.out.println(" => " + table.getValueAt(row, 2)); +// if (bzgxMap.containsKey(table.getValueAt(row, 2))) { +// bean = bzgxMap.get(table.getValueAt(row, 2)).get(0); +// +// System.out.println("contains "); +// } else { +// System.out.println("not contains "); +// } +// switch (column) { +// case 0: +// valueLists.get(row).jk3_xh = value == null ? "" : value +// .toString(); +// break; +// case 2: +// if (bean == null) { +// +//// valueLists.get(row).hx3_bzgx = ""; +//// table.setValueAt("", row, 1); +//// valueLists.get(row).hx3_gzzx = ""; +//// table.setValueAt("", row, 3); +//// valueLists.get(row).hx3_gzzxmc = ""; +//// table.setValueAt("", row, 4); +//// valueLists.get(row).hx3_dcgx1 = false; +//// table.setValueAt(false, row, 6); +//// valueLists.get(row).hx3_bgd1 = false; +//// table.setValueAt(false, row, 7); +//// valueLists.get(row).hx3_wwgx1 = false; +//// table.setValueAt(false, row, 8); +//// valueLists.get(row).hx3_jfd1 = false; +//// table.setValueAt(false, row, 9); +//// valueLists.get(row).hx3_jhwwgx1 = false; +//// table.setValueAt(false, row, 10); +//// valueLists.get(row).hx3_gxsm = value == null ? "" +//// : value.toString(); +// } else { +//// valueLists.get(row).hx3_bzgx = bean.hx3_gxbz; +//// table.setValueAt(bean.hx3_gxbz, row, 1); +//// valueLists.get(row).hx3_gzzx = bean.hx3_gzzx; +//// table.setValueAt(bean.hx3_gzzx, row, 3); +//// valueLists.get(row).hx3_gzzxmc = bean.hx3_gzzxmc; +//// table.setValueAt(bean.hx3_gzzxmc, row, 4); +//// valueLists.get(row).hx3_dcgx1 = bean.hx3_dcgx1; +//// table.setValueAt(bean.hx3_dcgx1, row, 6); +//// valueLists.get(row).hx3_bgd1 = bean.hx3_bgd1; +//// table.setValueAt(bean.hx3_bgd1, row, 7); +//// valueLists.get(row).hx3_wwgx1 = bean.hx3_wwgx1; +//// table.setValueAt(bean.hx3_wwgx1, row, 8); +//// valueLists.get(row).hx3_jfd1 = bean.hx3_jfd1; +//// table.setValueAt(bean.hx3_jfd1, row, 9); +//// valueLists.get(row).hx3_jhwwgx1 = bean.hx3_jhwwgx1; +//// table.setValueAt(bean.hx3_jhwwgx1, row, 10); +//// valueLists.get(row).hx3_gxsm = (String) value; +// } +// +// break; +// +// case 3: +// // if (bean != null) { +// // value = bean.hx3_gzzx; +// // } else { +// // value = ""; +// // } +// // +// // valueLists.get(row).hx3_gzzx = value == null ? "" : value +// // .toString(); +// break; +// case 4: +// // if (bean != null) { +// // value = bean.hx3_gzzxmc; +// // } else { +// // value = ""; +// // } +// // valueLists.get(row).hx3_gzzxmc = value == null ? "" : +// // value +// // .toString(); +// break; +// case 5: +// +//// valueLists.get(row).hx3_mjbh = value == null ? "" : value +//// .toString(); +// break; +// case 6: +// // if (bean != null) { +// // value = bean.hx3_dcgx1; +// // } else { +// // value = false; +// // } +// // valueLists.get(row).hx3_dcgx1 = (boolean) value; +// break; +// case 7: +// // if (bean != null) { +// // value = bean.hx3_bgd1; +// // } else { +// // value = false; +// // } +// // valueLists.get(row).hx3_bgd1 = (boolean) value; +// +// break; +// case 8: +// // if (bean != null) { +// // value = bean.hx3_wwgx1; +// // } else { +// // value = false; +// // } +// // valueLists.get(row).hx3_wwgx1 = (boolean) value; +// +// break; +// case 9: +// // if (bean != null) { +// // value = bean.hx3_jfd1; +// // } else { +// // value = false; +// // } +// // valueLists.get(row).hx3_jfd1 = (boolean) value; +// +// break; +// case 10: +// // if (bean != null) { +// // value = bean.hx3_jhwwgx1; +// // } else { +// // value = false; +// // } +// // valueLists.get(row).hx3_jhwwgx1 = (boolean) value; +// +// break; +// +//// case 13: +//// valueLists.get(row).hx3_gywjbh = value == null ? "" : value +//// .toString(); +//// break; +//// case 14: +//// valueLists.get(row).hx3_gywjbb = value == null ? "" : value +//// .toString(); +//// break; +// +// default: +// break; +// +// } +// +// // 2.õǰCellɫ +// // Component c = super.getTableCellRendererComponent(table, +// // value, +// // isSelected, hasFocus, row, column); +// this.setBackground(Color.yellow);// ñɫ +// this.setForeground(Color.BLACK);// ǰɫ +// return this; +// } else { +// +// // 3.õУżеɫ +// if (row % 2 == 0) {// żʱɫ +// setBackground(Color.white); +// } else if (row % 2 == 1) {// õеɫ +// setBackground(Color.white); +// } +// if (isSelected) { +// this.setBackground(Color.LIGHT_GRAY);// ñɫ +// } +// return this; +// } +// +// // return this; +// } +// } +// +//} diff --git a/src/com/teamcenter/rac/form/JK8DerPCBNOAppForm.java b/src/com/teamcenter/rac/form/JK8DerPCBNOAppForm.java new file mode 100644 index 0000000..3a91cb6 --- /dev/null +++ b/src/com/teamcenter/rac/form/JK8DerPCBNOAppForm.java @@ -0,0 +1,379 @@ +package com.teamcenter.rac.form; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionListener; +import java.util.HashMap; +import java.util.Map; + +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; + +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCComponentType; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.stylesheet.AbstractRendering; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; +import com.teamcenter.rac.util.combobox.iComboBox; + +public class JK8DerPCBNOAppForm extends AbstractRendering implements ItemListener{ + + private TCComponentForm form; + private TCSession session; + private HashMap realNameMap; + public JK8DerPCBNOAppForm(TCComponentForm arg0) throws Exception { + super(arg0); + form=arg0; + session = arg0.getSession(); + String[] names = session.getPreferenceService().getStringValues( + "JK8PCBNORegForm"); + if (names != null) { + + realNameMap = new HashMap<>(); + for (int i = 0; i < names.length; i++) { + String[] s = names[i].split("="); + if (s != null && s.length == 2) { + String key = s[0]; + String value = s[1]; + realNameMap.put(key, value); + } + + } + + } else { + MessageBox.post("ѡ JK8PCBNORegForm ڣϵԱ", "", + MessageBox.ERROR); + } + initializeUI(); + loadRendering(); + } + + private void initializeUI() { + // TODO Auto-generated method stub + System.out.println("UI-----Start"); + initPanel(); + //lovóɲɱ༭ + mainPanel.addMouseMotionListener(new MouseMotionListener() { + + @Override + public void mouseMoved(MouseEvent e) { +// Companylogo.setEnabled(false); +// MeasureType.setEnabled(false); +// CommunicateMode.setEnabled(false); +// Application.setEnabled(false); + } + + @Override + public void mouseDragged(MouseEvent e) { + // TODO Auto-generated method stub + + } + }); + } +private JLabel tableName=new JLabel("PCBϢǼ"); + + private JLabel jk8BasePCBNO;//ͺPCB + private JButton checkButton;//У + private JLabel jk8Companylogo;//˾ʶ + private JLabel jk8MeasureType;//ԭ + private JLabel jk8CommunicateMode;//ͨѶʽ + private JLabel jk8Application;//Ӧ÷Χ + private JLabel jk8Revisionlevel;//汾ʶ + private JLabel jk8PCBNO;//PCB + + private JLabel jk8Projectname;//Ŀ + private JTextField Projectname;//Ŀ + + private iComboBox Companylogo= new iComboBox();//˾ʶ + String logo=""; + private iComboBox MeasureType= new iComboBox();//ԭ + String type=""; + private iComboBox CommunicateMode= new iComboBox();//ͨѶʽ + String mode=""; + private iComboBox Application= new iComboBox();//Ӧ÷Χ + String app=""; + private JTextField Revisionlevel;//汾ʶ + private JTextField PCBNO;//PCB + private JTextField BasePCBNO;//ͺPCB + + private JPanel mainPanel; + private void initPanel() { + // TODO Auto-generated method stub + Font font=new Font("", 0, 24); + tableName.setFont(font); + Font font2=new Font("", 0, 20); + this.setLayout(new BorderLayout()); + jk8BasePCBNO=new JLabel("ͺPCB"); + jk8BasePCBNO.setFont(font2); + checkButton=new JButton("У");//У + checkButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + System.out.println("֤"); + check(); + + } + }); + jk8Companylogo=new JLabel("˾ʶ"); + jk8Companylogo.setFont(font2); + jk8MeasureType=new JLabel("ԭ"); + jk8MeasureType.setFont(font2); + jk8CommunicateMode=new JLabel("ͨѶʽ"); + jk8CommunicateMode.setFont(font2); + jk8Application=new JLabel("Ӧ÷Χ"); + jk8Application.setFont(font2); + jk8Revisionlevel=new JLabel("汾ʶ"); + jk8Revisionlevel.setFont(font2); + jk8PCBNO=new JLabel("PCB"); + jk8PCBNO.setFont(font2); + + jk8Projectname=new JLabel("Ŀ"); + jk8Projectname.setFont(font2); + + Revisionlevel=new JTextField(20); + PCBNO=new JTextField(19); + BasePCBNO=new JTextField(19); + PCBNO.setEnabled(false); + Projectname=new JTextField(60); + Projectname.setEnabled(false); + + setLov(Companylogo,"˾ʶ"); + setLov(MeasureType,"ԭ"); + setLov(CommunicateMode,"ͨѶʽ"); + setLov(Application,"Ӧ÷Χ"); + + + + + mainPanel=new JPanel(new PropertyLayout()); + mainPanel.add("1.1.left.top",tableName); + + mainPanel.add("2.1.left.top",jk8BasePCBNO); + mainPanel.add("2.2.left.top",BasePCBNO); + mainPanel.add("2.3.left.top",checkButton); + mainPanel.add("3.1.left.top",jk8Projectname); + mainPanel.add("3.2.left.top",Projectname); + + mainPanel.add("4.1.left.top",jk8Companylogo); + mainPanel.add("4.2.left.top",Companylogo); + mainPanel.add("5.1.left.top",jk8Application); + mainPanel.add("5.2.left.top",Application); + mainPanel.add("6.1.left.top",jk8MeasureType); + mainPanel.add("6.2.left.top",MeasureType); + mainPanel.add("7.1.left.top",jk8CommunicateMode); + mainPanel.add("7.2.left.top",CommunicateMode); +// mainPanel.add("6.1.left.top",jk8Revisionlevel); +// mainPanel.add("6.2.left.top",Revisionlevel); + mainPanel.add("8.1.left.top",jk8PCBNO); + mainPanel.add("8.2.left.top",PCBNO); + + this.setLayout(new BorderLayout()); + this.add(mainPanel,BorderLayout.CENTER); + this.setSize(new Dimension(650, 200)); + this.setVisible(true); + this.setBackground(Color.LIGHT_GRAY); + + } + private String BasePCBNO_toBeCheck=""; + protected void check() { + // TODO Auto-generated method stub + BasePCBNO_toBeCheck=BasePCBNO.getText(); + if (BasePCBNO_toBeCheck != null && !BasePCBNO_toBeCheck.equals("")) { + TCPreferenceService pref = session.getPreferenceService(); + String puid = pref.getStringValue("JK_PCBReg_uid");//JK_PCBReg_uid=JK_PCB_FORM_PUID + if (puid == null) { + MessageBox.post("ѡJK_PCBReg_uidδҵϵԱ", "", MessageBox.ERROR); + return; + } + TCComponentForm formAll; + try { + formAll = (TCComponentForm) session.stringToComponent(puid); + if (formAll == null) { + MessageBox.post("δҵϵԱ", "", MessageBox.ERROR); + } + boolean ishave1 = ishave("jk8PCBNO", formAll);// ܱ + + if (ishave1) { + this.form.refresh(); + MessageBox.post("ҵPCBͺţ", "ɹ", + MessageBox.INFORMATION); + } else { + form.getTCProperty("jk8BasePCBNO").setStringValue("");// PCBͺ + form.getTCProperty("jk8Companylogo").setStringValue("");// ˾ʶ + form.getTCProperty("jk8MeasureType").setStringValue("");// ԭ + form.getTCProperty("jk8CommunicateMode").setStringValue("");// ͨѶʽ + form.getTCProperty("jk8Application").setStringValue("");// Ӧ÷Χ + form.getTCProperty("jk8PCBNO").setStringValue("");// PCB + form.getTCProperty("jk8Projectname").setStringValue("");// Ŀ + this.form.refresh(); + MessageBox.post("δҵPCBͺţдĻͺPCBǷȷ", "", + MessageBox.ERROR); + } + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + private boolean ishave(String sbh_all, + TCComponentForm formAll) { + // TODO Auto-generated method stub + boolean bo = false; + try { + String[] sbhs = formAll.getTCProperty(sbh_all) + .getStringValueArray();// ʶ + String logo=""; + String type=""; + String mode=""; + String application=""; + String project_name=""; + + + for (int i = 0; i < sbhs.length; i++) { + if (BasePCBNO_toBeCheck.equals(sbhs[i])) { + logo = formAll.getTCProperty("jk8Companylogo") + .getStringValueArray()[i];// ˾ʶ + type = formAll.getTCProperty("jk8MeasureType") + .getStringValueArray()[i];// ԭ + mode = formAll.getTCProperty("jk8CommunicateMode") + .getStringValueArray()[i];// ͨѶʽ + application = formAll.getTCProperty("jk8Application") + .getStringValueArray()[i];// Ӧ÷Χ + project_name = formAll.getTCProperty("jk8Projectname") + .getStringValueArray()[i];// Ŀ + + bo = true; + } + } + + + form.getTCProperty("jk8BasePCBNO").setStringValue(BasePCBNO.getText());// PCBϲ + form.getTCProperty("jk8Companylogo").setStringValue(logo);// ˾ʶ + form.getTCProperty("jk8MeasureType").setStringValue(type);// ԭ + form.getTCProperty("jk8CommunicateMode").setStringValue(mode);// ͨѶʽ + form.getTCProperty("jk8Application").setStringValue(application);// Ӧ÷Χ + form.getTCProperty("jk8Projectname").setStringValue(project_name);// Ŀ + this.form.refresh(); + } catch (TCException e) { + e.printStackTrace(); + } + return bo; + } + + private void setLov(iComboBox box, String st) { + box.setTextFieldLength(18); + box.setAutoCompleteSuggestive(false); + box.addItems(realNameMap.get(st).split(",")); + } + + @Override + public void itemStateChanged(ItemEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void loadRendering() throws TCException { + BasePCBNO.setText(form.getTCProperty("jk8BasePCBNO").getStringValue()==null?"":form.getTCProperty("jk8BasePCBNO").getStringValue()); + Companylogo.setText(form.getTCProperty("jk8Companylogo").getStringValue()); + MeasureType.setText(form.getTCProperty("jk8MeasureType").getStringValue()); + CommunicateMode.setText(form.getTCProperty("jk8CommunicateMode").getStringValue()); + Application.setText(form.getTCProperty("jk8Application").getStringValue()); +// Revisionlevel.setText(form.getTCProperty("jk8Revisionlevel").getStringValue()==null?"":form.getTCProperty("jk8Revisionlevel").getStringValue()); + PCBNO.setText(form.getTCProperty("jk8PCBNO").getStringValue()==null?"":form.getTCProperty("jk8PCBNO").getStringValue()); + Projectname.setText(form.getTCProperty("jk8Projectname").getStringValue()==null?"":form.getTCProperty("jk8PCBNO").getStringValue()); + } + + +/* @Override + public Map getRenderingModified() { + Map modifiedRendering = new HashMap (); + try { + System.out.println("getRenderingModifiedʼ"); + saveRendering(); + }catch(Exception ex){ + ex.toString(); + System.out.println(ex.toString()); + } + + + return modifiedRendering; + }*/ + + public boolean isRenderingModified() { + System.out.println("isRenderingModified"); + + try { + + if(isrend(form.getTCProperty("jk8BasePCBNO"),BasePCBNO.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8Companylogo"),Companylogo.getTextField().getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8MeasureType"),MeasureType.getTextField().getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8CommunicateMode"),CommunicateMode.getTextField().getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8Application"),Application.getTextField().getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8PCBNO"),PCBNO.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8Projectname"),Projectname.getText())){ + return true; + } + + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + }// гѡ + return false; + } + + + private boolean isrend(TCProperty tcProperty, String str) { + // TODO Auto-generated method stub + if(tcProperty!=null&&str!=null&&(!str.equals(tcProperty.getStringValue()))){ + System.out.println(str); + return true; + } + return false; + } + + @Override + public void saveRendering() { + try { + form.getTCProperty("jk8BasePCBNO").setStringValue(BasePCBNO.getText()); + form.getTCProperty("jk8Companylogo").setStringValue(Companylogo.getTextField().getText()); + form.getTCProperty("jk8MeasureType").setStringValue(MeasureType.getTextField().getText()); + form.getTCProperty("jk8CommunicateMode").setStringValue(CommunicateMode.getTextField().getText()); + form.getTCProperty("jk8Application").setStringValue(Application.getTextField().getText()); +// form.getTCProperty("jk8Revisionlevel").setStringValue(Revisionlevel.getText()); + form.getTCProperty("jk8PCBNO").setStringValue(PCBNO.getText()); + form.getTCProperty("jk8Projectname").setStringValue(Projectname.getText()); + } catch (TCException e) { + e.printStackTrace(); + } + } + + +} diff --git a/src/com/teamcenter/rac/form/JK8MaterialRevisionMasterForm.java b/src/com/teamcenter/rac/form/JK8MaterialRevisionMasterForm.java new file mode 100644 index 0000000..8d0e995 --- /dev/null +++ b/src/com/teamcenter/rac/form/JK8MaterialRevisionMasterForm.java @@ -0,0 +1,1449 @@ +package com.teamcenter.rac.form; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.ArrayList; +import java.util.List; + +import javax.swing.BorderFactory; +import javax.swing.DefaultComboBoxModel; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextField; +import javax.swing.border.TitledBorder; + +import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.stylesheet.AbstractRendering; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; + +public class JK8MaterialRevisionMasterForm extends AbstractRendering implements ItemListener { + private TCComponentForm form = null; + + // + private String Jk8TechModel;// ͺ + private String Jk8SpecModel;// ͺ + //2019.06.11˵ͲƷʶ + private String JkRemarks; + private String JkProductIdno;//Ʒʶ + private double jk8IsUnitWeight;// λ + private String nullString="";// λĬdoubleΪ""ַ + private double jk8IsUnitVolume;// λ + + // ɹ + private String jk8IsDomesticMarket="";// Ƿ + private String jk8Isconsumables="";// Ƿ + private String jk8IsBuy;// Ƿɹ + private String jk8IsMake;// Ƿ + private String jk8IsOutsource;// Ƿί + private String jk8AccountSet;// Ĭ + private String jk8BusinessType;// ҵ + private String jk8Buyer;// ɹԱ + private double jk8PurLeadTime;// ̶ǰ + + // + private double jk8SafeStock=0;// ȫ + private String jk8Warehouse1;// Ĭϲֿ + private String jk8SupplyType1="3";// Ӧ + private String jk8PlanMethod="R";// ƻ + private String jk8IsInnTrans;// Ƿڲ + private String jk8WarehouseKeeper;// Ա + private double jk8InnTransCoe;// ڲ׼۸ϵ + //2019.12.03 Ƶ + private String jk8Frequency;// Ƶ + + private AbstractAIFApplication app = AIFUtility.getCurrentApplication(); + private TCSession session; + private TCPreferenceService service; + + public JK8MaterialRevisionMasterForm(TCComponentForm arg0) throws Exception { + super(arg0); + // TODO Auto-generated constructor stub + this.form = arg0; + this.session = (TCSession) app.getSession(); + this.service = session.getPreferenceService(); + loadRendering(); + } + + @Override + public void loadRendering() throws TCException { + // + Jk8TechModel = form.getTCProperty("jk8TechModel").getStringValue(); + Jk8SpecModel = form.getTCProperty("jk8SpecModel").getStringValue(); + //2019.06.11˵ͲƷʶ + JkRemarks = form.getTCProperty("jk8Remarks").getStringValue();//˵ + JkProductIdno = form.getTCProperty("jk8ProductIdentifyNO").getStringValue();//Ʒʶ + + jk8IsUnitWeight = form.getTCProperty("jk8UnitWeight").getDoubleValue(); + jk8IsUnitVolume = form.getTCProperty("jk8UnitVolume").getDoubleValue(); + + // ɹ + jk8IsDomesticMarket = form.getTCProperty("jk8IsDomesticMarket").getStringValue()==""?"":form.getTCProperty("jk8IsDomesticMarket").getStringValue(); + jk8Isconsumables = form.getTCProperty("jk8Isconsumables").getStringValue()==""?"":form.getTCProperty("jk8Isconsumables").getStringValue(); + jk8IsBuy = form.getTCProperty("jk8IsBuy").getStringValue()==""?"":form.getTCProperty("jk8IsBuy").getStringValue(); + jk8IsMake = form.getTCProperty("jk8IsMake").getStringValue(); + jk8IsOutsource = form.getTCProperty("jk8IsOutsource").getStringValue(); + jk8AccountSet = form.getTCProperty("jk8AccountSet").getStringValue(); + String[] AccountSetString = service.getStringValue("jk8AccountSet").split(","); + for (int i = 0; i < AccountSetString.length; i++) { + if(AccountSetString[i].split("-")[0].equals(jk8AccountSet)) { + jk8AccountSet=AccountSetString[i].split("-")[1]; + System.out.println("jk8AccountSet-------------->"+jk8AccountSet); + break; + } + } + jk8BusinessType = form.getTCProperty("jk8BusinessType").getStringValue(); + + jk8Buyer = form.getTCProperty("jk8Buyer").getStringValue(); + System.out.println("ʱɹ----------------"+jk8Buyer); + String[] BuyerString = service.getStringValue("jk8Buyer").split(","); + for (int i = 0; i < BuyerString.length; i++) { + if(BuyerString[i].split("-")[0].equals(jk8Buyer)) { + jk8Buyer=BuyerString[i].split("-")[1]; + break; + } + } + jk8PurLeadTime = form.getTCProperty("jk8PurLeadTime").getDoubleValue(); + + // + jk8SafeStock = form.getTCProperty("jk8SafeStock").getDoubleValue()==0?0.0:form.getTCProperty("jk8SafeStock").getDoubleValue(); + //ĬΪ3-ã޸ģĬ϶Ӧ3ӦĹӦ + jk8SupplyType1 = form.getTCProperty("jk8SupplyType1").getStringValue().equals("")?"3":form.getTCProperty("jk8SupplyType1").getStringValue(); + System.out.println("Ӧ----------->"+jk8SupplyType1); + String[] SupplyType1String = service.getStringValue("jk8SupplyType1").split(","); + for (int i = 0; i < SupplyType1String.length; i++) { + if(SupplyType1String[i].split("-")[0].contains(jk8SupplyType1)) { + jk8SupplyType1=SupplyType1String[i].split("-")[1]; + break; + } + + } + System.out.println("Ӧ----------->"+jk8SupplyType1); + jk8Warehouse1 = form.getTCProperty("jk8Warehouse1").getStringValue(); + String[] Warehouse1String = service.getStringValue("jk8Warehouse1").split(","); + for (int i = 0; i < Warehouse1String.length; i++) { + if(Warehouse1String[i].split("-")[0].contains(jk8Warehouse1)) { + jk8Warehouse1=Warehouse1String[i].split("-")[1]; + break;//¼ + } + + } + jk8PlanMethod = form.getTCProperty("jk8PlanMethod").getStringValue()==""?"R":form.getTCProperty("jk8PlanMethod").getStringValue(); + try { + jk8WarehouseKeeper = form.getTCProperty("jk8WarehouseKeeper").getStringValue(); +// jk8WarehouseKeeper = form.getTCProperty("jk8WarehouseKeeper").getIntValue()==0?0:form.getTCProperty("jk8WarehouseKeeper").getIntValue(); +// jk8WarehouseKeeper = 88; + } catch (Exception e) { +// MessageBox.post(e.getMessage()+"\nԱЧ","",MessageBox.INFORMATION); + e.printStackTrace(); + } + + jk8IsInnTrans = form.getTCProperty("jk8IsInnTrans").getStringValue(); + jk8InnTransCoe = form.getTCProperty("jk8InnTransCoe").getDoubleValue(); + // + jk8Frequency = form.getTCProperty("jk8Frequency").getStringValue(); + + initPanel(); + } + + private JPanel mainPanel; + private JPanel techPanel;// + private JPanel purchasePanel;// ɹ + private JPanel logisticsPanel;// + private JPanel otherPanel;// + private JLabel jk8FrequencyJlabel; + private JTextField jk8FrequencyField; + + // + private JLabel Jk8TechModelJlabel; + private JTextField Jk8TechModelField; + private JLabel Jk8SpecModelJlabel; + private JTextField Jk8SpecModelField; + //TODO ˵ Ʒʶ + private JLabel Jk8RemarksJlabel; + private JTextField Jk8RemarksField; + private JLabel Jk8ProductIdnoJlabel; + private JTextField Jk8ProductIdnoField; + + + + private JLabel jk8IsUnitWeightJlabel; + private JTextField jk8IsUnitWeightField; + private JLabel jk8IsUnitVolumeJlabel; + private JTextField jk8IsUnitVolumeField; + + // ɹ + private JLabel jk8IsDomesticMarketJlabel; + private JLabel jk8IsBuyJlabel; + private JLabel jk8Isconsumableslabel; + private JLabel jk8IsMakeJlabel; + private JLabel jk8IsOutsourceJlabel; + private JLabel jk8AccountSetJlabel; + private JLabel jk8BusinessTypeJlabel; + private JLabel jk8BuyerJlabel; + private JLabel jk8PurLeadTimeJlabel; + private JTextField jk8PurLeadTimeField; + + // + private JLabel jk8SafeStockJlabel; + private JTextField jk8SafeStockField; + private JLabel jk8Warehouse1Jlabel; + private JLabel jk8SupplyType1Jlabel; + private JLabel jk8PlanMethodJlabel; + private JLabel jk8IsInnTransJlabel; + private JLabel jk8WarehouseKeeperJlabel; + private JTextField jk8WarehouseKeeperField; + private JLabel jk8InnTransCoeJlabel; + private JTextField jk8InnTransCoeField; + + private JComboBox comBox_jk8IsDomesticMarket; + private JComboBox comBox_jk8IsBuy; + private JComboBox comBox_jk8Isconsumables; + private JComboBox comBox_jk8IsMakeField; + private JComboBox comBox_jk8IsOutsourceField; + private JComboBox comBox_jk8AccountSet; + private JComboBox comBox_jk8BusinessType; + private JComboBox comBox_jk8Buyer; + private JComboBox comBox_jk8SupplyType1; + private JComboBox comBox_jk8Warehouse1; + private JComboBox comBox_jk8PlanMethod; + private JComboBox comBox_jk8IsInnTrans; + + private void initPanel() { + boolean isTechEditable=false; + boolean isPurchaseEditable=false; + boolean isLogisticsEditable=false; + String group=""; + try { + group=session.getUser().getProperty("login_group"); + System.out.println(group); + } catch (TCException e1) { + e1.printStackTrace(); + } + String[] userString = service.getStringValue("jk_attri_part").split(";"); + for (int i = 0; i < userString.length; i++) { + if(userString[i].split(":")[0].equals("")) { + String[] groupString=userString[i].split(":")[1].split(","); + for (int j = 0; j < groupString.length; j++) { + if(groupString[j].equals(group)) { + isTechEditable=true; + break; + } + } + }else if(userString[i].split(":")[0].equals("ɹ")) { + String[] groupString=userString[i].split(":")[1].split(","); + for (int j = 0; j < groupString.length; j++) { + + if(groupString[j].equals(group)) { + isPurchaseEditable=true; + break; + } + } + }else if(userString[i].split(":")[0].equals("")) { + String[] groupString=userString[i].split(":")[1].split(","); + for (int j = 0; j < groupString.length; j++) { + + if(groupString[j].equals(group)) { + isLogisticsEditable=true; + break; + } + } + } + } + + this.setLayout(new BorderLayout()); + this.setName("ϱ"); + mainPanel = new JPanel(new PropertyLayout()); + techPanel = new JPanel(new PropertyLayout()); + purchasePanel = new JPanel(new PropertyLayout()); + JPanel purchaseLeftPanel=new JPanel(new PropertyLayout()); + JPanel purchaseMiddlePanel=new JPanel(new PropertyLayout()); + JPanel purchaseRightPanel=new JPanel(new PropertyLayout()); + logisticsPanel = new JPanel(new PropertyLayout()); + + + + Jk8TechModelJlabel = new JLabel("ͺ:"); + Jk8RemarksJlabel = new JLabel("˵:"); + Jk8ProductIdnoJlabel = new JLabel("Ʒʶ:"); + +// Jk8TechModelJlabel.setForeground(Color.red); + Jk8RemarksField = new JTextField(16); + Jk8RemarksField.setText(JkRemarks); + Jk8ProductIdnoField = new JTextField(16); + Jk8ProductIdnoField.setText(JkProductIdno); + Jk8TechModelField = new JTextField(16); + Jk8TechModelField.setText(Jk8TechModel); + Jk8SpecModelJlabel = new JLabel("ͺ:"); + Jk8SpecModelField = new JTextField(16); + Jk8SpecModelField.setText(Jk8SpecModel); + jk8IsUnitWeightJlabel = new JLabel("λ:"); + jk8IsUnitWeightField = new JTextField(16); +// if(jk8IsUnitWeight==0) { +// jk8IsUnitWeightField.setText(nullString); +// +// }else { +// +// jk8IsUnitWeightField.setText(Double.toString(jk8IsUnitWeight)); +// } + jk8IsUnitWeightField.setText(Double.toString(jk8IsUnitWeight)); + jk8IsUnitVolumeJlabel = new JLabel("λ:"); + jk8IsUnitVolumeField = new JTextField(16); +// if(jk8IsUnitVolume==0) { +// jk8IsUnitVolumeField.setText(nullString); +// +// }else { +// +// jk8IsUnitVolumeField.setText(Double.toString(jk8IsUnitVolume)); +// } + jk8IsUnitVolumeField.setText(Double.toString(jk8IsUnitVolume)); + + + otherPanel = new JPanel(new PropertyLayout()); + jk8FrequencyJlabel = new JLabel("ʹƵ:"); + jk8FrequencyField = new JTextField(16); + otherPanel.setBorder(new TitledBorder(BorderFactory.createTitledBorder(""))); + otherPanel.add("1.1.left.top", jk8FrequencyJlabel); + otherPanel.add("1.2.left.top", jk8FrequencyField); + jk8FrequencyField.setText(jk8Frequency); + jk8FrequencyField.setEditable(false); + + + techPanel.setBorder(new TitledBorder(BorderFactory.createTitledBorder(""))); + techPanel.add("1.1.left.top", Jk8TechModelJlabel); + techPanel.add("1.2.left.top", Jk8TechModelField); + techPanel.add("1.3.left.top", new JLabel(" ")); + techPanel.add("1.4.left.top", jk8IsUnitWeightJlabel); + techPanel.add("1.5.left.top", jk8IsUnitWeightField); + techPanel.add("2.1.left.top", Jk8SpecModelJlabel); + techPanel.add("2.2.left.top", Jk8SpecModelField); + techPanel.add("2.3.left.top", new JLabel(" ")); + techPanel.add("2.4.left.top", jk8IsUnitVolumeJlabel); + techPanel.add("2.5.left.top", jk8IsUnitVolumeField); + techPanel.add("3.1.left.top", Jk8RemarksJlabel); + techPanel.add("3.2.left.top", Jk8RemarksField); + techPanel.add("3.3.left.top", new JLabel(" ")); + techPanel.add("3.4.left.top", Jk8ProductIdnoJlabel); + techPanel.add("3.5.left.top", Jk8ProductIdnoField); + if(isTechEditable==true) { + Jk8TechModelField.setEnabled(true); + jk8IsUnitWeightField.setEnabled(true); + Jk8SpecModelField.setEnabled(true); + jk8IsUnitVolumeField.setEnabled(true); + Jk8RemarksField.setEnabled(true); + Jk8ProductIdnoField.setEnabled(true); + }else { + Jk8TechModelField.setEnabled(false); + jk8IsUnitWeightField.setEnabled(false); + Jk8SpecModelField.setEnabled(false); + jk8IsUnitVolumeField.setEnabled(false); + Jk8RemarksField.setEnabled(false); + Jk8ProductIdnoField.setEnabled(false); + } + + jk8IsDomesticMarketJlabel = new JLabel("Ƿ:"); + // б + + List isOrNot = new ArrayList<>(); + isOrNot.add(""); + isOrNot.add(""); + + // Ƿ(Ĭ) + comBox_jk8IsDomesticMarket = new JComboBox( + new DefaultComboBoxModel(isOrNot.toArray(new String[isOrNot.size()]))); + comBox_jk8IsDomesticMarket.addItemListener(new ItemListener() { + + @Override + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + + if (e.getItem() != null) { + + jk8IsDomesticMarket = (String) e.getItem(); + } else + return; + + } + + } + }); + if (jk8IsDomesticMarket.equals(null)) { + + comBox_jk8IsDomesticMarket.setSelectedIndex(0); + } else if (jk8IsDomesticMarket.equals("")) { + + comBox_jk8IsDomesticMarket.setSelectedIndex(0); + } else if (jk8IsDomesticMarket.equals("")) { + comBox_jk8IsDomesticMarket.setSelectedIndex(1); + + } +// comBox_jk8IsDomesticMarket.setSize(100, 20); +// comBox_jk8IsDomesticMarket.setMaximumSize(getMaximumSize()); +// comBox_jk8IsDomesticMarket.setBackground(Color.black); + // Ƿɹ + comBox_jk8IsBuy = new JComboBox(new DefaultComboBoxModel(isOrNot.toArray(new String[isOrNot.size()]))); + comBox_jk8IsBuy.addItemListener(new ItemListener() { + + @Override + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + + if (e.getItem() != null) { + + jk8IsBuy = (String) e.getItem(); + } else + return; + + } + + } + }); + if (jk8IsBuy.equals("")) { + + comBox_jk8IsBuy.setSelectedIndex(-1); + } else if (jk8IsBuy.equals("")) { + + comBox_jk8IsBuy.setSelectedIndex(0); + } else if (jk8IsBuy.equals("")) { + comBox_jk8IsBuy.setSelectedIndex(1); + + } + // Ƿ(Ĭ) + comBox_jk8Isconsumables = new JComboBox( + new DefaultComboBoxModel(isOrNot.toArray(new String[isOrNot.size()]))); + comBox_jk8Isconsumables.addItemListener(new ItemListener() { + + @Override + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + + if (e.getItem() != null) { + + jk8Isconsumables = (String) e.getItem(); + } else + return; + + } + + } + }); + if (jk8Isconsumables.equals(null)) { + + comBox_jk8Isconsumables.setSelectedIndex(0); + } else if (jk8Isconsumables.equals("")) { + + comBox_jk8Isconsumables.setSelectedIndex(0); + } else if (jk8Isconsumables.equals("")) { + comBox_jk8Isconsumables.setSelectedIndex(1); + + } + // Ƿ + comBox_jk8IsMakeField = new JComboBox( + new DefaultComboBoxModel(isOrNot.toArray(new String[isOrNot.size()]))); + comBox_jk8IsMakeField.addItemListener(new ItemListener() { + + @Override + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + + if (e.getItem() != null) { + + jk8IsMake = (String) e.getItem(); + } else + return; + + } + + } + }); + if (jk8IsMake.equals("")) { + + comBox_jk8IsMakeField.setSelectedIndex(-1); + } else if (jk8IsMake.equals("")) { + + comBox_jk8IsMakeField.setSelectedIndex(0); + } else if (jk8IsMake.equals("")) { + comBox_jk8IsMakeField.setSelectedIndex(1); + + } + // Ƿί + comBox_jk8IsOutsourceField = new JComboBox( + new DefaultComboBoxModel(isOrNot.toArray(new String[isOrNot.size()]))); + comBox_jk8IsOutsourceField.addItemListener(new ItemListener() { + + @Override + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + + if (e.getItem() != null) { + + jk8IsOutsource = (String) e.getItem(); + } else + return; + + } + + } + }); + if (jk8IsOutsource.equals("")) { + + comBox_jk8IsOutsourceField.setSelectedIndex(-1); + } else if (jk8IsOutsource.equals("")) { + + comBox_jk8IsOutsourceField.setSelectedIndex(0); + } else if (jk8IsOutsource.equals("")) { + comBox_jk8IsOutsourceField.setSelectedIndex(1); + + } + + // Ĭ + String[] AccountSetString = service.getStringValue("jk8AccountSet").split(","); + List AccountSet = new ArrayList<>(); + for (int i = 0; i < AccountSetString.length; i++) { + AccountSet.add(AccountSetString[i].split("-")[1]); + + } + comBox_jk8AccountSet = new JComboBox( + new DefaultComboBoxModel(AccountSet.toArray(new String[AccountSet.size()]))); + comBox_jk8AccountSet.addItemListener(new ItemListener() { + + @Override + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + + if (e.getItem() != null) { + String[] AccountSetString = service.getStringValue("jk8AccountSet").split(","); + for (int i = 0; i < AccountSetString.length; i++) { + if(AccountSetString[i].split("-")[1].equals((String) e.getItem())) { + jk8AccountSet=AccountSetString[i].split("-")[0]; + break; + } + } + } else + return; + + } + + } + }); + for (int i = 0; i < comBox_jk8AccountSet.getItemCount(); i++) { + if(comBox_jk8AccountSet.getItemAt(i).toString().equals(jk8AccountSet)) { + comBox_jk8AccountSet.setSelectedIndex(i); + break; + } + } + if (jk8AccountSet.equals("")) { + + comBox_jk8AccountSet.setSelectedIndex(-1); + } +// else if (jk8AccountSet.equals("")) { +// +// comBox_jk8AccountSet.setSelectedIndex(0); +// } else if (jk8AccountSet.equals("")) { +// comBox_jk8AccountSet.setSelectedIndex(1); +// +// } + + // ҵ + String[] BusinessTypeString = service.getStringValue("jk8BusinessType").split(","); + List BusinessType = new ArrayList<>(); + for (int i = 0; i < BusinessTypeString.length; i++) { + BusinessType.add(BusinessTypeString[i]); + + } + // ҵ + comBox_jk8BusinessType = new JComboBox( + new DefaultComboBoxModel(BusinessType.toArray(new String[BusinessType.size()]))); + comBox_jk8BusinessType.addItemListener(new ItemListener() { + + @Override + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + + if (e.getItem() != null) { + jk8BusinessType = (String) e.getItem(); + } else + return; + + } + + } + }); + for (int i = 0; i < comBox_jk8BusinessType.getItemCount(); i++) { + if(comBox_jk8BusinessType.getItemAt(i).toString().equals(jk8BusinessType)) { + comBox_jk8BusinessType.setSelectedIndex(i); + break; + } + } + if (jk8BusinessType.equals("")) { + + comBox_jk8BusinessType.setSelectedIndex(-1); + } +// else if (jk8BusinessType.equals("")) { +// +// comBox_jk8IsInnTrans.setSelectedIndex(0); +// } else if (jk8BusinessType.equals("")) { +// comBox_jk8IsInnTrans.setSelectedIndex(1); +// +// } + // ɹԱ + String[] BuyerString = service.getStringValue("jk8Buyer").split(","); + List BuyerType = new ArrayList<>(); + for (int i = 0; i < BuyerString.length; i++) { + BuyerType.add(BuyerString[i].split("-")[1]); + } + comBox_jk8Buyer = new JComboBox( + new DefaultComboBoxModel(BuyerType.toArray(new String[BuyerType.size()]))); + comBox_jk8Buyer.addItemListener(new ItemListener() { + + @Override + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + + if (e.getItem() != null) { + String[] BuyerString = service.getStringValue("jk8Buyer").split(","); + for (int i = 0; i < BuyerString.length; i++) { + if(BuyerString[i].split("-")[1].equals( (String) e.getItem())) { + jk8Buyer=BuyerString[i].split("-")[0]; + System.out.println("ɹԱ----------------->"+jk8Buyer); + break; + } + } + } else + return; + + } + + } + }); + for (int i = 0; i < comBox_jk8Buyer.getItemCount(); i++) { + if(comBox_jk8Buyer.getItemAt(i).toString().equals(jk8Buyer)) { + comBox_jk8Buyer.setSelectedIndex(i); + break; + } + } + if (jk8Buyer.equals("")) { + + comBox_jk8Buyer.setSelectedIndex(-1); + } + // Ĭϲֿ + String[] Warehouse1String = service.getStringValue("jk8Warehouse1").split(","); + List Warehouse1 = new ArrayList<>(); + for (int i = 0; i < Warehouse1String.length; i++) { + Warehouse1.add(Warehouse1String[i].split("-")[1]); + + } + comBox_jk8Warehouse1 = new JComboBox( + new DefaultComboBoxModel(Warehouse1.toArray(new String[Warehouse1.size()]))); + comBox_jk8Warehouse1.addItemListener(new ItemListener() { + + @Override + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + + if (e.getItem() != null) { + String[] Warehouse1String = service.getStringValue("jk8Warehouse1").split(","); + for (int i = 0; i < Warehouse1String.length; i++) { + if(Warehouse1String[i].split("-")[1].equals((String) e.getItem())) { + jk8Warehouse1=Warehouse1String[i].split("-")[0]; + break;//¼ + } + + } + } else + return; + + } + + } + }); + for (int i = 0; i < comBox_jk8Warehouse1.getItemCount(); i++) { + if(comBox_jk8Warehouse1.getItemAt(i).toString().equals(jk8Warehouse1)) { + comBox_jk8Warehouse1.setSelectedIndex(i); + break; + } + } + if(jk8Warehouse1.equals("")) { + + comBox_jk8Warehouse1.setSelectedIndex(-1); + } + // Ӧ + String[] SupplyType1String = service.getStringValue("jk8SupplyType1").split(","); + List SupplyType1 = new ArrayList<>(); + for (int i = 0; i < SupplyType1String.length; i++) { + SupplyType1.add(SupplyType1String[i].split("-")[1]); + + } + comBox_jk8SupplyType1 = new JComboBox( + new DefaultComboBoxModel(SupplyType1.toArray(new String[SupplyType1.size()]))); + comBox_jk8SupplyType1.addItemListener(new ItemListener() { + + @Override + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + + if (e.getItem() != null) { + String[] SupplyType1String = service.getStringValue("jk8SupplyType1").split(","); + for (int i = 0; i < SupplyType1String.length; i++) { + if(SupplyType1String[i].split("-")[1].equals((String) e.getItem())) { + jk8SupplyType1=SupplyType1String[i].split("-")[0]; + break;//¼ + } + + } + } else + return; + + } + + } + }); + for (int i = 0; i < comBox_jk8SupplyType1.getItemCount(); i++) { + if(comBox_jk8SupplyType1.getItemAt(i).toString().equals(jk8SupplyType1)) { + comBox_jk8SupplyType1.setSelectedIndex(i); + break; + } + } + if(jk8SupplyType1.equals("3")) { + + comBox_jk8SupplyType1.setSelectedIndex(2); + } + if(jk8SupplyType1.equals("3")) { + + comBox_jk8SupplyType1.setSelectedIndex(2); + } + // ƻ + String[] PlanMethodString = service.getStringValue("jk8PlanMethod").split(","); + List PlanMethod = new ArrayList<>(); + for (int i = 0; i < PlanMethodString.length; i++) { + PlanMethod.add(PlanMethodString[i]); + + } + comBox_jk8PlanMethod = new JComboBox( + new DefaultComboBoxModel(PlanMethod.toArray(new String[PlanMethod.size()]))); + comBox_jk8PlanMethod.addItemListener(new ItemListener() { + + @Override + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + + if (e.getItem() != null) { + jk8PlanMethod = (String) e.getItem(); + } else + return; + } + + } + }); + for (int i = 0; i < comBox_jk8PlanMethod.getItemCount(); i++) { + if(comBox_jk8PlanMethod.getItemAt(i).toString().equals(jk8PlanMethod)) { + comBox_jk8PlanMethod.setSelectedIndex(i); + break; + } + } + if(jk8PlanMethod.equals("")) { + + comBox_jk8PlanMethod.setSelectedIndex(0); + } + // Ƿڲ + comBox_jk8IsInnTrans = new JComboBox( + new DefaultComboBoxModel(isOrNot.toArray(new String[isOrNot.size()]))); + comBox_jk8IsInnTrans.addItemListener(new ItemListener() { + + @Override + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + + if (e.getItem() != null) { + + jk8IsInnTrans = (String) e.getItem(); + } else + return; + + } + + } + }); + if (jk8IsInnTrans.equals("")) { + + comBox_jk8IsInnTrans.setSelectedIndex(-1); + } else if (jk8IsInnTrans.equals("")) { + + comBox_jk8IsInnTrans.setSelectedIndex(0); + } else if (jk8IsInnTrans.equals("")) { + comBox_jk8IsInnTrans.setSelectedIndex(1); + + } + + jk8IsBuyJlabel = new JLabel("Ƿɹ:"); + jk8Isconsumableslabel = new JLabel("Ƿ:"); + jk8IsMakeJlabel = new JLabel("Ƿ:"); + jk8IsOutsourceJlabel = new JLabel("Ƿί:"); + jk8AccountSetJlabel = new JLabel("Ĭ:"); + jk8BusinessTypeJlabel = new JLabel("ҵ:"); + jk8BuyerJlabel = new JLabel("ɹԱ: "); + jk8PurLeadTimeJlabel = new JLabel("̶ǰ:"); + jk8PurLeadTimeField = new JTextField(16); +// if(jk8PurLeadTime==0) { +// +// jk8PurLeadTimeField.setText(nullString); +// }else { +// jk8PurLeadTimeField.setText(Double.toString(jk8PurLeadTime) ); +// +// } + jk8PurLeadTimeField.setText(Double.toString(jk8PurLeadTime) ); + purchasePanel.setBorder(new TitledBorder(BorderFactory.createTitledBorder("ɹ"))); + purchasePanel.setPreferredSize(new Dimension(580, 180)); + + purchasePanel.add("1.1.left.top", purchaseLeftPanel); + purchasePanel.add("1.2.left.top", purchaseMiddlePanel); + if(isPurchaseEditable==true) { + + purchaseMiddlePanel.add("1.1.left.top", new JLabel(" ")); + }else { + purchaseMiddlePanel.add("1.1.left.top", new JLabel(" ")); + + } + purchasePanel.add("1.3.left.top", purchaseRightPanel); + purchaseLeftPanel.add("1.1.left.top",jk8IsDomesticMarketJlabel); +// purchaseLeftPanel.add("1.2.left.top", comBox_jk8IsDomesticMarket); + if(isPurchaseEditable==true) { + + purchaseLeftPanel.add("1.2.left.top", comBox_jk8IsDomesticMarket); + }else { + String labelString=jk8IsDomesticMarket; + purchaseLeftPanel.add("1.2.left.top", new JLabel(labelString)); + } + purchaseLeftPanel.add("2.1.left.top", jk8Isconsumableslabel); + if(isPurchaseEditable==true) { + purchaseLeftPanel.add("2.2.left.top", comBox_jk8Isconsumables); + + }else { + String labelString=jk8Isconsumables; + purchaseLeftPanel.add("2.2.left.top", new JLabel(labelString)); + } + purchaseLeftPanel.add("3.1.left.top", jk8IsOutsourceJlabel); + if(isPurchaseEditable==true) { + + purchaseLeftPanel.add("3.2.left.top", comBox_jk8IsOutsourceField); + }else { + String labelString=jk8IsOutsource; + purchaseLeftPanel.add("3.2.left.top", new JLabel(labelString)); + } + purchaseLeftPanel.add("4.1.left.top", jk8BusinessTypeJlabel); + if(isPurchaseEditable==true) { + + purchaseLeftPanel.add("4.2.left.top", comBox_jk8BusinessType); + }else { + String labelString=jk8BusinessType; + purchaseLeftPanel.add("4.2.left.top", new JLabel(labelString)); + } + purchaseLeftPanel.add("5.1.left.top", jk8PurLeadTimeJlabel); + purchaseLeftPanel.add("5.2.left.top", jk8PurLeadTimeField); + + + + purchaseRightPanel.add("1.1.left.top",jk8IsBuyJlabel); + if(isPurchaseEditable==true) { + purchaseRightPanel.add("1.2.left.top", comBox_jk8IsBuy); + + }else { + String labelString=jk8IsBuy; + purchaseRightPanel.add("1.2.left.top", new JLabel(labelString)); + } + purchaseRightPanel.add("2.1.left.top", jk8IsMakeJlabel); + if(isPurchaseEditable==true) { + purchaseRightPanel.add("2.2.left.top", comBox_jk8IsMakeField); + }else { + String labelString=jk8IsMake; + purchaseRightPanel.add("2.2.left.top", new JLabel(labelString)); + } + purchaseRightPanel.add("3.1.left.top", jk8AccountSetJlabel); + if (isPurchaseEditable == true) { + purchaseRightPanel.add("3.2.left.top", comBox_jk8AccountSet); + }else { + String labelString=jk8AccountSet; + System.out.println("jk8AccountSet2------------------->"+jk8AccountSet); + String[] AccountSetString1 = service.getStringValue("jk8AccountSet").split(","); + for (int i = 0; i < AccountSetString1.length; i++) { + if(AccountSetString1[i].split("-")[0].equals(jk8AccountSet)) { + labelString=AccountSetString[i].split("-")[1]; + break; + } + } + System.out.println("labelString------------>"+labelString); + purchaseRightPanel.add("3.2.left.top", new JLabel(labelString)); + } + purchaseRightPanel.add("4.1.left.top", jk8BuyerJlabel); + if(isPurchaseEditable==true) { + purchaseRightPanel.add("4.2.left.top", comBox_jk8Buyer); + }else { + String[] label = service.getStringValue("jk8Buyer").split(","); + String labelString=jk8Buyer; + for (int i = 0; i < label.length; i++) { + if(label[i].split("-")[0].equals(jk8Buyer)) { + labelString=label[i].split("-")[1]; + break; + } + } + purchaseRightPanel.add("4.2.left.top", new JLabel(labelString)); + } + + + + + +// purchasePanel.add("1.1.left.top", jk8IsDomesticMarketJlabel); +// if(isPurchaseEditable==true) { +// +// purchasePanel.add("1.2.left.top", comBox_jk8IsDomesticMarket); +// }else { +// String labelString=jk8IsDomesticMarket; +// purchasePanel.add("1.2.left.top", new JLabel(labelString)); +// } +// purchasePanel.add("1.3.left.top", new JLabel(" ")); +// if(isPurchaseEditable==true) { +// purchasePanel.add("1.4.left.top", new JLabel(" ")); +// purchasePanel.add("1.5.left.top", jk8IsBuyJlabel); +// purchasePanel.add("1.6.left.top", comBox_jk8IsBuy); +// +// }else { +// purchasePanel.add("1.4.left.top", new JLabel(" ")); +// purchasePanel.add("1.5.left.top", jk8IsBuyJlabel); +// String labelString=jk8IsBuy; +// purchasePanel.add("1.6.left.top", new JLabel(labelString)); +// } +// purchasePanel.add("2.1.left.top", jk8Isconsumableslabel); +// if(isPurchaseEditable==true) { +// purchasePanel.add("2.2.left.top", comBox_jk8Isconsumables); +// +// }else { +// String labelString=jk8Isconsumables; +// purchasePanel.add("2.2.left.top", new JLabel(labelString)); +// } +// purchasePanel.add("2.3.left.top", new JLabel(" ")); +// if(isPurchaseEditable==true) { +// purchasePanel.add("2.4.left.top", new JLabel(" ")); +// purchasePanel.add("2.5.left.top", jk8IsMakeJlabel); +// purchasePanel.add("2.6.left.top", comBox_jk8IsMakeField); +// }else { +// String labelString=jk8IsMake; +// purchasePanel.add("2.4.left.top", new JLabel(" ")); +// purchasePanel.add("2.5.left.top", jk8IsMakeJlabel); +// purchasePanel.add("2.6.left.top", new JLabel(labelString)); +// } +// purchasePanel.add("3.1.left.top", jk8IsOutsourceJlabel); +// if(isPurchaseEditable==true) { +// +// purchasePanel.add("3.2.left.top", comBox_jk8IsOutsourceField); +// }else { +// String labelString=jk8IsOutsource; +// purchasePanel.add("3.2.left.top", new JLabel(labelString)); +// } +// purchasePanel.add("3.3.left.top", new JLabel(" ")); +// if(isPurchaseEditable==true) { +// purchasePanel.add("3.4.left.top", new JLabel(" ")); +// purchasePanel.add("3.5.left.top", jk8AccountSetJlabel); +// +// purchasePanel.add("3.6.left.top", comBox_jk8AccountSet); +// }else { +// purchasePanel.add("3.4.left.top", new JLabel(" ")); +// purchasePanel.add("3.5.left.top", jk8AccountSetJlabel); +// String labelString=jk8AccountSet; +// purchasePanel.add("3.6.left.top", new JLabel(labelString)); +// } +// purchasePanel.add("4.1.left.top", jk8BusinessTypeJlabel); +// if(isPurchaseEditable==true) { +// +// purchasePanel.add("4.2.left.top", comBox_jk8BusinessType); +// }else { +// String labelString=jk8BusinessType; +// purchasePanel.add("4.2.left.top", new JLabel(labelString)); +// } +// purchasePanel.add("4.3.left.top", new JLabel(" ")); +// if(isPurchaseEditable==true) { +// purchasePanel.add("4.4.left.top", new JLabel(" ")); +// purchasePanel.add("4.5.left.top", jk8BuyerJlabel); +// +// purchasePanel.add("4.6.left.top", comBox_jk8Buyer); +// }else { +// purchasePanel.add("4.4.left.top", new JLabel(" ")); +// purchasePanel.add("4.5.left.top", jk8BuyerJlabel); +// String[] label = service.getStringValue("jk8Buyer").split(","); +// String labelString=jk8Buyer; +// for (int i = 0; i < label.length; i++) { +// if(label[i].split("-")[0].equals(jk8Buyer)) { +// labelString=label[i].split("-")[1]; +// break; +// } +// } +// purchasePanel.add("4.6.left.top", new JLabel(labelString)); +// } +// purchasePanel.add("5.1.left.top", jk8PurLeadTimeJlabel); +// purchasePanel.add("5.2.left.top", jk8PurLeadTimeField); +// purchasePanel.add("5.3.left.top", new JLabel(" ")); + + if(isPurchaseEditable==true) { + jk8PurLeadTimeField.setEnabled(true); + }else { + jk8PurLeadTimeField.setEnabled(false); + } + + + jk8SafeStockJlabel = new JLabel("ȫ:"); + jk8SafeStockField = new JTextField(13); + jk8SafeStockField.setText(Double.toString(jk8SafeStock)); + jk8Warehouse1Jlabel = new JLabel("Ĭϲֿ:"); + jk8SupplyType1Jlabel = new JLabel("Ӧ:"); + jk8PlanMethodJlabel = new JLabel("ƻ:"); + jk8IsInnTransJlabel = new JLabel("Ƿڲ:"); + jk8WarehouseKeeperJlabel = new JLabel("Ա: "); + jk8WarehouseKeeperField = new JTextField(15); + jk8WarehouseKeeperField.setText(jk8WarehouseKeeper); + jk8InnTransCoeJlabel = new JLabel("ڲ׼۸ϵ:"); + jk8InnTransCoeField = new JTextField(13); + jk8InnTransCoeField.setText(Double.toString(jk8InnTransCoe)); + + logisticsPanel.setBorder(new TitledBorder(BorderFactory.createTitledBorder(""))); + logisticsPanel.setPreferredSize(new Dimension(580, 180)); + JPanel logisticsLeftPanel=new JPanel(new PropertyLayout()); + JPanel logisticsMiddlePanel=new JPanel(new PropertyLayout()); + JPanel logisticsRightPanel=new JPanel(new PropertyLayout()); + logisticsPanel.add("1.1.left.top", logisticsLeftPanel); + logisticsPanel.add("1.2.left.top", logisticsMiddlePanel); + if(isLogisticsEditable==true) { + + logisticsMiddlePanel.add("1.1.left.top", new JLabel(" ")); + }else { + + logisticsMiddlePanel.add("1.1.left.top", new JLabel(" ")); + } + + logisticsPanel.add("1.3.left.top", logisticsRightPanel); + + + logisticsLeftPanel.add("1.1.left.top", jk8SafeStockJlabel); + logisticsLeftPanel.add("1.2.left.top", jk8SafeStockField); + logisticsLeftPanel.add("2.1.left.top", jk8SupplyType1Jlabel); + if(isLogisticsEditable==true) { + logisticsLeftPanel.add("2.2.left.top", comBox_jk8SupplyType1); + + }else { + String[] label = service.getStringValue("jk8SupplyType1").split(","); + String labelString=jk8SupplyType1; + for (int i = 0; i < label.length; i++) { + if(label[i].split("-")[0].equals(jk8SupplyType1)) { + labelString=label[i].split("-")[1]; + break; + } + } + logisticsLeftPanel.add("2.2.left.top", new JLabel(labelString)); + } + logisticsLeftPanel.add("3.1.left.top", jk8IsInnTransJlabel); + if(isLogisticsEditable==true) { + + logisticsLeftPanel.add("3.2.left.top", comBox_jk8IsInnTrans); + }else { + String labelString=jk8IsInnTrans; + logisticsLeftPanel.add("3.2.left.top", new JLabel(labelString)); + } + logisticsLeftPanel.add("4.1.left.top", jk8InnTransCoeJlabel); + logisticsLeftPanel.add("4.2.left.top", jk8InnTransCoeField); + + + + logisticsRightPanel.add("1.1.left.top", jk8Warehouse1Jlabel); + if(isLogisticsEditable==true) { + logisticsRightPanel.add("1.2.left.top", comBox_jk8Warehouse1); + + }else { + String[] label = service.getStringValue("jk8Warehouse1").split(","); + String labelString=jk8Warehouse1; + for (int i = 0; i < label.length; i++) { + if(label[i].split("-")[0].equals(jk8Warehouse1)) { + labelString=label[i].split("-")[1]; + break; + } + } + logisticsRightPanel.add("1.2.left.top", new JLabel(labelString)); + } + logisticsRightPanel.add("2.1.left.top", jk8PlanMethodJlabel); + if(isLogisticsEditable==true) { + logisticsRightPanel.add("2.2.left.top", comBox_jk8PlanMethod); + }else { + String labelString=jk8PlanMethod; + logisticsRightPanel.add("2.2.left.top", new JLabel(labelString)); + } + logisticsRightPanel.add("3.1.left.top", jk8WarehouseKeeperJlabel); + logisticsRightPanel.add("3.2.left.top", jk8WarehouseKeeperField); + + + +// logisticsPanel.add("1.1.left.top", jk8SafeStockJlabel); +// logisticsPanel.add("1.2.left.top", jk8SafeStockField); +// logisticsPanel.add("1.3.left.top", new JLabel(" ")); +// logisticsPanel.add("1.4.left.top", jk8Warehouse1Jlabel); +// if(isLogisticsEditable==true) { +// logisticsPanel.add("1.5.left.top", comBox_jk8Warehouse1); +// +// }else { +// String[] label = service.getStringValue("jk8Warehouse1").split(","); +// String labelString=jk8Warehouse1; +// for (int i = 0; i < label.length; i++) { +// if(label[i].split("-")[0].equals(jk8Warehouse1)) { +// labelString=label[i].split("-")[1]; +// break; +// } +// } +// logisticsPanel.add("1.5.left.top", new JLabel(labelString)); +// } +// logisticsPanel.add("2.1.left.top", jk8SupplyType1Jlabel); +// if(isLogisticsEditable==true) { +// logisticsPanel.add("2.2.left.top", comBox_jk8SupplyType1); +// logisticsPanel.add("2.3.left.top", new JLabel(" ")); +// +// }else { +// String[] label = service.getStringValue("jk8SupplyType1").split(","); +// String labelString=jk8SupplyType1; +// for (int i = 0; i < label.length; i++) { +// if(label[i].split("-")[0].equals(jk8SupplyType1)) { +// labelString=label[i].split("-")[1]; +// break; +// } +// } +// logisticsPanel.add("2.2.left.top", new JLabel(labelString)); +// logisticsPanel.add("2.3.left.top", new JLabel(" ")); +// } +// logisticsPanel.add("2.4.left.top", jk8PlanMethodJlabel); +// if(isLogisticsEditable==true) { +// logisticsPanel.add("2.5.left.top", comBox_jk8PlanMethod); +// }else { +// String labelString=jk8PlanMethod; +// logisticsPanel.add("2.5.left.top", new JLabel(labelString)); +// } +// logisticsPanel.add("3.1.left.top", jk8IsInnTransJlabel); +// if(isPurchaseEditable==true) { +// +// logisticsPanel.add("3.2.left.top", comBox_jk8IsInnTrans); +// logisticsPanel.add("3.3.left.top", new JLabel(" ")); +// }else { +// String labelString=jk8IsInnTrans; +// logisticsPanel.add("3.2.left.top", new JLabel(labelString)); +// logisticsPanel.add("3.3.left.top", new JLabel(" ")); +// } +// logisticsPanel.add("3.4.left.top", jk8WarehouseKeeperJlabel); +// logisticsPanel.add("3.5.left.top", jk8WarehouseKeeperField); +// logisticsPanel.add("4.1.left.top", jk8InnTransCoeJlabel); +// logisticsPanel.add("4.2.left.top", jk8InnTransCoeField); +// logisticsPanel.add("4.3.left.top", new JLabel(" ")); +// + if(isLogisticsEditable==true) { + jk8SafeStockField.setEnabled(true); + comBox_jk8Warehouse1.setEnabled(true); + comBox_jk8SupplyType1.setEnabled(true); + comBox_jk8PlanMethod.setEnabled(true); + comBox_jk8IsInnTrans.setEnabled(true); + jk8WarehouseKeeperField.setEnabled(true); + jk8InnTransCoeField.setEnabled(true); + }else { + jk8SafeStockField.setEnabled(false); + comBox_jk8Warehouse1.setEnabled(false); + comBox_jk8SupplyType1.setEnabled(false); + comBox_jk8PlanMethod.setEnabled(false); + comBox_jk8IsInnTrans.setEnabled(false); + jk8WarehouseKeeperField.setEnabled(false); + jk8InnTransCoeField.setEnabled(false); + } + + mainPanel.add("1.1.left.top", techPanel); + mainPanel.add("2.1.left.top", purchasePanel); + mainPanel.add("3.1.left.top", logisticsPanel); + mainPanel.add("4.1.left.top", otherPanel); + // mainPanel.add(purchasePanel, BorderLayout.CENTER); + // mainPanel.add(logisticsPanel, BorderLayout.SOUTH); + // mainPanel.add(purchasePanel, BorderLayout.CENTER); + // mainPanel.add(logisticsPanel, BorderLayout.SOUTH); + JLabel notice=new JLabel("*ע:ԽΪ"); + notice.setFont(new java.awt.Font("Dialog", 1, 15)); + notice.setForeground(Color.red); + this.add(notice,BorderLayout.NORTH ); + this.add(new JScrollPane(mainPanel), BorderLayout.CENTER); + + } + + public boolean isRenderingModified() { + System.out.println("isRenderingModified"); + Jk8TechModel = Jk8TechModelField.getText(); + Jk8SpecModel = Jk8SpecModelField.getText(); + JkRemarks = Jk8RemarksField.getText(); + JkProductIdno = Jk8ProductIdnoField.getText(); + jk8IsUnitWeight = Double.valueOf(jk8IsUnitWeightField.getText()); + jk8IsUnitVolume = Double.valueOf(jk8IsUnitVolumeField.getText()); + + + jk8PurLeadTime= Double.valueOf(jk8PurLeadTimeField.getText()); + jk8SafeStock= Double.valueOf(jk8SafeStockField.getText()); + jk8WarehouseKeeper=jk8WarehouseKeeperField.getText(); + jk8InnTransCoe = Double.valueOf(jk8InnTransCoeField.getText()); + String[] AccountSetString=service.getStringValue("jk8AccountSet").split(","); + for (int i = 0; i < AccountSetString.length; i++) { + if(AccountSetString[i].split("-")[1].equals(jk8AccountSet)) { + jk8AccountSet=AccountSetString[i].split("-")[0]; + break; + } + } + String[] BuyerString=service.getStringValue("jk8Buyer").split(","); + for (int i = 0; i < BuyerString.length; i++) { + if(BuyerString[i].split("-")[1].equals(jk8Buyer)) { + jk8Buyer=BuyerString[i].split("-")[0]; + break; + } + } + for (int i = 0; i < BuyerString.length; i++) { + if(BuyerString[i].split("-")[0].equals(jk8Buyer)) { + jk8Buyer=BuyerString[i].split("-")[0]; + break; + } + } + String[] Warehouse1String = service.getStringValue("jk8Warehouse1").split(","); + for (int i = 0; i < Warehouse1String.length; i++) { + if(Warehouse1String[i].split("-")[1].equals(jk8Warehouse1)) { + jk8Warehouse1=Warehouse1String[i].split("-")[0]; + break; + } + + } + String[] SupplyType1String = service.getStringValue("jk8SupplyType1").split(","); + for (int i = 0; i < SupplyType1String.length; i++) { + if(SupplyType1String[i].split("-")[1].equals(jk8SupplyType1)) { + jk8SupplyType1=SupplyType1String[i].split("-")[0]; + break; + } + + } + try { + + if(isrend(form.getTCProperty("jk8Frequency"),jk8Frequency)){ + return true; + } + if(isrend(form.getTCProperty("jk8TechModel"),Jk8TechModel)){ + return true; + } + if(isrend(form.getTCProperty("jk8SpecModel"),Jk8SpecModel)){ + return true; + } + if(isrend(form.getTCProperty("jk8Remarks"),JkRemarks)){ + return true; + } + if(isrend(form.getTCProperty("jk8ProductIdentifyNO"),JkProductIdno)){ + return true; + } + if(isrend(form.getTCProperty("jk8UnitWeight"),jk8IsUnitWeight)){ + return true; + } + if(isrend(form.getTCProperty("jk8UnitVolume"),jk8IsUnitVolume)){ + return true; + } + if(isrend(form.getTCProperty("jk8IsDomesticMarket"),jk8IsDomesticMarket)){ + if(!jk8IsDomesticMarket.equals("")){ + return true; + } + } + if(isrend(form.getTCProperty("jk8IsBuy"),jk8IsBuy)){ + return true; + } + if(isrend(form.getTCProperty("jk8Isconsumables"),jk8Isconsumables)){ + if(!jk8Isconsumables.equals("")){ + return true; + } + } + if(isrend(form.getTCProperty("jk8IsMake"),jk8IsMake)){ + return true; + } + if(isrend(form.getTCProperty("jk8IsOutsource"),jk8IsOutsource)){ + return true; + } + if(isrend(form.getTCProperty("jk8AccountSet"),jk8AccountSet)){ + return true; + } + if(isrend(form.getTCProperty("jk8BusinessType"),jk8BusinessType)){ + return true; + } + if(isrend(form.getTCProperty("jk8Buyer"),jk8Buyer)){ + return true; + } + if(isrend(form.getTCProperty("jk8PurLeadTime"),jk8PurLeadTime)){ + return true; + } + if(isrend(form.getTCProperty("jk8SafeStock"),jk8SafeStock)){ + return true; + } + if(isrend(form.getTCProperty("jk8Warehouse1"),jk8Warehouse1)){ + return true; + } + if(isrend(form.getTCProperty("jk8SupplyType1"),jk8SupplyType1)){ + return true; + } + if(isrend(form.getTCProperty("jk8PlanMethod"),jk8PlanMethod)){ + return true; + } + if(isrend(form.getTCProperty("jk8IsInnTrans"),jk8IsInnTrans)){ + return true; + } + if(isrend(form.getTCProperty("jk8WarehouseKeeper"),jk8WarehouseKeeper)){ + return true; + } + if(isrend(form.getTCProperty("jk8InnTransCoe"),jk8InnTransCoe)){ + return true; + } + + + } catch (TCException e) { + e.printStackTrace(); + }// гѡ + return false; + } + + + private boolean isrend(TCProperty tcProperty, Object str) { + if(str instanceof String){ + if(tcProperty!=null&&str!=null&&(!str.equals(tcProperty.getStringValue()))){ + System.out.println(str); + return true; + } + }else if(str instanceof Double){ + if(tcProperty!=null&&str!=null&&(((Double)str)!=tcProperty.getDoubleValue())){ + System.out.println(str); + return true; + } + } + + return false; + } + + + @Override + public void saveRendering() { + System.out.println("뱣"); + Jk8TechModel = Jk8TechModelField.getText(); + Jk8SpecModel = Jk8SpecModelField.getText(); + jk8IsUnitWeight = Double.valueOf(jk8IsUnitWeightField.getText()); + jk8IsUnitVolume = Double.valueOf(jk8IsUnitVolumeField.getText()); + + + jk8PurLeadTime= Double.valueOf(jk8PurLeadTimeField.getText()); + jk8SafeStock= Double.valueOf(jk8SafeStockField.getText()); + jk8WarehouseKeeper=jk8WarehouseKeeperField.getText(); + + JkRemarks=Jk8RemarksField.getText(); + JkProductIdno=Jk8ProductIdnoField.getText(); + jk8InnTransCoe = Double.valueOf(jk8InnTransCoeField.getText()); + try { + // + form.getTCProperty("jk8TechModel").setStringValue(Jk8TechModel); + form.getTCProperty("jk8SpecModel").setStringValue(Jk8SpecModel); + form.getTCProperty("jk8UnitWeight").setDoubleValue(jk8IsUnitWeight); + form.getTCProperty("jk8UnitVolume").setDoubleValue(jk8IsUnitVolume); + //2019.06.13 + System.out.println("汸ע"+JkRemarks); + form.getTCProperty("jk8Remarks").setStringValue(JkRemarks); + form.getTCProperty("jk8ProductIdentifyNO").setStringValue(JkProductIdno); + + // ɹ + form.getTCProperty("jk8IsDomesticMarket").setStringValue(jk8IsDomesticMarket); + form.getTCProperty("jk8IsBuy").setStringValue(jk8IsBuy); + form.getTCProperty("jk8Isconsumables").setStringValue(jk8Isconsumables); + form.getTCProperty("jk8IsMake").setStringValue(jk8IsMake); + form.getTCProperty("jk8IsOutsource").setStringValue(jk8IsOutsource); +// jk8AccountSet= form.getTCProperty("jk8AccountSet").getStringValue(); + String[] AccountSetString=service.getStringValue("jk8AccountSet").split(","); + for (int i = 0; i < AccountSetString.length; i++) { + if(AccountSetString[i].split("-")[1].equals(jk8AccountSet)) { + jk8AccountSet=AccountSetString[i].split("-")[0]; + break; + } + } + System.out.println("jk8AccountSet------------------------->"+jk8AccountSet); + form.getTCProperty("jk8AccountSet").setStringValue(jk8AccountSet); +// jk8BusinessType= form.getTCProperty("jk8BusinessType").getStringValue(); +// String[] BusinessTypeString=service.getStringValue("jk8BusinessType").split(","); +// for (int i = 0; i < BusinessTypeString.length; i++) { +// if(BusinessTypeString[i].split("-")[1].equals(jk8BusinessType)) { +// jk8BusinessType=BusinessTypeString[i].split("-")[0]; +// break; +// } +// } + form.getTCProperty("jk8BusinessType").setStringValue(jk8BusinessType); + System.out.println("ʱɹ---------------->"+jk8Buyer); + String[] BuyerString=service.getStringValue("jk8Buyer").split(","); + for (int i = 0; i < BuyerString.length; i++) { + if(BuyerString[i].split("-")[1].equals(jk8Buyer)) { + jk8Buyer=BuyerString[i].split("-")[0]; + break; + } + } + for (int i = 0; i < BuyerString.length; i++) { + if(BuyerString[i].split("-")[0].equals(jk8Buyer)) { + jk8Buyer=BuyerString[i].split("-")[0]; + break; + } + } + System.out.println("IJɹΪ---------------->"+jk8Buyer); + + form.getTCProperty("jk8Buyer").setStringValue(jk8Buyer); + form.getTCProperty("jk8PurLeadTime").setDoubleValue(jk8PurLeadTime); + + // + form.getTCProperty("jk8SafeStock").setDoubleValue(jk8SafeStock); + String[] Warehouse1String = service.getStringValue("jk8Warehouse1").split(","); + for (int i = 0; i < Warehouse1String.length; i++) { + if(Warehouse1String[i].split("-")[1].equals(jk8Warehouse1)) { + jk8Warehouse1=Warehouse1String[i].split("-")[0]; + break; + } + + } + form.getTCProperty("jk8Warehouse1").setStringValue(jk8Warehouse1); +// jk8SupplyType1 = form.getTCProperty("jk8SupplyType1").getStringValue().equals("3")?"3":form.getTCProperty("jk8SupplyType1").getStringValue(); + String[] SupplyType1String = service.getStringValue("jk8SupplyType1").split(","); + for (int i = 0; i < SupplyType1String.length; i++) { + if(SupplyType1String[i].split("-")[1].equals(jk8SupplyType1)) { + jk8SupplyType1=SupplyType1String[i].split("-")[0]; + break; + } + + } + System.out.println("jk8SupplyType1------------------------->"+jk8SupplyType1); + form.getTCProperty("jk8SupplyType1").setStringValue(jk8SupplyType1); + form.getTCProperty("jk8PlanMethod").setStringValue(jk8PlanMethod); + form.getTCProperty("jk8IsInnTrans").setStringValue(jk8IsInnTrans); + form.getTCProperty("jk8WarehouseKeeper").setStringValue(jk8WarehouseKeeper); + form.getTCProperty("jk8InnTransCoe").setDoubleValue(jk8InnTransCoe); + + + + } catch (TCException e) { + e.printStackTrace(); + } + + } + + @Override + public void itemStateChanged(ItemEvent e) { + + } +} diff --git a/src/com/teamcenter/rac/form/JK8PCBNOAppForm.java b/src/com/teamcenter/rac/form/JK8PCBNOAppForm.java new file mode 100644 index 0000000..109249e --- /dev/null +++ b/src/com/teamcenter/rac/form/JK8PCBNOAppForm.java @@ -0,0 +1,447 @@ +package com.teamcenter.rac.form; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionListener; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.swing.DefaultComboBoxModel; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; +import javax.swing.event.AncestorEvent; +import javax.swing.event.AncestorListener; + +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCComponentType; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.stylesheet.AbstractRendering; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; +import com.teamcenter.rac.util.combobox.iComboBox; + +public class JK8PCBNOAppForm extends AbstractRendering {//implements ItemListener + private TCComponentForm form; + private TCSession session; + private HashMap realNameMap; + + public JK8PCBNOAppForm(TCComponentForm arg0) throws Exception { + super(arg0); + // TODO Auto-generated constructor stub + form = arg0; + session = arg0.getSession(); + String[] names = session.getPreferenceService().getStringValues("JK8PCBNORegForm"); + if (names != null) { + + realNameMap = new HashMap<>(); + for (int i = 0; i < names.length; i++) { + String[] s = names[i].split("="); + if (s != null && s.length == 2) { + String key = s[0]; + String value = s[1]; + realNameMap.put(key, value); + } + + } + + } else { + MessageBox.post("ѡ JK8PCBNORegForm ڣϵԱ", "", MessageBox.ERROR); + } + initializeUI(); + loadRendering(); + // PCBֵͲ޸ + if (form.getTCProperty("jk8PCBNO").getStringValue().length() > 0) { + + mainPanel.addMouseMotionListener(new MouseMotionListener() { + + @Override + public void mouseMoved(MouseEvent e) { + // TODO Auto-generated method stub + Companylogo.setEnabled(false); + MeasureType.setEnabled(false); + CommunicateMode.setEnabled(false); + Application.setEnabled(false); +// Companylogo.setEditable(false); +// Companylogo.getTextField().setEditable(false); +// MeasureType.setEditable(false); +// CommunicateMode.setEditable(false); +// Application.setEditable(false); + } + + @Override + public void mouseDragged(MouseEvent e) { + // TODO Auto-generated method stub + + } + }); + } + } + + private void initializeUI() { + // TODO Auto-generated method stub + System.out.println("UI-----Start"); + initPanel(); + + } + + private JLabel tableName = new JLabel("PCBϢ"); + + private JLabel jk8Companylogo;// ˾ʶ + private JLabel jk8MeasureType;// ԭ + private JLabel jk8CommunicateMode;// ͨѶʽ + private JLabel jk8Application;// Ӧ÷Χ + // private JLabel jk8Revisionlevel;//汾ʶ + private JLabel jk8PCBNO;// PCB + private JLabel jk8PCBProjectName;//2017.11.9Ŀ + private iComboBox Companylogo = new iComboBox();// ˾ʶ + String logo = ""; + private iComboBox MeasureType = new iComboBox();// ԭ + String type = ""; + private iComboBox CommunicateMode = new iComboBox();// ͨѶʽ + String mode = ""; + private iComboBox Application = new iComboBox();// Ӧ÷Χ + String app = ""; + private JTextField Revisionlevel;// 汾ʶ + private JTextField PCBNO;// PCB + private JTextField PCBProjectName;// Ŀ2017.11.9 + + private JPanel mainPanel; + + private void initPanel() { + // TODO Auto-generated method stub + Font font = new Font("", 0, 24); + tableName.setFont(font); + Font font2 = new Font("", 0, 20); + this.setLayout(new BorderLayout()); + jk8Companylogo = new JLabel("˾ʶ"); + jk8Companylogo.setFont(font2); + jk8MeasureType = new JLabel("ԭ"); + jk8MeasureType.setFont(font2); + jk8CommunicateMode = new JLabel("ͨѶʽ"); + jk8CommunicateMode.setFont(font2); + jk8Application = new JLabel("Ӧ÷Χ"); + jk8Application.setFont(font2); + // jk8Revisionlevel=new JLabel("汾ʶ"); + // jk8Revisionlevel.setFont(font2); + jk8PCBNO = new JLabel("PCB"); + jk8PCBNO.setFont(font2); + + jk8PCBProjectName=new JLabel("Ŀ");//2017.11.9 + jk8PCBProjectName.setFont(font2); + + Revisionlevel = new JTextField(20); + PCBNO = new JTextField(19); + PCBNO.setEnabled(false); + + PCBProjectName=new JTextField(60);//2017.11.9Ŀ + PCBProjectName.setEnabled(true); + + setLov(Companylogo, "˾ʶ"); + setLov(Application, "Ӧ÷Χ"); + setLov(MeasureType, "ԭ"); + setLov(CommunicateMode, "ͨѶʽ"); + Companylogo.setEditable(false); + +// Application.addActionListener(new ActionListener() { +// +// @Override +// public void actionPerformed(ActionEvent e) { +// if (Application.getSelectedItem() != null) { +// if (((String) Application.getSelectedItem()).equals("ͨѶ") +// || ((String) Application.getSelectedItem()).equals("")) { +// System.out.println("Ӧ÷Χ------------>" + ((String) Application.getSelectedItem())); +// setLov2(MeasureType, new String[]{""}); +// setLov2(CommunicateMode, new String[]{""}); +// mainPanel.addMouseMotionListener(new MouseMotionListener() { +// +// @Override +// public void mouseMoved(MouseEvent e) { +// // TODO Auto-generated method stub +// System.out.println("qqqqq"); +//// MeasureType.getTextField().setText(""); +//// CommunicateMode.getTextField().setText(""); +//// MeasureType.setEnabled(false); +//// CommunicateMode.setEnabled(false); +// } +// +// @Override +// public void mouseDragged(MouseEvent e) { +// // TODO Auto-generated method stub +// +// } +// }); +// } else if (((String) Application.getSelectedItem()).equals("ȡ")) { +// System.out.println("Ӧ÷Χ------------>" + ((String) Application.getSelectedItem())); +// setLov2(MeasureType, new String[]{""}); +// setLov2(CommunicateMode, new String[]{""}); +// mainPanel.addMouseMotionListener(new MouseMotionListener() { +// +// @Override +// public void mouseMoved(MouseEvent e) { +// // TODO Auto-generated method stub +//// MeasureType.setEnabled(false); +//// CommunicateMode.setEnabled(false); +// System.out.println("wwwww"); +//// MeasureType.getTextField().setText(""); +//// CommunicateMode.getTextField().setText(""); +// } +// +// @Override +// public void mouseDragged(MouseEvent e) { +// // TODO Auto-generated method stub +// +// } +// }); +// } +// } +// } +// }); +// else if (((String) Application.getSelectedItem()).equals("") +// || ((String) Application.getSelectedItem()).equals("ҵ")) { +// System.out.println("Ӧ÷Χ------------>" + ((String) Application.getSelectedItem())); +// MeasureType.setEnabled(true); +// CommunicateMode.setEnabled(true); +// setLov(MeasureType, "ԭ"); +// setLov(CommunicateMode, "ͨѶʽ"); +// mainPanel.addMouseMotionListener(new MouseMotionListener() { +// @Override +// public void mouseMoved(MouseEvent e) { +// // TODO Auto-generated method stub +//// setLov(MeasureType, "ԭ"); +//// setLov(CommunicateMode, "ͨѶʽ"); +// } +// +// @Override +// public void mouseDragged(MouseEvent e) { +// // TODO Auto-generated method stub +// +// } +// }); +// } +// } +// +// } +// }); + + mainPanel = new JPanel(new PropertyLayout()); + //2017.11.9 Ŀ + + mainPanel.add("1.1.left.top", tableName); + mainPanel.add("2.1.left.top", jk8PCBProjectName); + mainPanel.add("2.2.left.top", PCBProjectName); + mainPanel.add("3.1.left.top", jk8Companylogo); + mainPanel.add("3.2.left.top", Companylogo); + mainPanel.add("4.1.left.top", jk8MeasureType); + mainPanel.add("4.2.left.top", MeasureType); + mainPanel.add("5.1.left.top", jk8CommunicateMode); + mainPanel.add("5.2.left.top", CommunicateMode); + mainPanel.add("6.1.left.top", jk8Application); + mainPanel.add("6.2.left.top", Application); + // mainPanel.add("6.1.left.top",jk8Revisionlevel); + // mainPanel.add("6.2.left.top",Revisionlevel); + mainPanel.add("7.1.left.top", jk8PCBNO); + mainPanel.add("7.2.left.top", PCBNO); + + this.setLayout(new BorderLayout()); + this.add(mainPanel, BorderLayout.CENTER); + this.setSize(new Dimension(650, 200)); + this.setVisible(true); + this.setBackground(Color.LIGHT_GRAY); + + } + + private void setLov(iComboBox box, String st) { + // TODO Auto-generated method stub + box.setTextFieldLength(18); + box.setAutoCompleteSuggestive(false); + box.removeAllItems(); + box.addItems(realNameMap.get(st).split(",")); + } + private void setLov2(iComboBox box, String[] items) { + // TODO Auto-generated method stub + box.setTextFieldLength(18); + box.setAutoCompleteSuggestive(false); + box.removeAllItems(); + box.addItems(items); + } + +// @Override +// public void itemStateChanged(ItemEvent e) { +// System.out.println("ѡ-----"); +// Object object = e.getSource(); +// if (object.equals(Companylogo)) { +// System.out.println("˾ʶ ѡˡ" + e.getItem() + ""); +// if (e.getStateChange() == ItemEvent.SELECTED) { +// if (e.getItem() != null) { +// logo = (String) e.getItem(); +// logo = logo.trim(); +// } else { +// return; +// } +// } +// } +// if (object.equals(Application)) { +// System.out.println("Ӧ÷Χ ѡˡ" + e.getItem() + ""); +// if (e.getStateChange() == ItemEvent.SELECTED) { +// if (e.getItem() != null) { +// app = (String) e.getItem(); +// app = app.trim(); +// } else { +// return; +// } +// } +// if (app.equals("ͨѶ") || app.equals("")) { +// // MeasureType.setSelectedIndex(3); +// // MeasureType.setEditable(false); +// // MeasureType.setEnabled(false); +// // CommunicateMode.setSelectedIndex(-1); +// // CommunicateMode.setEditable(false); +// // CommunicateMode.setEnabled(false); +// setLov(MeasureType, "˾ʶ"); +// mainPanel.addMouseMotionListener(new MouseMotionListener() { +// +// @Override +// public void mouseMoved(MouseEvent e) { +// MeasureType.setEnabled(false); +// CommunicateMode.setEnabled(false); +// } +// +// @Override +// public void mouseDragged(MouseEvent e) { +// // TODO Auto-generated method stub +// +// } +// }); +// +// } +// if (app.equals("ȡ")) { +// MeasureType.setSelectedIndex(-1); +// MeasureType.setEditable(false); +// MeasureType.setEnabled(false); +// CommunicateMode.setSelectedIndex(-1); +// CommunicateMode.setEditable(false); +// CommunicateMode.setEnabled(false); +// } +// } +// if (object.equals(MeasureType)) { +// System.out.println("ԭ ѡˡ" + e.getItem() + ""); +// if (e.getStateChange() == ItemEvent.SELECTED) { +// if (e.getItem() != null) { +// type = (String) e.getItem(); +// type = type.trim(); +// } else { +// return; +// } +// } +// } +// if (object.equals(CommunicateMode)) { +// System.out.println("ͨѶʽ ѡˡ" + e.getItem() + ""); +// if (e.getStateChange() == ItemEvent.SELECTED) { +// if (e.getItem() != null) { +// mode = (String) e.getItem(); +// mode = mode.trim(); +// } else { +// return; +// } +// } +// } +// } + + @Override + public void loadRendering() throws TCException { + PCBProjectName.setText(form.getTCProperty("jk8Projectname").getStringValue()== null ? "" + : form.getTCProperty("jk8Projectname").getStringValue()); + Companylogo.setText(form.getTCProperty("jk8Companylogo").getStringValue()); + MeasureType.setText(form.getTCProperty("jk8MeasureType").getStringValue()); + CommunicateMode.setText(form.getTCProperty("jk8CommunicateMode").getStringValue()); + Application.setText(form.getTCProperty("jk8Application").getStringValue()); + // Revisionlevel.setText(form.getTCProperty("jk8PCBNO").getStringValue()==null?"":form.getTCProperty("jk8PCBNO").getStringValue()); + PCBNO.setText(form.getTCProperty("jk8PCBNO").getStringValue() == null ? "" + : form.getTCProperty("jk8PCBNO").getStringValue()); + } + + /*@Override + public Map getRenderingModified() { + Map modifiedRendering = new HashMap (); + try { + System.out.println("getRenderingModifiedʼ"); + saveRendering(); + }catch(Exception ex){ + ex.toString(); + System.out.println(ex.toString()); + } + + + return modifiedRendering; + }*/ + + public boolean isRenderingModified() { + System.out.println("isRenderingModified"); + + try { + + if(isrend(form.getTCProperty("jk8Projectname"),PCBProjectName.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8Companylogo"),Companylogo.getTextField().getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8MeasureType"),MeasureType.getTextField().getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8CommunicateMode"),CommunicateMode.getTextField().getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8Application"),Application.getTextField().getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8PCBNO"),PCBNO.getText())){ + return true; + } + + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + }// гѡ + return false; + } + + + private boolean isrend(TCProperty tcProperty, String str) { + // TODO Auto-generated method stub + if(tcProperty!=null&&str!=null&&(!str.equals(tcProperty.getStringValue()))){ + System.out.println(str); + return true; + } + return false; + } + + @Override + public void saveRendering() { + try { + form.getTCProperty("jk8Projectname").setStringValue(PCBProjectName.getText()); + form.getTCProperty("jk8Companylogo").setStringValue(Companylogo.getTextField().getText()); + form.getTCProperty("jk8MeasureType").setStringValue(MeasureType.getTextField().getText()); + form.getTCProperty("jk8CommunicateMode").setStringValue(CommunicateMode.getTextField().getText()); + form.getTCProperty("jk8Application").setStringValue(Application.getTextField().getText()); + // form.getTCProperty("jk8Revisionlevel").setStringValue(Revisionlevel.getText()); + form.getTCProperty("jk8PCBNO").setStringValue(PCBNO.getText()); + } catch (TCException e) { + e.printStackTrace(); + } + } + +} diff --git a/src/com/teamcenter/rac/form/JK8PCBNORegForm.java b/src/com/teamcenter/rac/form/JK8PCBNORegForm.java new file mode 100644 index 0000000..5388165 --- /dev/null +++ b/src/com/teamcenter/rac/form/JK8PCBNORegForm.java @@ -0,0 +1,428 @@ +package com.teamcenter.rac.form; + +import java.awt.BorderLayout; +import java.awt.Font; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.swing.CellEditor; +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.table.DefaultTableModel; + +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCComponentType; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.stylesheet.AbstractRendering; + +public class JK8PCBNORegForm extends AbstractRendering implements ItemListener { + private TCComponentForm form = null; + private TCSession session; + // ideȡֵ + private String[] jk8Companylogo; + private String[] jk8MeasureType; + private String[] jk8CommunicateMode; + private String[] jk8Application; + private String[] jk8Revisionlevel; + private String[] jk8PCBNO; + private String[] jk8Projectname;//2017.9.11 + + // ȡֵ + private String[] jk8Companylogo1; + private String[] jk8MeasureType1; + private String[] jk8CommunicateMode1; + private String[] jk8Application1; + private String[] jk8Revisionlevel1; + private String[] jk8PCBNO1; + private String[] jk8Projectname1;//2017.9.11 + + public JK8PCBNORegForm(TCComponentForm arg0) throws Exception { + super(arg0); + this.form = arg0; + this.session = arg0.getSession(); + loadRendering(); + } + + @Override + public void itemStateChanged(ItemEvent e) { + // TODO Auto-generated method stub + } + + @Override + public void loadRendering() throws TCException { + // TODO Auto-generated method stub + jk8Companylogo = form.getTCProperty("jk8Companylogo").getStringArrayValue(); + jk8MeasureType = form.getTCProperty("jk8MeasureType").getStringArrayValue(); + jk8CommunicateMode = form.getTCProperty("jk8CommunicateMode").getStringArrayValue(); + jk8Application = form.getTCProperty("jk8Application").getStringArrayValue(); + // jk8Revisionlevel = + // form.getTCProperty("jk8Revisionlevel").getStringArrayValue(); + jk8PCBNO = form.getTCProperty("jk8PCBNO").getStringArrayValue(); + jk8Projectname = form.getTCProperty("jk8Projectname").getStringArrayValue(); + + initPanel(); + + } + + private JPanel panel; + private JPanel topJPanel; + private JPanel mainJPanel; + private JTable dataTable1; + private JLabel title; + private JButton addBut; + private Object[] obj = new Object[] { "","Ŀ", "˾ʶ", "Ӧ÷Χ", "ԭ", "ͨѶʽ", "PCB" }; + private List valueLists;// ȡ + private int countNumber; + + private void initPanel() { + valueLists = new ArrayList(); + getFormVlue(); + this.setLayout(new BorderLayout()); + panel = new JPanel(new BorderLayout()); + topJPanel = new JPanel(new BorderLayout()); + title = new JLabel("PCBǼDZ"); + Font font = new Font("", 0, 24); + title.setFont(font); + topJPanel.add(BorderLayout.CENTER, title); + addBut = new JButton(""); + String[] names = session.getPreferenceService().getStringValue("Allowed_Account").split(",");//˺ţadmin,infodba + String userid=""; + boolean visible=false; + try { + userid=session.getUser().getUserId(); + for (int i = 0; i < names.length; i++) { + if(userid.equals(names[i])) { + visible=true; + break; + } + + } + } catch (TCException e1) { + e1.printStackTrace(); + } + if(visible) { + + topJPanel.add(BorderLayout.EAST, addBut); + } + + mainJPanel = new JPanel(new BorderLayout()); + this.dataTable1 = getjTable(this.dataTable1, null, obj, null); + dataTable1.setDefaultRenderer(Object.class, new TableComboxRender()); + mainJPanel.add(new JScrollPane(this.dataTable1), BorderLayout.CENTER); + int rowCount = this.dataTable1.getRowCount(); + Object[][] values = new Object[valueLists.size()][7];//2017.11.9һĿ + countNumber = 0; + for (int i = 0; i < valueLists.size(); i++) { + countNumber++; + values[i][0] = countNumber + "";// + values[i][1] = valueLists.get(i).ProjectName;// Ŀ + values[i][2] = valueLists.get(i).Companylogo;// ˾ʶ + values[i][3] = valueLists.get(i).Application;// Ӧ÷Χ + values[i][4] = valueLists.get(i).MeasureType;// ԭ + values[i][5] = valueLists.get(i).CommunicateMode;// ͨѶʽ + // values[i][5] = valueLists.get(i).Revisionlevel;// 汾ʶ + values[i][6] = valueLists.get(i).PCBNO;// PCB + } + for (int i = rowCount - 1; i >= 0; i--) { + ((DefaultTableModel) this.dataTable1.getModel()).removeRow(i); + } + for (int i = 0; i < values.length; i++) { + if (values[i][1] != null) { + + ((DefaultTableModel) this.dataTable1.getModel()).addRow(values[i]); + } + } + addBut.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + addrow(); + } + }); + panel.add(topJPanel, BorderLayout.NORTH); + panel.add(mainJPanel, BorderLayout.CENTER); + this.add(panel); + this.setVisible(true); + } + + protected void addrow() { + // TODO Auto-generated method stub + System.out.println(""); + ((DefaultTableModel) dataTable1.getModel()).addRow(new String[7]); + setxh(dataTable1); + + } + + // ųʼ + private void setxh(JTable table) { + // TODO Auto-generated method stub + int cl = table.getRowCount(); + for (int i = 0; i < cl; i++) { + table.setValueAt(i + 1 + "", i, 0); + } + } + + private TCProperty[] propertiesArray; + public static final String[] PROP_NAMES = { // + "jk8Projectname","jk8Companylogo", "jk8Application", "jk8MeasureType", "jk8CommunicateMode", // 5 + "jk8PCBNO" }; + + private void getFormVlue() { + // TODO Auto-generated method stub + this.valueLists = new ArrayList<>(); + try { + // ȡֵ + propertiesArray = form.getTCProperties(PROP_NAMES); + // дֵԵ + if (propertiesArray != null) { + String[] valueStrs0 = propertiesArray[0] == null ? new String[0] + : propertiesArray[0].getStringArrayValue(); + String[] valueStrs1 = propertiesArray[1] == null ? new String[0] + : propertiesArray[1].getStringArrayValue(); + String[] valueStrs2 = propertiesArray[2] == null ? new String[0] + : propertiesArray[2].getStringArrayValue(); + String[] valueStrs3 = propertiesArray[3] == null ? new String[0] + : propertiesArray[3].getStringArrayValue(); + String[] valueStrs4 = propertiesArray[4] == null ? new String[0] + : propertiesArray[4].getStringArrayValue(); + String[] valueStrs5 = propertiesArray[5] == null ? new String[0] + : propertiesArray[5].getStringArrayValue(); + // String[] valueStrs5 = propertiesArray[5] == null ? new String[0] + // : propertiesArray[5].getStringArrayValue(); + + if ( + // valueStrs0.length == valueStrs1.length + // && valueStrs0.length == valueStrs2.length + // && + valueStrs0.length == valueStrs3.length && valueStrs0.length == valueStrs4.length + + && valueStrs0.length != 0) { + for (int i = 0; i < valueStrs0.length; i++) { + JK8_PCB_PropBean bean = new JK8_PCB_PropBean(); + bean.setProjectName(valueStrs0[i]);//Ŀ + bean.setCompanylogo(valueStrs1[i]); // "˾ʶ", + bean.setApplication(valueStrs2[i]); // "Ӧ÷Χ", + bean.setMeasureType(valueStrs3[i]); // "ԭ", + bean.setCommunicateMode(valueStrs4[i]);// "ͨѶʽ" + // bean.setRevisionlevel(valueStrs4[i]); // "汾ʶ", + bean.setPCBNO(valueStrs5[i]); // "PCB", + + this.valueLists.add(bean); + } + } + } + } catch (TCException e) { + e.printStackTrace(); + } + } + + // Jtableͨ÷ + public JTable getjTable(JTable partsTable, DefaultTableModel dtm, Object[] titleNames, Object[][] values) { + int simpleLen = 105; + int totleLen = 900; + if (partsTable == null) { + partsTable = new JTable(getTableModel(dtm, titleNames, values)) { + // TODO ֻ5~8вǻǩԼ¿޸ + @Override + public boolean isCellEditable(int row, int column) { + // if (column == 7 || column == 8) { + // // ((DefaultTableModel) + // // partsTable.getModel()).getValueAt(row, 1); + // return true; + // // if(session.getUserName().equals(anObject)){ + // // + // // }else{ + // // return false; + // // } + // } else { + // return false; + // } + return true;// ɱ༭ + } + }; + partsTable.setRowHeight(20); + if (simpleLen * titleNames.length >= totleLen) { + for (int i = 0; i < titleNames.length; i++) { + partsTable.getColumnModel().getColumn(i).setPreferredWidth(105); + } + partsTable.setAutoResizeMode(0); + } else { + partsTable.setAutoResizeMode(1); + } + } + return partsTable; + } + + // tableؼ + public DefaultTableModel getTableModel(DefaultTableModel dtm, Object[] columnNameObjects, Object[][] objects) { + if (dtm == null) { + dtm = new DefaultTableModel(objects, columnNameObjects); + } + return dtm; + } + + /*@Override + public Map getRenderingModified() { + Map modifiedRendering = new HashMap (); + try { + System.out.println("getRenderingModifiedʼ"); + saveRendering(); + }catch(Exception ex){ + ex.toString(); + System.out.println(ex.toString()); + } + + + return modifiedRendering; + }*/ + +// public boolean isRenderingModified() { +// System.out.println("isRenderingModified"); +// +// try { +// int rowCount1 = dataTable1.getRowCount(); +// jk8Projectname=new String[rowCount1];//Ŀ +// jk8Companylogo1 = new String[rowCount1];// ˾ʶ +// jk8MeasureType1 = new String[rowCount1];// ԭ +// jk8CommunicateMode1 = new String[rowCount1];// ͨѶʽ +// jk8Application1 = new String[rowCount1];// Ӧ÷Χ +// jk8PCBNO1 = new String[rowCount1];// PCB +// // //ȡɱ༭״̬漰ʱ޸ĵ +//// try { +//// //쳣رաwin72008ϵͳлᵼTCر쳣 +//// for (int i = 0; i < rowCount1; i++) { +//// for (int j = 1; j < 7; j++) { +//// +//// CellEditor ce = dataTable1.getCellEditor(i, j); +//// ce.stopCellEditing(); +//// } +//// } +////// for (int i = 0; i < rowCount1; i++) { +////// CellEditor ce = dataTable1.getCellEditor(i, 8); +////// ce.stopCellEditing(); +////// } +//// } catch (Exception e) { +//// e.printStackTrace(); +//// } +// // ѭÿУֵformӦԡ +// for (int j = 0; j < rowCount1; j++) { +// // lx1[j] = "tb1"; +// jk8Projectname1[j] = dataTable1.getValueAt(j, 1) == null ? "" : (String) dataTable1.getValueAt(j, 1);// ˾ʶ +// jk8Companylogo1[j] = dataTable1.getValueAt(j, 2) == null ? "" : (String) dataTable1.getValueAt(j, 2);// ˾ʶ +// jk8Application1[j] = dataTable1.getValueAt(j, 3) == null ? "" : (String) dataTable1.getValueAt(j, 3);// Ӧ÷Χ +// jk8MeasureType1[j] = dataTable1.getValueAt(j, 4) == null ? "" : (String) dataTable1.getValueAt(j, 4);// ԭ +// jk8CommunicateMode1[j] = dataTable1.getValueAt(j, 5) == null ? "" : (String) dataTable1.getValueAt(j, 5);// ͨѶʽ +// jk8PCBNO1[j] = dataTable1.getValueAt(j, 6) == null ? "" : (String) dataTable1.getValueAt(j, 6);// PCB +// } +// if(isrend(form.getTCProperty("jk8Projectname").getStringArrayValue(),jk8Projectname1)){ +// return true; +// } +// if(isrend(form.getTCProperty("jk8Companylogo").getStringArrayValue(),jk8Companylogo1)){ +// return true; +// } +// if(isrend(form.getTCProperty("jk8MeasureType").getStringArrayValue(),jk8MeasureType1)){ +// return true; +// } +// if(isrend(form.getTCProperty("jk8CommunicateMode").getStringArrayValue(),jk8CommunicateMode1)){ +// return true; +// } +// if(isrend(form.getTCProperty("jk8Application").getStringArrayValue(),jk8Application1)){ +// return true; +// } +// if(isrend(form.getTCProperty("jk8PCBNO").getStringArrayValue(),jk8PCBNO1)){ +// return true; +// } +// +// } catch (Exception e) { +// // TODO Auto-generated catch block +// System.out.println(e.getMessage()); +// return false; +// }// гѡ +// return false; +// } + + + public boolean isrend(Object[] jkfxget, Object[] jkfxset) { + // TODO Auto-generated method stub + if(jkfxget!=null&&jkfxset!=null){ + if(jkfxget.length==jkfxset.length){ + for (int i = 0; i < jkfxset.length; i++) { + if(jkfxget[i]!=null&&(!jkfxget[i].equals(jkfxset[i]))){ + return true; + } + if(jkfxget[i]==null&&jkfxset[i]!=null&&(!jkfxset[i].equals(""))){ + return true; + } + } + }else{ + return true; + } + } + + return false; + } + + @Override + public void saveRendering() { + // TODO Auto-generated method stub + int rowCount1 = dataTable1.getRowCount(); + jk8Projectname=new String[rowCount1];//Ŀ + jk8Companylogo1 = new String[rowCount1];// ˾ʶ + jk8MeasureType1 = new String[rowCount1];// ԭ + jk8CommunicateMode1 = new String[rowCount1];// ͨѶʽ + jk8Application1 = new String[rowCount1];// Ӧ÷Χ + jk8PCBNO1 = new String[rowCount1];// PCB + // //ȡɱ༭״̬漰ʱ޸ĵ + try { + //쳣رաwin72008ϵͳлᵼTCر쳣 + for (int i = 0; i < rowCount1; i++) { + for (int j = 1; j < 7; j++) { + + CellEditor ce = dataTable1.getCellEditor(i, j); + ce.stopCellEditing(); + } + } +// for (int i = 0; i < rowCount1; i++) { +// CellEditor ce = dataTable1.getCellEditor(i, 8); +// ce.stopCellEditing(); +// } + } catch (Exception e) { + e.printStackTrace(); + } + // ѭÿУֵformӦԡ + for (int j = 0; j < rowCount1; j++) { + // lx1[j] = "tb1"; + jk8Projectname1[j] = dataTable1.getValueAt(j, 1) == null ? "" : (String) dataTable1.getValueAt(j, 1);// ˾ʶ + jk8Companylogo1[j] = dataTable1.getValueAt(j, 2) == null ? "" : (String) dataTable1.getValueAt(j, 2);// ˾ʶ + jk8Application1[j] = dataTable1.getValueAt(j, 3) == null ? "" : (String) dataTable1.getValueAt(j, 3);// Ӧ÷Χ + jk8MeasureType1[j] = dataTable1.getValueAt(j, 4) == null ? "" : (String) dataTable1.getValueAt(j, 4);// ԭ + jk8CommunicateMode1[j] = dataTable1.getValueAt(j, 5) == null ? "" : (String) dataTable1.getValueAt(j, 5);// ͨѶʽ + jk8PCBNO1[j] = dataTable1.getValueAt(j, 6) == null ? "" : (String) dataTable1.getValueAt(j, 6);// PCB + } + try { + form.getTCProperty("jk8Projectname").setStringValueArray(jk8Projectname1); + form.getTCProperty("jk8Companylogo").setStringValueArray(jk8Companylogo1); + form.getTCProperty("jk8MeasureType").setStringValueArray(jk8MeasureType1); + form.getTCProperty("jk8CommunicateMode").setStringValueArray(jk8CommunicateMode1);// + form.getTCProperty("jk8Application").setStringValueArray(jk8Application1); + form.getTCProperty("jk8PCBNO").setStringValueArray(jk8PCBNO1); + + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + +} diff --git a/src/com/teamcenter/rac/form/JK8_ALARM_DERIVATIVES_SBH_Form.java b/src/com/teamcenter/rac/form/JK8_ALARM_DERIVATIVES_SBH_Form.java new file mode 100644 index 0000000..f58e087 --- /dev/null +++ b/src/com/teamcenter/rac/form/JK8_ALARM_DERIVATIVES_SBH_Form.java @@ -0,0 +1,629 @@ +package com.teamcenter.rac.form; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionListener; +import java.util.HashMap; + +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; + +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.stylesheet.AbstractRendering; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; +import com.teamcenter.rac.util.combobox.iComboBox; + +//3Ʒʶ +public class JK8_ALARM_DERIVATIVES_SBH_Form extends AbstractRendering implements ItemListener { + + // private JButton tijiao; + private JButton yanzhen; + private JPanel mainPanel; + + private JPanel topPanel; + private JPanel topPanel_1; +// private JPanel topPanel_2; + private JPanel firstJPanel; + private JPanel secondJPanel; + private JPanel secondJPanel_1; + private JPanel secondJPanel_2; + private JPanel thirdJPanel; + private TCComponentForm form; + private TCSession session; + + String jffs = ""; + private JComboBox comBox; + private JTextField jt1;//׼ʶ + private JTextField jt2;// + private JTextField jtjbcj;// + private JTextField jt3;// + private JTextField jt4;//Ʒ + + private JTextField jt10;//Ʒͺ + private JTextField jt11;//ʶ + + private JLabel jl1; + private JLabel jl2; +// private JLabel jl3;//Ʒ + private JLabel jl4; + + // private Registry registry = null; +// private iComboBox box3 = new iComboBox();// + private iComboBox box5 = new iComboBox();// ֹ + private JTextField khgn= new JTextField(20); + private iComboBox box6 = new iComboBox();// ط + private JTextField bjgf= new JTextField(20); + private iComboBox box7 = new iComboBox();// Կ + private JTextField my= new JTextField(20); + private iComboBox box8 = new iComboBox();// ûԴ㹦 + private JTextField yhql= new JTextField(20); + private iComboBox box9 = new iComboBox();// ¶Ȳ + private JTextField wdbc= new JTextField(20); + private iComboBox box10 = new iComboBox();// + private JTextField glbh= new JTextField(20); + private iComboBox box11 = new iComboBox();// + private JTextField wymp= new JTextField(20); + private HashMap realNameMap; + + private String jt;// ׼ʶ + + private String isCheck; + + private JTextField jt01;// Ŀ + private JTextField jt02;// Ŀ + private JTextField jt03;// Ʒ + + public JK8_ALARM_DERIVATIVES_SBH_Form(TCComponentForm arg0) throws Exception { + super(arg0); + form = arg0; + session = arg0.getSession(); + // registry = Registry.getRegistry("com.teamcenter.rac.form.form_user"); + String[] names = session.getPreferenceService().getStringValues( + "JK8_WATER_DERIVATIVES_SBH_FORM"); + if (names != null) { + + realNameMap = new HashMap<>(); + for (int i = 0; i < names.length; i++) { + String[] s = names[i].split("="); + if (s != null && s.length == 2) { + String key = s[0]; + String value = s[1]; + realNameMap.put(key, value); + } + + } + + } else { + MessageBox.post("ѡ JK8_WATER_DERIVATIVES_SBH_FORM ڣϵԱ", "", + MessageBox.ERROR); + } + initializeUI(); + loadRendering(); + + mainPanel.addMouseMotionListener(new MouseMotionListener() { + + @Override + public void mouseMoved(MouseEvent e) { + try { + isCheck = form.getTCProperty("fnd0IsCheckoutable") + .getDisplayableValue(); + } catch (TCException e1) { + e1.printStackTrace(); + } + if ("".equals(isCheck)) { + seten(!"".equals(jt10.getText())); + setOwnerHave(); + } + } + + @Override + public void mouseDragged(MouseEvent e) { + + } + }); + + + jt10.setEnabled(false); + jt11.setEnabled(false); + + } + + public void initializeUI() { + System.out.println("UI-----Start"); + initPanel(); + + } + + private void setLov(iComboBox box, String st) { + box.setTextFieldLength(18); + box.setAutoCompleteSuggestive(false); + box.addItems(realNameMap.get(st).split(",")); + } + + public void initPanel() { + System.out.println("--------------------------"); + jt1 = new JTextField(20); + jt2 = new JTextField(20); + jtjbcj = new JTextField(20); + jt3 = new JTextField(20); + jt4 = new JTextField(20); + jt4.setEnabled(false); + jtjbcj.setEnabled(false); + jt2.setEnabled(false); + jt3.setEnabled(false); + + + jt10 = new JTextField(25); + jt11 = new JTextField(25); + jt01 = new JTextField(20); + jt02 = new JTextField(20); + jt03 = new JTextField(20); + + jl1 = new JLabel(" ׼ʶ:"); + jl1.setSize(50, 20); + jl2 = new JLabel(" ˮƷʶϢǼ"); + jl2.setSize(70, 20); +// jl3 = new JLabel(" Ʒͣ"); +// jl3.setSize(70, 20); + jl4 = new JLabel(" ˮƷʶ"); + jl4.setFont(new Font("", 0, 24)); + jl2.setFont(new Font("", 0, 20)); + mainPanel = new JPanel(new PropertyLayout()); + this.setSize(new Dimension(650, 250)); + this.setLayout(new BorderLayout()); + + topPanel = new JPanel(new PropertyLayout()); + topPanel_1 = new JPanel(new PropertyLayout()); + topPanel_1.add("1.1.left.top.preferred.preferred", jl4); + topPanel_1.add("1.2.left.top.preferred.preferred", new JLabel( + " ")); + topPanel.add("1.1.left.top.preferred.preferred", topPanel_1); + // topPanel.add("1.2.right.bottom.preferred.preferred", topPanel_2); + + firstJPanel = new JPanel(new PropertyLayout()); + +// topPanel.add("2.1.left.top.preferred.preferred", new JLabel(""));// ƷʶϢǼ + topPanel.add("2.1.left.top.preferred.preferred", jl2); + firstJPanel.add("1.1.left.top.preferred.preferred", jl1); + firstJPanel.add("1.2.right.top.preferred.preferred", getjl()); + firstJPanel.add("1.3.left.top.preferred.preferred", jt1); + yanzhen = new JButton("֤ʶ"); + yanzhen.setEnabled(true); + yanzhen.setPreferredSize(new Dimension(100, 20)); + yanzhen.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + System.out.println("֤"); + yzbut(); + + } + }); + firstJPanel.add("1.4.left.top.preferred.preferred", yanzhen); + firstJPanel.add("2.1.left.top.preferred.preferred", new JLabel( + " Ŀƣ")); + firstJPanel.add("2.2.right.top.preferred.preferred", getjl()); + firstJPanel.add("2.3.left.top.preferred.preferred", jt01); + firstJPanel.add("3.1.left.top.preferred.preferred", new JLabel( + " Ŀţ")); + firstJPanel.add("3.2.right.top.preferred.preferred", getjl()); + firstJPanel.add("3.3.left.top.preferred.preferred", jt02); + firstJPanel.add("4.1.left.top.preferred.preferred", new JLabel( + " Ʒƣ")); + firstJPanel.add("4.2.right.top.preferred.preferred", getjl()); + firstJPanel.add("4.3.left.top.preferred.preferred", jt03); + secondJPanel = new JPanel(new PropertyLayout()); + secondJPanel_1 = new JPanel(new PropertyLayout()); + + /* secondJPanel_1.add("1.1.left.top.preferred.preferred", jl3); + secondJPanel_1.add("1.2.left.top.preferred.preferred", jt4);*/ + + secondJPanel_1.add("1.1.left.top.preferred.preferred", new JLabel( + " ʣ")); + secondJPanel_1.add("1.2.left.top.preferred.preferred", jt2); + + secondJPanel_1.add("1.3.left.top.preferred.preferred", new JLabel( + " ң")); +// setLov(box3, ""); + secondJPanel_1.add("1.4.left.top.preferred.preferred", jtjbcj); + + secondJPanel_1.add("2.1.left.top.preferred.preferred", new JLabel( + " ͣ")); + secondJPanel_1.add("2.2.left.top.preferred.preferred", jt3); + // + secondJPanel_2 = new JPanel(new PropertyLayout()); + + /* secondJPanel_2.add("1.1.left.top.preferred.preferred", new JLabel(" ֹܣ")); +// setLov(box5, "ֹ"); + secondJPanel_2.add("1.2.left.top.preferred.preferred", khgn);*/ + + secondJPanel_2.add("1.1.left.top.preferred.preferred", new JLabel(" طܣ")); +// setLov(box6, "ط"); + secondJPanel_2.add("1.2.left.top.preferred.preferred", bjgf); + + /*secondJPanel_2.add("2.1.left.top.preferred.preferred", new JLabel(" Կ")); +// setLov(box7, "Կ"); + secondJPanel_2.add("2.2.left.top.preferred.preferred", my); + + secondJPanel_2.add("2.3.left.top.preferred.preferred", new JLabel(" ûԴ㹦ܣ")); +// setLov(box8, "ûԴ㹦"); + secondJPanel_2.add("2.4.left.top.preferred.preferred", yhql); + + secondJPanel_2.add("3.1.left.top.preferred.preferred", new JLabel(" ¶Ȳ")); +// setLov(box9, "¶Ȳ"); + secondJPanel_2.add("3.2.left.top.preferred.preferred", wdbc); + + secondJPanel_2.add("3.3.left.top.preferred.preferred", new JLabel(" ")); +// setLov(box10, ""); + secondJPanel_2.add("3.4.left.top.preferred.preferred", glbh);*/ + + secondJPanel_2.add("1.3.left.top.preferred.preferred", new JLabel(" ƣ")); +// setLov(box11, ""); + secondJPanel_2.add("1.4.left.top.preferred.preferred", wymp); + + + + secondJPanel.add("1.1.left.top.preferred.preferred", secondJPanel_1); + secondJPanel.add("2.1.left.top.preferred.preferred", secondJPanel_2); + thirdJPanel = new JPanel(new PropertyLayout()); + thirdJPanel.add("1.1.left.top.preferred.preferred", new JLabel( + " Ʒͺţ ")); + thirdJPanel.add("1.2.left.top.preferred.preferred", jt10); + thirdJPanel.add("1.3.left.top.preferred.preferred", new JLabel( + " ʶţ")); + thirdJPanel.add("1.4.left.top.preferred.preferred", jt11); + + mainPanel.add("1.1.left.top.preferred.preferred", topPanel); + mainPanel.add("2.1.left.top.preferred.preferred", firstJPanel); + mainPanel.add("3.1.left.top.preferred.preferred", secondJPanel); + mainPanel.add("4.1.left.top.preferred.preferred", thirdJPanel); + this.add(mainPanel); + this.setVisible(true); + this.setBackground(Color.LIGHT_GRAY); + } + + @Override + public void loadRendering() throws TCException { + System.out.println("loadRendering"); + + jt1.setText(form.getTCProperty("jk8BaseIdentifyNO").getStringValue());// ׼ʶ +// box3.setText(form.getTCProperty("jk8BMManufactor").getStringValue());// + jtjbcj.setText(form.getTCProperty("jk8BMManufactor").getStringValue());// + + jt01.setText(form.getTCProperty("jk8ProjectName").getStringValue());// Ŀ + jt02.setText(form.getTCProperty("jk8ProjectNO").getStringValue());// Ŀ + jt03.setText(form.getTCProperty("jk8ProductName").getStringValue());// Ʒ + + jt4.setText(form.getTCProperty("jk8ProductType").getStringValue());// Ʒ + jt2.setText(form.getTCProperty("jk8BMMaterial").getStringValue());// + jt3.setText(form.getTCProperty("jk8ContrlCompType").getStringValue());// + + /*box5.setText(form.getTCProperty("jk8ForbOpenAccount").getStringValue());// ֹ + box6.setText(form.getTCProperty("jk8SecurityFunc").getStringValue());// ط + box7.setText(form.getTCProperty("jk8SecretKey").getStringValue());// Կ + + box8.setText(form.getTCProperty("jk8WithZero").getStringValue());// ûԴ㹦 + box9.setText(form.getTCProperty("jk8TempPressCompFunc").getStringValue());// ¶Ȳ + box10.setText(form.getTCProperty("jk8OvercurrentPro").getStringValue());// + box11.setText(form.getTCProperty("jk8ForeignLanName").getStringValue());// +*/ +// khgn.setText(form.getTCProperty("jk8ForbOpenAccount").getStringValue());// ֹ + bjgf.setText(form.getTCProperty("jk8SecurityFunc").getStringValue());// ط +// my.setText(form.getTCProperty("jk8SecretKey").getStringValue());// Կ +// yhql.setText(form.getTCProperty("jk8WithZero").getStringValue());// ûԴ㹦 +// wdbc.setText(form.getTCProperty("jk8TempPressCompFunc").getStringValue());// ¶Ȳ +// glbh.setText(form.getTCProperty("jk8OvercurrentPro").getStringValue());// + wymp.setText(form.getTCProperty("jk8ForeignLanName").getStringValue());// + + jt10.setText(form.getTCProperty("jk8ProductModNO").getStringValue());// Ʒͺ + jt11.setText(form.getTCProperty("jk8ProductIdentifyNO").getStringValue());// ʶ + + } + + + + @Override + public void saveRendering() { + //TODO ȷЩDZҪ + System.out.println(jt01.getText()); + System.out.println(jt02.getText()); + System.out.println(jt1.getText()); + if ( "".equals(jt1.getText())) { + MessageBox.post("޷,ȷȫд!!", "", MessageBox.ERROR); + }else{ + //ʶΪգôԱϢ + if ("".equals(jt11.getText())) { + try { + form.getTCProperty("jk8ProjectName").setStringValue( + jt01.getText());// Ŀ + form.getTCProperty("jk8ProjectNO").setStringValue( + jt02.getText());// Ŀ + form.getTCProperty("jk8ProductName").setStringValue( + jt03.getText());// Ʒ + form.getTCProperty("jk8BaseIdentifyNO").setStringValue( + jt1.getText());// ׼ʶ +// form.getTCProperty("jk8BMManufactor").setStringValue(box3.getTextField().getText());// + form.getTCProperty("jk8BMManufactor").setStringValue( + jtjbcj.getText());// + form.getTCProperty("jk8ProductType").setStringValue( + jt4.getText());// Ʒ + form.getTCProperty("jk8BMMaterial").setStringValue( + jt2.getText());// + form.getTCProperty("jk8ContrlCompType").setStringValue( + jt3.getText());// + form.getTCProperty("jk8ProductModNO").setStringValue( + jt10.getText());// Ʒͺ + form.getTCProperty("jk8ProductIdentifyNO").setStringValue( + jt11.getText());// ʶ + +// form.getTCProperty("jk8ForbOpenAccount").setStringValue(khgn.getText());// ֹ + form.getTCProperty("jk8SecurityFunc").setStringValue(bjgf.getText());// ط +// form.getTCProperty("jk8SecretKey").setStringValue(my.getText());// Կ +// form.getTCProperty("jk8WithZero").setStringValue(yhql.getText());// ûԴ㹦 +// form.getTCProperty("jk8TempPressCompFunc").setStringValue(wdbc.getText());// ¶Ȳ +// form.getTCProperty("jk8OvercurrentPro").setStringValue(glbh.getText());// + form.getTCProperty("jk8ForeignLanName").setStringValue(wymp.getText());// + + } catch (Exception e) { + e.printStackTrace(); + } + } else { + MessageBox.post("ʶѴ,޷ٴα", "", MessageBox.ERROR); + } + } + + + } + + //DZ˾Ͳ޸ + public void setOwnerHave() { + try { + + String user = session.getUserName(); + String owning_user = form.getProperty("owning_user"); + // System.out.println("owning_user.indexOf(user)="+owning_user.indexOf(user)); + if (owning_user.indexOf(user) < 0) {//û߲ͬһ˾ͽֹ޸ + jt1.setEnabled(false); + jt2.setEnabled(false); + jt3.setEnabled(false); + jt4.setEnabled(false); + yanzhen.setEnabled(false); +// box3.setEnabled(false); + jtjbcj.setEnabled(false); + box5.setEnabled(false); + box6.setEnabled(false); + box7.setEnabled(false); + box8.setEnabled(false); + box9.setEnabled(false); + box10.setEnabled(false); + box11.setEnabled(false); + jt10.setEnabled(false); + jt11.setEnabled(false); + jt01.setEnabled(false); + jt02.setEnabled(false); + jt03.setEnabled(false); + + } + } catch (TCException e) { + System.out.println("ӵǷʱļеòȷҲ"); + e.printStackTrace(); + } + } + + //׼ʶŶԵϾ༭ + public void seten(boolean is) { +// jtjbcj.setEnabled(is);// + box5.setEnabled(is);//ֹ + box6.setEnabled(is);//ط + box7.setEnabled(is);// Կ + box8.setEnabled(is);//ûԴ㹦 + box9.setEnabled(is);//¶Ȳ + box10.setEnabled(is);// + box11.setEnabled(is);// + jt01.setEnabled(is);//Ŀ + jt02.setEnabled(is);//Ŀ + jt03.setEnabled(is);//Ʒ + + } + + @Override + public void itemStateChanged(ItemEvent e) { + Object object = e.getSource(); + if (object.equals(comBox)) { + System.out.println("ѡ" + e.getItem() + ""); + if (e.getStateChange() == ItemEvent.SELECTED) { + + if (e.getItem() != null) { + jffs = (String) e.getItem(); + jffs = jffs.trim(); + System.out.println(jffs); + } else { + return; + } + + } + } + } + + private void yzbut() { + jt = jt1.getText(); + if (jt != null && !jt.equals("")) { + TCPreferenceService pref = session.getPreferenceService(); + String puid = pref.getStringValue("JK_WATER_SQB_FORM_PUID");//h3f1AjBIYvbLjA + if (puid == null) { + MessageBox.post("ѡδҵϵԱ", "", MessageBox.ERROR); + return; + } + + TCComponentForm formAll; + try { + formAll = (TCComponentForm) session.stringToComponent(puid); + if (formAll == null) { + MessageBox.post("δҵϵԱ", "", MessageBox.ERROR); + } + boolean ishave1 = ishave("jk8ProductIdentifyNO", + "jk8ProductModNO", formAll);// ܱ + + if (ishave1) { + MessageBox.post("ҵʶţƷͺ", "ɹ", + MessageBox.INFORMATION); + } else { + MessageBox.post("δҵʶţдĻ׼ʶǷȷ", "", + MessageBox.ERROR); + } + } catch (TCException e) { + e.printStackTrace(); + } + } + + } + + private boolean ishave(String sbh_all, String cpxh_all, + TCComponentForm formAll) { + boolean bo = false; + try { + String[] sbhs = formAll.getTCProperty(sbh_all) + .getStringValueArray();// ʶ + String cpxh = ""; + String cplx = "";//Ʒ + String jbcj = "";// + String kzqzjlx = "";// + String jbcz = "";// + String gjgg="";//ܾ + String jg="";//ṹ + String txfs="";//ͨŷʽ + for (int i = 0; i < sbhs.length; i++) { + if (jt.equals(sbhs[i])) { + cpxh = formAll.getTCProperty(cpxh_all) + .getStringValueArray()[i];// 鵽IJƷͺ + jbcj = formAll.getTCProperty("jk8BMManufactor") + .getStringValueArray()[i];// + cplx = formAll.getTCProperty("jk8ProductTypePMN") + .getStringValueArray()[i];// Ʒ + kzqzjlx = formAll.getTCProperty("jk8ContrlCompType") + .getStringValueArray()[i];// + jbcz = formAll.getTCProperty("jk8BMMaterial") + .getStringValueArray()[i];// + gjgg = formAll.getTCProperty("jk8PipeDSpec") + .getStringValueArray()[i];// ܾ + jg = formAll.getTCProperty("jk8Structure") + .getStringValueArray()[i];// ṹ + txfs = formAll.getTCProperty("jk8CommunicateMode") + .getStringValueArray()[i];// ͨŷʽ + bo = true; + } + } + + System.out.println("Ʒ:" + cplx); + if (bo) { + if (cpxh != null) { + jt10.setText(cpxh);//Ʒͺ + jt4.setText(cplx);//Ʒ + jt2.setText(jbcz);// + jt3.setText(kzqzjlx);// + jt1.setText(jt);//׼ʶ +// box3.setText(jbcj);// // + jtjbcj.setText(jbcj);// // + } else { + jt10.setText(""); + } + } + + form.getTCProperty("jk8BaseIdentifyNO").setStringValue(jt);// ׼ʶ + form.getTCProperty("jk8BMManufactor").setStringValue(jbcj);// + form.getTCProperty("jk8ProductType").setStringValue(cplx);// Ʒ + form.getTCProperty("jk8ContrlCompType").setStringValue(kzqzjlx);// + form.getTCProperty("jk8BMMaterial").setStringValue(jbcz);// + form.getTCProperty("jk8ProductModNO").setStringValue(cpxh);// Ʒͺ + form.getTCProperty("jk8PipeDSpec").setStringValue(gjgg);// ܾ + form.getTCProperty("jk8Structure").setStringValue(jg);// ṹ + form.getTCProperty("jk8CommunicateMode").setStringValue(txfs);// ͨŷʽ + seten(bo); + } catch (TCException e) { + e.printStackTrace(); + } + return bo; + } + + private JLabel getjl() { + JLabel bt = new JLabel("*"); + bt.setForeground(Color.red); + return bt; + } + + public boolean isRenderingModified() { + System.out.println("isRenderingModified"); + + try { + + if (isrend(form.getTCProperty("jk8ProjectName"), jt01.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ProjectNO"), jt02.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ProductName"), jt03.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8BaseIdentifyNO"), jt1.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8BMManufactor"), jtjbcj.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ProductType"), jt4.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8BMMaterial"),jt2.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ContrlCompType"), jt3.getText())) { + return true; + } + + if (isrend(form.getTCProperty("jk8ProductModNO"), jt10.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ProductIdentifyNO"), jt11.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8SecurityFunc"), bjgf.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ForeignLanName"), wymp.getText())) { + return true; + } + + + } catch (TCException e) { + e.printStackTrace(); + } // гѡ + return false; + } + + + private boolean isrend(TCProperty tcProperty, String str) { + if(tcProperty!=null&&str!=null&&(!str.equals(tcProperty.getStringValue()))){ + System.out.println(str); + return true; + } + return false; + } + + +} diff --git a/src/com/teamcenter/rac/form/JK8_ALARM_PRODUCT_MODEL_Form.java b/src/com/teamcenter/rac/form/JK8_ALARM_PRODUCT_MODEL_Form.java new file mode 100644 index 0000000..ffb9151 --- /dev/null +++ b/src/com/teamcenter/rac/form/JK8_ALARM_PRODUCT_MODEL_Form.java @@ -0,0 +1,394 @@ +package com.teamcenter.rac.form; + +//import java.awt.Dimension; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionListener; +import java.util.HashMap; + +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.JTextField; + +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.stylesheet.AbstractRendering; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; +import com.teamcenter.rac.util.combobox.iComboBox; + +//8Ʒͺ +public class JK8_ALARM_PRODUCT_MODEL_Form extends AbstractRendering { + private TCComponentForm form; + private TCSession session; + // private Registry registry = null; + private JScrollPane jsp; + private JPanel jpall; + private JPanel jpal2; + private JPanel jpal2_1; + private JPanel jpal3; + private JPanel jp1; + + private JTextField jtxt11 = new JTextField(32);// Ʒ + private JTextField jtxt12 = new JTextField(32);// Ŀ + private JTextField jtxt13 = new JTextField(32);// Ŀ + private iComboBox box1 = new iComboBox();// / + private iComboBox box2 = new iComboBox();// + private iComboBox box3 = new iComboBox();// ʹó + private iComboBox box4 = new iComboBox();// 鲿ֵĹϵ + private iComboBox box5 = new iComboBox();// ź + private iComboBox box6 = new iComboBox();// ͨŷʽƷ + private iComboBox box7 = new iComboBox();// +// private JTextArea jt2 =new JTextArea(3,24);// ܸ + private JTextField jt3 = new JTextField(24);// Ʒͺ + private JTextField jt4 = new JTextField(24);// Ʒ + private JTextField jt5 = new JTextField(24);// ʶ + + private HashMap realNameMap;// lovѡֵ + private String isCheck; + + public JK8_ALARM_PRODUCT_MODEL_Form(TCComponentForm c) throws Exception { + + super(c); + form = c; + session = c.getSession(); + // registry = Registry.getRegistry(this); + String[] names = session.getPreferenceService().getStringValues( + "JK_CPXH_FORM"); + if (names != null) { + + realNameMap = new HashMap<>(); + for (int i = 0; i < names.length; i++) { + String[] s = names[i].split("="); + if (s != null && s.length == 2) { + String key = s[0]; + String value = s[1]; + realNameMap.put(key, value); + } else { + MessageBox.post("ѡ JK_CPXH_FORM ôϵԱ", "", + MessageBox.ERROR); + return; + } + + } + + } else { + MessageBox.post("ѡ JK_CPXH_FORM ڣϵԱ", "", + MessageBox.ERROR); + } + + // init(); + loadRendering(); + + jp1.addMouseMotionListener(new MouseMotionListener() { + + @Override + public void mouseMoved(MouseEvent arg0) { + + try { + isCheck = form.getTCProperty("fnd0IsCheckoutable") + .getDisplayableValue(); + } catch (TCException e1) { + e1.printStackTrace(); + } + if ("".equals(isCheck)) { + + setOwnerHave(); + } + } + @Override + public void mouseDragged(MouseEvent arg0) { + + } + }); + + jt3.setEnabled(false); + + System.out.println("end"); + } + + private void init() { + setLayout(new BorderLayout()); + // setBackground(Color.white); + jpall = new JPanel(new PropertyLayout()); + jpal2 = new JPanel(new PropertyLayout()); + jpal2_1 = new JPanel(new PropertyLayout()); + jpal3 = new JPanel(new PropertyLayout()); + jp1 = new JPanel(new PropertyLayout()); + + JLabel jlab11 = new JLabel("Ʒͺ "); + jlab11.setFont(new Font("", 1, 24)); + jpall.add("1.1.left.top", jlab11); + //jpall.add("2.1.left.top", jlab12); + + jpal2.add("1.1.left.top", new JLabel(" Ʒƣ")); + jpal2.add("1.2.right.top", getjl()); + jpal2.add("1.3.left.top", jtxt11); + jpal2.add("2.1.left.top", new JLabel(" Ŀƣ")); + jpal2.add("2.2.right.top", getjl()); + jpal2.add("2.3.left.top", jtxt12); + jpal2.add("3.1.left.top", new JLabel(" Ŀţ")); + jpal2.add("3.2.right.top", getjl()); + jpal2.add("3.3.left.top", jtxt13); + //ƷͺϢǼ + JLabel jlablInfo1 = new JLabel("ƷͺϢǼ "); + jlablInfo1.setFont(new Font("", 0, 16)); + jpal2_1.add("1.1.right.top", jlablInfo1); + + + jpal2_1.add("2.1.left.top", new JLabel(" : ")); + jpal2_1.add("2.2.right.top", getjl()); + setLov(box2, ""); + jpal2_1.add("2.3.left.top", box2); + jpal2_1.add("2.4.left.top", new JLabel(" ʹó: ")); + jpal2_1.add("2.5.right.top", getjl()); + setLov(box3, "ʹó"); + jpal2_1.add("2.6.left.top", box3); + + jpal2_1.add("3.1.left.top", new JLabel(" ⲿֵĹϵ: ")); + jpal2_1.add("3.2.right.top", getjl()); + setLov(box4, "ⲿֵĹϵ"); + jpal2_1.add("3.3.left.top", box4); + jpal2_1.add("3.4.left.top", new JLabel(" ź: ")); + jpal2_1.add("3.5.right.top", getjl()); + setLov(box5, "ź"); + jpal2_1.add("3.6.left.top", box5); + + jpal2_1.add("4.1.left.top", new JLabel(" Ʒ: ")); + jpal2_1.add("4.2.right.top", new JLabel(" ")); + setLov(box6, "Ʒ"); + jpal2_1.add("4.3.left.top", box6); + + /*JScrollPane jspane1=new JScrollPane(jt2); + jt2.setLineWrap(true); + jpal2.add("9.1.left.top", new JLabel(" ܸ")); + jpal2.add("9.2.right.top", new JLabel(" ")); + jpal2.add("9.3.left.top", jspane1);*/ + + /*// ƷͺϢǼ + JLabel jlablInfo2 = new JLabel("ʶϢǼ "); + jlablInfo2.setFont(new Font("", 0, 16)); + jpal2.add("8.1.right.top", jlablInfo1); + + jpal2.add("9.1.left.top", new JLabel(" : ")); + jpal2.add("9.2.right.top", getjl()); + setLov(box1, "/"); + jpal2.add("9.3.left.top", box1); + jpal2.add("9.4.left.top", new JLabel(" Ʒͣ")); + jpal2.add("9.5.right.top", new JLabel(" ")); + jpal2.add("9.6.left.top", jt4); + jpal2.add("10.1.left.top", new JLabel(" : ")); + jpal2.add("10.2.right.top", getjl()); + setLov(box7, ""); + jpal2.add("10.3.left.top", box7); + + jpal2.add("11.1.left.top", new JLabel(" "));*/ + + + jpal3.add("1.1.left.top", new JLabel(" Ʒͺţ")); + jpal3.add("1.2.right.top", new JLabel(" ")); + jpal3.add("1.3.left.top", jt3); + + /*jpal3.add("12.4.left.top", new JLabel(" ʶţ")); + jpal3.add("12.5.right.top", new JLabel(" ")); + jpal3.add("12.6.left.top", jt5);*/ + + jp1.add("1.1.left.top", jpall); + jp1.add("2.1.left.top", jpal2); + jp1.add("3.1.left.top", jpal2_1); + jp1.add("4.1.left.top", jpal3); + + // jpall.setPreferredSize(new Dimension(700, 650)); + jsp = new JScrollPane(jp1);// + jsp.setPreferredSize(new Dimension(700, 400)); + this.add(jsp, "Center"); + setVisible(true); + + } + + private void setLov(iComboBox box, String st) { + box.setTextFieldLength(20); + box.setAutoCompleteSuggestive(false); + box.addItems(realNameMap.get(st).split(",")); + } + + @Override + public void loadRendering() throws TCException { + init(); + jtxt11.setText(form.getTCProperty("jk8ProductName").getStringValue());// Ʒ + jtxt12.setText(form.getTCProperty("jk8ProjectName").getStringValue());// Ŀ + jtxt13.setText(form.getTCProperty("jk8ProjectNO").getStringValue());// Ŀ + + box4.setText(form.getTCProperty("jk8AlaDectRelation").getStringValue());// ⲿֵĹϵ + box6.setText(form.getTCProperty("jk8ProFeatNum").getStringValue());// Ʒ + box5.setText(form.getTCProperty("jk8OutputSignal").getStringValue());// ź + box3.setText(form.getTCProperty("jk8UsePlace").getStringValue());// ʹó + box2.setText(form.getTCProperty("jk8GasType").getStringValue());// + jt3.setText(form.getTCProperty("jk8ProductModNO").getStringValue());// Ʒͺ + + /* jt5.setText(form.getTCProperty("jk8ProductModNO").getStringValue());//TODO ʶ + box1.setText(form.getTCProperty("jk8BMManufactor").getStringValue());// +// jt2.setText(form.getTCProperty("jk8FunctionOverview").getStringValue());// ܸ + box7.setText(form.getTCProperty("jk8ContrlCompType").getStringValue());//TODO + jt4.setText(form.getTCProperty("jk8ProductModNO").getStringValue());//TODO Ʒ +*/ + } + + @Override + public void saveRendering() { + if ("".equals(jtxt11.getText()) + || "".equals(jtxt12.getText()) + || "".equals(jtxt13.getText()) +// || "".equals(box1.getTextField().getText()) + || "".equals(box2.getTextField().getText()) + || "".equals(box3.getTextField().getText()) + || "".equals(box4.getTextField().getText()) +// || "".equals(box7.getTextField().getText()) + || "".equals(box5.getTextField().getText())) { + + MessageBox.post("޷,ȷȫд!!", "", MessageBox.ERROR); + return; + } + + if ("".equals(jt3.getText())) { + try { + + form.getTCProperty("jk8ProductName").setStringValue( + jtxt11.getText());// Ʒ + form.getTCProperty("jk8ProjectName").setStringValue( + jtxt12.getText());// Ŀ + form.getTCProperty("jk8ProjectNO").setStringValue( + jtxt13.getText());// Ŀ +// form.getTCProperty("jk8BMManufactor").setStringValue( +// box1.getTextField().getText());// + form.getTCProperty("jk8GasType").setStringValue( + box2.getTextField().getText());// + form.getTCProperty("jk8UsePlace").setStringValue( + box3.getTextField().getText());// ʹó + form.getTCProperty("jk8AlaDectRelation").setStringValue( + box4.getTextField().getText());// 鲿ֵĹϵ + form.getTCProperty("jk8OutputSignal").setStringValue( + box5.getTextField().getText());// ź + form.getTCProperty("jk8ProFeatNum").setStringValue( + box6.getTextField().getText());// Էʽ + +// form.getTCProperty("jk8FunctionOverview").setStringValue( +// jt2.getText());// ܸ + + form.getTCProperty("jk8ProductModNO").setStringValue( + jt3.getText());// Ʒͺ + + + + } catch (TCException e) { + e.printStackTrace(); + } + } else { + MessageBox.post("ƷͺѴ,޷ٴα", "", MessageBox.ERROR); + } + } + + // ÷ӵ߲ɱ༭ + public void setOwnerHave() { + try { + + String user = session.getUserName(); + String owning_user = form.getProperty("owning_user"); + // System.out.println("owning_user.indexOf(user)="+owning_user.indexOf(user)); + if (owning_user.indexOf(user) < 0) { + // tj.setEnabled(false); + jtxt11.setEnabled(false); + jtxt12.setEnabled(false); + jtxt13.setEnabled(false); + box1.setEnabled(false); + box2.setEnabled(false); + box3.setEnabled(false); + box4.setEnabled(false); + box5.setEnabled(false); + box6.setEnabled(false); + box7.setEnabled(false); +// jt2.setEnabled(false); + jt3.setEnabled(false); + jt4.setEnabled(false); + jt5.setEnabled(false); + + } + } catch (TCException e) { + System.out.println("ӵǷʱļеòȷҲ"); + e.printStackTrace(); + } + } + + private JLabel getjl() { + JLabel bt = new JLabel("*"); + bt.setForeground(Color.red); + return bt; + } + private boolean isrend(TCProperty tcProperty, String str) { + if(tcProperty!=null&&str!=null&&(!str.equals(tcProperty.getStringValue()))){ + System.out.println(str); + return true; + } + return false; + } + public boolean isRenderingModified() { + System.out.println("isRenderingModified"); + + try { + + if (isrend(form.getTCProperty("jk8ProductName"), jtxt11.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ProjectName"), jtxt12.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ProjectNO"), jtxt13.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ProductModNO"), jt3.getText())) {// TODO + return true; + } + if (isrend(form.getTCProperty("jk8ProductModNO"), jt4.getText())) {//TODO + return true; + } + if (isrend(form.getTCProperty("jk8ProductIdentifyNO"), jt5.getText())) {//TODO + + return true; + } + if (isrend(form.getTCProperty("jk8BMManufactor"), box1.getTextField().getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8GasType"), box2.getTextField().getText())) { + return true; + } + + if (isrend(form.getTCProperty("jk8UsePlace"), box3.getTextField().getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8AlaDectRelation"), box4.getTextField().getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8OutputSignal"), box5.getTextField().getText())) { + return true; + } + + if (isrend(form.getTCProperty("jk8ProFeatNum"), box6.getTextField().getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ContrlCompType"), box7.getTextField().getText())) { + return true; + } + + } catch (TCException e) { + e.printStackTrace(); + } // гѡ + return false; + } +} diff --git a/src/com/teamcenter/rac/form/JK8_ALARM_SBH_Form.java b/src/com/teamcenter/rac/form/JK8_ALARM_SBH_Form.java new file mode 100644 index 0000000..c558aef --- /dev/null +++ b/src/com/teamcenter/rac/form/JK8_ALARM_SBH_Form.java @@ -0,0 +1,421 @@ +package com.teamcenter.rac.form; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionListener; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.swing.ButtonGroup; +import javax.swing.DefaultComboBoxModel; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JScrollPane; +import javax.swing.JTextField; +import javax.swing.plaf.basic.BasicBorders.RadioButtonBorder; + +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCComponentType; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.stylesheet.AbstractRendering; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; +import com.teamcenter.rac.util.Registry; +import com.teamcenter.rac.util.combobox.iComboBox; + +//9Ʒʶ +public class JK8_ALARM_SBH_Form extends AbstractRendering { + private TCComponentForm form; + private TCSession session; + // private JButton tijiao; + private JButton yanzhen; + private JPanel mainPanel; + + private JPanel firstJPanel; + private JPanel thirdJPanel; + private JScrollPane jsp; + + private JPanel topJPanel; + private JPanel charu2; + + private JLabel jl1; + private JLabel jl2; + + private JTextField jt01;// Ŀ + private JTextField jt02;// Ŀ + private JTextField jt1;// Ʒͺ + private JTextField jt2;// ʶ + + private iComboBox box1 = new iComboBox();// +// private JTextField jt03=new JTextField(30);//Ҫ + + + private HashMap realNameMap;// lovѡֵ + private String jt;// Ʒͺ + + private String isCheck; + private boolean is = false; + + public JK8_ALARM_SBH_Form(TCComponentForm arg0) throws Exception { + super(arg0); + // TODO Auto-generated constructor stub + form = arg0; + session = arg0.getSession(); + // registry = Registry.getRegistry(this); + String[] names = session.getPreferenceService().getStringValues( + "JK_CPXH_FORM"); + if (names != null) { + + realNameMap = new HashMap<>(); + for (int i = 0; i < names.length; i++) { + String[] s = names[i].split("="); + if (s != null && s.length == 2) { + String key = s[0]; + String value = s[1]; + realNameMap.put(key, value); + } + + } + + } else { + MessageBox.post("ѡ JK_CPXH_FORM ڣϵԱ", "", + MessageBox.ERROR); + } + initializeUI(); + loadRendering(); + + mainPanel.addMouseMotionListener(new MouseMotionListener() { + + @Override + public void mouseMoved(MouseEvent e) { + // TODO Auto-generated method stub + try { + isCheck = form.getTCProperty("fnd0IsCheckoutable") + .getDisplayableValue(); + } catch (TCException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + if ("".equals(isCheck)) { + seten(is); + setOwnerHave(); + } + } + + @Override + public void mouseDragged(MouseEvent e) { + // TODO Auto-generated method stub + + } + }); + + jt2.setEnabled(false); + + } + + private void setLov(iComboBox box, String st) { + // TODO Auto-generated method stub + box.setTextFieldLength(18); + box.setAutoCompleteSuggestive(false); + box.addItems(realNameMap.get(st).split(",")); + } + + public void initializeUI() { + System.out.println("UI-----Start"); + setLayout(new BorderLayout()); + initPanel(); + + jsp = new JScrollPane(initPanel()); + jsp.setPreferredSize(new Dimension(450, 490)); + jsp.getVerticalScrollBar().setUnitIncrement(20); + + add(jsp, "Center"); + this.setVisible(true); + this.setBackground(Color.lightGray); + } + + public JPanel initPanel() { + System.out.println("--------------------------"); + mainPanel = new JPanel(new PropertyLayout()); + this.setSize(new Dimension(650, 260)); + jt01 = new JTextField(30); + jt02 = new JTextField(30); + jt1 = new JTextField(30); + jt2 = new JTextField(20); + + jl1 = new JLabel(" Ʒʶ"); + jl1.setFont(new Font("", 1, 24)); + jl2 = new JLabel(" ²ƷʶϢǼ"); + jl2.setFont(new Font("", 1, 18)); + + topJPanel = new JPanel(new PropertyLayout()); + topJPanel.add("1.1.left.top", jl1); + topJPanel.add("1.2.left.top", new JLabel( + " ")); + // tijiao = new JButton("ύ"); + // tijiao.setPreferredSize(new Dimension(70, 30)); + // topJPanel.add("1.3.left.top.preferred.preferred", tijiao); + + firstJPanel = new JPanel(new PropertyLayout()); + firstJPanel.add("1.1.left.top", new JLabel(" Ʒͺ:")); + firstJPanel.add("1.2.right.top", getjl()); + firstJPanel.add("1.3.left.top", jt1); + firstJPanel.add("1.4.left.top", new JLabel(" ")); + yanzhen = new JButton("֤Ʒͺ"); + firstJPanel.add("1.5.left.top", yanzhen); + firstJPanel.add("2.1.left.top", new JLabel(" Ŀ:")); + firstJPanel.add("2.2.right.top", getjl()); + firstJPanel.add("2.3.left.top", jt01); + firstJPanel.add("3.1.left.top", new JLabel(" Ŀ:")); + firstJPanel.add("3.2.right.top", getjl()); + firstJPanel.add("3.3.left.top", jt02); + yanzhen.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + System.out.println("֤"); + yzbut(); + } + }); + + charu2 = new JPanel(new PropertyLayout()); + charu2.add("1.1.left.top", new JLabel(" ")); + charu2.add("1.2.right.top", getjl()); + setLov(box1, ""); + charu2.add("1.3.left.top", box1); + + /*charu2.add("2.1.left.top", new JLabel(" Ҫ:")); + charu2.add("2.2.right.top", new JLabel(" ")); + charu2.add("2.3.left.top", jt03);*/ + + thirdJPanel = new JPanel(new PropertyLayout()); + thirdJPanel.add("1.1.left.top", new JLabel(" ʶţ ")); + thirdJPanel.add("1.2.left.top", jt2); + + mainPanel.add("1.1.left.top", topJPanel); + mainPanel.add("2.1.left.top", firstJPanel); + mainPanel.add("3.1.left.top", charu2); + mainPanel.add("4.1.left.top", thirdJPanel); + return mainPanel; + + } + + @Override + public void loadRendering() throws TCException { + // TODO Auto-generated method stub + jt1.setText(form.getTCProperty("jk8ProductModNO").getStringValue());// Ʒͺ + jt01.setText(form.getTCProperty("jk8ProjectName").getStringValue());// Ŀ + jt02.setText(form.getTCProperty("jk8ProjectNO").getStringValue());// Ŀ + jt2.setText(form.getTCProperty("jk8ProductIdentifyNO").getStringValue());// ʶ + + box1.setText(form.getTCProperty("jk8ContrlCompType").getStringValue());// +// jt03.setText(form.getTCProperty("jk8SpecRequirements").getStringValue());// Ҫ + + + } + + public boolean isRenderingModified() { + System.out.println("isRenderingModified"); + + try { + + if (isrend(form.getTCProperty("jk8ProductModNO"), jt1.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ProductIdentifyNO"), + jt2.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ProjectName"), jt01.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ProjectNO"), jt02.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ContrlCompType"), box1.getTextField() + .getText())) { + return true; + } + /*if (isrend(form.getTCProperty("jk8SpecRequirements"), jt03.getText())) { + return true; + }*/ + + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + return false; + }// гѡ + return false; + } + + private boolean isrend(TCProperty tcProperty, String str) { + // TODO Auto-generated method stub + if (tcProperty != null && str != null + && (!str.equals(tcProperty.getStringValue()))) { + System.out.println(str); + return true; + } + return false; + } + + @Override + public void saveRendering() { + // TODO Auto-generated method stub + if ("".equals(jt1.getText()) || "".equals(jt01.getText()) + || "".equals(jt02.getText()) + || "".equals(box1.getTextField().getText()) + // || "".equals(box2.getTextField().getText()) + ) { + MessageBox.post("޷,ȷȫд!!", "", MessageBox.ERROR); + + } else { + if ("".equals(jt2.getText())) { + try { + form.getTCProperty("jk8ProductModNO").setStringValue( + jt1.getText());// Ʒͺ + form.getTCProperty("jk8ProductIdentifyNO").setStringValue( + jt1.getText());// ʶ + form.getTCProperty("jk8ProjectName").setStringValue( + jt01.getText());// Ŀ + form.getTCProperty("jk8ProjectNO").setStringValue( + jt02.getText());// Ŀ + form.getTCProperty("jk8ContrlCompType").setStringValue( + box1.getTextField().getText());// + /*form.getTCProperty("jk8SpecRequirements").setStringValue( + jt03.getText());// Ҫ +*/ + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } else { + MessageBox.post("ʶѴ,޷ٴα", "", MessageBox.ERROR); + } + } + + } + + public void setOwnerHave() { + try { + + String user = session.getUserName(); + String owning_user = form.getProperty("owning_user"); + // System.out.println("owning_user.indexOf(user)="+owning_user.indexOf(user)); + if (owning_user.indexOf(user) < 0) { + jt1.setEnabled(false); + jt01.setEnabled(false); + jt02.setEnabled(false); + yanzhen.setEnabled(false); + box1.setEnabled(false); +// jt03.setEnabled(false); + jt2.setEnabled(false); + + } + } catch (TCException e) { + System.out.println("ӵǷʱļеòȷҲ"); + e.printStackTrace(); + } + } + + public void seten(boolean is) { + jt01.setEnabled(is); + jt02.setEnabled(is); + box1.setEnabled(is); +// jt03.setEnabled(is); + + } + + private void yzbut() { + // TODO Auto-generated method stub + + jt = jt1.getText(); + if (jt != null && !jt.equals("") && !jt.equals("")) { + TCPreferenceService pref = session.getPreferenceService(); + String puid = pref.getStringValue("JK_SQB_FORM_PUID");// ѡpuid + if (puid == null) { + MessageBox.post("ѡJK_SQB_FORM_PUIDδҵϵԱ", "", + MessageBox.ERROR); + } + + TCComponentForm formAll; + try { + formAll = (TCComponentForm) session.stringToComponent(puid); + if (formAll == null) { + MessageBox.post("ܱδҵϵԱ", "", MessageBox.ERROR); + } + boolean ishave1 = ishave("jk8ProductModNO", + "jk8ProductIdentifyNO", formAll);// Դ + + if (ishave1) { + MessageBox.post("ҵƷͺţòƷͺſ", "ɹ", + MessageBox.INFORMATION); + } else { + MessageBox.post("δҵƷͺţдIJƷͺǷȷ", "", + MessageBox.ERROR); + } + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + MessageBox.post(e.getMessage(), "", MessageBox.ERROR); + } + } else { + MessageBox.post("ƷͺŲΪգдٵť", "", MessageBox.ERROR); + } + + } + + private boolean ishave(String cpxh_all, String sbh_all, + TCComponentForm formAll) { + // TODO Auto-generated method stub + boolean bo = false; + try { + String[] cpxhs = formAll.getTCProperty(cpxh_all) + .getStringValueArray();// ܲƷͺ + String lx = ""; + String name = ""; + for (int i = 0; i < cpxhs.length; i++) { + if (jt.equals(cpxhs[i])) { + lx = formAll.getTCProperty("jk8ProductType") + .getStringValueArray()[i];// Ʒ + + if ("tb10".equals(lx)) {// жǷ + bo = true; + break; + } + + } + } + + seten(bo); + is = bo; + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return bo; + } + + private JLabel getjl() { + JLabel bt = new JLabel("*"); + bt.setForeground(Color.red); + return bt; + } + +} diff --git a/src/com/teamcenter/rac/form/JK8_ALARM_SPECIAL_SBH_Form.java b/src/com/teamcenter/rac/form/JK8_ALARM_SPECIAL_SBH_Form.java new file mode 100644 index 0000000..5cc79a3 --- /dev/null +++ b/src/com/teamcenter/rac/form/JK8_ALARM_SPECIAL_SBH_Form.java @@ -0,0 +1,545 @@ +package com.teamcenter.rac.form; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionListener; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.swing.ButtonGroup; +import javax.swing.DefaultComboBoxModel; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JTextField; + +import com.teamcenter.rac.aif.kernel.AIFComponentContext; +import com.teamcenter.rac.kernel.TCComponentFolder; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.stylesheet.AbstractRendering; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; +import com.teamcenter.rac.util.Registry; +import com.teamcenter.rac.util.combobox.iComboBox; +//import com.teamcenter.soa.exceptions.NotLoadedException; + +//ҪˮƷʶ +public class JK8_ALARM_SPECIAL_SBH_Form extends AbstractRendering { + + private TCSession session; + private TCComponentForm form; + private JButton tijiao; + private JButton yanzhen; + private JPanel mainPanel; + + private JPanel topPanel; + private JPanel firstJPanel; + private JPanel secondJPanel; + private JPanel secondJPanel_1; + private JPanel thirdJPanel; + + private JTextField jt1;//׼ʶ + private JTextField jt4; + private JTextField jt6;// + private JTextField jt8;// + private JTextField jt10;//Ʒͺ + private JTextField jt11;//ʶ + + private JTextField jt12;// Ʒ + private JTextField jt13;// + private JTextField jt01;// Ŀ + private JTextField jt02;// Ŀ + private JTextField jt03;// Ʒ + + // private JComboBox comBox0; + // private JComboBox comBox; + private iComboBox comBox0 = new iComboBox();//Ҫ + private iComboBox comBox = new iComboBox();// + + private JLabel jl1; + private JLabel jl2; + private JLabel jl3; + private JLabel jl4; + + private String jt;// ׼ʶ + + + + private String isCheck; + + private HashMap realNameMap; + + // private Registry registry = null; + + public JK8_ALARM_SPECIAL_SBH_Form(TCComponentForm arg0) throws Exception { + super(arg0); + form = arg0; + session = arg0.getSession(); + // registry = Registry.getRegistry("com.teamcenter.rac.form.form_user"); + String[] names = session.getPreferenceService().getStringValues("JK_WATER_METER_FORM"); + if (names != null) { + + realNameMap = new HashMap<>(); + for (int i = 0; i < names.length; i++) { + String[] s = names[i].split("="); + if (s != null && s.length == 2) { + String key = s[0]; + String value = s[1]; + realNameMap.put(key, value); + } + + } + + } else { + MessageBox.post("ѡ JK_WATER_METER_FORM ڣϵԱ", "", + MessageBox.ERROR); + } + initPanel(); + loadRendering(); + mainPanel.addMouseMotionListener(new MouseMotionListener() { + + @Override + public void mouseMoved(MouseEvent e) { + try { + isCheck = form.getTCProperty("fnd0IsCheckoutable") + .getDisplayableValue(); + } catch (TCException e1) { + e1.printStackTrace(); + } + if ("".equals(isCheck)) { + seten(false); + setOwnerHave(); + } + } + + @Override + public void mouseDragged(MouseEvent e) { + + } + }); + + jt10.setEnabled(false); + jt11.setEnabled(false); + + } + + public void initPanel() { + System.out.println("--------------------------"); + jt1 = new JTextField(20); + jt4 = new JTextField(20); + jt6 = new JTextField(20); + jt8 = new JTextField(20); + jt10 = new JTextField(25); + jt11 = new JTextField(25); + jt12 = new JTextField(20); + jt13 = new JTextField(20); + jt01 = new JTextField(20); + jt02 = new JTextField(20); + jt03 = new JTextField(20); + + jl1 = new JLabel(" ׼ʶţ"); + jl1.setSize(50, 20); + jl2 = new JLabel(" ҪˮƷʶϢǼ"); + jl2.setSize(70, 20); + jl3 = new JLabel(" Ʒͣ"); + jl3.setSize(70, 20); + jl4 = new JLabel(" ҪˮƷʶ"); + jl4.setFont(new Font("", 0, 24)); + jl2.setFont(new Font("", 0, 20)); + mainPanel = new JPanel(new PropertyLayout()); + this.setSize(new Dimension(600, 200)); + this.setLayout(new BorderLayout()); + + topPanel = new JPanel(new PropertyLayout()); + + topPanel.add("1.1.left.top.preferred.preferred", jl4); + topPanel.add("1.2.left.top.preferred.preferred", new JLabel( + " ")); + // tijiao = new JButton("ύ"); + // tijiao.setEnabled(true); + // tijiao.setPreferredSize(new Dimension(70, 20)); + // tijiao.addActionListener(new ActionListener() { + // + // @Override + // public void actionPerformed(ActionEvent e) { + // // TODO Auto-generated method stub + // System.out.println("ύ"); + // saveRendering(); + // } + // }); + // topPanel.add("1.3.left.bottom.preferred.preferred", tijiao); + + firstJPanel = new JPanel(new PropertyLayout()); + // firstJPanel.setBorder(new + // TitledBorder(BorderFactory.createEtchedBorder())); + // firstJPanel.setBorder(new + // TitledBorder(BorderFactory.createEtchedBorder(),"",2,7)); + + topPanel.add("2.1.left.top", new JLabel("")); + topPanel.add("2.1.left.top", jl2); + firstJPanel.add("1.1.left.top", jl1); + firstJPanel.add("1.2.left.top", getjl()); + firstJPanel.add("1.3.left.top", jt1); + yanzhen = new JButton("֤ʶ"); + yanzhen.setEnabled(true); + yanzhen.setPreferredSize(new Dimension(100, 20)); + yanzhen.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + System.out.println("֤"); + + yzbut(); + + } + + }); + firstJPanel.add("1.4.left.top", yanzhen); + firstJPanel.add("2.1.left.top", new JLabel(" Ŀ:")); + firstJPanel.add("2.2.left.top", new JLabel(" ")); + firstJPanel.add("2.3.left.top", jt01); + firstJPanel.add("3.1.left.top", new JLabel(" Ŀ:")); + firstJPanel.add("3.2.left.top", new JLabel(" ")); + firstJPanel.add("3.3.left.top", jt02); + firstJPanel.add("4.1.left.top", new JLabel(" Ʒ:")); + firstJPanel.add("4.2.left.top", new JLabel(" ")); + firstJPanel.add("4.3.left.top", jt03); + firstJPanel.add("5.1.left.top", new JLabel(" Ҫ:")); + + setLov(comBox0, "Ҫ"); + firstJPanel.add("5.2.right.top.preferred.preferred", getjl()); + firstJPanel.add("5.3.left.top.preferred.preferred", comBox0); + + secondJPanel = new JPanel(new PropertyLayout()); + secondJPanel_1 = new JPanel(new PropertyLayout()); + secondJPanel_1.add("1.1.left.top", jl3); + + secondJPanel_1.add("1.2.left.top", jt12);//Ʒ + secondJPanel_1.add("2.1.left.top", new JLabel(" ʣ")); +// setLov(comBox, ""); + secondJPanel_1.add("2.2.left.top", jt13); + secondJPanel_1.add("3.1.left.top", new JLabel(" ң")); + secondJPanel_1.add("3.2.left.top", jt6); + secondJPanel_1.add("4.1.left.top", new JLabel(" ͣ")); + secondJPanel_1.add("4.2.left.top", jt8); + + + secondJPanel.add("1.1.left.top", secondJPanel_1); + + thirdJPanel = new JPanel(new PropertyLayout()); + thirdJPanel.add("1.1.left.top.preferred.preferred", new JLabel( + " Ʒͺţ ")); + thirdJPanel.add("1.2.left.top.preferred.preferred", jt10); + thirdJPanel.add("1.3.left.top.preferred.preferred", new JLabel( + " ʶţ")); + thirdJPanel.add("1.4.left.top.preferred.preferred", jt11); + + mainPanel.add("1.1.left.top.preferred.preferred", topPanel); + mainPanel.add("2.1.left.top.preferred.preferred", firstJPanel); + mainPanel.add("3.1.left.top.preferred.preferred", secondJPanel); + mainPanel.add("4.1.left.top.preferred.preferred", thirdJPanel); + this.add(mainPanel); + this.setVisible(true); + this.setBackground(Color.LIGHT_GRAY); + } + + @Override + public void loadRendering() throws TCException { + System.out.println("loadRendering"); + + comBox0.setText(form.getTCProperty("jk8Specialrequirements").getStringValue());// Ҫ ϵͳjk8SpecialRequirements ʽϵͳjk8Specialrequirements + jt13.setText(form.getTCProperty("jk8BMMaterial").getStringValue());//TODO + + + jt1.setText(form.getTCProperty("jk8BaseIdentifyNO").getStringValue());// ׼ʶ + // jt4.setText(form.getTCProperty("jk_tsy_sysc").getStringValue());// + jt6.setText(form.getTCProperty("jk8BMManufactor").getStringValue());// + jt8.setText(form.getTCProperty("jk8ContrlCompType").getStringValue());// + jt10.setText(form.getTCProperty("jk8ProductModNO").getStringValue());// Ʒͺ + jt11.setText(form.getTCProperty("jk8ProductIdentifyNO").getStringValue());// ʶ + jt12.setText(form.getTCProperty("jk8ProductTypePIN").getStringValue());// Ʒ + // jt14.setText(form.getTCProperty("jk8BMManfMatched").getStringValue());// + // + jt01.setText(form.getTCProperty("jk8ProjectName").getStringValue());// Ŀ + jt02.setText(form.getTCProperty("jk8ProjectNO").getStringValue());// Ŀ + jt03.setText(form.getTCProperty("jk8ProductName").getStringValue());// Ʒ + + seten(true);//ɱ༭ + } + + +/* @Override + public Map getRenderingModified() { + Map modifiedRendering = new HashMap (); + try { + System.out.println("getRenderingModifiedʼ"); + saveRendering(); + }catch(Exception ex){ + ex.toString(); + System.out.println(ex.toString()); + } + + + return modifiedRendering; + }*/ + + + + + + + @Override + public void saveRendering() { + if ("".equals(jt1.getText()) + || "".equals(comBox0.getTextField().getText())) { + MessageBox.post("޷,ȷȫд!!", "", MessageBox.ERROR); + + }else{ + if ("".equals(jt11.getText())) { + try { + form.getTCProperty("jk8Specialrequirements").setStringValue(comBox0.getTextField().getText());// Ҫ + form.getTCProperty("jk8BMMaterial").setStringValue(jt13.getText());// + + + form.getTCProperty("jk8BaseIdentifyNO").setStringValue(jt1.getText());// ׼ʶ + // г3 + form.getTCProperty("jk8BMManufactor").setStringValue(jt6.getText());// + form.getTCProperty("jk8ContrlCompType").setStringValue(jt8.getText());// + form.getTCProperty("jk8ProductModNO").setStringValue(jt10.getText());// Ʒͺ + form.getTCProperty("jk8ProductIdentifyNO").setStringValue(jt11.getText());// ʶ + form.getTCProperty("jk8ProductTypePIN").setStringValue(jt12.getText());// Ʒ + form.getTCProperty("jk8ProjectName").setStringValue(jt01.getText());// Ŀ + form.getTCProperty("jk8ProjectNO").setStringValue(jt02.getText());// Ŀ + form.getTCProperty("jk8ProductName").setStringValue(jt03.getText());// Ʒ + } catch (TCException e) { + e.printStackTrace(); + } + } else { + MessageBox.post("ʶѴ,޷ٴα", "", MessageBox.ERROR); + } + } + + + + } + + public void setOwnerHave() { + try { + + String user = session.getUserName(); + String owning_user = form.getProperty("owning_user"); + if (owning_user.indexOf(user) < 0) { + jt1.setEnabled(false); + yanzhen.setEnabled(false); + comBox0.setEnabled(false); + comBox.setEnabled(false); + jt4.setEnabled(false); + jt6.setEnabled(false); + jt8.setEnabled(false); + jt10.setEnabled(false); + jt11.setEnabled(false); + jt12.setEnabled(false); + jt13.setEnabled(false); + jt01.setEnabled(false); + jt02.setEnabled(false); + jt03.setEnabled(false); + } + } catch (TCException e) { + System.out.println("ӵǷʱļеòȷҲ"); + e.printStackTrace(); + } + } + + public void seten(boolean is) { + comBox0.setEnabled(true); + comBox.setEnabled(is);// + jt6.setEnabled(false);// + jt8.setEnabled(false);// + + jt12.setEnabled(false);//Ʒ + jt13.setEnabled(false);//Ʒ + jt01.setEnabled(true); + jt02.setEnabled(true); + jt03.setEnabled(true); + } + + private void setLov(iComboBox box, String st) { + // TODO Auto-generated method stub + box.setTextFieldLength(20); + box.setAutoCompleteSuggestive(false); + box.addItems(realNameMap.get(st).split(",")); + } + + private void yzbut() { + // TODO Auto-generated method stub + + jt = jt1.getText(); + if (jt != null && !jt.equals("")) { + TCPreferenceService pref = session.getPreferenceService(); + String puid = pref.getStringValue("JK_WATER_SQB_FORM_PUID"); + if (puid == null) { + MessageBox.post("ѡδҵϵԱ", "", MessageBox.ERROR); + } + + TCComponentForm formAll; + try { + formAll = (TCComponentForm) session.stringToComponent(puid); + if (formAll == null) { + MessageBox.post("δҵϵԱ", "", MessageBox.ERROR); + } + boolean ishave1 = ishave("jk8ProductIdentifyNO", + "jk8ProductModNO", formAll);// Դ + + if (ishave1) { + MessageBox.post("ҵʶţƷͺ", "ɹ", + MessageBox.INFORMATION); + } else { + MessageBox.post("δҵʶţдĻ׼ʶǷȷ", "", + MessageBox.ERROR); + } + } catch (TCException e) { + e.printStackTrace(); + } + } + + } + + private boolean ishave(String sbh_all, String cpxh_all, + TCComponentForm formAll) { + boolean bo = false; + try { + String[] sbhs = formAll.getTCProperty(sbh_all) + .getStringValueArray();// ʶ + + String cpxh = ""; + String jbcj = ""; + String jbcz = ""; + String lx = ""; + String type = ""; + String gjgg="";//ܾ + String jg="";//ṹ + String txfs="";//ͨŷʽ + for (int i = 0; i < sbhs.length; i++) { + if (jt.equals(sbhs[i])&&jt.contains(".")) { + cpxh = formAll.getTCProperty(cpxh_all) + .getStringValueArray()[i];// 鵽IJƷͺ + jbcj = formAll.getTCProperty("jk8BMManufactor") + .getStringValueArray()[i];// + jbcz = formAll.getTCProperty("jk8BMMaterial") + .getStringValueArray()[i];// + lx = formAll.getTCProperty("jk8ProductTypePMN")//ϵͳjk8ProductType + .getStringValueArray()[i];// Ʒ + type = formAll.getTCProperty("jk8ContrlCompType") + .getStringValueArray()[i];// + gjgg = formAll.getTCProperty("jk8PipeDSpec") + .getStringValueArray()[i];// ܾ + jg = formAll.getTCProperty("jk8Structure") + .getStringValueArray()[i];// ṹ + txfs = formAll.getTCProperty("jk8CommunicateMode") + .getStringValueArray()[i];// ͨŷʽ + bo = true; + } + } + System.out.println("Ʒ:" + lx); + if (bo) { + if (cpxh != null) { + jt10.setText(cpxh); + } else { + jt10.setText(""); + } + } + jt13.setText(jbcz); + jt6.setText(jbcj); + jt12.setText(lx); + jt8.setText(type); + form.getTCProperty("jk8BMManufactor").setStringValue(jbcj);// + form.getTCProperty("jk8BMMaterial").setStringValue(jbcz);// + form.getTCProperty("jk8ProductTypePIN").setStringValue(lx);// Ʒ + form.getTCProperty("jk8ContrlCompType").setStringValue(type);// + form.getTCProperty("jk8PipeDSpec").setStringValue(gjgg);// ܾ + form.getTCProperty("jk8Structure").setStringValue(jg);// ṹ + form.getTCProperty("jk8CommunicateMode").setStringValue(txfs);// ͨŷʽ + seten(bo); + + } catch (TCException e) { + e.printStackTrace(); + } + return bo; + } + + private JLabel getjl() { + JLabel bt = new JLabel("*"); + bt.setForeground(Color.red); + return bt; + } + public boolean isRenderingModified() { + System.out.println("isRenderingModified"); + try { + + if (isrend(form.getTCProperty("jk8Specialrequirements"), comBox0.getTextField().getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8BMMaterial"), jt13.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8BaseIdentifyNO"), jt1.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8BMManufactor"), jt6.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ContrlCompType"), jt8.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ProductModNO"), jt10.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ProductIdentifyNO"),jt11.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ProductTypePIN"), jt12.getText())) { + return true; + } + + if (isrend(form.getTCProperty("jk8ProjectName"), jt01.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ProjectNO"), jt02.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ProductName"), jt03.getText())) { + return true; + } + + + + } catch (TCException e) { + e.printStackTrace(); + } // гѡ + return false; + } + + + private boolean isrend(TCProperty tcProperty, String str) { + if(tcProperty!=null&&str!=null&&(!str.equals(tcProperty.getStringValue()))){ + System.out.println(str); + return true; + } + return false; + } +} diff --git a/src/com/teamcenter/rac/form/JK8_ALARM_SUMMARY_Form.java b/src/com/teamcenter/rac/form/JK8_ALARM_SUMMARY_Form.java new file mode 100644 index 0000000..f77ecc9 --- /dev/null +++ b/src/com/teamcenter/rac/form/JK8_ALARM_SUMMARY_Form.java @@ -0,0 +1,461 @@ +package com.teamcenter.rac.form; + +import java.awt.BorderLayout; +import java.awt.Font; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.List; + +import javax.swing.DefaultCellEditor; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTabbedPane; +import javax.swing.JTable; +import javax.swing.RowSorter; +import javax.swing.table.DefaultTableModel; +import javax.swing.table.TableCellEditor; +import javax.swing.table.TableColumn; +import javax.swing.table.TableModel; +import javax.swing.table.TableRowSorter; + +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.stylesheet.AbstractRendering; +import com.teamcenter.rac.util.MessageBox; + +//²Ʒͺűܱ +public class JK8_ALARM_SUMMARY_Form extends AbstractRendering { + private List ta1 = new ArrayList<>(); + private Object[][] table1 = null; + + // IDEȡֵ + private String[] lx;//Ʒ + private String[] xmmc;// Ŀ + private String[] xmbh;// Ŀ + private String[] cpxh;// Ʒͺ + private String[] sbh;// ʶ + private String[] cpmc;// Ʒ + private String[] jbcj;// + private String[] bjbf;// ⲿֵĹϵ + private String[] cptzh;// Ʒ + private String[] scxhzl;// ź + private String[] sycs;// ʹó + private String[] qtzl;// + private String[] tsyq;// Ҫ + private String[] kzqzjlx;// + private String[] cplx;// Ʒ +// private String[] jg;// ṹ +// private String[] gjgg;// ܾ +// private String[] txfs;// ͨŷʽ + + + private String[] bz;// bz + private String[] sqr;// + private String[] djrq;// Ǽ + private String[] status;// ״̬ + + + // ȡֵ + private String[] lx1; + private String[] xmmc1;// Ŀ + private String[] xmbh1;// Ŀ + private String[] cpxh1;// Ʒͺ + private String[] sbh1;// ʶ + private String[] cpmc1;// Ʒ + private String[] jbcj1;// + private String[] jbcz1;// ICͺ + private String[] kzqzjlx1;// + private String[] cplx1;// Ʒ +// private String[] jg1;// ṹ +// private String[] gjgg1;// ܾ +// private String[] txfs1;// ͨŷʽ + // private String[] u8mmh1;// U8 +// private String[] fm1;// +// private String[] jmlx1;// + private String[] sqr1;// + private String[] djrq1;// Ǽ +// private String[] sysc1;// г +// private String[] ptjbcj1;// ׻ + private String[] status1;// ״̬ + private String[] bz1;// ע +// private String[] fmlx1;// " +// private String[] txfs1;// ͨŷʽ +// private String[] gdlx1;// 緽ʽ + private String[] bjbf1;// ⲿֵĹϵ + private String[] cptzh1;// Ʒ + private String[] scxhzl1;// ź + private String[] sycs1;// ʹó + private String[] qtzl1;// + private String[] tsyq1;// Ҫ + + private JLabel biaoti; + + private JPanel Panel; + private JPanel topJPanel; + private JPanel mainJPanel; + private JTabbedPane tabPane; + private JPanel biao1; + + + // private JButton outBut=new JButton(""); + private JButton addBut = new JButton(""); + private JTable dataTable1;// 1 + + + private Object[] obj = new Object[] { + "","Ʒ", "Ŀ", "Ŀ","Ʒ",//5 + "","Ʒͺ", "ʶ","","ⲿֵĹϵ",//10 + "Ʒ","ź", "ʹó", "", "Ҫ",//15 + "","Ǽ","״̬","ע" };//19 ˮ + + + private TCComponentForm form = null; + private TCSession session; + + private String name; + private String[] lovvals; + private boolean is = false; + + public JK8_ALARM_SUMMARY_Form(TCComponentForm arg0) throws Exception { + super(arg0); + this.form = arg0; + this.session = arg0.getSession(); + name = session.getUser().getProperty("user_name"); + System.out.println("name=" + name); + TCPreferenceService pref = session.getPreferenceService(); + String[] names = pref.getStringValues("JK_BJQ_HZB_Power");// ѡȨû + if (names != null) { + for (int i = 0; i < names.length; i++) { + System.out.println("Ȩ=" + names[i]); + if (names[i].equals(name)) { + System.out.println(""); + is = true; + } + } + } + lovvals = pref.getStringValues("JK_BJQ_SUMMARY_STATUSLOV");// ״̬lov + if(lovvals==null||lovvals.length==0){ + MessageBox.post("ѡJK_BJQ_SUMMARY_STATUSLOV","",MessageBox.WARNING); + return; + } + loadRendering(); + } + + public void initPanel() { + this.setLayout(new BorderLayout()); + Panel = new JPanel(new BorderLayout()); + topJPanel = new JPanel(new BorderLayout()); + biaoti = new JLabel("ƷͺʶŵǼDZ"); + biaoti.setFont(new Font("", 1, 24)); + // topJPanel.add("1.1.left.top", biaoti); + topJPanel.add(BorderLayout.CENTER, biaoti); + // topJPanel.add(BorderLayout.EAST, outBut); + if (is) { + topJPanel.add(BorderLayout.EAST, addBut); + } + mainJPanel = new JPanel(new BorderLayout()); + + biao1 = new JPanel(new BorderLayout()); + + // ǩҳ JTabbedPane + tabPane = new JTabbedPane(); + // + tabPane.add("", biao1); + // ñ + this.dataTable1 = getjTable(this.dataTable1, null, obj, table1); + biao1.add(new JScrollPane(this.dataTable1), BorderLayout.CENTER); + + + + settablecol(dataTable1);//״̬ + + setxh(dataTable1);// + dataTable1.setEnabled(false);// òɱ༭ + + mainJPanel.add(tabPane, BorderLayout.CENTER); + + Panel.add(topJPanel, BorderLayout.NORTH); + Panel.add(mainJPanel, BorderLayout.CENTER); + this.add(Panel); + this.setVisible(true); + + addBut.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + addrow(); + } + }); + + + } + + private void settablecol(JTable dataTable) { + // TODO Auto-generated method stub + TableColumn tc=dataTable.getColumn("״̬");// ȡһ + JComboBox cbx = new JComboBox(lovvals);// б + TableCellEditor tce=new DefaultCellEditor(cbx);// ༭ + tc.setCellEditor(tce); + } + + public void addrow() { + // TODO Auto-generated method stub + System.out.println(""); + String paname = tabPane.getTitleAt(tabPane.getSelectedIndex()); + System.out.println("ǰѡ:" + paname); + switch (paname) { + case "": + ((DefaultTableModel) dataTable1.getModel()).addRow(new String[18]); + setxh(dataTable1); + break; + default: + break; + } + + } + + // Jtableͨ÷ + public JTable getjTable(JTable partsTable, DefaultTableModel dtm, + Object[] titleNames, Object[][] values) { + int simpleLen = 105; + int totleLen = 900; + if (partsTable == null) { + + DefaultTableModel dtm1 = getTableModel(dtm, titleNames, values); + partsTable = new JTable(dtm1) { + public boolean isCelEditable(int row, int column) { + if(column==18) {//ע޸ + + return false; + }else { + return true; + + } + } + }; + RowSorter sorter = new TableRowSorter(dtm1); + // partsTable = new JTable(dtm); + partsTable.setRowSorter(sorter); + + if (simpleLen * titleNames.length >= totleLen) { + for (int i = 0; i < titleNames.length; i++) { + partsTable.getColumnModel().getColumn(i) + .setPreferredWidth(105); + } + partsTable.setAutoResizeMode(0); + } else { + partsTable.setAutoResizeMode(1); + } + } + return partsTable; + } + + // tableؼ + public DefaultTableModel getTableModel(DefaultTableModel dtm, + Object[] columnNameObjects, Object[][] objects) { + if (dtm == null) { + dtm = new DefaultTableModel(objects, columnNameObjects) + ; + } + return dtm; + } + + // ųʼ + private void setxh(JTable table) { + int cl = table.getRowCount(); + for (int i = 0; i < cl; i++) { + table.setValueAt(i + 1 + "", i, 0); + } + } + + @Override + public void loadRendering() throws TCException { + lx = form.getTCProperty("jk8ProductType").getStringArrayValue();//ͿпޣֻˮһࣻͣԻҪ + xmbh = form.getTCProperty("jk8ProjectNO").getStringArrayValue();// Ŀ + xmmc = form.getTCProperty("jk8ProjectName").getStringArrayValue();// Ŀ + cpxh = form.getTCProperty("jk8ProductModNO").getStringArrayValue();// Ʒͺ + sbh = form.getTCProperty("jk8ProductIdentifyNO").getStringArrayValue();// ʶ + + cpmc = form.getTCProperty("jk8ProductName").getStringArrayValue();// Ʒ + jbcj = form.getTCProperty("jk8BMManufactor").getStringArrayValue();// + bjbf = form.getTCProperty("jk8AlaDectRelation").getStringArrayValue();// ⲿֵĹϵ + kzqzjlx = form.getTCProperty("jk8ContrlCompType").getStringArrayValue();// + bz = form.getTCProperty("jk8Note").getStringArrayValue();// ע + + sqr = form.getTCProperty("jk8Applicant").getStringArrayValue();// + djrq = form.getTCProperty("jk8RecordDate").getStringArrayValue();// Ǽ + status = form.getTCProperty("jk8Status").getStringArrayValue();// ״̬ + cplx = form.getTCProperty("jk8ProductType").getStringArrayValue();// Ʒ + cptzh = form.getTCProperty("jk8ProFeatNum").getStringArrayValue();// Ʒ + scxhzl = form.getTCProperty("jk8OutputSignal").getStringArrayValue();// ź + sycs = form.getTCProperty("jk8UsePlace").getStringArrayValue();// ʹó + qtzl = form.getTCProperty("jk8GasType").getStringArrayValue();// + tsyq = form.getTCProperty("jk8CustSpecRequirements").getStringArrayValue();// Ҫ + + + if (lx != null) { + for (int i = 0; i < lx.length; i++) { + System.out.println("lx=" + lx[i]); + if (true){ + //if (lx[i] != null){ + ta1.add(new String[] { + "", cplx[i],xmmc[i], xmbh[i], cpmc[i], + kzqzjlx[i],cpxh[i], sbh[i],jbcj[i],bjbf[i], + cptzh[i],scxhzl[i],sycs[i],qtzl[i],tsyq[i], + sqr[i], djrq[i] ,status[i],bz[i]}); + } + + } + + if (ta1 != null) { + table1 = new Object[ta1.size()][13]; + add(table1, ta1); + } + + } + initPanel(); + + } + + // תΪά + private void add(Object[][] obj, List tb) { + // TODO Auto-generated method stub + for (int i = 0; i < tb.size(); i++) { + obj[i] = tb.get(i); + } + } + + @Override + public void saveRendering() { + int rowCount1 = dataTable1.getRowCount(); + + System.out.println("rowcount1=" + rowCount1); + int count = rowCount1 ; + + // ʼ + lx1 =new String[count];//ͿпޣֻˮһࣻͣԻҪ + xmbh1 =new String[count];// Ŀ + xmmc1 = new String[count];// Ŀ + cpxh1 = new String[count];// Ʒͺ + sbh1 = new String[count];// ʶ + + cpmc1 =new String[count];// Ʒ + jbcj1 = new String[count];// + bjbf1 =new String[count];// ⲿֵĹϵ + kzqzjlx1 = new String[count];// + bz1 = new String[count];// ע + + sqr1 = new String[count];// + djrq1 = new String[count];// Ǽ + status1 = new String[count];// ״̬ + cplx1 = new String[count];// Ʒ + cptzh1 = new String[count];// Ʒ + scxhzl1 =new String[count];// ź + sycs1 = new String[count];// ʹó + qtzl1 = new String[count];// + tsyq1 =new String[count];// Ҫ + + // ѭÿУֵformӦԡ + for (int j = 0; j < rowCount1; j++) { + lx1[j] = "tb1"; + cplx[j] = dataTable1.getValueAt(j, 1) == null ? "" + : (String) dataTable1.getValueAt(j, 1);// Ʒ + xmmc1[j] = dataTable1.getValueAt(j, 2) == null ? "" + : (String) dataTable1.getValueAt(j, 2);// Ŀ + xmbh1[j] = dataTable1.getValueAt(j, 3) == null ? "" + : (String) dataTable1.getValueAt(j, 3);// Ŀ + cpmc1[j] = dataTable1.getValueAt(j, 4) == null ? "" + : (String) dataTable1.getValueAt(j, 4);// Ʒ + + kzqzjlx1[j] = dataTable1.getValueAt(j, 5) == null ? "" + : (String) dataTable1.getValueAt(j, 5);// + cpxh1[j] = dataTable1.getValueAt(j, 6) == null ? "" + : (String) dataTable1.getValueAt(j, 6);// Ʒͺ + sbh1[j] = dataTable1.getValueAt(j, 7) == null ? "" + : (String) dataTable1.getValueAt(j, 7);// ʶ + jbcj1[j] = dataTable1.getValueAt(j, 8) == null ? "" + : (String) dataTable1.getValueAt(j, 8);// + bjbf1[j] = dataTable1.getValueAt(j, 9) == null ? "" + : (String) dataTable1.getValueAt(j, 9);// ⲿֵĹϵ + + cptzh1[j] = dataTable1.getValueAt(j, 10) == null ? "" + : (String) dataTable1.getValueAt(j, 10);// Ʒ + scxhzl1[j] = dataTable1.getValueAt(j, 11) == null ? "" + : (String) dataTable1.getValueAt(j, 11);// ͺ + sycs[j] = dataTable1.getValueAt(j, 12) == null ? "" + : (String) dataTable1.getValueAt(j, 12);// ʹó + qtzl1[j] = dataTable1.getValueAt(j, 10) == null ? "" + : (String) dataTable1.getValueAt(j, 10);// + tsyq1[j] = dataTable1.getValueAt(j, 11) == null ? "" + : (String) dataTable1.getValueAt(j, 11);// Ҫ + + + + sqr1[j] = dataTable1.getValueAt(j, 14) == null ? "" + : (String) dataTable1.getValueAt(j, 14);// + djrq1[j] = dataTable1.getValueAt(j, 15) == null ? "" + : (String) dataTable1.getValueAt(j, 15);// Ǽ + status1[j] = dataTable1.getValueAt(j, 16) == null ? "" + : (String) dataTable1.getValueAt(j, 16);// ״̬ + bz1[j] = dataTable1.getValueAt(j, 13) == null ? "" + : (String) dataTable1.getValueAt(j, 13);// ע + } + + try { + form.getTCProperty("jk8ProductType").setStringValueArray(lx1 );//ͿпޣֻˮһࣻͣԻҪ + form.getTCProperty("jk8ProjectNO").setStringValueArray(xmbh1);// Ŀ + form.getTCProperty("jk8ProjectName").setStringValueArray(xmmc1);// Ŀ + form.getTCProperty("jk8ProductModNO").setStringValueArray(cpxh1);// Ʒͺ + form.getTCProperty("jk8ProductIdentifyNO").setStringValueArray(sbh1);// ʶ + + form.getTCProperty("jk8ProductName").setStringValueArray(cpmc1);// Ʒ + form.getTCProperty("jk8BMManufactor").setStringValueArray(jbcj1);// + form.getTCProperty("jk8AlaDectRelation").setStringValueArray(bjbf1);// ⲿֵĹϵ + form.getTCProperty("jk8ContrlCompType").setStringValueArray(kzqzjlx1);// + form.getTCProperty("jk8Note").setStringValueArray(bz1);// ע + + form.getTCProperty("jk8Applicant").setStringValueArray(sqr1);// + form.getTCProperty("jk8RecordDate").setStringValueArray(djrq1);// Ǽ + form.getTCProperty("jk8Status").setStringValueArray(status1);// ״̬ + form.getTCProperty("jk8ProductType").setStringValueArray(cplx1);// Ʒ + form.getTCProperty("jk8ProFeatNum").setStringValueArray(cptzh1);// Ʒ + form.getTCProperty("jk8OutputSignal").setStringValueArray(scxhzl1);// ź + form.getTCProperty("jk8UsePlace").setStringValueArray(sycs1);// ʹó + form.getTCProperty("jk8GasType").setStringValueArray(qtzl1);// + form.getTCProperty("jk8CustSpecRequirements").setStringValueArray(tsyq1);// Ҫ + + } catch (TCException e) { + e.printStackTrace(); + } + + } + + + + public boolean isrend(Object[] jkfxget, Object[] jkfxset) { + // TODO Auto-generated method stub + if (jkfxget != null && jkfxset != null) { + if (jkfxget.length == jkfxset.length) { + for (int i = 0; i < jkfxset.length; i++) { + if (jkfxget[i] != null && (!jkfxget[i].equals(jkfxset[i]))) { + return true; + } + if (jkfxget[i] == null && jkfxset[i] != null&&(!jkfxset[i].equals(""))) { + return true; + } + } + } else { + return true; + } + } + + return false; + } + +} diff --git a/src/com/teamcenter/rac/form/JK8_CJQ_Form.java b/src/com/teamcenter/rac/form/JK8_CJQ_Form.java new file mode 100644 index 0000000..d17ca6d --- /dev/null +++ b/src/com/teamcenter/rac/form/JK8_CJQ_Form.java @@ -0,0 +1,683 @@ +package com.teamcenter.rac.form; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionListener; +import java.util.HashMap; +import javax.swing.ButtonGroup; +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.JTextField; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.stylesheet.AbstractRendering; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; +import com.teamcenter.rac.util.combobox.iComboBox; + +//2вƷͺţ²Ʒʶ +public class JK8_CJQ_Form extends AbstractRendering { + /** + * + */ + private static final long serialVersionUID = 1L; + private TCComponentForm form; + private TCSession session; + // private JButton tijiao; + private JButton yanzhen; + private JPanel mainPanel; + + private JPanel firstJPanel; + private JPanel secondJPanel; + private JPanel secondJPanel_1; + private JPanel secondJPanel_2; + private JPanel thirdJPanel; + private JScrollPane jsp; + // private Registry registry = null; + private ButtonGroup group; + private JPanel topJPanel; + private JPanel charu1; + private JPanel charu2; + + private JLabel jl1; + private JLabel jl2; + + + + private JTextField jt01;// Ŀ + private JTextField jt02;// Ŀ + private JTextField jt1; + private JTextArea jt2 ; + private JTextField jt3; + private JTextField jt4; + private JTextField jt5; + private JTextField jt6; + private JTextField jt7; + private JTextField jt8; + private JTextField jt9; + private JTextField jt10;// + private JTextField jt11;// + private JTextField jt12;// + + private iComboBox box1 = new iComboBox();// / + private iComboBox box2 = new iComboBox();// Ʒ + private iComboBox box3 = new iComboBox();// + private iComboBox box4 = new iComboBox();// Ʒѷʽ + + private JRadioButton radioButton1; + private JRadioButton radioButton2; + private String sysc = "";// г + private HashMap realNameMap;// lovѡֵ + private String jt;// Ʒͺ + + private String isCheck; + private boolean is = false; + + public JK8_CJQ_Form(TCComponentForm arg0) throws Exception { + super(arg0); + // Auto-generated constructor stub + form = arg0; + session = arg0.getSession(); + // registry = Registry.getRegistry(this); + String[] names = session.getPreferenceService().getStringValues("JK_CPXH_FORM"); + if (names != null) { + + realNameMap = new HashMap<>(); + for (int i = 0; i < names.length; i++) { + String[] s = names[i].split("="); + if (s != null && s.length == 2) { + String key = s[0]; + String value = s[1]; + realNameMap.put(key, value); + } + + } + + } else { + MessageBox.post("ѡ JK_CPXH_FORM ڣϵԱ", "", MessageBox.ERROR); + } + initializeUI(); + loadRendering(); + + mainPanel.addMouseMotionListener(new MouseMotionListener() { + + @Override + public void mouseMoved(MouseEvent e) { + // Auto-generated method stub + try { + isCheck = form.getTCProperty("fnd0IsCheckoutable").getDisplayableValue(); + } catch (TCException e1) { + // Auto-generated catch block + e1.printStackTrace(); + } + if ("".equals(isCheck)) { + seten(is); + setOwnerHave(); + } + } + + @Override + public void mouseDragged(MouseEvent e) { + // Auto-generated method stub + + } + }); + + if (!radioButton2.isSelected()) { + jt3.setEnabled(false); + } + jt9.setEnabled(false); + + } + + private void setLov(iComboBox box, String st) { + // Auto-generated method stub + box.setTextFieldLength(18); + box.setAutoCompleteSuggestive(false); + box.addItems(realNameMap.get(st).split(",")); + } + + public void initializeUI() { + System.out.println("UI-----Start"); + setLayout(new BorderLayout()); + initPanel(); + + jsp = new JScrollPane(initPanel()); + jsp.setPreferredSize(new Dimension(450, 490)); + jsp.getVerticalScrollBar().setUnitIncrement(20); + + add(jsp, "Center"); + this.setVisible(true); + this.setBackground(Color.lightGray); + } + + public JPanel initPanel() { + System.out.println("--------------------------"); + mainPanel = new JPanel(new PropertyLayout()); + this.setSize(new Dimension(650, 260)); + jt01 = new JTextField(30); + jt02 = new JTextField(30); + jt1 = new JTextField(30); + jt2 =new JTextArea(3,20); + jt3 = new JTextField(20); + jt4 = new JTextField(20); + jt5 = new JTextField(20); + jt6 = new JTextField(20); + jt7 = new JTextField(20); + jt8 = new JTextField(20); + jt9 = new JTextField(20); + jt10 = new JTextField(20); + jt11 = new JTextField(20); + jt12 = new JTextField(20); + + jl1 = new JLabel(" ɼʶ"); + jl1.setFont(new Font("", 1, 24)); + jl2 = new JLabel(" ɼʶϢǼ"); + jl2.setFont(new Font("", 1, 18)); + + topJPanel = new JPanel(new PropertyLayout()); + topJPanel.add("1.1.left.top.preferred.preferred", jl1); + topJPanel.add("1.2.left.top.preferred.preferred", new JLabel( + " ")); + // tijiao = new JButton("ύ"); + // tijiao.setPreferredSize(new Dimension(70, 30)); + // topJPanel.add("1.3.left.top.preferred.preferred", tijiao); + + firstJPanel = new JPanel(new PropertyLayout()); + firstJPanel.add("1.1.left.top.preferred.preferred", new JLabel( + " Ʒͺ:")); + firstJPanel.add("1.2.right.top.preferred.preferred", getjl()); + firstJPanel.add("1.3.left.top.preferred.preferred", jt1); + firstJPanel + .add("1.4.left.top.preferred.preferred", new JLabel(" ")); + yanzhen = new JButton("֤Ʒͺ"); + firstJPanel.add("1.5.left.top.preferred.preferred", yanzhen); + firstJPanel.add("2.1.left.top.preferred.preferred", new JLabel( + " Ŀ:")); + firstJPanel.add("2.2.right.top.preferred.preferred", getjl()); + firstJPanel.add("2.3.left.top.preferred.preferred", jt01); + firstJPanel.add("3.1.left.top.preferred.preferred", new JLabel( + " Ŀ:")); + firstJPanel.add("3.2.right.top.preferred.preferred", getjl()); + firstJPanel.add("3.3.left.top.preferred.preferred", jt02); + yanzhen.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // Auto-generated method stub + System.out.println("֤"); + yzbut(); + } + }); + charu1 = new JPanel(new PropertyLayout()); + charu1.add("1.1.left.top.preferred.preferred", jl2); + + charu2 = new JPanel(new PropertyLayout()); + charu2.add("1.1.left.top.preferred.preferred", + new JLabel(" /:")); + charu2.add("1.2.right.top.preferred.preferred", getjl()); + setLov(box1, "/"); + charu2.add("1.3.left.top.preferred.preferred", box1); + charu2.add("2.1.left.top.preferred.preferred", new JLabel(" Ʒ:")); + charu2.add("2.2.right.top.preferred.preferred", getjl()); + // Ʒ + setLov(box2, "Ʒ"); + charu2.add("2.3.left.top.preferred.preferred", box2); + charu2.add("3.1.left.top.preferred.preferred", new JLabel(" :")); + // + setLov(box3, ""); + charu2.add("3.2.right.top.preferred.preferred", getjl()); + charu2.add("3.3.left.top.preferred.preferred", box3); + + secondJPanel = new JPanel(new PropertyLayout()); + secondJPanel_1 = new JPanel(new PropertyLayout()); + secondJPanel_1.add("1.1.left.top.preferred.preferred", new JLabel( + " Ʒѷʽ ")); + setLov(box4, "Ʒѷʽ"); + secondJPanel_1.add("1.2.left.top.preferred.preferred", box4); + secondJPanel_1.add("2.1.left.top.preferred.preferred", new JLabel( + " г")); + radioButton1 = new JRadioButton("ͨ");// ѡť + radioButton2 = new JRadioButton("ר");// ѡť + radioButton1.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // Auto-generated method stub + if (radioButton1.isSelected()) { + jt3.setText(""); + jt3.setEnabled(false); + } + } + }); + radioButton2 = new JRadioButton("ר");// ѡť + radioButton2.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // Auto-generated method stub + if (radioButton2.isSelected()) { + jt3.setEnabled(true); + } + } + }); + group = new ButtonGroup(); + group.add(radioButton1); + group.add(radioButton2); + secondJPanel_1.add("2.2.left.top.preferred.preferred", radioButton1); + secondJPanel_1.add("2.3.left.top.preferred.preferred", radioButton2); + secondJPanel_1.add("2.4.left.top.preferred.preferred", jt3); + secondJPanel_1.add("3.1.left.top.preferred.preferred", new JLabel( + " ·ͺţ")); + secondJPanel_1.add("3.2.left.top.preferred.preferred", jt5); + secondJPanel_1.add("4.1.left.top.preferred.preferred", new JLabel( + " ICͺţ")); + secondJPanel_1.add("4.2.left.top.preferred.preferred", jt7); + + secondJPanel_1.add("5.1.left.top.preferred.preferred", new JLabel( + " ţ")); + secondJPanel_1.add("5.2.left.top.preferred.preferred", jt10); + + secondJPanel_1.add("6.1.left.top.preferred.preferred", new JLabel( + " ")); + secondJPanel_1.add("7.1.left.top.preferred.preferred", new JLabel( + " ׳ң")); + secondJPanel_1.add("7.2.left.top.preferred.preferred", jt12); + + secondJPanel_2 = new JPanel(new PropertyLayout()); + + JScrollPane jspane1=new JScrollPane(jt2); + jt2.setLineWrap(true); + secondJPanel_2.add("1.1.left.top.preferred.preferred", new JLabel( + " ܸ ")); + secondJPanel_2.add("1.2.left.top.preferred.preferred", getjl()); + secondJPanel_2.add("1.3.left.top.preferred.preferred", jspane1);//2019.6.24 Ĺܸ Ҫ + secondJPanel_2.add("2.1.left.top.preferred.preferred", new JLabel( + " ͺţ ")); + secondJPanel_2.add("2.2.left.top.preferred.preferred", jt4); + + secondJPanel_2.add("3.1.left.top.preferred.preferred", new JLabel( + " ")); + secondJPanel_2.add("3.2.left.top.preferred.preferred", jt6); + + secondJPanel_2.add("4.1.left.top.preferred.preferred", new JLabel( + " ͻҪ")); + secondJPanel_2.add("4.2.left.top.preferred.preferred", jt8); + secondJPanel_2.add("5.1.left.top.preferred.preferred", new JLabel( + " ͣ")); + secondJPanel_2.add("5.2.left.top.preferred.preferred", jt11); + secondJPanel.add("1.1.left.top.preferred.preferred", secondJPanel_1); + secondJPanel.add("1.2.left.top.preferred.preferred", secondJPanel_2); + + thirdJPanel = new JPanel(new PropertyLayout()); + thirdJPanel.add("1.1.left.top.preferred.preferred", new JLabel( + " ʶţ ")); + thirdJPanel.add("1.2.left.top.preferred.preferred", jt9); + + mainPanel.add("1.1.left.top.preferred.preferred", topJPanel); + mainPanel.add("2.1.left.top.preferred.preferred", firstJPanel); + mainPanel.add("3.1.left.top.preferred.preferred", charu1); + mainPanel.add("4.1.left.top.preferred.preferred", charu2); + mainPanel.add("5.1.left.top.preferred.preferred", secondJPanel); + mainPanel.add("6.1.left.top.preferred.preferred", thirdJPanel); + return mainPanel; + + } + + @Override + public void loadRendering() throws TCException { + // Auto-generated method stub + jt1.setText(form.getTCProperty("jk8ProductModNO").getStringValue());// Ʒͺ + jt01.setText(form.getTCProperty("jk8ProjectName").getStringValue());// Ŀ + jt02.setText(form.getTCProperty("jk8ProjectNO").getStringValue());// Ŀ + + box1.setText(form.getTCProperty("jk8BMManufactor").getStringValue());// / + box2.setText(form.getTCProperty("jk8ProductType_select") + .getStringValue());// Ʒ + box3.setText(form.getTCProperty("jk8ContrlCompType").getStringValue());// + + box4.setText(form.getTCProperty("jk8BillingMode").getStringValue());// Ʒѷʽ + jt5.setText(form.getTCProperty("jk8CircBoardModNO").getStringValue());// ·ͺ + jt2.setText(form.getTCProperty("jk8FunctionOverview").getStringValue());// ܸ + jt4.setText(form.getTCProperty("jk8InsteadType").getStringValue());// ͺ + jt6.setText(form.getTCProperty("jk8ProgramFeatures").getStringValue());// + jt8.setText(form.getTCProperty("jk8CustSpecRequirements") + .getStringValue());// ͻҪ + jt7.setText(form.getTCProperty("jk8ICCardType").getStringValue());// ICͺ + jt10.setText(form.getTCProperty("jk8Valve").getStringValue());// + jt11.setText(form.getTCProperty("jk8EncryptType").getStringValue());// + jt12.setText(form.getTCProperty("jk8BMManfMatched").getStringValue());// + + jt9.setText(form.getTCProperty("jk8ProductIdentifyNO").getStringValue());// ʶ + + sysc = form.getTCProperty("jk8ApplyMarket").getStringValue();// гѡֵ + if (sysc.equals("ͨ")) { + radioButton1.setSelected(true); + } else if (sysc.contains("ר")) { + radioButton2.setSelected(true); + String[] strs=form.getTCProperty("jk8ApplyMarket").getStringValue().split(";"); + if(strs!=null&&strs.length>1){ + jt3.setText(strs[1]);// ר + } + + } + + } + + /*@Override + public Map getRenderingModified() { + Map modifiedRendering = new HashMap (); + try { + System.out.println("getRenderingModifiedʼ"); + saveRendering(); + }catch(Exception ex){ + ex.toString(); + System.out.println(ex.toString()); + } + + + return modifiedRendering; + }*/ + + public boolean isRenderingModified() { + System.out.println("isRenderingModified"); + + try { + + if(isrend(form.getTCProperty("jk8ProductModNO"),jt1.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ProjectName"),jt01.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ProjectNO"),jt02.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8BMManufactor"),box1.getTextField().getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ProductType_select"),box2.getTextField().getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ContrlCompType"),box3.getTextField().getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8BillingMode"),box4.getTextField().getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8CircBoardModNO"),jt5.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8FunctionOverview"),jt2.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8InsteadType"),jt4.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ProgramFeatures"),jt6.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8CustSpecRequirements"),jt8.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ICCardType"),jt7.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ProductIdentifyNO"),jt9.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8Valve"),jt10.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8EncryptType"),jt11.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8BMManfMatched"),jt12.getText())){ + return true; + } + + if (radioButton1.isSelected()) { + if(isrend(form.getTCProperty("jk8ApplyMarket"),radioButton1.getText())){ + return true; + } + } + if (radioButton2.isSelected()) { + if(isrend(form.getTCProperty("jk8ApplyMarket"),radioButton2.getText() + ";" + jt3.getText())){ + return true; + } + } + + + } catch (TCException e) { + // Auto-generated catch block + e.printStackTrace(); + }// гѡ + return false; + } + + + private boolean isrend(TCProperty tcProperty, String str) { + // Auto-generated method stub + if(tcProperty!=null&&str!=null&&(!str.equals(tcProperty.getStringValue()))){ + System.out.println(str); + return true; + } + return false; + } + + @Override + public void saveRendering() { + // Auto-generated method stub + if ("".equals(jt1.getText()) || "".equals(jt01.getText()) + || "".equals(jt02.getText()) + || "".equals(jt2.getText()) + || "".equals(box1.getTextField().getText()) + || "".equals(box2.getTextField().getText()) + || "".equals(box3.getTextField().getText()) + ) { + MessageBox.post("޷,ȷȫд!!", "", MessageBox.ERROR); + + }else{ + if ("".equals(jt9.getText())) { + try { + form.getTCProperty("jk8ProductModNO").setStringValue( + jt1.getText());// Ʒͺ + form.getTCProperty("jk8ProjectName").setStringValue( + jt01.getText());// Ŀ + form.getTCProperty("jk8ProjectNO").setStringValue( + jt02.getText());// Ŀ + form.getTCProperty("jk8BMManufactor").setStringValue( + box1.getTextField().getText());// / + form.getTCProperty("jk8ProductType_select").setStringValue( + box2.getTextField().getText());// Ʒ + form.getTCProperty("jk8ContrlCompType").setStringValue( + box3.getTextField().getText());// + form.getTCProperty("jk8BillingMode").setStringValue( + box4.getTextField().getText());// Ʒѷʽ + form.getTCProperty("jk8CircBoardModNO").setStringValue( + jt5.getText());// ·ͺ + form.getTCProperty("jk8FunctionOverview").setStringValue( + jt2.getText());// ܸ + form.getTCProperty("jk8InsteadType").setStringValue( + jt4.getText());// ͺ + form.getTCProperty("jk8ProgramFeatures").setStringValue( + jt6.getText());// + form.getTCProperty("jk8CustSpecRequirements").setStringValue( + jt8.getText());// ͻҪ + form.getTCProperty("jk8ICCardType").setStringValue( + jt7.getText());// ICͺ + form.getTCProperty("jk8ProductIdentifyNO").setStringValue( + jt9.getText());// ʶ + form.getTCProperty("jk8Valve").setStringValue(jt10.getText());// + form.getTCProperty("jk8EncryptType").setStringValue( + jt11.getText());// + form.getTCProperty("jk8BMManfMatched").setStringValue( + jt12.getText());// + if (radioButton1.isSelected()) { + + form.getTCProperty("jk8ApplyMarket").setStringValue( + radioButton1.getText());// г + } + if (radioButton2.isSelected()) { + + form.getTCProperty("jk8ApplyMarket").setStringValue( + radioButton2.getText() + ";" + jt3.getText());// г + } + + } catch (Exception e) { + // Auto-generated catch block + e.printStackTrace(); + } + } else { + MessageBox.post("ʶѴ,޷ٴα", "", MessageBox.ERROR); + } + } + + } + + public void setOwnerHave() { + try { + + String user = session.getUserName(); + String owning_user = form.getProperty("owning_user"); + // System.out.println("owning_user.indexOf(user)="+owning_user.indexOf(user)); + if (owning_user.indexOf(user) < 0) { + jt1.setEnabled(false); + jt01.setEnabled(false); + jt02.setEnabled(false); + yanzhen.setEnabled(false); + box1.setEnabled(false); + box2.setEnabled(false); + box3.setEnabled(false); + box4.setEnabled(false); + jt2.setEnabled(false); + jt3.setEnabled(false); + jt4.setEnabled(false); + jt5.setEnabled(false); + jt6.setEnabled(false); + jt7.setEnabled(false); + jt8.setEnabled(false); + jt9.setEnabled(false); + jt10.setEnabled(false); + jt11.setEnabled(false); + jt12.setEnabled(false); + radioButton1.setEnabled(false); + radioButton2.setEnabled(false); + + } + } catch (TCException e) { + System.out.println("ӵǷʱļеòȷҲ"); + e.printStackTrace(); + } + } + + public void seten(boolean is) { + jt01.setEnabled(is); + jt02.setEnabled(is); + box1.setEnabled(is); + box2.setEnabled(is); + box3.setEnabled(is); + box4.setEnabled(is); + jt2.setEnabled(is); + // jt3.setEnabled(is); + jt4.setEnabled(is); + jt5.setEnabled(is); + jt6.setEnabled(is); + jt7.setEnabled(is); + jt8.setEnabled(is); + jt10.setEnabled(is); + jt11.setEnabled(is); + jt12.setEnabled(is); + radioButton1.setEnabled(is); + radioButton2.setEnabled(is); + } + + private void yzbut() { + // Auto-generated method stub + + jt = jt1.getText(); + if (jt != null && !jt.equals("") && !jt.equals("")) { + TCPreferenceService pref = session.getPreferenceService(); + String puid = pref.getStringValue("JK_SQB_FORM_PUID");// ѡpuid + if (puid == null) { + MessageBox.post("ѡδҵϵԱ", "", MessageBox.ERROR); + } + + TCComponentForm formAll; + try { + formAll = (TCComponentForm) session.stringToComponent(puid); + if (formAll == null) { + MessageBox.post("δҵϵԱ", "", MessageBox.ERROR); + } + boolean ishave1 = ishave("jk8ProductModNO", + "jk8ProductIdentifyNO", formAll);// Դ + + if (ishave1) { + MessageBox.post("ҵƷͺţòƷͺſ", "ɹ", + MessageBox.INFORMATION); + } else { + MessageBox.post("δҵƷͺţдIJƷͺǷȷ", "", + MessageBox.ERROR); + } + } catch (TCException e) { + // Auto-generated catch block + e.printStackTrace(); + MessageBox.post(e.getMessage(), "", MessageBox.ERROR); + } + } else { + MessageBox.post("ƷͺŲΪգдٵť", "", MessageBox.ERROR); + } + + } + + private boolean ishave(String cpxh_all, String sbh_all, + TCComponentForm formAll) { + // Auto-generated method stub + boolean bo = false; + try { + String[] cpxhs = formAll.getTCProperty(cpxh_all) + .getStringValueArray();// ܲƷͺ + String lx = ""; + String name = ""; + for (int i = 0; i < cpxhs.length; i++) { + if (jt.equals(cpxhs[i])) { + lx = formAll.getTCProperty("jk8ProductType") + .getStringValueArray()[i];// Ʒ + name = formAll.getTCProperty("jk8ProductName") + .getStringValueArray()[i];// Ʒ + bo = true; + break; + } + } + System.out.println("Ʒ:" + lx); + System.out.println("Ʒ:" + name); + form.getTCProperty("jk8ProductType").setStringValue(lx);// Ʒ + form.getTCProperty("jk8ProductName").setStringValue(name);// Ʒ + seten(bo); + is = bo; + } catch (TCException e) { + // Auto-generated catch block + e.printStackTrace(); + } + return bo; + } + + private JLabel getjl() { + JLabel bt = new JLabel("*"); + bt.setForeground(Color.red); + return bt; + } + +} diff --git a/src/com/teamcenter/rac/form/JK8_CPXH_Form.java b/src/com/teamcenter/rac/form/JK8_CPXH_Form.java new file mode 100644 index 0000000..e068628 --- /dev/null +++ b/src/com/teamcenter/rac/form/JK8_CPXH_Form.java @@ -0,0 +1,1195 @@ +package com.teamcenter.rac.form; + +//import java.awt.Dimension; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionListener; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import javax.swing.BorderFactory; +import javax.swing.ButtonGroup; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JScrollPane; +import javax.swing.JTextField; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.stylesheet.AbstractRendering; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; +import com.teamcenter.rac.util.combobox.iComboBox; + +//1²Ʒͺšʶ +public class JK8_CPXH_Form extends AbstractRendering { + /** + * + */ + private static final long serialVersionUID = 1L; + private TCComponentForm form; + private TCSession session; + // private Registry registry = null; + private JScrollPane jsp; + private JPanel jpall; + private JPanel jp1; + private JPanel jp11; + private JPanel jp12; + + private JPanel jp2; + private JPanel jp21; + private JPanel jp22; + private JPanel jp221; + private JPanel jp222; + private JPanel jp23; + private JPanel jp231; + private JPanel jp232; + private JPanel jp24; + private JPanel jp25; + private JPanel jp251; + private JPanel jp26; + +// private JPanel jp3; +// private JPanel jp31; +// +// private JPanel jp4; +// private JPanel jp41; +// private JPanel jp42; + + private JPanel jp5; + private JLabel jlab11; + private JTextField jtxt11;// Ʒ + private JTextField jtxt12 = new JTextField(24);// Ŀ + private JTextField jtxt13 = new JTextField(24);// Ŀ +// private JButton tj = new JButton("ύ"); + + // private JLabel jlab21; + // private JLabel jlab22; +// private JLabel jlab23; +// private JLabel jlab31; + + private JRadioButton jcb1;// ȼƷͺϢǼ + private JRadioButton jcb2;// ɼƷͺϢǼ + private JRadioButton jcb3;// еƷͺϢǼ + private JRadioButton jcb4;// + + // private JRadioButton myjcb;// + // private JRadioButton gyjcb;// + + private iComboBox box1 = new iComboBox();// ԭ + private iComboBox box2 = new iComboBox();// Ʒ1 + private iComboBox box3 = new iComboBox();// + private iComboBox box4 = new iComboBox();// + private iComboBox box5 = new iComboBox();// ICԤ + private iComboBox box6 = new iComboBox();// + private iComboBox box7 = new iComboBox();// ¶ѹ + private iComboBox box13 = new iComboBox();// + private iComboBox box12 = new iComboBox();// ͼ + +// private iComboBox box8 = new iComboBox();// / +// private iComboBox box9 = new iComboBox();// Ʒ +// private iComboBox box10 = new iComboBox();// +// private iComboBox box11 = new iComboBox();// Ʒѷʽ + + private iComboBox box14 = new iComboBox();// Ƿ 2018.3.20 + +// private ButtonGroup group; + private ButtonGroup group1; +// private JRadioButton jr1;// г1 +// private JRadioButton jr2;// г2 + private JTextField jt23 = new JTextField(24);// ҵ + private JTextField jt24 = new JTextField(24);// +// private JTextArea jt43 =new JTextArea(3,24);// ܸ +// private JTextField jt44 = new JTextField(14);// г3 +// private JTextField jt45 = new JTextField(24);// ͺ +// private JTextField jt46 = new JTextField(24);// ·ͺ +// private JTextField jt47 = new JTextField(24);// +// private JTextField jt48 = new JTextField(24);// ICͺ +// private JTextField jt49 = new JTextField(24);// ͻҪ +// private JTextField jt10 = new JTextField(24);;// +// private JTextField jt11 = new JTextField(24);;// +// private JTextField jt12 = new JTextField(24);;// + private JTextField jt51 = new JTextField(32);//TODO Ʒͺ +// private JTextField jt52 = new JTextField(32);// ʶ + +// private String sysc;// гѡֵ +// private String[] txms;// ͨŶѡֵ + private String[] myb;// öѡֵ + private String[] llgg;// ѡֵ + + //private List txlist = new ArrayList();// ͨŶѡ + private List mylist = new ArrayList();// öѡ + private List lllist = new ArrayList();// ѡ + + private iComboBox box15 = new iComboBox();// ͨ 2018.6.6ѡij + + private HashMap realNameMap;// lovѡֵ + + private String isCheck; + + public JK8_CPXH_Form(TCComponentForm c) throws Exception { + super(c); +// MessageBox.post("JK8_CPXH_Form()","",MessageBox.INFORMATION); + try { + form = c; + session = c.getSession(); + // registry = Registry.getRegistry(this); + String[] names = session.getPreferenceService().getStringValues("JK_CPXH_FORM"); + if (names != null) { + realNameMap = new HashMap<>(); + for (int i = 0; i < names.length; i++) { + String[] s = names[i].split("="); + if (s != null && s.length == 2) { + String key = s[0]; + String value = s[1]; + realNameMap.put(key, value); + } else { + MessageBox.post("ѡ JK_CPXH_FORM ôϵԱ", "", MessageBox.ERROR); + return; + } + } + } else { + MessageBox.post("ѡ JK_CPXH_FORM ڣϵԱ", "", MessageBox.ERROR); + } + + init(); + loadRendering(); + + jpall.addMouseMotionListener(new MouseMotionListener() { + @Override + public void mouseMoved(MouseEvent arg0) { + // Auto-generated method stub + try { + isCheck = form.getTCProperty("fnd0IsCheckoutable").getDisplayableValue(); + } catch (Exception e1) { + // Auto-generated catch block + e1.printStackTrace(); + } + if ("".equals(isCheck)) { + if (jcb1.isSelected()) { + setJcb2(false); + setJcb3(false); + } else if (jcb2.isSelected()) { + setJcb1(false); + setJcb3(false); + } else if (jcb3.isSelected()) { + setJcb1(false); + setJcb2(false); + } else if (jcb4.isSelected()) { + setJcb1(false); + setJcb2(false); + setJcb3(false); + } else { + setJcb1(false); + setJcb2(false); + setJcb3(false); + } + + setIsKlc(); + setLxEn(); + setOwnerHave(); + } + + } + + + @Override + public void mouseDragged(MouseEvent arg0) { + // Auto-generated method stub + + } + }); + +// if (!jr2.isSelected()) { +// jt44.setEnabled(false); +// } + jt51.setEnabled(false); +// jt52.setEnabled(false); + + System.out.println("end"); + + }catch(Exception e) { + e.printStackTrace(); + //ӡ쳣 + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + e.printStackTrace(new PrintStream(baos)); + String exception = baos.toString(); + MessageBox.post(exception,"쳣",MessageBox.INFORMATION); + } + } + + private void init() { +// MessageBox.post("init()","",MessageBox.INFORMATION); + // Auto-generated method stub + setLayout(new BorderLayout()); + // setBackground(Color.white); + jpall = new JPanel(new PropertyLayout()); + jp1 = new JPanel(new PropertyLayout()); + jp2 = new JPanel(new PropertyLayout()); +// jp3 = new JPanel(new PropertyLayout()); +// jp4 = new JPanel(new PropertyLayout()); + jp5 = new JPanel(new PropertyLayout()); + // jp1ʼ + jp11 = new JPanel(new PropertyLayout()); + jp12 = new JPanel(new PropertyLayout()); + jlab11 = new JLabel(" ²Ʒͺ "); + jlab11.setFont(new Font("", 1, 24)); + jtxt11 = new JTextField(); + jtxt11.setColumns(60); + jtxt11.setBackground(Color.white); + jp11.add("1.1.left.top", jlab11); + // jp11.add("1.2.right.top", tj); + // tj.addActionListener(new ActionListener() { + // + // @Override + // public void actionPerformed(ActionEvent actionevent) { + // // Auto-generated method stub + // saveRendering(); + // } + // }); + + jp12.add("1.1.left.top", new JLabel(" Ʒƣ ")); + jp12.add("1.2.right.top", getjl()); + jp12.add("1.3.left.top", jtxt11); + jp12.add("2.1.left.top", new JLabel(" Ŀƣ ")); + jp12.add("2.2.right.top", getjl()); + jp12.add("2.3.left.top", jtxt12); + jp12.add("3.1.left.top", new JLabel(" Ŀţ ")); + jp12.add("3.2.right.top", getjl()); + jp12.add("3.3.left.top", jtxt13); + jp1.add("1.1.left.top", jp11); + jp1.add("2.1.left.top", jp12); + + // jp2ʼ + jcb1 = new JRadioButton("ȼƷͺϢǼ"); + jcb1.setFont(new Font("", 0, 16)); + jcb1.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + // Auto-generated method stub + if (jcb1.isSelected()) { + setJcbTxt2(); + setJcbTxt3(); + setJcb1(true); + setJcb2(false); + setJcb3(false); + } + + } + }); + jcb2 = new JRadioButton("ɼƷͺϢǼ"); + jcb2.setFont(new Font("", 0, 16)); + jcb2.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + // Auto-generated method stub + setJcbTxt1(); + setJcbTxt3(); + setJcb1(false); + setJcb2(true); + setJcb3(false); + } + }); + jcb3 = new JRadioButton("еƷͺϢǼ"); + jcb3.setFont(new Font("", 0, 16)); + jcb3.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + // Auto-generated method stub + setJcbTxt1(); + setJcbTxt2(); + setJcb1(false); + setJcb2(false); + setJcb3(true); + } + }); + jcb4 = new JRadioButton(""); + jcb4.setFont(new Font("", 0, 16)); + jcb4.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + // Auto-generated method stub + setJcbTxt1(); + setJcbTxt2(); + setJcbTxt3(); + setJcb1(false); + setJcb2(false); + setJcb3(false); + } + }); + group1 = new ButtonGroup(); + group1.add(jcb1); + group1.add(jcb2); + group1.add(jcb3); + group1.add(jcb4); + // jlab21 = new JLabel(" ȼƷͺϢǼ "); + // jlab21.setFont(new Font("", 0, 16)); + // jlab22 = new JLabel("ɼƷͺϢǼ"); + // jlab22.setFont(new Font("", 0, 16)); + jp21 = new JPanel(new PropertyLayout()); + jp22 = new JPanel(new PropertyLayout()); + jp23 = new JPanel(new PropertyLayout()); + jp24 = new JPanel(new PropertyLayout()); + jp25 = new JPanel(new PropertyLayout()); + jp26 = new JPanel(new PropertyLayout()); + + jp21.add("1.1.left.top", new JLabel(" ԭ: ")); + jp21.add("1.2.right.top", getjl()); + setLov(box1, "ԭ"); + jp21.add("1.3.left.top", box1); + jp21.add("2.1.left.top", new JLabel(" Ʒ: ")); + jp21.add("2.2.right.top", getjl()); + setLov(box2, "Ʒ1"); + jp21.add("2.3.left.top", box2); + + jp221 = new JPanel(new PropertyLayout()); + jp222 = new JPanel(new PropertyLayout()); + + jp221.add("1.1.right.top", new JLabel("ͨģʽ:")); + jp221.add("1.2.right.top", getjl()); + //setLov(box15, "ͨģʽѡ"); + setLov(box15, "ͨģʽ"); + jp221.add("1.3.right.top", box15); +// String[] s1 = realNameMap.get("ͨģʽѡ").split(","); +// for (int j = 0; j < s1.length; j++) { +// JRadioButton jcb = new JRadioButton(s1[j]); +// if (txms != null && txms.length > 0) { +// for (String s : txms) { +// if (s1[j].equals(s)) { +// jcb.setSelected(true);// ݱԸֵ +// } +// } +// } +// txlist.add(jcb); +// jp221.add("1." + (j + 3) + ".right.top", jcb); +// } + jp222.add("1.1.left.top", new JLabel(":")); + setLov(box3, ""); + jp222.add("1.2.left.top", getjl()); + jp222.add("1.3.left.top", box3); + + jp22.add("1.1.left.top", jp221); + jp22.add("2.1.left.top", jp222); + + jp231 = new JPanel(new PropertyLayout()); + // myjcb = new JRadioButton("ñ:"); + jp231.add("1.1.left.top", new JLabel(" ñѡ:")); + String[] s2 = realNameMap.get("ñ").split(","); + for (int j = 0; j < s2.length; j++) { + JRadioButton jcb = new JRadioButton(s2[j]); + if (myb != null && myb.length > 0) { + for (String s : myb) { + if (s2[j].equals(s)) { + jcb.setSelected(true);// ݱԸֵ + } + } + } + mylist.add(jcb); + jp231.add("1." + (j + 2) + ".left.top", jcb); + } + jp232 = new JPanel(new PropertyLayout()); + // gyjcb = new JRadioButton("ҵ:"); + + jp232.add("1.1.left.top", new JLabel(" :")); + jp232.add("1.2.right.top", getjl()); + setLov(box14, ""); + + jp232.add("1.3.left.top", box14); + jp232.add("2.1.left.top", new JLabel(" ҵ:")); + jp232.add("2.2.left.top", new JLabel(" ")); + jp232.add("2.3.left.top", jt23); + jp232.add("3.1.left.top", new JLabel(" :")); + jp232.add("3.2.left.top", new JLabel(" ")); + jp232.add("3.3.left.top", jt24); + + jp23.add("1.1.left.top", new JLabel(" (ƷΧλΪ)")); + jp23.add("1.2.left.top", getjl()); + jp23.add("2.1.left.top", jp231); + jp23.add("3.1.left.top", jp232); + + jp24.add("1.1.left.top", new JLabel(" :")); + box4 = new iComboBox(); + setLov(box4, ""); + jp24.add("1.2.right.top", getjl()); + jp24.add("1.3.left.top", box4); + + jp24.add("2.1.left.top", new JLabel(" ICԤ:")); + setLov(box5, "ICԤ"); + jp24.add("2.2.left.top", new JLabel(" ")); + jp24.add("2.3.left.top", box5); + + jp24.add("3.1.left.top", new JLabel(" :")); + setLov(box6, ""); + jp24.add("3.2.left.top", getjl());//2019.05.16 + jp24.add("3.3.left.top", box6); + + jp24.add("4.1.left.top", new JLabel(" :")); + setLov(box7, "");//2018.6.1ijɲ + jp24.add("4.2.left.top", new JLabel(" ")); + jp24.add("4.3.left.top", box7); + + jp24.add("5.1.left.top", new JLabel(" :")); + setLov(box13, ""); + jp24.add("5.2.left.top", new JLabel(" ")); + jp24.add("5.3.left.top", box13); + + jp251 = new JPanel(new PropertyLayout()); + jp251.add("1.1.left.top", new JLabel("ͼ:")); + setLov(box12, "ͼ"); + jp251.add("1.2.right.top", getjl()); + jp251.add("1.3.left.top", box12); + jp251.add("2.1.left.top", new JLabel("񣨶ѡ:")); + jp251.add("2.2.right.top", getjl()); + String[] s3 = realNameMap.get("").split(","); + for (int j = 0; j < s3.length; j++) { + JRadioButton jcb = new JRadioButton(s3[j]); + if (llgg != null && llgg.length > 0) { + for (String s : llgg) { + if (s3[j].equals(s)) { + jcb.setSelected(true);// ݱԸֵ + } + } + } + lllist.add(jcb); + jp251.add("2." + (j + 3) + ".left.top", jcb); + } + jp25.add("1.1.left.top", jcb3); + jp25.add("2.1.left.top", jp251); + + // jlab23 = new JLabel(registry.getString("ע")); + jp26.add("1.1.left.top", jcb4); + // jp26.add("2.1.left.top", jlab23); + + JPanel jp2x = new JPanel(new PropertyLayout()); + jp2x.add("1.1.left.top", jcb1); + jp2x.add("2.1.left.top", jp21); + jp2x.add("3.1.left.top", jp23); + jp2x.add("4.1.left.top", jp24); + jp2x.setBorder(BorderFactory.createTitledBorder("")); + jp2x.setBorder(BorderFactory.createLineBorder(Color.white, 3)); + JPanel jp2y = new JPanel(new PropertyLayout()); + JPanel jp2y1 = new JPanel(new PropertyLayout()); + + jp2y1.add("1.1.left.top", jcb2); + jp2y1.add("2.1.left.top", jp22); + jp2y.add("1.1.left.top", jp2y1); + jp2y1.setBorder(BorderFactory.createTitledBorder("")); + jp2y1.setBorder(BorderFactory.createLineBorder(Color.white, 3)); + jp2y.add("2.1.left.top", jp25); + jp25.setBorder(BorderFactory.createTitledBorder("")); + jp25.setBorder(BorderFactory.createLineBorder(Color.white, 3)); + jp2y.add("3.1.left.top", jp26); + + jp2.add("1.1.left.top", jp2x); + jp2.add("1.2.left.top", jp2y); + + // jp2.add("1.1.left.top", jcb1); + // jp2.add("1.2.left.top", jcb2); + // jp2.add("2.1.left.top", jp21);// .preferred.preferred + // jp2.add("2.2.left.top", jp22); + // jp2.add("3.1.left.top", jp23); + // jp2.add("3.2.left.top", jp25); + // jp2.add("4.1.left.top", jp24); + // jp2.add("4.2.left.top", jp26); + + // jp3ʼ +// jlab31 = new JLabel(" ²ƷʶϢǼ"); +// jlab31.setFont(new Font("", 0, 16)); +// +// jp31 = new JPanel(new PropertyLayout()); +// jp31.add("1.1.left.top", new JLabel(" /:")); +// setLov(box8, "/"); +// jp31.add("1.2.right.top", getjl()); +// jp31.add("1.3.left.top", box8); +// jp31.add("2.1.left.top", new JLabel(" Ʒ:")); +// jp31.add("2.2.right.top", getjl()); +// setLov(box9, "Ʒ"); +// jp31.add("2.3.left.top", box9); +// jp31.add("3.1.left.top", new JLabel(" :")); +// setLov(box10, ""); +// jp31.add("3.2.right.top", getjl()); +// jp31.add("3.3.left.top", box10); +// +// jp3.add("1.1.left.top", jlab31); +// jp3.add("2.1.left.top", jp31); + + // jp4ʼ +// jp41 = new JPanel(new PropertyLayout()); +// jp42 = new JPanel(new PropertyLayout()); +// +// jp41.add("1.1.left.top", new JLabel(" Ʒѷʽ")); +// setLov(box11, "Ʒѷʽ"); +// jp41.add("1.2.left.top", box11); +// jp41.add("2.1.left.top", new JLabel(" г")); +// jr1 = new JRadioButton("ͨ");// ѡť +// jr1.addActionListener(new ActionListener() { +// +// @Override +// public void actionPerformed(ActionEvent e) { +// // Auto-generated method stub +// if (jr1.isSelected()) { +// jt44.setText(""); +// jt44.setEnabled(false); +// } +// } +// }); +// jr2 = new JRadioButton("ר");// ѡť +// jr2.addActionListener(new ActionListener() { +// +// @Override +// public void actionPerformed(ActionEvent e) { +// // Auto-generated method stub +// if (jr2.isSelected()) { +// jt44.setEnabled(true); +// } +// } +// }); +// group = new ButtonGroup(); +// group.add(jr1); +// group.add(jr2); +// jp41.add("2.2.left.top", jr1); +// jp41.add("2.3.left.top", jr2); +// jp41.add("2.4.left.top", jt44); +// jp41.add("3.1.left.top", new JLabel(" ·ͺţ")); +// jp41.add("3.2.left.top", jt46); +// jp41.add("4.1.left.top", new JLabel(" ICͺţ")); +// jp41.add("4.2.left.top", jt48); +// jp41.add("5.1.left.top", new JLabel(" ţ")); +// jp41.add("5.2.left.top", jt10); +// jp41.add("6.1.left.top", new JLabel(" ")); +// jp41.add("7.1.left.top", new JLabel(" ׳ң")); +// jp41.add("7.2.left.top", jt12); +// +// JScrollPane jspane1=new JScrollPane(jt43); +// jt43.setLineWrap(true); +// jp42.add("1.1.left.top", new JLabel(" ܸ ")); +// jp42.add("1.2.right.top", getjl()); +// jp42.add("1.3.left.top", jspane1);//2019.6.24 Ĺܸ Ҫ +// jp42.add("2.1.left.top", new JLabel(" ͺţ ")); +// jp42.add("2.2.left.top", new JLabel(" ")); +// jp42.add("2.3.left.top", jt45); +// jp42.add("3.1.left.top", new JLabel(" ")); +// jp42.add("3.2.left.top", new JLabel(" ")); +// jp42.add("3.3.left.top", jt47); +// jp42.add("4.1.left.top", new JLabel(" ͻҪ")); +// jp42.add("4.2.left.top", new JLabel(" ")); +// jp42.add("4.3.left.top", jt49); +// jp42.add("5.1.left.top", new JLabel(" ͣ")); +// jp42.add("5.2.left.top", new JLabel(" ")); +// jp42.add("5.3.left.top", jt11); +// +// jp4.add("1.1.left.top", jp41); +// jp4.add("1.2.left.top", jp42); + + // jp5ʼ + jp5.add("1.1.left.top", new JLabel(" Ʒͺţ ")); + jp5.add("1.2.left.top", jt51); +// jp5.add("1.3.left.top", new JLabel(" ʶţ")); +// jp5.add("1.4.left.top", jt52); + + jpall.add("1.1.left.top", jp1); + jpall.add("2.1.left.top", new JLabel("")); + jpall.add("3.1.left.top", jp2); +// jpall.add("4.1.left.top", new JLabel("")); +// jpall.add("5.1.left.top", jp3); +// jpall.add("6.1.left.top", new JLabel("")); +// jpall.add("7.1.left.top", jp4); + jpall.add("4.1.left.top", new JLabel("")); + jpall.add("5.1.left.top", jp5); + // jpall.setPreferredSize(new Dimension(700, 650)); + jsp = new JScrollPane(jpall);// + jsp.setPreferredSize(new Dimension(700, 600)); + add(jsp, "Center"); + this.setVisible(true); +// MessageBox.post("init()ִ","",MessageBox.INFORMATION); + } + + private void setLov(iComboBox box, String st) { + // Auto-generated method stub + box.setTextFieldLength(20); + box.setAutoCompleteSuggestive(false); + box.addItems(realNameMap.get(st).split(",")); + } + + @Override + public void loadRendering() throws TCException { + System.out.println("loadRendering"); +// MessageBox.post("loadRendering()","",MessageBox.INFORMATION); + // Auto-generated method stub +// sysc = form.getTCProperty("jk8ApplyMarket").getStringValue();// гѡֵ +// txms = form.getTCProperty("jk8CommunicateMode").getStringValue().split("");// ͨģʽѡ: + myb = form.getTCProperty("jk8CivilMeter").getStringValue().split("");// ñ + llgg = form.getTCProperty("jk8FlowSpecification").getStringValue().split("");// + +// init(); + +// if (sysc != null && !sysc.equals("")) {// гѡ +// +// if (sysc.equals("ͨ")) { +// jr1.setSelected(true); +// } else if (sysc.contains("ר")) { +// jr2.setSelected(true); +// String[] strs=form.getTCProperty("jk8ApplyMarket").getStringValue().split(";"); +// if(strs!=null&&strs.length>1){ +// jt44.setText(strs[1]);// ר +// } +// +// } +// } + + String str_jcb = form.getTCProperty("jk8ApplyType").getStringValue(); + if (str_jcb != null && !str_jcb.equals("")) { + if (str_jcb.equals(jcb1.getText())) { + jcb1.setSelected(true); + } else if (str_jcb.equals(jcb2.getText())) { + jcb2.setSelected(true); + } else if (str_jcb.equals(jcb3.getText())) { + jcb3.setSelected(true); + } else if (str_jcb.equals(jcb4.getText())) { + jcb4.setSelected(true); + } + } + + jtxt11.setText(form.getTCProperty("jk8ProductName").getStringValue());// Ʒ + jtxt12.setText(form.getTCProperty("jk8ProjectName").getStringValue());// Ŀ + jtxt13.setText(form.getTCProperty("jk8ProjectNO").getStringValue());// Ŀ + box1.setText(form.getTCProperty("jk8MeasureType").getStringValue());// ԭ + String str = form.getTCProperty("jk8ProductType1").getStringValue(); + if (str != null && str.contains("tb")) { + str = ""; + } + box2.setText(str);// Ʒ1 + box3.setText(form.getTCProperty("jk8ShellType").getStringValue());// + box4.setText(form.getTCProperty("jk8BaseMeterShellType").getStringValue());// + box5.setText(form.getTCProperty("jk8ICCardPrepaidFunc").getStringValue());// ICԤ + box6.setText(form.getTCProperty("jk8InternetOfThingFunc").getStringValue()); // + box7.setText(form.getTCProperty("jk8TempPressCompFunc").getStringValue()); // ѹ + box13.setText(form.getTCProperty("jk8SecurityFunc").getStringValue()); // + +// box8.setText(form.getTCProperty("jk8BMManufactor").getStringValue());// / +// box9.setText(form.getTCProperty("jk8ProductType").getStringValue());// Ʒ +// box10.setText(form.getTCProperty("jk8ContrlCompType").getStringValue());// +// box11.setText(form.getTCProperty("jk8BillingMode").getStringValue());// Ʒѷʽ + box12.setText(form.getTCProperty("jk8MeterTypeShellMaterial").getStringValue());// ͼ + + box14.setText(form.getTCProperty("jk8WideRange").getStringValue());// 2018.3.20 + + box15.setText(form.getTCProperty("jk8CommunicateMode").getStringValue());// ͨѶʽ2019.4.25 + + + jt23.setText(form.getTCProperty("jk8IndustrialMater").getStringValue());// ҵ + jt24.setText(form.getTCProperty("jk8FowMeter").getStringValue());// + +// jt43.setText(form.getTCProperty("jk8FunctionOverview").getStringValue());// ܸ +// // jt44.setText(form.getTCProperty("jk_xcp_sysc").getStringValue());// +// // г3 +// jt45.setText(form.getTCProperty("jk8InsteadType").getStringValue());// ͺ +// jt46.setText(form.getTCProperty("jk8CircBoardModNO").getStringValue());// ·ͺ +// jt47.setText(form.getTCProperty("jk8ProgramFeatures").getStringValue());// +// jt48.setText(form.getTCProperty("jk8ICCardType").getStringValue());// ICͺ +// jt49.setText(form.getTCProperty("jk8CustSpecRequirements").getStringValue());// ͻҪ + jt51.setText(form.getTCProperty("jk8ProductModNO").getStringValue());// Ʒͺ +// jt52.setText(form.getTCProperty("jk8ProductIdentifyNO").getStringValue());// ʶ +// +// jt10.setText(form.getTCProperty("jk8Valve").getStringValue());// +// jt11.setText(form.getTCProperty("jk8EncryptType").getStringValue());// +// jt12.setText(form.getTCProperty("jk8BMManfMatched").getStringValue());// +// MessageBox.post("loadRendering()ִ","",MessageBox.INFORMATION); + } + + + +/* @Override + public Map getRenderingModified() { + Map modifiedRendering = new HashMap (); + try { + System.out.println("getRenderingModifiedʼ"); + saveRendering(); + }catch(Exception ex){ + ex.toString(); + System.out.println(ex.toString()); + } + + + return modifiedRendering; + }*/ + + public boolean isRenderingModified() { + System.out.println("isRenderingModified"); + +// String sysc = ""; +// if (jr1.isSelected()) { +// sysc = jr1.getText(); +// } else if (jr2.isSelected()) { +// sysc = jr2.getText(); +// } + String jcb_str = ""; + if (jcb1.isSelected()) { + jcb_str = jcb1.getText(); + } else if (jcb2.isSelected()) { + jcb_str = jcb2.getText(); + } else if (jcb3.isSelected()) { + jcb_str = jcb3.getText(); + } else if (jcb4.isSelected()) { + jcb_str = jcb4.getText(); + } + try { + // if(isrend(form.getTCProperty("jk8ApplyMarket"),sysc + ";" + jt44.getText())){ + // return true; + // } + if(isrend(form.getTCProperty("jk8ApplyType"),jcb_str)){ + return true; + } + // if(isrend(form.getTCProperty("jk8CommunicateMode"),getListtxt(txlist))){ + // return true; + // } + if(isrend(form.getTCProperty("jk8CommunicateMode"),box15.getTextField().getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8CivilMeter"),getListtxt(mylist))){ + return true; + } + if(isrend(form.getTCProperty("jk8FlowSpecification"),getListtxt(lllist))){ + return true; + } + if(isrend(form.getTCProperty("jk8ProductName"),jtxt11.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ProjectName"),jtxt12.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ProjectNO"),jtxt13.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8MeasureType"),box1.getTextField().getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ProductType1"),box2.getTextField().getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ShellType"),box3.getTextField().getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8BaseMeterShellType"),box4.getTextField().getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ICCardPrepaidFunc"),box5.getTextField().getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8InternetOfThingFunc"),box6.getTextField().getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8TempPressCompFunc"),box7.getTextField().getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8SecurityFunc"),box13.getTextField().getText())){ + return true; + } + // if(isrend(form.getTCProperty("jk8BMManufactor"),box8.getTextField().getText())){ + // return true; + // } + // if(isrend(form.getTCProperty("jk8ProductType"),box9.getTextField().getText())){ + // return true; + // } + // if(isrend(form.getTCProperty("jk8ContrlCompType"),box10.getTextField().getText())){ + // return true; + // } + // if(isrend(form.getTCProperty("jk8BillingMode"),box11.getTextField().getText())){ + // return true; + // } + if(isrend(form.getTCProperty("jk8MeterTypeShellMaterial"),box12.getTextField().getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8WideRange"),box14.getTextField().getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8IndustrialMater"),jt23.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8FowMeter"),jt24.getText())){ + return true; + } + // if(isrend(form.getTCProperty("jk8FunctionOverview"),jt43.getText())){ + // return true; + // } + // if(isrend(form.getTCProperty("jk8InsteadType"),jt45.getText())){ + // return true; + // } + // if(isrend(form.getTCProperty("jk8CircBoardModNO"),jt46.getText())){ + // return true; + // } + // if(isrend(form.getTCProperty("jk8ProgramFeatures"),jt47.getText())){ + // return true; + // } + // if(isrend(form.getTCProperty("jk8ICCardType"),jt48.getText())){ + // return true; + // } + // if(isrend(form.getTCProperty("jk8CustSpecRequirements"),jt49.getText())){ + // return true; + // } + if(isrend(form.getTCProperty("jk8ProductModNO"),jt51.getText())){ + return true; + } + // if(isrend(form.getTCProperty("jk8ProductIdentifyNO"),jt52.getText())){ + // return true; + // } + // if(isrend(form.getTCProperty("jk8Valve"),jt10.getText())){ + // return true; + // } + // if(isrend(form.getTCProperty("jk8EncryptType"),jt11.getText())){ + // return true; + // } + // if(isrend(form.getTCProperty("jk8BMManfMatched"),jt12.getText())){ + // return true; + // } + + + } catch (Exception e) { + // Auto-generated catch block + e.printStackTrace(); + }// гѡ + return false; + } + + + + private boolean isrend(TCProperty tcProperty, String jcb_str) { + // Auto-generated method stub + if(tcProperty!=null && jcb_str!=null && !jcb_str.equals(tcProperty.getStringValue())){ + System.out.println(jcb_str); + return true; + } + return false; + } + + @Override + public void saveRendering() { + // Auto-generated method stub + boolean isno=true; + if ("".equals(jtxt11.getText()) || "".equals(jtxt12.getText()) + || "".equals(jtxt13.getText()) +// || "".equals(jt43.getText()) +// || "".equals(box8.getTextField().getText()) +// || "".equals(box9.getTextField().getText()) +// || "".equals(box10.getTextField().getText()) + ) { + isno=false; + } + if(jcb1.isSelected()||jcb2.isSelected()||jcb3.isSelected()||jcb4.isSelected()){ + if (jcb1.isSelected()) { + if ("".equals(box1.getTextField().getText()) + || "".equals(box2.getTextField().getText()) + || "".equals(box14.getTextField().getText()) + || "".equals(box4.getTextField().getText()) + || "".equals(box6.getTextField().getText()) + || "".equals(getListtxt(mylist)) && "".equals(jt23.getText()) && "".equals(jt24.getText())) { + isno=false; + } + } else if (jcb2.isSelected()) { + if ("".equals(box3.getTextField().getText()) ||"".equals(box15.getTextField().getText())) { + isno=false; + } + } else if (jcb3.isSelected()) { + if ("".equals(box12.getTextField().getText()) || "".equals(getListtxt(lllist))) { + isno=false; + } + } + }else{ + isno=false; + } + + if(isno){ +// if ("".equals(jt52.getText())) { + try { +// String sysc = ""; +// if (jr1.isSelected()) { +// sysc = jr1.getText(); +// } else if (jr2.isSelected()) { +// sysc = jr2.getText(); +// } +// form.getTCProperty("jk8ApplyMarket").setStringValue(sysc + ";" + jt44.getText());// гѡ + + String jcb_str = ""; + if (jcb1.isSelected()) { + jcb_str = jcb1.getText(); + } else if (jcb2.isSelected()) { + jcb_str = jcb2.getText(); + } else if (jcb3.isSelected()) { + jcb_str = jcb3.getText(); + } else if (jcb4.isSelected()) { + jcb_str = jcb4.getText(); + } + form.getTCProperty("jk8ApplyType").setStringValue(jcb_str);// ܵѡ + +// form.getTCProperty("jk8CommunicateMode").setStringValue(getListtxt(txlist));// ͨģʽѡ + form.getTCProperty("jk8CommunicateMode").setStringValue(box15.getTextField().getText());// ͨģʽѡ + + form.getTCProperty("jk8CivilMeter").setStringValue(getListtxt(mylist));// ñ + + form.getTCProperty("jk8FlowSpecification").setStringValue(getListtxt(lllist));// + + form.getTCProperty("jk8ProductName").setStringValue(jtxt11.getText());// Ʒ + form.getTCProperty("jk8ProjectName").setStringValue(jtxt12.getText());// Ŀ + form.getTCProperty("jk8ProjectNO").setStringValue(jtxt13.getText());// Ŀ + form.getTCProperty("jk8MeasureType").setStringValue(box1.getTextField().getText());// ԭ + form.getTCProperty("jk8ProductType1").setStringValue(box2.getTextField().getText());// Ʒ1 + form.getTCProperty("jk8ShellType").setStringValue(box3.getTextField().getText());// + form.getTCProperty("jk8BaseMeterShellType").setStringValue(box4.getTextField().getText());// + form.getTCProperty("jk8ICCardPrepaidFunc").setStringValue(box5.getTextField().getText());// ICԤ + form.getTCProperty("jk8InternetOfThingFunc").setStringValue(box6.getTextField().getText()); // + form.getTCProperty("jk8TempPressCompFunc").setStringValue(box7.getTextField().getText()); // ѹ + form.getTCProperty("jk8SecurityFunc").setStringValue(box13.getTextField().getText()); // + +// form.getTCProperty("jk8BMManufactor").setStringValue(box8.getTextField().getText());// / +// form.getTCProperty("jk8ProductType").setStringValue(box9.getTextField().getText());// Ʒ +// form.getTCProperty("jk8ContrlCompType").setStringValue(box10.getTextField().getText());// +// form.getTCProperty("jk8BillingMode").setStringValue(box11.getTextField().getText());// Ʒѷʽ + form.getTCProperty("jk8MeterTypeShellMaterial").setStringValue(box12.getTextField().getText());// ͼ + + form.getTCProperty("jk8WideRange").setStringValue(box14.getTextField().getText());// + form.getTCProperty("jk8IndustrialMater").setStringValue(jt23.getText());// ҵ + form.getTCProperty("jk8FowMeter").setStringValue(jt24.getText());// +// form.getTCProperty("jk8FunctionOverview").setStringValue(jt43.getText());// ܸ +// // form.getTCProperty("jk_xcp_sysc").setStringValue(jt44.getText());// +// // г3 +// form.getTCProperty("jk8InsteadType").setStringValue(jt45.getText());// ͺ +// form.getTCProperty("jk8CircBoardModNO").setStringValue(jt46.getText());// ·ͺ +// form.getTCProperty("jk8ProgramFeatures").setStringValue(jt47.getText());// +// form.getTCProperty("jk8ICCardType").setStringValue(jt48.getText());// ICͺ +// form.getTCProperty("jk8CustSpecRequirements").setStringValue(jt49.getText());// ͻҪ + form.getTCProperty("jk8ProductModNO").setStringValue(jt51.getText());// Ʒͺ +// form.getTCProperty("jk8ProductIdentifyNO").setStringValue(jt52.getText());// ʶ +// +// form.getTCProperty("jk8Valve").setStringValue(jt10.getText());// +// form.getTCProperty("jk8EncryptType").setStringValue(jt11.getText());// +// form.getTCProperty("jk8BMManfMatched").setStringValue(jt12.getText());// + } catch (Exception e) { +// Auto-generated catch block + e.printStackTrace(); + } +// } else { +// MessageBox.post("ʶѴ,޷ٴα", "", MessageBox.ERROR); +// } + }else{ + MessageBox.post("޷,ȷȫд!!", "", MessageBox.ERROR); + } + + } + + // ƴӶѡַ + private String getListtxt(List list) { + // Auto-generated method stub + String txms = ""; + for (int i = 0; i < list.size(); i++) { + if (list.get(i).isSelected()) { + txms = txms + "" + list.get(i).getText(); + } + } + if (txms.length() > 1) { + txms = txms.substring(1); + } + return txms; + } + + // ÷ӵ߲ɱ༭ + public void setOwnerHave() { + try { + + String user = session.getUserName(); + String owning_user = form.getProperty("owning_user"); + // System.out.println("owning_user.indexOf(user)="+owning_user.indexOf(user)); + if (owning_user.indexOf(user) < 0) { + // tj.setEnabled(false); + jcb1.setEnabled(false); + jcb2.setEnabled(false); + jcb3.setEnabled(false); + jcb4.setEnabled(false); + jtxt11.setEnabled(false); + jtxt12.setEnabled(false); + jtxt13.setEnabled(false); + jt51.setEnabled(false); +// jt52.setEnabled(false); + setJcb1(false); + setJcb2(false); + setJcb3(false); +// setOther(false); +// jt44.setEnabled(false); + + } + } catch (TCException e) { + System.out.println("ӵǷʱļеòȷҲ"); + e.printStackTrace(); + } + } + + // 1 + private void setJcbTxt1() { + // Auto-generated method stub + box1.setText(""); + box2.setText(""); + box14.setText(""); + box4.setText(""); + box5.setText(""); + box6.setText(""); + box7.setText(""); + box13.setText(""); + jt23.setText(""); + jt24.setText(""); + for (int i = 0; i < mylist.size(); i++) { + mylist.get(i).setSelected(false); + } + + } + + // 2 + private void setJcbTxt2() { + // Auto-generated method stub +// for (int i = 0; i < txlist.size(); i++) { +// txlist.get(i).setSelected(false); +// } + box15.setText(""); + box3.setText(""); + + } + + // 3 + private void setJcbTxt3() { + // Auto-generated method stub + box12.setText(""); + for (int i = 0; i < lllist.size(); i++) { + lllist.get(i).setSelected(false); + } + } + + // ȼƷͺϢǼǷɱ༭ + private void setJcb1(boolean is) { + // Auto-generated method stub + box1.setEnabled(is); + box2.setEnabled(is); + box14.setEnabled(is); + box4.setEnabled(is); + box5.setEnabled(is); + box6.setEnabled(is); + box7.setEnabled(is); + box13.setEnabled(is); + + jt24.setEnabled(is); + if (!is) {// isfalse,true + for (int i = 0; i < mylist.size(); i++) { + mylist.get(i).setEnabled(is); + } + jt23.setEnabled(is); + } + } + + // ɼƷͺϢǼǷɱ༭ + private void setJcb2(boolean is) { + // Auto-generated method stub +// for (int i = 0; i < txlist.size(); i++) { +// txlist.get(i).setEnabled(is); +// } + box15.setEnabled(is); + box3.setEnabled(is); + } + + // еƷͺϢǼǷɱ༭ + private void setJcb3(boolean is) { + // Auto-generated method stub + box12.setEnabled(is); + for (int i = 0; i < lllist.size(); i++) { + lllist.get(i).setEnabled(is); + } + } + + // ·Ƿɱ༭ +// private void setOther(boolean is) { +// // Auto-generated method stub +// box8.setEnabled(is); +// box9.setEnabled(is); +// box10.setEnabled(is); +// box11.setEnabled(is); +// jt43.setEnabled(is); +// // jt44.setEnabled(is); +// jt45.setEnabled(is); +// jt46.setEnabled(is); +// jt47.setEnabled(is); +// jt48.setEnabled(is); +// jt49.setEnabled(is); +// jt10.setEnabled(is); +// jt11.setEnabled(is); +// jt12.setEnabled(is); +// jr1.setEnabled(is); +// jr2.setEnabled(is); +// } + + private void setLxEn() { + String str = box2.getTextField().getText(); + for (int i = 0; i < mylist.size(); i++) { + mylist.get(i).setEnabled(false); + } + jt23.setEnabled(false); + jt24.setEnabled(false); + if (str.equals("ñ")) { + for (int i = 0; i < mylist.size(); i++) { + mylist.get(i).setEnabled(true); + } + jt23.setText(""); + jt24.setText(""); + } else if (str.equals("ҵ")) { + for (int i = 0; i < mylist.size(); i++) { + mylist.get(i).setSelected(false); + } + jt23.setEnabled(true); + jt24.setText(""); + } else if (str.equals("")) { + for (int i = 0; i < mylist.size(); i++) { + mylist.get(i).setSelected(false); + } + jt23.setText(""); + jt24.setEnabled(true); + + } + } + private ButtonGroup groupklc=new ButtonGroup(); + // ֻܵѡ + private void setIsKlc() { + // Auto-generated method stub + String str = box14.getTextField().getText(); + if("".equals(str)){ + +// boolean issel=false; + for (int i = 0; i < mylist.size(); i++) { + groupklc.add(mylist.get(i)); +// if(issel){ +// mylist.get(i).setSelected(false); +// } +// if(mylist.get(i).isSelected()){ +// issel=true; +// } + } + + + + }else{ + for (int i = 0; i < mylist.size(); i++) { + groupklc.remove(mylist.get(i)); + } + + } + } + + private JLabel getjl() { + JLabel bt = new JLabel("*"); + bt.setForeground(Color.red); + return bt; + } +} diff --git a/src/com/teamcenter/rac/form/JK8_ColPIdenNOAppForm.java b/src/com/teamcenter/rac/form/JK8_ColPIdenNOAppForm.java new file mode 100644 index 0000000..a1ca3a0 --- /dev/null +++ b/src/com/teamcenter/rac/form/JK8_ColPIdenNOAppForm.java @@ -0,0 +1,447 @@ +package com.teamcenter.rac.form; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionListener; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.swing.ButtonGroup; +import javax.swing.DefaultComboBoxModel; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JScrollPane; +import javax.swing.JTextField; +import javax.swing.plaf.basic.BasicBorders.RadioButtonBorder; + +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCComponentType; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.stylesheet.AbstractRendering; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; +import com.teamcenter.rac.util.Registry; +import com.teamcenter.rac.util.combobox.iComboBox; + +//7Ʒʶ +public class JK8_ColPIdenNOAppForm extends AbstractRendering { + private TCComponentForm form; + private TCSession session; + // private JButton tijiao; + private JButton yanzhen; + private JPanel mainPanel; + + private JPanel firstJPanel; + private JPanel thirdJPanel; + private JScrollPane jsp; + + private JPanel topJPanel; + private JPanel charu2; + + private JLabel jl1; + private JLabel jl2; + + private JTextField jt01;// Ŀ + private JTextField jt02;// Ŀ + private JTextField jt1;//Ʒͺ + private JTextField jt2;//ʶ + + + private iComboBox box1 = new iComboBox();// + private iComboBox box2 = new iComboBox();// ͨŷʽ + private iComboBox box3 = new iComboBox();// 緽ʽ + + + private HashMap realNameMap;// lovѡֵ + private String jt;// Ʒͺ + + private String isCheck; + private boolean is = false; + + public JK8_ColPIdenNOAppForm(TCComponentForm arg0) throws Exception { + super(arg0); + // TODO Auto-generated constructor stub + form = arg0; + session = arg0.getSession(); + // registry = Registry.getRegistry(this); + String[] names = session.getPreferenceService().getStringValues( + "JK_CPXH_FORM"); + if (names != null) { + + realNameMap = new HashMap<>(); + for (int i = 0; i < names.length; i++) { + String[] s = names[i].split("="); + if (s != null && s.length == 2) { + String key = s[0]; + String value = s[1]; + realNameMap.put(key, value); + } + + } + + } else { + MessageBox.post("ѡ JK_CPXH_FORM ڣϵԱ", "", + MessageBox.ERROR); + } + initializeUI(); + loadRendering(); + + mainPanel.addMouseMotionListener(new MouseMotionListener() { + + @Override + public void mouseMoved(MouseEvent e) { + // TODO Auto-generated method stub + try { + isCheck = form.getTCProperty("fnd0IsCheckoutable") + .getDisplayableValue(); + } catch (TCException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + if ("".equals(isCheck)) { + seten(is); + setOwnerHave(); + } + } + + @Override + public void mouseDragged(MouseEvent e) { + // TODO Auto-generated method stub + + } + }); + + jt2.setEnabled(false); + + } + + private void setLov(iComboBox box, String st) { + // TODO Auto-generated method stub + box.setTextFieldLength(18); + box.setAutoCompleteSuggestive(false); + box.addItems(realNameMap.get(st).split(",")); + } + + public void initializeUI() { + System.out.println("UI-----Start"); + setLayout(new BorderLayout()); + initPanel(); + + jsp = new JScrollPane(initPanel()); + jsp.setPreferredSize(new Dimension(450, 490)); + jsp.getVerticalScrollBar().setUnitIncrement(20); + + add(jsp, "Center"); + this.setVisible(true); + this.setBackground(Color.lightGray); + } + + public JPanel initPanel() { + System.out.println("--------------------------"); + mainPanel = new JPanel(new PropertyLayout()); + this.setSize(new Dimension(650, 260)); + jt01 = new JTextField(30); + jt02 = new JTextField(30); + jt1 = new JTextField(30); + jt2 = new JTextField(20); + + + jl1 = new JLabel(" ҵÿƷʶ"); + jl1.setFont(new Font("", 1, 24)); + jl2 = new JLabel(" ²ƷʶϢǼ"); + jl2.setFont(new Font("", 1, 18)); + + topJPanel = new JPanel(new PropertyLayout()); + topJPanel.add("1.1.left.top.preferred.preferred", jl1); + topJPanel.add("1.2.left.top.preferred.preferred", new JLabel( + " ")); + // tijiao = new JButton("ύ"); + // tijiao.setPreferredSize(new Dimension(70, 30)); + // topJPanel.add("1.3.left.top.preferred.preferred", tijiao); + + firstJPanel = new JPanel(new PropertyLayout()); + firstJPanel.add("1.1.left.top.preferred.preferred", new JLabel( + " Ʒͺ:")); + firstJPanel.add("1.2.right.top.preferred.preferred", getjl()); + firstJPanel.add("1.3.left.top.preferred.preferred", jt1); + firstJPanel + .add("1.4.left.top.preferred.preferred", new JLabel(" ")); + yanzhen = new JButton("֤Ʒͺ"); + firstJPanel.add("1.5.left.top.preferred.preferred", yanzhen); + firstJPanel.add("2.1.left.top.preferred.preferred", new JLabel( + " Ŀ:")); + firstJPanel.add("2.2.right.top.preferred.preferred", getjl()); + firstJPanel.add("2.3.left.top.preferred.preferred", jt01); + firstJPanel.add("3.1.left.top.preferred.preferred", new JLabel( + " Ŀ:")); + firstJPanel.add("3.2.right.top.preferred.preferred", getjl()); + firstJPanel.add("3.3.left.top.preferred.preferred", jt02); + yanzhen.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + System.out.println("֤"); + yzbut(); + } + }); + + charu2 = new JPanel(new PropertyLayout()); + charu2.add("1.1.left.top.preferred.preferred", + new JLabel(" ")); + charu2.add("1.2.right.top.preferred.preferred", getjl()); + setLov(box1, ""); + charu2.add("1.3.left.top.preferred.preferred", box1); +// charu2.add("2.1.left.top.preferred.preferred", new JLabel(" ͨŷʽ:")); +// charu2.add("2.2.right.top.preferred.preferred", getjl()); +// // Ʒ +// setLov(box2, "ͨŷʽ"); +// charu2.add("2.3.left.top.preferred.preferred", box2); + charu2.add("2.1.left.top.preferred.preferred", new JLabel(" 緽ʽ:")); + // + setLov(box3, "緽ʽ"); + charu2.add("2.2.right.top.preferred.preferred", getjl()); + charu2.add("2.3.left.top.preferred.preferred", box3); + + thirdJPanel = new JPanel(new PropertyLayout()); + thirdJPanel.add("1.1.left.top.preferred.preferred", new JLabel( + " ʶţ ")); + thirdJPanel.add("1.2.left.top.preferred.preferred", jt2); + + mainPanel.add("1.1.left.top.preferred.preferred", topJPanel); + mainPanel.add("2.1.left.top.preferred.preferred", firstJPanel); + mainPanel.add("3.1.left.top.preferred.preferred", charu2); + mainPanel.add("4.1.left.top.preferred.preferred", thirdJPanel); + return mainPanel; + + } + + @Override + public void loadRendering() throws TCException { + // TODO Auto-generated method stub + jt1.setText(form.getTCProperty("jk8ProductModNO").getStringValue());// Ʒͺ + jt01.setText(form.getTCProperty("jk8ProjectName").getStringValue());// Ŀ + jt02.setText(form.getTCProperty("jk8ProjectNO").getStringValue());// Ŀ + jt2.setText(form.getTCProperty("jk8ProductIdentifyNO").getStringValue());// ʶ + + + box1.setText(form.getTCProperty("jk8ValveType").getStringValue());// + box2.setText(form.getTCProperty("jk8CommunicateMode").getStringValue());// ͨŷʽ + box3.setText(form.getTCProperty("jk8PowerSupplyMode").getStringValue());// 緽ʽ + + } + + + + public boolean isRenderingModified() { + System.out.println("isRenderingModified"); + + try { + + if(isrend(form.getTCProperty("jk8ProductModNO"),jt1.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ProductIdentifyNO"),jt2.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ProjectName"),jt01.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ProjectNO"),jt02.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ValveType"),box1.getTextField().getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8CommunicateMode"),box2.getTextField().getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8PowerSupplyMode"),box3.getTextField().getText())){ + return true; + } + + + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + return false; + }// гѡ + return false; + } + + + private boolean isrend(TCProperty tcProperty, String str) { + // TODO Auto-generated method stub + if(tcProperty!=null&&str!=null&&(!str.equals(tcProperty.getStringValue()))){ + System.out.println(str); + return true; + } + return false; + } + + @Override + public void saveRendering() { + // TODO Auto-generated method stub + if ("".equals(jt1.getText()) || "".equals(jt01.getText()) + || "".equals(jt02.getText()) + || "".equals(box1.getTextField().getText()) + //|| "".equals(box2.getTextField().getText()) + || "".equals(box3.getTextField().getText()) + ) { + MessageBox.post("޷,ȷȫд!!", "", MessageBox.ERROR); + + }else{ + if ("".equals(jt2.getText())) { + try { + form.getTCProperty("jk8ProductModNO").setStringValue( + jt1.getText());// Ʒͺ + form.getTCProperty("jk8ProductIdentifyNO").setStringValue( + jt1.getText());// ʶ + form.getTCProperty("jk8ProjectName").setStringValue( + jt01.getText());// Ŀ + form.getTCProperty("jk8ProjectNO").setStringValue( + jt02.getText());// Ŀ + form.getTCProperty("jk8ValveType").setStringValue( + box1.getTextField().getText());// + form.getTCProperty("jk8CommunicateMode").setStringValue( + box2.getTextField().getText());// ͨŷʽ + form.getTCProperty("jk8PowerSupplyMode").setStringValue( + box3.getTextField().getText());// 緽ʽ + + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } else { + MessageBox.post("ʶѴ,޷ٴα", "", MessageBox.ERROR); + } + } + + } + + public void setOwnerHave() { + try { + + String user = session.getUserName(); + String owning_user = form.getProperty("owning_user"); + // System.out.println("owning_user.indexOf(user)="+owning_user.indexOf(user)); + if (owning_user.indexOf(user) < 0) { + jt1.setEnabled(false); + jt01.setEnabled(false); + jt02.setEnabled(false); + yanzhen.setEnabled(false); + box1.setEnabled(false); + box2.setEnabled(false); + box3.setEnabled(false); + jt2.setEnabled(false); + + } + } catch (TCException e) { + System.out.println("ӵǷʱļеòȷҲ"); + e.printStackTrace(); + } + } + + public void seten(boolean is) { + jt01.setEnabled(is); + jt02.setEnabled(is); + box1.setEnabled(is); + box2.setEnabled(is); + box3.setEnabled(is); + + + } + + private void yzbut() { + // TODO Auto-generated method stub + + jt = jt1.getText(); + if (jt != null && !jt.equals("") && !jt.equals("")) { + TCPreferenceService pref = session.getPreferenceService(); + String puid = pref.getStringValue("JK_SQB_FORM_PUID");// ѡpuid + if (puid == null) { + MessageBox.post("ѡJK_SQB_FORM_PUIDδҵϵԱ", "", MessageBox.ERROR); + } + + TCComponentForm formAll; + try { + formAll = (TCComponentForm) session.stringToComponent(puid); + if (formAll == null) { + MessageBox.post("ܱδҵϵԱ", "", MessageBox.ERROR); + } + boolean ishave1 = ishave("jk8ProductModNO", + "jk8ProductIdentifyNO", formAll);// Դ + + if (ishave1) { + MessageBox.post("ҵƷͺţòƷͺſ", "ɹ", + MessageBox.INFORMATION); + } else { + MessageBox.post("δҵƷͺţдIJƷͺǷȷ", "", + MessageBox.ERROR); + } + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + MessageBox.post(e.getMessage(), "", MessageBox.ERROR); + } + } else { + MessageBox.post("ƷͺŲΪգдٵť", "", MessageBox.ERROR); + } + + } + + private boolean ishave(String cpxh_all, String sbh_all, + TCComponentForm formAll) { + // TODO Auto-generated method stub + boolean bo = false; + try { + String[] cpxhs = formAll.getTCProperty(cpxh_all) + .getStringValueArray();// ܲƷͺ + String lx = ""; + String name = ""; + for (int i = 0; i < cpxhs.length; i++) { + if (jt.equals(cpxhs[i])) { + lx = formAll.getTCProperty("jk8ProductType") + .getStringValueArray()[i];// Ʒ + + if("tb10".equals(lx)){//жǷ + bo = true; + break; + } + + } + } + + + seten(bo); + is = bo; + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return bo; + } + + private JLabel getjl() { + JLabel bt = new JLabel("*"); + bt.setForeground(Color.red); + return bt; + } + +} diff --git a/src/com/teamcenter/rac/form/JK8_CotlerPModApp_Form.java b/src/com/teamcenter/rac/form/JK8_CotlerPModApp_Form.java new file mode 100644 index 0000000..f7fb9bd --- /dev/null +++ b/src/com/teamcenter/rac/form/JK8_CotlerPModApp_Form.java @@ -0,0 +1,278 @@ +package com.teamcenter.rac.form; + +//import java.awt.Dimension; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionListener; +import java.util.HashMap; + +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextField; + +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.stylesheet.AbstractRendering; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; +import com.teamcenter.rac.util.combobox.iComboBox; + +//6Ʒͺ +public class JK8_CotlerPModApp_Form extends AbstractRendering { + private TCComponentForm form; + private TCSession session; + // private Registry registry = null; + private JScrollPane jsp; + private JPanel jpall; + private JPanel jpal2; + private JPanel jp1; + + private JTextField jtxt11 = new JTextField(32);// Ʒ + private JTextField jtxt12 = new JTextField(32);// Ŀ + private JTextField jtxt13 = new JTextField(32);// Ŀ + private iComboBox box1 = new iComboBox();// / + private iComboBox box2 = new iComboBox();// ͨģʽ() + private JTextField jt2 = new JTextField(32);// ܸ + private JTextField jt3 = new JTextField(24);// Ʒͺ + private iComboBox box3 = new iComboBox();// ͣñҵ2019.7.26 + private iComboBox box4 = new iComboBox();//ֱ + + private HashMap realNameMap;// lovѡֵ + private String isCheck; + + public JK8_CotlerPModApp_Form(TCComponentForm c) throws Exception { + + super(c); + form = c; + session = c.getSession(); + // registry = Registry.getRegistry(this); + String[] names = session.getPreferenceService().getStringValues( + "JK_CPXH_FORM"); + if (names != null) { + + realNameMap = new HashMap<>(); + for (int i = 0; i < names.length; i++) { + String[] s = names[i].split("="); + if (s != null && s.length == 2) { + String key = s[0]; + String value = s[1]; + realNameMap.put(key, value); + } else { + MessageBox.post("ѡ JK_CPXH_FORM ôϵԱ", "", + MessageBox.ERROR); + return; + } + + } + + } else { + MessageBox.post("ѡ JK_CPXH_FORM ڣϵԱ", "", + MessageBox.ERROR); + } + + // init(); + loadRendering(); + + jp1.addMouseMotionListener(new MouseMotionListener() { + + @Override + public void mouseMoved(MouseEvent arg0) { + // TODO Auto-generated method stub + + try { + isCheck = form.getTCProperty("fnd0IsCheckoutable") + .getDisplayableValue(); + } catch (TCException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + if ("".equals(isCheck)) { + + setOwnerHave(); + } + } + @Override + public void mouseDragged(MouseEvent arg0) { + // TODO Auto-generated method stub + + } + }); + + jt3.setEnabled(false); + + System.out.println("end"); + } + + private void init() { + // TODO Auto-generated method stub + setLayout(new BorderLayout()); + // setBackground(Color.white); + jpall = new JPanel(new PropertyLayout()); + jpal2 = new JPanel(new PropertyLayout()); + jp1 = new JPanel(new PropertyLayout()); + + JLabel jlab11 = new JLabel("Ʒͺ "); + jlab11.setFont(new Font("", 1, 24)); + JLabel jlab12 = new JLabel("*Ҫ֤ʱ,¹Ʒͺ*"); + jlab12.setForeground(Color.red); + jpall.add("1.1.left.top", jlab11); + //jpall.add("2.1.left.top", jlab12); + + jpal2.add("1.1.left.top", new JLabel(" Ʒƣ")); + jpal2.add("1.2.right.top", getjl()); + jpal2.add("1.3.left.top", jtxt11); + jpal2.add("2.1.left.top", new JLabel(" Ŀƣ")); + jpal2.add("2.2.right.top", getjl()); + jpal2.add("2.3.left.top", jtxt12); + jpal2.add("3.1.left.top", new JLabel(" Ŀţ")); + jpal2.add("3.2.right.top", getjl()); + jpal2.add("3.3.left.top", jtxt13); + jpal2.add("4.1.left.top", new JLabel(" : ")); + jpal2.add("4.2.right.top", getjl()); + box3.setTextFieldLength(20); + box3.setAutoCompleteSuggestive(false); + box3.addItems(new String[]{"ҵ","ñ"}); + jpal2.add("4.3.left.top", box3); + jpal2.add("5.1.left.top", new JLabel(" : ")); + jpal2.add("5.2.right.top", getjl()); + setLov(box1, "/"); + jpal2.add("5.3.left.top", box1); + jpal2.add("6.1.left.top", new JLabel(" ͨŷʽ: ")); + jpal2.add("6.2.right.top", getjl()); + setLov(box2, ""); + jpal2.add("6.3.left.top", box2); + jpal2.add("7.1.left.top", new JLabel(" ֱ: ")); + jpal2.add("7.2.right.top", new JLabel(" ")); + setLov(box4, "ֱ"); + jpal2.add("7.3.left.top", box4); + + jpal2.add("8.1.left.top", new JLabel(" ܸ")); + jpal2.add("8.2.right.top", new JLabel(" ")); + jpal2.add("8.3.left.top", jt2); + jpal2.add("9.1.left.top", new JLabel(" ")); + jpal2.add("10.1.left.top", new JLabel(" Ʒͺţ")); + jpal2.add("10.2.right.top", new JLabel(" ")); + jpal2.add("10.3.left.top", jt3); + + jp1.add("1.1.left.top", jpall); + jp1.add("2.1.left.top", jpal2); + + // jpall.setPreferredSize(new Dimension(700, 650)); + jsp = new JScrollPane(jp1);// + jsp.setPreferredSize(new Dimension(500, 440)); + this.add(jsp, "Center"); + setVisible(true); + + } + + private void setLov(iComboBox box, String st) { + // TODO Auto-generated method stub + box.setTextFieldLength(20); + box.setAutoCompleteSuggestive(false); + box.addItems(realNameMap.get(st).split(",")); + } + + @Override + public void loadRendering() throws TCException { + // TODO Auto-generated method stub + init(); + jtxt11.setText(form.getTCProperty("jk8ProductName").getStringValue());// Ʒ + jtxt12.setText(form.getTCProperty("jk8ProjectName").getStringValue());// Ŀ + jtxt13.setText(form.getTCProperty("jk8ProjectNO").getStringValue());// Ŀ + box1.setText(form.getTCProperty("jk8BMManufactor").getStringValue());// + box2.setText(form.getTCProperty("jk8CommunicateMode").getStringValue());// ͨŷʽ + box3.setText(form.getTCProperty("jk8InduOrCivil").getStringValue());//2019.7.26 + box4.setText(form.getTCProperty("jk8NomDiameter").getStringValue());//ֱ2019.7.26 + jt2.setText(form.getTCProperty("jk8FunctionOverview").getStringValue());// ܸ + jt3.setText(form.getTCProperty("jk8ProductModNO").getStringValue());// Ʒͺ + + } + + @Override + public void saveRendering() { + // TODO Auto-generated method stub + if ("".equals(jtxt11.getText()) || "".equals(jtxt12.getText()) + || "".equals(jtxt13.getText()) + || "".equals(box1.getTextField().getText()) + || "".equals(box2.getTextField().getText()) + || "".equals(box3.getTextField().getText()) + ) { + + MessageBox.post("޷,ȷȫд!!", "", MessageBox.ERROR); + return; + } + if (box3.getTextField().getText().equals("ҵ")&&"".equals(box4.getTextField().getText())) { + + MessageBox.post("޷,ȷҵĹֱд!!", "", MessageBox.ERROR); + return; + } + + if ("".equals(jt3.getText())) { + try { + + form.getTCProperty("jk8ProductName").setStringValue( + jtxt11.getText());// Ʒ + form.getTCProperty("jk8ProjectName").setStringValue( + jtxt12.getText());// Ŀ + form.getTCProperty("jk8ProjectNO").setStringValue( + jtxt13.getText());// Ŀ + form.getTCProperty("jk8BMManufactor").setStringValue( + box1.getTextField().getText());// + form.getTCProperty("jk8CommunicateMode").setStringValue( + box2.getTextField().getText());// ͨŷʽ + form.getTCProperty("jk8InduOrCivil").setStringValue( + box3.getTextField().getText());// 2019.7.26 + form.getTCProperty("jk8NomDiameter").setStringValue( + box4.getTextField().getText());// ֱ2019.7.26 + form.getTCProperty("jk8FunctionOverview").setStringValue( + jt2.getText());// ܸ + + form.getTCProperty("jk8ProductModNO").setStringValue( + jt3.getText());// Ʒͺ + + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } else { + MessageBox.post("ƷͺѴ,޷ٴα", "", MessageBox.ERROR); + } + } + + // ÷ӵ߲ɱ༭ + public void setOwnerHave() { + try { + + String user = session.getUserName(); + String owning_user = form.getProperty("owning_user"); + // System.out.println("owning_user.indexOf(user)="+owning_user.indexOf(user)); + if (owning_user.indexOf(user) < 0) { + // tj.setEnabled(false); + jtxt11.setEnabled(false); + jtxt12.setEnabled(false); + jtxt13.setEnabled(false); + box1.setEnabled(false); + box2.setEnabled(false); + box3.setEnabled(false); + box4.setEnabled(false); + jt2.setEnabled(false); + jt3.setEnabled(false); + + } + } catch (TCException e) { + System.out.println("ӵǷʱļеòȷҲ"); + e.printStackTrace(); + } + } + + private JLabel getjl() { + JLabel bt = new JLabel("*"); + bt.setForeground(Color.red); + return bt; + } +} diff --git a/src/com/teamcenter/rac/form/JK8_FXGL_Form.java b/src/com/teamcenter/rac/form/JK8_FXGL_Form.java new file mode 100644 index 0000000..6b32e1d --- /dev/null +++ b/src/com/teamcenter/rac/form/JK8_FXGL_Form.java @@ -0,0 +1,598 @@ +package com.teamcenter.rac.form; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import javax.swing.CellEditor; +import javax.swing.DefaultCellEditor; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.table.DefaultTableModel; +import javax.swing.table.TableCellEditor; +import javax.swing.table.TableColumn; +import javax.swing.table.TableColumnModel; + +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCFormProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.stylesheet.AbstractRendering; +import com.teamcenter.rac.util.MessageBox; + +//չ +public class JK8_FXGL_Form extends AbstractRendering { + private TCComponentForm form; + private TCSession session; + private int selIndex; + private Date getdate; + private Date getdate2; + private DefaultTableModel tableModel; // TableModel + private TableWithRowHead table = null; + private TCFormProperty[] formProperties; + // formijԵֵ + // private String[] jkfxget1; + private String[] jkfxget2; + private String[] jkfxget3; + private String[] jkfxget4; + private String[] jkfxget5; + private String[] jkfxget6; + private Date[] jkfxget7; + private String[] jkfxget8; + private String[] jkfxget9; + private String[] jkfxget10; + private String[] jkfxget11; + private Date[] jkfxget12; + private String[] jkfxget13; + private String[] jkfxget14; + + // private String[] jkfxset1; + private String[] jkfxset2; + private String[] jkfxset3; + private String[] jkfxset4; + private String[] jkfxset5; + private String[] jkfxset6; + private Date[] jkfxset7; + private String[] jkfxset8; + private String[] jkfxset9; + private String[] jkfxset10; + private String[] jkfxset11; + private Date[] jkfxset12; + private String[] jkfxset13; + private String[] jkfxset14; + + private JScrollPane scr; + private JButton addBut; + private JButton delBut; + private Object[][] userInfo = new Object[1][14]; + + private String[] titles = { "", "", "Ԥɵĺ", "", "Ӱ", "ۺӰ", + "ʶ", "Ԥʩ", "Ӧʩ", "Ӧ", "״̬", "", "ӦԲ", "ӦԹ" }; + + private Object[] strs1;// 4 + private Object[] strs2;// 5 + private Object[] strs3;// 6 + private Object[] strs4;// 11 + private Object[] strs5;// 13 + + public JK8_FXGL_Form(TableWithRowHead table, Date selecttime, boolean bo) + throws Exception { + // TODO Auto-generated constructor stub + this.table = table; + + // System.out.println("==========" + getdate); + if (bo) { + this.getdate = selecttime; + setDateValue(selecttime); + } else { + this.getdate2 = selecttime; + setDateValue2(selecttime); + } + } + + public JK8_FXGL_Form(TCComponentForm arg0) throws Exception { + super(arg0); + // TODO Auto-generated constructor stub + form = arg0; + session = arg0.getSession(); + + String[] names = session.getPreferenceService().getStringValues( + "JK_RISK_FORM"); + if (names != null && names.length == 5) { + try { + strs1 = names[0].split(":")[1].split(","); + strs2 = names[1].split(":")[1].split(","); + strs3 = names[2].split(":")[1].split(","); + strs4 = names[3].split(":")[1].split(","); + strs5 = names[4].split(":")[1].split(","); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + MessageBox.post("ѡ JK_RISK_FORM ôϵԱ", "", + MessageBox.ERROR); + return; + } + } else { + MessageBox.post("ѡ JK_RISK_FORM ڻôϵԱ", "", + MessageBox.ERROR); + return; + } + + // initializeUI(); + loadRendering(); + } + + @Override + public void loadRendering() throws TCException { + // TODO Auto-generated method stub + // jkfxget1 = + // form.getTCProperty("jk8SequanceNO").getStringValueArray();// δ + // TCFormProperty[] + // formProperties=((TCComponentForm)getComponent()).getAllFormProperties(); + // for(int i=0;i= 0) { + int yn = JOptionPane.showConfirmDialog(null, "ǷɾѡУ", + "ɾȷ϶Ի", 0, 2); + if (yn == 0) { + int cow = 0; + // System.out.println("rc="+rc); + + int[] rows = table.getSelectedRows(); + int count = tableModel.getRowCount(); + for (int i = rows.length - 1; i >= 0; i--) { + tableModel.removeRow(rows[i]); + cow++; + } + + tableModel.setRowCount(count - cow); + } + setxh(); + } else { + MessageBox.post("ѡҪɾ", "ʾ", MessageBox.INFORMATION); + } + + } + }); + + tableModel = new DefaultTableModel(userInfo, titles); + table = new TableWithRowHead(tableModel, session); + + setxh(); + + // TODO Auto-generated method stub + addLov(strs1, 3); + addLov(strs2, 4); + addLov(strs3, 5); + addLov(strs4, 10); + addLov(strs5, 12); + /*** + * ԪԶ + */ + TableColumnModel cmodel = table.getColumnModel(); + TextAreaRenderer textAreaRenderer = new TextAreaRenderer(); + for (int i = 1; i < 14; i++) { + cmodel.getColumn(i).setCellRenderer(textAreaRenderer); + } + table.setBackground(Color.white); + + // + scr = new JScrollPane(table); + scr.setPreferredSize(new Dimension(1000, 400)); + + add(jpbut, BorderLayout.NORTH); + // formв˹ + add(scr, BorderLayout.CENTER); + setPreferredSize(new Dimension(1200, 400)); + // formΪɼ + setVisible(true); + } + + // ųʼ + private void setxh() { + // TODO Auto-generated method stub + int cl = table.getRowCount(); + for (int i = 0; i < cl; i++) { + table.setValueAt(i + 1 + "", i, 0); + } + } + +/* @Override + public Map getRenderingModified() { + Map modifiedRendering = new HashMap(); + saveRendering(); + return modifiedRendering; + } +*/ + public boolean isRenderingModified() { + System.out.println("isRenderingModified"); + + int rowCount = table.getRowCount(); + + jkfxset2 = new String[rowCount]; + jkfxset3 = new String[rowCount]; + jkfxset4 = new String[rowCount]; + jkfxset5 = new String[rowCount]; + jkfxset6 = new String[rowCount]; + jkfxset7 = new Date[rowCount]; + jkfxset8 = new String[rowCount]; + jkfxset9 = new String[rowCount]; + jkfxset10 = new String[rowCount]; + jkfxset11 = new String[rowCount]; + jkfxset12 = new Date[rowCount]; + jkfxset13 = new String[rowCount]; + jkfxset14 = new String[rowCount]; + // ѭÿУֵformӦԡ + try { + + for (int j = 0; j < rowCount; j++) { + + // jkfxset1[j] = (String) table.getValueAt(j, 0); + jkfxset2[j] = table.getValueAt(j, 1) != null ? (String) table + .getValueAt(j, 1) : ""; + jkfxset3[j] = table.getValueAt(j, 2) != null ? (String) table + .getValueAt(j, 2) : ""; + jkfxset4[j] = table.getValueAt(j, 3) != null ? (String) table + .getValueAt(j, 3) : ""; + jkfxset5[j] = table.getValueAt(j, 4) != null ? (String) table + .getValueAt(j, 4) : ""; + jkfxset6[j] = table.getValueAt(j, 5) != null ? (String) table + .getValueAt(j, 5) : ""; + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + if (table.getValueAt(j, 6) != null + && !table.getValueAt(j, 6).equals("")) { + + jkfxset7[j] = formatter.parse((String) (table.getValueAt(j, + 6))); + } else { + jkfxset7[j] = null; + + } + jkfxset8[j] = table.getValueAt(j, 7) != null ? (String) table + .getValueAt(j, 7) : ""; + jkfxset9[j] = table.getValueAt(j, 8) != null ? (String) table + .getValueAt(j, 8) : ""; + jkfxset10[j] = table.getValueAt(j, 9) != null ? (String) table + .getValueAt(j, 9) : ""; + jkfxset11[j] = table.getValueAt(j, 10) != null ? (String) table + .getValueAt(j, 10) : ""; + + if (table.getValueAt(j, 11) != null + && !table.getValueAt(j, 11).equals("")) { + + jkfxset12[j] = formatter.parse((String) (table.getValueAt( + j, 11))); + } else { + jkfxset12[j] = null; + ; + } + + jkfxset13[j] = table.getValueAt(j, 12) != null ? (String) table + .getValueAt(j, 12) : ""; + jkfxset14[j] = table.getValueAt(j, 13) != null ? (String) table + .getValueAt(j, 13) : ""; + + } + + if (isrend(form.getTCProperty("jk8RiskDesc").getStringValueArray(), jkfxset2)) { + return true; + } + if (isrend(form.getTCProperty("jk8EstiResult").getStringValueArray(), jkfxset3)) { + return true; + } + if (isrend(form.getTCProperty("jk8Probability").getStringValueArray(), jkfxset4)) { + return true; + } + if (isrend( form.getTCProperty("jk8Influence").getStringValueArray(), jkfxset5)) { + return true; + } + if (isrend(form.getTCProperty("jk8ComInfluence").getStringValueArray(), jkfxset6)) { + return true; + } + if (isrend(form.getTCProperty("jk8IdentifyDate").getDateValueArray(), jkfxset7)) { + return true; + } + if (isrend(form.getTCProperty("jk8PreMeasure").getStringValueArray(), jkfxset8)) { + return true; + } + if (isrend(form.getTCProperty("jk8EmgMeasure").getStringValueArray(), jkfxset9)) { + return true; + } + if (isrend(form.getTCProperty("jk8DealPerson").getStringValueArray(), jkfxset10)) { + return true; + } + if (isrend(form.getTCProperty("jk8State").getStringValueArray(), jkfxset11)) { + return true; + } + if (isrend(form.getTCProperty("jk8OccurDate").getDateValueArray(), jkfxset12)) { + return true; + } + if (isrend(form.getTCProperty("jk8Measure").getStringValueArray(), jkfxset13)) { + return true; + } + if (isrend(form.getTCProperty("jk8RiskCorresProcess").getStringValueArray(), jkfxset14)) { + return true; + } + + // form.getTCProperty("jk8RiskDesc").setStringValueArray(jkfxset2); + // form.getTCProperty("jk8EstiResult").setStringValueArray(jkfxset3); + // form.getTCProperty("jk8Probability").setStringValueArray(jkfxset4); + // form.getTCProperty("jk8Influence").setStringValueArray(jkfxset5); + // form.getTCProperty("jk8ComInfluence").setStringValueArray(jkfxset6); + // form.getTCProperty("jk8IdentifyDate").setDateValueArray(jkfxset7); + // form.getTCProperty("jk8PreMeasure").setStringValueArray(jkfxset8); + // form.getTCProperty("jk8EmgMeasure").setStringValueArray(jkfxset9); + // form.getTCProperty("jk8DealPerson").setStringValueArray(jkfxset10); + // form.getTCProperty("jk8State").setStringValueArray(jkfxset11); + // form.getTCProperty("jk8OccurDate").setDateValueArray(jkfxset12); + // form.getTCProperty("jk8Measure").setStringValueArray(jkfxset13); + // form.getTCProperty("jk8RiskCorresProcess").setStringValueArray( + // jkfxset14); + + } catch (ParseException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (Exception e) { + + e.printStackTrace(); + } + + return false; + + } + + public boolean isrend(Object[] jkfxget, Object[] jkfxset) { + // TODO Auto-generated method stub + if (jkfxget != null && jkfxset != null) { + if (jkfxget.length == jkfxset.length) { + for (int i = 0; i < jkfxset.length; i++) { + if (jkfxget[i] != null && (!jkfxget[i].equals(jkfxset[i]))) { + return true; + } + if (jkfxget[i] == null && jkfxset[i] != null&&(!jkfxset[i].equals(""))) { + return true; + } + } + } else { + return true; + } + } + + return false; + } + + @Override + public void saveRendering() { + // TODO Auto-generated method stub + // õtable + + int rowCount = table.getRowCount(); + System.out.println("row=" + rowCount); + try { + int[] in = { 2, 3, 8, 9, 10, 14 }; + for (int i = 0; i < rowCount; i++) { + for (int j = 0; j < in.length; j++) { + if (table.getCellEditor(i, in[j]) != null) { + System.out.println("dada=" + in[j]); + table.getCellEditor(i, in[j]).stopCellEditing(); + } + + } + } + } catch (Exception e) { + // TODO: handle exception + System.out.println(""); + } + + jkfxset2 = new String[rowCount]; + jkfxset3 = new String[rowCount]; + jkfxset4 = new String[rowCount]; + jkfxset5 = new String[rowCount]; + jkfxset6 = new String[rowCount]; + jkfxset7 = new Date[rowCount]; + jkfxset8 = new String[rowCount]; + jkfxset9 = new String[rowCount]; + jkfxset10 = new String[rowCount]; + jkfxset11 = new String[rowCount]; + jkfxset12 = new Date[rowCount]; + jkfxset13 = new String[rowCount]; + jkfxset14 = new String[rowCount]; + // ѭÿУֵformӦԡ + try { + for (int j = 0; j < rowCount; j++) { + + // jkfxset1[j] = (String) table.getValueAt(j, 0); + jkfxset2[j] = table.getValueAt(j, 1) != null ? (String) table + .getValueAt(j, 1) : ""; + jkfxset3[j] = table.getValueAt(j, 2) != null ? (String) table + .getValueAt(j, 2) : ""; + jkfxset4[j] = table.getValueAt(j, 3) != null ? (String) table + .getValueAt(j, 3) : ""; + jkfxset5[j] = table.getValueAt(j, 4) != null ? (String) table + .getValueAt(j, 4) : ""; + jkfxset6[j] = table.getValueAt(j, 5) != null ? (String) table + .getValueAt(j, 5) : ""; + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + if (table.getValueAt(j, 6) != null + && !table.getValueAt(j, 6).equals("")) { + + jkfxset7[j] = formatter.parse((String) (table.getValueAt(j, + 6))); + } else { + jkfxset7[j] = null; + + } + jkfxset8[j] = table.getValueAt(j, 7) != null ? (String) table + .getValueAt(j, 7) : ""; + jkfxset9[j] = table.getValueAt(j, 8) != null ? (String) table + .getValueAt(j, 8) : ""; + jkfxset10[j] = table.getValueAt(j, 9) != null ? (String) table + .getValueAt(j, 9) : ""; + jkfxset11[j] = table.getValueAt(j, 10) != null ? (String) table + .getValueAt(j, 10) : ""; + + if (table.getValueAt(j, 11) != null + && !table.getValueAt(j, 11).equals("")) { + + jkfxset12[j] = formatter.parse((String) (table.getValueAt( + j, 11))); + } else { + jkfxset12[j] = null; + ; + } + + jkfxset13[j] = table.getValueAt(j, 12) != null ? (String) table + .getValueAt(j, 12) : ""; + jkfxset14[j] = table.getValueAt(j, 13) != null ? (String) table + .getValueAt(j, 13) : ""; + + } + form.getTCProperty("jk8RiskDesc").setStringValueArray(jkfxset2); + form.getTCProperty("jk8EstiResult").setStringValueArray(jkfxset3); + form.getTCProperty("jk8Probability").setStringValueArray(jkfxset4); + form.getTCProperty("jk8Influence").setStringValueArray(jkfxset5); + form.getTCProperty("jk8ComInfluence").setStringValueArray(jkfxset6); + form.getTCProperty("jk8IdentifyDate").setDateValueArray(jkfxset7); + form.getTCProperty("jk8PreMeasure").setStringValueArray(jkfxset8); + form.getTCProperty("jk8EmgMeasure").setStringValueArray(jkfxset9); + form.getTCProperty("jk8DealPerson").setStringValueArray(jkfxset10); + form.getTCProperty("jk8State").setStringValueArray(jkfxset11); + form.getTCProperty("jk8OccurDate").setDateValueArray(jkfxset12); + form.getTCProperty("jk8Measure").setStringValueArray(jkfxset13); + form.getTCProperty("jk8RiskCorresProcess").setStringValueArray( + jkfxset14); + + } catch (ParseException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (TCException e) { + + e.printStackTrace(); + } + // еֵ浽Form + + // form.getTCProperty("jk8SequanceNO").setStringValueArray(jkfxset1); + + } + + private void addLov(Object[] str_registry, int column_index) { + // TODO Auto-generated method stub + JComboBox jComboBox01 = new JComboBox(str_registry); + TableCellEditor roleTableCellEditor01 = new DefaultCellEditor( + jComboBox01); + TableColumn tableColumn01 = table.getColumnModel().getColumn( + column_index); + tableColumn01.setCellEditor(roleTableCellEditor01); + // System.out.println("lov====>" + column_index); + } + + // ʱ + private void setDateValue(Date selecttime) { + // TODO Auto-generated method stub + if (getdate != null) { + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + table.setValueAt(formatter.format(getdate), table.getSelectedRow(), + 6); + } + } + + // ʱ2 + private void setDateValue2(Date selecttime) { + // TODO Auto-generated method stub + if (getdate2 != null) { + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + table.setValueAt(formatter.format(getdate2), + table.getSelectedRow(), 11); + } + } +} diff --git a/src/com/teamcenter/rac/form/JK8_JSPSFormStyleSheet.java b/src/com/teamcenter/rac/form/JK8_JSPSFormStyleSheet.java new file mode 100644 index 0000000..fa0aa7f --- /dev/null +++ b/src/com/teamcenter/rac/form/JK8_JSPSFormStyleSheet.java @@ -0,0 +1,1246 @@ +package com.teamcenter.rac.form; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Font; +import java.awt.Toolkit; +import java.awt.datatransfer.StringSelection; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.swing.JButton; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JMenu; +import javax.swing.JMenuItem; +import javax.swing.JPanel; +import javax.swing.JPopupMenu; +import javax.swing.JScrollPane; +import javax.swing.JTabbedPane; +import javax.swing.JTable; +import javax.swing.JTextArea; +import javax.swing.ListSelectionModel; +import javax.swing.event.MouseInputListener; +import javax.swing.table.DefaultTableModel; +import javax.swing.table.TableCellRenderer; + +import com.connor.jk.plm.form.BOM; +import com.connor.jk.plm.form.BZGXBean; +import com.connor.jk.plm.form.BomStructBean; +import com.connor.jk.plm.form.BomStructTree; +import com.connor.jk.plm.form.HX3_GYLXRevisionFormPropBean; +import com.connor.jk.plm.util.JkomMethodUtil; +import com.teamcenter.rac.aif.kernel.AIFComponentContext; +import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentBOMLine; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCComponentItem; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +import com.teamcenter.rac.kernel.TCComponentType; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.stylesheet.AbstractRendering; +import com.teamcenter.rac.util.ButtonLayout; +import com.teamcenter.rac.util.MessageBox; + +public class JK8_JSPSFormStyleSheet extends AbstractRendering implements + ActionListener { + private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + private final String HX_BZGX_Option_Name = "HX_BZGX_Option_Name"; + private String titleName ; + + private JPanel rootPanel; + private JPanel topPanel; + private JPanel buttomPanel; + private JScrollPane scrollPanel; + private JLabel emptyLable; + private JButton addButton; + private JButton insertButton; + private JButton delButton; + + private JTable partsTable; + public boolean isRefresh; + public boolean over; + private List valueLists; + private HashMap> bzgxMap;//׼ + private DefaultTableModel dtm; + private TCComponent formComp; + + private TCProperty[] propertiesArray; + private BomStructTree bomJTree; + private BomStructBean firstBean; + private HX3_GYLXRevisionFormPropBean selectTableBean; + private BOM bomMsg; + +// private String[] BZGX_LIST = { // +// "hx3_gzbz", // ׼ +// "hx3_gxsm",// ˵ +// "hx3_gzzx",// , +// "hx3_dcgx1",// 幤 bool +// "hx3_bgd1",// bool +// "hx3_wwgx1",// ί⹤ bool +// "hx3_jfd1",// Ʒѵ bool +// "hx3_jhwwgx1"// ƻί⹤ bool +// }; + private String[] BZGX_LIST = { // + "creation_date", // ׼ + "object_name",// ˵ + "current_name",// , + "owning_user",// 幤 bool + "owning_group"// bool + }; + private Object[] titleNames = { // + "к", "׼", "˵", "", "",// 5 + "ģ߱", "幤", "", "ί⹤", "Ʒѵ",// 10 + "ƻί⹤", "Ч", "ʧЧ", "ļ", "ļ汾", // 15 + "" // 17 + }; + public static final String[] TM2_PROCESS_PROP_NAMES = {// + "hx3_gxhh", "hx3_gxbz", "hx3_gxsm", "hx3_gzzx", + "hx3_gzzxmc", // 5 + "hx3_mjbh", "hx3_dcgx1", "hx3_bgd1", "hx3_wwgx1", + "hx3_jfd1", // 10 + "hx3_jhwwgx1", "hx3_sxrq", "hx3_shixrq", "hx3_gywjbh", + "hx3_gywjbb",// 15 + "hx3_lywl"// 17 + }; + + // =========================== + + public JK8_JSPSFormStyleSheet(TCComponent arg0) throws Exception { + super(arg0); + this.formComp = arg0; + getTitle(); + this.isRefresh = false; + this.over = false; + loadRendering(); + if (firstBean == null) { + getFormMsg(); + bomJTree = new BomStructTree(firstBean, this); + } + new Thread() { + + @Override + public void run() { + // TODO Auto-generated method stub + // super.run(); + while (!over) { + try { + new Thread().sleep(1000); + if (selectTableBean != null) { + + int index = valueLists.indexOf(selectTableBean); + + if(index !=-1){ + ((DefaultTableModel) partsTable.getModel()) + .setValueAt(selectTableBean.hx3_lywl, + index, 15); + } + + } + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + }catch(Exception e){ + e.printStackTrace(); + } + } + } + + }.start(); + } + + public void getTitle(){ + try { + TCComponentItemRevision tempRev = (TCComponentItemRevision) formComp + .getReferenceProperty("item_revision"); + if(tempRev == null){ + return; + } + TCComponentItem item = tempRev.getItem(); + if(item == null){ + return; + } + AIFComponentContext[] contextS = item.whereReferencedByTypeRelation(new String[]{"HX3_WLRevision"},new String[]{ "HX3_GYLXRelation"}); + System.out.println("count = "+contextS.length); + if(contextS!=null && contextS.length>0){ + titleName =((TCComponentItemRevision) contextS[0].getComponent()).getStringProperty("object_string")+"·ͼ"; + } + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + + public void getBZGXList() { + try { + bzgxMap = new HashMap<>(); + String puid = JkomMethodUtil.getPrefStr(HX_BZGX_Option_Name); + TCSession session = (TCSession) AIFUtility.getCurrentApplication() + .getSession(); + + TCComponentForm form = (TCComponentForm) session + .stringToComponent(puid); + TCProperty[] propS = form.getTCProperties(BZGX_LIST); + if (propS != null) { + if (propS[0] != null && propS[1] != null && propS[2] != null + && propS[3] != null && propS[4] != null + && propS[5] != null && propS[6] != null + && propS[7] != null) { + if (propS[0].getStringArrayValue().length == propS[1] + .getStringArrayValue().length + && propS[0].getStringArrayValue().length == propS[2] + .getStringArrayValue().length + && propS[0].getStringArrayValue().length == propS[3] + .getLogicalValueArray().length + && propS[0].getStringArrayValue().length == propS[4] + .getLogicalValueArray().length + && propS[0].getStringArrayValue().length == propS[5] + .getLogicalValueArray().length + && propS[0].getStringArrayValue().length == propS[6] + .getLogicalValueArray().length + && propS[0].getStringArrayValue().length == propS[7] + .getLogicalValueArray().length) { + for (int i = 0; i < propS[0].getStringArrayValue().length; i++) { + BZGXBean bean = new BZGXBean(); + bean.hx3_gxbz = propS[0].getStringArrayValue()[i]; // ׼ + bean.hx3_gxsm = propS[1].getStringArrayValue()[i];// ˵ + bean.hx3_gzzx = propS[2].getStringArrayValue()[i];// , + bean.hx3_gzzxmc = propS[2].getDisplayableValues() + .get(i);// + bean.hx3_dcgx1 = propS[3].getLogicalValueArray()[i];// 幤 + bean.hx3_bgd1 = propS[4].getLogicalValueArray()[i];// + bean.hx3_wwgx1 = propS[5].getLogicalValueArray()[i];// ί⹤ + bean.hx3_jfd1 = propS[6].getLogicalValueArray()[i];// Ʒѵ + bean.hx3_jhwwgx1 = propS[7].getLogicalValueArray()[i];// ƻί⹤ + if (!bzgxMap.containsKey(bean.hx3_gxbz)) { + System.out.println("׼ =>" + bean.hx3_gxbz); + List bzgxBeanList = new ArrayList<>(); + bzgxBeanList.add(bean); + bzgxMap.put(bean.hx3_gxsm, bzgxBeanList); + }else{ + List bzgxBeanList = bzgxMap.get(bean.hx3_gxbz); + bzgxBeanList.add(bean); + } + } + + } else { + System.out.println("׼ijȲͬ"); + } + + } else { + System.out.println("ȡ׼ִ"); + } + + } + + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + + /** + * ͨFormϹϢ + * + * @throws TCException + */ + public void getFormMsg() throws TCException { + getBZGXList(); + TCComponentItemRevision rev = (TCComponentItemRevision) formComp + .getReferenceProperty("item_revision");// ȡڵİ汾 + if (rev == null) { + System.out.println("ûҵ汾"); + return; + } + TCComponentItem item = rev.getItem(); + if (item == null) { + System.out.println("ûҵ"); + return; + } + AIFComponentContext[] aifContext = item.whereReferencedByTypeRelation( + new String[] { "HX3_WLRevision" }, + new String[] { "HX3_GYLXRelation" }); + if (aifContext == null || aifContext.length == 0 + || aifContext.length > 1) { + System.out.println("ǰ·߹˶ϰ汾"); + } + firstBean = new BomStructBean(); + TCComponentBOMLine topLine = null; + if(aifContext != null && aifContext.length>0){ + TCComponentItemRevision wlRev = ((TCComponentItemRevision) aifContext[0] + .getComponent()); + bomMsg = JkomMethodUtil.getTopLineByRev2(wlRev); + topLine = bomMsg.line; + } + if (topLine == null) { + System.out.println("ǰûBOMϢ"); + return; + + } + exchangeLineToBean(firstBean, topLine); + + } + + /** + * FORMʱȡ + */ + public void getFormVlue() { + + this.valueLists = new ArrayList<>(); + try { + + // ȡֵ + propertiesArray = formComp.getTCProperties(TM2_PROCESS_PROP_NAMES); + // дֵԵ + if (propertiesArray != null) { + String[] valueStrs0 = propertiesArray[0] == null ? new String[0] + : propertiesArray[0].getStringArrayValue(); + String[] valueStrs1 = propertiesArray[1] == null ? new String[0] + : propertiesArray[1].getStringArrayValue(); + String[] valueStrs2 = propertiesArray[2] == null ? new String[0] + : propertiesArray[2].getStringArrayValue(); + String[] valueStrs3 = propertiesArray[3] == null ? new String[0] + : propertiesArray[3].getStringArrayValue(); + String[] valueStrs4 = propertiesArray[4] == null ? new String[0] + : propertiesArray[4].getStringArrayValue(); + String[] valueStrs5 = propertiesArray[5] == null ? new String[0] + : propertiesArray[5].getStringArrayValue(); + boolean[] valueStrs6 = propertiesArray[6] == null ? new boolean[0] + : propertiesArray[6].getBoolArrayValue(); + boolean[] valueStrs7 = propertiesArray[7] == null ? new boolean[0] + : propertiesArray[7].getBoolArrayValue(); + boolean[] valueStrs8 = propertiesArray[8] == null ? new boolean[0] + : propertiesArray[8].getBoolArrayValue(); + boolean[] valueStrs9 = propertiesArray[9] == null ? new boolean[0] + : propertiesArray[9].getBoolArrayValue(); + boolean[] valueStrs10 = propertiesArray[10] == null ? new boolean[0] + : propertiesArray[10].getBoolArrayValue(); + Date[] valueStrs11 = propertiesArray[11] == null ? new Date[0] + : propertiesArray[11].getDateValueArray();// Date + Date[] valueStrs12 = propertiesArray[12] == null ? new Date[0] + : propertiesArray[12].getDateValueArray();// Date + String[] valueStrs13 = propertiesArray[13] == null ? new String[0] + : propertiesArray[13].getStringArrayValue(); + String[] valueStrs14 = propertiesArray[14] == null ? new String[0] + : propertiesArray[14].getStringArrayValue(); + String[] valueStrs15 = propertiesArray[15] == null ? new String[0] + : propertiesArray[15].getStringArrayValue();// TypedReference + + if (valueStrs0.length == valueStrs1.length + && valueStrs0.length == valueStrs2.length + && valueStrs0.length == valueStrs3.length + && valueStrs0.length == valueStrs4.length + && valueStrs0.length == valueStrs5.length + && valueStrs0.length == valueStrs6.length + && valueStrs0.length == valueStrs7.length + && valueStrs0.length == valueStrs8.length + && valueStrs0.length == valueStrs9.length + && valueStrs0.length == valueStrs10.length + && valueStrs0.length == valueStrs11.length + && valueStrs0.length == valueStrs12.length + && valueStrs0.length == valueStrs13.length + && valueStrs0.length == valueStrs14.length + && valueStrs0.length == valueStrs15.length + + && valueStrs0.length != 0) { + for (int i = 0; i < valueStrs0.length; i++) { + HX3_GYLXRevisionFormPropBean bean = new HX3_GYLXRevisionFormPropBean(); + bean.hx3_gxhh = valueStrs0[i];// "к", + + bean.hx3_bzgx = valueStrs1[i];// "׼", + bean.hx3_gxsm = valueStrs2[i];// "˵", + bean.hx3_gzzx = valueStrs3[i];// "", + bean.hx3_gzzxmc = valueStrs4[i];// "",// 5 + bean.hx3_mjbh = valueStrs5[i];// "ģ߱", + bean.hx3_dcgx1 = valueStrs6[i];// "幤", + bean.hx3_bgd1 = valueStrs7[i];// "", + bean.hx3_wwgx1 = valueStrs8[i];// "ί⹤", + bean.hx3_jfd1 = valueStrs9[i];// "Ʒѵ",// 10 + bean.hx3_jhwwgx1 = valueStrs10[i];// "ƻί⹤", + + bean.hx3_sxrq = valueStrs11[i];// "Ч", + bean.hx3_shixrq = valueStrs12[i];// "ʧЧ", + bean.hx3_gywjbh = valueStrs13[i];// "ļ", + bean.hx3_gywjbb = valueStrs14[i];// "ļ汾", // 15 + bean.hx3_lywl = valueStrs15[i];// "", + + this.valueLists.add(bean); + + + } + } + } + Collections.sort(this.valueLists); + } catch (TCException e) { + e.printStackTrace(); + } + + } + + /** + * + */ + public void saveWLProps() { + if (valueLists == null) { + System.out.println("бΪ"); + return; + } + Collections.sort(this.valueLists); + // List gxbbList = new ArrayList<>(); + // for (int i = 0; i < valueLists.size(); i++) { + // HX3_GYLXRevisionFormPropBean bean = valueLists.get(i); + // + // } + try { + JkomMethodUtil.setByPass(true); + } catch (TCException e2) { + // TODO Auto-generated catch block + e2.printStackTrace(); + } + String[] valueStrs0 = new String[valueLists.size()]; + String[] valueStrs1 = new String[valueLists.size()]; + String[] valueStrs2 = new String[valueLists.size()]; + String[] valueStrs3 = new String[valueLists.size()]; + String[] valueStrs4 = new String[valueLists.size()]; + String[] valueStrs5 = new String[valueLists.size()]; + + boolean[] valueStrs6 = new boolean[valueLists.size()]; + boolean[] valueStrs7 = new boolean[valueLists.size()]; + boolean[] valueStrs8 = new boolean[valueLists.size()]; + boolean[] valueStrs9 = new boolean[valueLists.size()]; + boolean[] valueStrs10 = new boolean[valueLists.size()]; + Date[] valueStrs11 = new Date[valueLists.size()]; + Date[] valueStrs12 = new Date[valueLists.size()]; + String[] valueStrs13 = new String[valueLists.size()]; + String[] valueStrs14 = new String[valueLists.size()]; + String[] valueStrs15 = new String[valueLists.size()]; + + for (int i = 0; i < valueLists.size(); i++) { + HX3_GYLXRevisionFormPropBean bean = valueLists.get(i); + valueStrs0[i] = bean.hx3_gxhh == null ? "" : bean.hx3_gxhh; + valueStrs1[i] = bean.hx3_bzgx == null ? "" : bean.hx3_bzgx; + valueStrs2[i] = bean.hx3_gxsm == null ? "" : bean.hx3_gxsm; + valueStrs3[i] = bean.hx3_gzzx == null ? "" : bean.hx3_gzzx; + valueStrs4[i] = bean.hx3_gzzxmc == null ? "" : bean.hx3_gzzxmc; + valueStrs5[i] = bean.hx3_mjbh == null ? "" : bean.hx3_mjbh; + valueStrs6[i] = bean.hx3_dcgx1; + valueStrs7[i] = bean.hx3_bgd1; + valueStrs8[i] = bean.hx3_wwgx1; + valueStrs9[i] = bean.hx3_jfd1; + valueStrs10[i] = bean.hx3_jhwwgx1; + valueStrs11[i] = bean.hx3_sxrq; + valueStrs12[i] = bean.hx3_shixrq; + valueStrs13[i] = bean.hx3_gywjbh == null ? "" : bean.hx3_gywjbh; + valueStrs14[i] = bean.hx3_gywjbb == null ? "" : bean.hx3_gywjbb; + valueStrs15[i] = bean.hx3_lywl == null ? "" : bean.hx3_lywl; + } + try { + if (propertiesArray[0] != null) + propertiesArray[0].setStringValueArray(valueStrs0); + if (propertiesArray[1] != null) + propertiesArray[1].setStringValueArray(valueStrs1); + if (propertiesArray[2] != null) + propertiesArray[2].setStringValueArray(valueStrs2); + if (propertiesArray[3] != null) + propertiesArray[3].setStringValueArray(valueStrs3); + if (propertiesArray[4] != null) + propertiesArray[4].setStringValueArray(valueStrs4); + if (propertiesArray[5] != null) + propertiesArray[5].setStringValueArray(valueStrs5); + if (propertiesArray[6] != null) + propertiesArray[6].setLogicalValueArray(valueStrs6); + if (propertiesArray[7] != null) + propertiesArray[7].setLogicalValueArray(valueStrs7); + if (propertiesArray[8] != null) + propertiesArray[8].setLogicalValueArray(valueStrs8); + if (propertiesArray[9] != null) + propertiesArray[9].setLogicalValueArray(valueStrs9); + if (propertiesArray[10] != null) + propertiesArray[10].setLogicalValueArray(valueStrs10); + if (propertiesArray[11] != null) + propertiesArray[11].setDateValueArray(valueStrs11); + if (propertiesArray[12] != null) + propertiesArray[12].setDateValueArray(valueStrs12); + if (propertiesArray[13] != null) + propertiesArray[13].setStringValueArray(valueStrs13); + if (propertiesArray[14] != null) + propertiesArray[14].setStringValueArray(valueStrs14); + if (propertiesArray[15] != null) + propertiesArray[15].setStringValueArray(valueStrs15); + + formComp.setTCProperties(propertiesArray); + + List lineList = new ArrayList<>(); + List propList = new ArrayList<>(); + + if (this.firstBean != null) { + + if (this.firstBean.getChlidLineS() != null) { + + for (BomStructBean structBean : this.firstBean + .getChlidLineS()) { + setBomlineProp(structBean, lineList, propList); + } + } + + TCProperty[][] props = new TCProperty[propList.size()][1]; + + for (int j = 0; j < propList.size(); j++) { + props[j][0] = propList.get(j); + } + + if (bomMsg.window != null) { + bomMsg.window.lock(); + TCComponentType.setPropertiesSet( + lineList.toArray(new TCComponent[lineList.size()]), + props); + bomMsg.window.save(); + bomMsg.window.unlock(); + bomMsg.window.close(); + + } + + } + + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (Exception e1) { + e1.printStackTrace(); + } + try { + JkomMethodUtil.setByPass(false); + } catch (TCException e2) { + // TODO Auto-generated catch block + e2.printStackTrace(); + } + } + + /** + * + * @param bean + * @throws TCException + */ + public void setBomlineProp(BomStructBean bean, List lineList, + List propList) throws TCException { + + if (bean == null) { + return; + } + lineList.add(bean.getBomLine()); + TCProperty prop = bean.getBomLine().getTCProperty("HX3_gxhh"); + prop.setStringValue(bean.getGxh()); + // bean.getBomLine().lock(); + // bean.getBomLine().setTCProperty(prop); + // bean.getBomLine().save(); + // bean.getBomLine().unlock(); + propList.add(prop); + + if (bean.getChlidLineS() != null && bean.getChlidLineS().size() > 0) { + for (BomStructBean child : bean.getChlidLineS()) { + setBomlineProp(child, lineList, propList); + } + } + + } + + /** + * ǩ벢 + */ + @Override + public boolean checkForSave(Object obj) { + // TODO Auto-generated method stub + over = true; + saveWLProps(); + + System.out.println("ǩ벢"); + return super.checkForSave(obj); + } + + /** + * + */ + @Override + public void save() { + // TODO Auto-generated method stub + over = true; + saveWLProps(); + + System.out.println(""); + super.save(); + } + + public void init() { + System.out.println("====>>>> ʼ <1>"); + // clorMap = new HashMap(); + // fontMap = new HashMap(); + valueLists = new ArrayList(); + getFormVlue(); + this.setLayout(new BorderLayout()); + this.setBackground(Color.WHITE); + rootPanel = new JPanel(new BorderLayout()); + addButton = new JButton(""); + + addButton.setEnabled(true); + insertButton = new JButton(""); + insertButton.setEnabled(true); + delButton = new JButton("ɾ"); + delButton.setEnabled(true); + emptyLable = new JLabel(" "); + + addButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + addRow(e); + } + }); + + insertButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + insertRow(e); + } + }); + + delButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + delRow(e); + } + }); + // TODO Table + this.partsTable = getjTable(partsTable, this.dtm, this.titleNames, + getValues(valueLists)); + final MouseInputListener mouseInputListener = getMouseInputListener(partsTable);// Ҽѡ + + partsTable.addMouseListener(mouseInputListener); + + this.topPanel = new JPanel(new BorderLayout()); + scrollPanel = new JScrollPane(); + scrollPanel.getViewport().add(partsTable, null); + scrollPanel.validate(); + + this.topPanel.add(BorderLayout.CENTER, scrollPanel); + + this.buttomPanel = new JPanel(new ButtonLayout(ButtonLayout.VERTICAL)); + this.buttomPanel.add(addButton); + this.buttomPanel.add(new JLabel(" ")); + this.buttomPanel.add(insertButton); + this.buttomPanel.add(emptyLable); + this.buttomPanel.add(delButton); + + this.rootPanel = new JPanel(new BorderLayout()); + this.rootPanel.add(BorderLayout.CENTER, topPanel); + // this.rootPanel.add(BorderLayout.SOUTH, buttomPanel); + + JTabbedPane tabPane = new JTabbedPane(); + + + String title = "·Ϣ"; + if(titleName!=null) + { + title = titleName; + } + tabPane.add(title, new JScrollPane(rootPanel)); + + this.setLayout(new BorderLayout()); + this.add(buttomPanel, BorderLayout.EAST); + this.add(tabPane, BorderLayout.CENTER); + } + + private void addRow(ActionEvent e) { + + HX3_GYLXRevisionFormPropBean bean = new HX3_GYLXRevisionFormPropBean(); + try { + bean.hx3_sxrq = sdf.parse("2000-01-01"); + bean.hx3_shixrq = sdf.parse("2099-12-31"); + } catch (ParseException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + + Object[] objs = new Object[] { bean.hx3_gxhh, bean.hx3_bzgx, + bean.hx3_gxsm, bean.hx3_gzzx, bean.hx3_gzzxmc, bean.hx3_mjbh, + bean.hx3_dcgx1, bean.hx3_bgd1, bean.hx3_wwgx1, bean.hx3_jfd1, + bean.hx3_jhwwgx1, sdf.format(bean.hx3_sxrq), + sdf.format(bean.hx3_shixrq), bean.hx3_gywjbh, bean.hx3_gywjbb, + bean.hx3_lywl }; + + valueLists.add(bean); + ((DefaultTableModel) this.partsTable.getModel()).addRow(objs); + + ((DefaultTableModel) this.partsTable.getModel()) + .fireTableStructureChanged(); + ((DefaultTableModel) this.partsTable.getModel()).fireTableDataChanged(); + scrollPanel.validate(); + + } + + private void insertRow(ActionEvent e) { + int index = partsTable.getSelectedRow(); + if (partsTable.getRowCount() == 0) { + index = 0; + } + // if (index == -1) { + // MessageBox.post("ѡִɾ", "Warning", MessageBox.WARNING); + // return; + // } + HX3_GYLXRevisionFormPropBean bean = new HX3_GYLXRevisionFormPropBean(); + try { + bean.hx3_sxrq = sdf.parse("2000-01-01"); + bean.hx3_shixrq = sdf.parse("2099-12-31"); + } catch (ParseException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + + Object[] objs = new Object[] { bean.hx3_gxhh, bean.hx3_bzgx, + bean.hx3_gxsm, bean.hx3_gzzx, bean.hx3_gzzxmc, bean.hx3_mjbh, + bean.hx3_dcgx1, bean.hx3_bgd1, bean.hx3_wwgx1, bean.hx3_jfd1, + bean.hx3_jhwwgx1, sdf.format(bean.hx3_sxrq), + sdf.format(bean.hx3_shixrq), bean.hx3_gywjbh, bean.hx3_gywjbb, + bean.hx3_lywl }; + if (index != -1) { + valueLists.add(index, bean); + ((DefaultTableModel) this.partsTable.getModel()).insertRow(index, + objs); + } else { + valueLists.add(bean); + ((DefaultTableModel) this.partsTable.getModel()).addRow(objs); + } + + ((DefaultTableModel) this.partsTable.getModel()) + .fireTableStructureChanged(); + ((DefaultTableModel) this.partsTable.getModel()).fireTableDataChanged(); + scrollPanel.validate(); + } + + private void delRow(ActionEvent e) { + int index = partsTable.getSelectedRow(); + if (index == -1) { + MessageBox.post("ѡִɾ", "", MessageBox.WARNING); + return; + } + if(valueLists.get(index).hx3_lywl!=null){ + if(!valueLists.get(index).hx3_lywl.trim().isEmpty()){ + MessageBox.post("ƳϺִɾ", "", MessageBox.WARNING); + return; + } + } + valueLists.remove(index); + ((DefaultTableModel) this.partsTable.getModel()).removeRow(index); + ((DefaultTableModel) this.partsTable.getModel()) + .fireTableStructureChanged(); + ((DefaultTableModel) this.partsTable.getModel()).fireTableDataChanged(); + scrollPanel.validate(); + } + + /***************************************************/ + + /** + * JTABLEͨ÷ + * + * @param partsTable + * @param titleNames + * @return + */ + public JTable getjTable(JTable partsTable, DefaultTableModel dtm, + Object[] titleNames, Object[][] values) { + int simpleLen = 72; + int totleLen = 900; + if (partsTable == null) { + //partsTable.isCellEditable(arg0, arg1) + + partsTable = new JTable(getTableModel(dtm, titleNames, values)) { + @Override + public boolean isCellEditable(int row, int column) { + + if (column == 15|| column == 1|| (column >2 && column < 5) + || (column > 5 && column < 13)){ + return false; + }else if(column == 0){ + if(valueLists.get(row).hx3_lywl ==null || valueLists.get(row).hx3_lywl.trim().isEmpty()){ + return true; + } + return false; + } + else{ + + + + return true; + } + } + + }; + + partsTable.setDefaultRenderer(Object.class, + new TableCellTextAreaRenderer()); + + partsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + + if (simpleLen * titleNames.length >= totleLen) { + for (int i = 0; i < titleNames.length; i++) { + partsTable.getColumnModel().getColumn(i) + .setPreferredWidth(72); + } + partsTable.setAutoResizeMode(0); + + } else { + // System.out.println("auto size"); + partsTable.setAutoResizeMode(1); + } + + } + return partsTable; + } + + public DefaultTableModel getTableModel(DefaultTableModel dtm, + Object[] columNameObjects, Object[][] objects) { + // Object[] columNameObjects = this.titleNames; //// , + // Object[][] objects = getValues(this.valueLists); + if (dtm == null) { + dtm = new DefaultTableModel(objects, columNameObjects); + } + return dtm; + } + + public Object[][] getValues(List beanList) { + Object[][] objects = new Object[beanList.size()][HX3_GYLXRevisionFormPropBean.COUNT]; + + for (int i = 0; i < beanList.size(); i++) { + // objects[i][0] =beanList.get(i).getIndex(); + objects[i][0] = beanList.get(i).hx3_gxhh;// "к", + + objects[i][1] = beanList.get(i).hx3_bzgx;// "׼", + objects[i][2] = beanList.get(i).hx3_gxsm;// "˵", + objects[i][3] = beanList.get(i).hx3_gzzx;// "", + objects[i][4] = beanList.get(i).hx3_gzzxmc;// "",// 5 + objects[i][5] = beanList.get(i).hx3_mjbh;// "ģ߱", + objects[i][6] = beanList.get(i).hx3_dcgx1;// "幤", + objects[i][7] = beanList.get(i).hx3_bgd1;// "", + objects[i][8] = beanList.get(i).hx3_wwgx1;// "ί⹤", + objects[i][9] = beanList.get(i).hx3_jfd1;// "Ʒѵ",// 10 + objects[i][10] = beanList.get(i).hx3_jhwwgx1;// "ƻί⹤", + objects[i][11] = sdf.format(beanList.get(i).hx3_sxrq);// "Ч", + objects[i][12] = sdf.format(beanList.get(i).hx3_shixrq);// "ʧЧ", + objects[i][13] = beanList.get(i).hx3_gywjbh;// "ļ", + objects[i][14] = beanList.get(i).hx3_gywjbb;// "ļ汾", // 15 + objects[i][15] = beanList.get(i).hx3_lywl;// "", + // objects[i][16] = beanList.get(i).hx3_lywlid; + } + return objects; + } + + public void setClipboard(String str) { + StringSelection ss = new StringSelection(str); + Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null); + } + + /**************************************************/ + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void loadRendering() throws TCException { + // TODO Auto-generated method stub + init(); + } + + @Override + public void saveRendering() { + // TODO Auto-generated method stub + + } + + public static void main(String[] args) { + + } + + /** + * BOM + * + * @param bean + * @param line + * @throws TCException + */ + public void exchangeLineToBean(BomStructBean bean, TCComponentBOMLine line) + throws TCException { + if (line == null && bean != null) { + return; + } + bean.setBomLine(line); + List childBeanList = new ArrayList<>(); + + AIFComponentContext[] contextS = line.getChildren(); + if (contextS != null) { + for (AIFComponentContext context : contextS) { + BomStructBean childBean = new BomStructBean(); + TCComponentBOMLine childLine = (TCComponentBOMLine) context + .getComponent(); + // childBean.setBomLine(childLine); + childBeanList.add(childBean); + exchangeLineToBean(childBean, childLine); + } + } + bean.setChlidLineS(childBeanList); + + } + + /** + * + * ҼѡʾҼ˵ + */ + private MouseInputListener getMouseInputListener(final JComponent jTable) { + return new MouseInputListener() { + public void mouseClicked(MouseEvent e) { + processEvent(e); + System.out.println(" =>>>> mouseClicked"); + } + + public void mousePressed(MouseEvent e) { + processEvent(e); + System.out.println(" =>>>> mousePressed"); + } + + public void mouseReleased(MouseEvent e) { + processEvent(e); + System.out.println(" =>>> mouseReleased"); + System.out + .println(" jTable.isEnabled() =" + jTable.isEnabled()); + if (!jTable.isEnabled()) { + System.out.println("ؼʹ"); + return; + } + if ((e.getModifiers() & MouseEvent.BUTTON3_MASK) != 0 + && !e.isControlDown() && !e.isShiftDown()) { + // popupMenu.show(tableLyz, e.getX(), e.getY());//Ҽ˵ʾ + JMenu a = new JMenu(""); + JMenuItem c = new JMenuItem(""); + c.addMouseListener(new MouseListener() { + @Override + public void mouseReleased(MouseEvent arg0) { + + } + + @Override + public void mousePressed(MouseEvent arg0) { + System.out.println("++++++++++++++"); + // new Thread(bomJTree).start(); + selectTableBean = valueLists.get(((JTable) jTable) + .getSelectedRow()); + if (selectTableBean.hx3_gxhh == null + || selectTableBean.hx3_gxhh.trim() + .isEmpty()) { + MessageBox.post("кΪգдк֮", "", + MessageBox.WARNING); + } else { + bomJTree.showDialog(valueLists + .get(((JTable) jTable).getSelectedRow())); + } + + } + + @Override + public void mouseExited(MouseEvent arg0) { + // TODO Auto-generated method stub + // System.out.println("3333333333"); + } + + @Override + public void mouseEntered(MouseEvent arg0) { + // TODO Auto-generated method stub + // System.out.println("2222222222"); + } + + @Override + public void mouseClicked(MouseEvent arg0) { + // TODO Auto-generated method stub + // System.out.println("1111111111"); + } + }); + //JMenuItem d = new JMenuItem("Ƴ"); + + a.add(c); + //a.add(d); + JPopupMenu b = new JPopupMenu(); + b = a.getPopupMenu(); + b.show(jTable, e.getX(), e.getY()); + + } + + } + + public void mouseEntered(MouseEvent e) { + + processEvent(e); + + } + + public void mouseExited(MouseEvent e) { + + processEvent(e); + + } + + public void mouseDragged(MouseEvent e) { + + processEvent(e); + + } + + public void mouseMoved(MouseEvent e) { + + processEvent(e); + + } + + private void processEvent(MouseEvent e) { + + if ((e.getModifiers() & MouseEvent.BUTTON3_MASK) != 0) { + + int modifiers = e.getModifiers(); + + modifiers -= MouseEvent.BUTTON3_MASK; + + modifiers |= MouseEvent.BUTTON1_MASK; + + MouseEvent ne = new MouseEvent(e.getComponent(), e.getID(), + + e.getWhen(), modifiers, e.getX(), e.getY(), e + + .getClickCount(), false); + + jTable.dispatchEvent(ne); + } + } + }; + } + + class TableCellTextAreaRenderer extends JTextArea implements + TableCellRenderer { + private BZGXBean bean = null; + + public TableCellTextAreaRenderer() { + setLineWrap(true); + setWrapStyleWord(true); + } + + public Component getTableCellRendererComponent(JTable table, + Object value, boolean isSelected, boolean hasFocus, int row, + int column) { + + // 㵱еѸ߶ + int maxPreferredHeight = 0; + for (int i = 0; i < table.getColumnCount(); i++) { + setText("" + table.getValueAt(row, i)); + setSize(table.getColumnModel().getColumn(column).getWidth(), 0); + maxPreferredHeight = Math.max(maxPreferredHeight, + getPreferredSize().height); + } + + if (table.getRowHeight(row) != maxPreferredHeight) // Ϲæ + table.setRowHeight(row, maxPreferredHeight); + + setText(value == null ? "" : value.toString()); + // table.setSelectionBackground(Color.yellow); + Font fp = new Font("Menu.font", Font.PLAIN, 14); + Font fb = new Font("Menu.font", Font.BOLD, 14); + if (isSelected) { + this.setFont(fb); + + } else { + this.setFont(fp); + } + + if (isSelected + && hasFocus + && row == table.getSelectedRow() + && column == table.getSelectedColumn() + && !((column ==1)||(column > 2 && column < 5) || (column > 5 && column < 11))) { + + bean = null; + System.out.println(" => " + table.getValueAt(row, 2)); + if (bzgxMap.containsKey(table.getValueAt(row, 2))) { + bean = bzgxMap.get(table.getValueAt(row, 2)).get(0); + + System.out.println("contains "); + } else { + System.out.println("not contains "); + } + switch (column) { + case 0: + valueLists.get(row).hx3_gxhh = value == null ? "" : value + .toString(); + break; + case 2: + if (bean == null) { + + valueLists.get(row).hx3_bzgx = ""; + table.setValueAt("", row, 1); + valueLists.get(row).hx3_gzzx = ""; + table.setValueAt("", row, 3); + valueLists.get(row).hx3_gzzxmc = ""; + table.setValueAt("", row, 4); + valueLists.get(row).hx3_dcgx1 = false; + table.setValueAt(false, row, 6); + valueLists.get(row).hx3_bgd1 = false; + table.setValueAt(false, row, 7); + valueLists.get(row).hx3_wwgx1 = false; + table.setValueAt(false, row, 8); + valueLists.get(row).hx3_jfd1 = false; + table.setValueAt(false, row, 9); + valueLists.get(row).hx3_jhwwgx1 = false; + table.setValueAt(false, row, 10); + valueLists.get(row).hx3_gxsm = value == null ? "" + : value.toString(); + } else { + valueLists.get(row).hx3_bzgx = bean.hx3_gxbz; + table.setValueAt(bean.hx3_gxbz, row, 1); + valueLists.get(row).hx3_gzzx = bean.hx3_gzzx; + table.setValueAt(bean.hx3_gzzx, row, 3); + valueLists.get(row).hx3_gzzxmc = bean.hx3_gzzxmc; + table.setValueAt(bean.hx3_gzzxmc, row, 4); + valueLists.get(row).hx3_dcgx1 = bean.hx3_dcgx1; + table.setValueAt(bean.hx3_dcgx1, row, 6); + valueLists.get(row).hx3_bgd1 = bean.hx3_bgd1; + table.setValueAt(bean.hx3_bgd1, row, 7); + valueLists.get(row).hx3_wwgx1 = bean.hx3_wwgx1; + table.setValueAt(bean.hx3_wwgx1, row, 8); + valueLists.get(row).hx3_jfd1 = bean.hx3_jfd1; + table.setValueAt(bean.hx3_jfd1, row, 9); + valueLists.get(row).hx3_jhwwgx1 = bean.hx3_jhwwgx1; + table.setValueAt(bean.hx3_jhwwgx1, row, 10); + valueLists.get(row).hx3_gxsm = (String) value; + } + + break; + + case 3: + // if (bean != null) { + // value = bean.hx3_gzzx; + // } else { + // value = ""; + // } + // + // valueLists.get(row).hx3_gzzx = value == null ? "" : value + // .toString(); + break; + case 4: + // if (bean != null) { + // value = bean.hx3_gzzxmc; + // } else { + // value = ""; + // } + // valueLists.get(row).hx3_gzzxmc = value == null ? "" : + // value + // .toString(); + break; + case 5: + + valueLists.get(row).hx3_mjbh = value == null ? "" : value + .toString(); + break; + case 6: + // if (bean != null) { + // value = bean.hx3_dcgx1; + // } else { + // value = false; + // } + // valueLists.get(row).hx3_dcgx1 = (boolean) value; + break; + case 7: + // if (bean != null) { + // value = bean.hx3_bgd1; + // } else { + // value = false; + // } + // valueLists.get(row).hx3_bgd1 = (boolean) value; + + break; + case 8: + // if (bean != null) { + // value = bean.hx3_wwgx1; + // } else { + // value = false; + // } + // valueLists.get(row).hx3_wwgx1 = (boolean) value; + + break; + case 9: + // if (bean != null) { + // value = bean.hx3_jfd1; + // } else { + // value = false; + // } + // valueLists.get(row).hx3_jfd1 = (boolean) value; + + break; + case 10: + // if (bean != null) { + // value = bean.hx3_jhwwgx1; + // } else { + // value = false; + // } + // valueLists.get(row).hx3_jhwwgx1 = (boolean) value; + + break; + + case 13: + valueLists.get(row).hx3_gywjbh = value == null ? "" : value + .toString(); + break; + case 14: + valueLists.get(row).hx3_gywjbb = value == null ? "" : value + .toString(); + break; + + default: + break; + + } + + // 2.õǰCellɫ + // Component c = super.getTableCellRendererComponent(table, + // value, + // isSelected, hasFocus, row, column); + this.setBackground(Color.yellow);// ñɫ + this.setForeground(Color.BLACK);// ǰɫ + return this; + } else { + + // 3.õУżеɫ + if (row % 2 == 0) {// żʱɫ + setBackground(Color.white); + } else if (row % 2 == 1) {// õеɫ + setBackground(Color.white); + } + if (isSelected) { + this.setBackground(Color.LIGHT_GRAY);// ñɫ + } + return this; + } + + // return this; + } + } + +} diff --git a/src/com/teamcenter/rac/form/JK8_JSPSPropBean.java b/src/com/teamcenter/rac/form/JK8_JSPSPropBean.java new file mode 100644 index 0000000..17ddaf5 --- /dev/null +++ b/src/com/teamcenter/rac/form/JK8_JSPSPropBean.java @@ -0,0 +1,44 @@ +package com.teamcenter.rac.form; + +import java.util.Date; + + +public class JK8_JSPSPropBean implements Comparable{ + +// public static final int COUNT = 8; + public static final int COUNT = 9; +// public String jk8_bh = "";// "", + public String jk8_psr = "";// "", + public String jk8_jd = "";// "", + public String jk8_tcrq = "";// "", + public String jk8_wtszwz = "";// "λ",// 5 + public String jk8_wtms = "";// "", + public String jk8_jy = "";// "", + public String jk8_cljg = "";// "", + public String jk8_zt = "";// "״̬", + @Override + public int compareTo(Object o) { + // TODO Auto-generated method stub + if(o ==null){ + return 0; + } + JK8_JSPSPropBean bean = (JK8_JSPSPropBean) o; + if(this.jk8_psr == null){ + if(bean.jk8_psr!=null){ + //111 + return "".compareTo(bean.jk8_psr); + }else{ + return 0; + } + }else{ + if(bean.jk8_psr!=null){ + //111 + return this.jk8_psr.compareTo(bean.jk8_psr); + }else{ + return this.jk8_psr.compareTo(""); + } + //return this.hx3_gxhh.compareTo(bean.hx3_gxhh); + } + } + +} diff --git a/src/com/teamcenter/rac/form/JK8_JSPS_Form.java b/src/com/teamcenter/rac/form/JK8_JSPS_Form.java new file mode 100644 index 0000000..cbcab9e --- /dev/null +++ b/src/com/teamcenter/rac/form/JK8_JSPS_Form.java @@ -0,0 +1,786 @@ +package com.teamcenter.rac.form; + +import java.awt.BorderLayout; +//import java.awt.Color; +//import java.awt.Component; +import java.awt.Dimension; +//import java.awt.Font; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.HashMap; +//import java.util.Date; +import java.util.List; +import java.util.Map; + +import javax.swing.CellEditor; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +//import javax.swing.JTabbedPane; +import javax.swing.JTable; +import javax.swing.table.DefaultTableCellRenderer; +//import javax.swing.JTextArea; +import javax.swing.table.DefaultTableModel; +//import javax.swing.table.TableCellRenderer; +import javax.swing.table.TableColumn; +import javax.swing.table.TableColumnModel; + +//import com.connor.jk.plm.form.BZGXBean; +//import com.connor.jk.plm.form.BomStructBean; +//import com.connor.jk.plm.form.HX3_GYLXRevisionFormPropBean; +import com.connor.jk.plm.util.JkomMethodUtil; +//import com.connor.jy.plm2.bom.dbom.TableComboxRender; +import com.teamcenter.rac.aif.AbstractAIFUIApplication; +import com.teamcenter.rac.aifrcp.AIFUtility; +//import com.teamcenter.rac.common.testers.OkToCheckOutStateTester; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCComponentItemRevision; +//import com.teamcenter.rac.kernel.TCComponentForm; +//import com.teamcenter.rac.kernel.TCComponentType; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.stylesheet.AbstractRendering; +import com.teamcenter.rac.util.MessageBox; + +//import com.teamcenter.rac.util.PropertyLayout; + +public class JK8_JSPS_Form extends AbstractRendering { + private AbstractAIFUIApplication app = AIFUtility.getCurrentApplication();; + private TCSession session = (TCSession) app.getSession();; + private TCComponent formComp = null; + private JPanel mainJPanel; + private JPanel tableJPanel; + private JPanel buttonJPanel; + private JButton addButton; + private JButton delButton; + + private JButton saveButton; + private JTable jTable; + + // private JScrollPane scrollPanel; + private Object[] obj = new Object[] { "", "", "", "", "λ", + "", "", "״̬", "˵" }; + + private int countNumber; + + public static final String[] PROP_NAMES = { // + "jk8Reviewer", "jk8Decision", "jk8ProposedDate", "jk8ProbLocation", // 4 + "jk8ProbDesc", "jk8Proposal", "jk8Status", "jk8TreatResult" }; + + private List valueLists; + private List myValueLists; + private TCProperty[] propertiesArray; + + public boolean over; + + public JK8_JSPS_Form(TCComponent arg0) throws Exception { + super(arg0); + + this.formComp = arg0; + initializeUI(); + System.out.println(valueLists.size()); + } + + TCComponentItemRevision itemRevision; + Map nameDecision = new HashMap<>(); + + public void initializeUI() { + System.out.println("UI-----Start"); + String[] name_rev = null; + try { + name_rev = ((TCComponentForm) formComp) + .getTCProperty("object_name").getStringValue().split("/"); + } catch (TCException e2) { + e2.printStackTrace(); + } + try { + itemRevision = (TCComponentItemRevision) session.search( + "__Item_Revision_name_ID_and_rev", new String[] { " ID", + "汾" }, new String[] { name_rev[0], name_rev[1] })[0]; + } catch (Exception e1) { + e1.printStackTrace(); + } + // try { + // itemRevision=(TCComponentItemRevision) + // ((TCComponentForm)formComp).whereReferenced()[0].getComponent(); + // } catch (TCException e) { + // e.printStackTrace(); + // } + TCComponent[] tcComponents = null; + try { + tcComponents = itemRevision + .getReferenceListProperty("fnd0ActuatedInteractiveTsks");// signoff_attachments + // fnd0ActuatedInteractiveTsks + for (int i = 0; i < tcComponents.length; i++) { + TCComponent tcComponent = tcComponents[i]; + String userName = tcComponent.getProperty("owning_user").split( + " ")[0]; + String userDecision = tcComponent.getTCProperty("fnd0Status") + .getStringValue(); + if (tcComponent.getTCProperty("fnd0AliasTaskName") + .getStringValue().equals("ǩ : ǩ")) { + + nameDecision.put(userName, userDecision); + } + } + } catch (TCException e) { + e.printStackTrace(); + } + initPanel(); + + } + private JComboBox comBoxProduct; + private void initPanel() { + valueLists = new ArrayList(); + getFormVlue(); + this.setLayout(new BorderLayout()); + mainJPanel = new JPanel(new BorderLayout()); + tableJPanel = new JPanel(new BorderLayout()); + // ñ + this.jTable = getjTable(this.jTable, null, obj, null); + jTable.setDefaultRenderer(Object.class, new TableComboxRender()); + + // for (int index = 0; index < columnName.length; index++) { + // } + + tableJPanel.add(new JScrollPane(this.jTable), BorderLayout.CENTER); + // scrollPanel = new JScrollPane(); + // scrollPanel.getViewport().add(jTable, null); + // scrollPanel.validate(); + int rowCount = this.jTable.getRowCount(); + System.out.println("rowCount===========================>" + rowCount); + // if(true) { + // return; + // } + Object[][] values = new Object[valueLists.size()][9]; + countNumber = 0; + for (int i = 0; i < valueLists.size(); i++) { + countNumber++; + values[i][0] = countNumber + "";// + values[i][1] = valueLists.get(i).jk8_psr;// + values[i][2] = valueLists.get(i).jk8_jd;// + values[i][3] = valueLists.get(i).jk8_tcrq;// + values[i][4] = valueLists.get(i).jk8_wtszwz;// λ + values[i][5] = valueLists.get(i).jk8_wtms;// + values[i][6] = valueLists.get(i).jk8_jy;// + values[i][7] = valueLists.get(i).jk8_zt;// ״̬ + values[i][8] = valueLists.get(i).jk8_cljg;// ˵ + + } + // ˫¼ + jTable.addMouseListener(new MouseAdapter() { + + public void mouseClicked(MouseEvent e) { + if (e.getClickCount() == 2) { + int row = ((JTable) e.getSource()).rowAtPoint(e.getPoint()); // õλ + int col = ((JTable) e.getSource()).columnAtPoint(e + .getPoint()); // õλ + System.out.println("" + row + "У" + col + ""); + // TODO һ½ + JSPS_Dialog dialog = new JSPS_Dialog(valueLists, row, col, + obj); + new Thread(dialog).run(); + } + } + }); + + for (int i = rowCount - 1; i >= 0; i--) { + ((DefaultTableModel) this.jTable.getModel()).removeRow(i); + } + for (int i = 0; i < values.length; i++) { + if (values[i][1] != null) { + + ((DefaultTableModel) this.jTable.getModel()).addRow(values[i]); + } + } + + buttonJPanel = new JPanel(new BorderLayout()); + addButton = new JButton("+"); + addButton.setPreferredSize(new Dimension(60, 25)); + addButton.setEnabled(true); + addButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + addRow(e); + } + }); + // saveButton = new JButton(""); + // saveButton.setEnabled(true); + // saveButton.setPreferredSize(new Dimension(60, 25)); + // saveButton.addActionListener(new ActionListener() { + // + // @Override + // public void actionPerformed(ActionEvent e) { + // saveWLProps(); + // } + // }); + delButton = new JButton("-"); + delButton.setEnabled(true); + delButton.setPreferredSize(new Dimension(60, 25)); + delButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent arg0) { + delRow(arg0); + } + }); + // buttonJPanel.add("1.1.left.top", addButton); + // buttonJPanel.add("2.1.left.top", saveButton); + // buttonJPanel.add("3.1.left.top", delButton); + buttonJPanel.add(addButton, BorderLayout.NORTH); + // buttonJPanel.add(saveButton, BorderLayout.CENTER); + buttonJPanel.add(delButton, BorderLayout.SOUTH); + + mainJPanel.add(tableJPanel, BorderLayout.CENTER); + // mainJPanel.add(buttonJPanel, BorderLayout.EAST); + + this.add(mainJPanel, BorderLayout.CENTER); + // for (int i = 0; i < valueLists.size(); i++) { + // System.out.println((String) jTable.getValueAt(i, 7)==null?"":(String) + // jTable.getValueAt(i, 7)); + // } + } + + protected void delRow(ActionEvent arg0) { + int index = jTable.getSelectedRow(); + if (index == -1) { + MessageBox.post("ѡִɾ", "", MessageBox.WARNING); + return; + } + if (valueLists.get(index).jk8_psr != session.getUserName()) { + MessageBox.post("ֻɾԼĻǩѡִɾ", "", + MessageBox.WARNING); + return; + } + valueLists.remove(index); + ((DefaultTableModel) this.jTable.getModel()).removeRow(index); + ((DefaultTableModel) this.jTable.getModel()) + .fireTableStructureChanged(); + ((DefaultTableModel) this.jTable.getModel()).fireTableDataChanged(); + // scrollPanel.validate(); + + } + + protected void addRow(ActionEvent e) { + countNumber++; + JK8_JSPSPropBean bean = new JK8_JSPSPropBean(); + bean.jk8_psr = session.getUserName(); + // ȡϵͳǰʱ䣬ұȽ + Calendar calendar = Calendar.getInstance(); + String year = String.valueOf(calendar.get(Calendar.YEAR));// ȡ + String month = String.valueOf(calendar.get(Calendar.MONTH) + 1);// ȡ· + String day = String.valueOf(calendar.get(Calendar.DATE));// ȡ + String today = year + "/" + month + "/" + day; + bean.jk8_tcrq = today; + Object[] objs = new Object[] { countNumber + "", bean.jk8_psr, + bean.jk8_jd, bean.jk8_tcrq, bean.jk8_wtszwz, bean.jk8_wtms, + bean.jk8_jy, bean.jk8_zt, bean.jk8_cljg }; + valueLists.add(bean); + ((DefaultTableModel) this.jTable.getModel()).addRow(objs); + + ((DefaultTableModel) this.jTable.getModel()) + .fireTableStructureChanged(); + ((DefaultTableModel) this.jTable.getModel()).fireTableDataChanged(); + + } + + // Jtableͨ÷ + public JTable getjTable(JTable partsTable, DefaultTableModel dtm, + Object[] titleNames, Object[][] values) { + int simpleLen = 105; + int totleLen = 900; + if (partsTable == null) { + partsTable = new JTable(getTableModel(dtm, titleNames, values)) { + // TODO ֻ5~8вǻǩԼ¿޸ + @Override + public boolean isCellEditable(int row, int column) { + if (column == 7 || column == 8) { + // ((DefaultTableModel) + // partsTable.getModel()).getValueAt(row, 1); + return true; + // if(session.getUserName().equals(anObject)){ + // + // }else{ + // return false; + // } + } else { + return false; + } + // return false; + } + }; + partsTable.setRowHeight(20); + if (simpleLen * titleNames.length >= totleLen) { + for (int i = 0; i < titleNames.length; i++) { + partsTable.getColumnModel().getColumn(i) + .setPreferredWidth(105); + } + partsTable.setAutoResizeMode(0); + } else { + partsTable.setAutoResizeMode(1); + } + } + return partsTable; + } + + // tableؼ + public DefaultTableModel getTableModel(DefaultTableModel dtm, + Object[] columnNameObjects, Object[][] objects) { + if (dtm == null) { + dtm = new DefaultTableModel(objects, columnNameObjects); + } + return dtm; + } + + @Override + public void loadRendering() throws TCException { + initializeUI(); + + } + + public boolean isRenderingModified() { + System.out.println("isRenderingModified"); + + try { + for (int i = 0; i < valueLists.size(); i++) { + System.out.println("" + (i + 1) + ""); + System.out.print((String) jTable.getValueAt(i, 7) == null ? "" + : (String) jTable.getValueAt(i, 7)); + } + int count = 0; + count = valueLists.size(); + // Collections.sort(this.valueLists); + try { + JkomMethodUtil.setByPass(true); + } catch (TCException e2) { + e2.printStackTrace(); + } + String[] valueStrs0 = new String[count];// + String[] valueStrs1 = new String[count];// + String[] valueStrs2 = new String[count];// + String[] valueStrs3 = new String[count];// λ + String[] valueStrs4 = new String[count];// + String[] valueStrs5 = new String[count];// + String[] valueStrs6 = new String[count];// ״̬ + String[] valueStrs7 = new String[count];// ˵ + // //ȡɱ༭״̬漰ʱ޸ĵ + try { + // 쳣رաwin72008ϵͳлᵼTCر쳣 + for (int i = 0; i < count; i++) { + CellEditor ce = jTable.getCellEditor(i, 7); + ce.stopCellEditing(); + } + for (int i = 0; i < count; i++) { + CellEditor ce = jTable.getCellEditor(i, 8); + ce.stopCellEditing(); + } + } catch (Exception e) { + e.printStackTrace(); + } + for (int i = 0; i < valueLists.size(); i++) { + JK8_JSPSPropBean bean = valueLists.get(i); + valueStrs0[i] = bean.jk8_psr == null ? "" : bean.jk8_psr; + valueStrs1[i] = bean.jk8_jd == null ? "" : bean.jk8_jd; + valueStrs2[i] = bean.jk8_tcrq == null ? "" : bean.jk8_tcrq; + valueStrs3[i] = bean.jk8_wtszwz == null ? "" : bean.jk8_wtszwz; + valueStrs4[i] = bean.jk8_wtms == null ? "" : bean.jk8_wtms; + valueStrs5[i] = bean.jk8_jy == null ? "" : bean.jk8_jy; + valueStrs6[i] = (String) jTable.getValueAt(i, 7) == null ? "" + : (String) jTable.getValueAt(i, 7); + valueStrs7[i] = (String) jTable.getValueAt(i, 8) == null ? "" + : (String) jTable.getValueAt(i, 8); + } + + if (isrend(propertiesArray[0].getStringArrayValue(), valueStrs0)) { + return true; + } + if (isrend(propertiesArray[1].getStringArrayValue(), valueStrs1)) { + return true; + } + if (isrend(propertiesArray[2].getStringArrayValue(), valueStrs2)) { + return true; + } + if (isrend(propertiesArray[3].getStringArrayValue(), valueStrs3)) { + return true; + } + if (isrend(propertiesArray[4].getStringArrayValue(), valueStrs4)) { + return true; + } + if (isrend(propertiesArray[5].getStringArrayValue(), valueStrs5)) { + return true; + } + if (isrend(propertiesArray[6].getStringArrayValue(), valueStrs6)) { + return true; + } + if (isrend(propertiesArray[7].getStringArrayValue(), valueStrs7)) { + return true; + } + + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + }// гѡ + return false; + } + + public boolean isrend(Object[] jkfxget, Object[] jkfxset) { + // TODO Auto-generated method stub + if (jkfxget != null && jkfxset != null) { + if (jkfxget.length == jkfxset.length) { + for (int i = 0; i < jkfxset.length; i++) { + if (jkfxget[i] != null && (!jkfxget[i].equals(jkfxset[i]))) { + return true; + } + if (jkfxget[i] == null && jkfxset[i] != null) { + return true; + } + } + } else { + return true; + } + } + + return false; + } + + @Override + public void saveRendering() { + over = true; + saveWLProps(); + } + + /** + * ǩ벢 + */ + @Override + public boolean checkForSave(Object obj) { + over = true; + saveWLProps(); + + System.out.println("ǩ벢"); + return super.checkForSave(obj); + } + + /** + * + */ + @Override + public void save() { + over = true; + saveWLProps(); + + System.out.println(""); + super.save(); + } + + /** + * + */ + // public void saveWLProps() { + // // try { + // // this.formComp.lock(); + // // } catch (TCException e3) { + // // e3.printStackTrace(); + // // }//ֹûͬʱ + // // isRefresh = true; + // // submitInfomation(); + // // if (problemLocation.equals("") || problemDesc.equals("") || + // Proposal.equals("") ) { + // // this.setAlwaysOnTop(false); + // // MessageBox.post("ȷλáд", "", MessageBox.ERROR); + // // return; + // // } + // try { + // getFormVlue(); + // } catch (Exception e2) { + // e2.printStackTrace(); + // } + // // ѵǰǩ˵ʷǩ¼ȡ + // // JK8_JSPSPropBean bean0 = new JK8_JSPSPropBean(); + // // + // // bean0.jk8_psr = reviewer;// "", + // // bean0.jk8_jd = decision;// "", + // // bean0.jk8_tcrq = proposedDate;// "", + // // bean0.jk8_wtszwz = problemLocation;// "λ",// 5 + // // bean0.jk8_wtms = problemDesc;// "", + // // bean0.jk8_jy = Proposal;// "", + // // bean0.jk8_cljg = TreatResult;// "", + // // + // // this.valueLists.add(bean0); + // // int count = 0; + // // if(count==0){ + // // return; + // // } + // // /** + // String[] valueStrs0 = new String[valueLists.size()];// + // String[] valueStrs1 = new String[valueLists.size()];// + // String[] valueStrs2 = new String[valueLists.size()];// + // String[] valueStrs3 = new String[valueLists.size()];// λ + // String[] valueStrs4 = new String[valueLists.size()];// + // String[] valueStrs5 = new String[valueLists.size()];// + // String[] valueStrs6 = new String[valueLists.size()];// + // + // for (int i = 0; i < valueLists.size(); i++) { + // JK8_JSPSPropBean bean = valueLists.get(i); + // valueStrs0[i] = bean.jk8_psr == null ? "" : bean.jk8_psr; + // valueStrs1[i] = bean.jk8_jd == null ? "" : bean.jk8_jd; + // valueStrs2[i] = bean.jk8_tcrq == null ? "" : bean.jk8_tcrq; + // valueStrs3[i] = bean.jk8_wtszwz == null ? "" : bean.jk8_wtszwz; + // valueStrs4[i] = bean.jk8_wtms == null ? "" : bean.jk8_wtms; + // valueStrs5[i] = bean.jk8_jy == null ? "" : bean.jk8_jy; + // valueStrs6[i] = bean.jk8_cljg == null ? "" : bean.jk8_cljg; + // } + // // //ȡĿɱ༭״̬漰ʱ޸ĵ + // for (int i = 0; i < valueLists.size(); i++) { + // for (int k = 4; k < 8; k++) { + // + // CellEditor ce = jTable.getCellEditor(i, k); + // ce.stopCellEditing(); + // // System.out.println("1111111111111111111111111111111111111"); + // } + // } + // // **/ + // + // // try { + // // JkomMethodUtil.setByPass(true); + // // } catch (TCException e2) { + // // e2.printStackTrace(); + // // } + // try { + // // if (propertiesArray[0] != null) + // propertiesArray[0].setStringValueArray(valueStrs0); + // // if (propertiesArray[1] != null) + // propertiesArray[1].setStringValueArray(valueStrs1); + // // if (propertiesArray[2] != null) + // propertiesArray[2].setStringValueArray(valueStrs2); + // // if (propertiesArray[3] != null) + // propertiesArray[3].setStringValueArray(valueStrs3); + // // if (propertiesArray[4] != null) + // propertiesArray[4].setStringValueArray(valueStrs4); + // // if (propertiesArray[5] != null) + // propertiesArray[5].setStringValueArray(valueStrs5); + // // if (propertiesArray[6] != null) + // propertiesArray[6].setStringValueArray(valueStrs6); + // + // formComp.setTCProperties(propertiesArray); + // + // } catch (TCException e) { + // e.printStackTrace(); + // } catch (Exception e1) { + // e1.printStackTrace(); + // } + // // try { + // // JkomMethodUtil.setByPass(false); + // // } catch (TCException e2) { + // // e2.printStackTrace(); + // // } + // // try { + // // this.formComp.unlock(); + // // } catch (TCException e) { + // // e.printStackTrace(); + // // } + // + // } + + public void saveWLProps() { + // ѵǰǩ˵ʷǩ¼ȡ + for (int i = 0; i < valueLists.size(); i++) { + System.out.println("" + (i + 1) + ""); + System.out.print((String) jTable.getValueAt(i, 7) == null ? "" + : (String) jTable.getValueAt(i, 7)); + } + int count = 0; + count = valueLists.size(); + // Collections.sort(this.valueLists); + try { + JkomMethodUtil.setByPass(true); + } catch (TCException e2) { + e2.printStackTrace(); + } + String[] valueStrs0 = new String[count];// + String[] valueStrs1 = new String[count];// + String[] valueStrs2 = new String[count];// + String[] valueStrs3 = new String[count];// λ + String[] valueStrs4 = new String[count];// + String[] valueStrs5 = new String[count];// + String[] valueStrs6 = new String[count];// ״̬ + String[] valueStrs7 = new String[count];// ˵ + // //ȡɱ༭״̬漰ʱ޸ĵ + try { + // 쳣رաwin72008ϵͳлᵼTCر쳣 + for (int i = 0; i < count; i++) { + CellEditor ce = jTable.getCellEditor(i, 7); + ce.stopCellEditing(); + } + for (int i = 0; i < count; i++) { + CellEditor ce = jTable.getCellEditor(i, 8); + ce.stopCellEditing(); + } + } catch (Exception e) { + e.printStackTrace(); + } + for (int i = 0; i < valueLists.size(); i++) { + JK8_JSPSPropBean bean = valueLists.get(i); + valueStrs0[i] = bean.jk8_psr == null ? "" : bean.jk8_psr; + valueStrs1[i] = bean.jk8_jd == null ? "" : bean.jk8_jd; + valueStrs2[i] = bean.jk8_tcrq == null ? "" : bean.jk8_tcrq; + valueStrs3[i] = bean.jk8_wtszwz == null ? "" : bean.jk8_wtszwz; + valueStrs4[i] = bean.jk8_wtms == null ? "" : bean.jk8_wtms; + valueStrs5[i] = bean.jk8_jy == null ? "" : bean.jk8_jy; + valueStrs6[i] = (String) jTable.getValueAt(i, 7) == null ? "" + : (String) jTable.getValueAt(i, 7); + valueStrs7[i] = (String) jTable.getValueAt(i, 8) == null ? "" + : (String) jTable.getValueAt(i, 8); + System.out.println("״̬1----------" + valueStrs7[i]); + } + + // for (int i = 0; i < myValueLists.size(); i++) { + // JK8_JSPSPropBean bean = myValueLists.get(i); + // valueStrs0[valueLists.size() + i] = bean.jk8_psr == null ? "" : + // bean.jk8_psr; + // valueStrs1[valueLists.size() + i] = bean.jk8_jd == null ? "" : + // bean.jk8_jd; + // valueStrs2[valueLists.size() + i] = bean.jk8_tcrq == null ? "" : + // bean.jk8_tcrq; + // valueStrs3[valueLists.size() + i] = bean.jk8_wtszwz == null ? "" + // : bean.jk8_wtszwz; + // valueStrs4[valueLists.size() + i] = bean.jk8_wtms== null ? "" + // : bean.jk8_wtms; + // valueStrs5[valueLists.size() + i] = bean.jk8_jy== null ? "" + // : bean.jk8_jy; + // valueStrs6[valueLists.size() + i] = (String) jTable.getValueAt(i, 7) + // == null + // ? "" + // : (String) jTable.getValueAt(i, 7); + // System.out.println(i+"2----------"+valueStrs6[valueLists.size() + // + i]); + // } + + try { + // if(propertiesArray[0]==null) { + // System.out.println("bingo"); + // } + // if (propertiesArray[0] != null) + propertiesArray[0].setStringValueArray(valueStrs0); + // if (propertiesArray[1] != null) + propertiesArray[1].setStringValueArray(valueStrs1); + // if (propertiesArray[2] != null) + propertiesArray[2].setStringValueArray(valueStrs2); + // if (propertiesArray[3] != null) + propertiesArray[3].setStringValueArray(valueStrs3); + // if (propertiesArray[4] != null) + propertiesArray[4].setStringValueArray(valueStrs4); + // if (propertiesArray[5] != null) + propertiesArray[5].setStringValueArray(valueStrs5); + // if (propertiesArray[6] != null) + propertiesArray[6].setStringValueArray(valueStrs6); + propertiesArray[7].setStringValueArray(valueStrs7); + + formComp.setTCProperties(propertiesArray); + + } catch (TCException e) { + e.printStackTrace(); + } catch (Exception e1) { + e1.printStackTrace(); + } + try { + JkomMethodUtil.setByPass(false); + } catch (TCException e2) { + e2.printStackTrace(); + } + } + + /** + * FORMʱȡ + */ + public void getFormVlue() { + // try { + // + // this.formComp.refresh(); + // } catch (TCException e1) { + // // TODO Auto-generated catch block + // e1.printStackTrace(); + // }//Dzִд˲裬ܸ£ͬ;Ⱦͻᵼˢ£ϵͳ + this.valueLists = new ArrayList<>(); + try { + // ȡֵ + propertiesArray = formComp.getTCProperties(PROP_NAMES); + // дֵԵ + if (propertiesArray != null) { + String[] valueStrs0 = propertiesArray[0] == null ? new String[0] + : propertiesArray[0].getStringArrayValue(); + String[] valueStrs1 = propertiesArray[1] == null ? new String[0] + : propertiesArray[1].getStringArrayValue(); + String[] valueStrs2 = propertiesArray[2] == null ? new String[0] + : propertiesArray[2].getStringArrayValue(); + String[] valueStrs3 = propertiesArray[3] == null ? new String[0] + : propertiesArray[3].getStringArrayValue(); + String[] valueStrs4 = propertiesArray[4] == null ? new String[0] + : propertiesArray[4].getStringArrayValue(); + String[] valueStrs5 = propertiesArray[5] == null ? new String[0] + : propertiesArray[5].getStringArrayValue(); + String[] valueStrs6 = propertiesArray[6] == null ? new String[0] + : propertiesArray[6].getStringArrayValue(); + if (propertiesArray[7] == null) { + System.out.println("bingo"); + } else { + System.out.println("ergo"); + } + String[] valueStrs7 = propertiesArray[7] == null ? new String[0] + : propertiesArray[7].getStringArrayValue(); + + if ( + // valueStrs0.length == valueStrs1.length + // && valueStrs0.length == valueStrs2.length + // && + valueStrs0.length == valueStrs3.length + && valueStrs0.length == valueStrs4.length + && valueStrs0.length == valueStrs5.length + // && valueStrs0.length == valueStrs6.length + + && valueStrs0.length != 0) { + for (int i = 0; i < valueStrs0.length; i++) { + JK8_JSPSPropBean bean = new JK8_JSPSPropBean(); + + bean.jk8_psr = valueStrs0[i];// "", + bean.jk8_jd = valueStrs1[i];// "", + bean.jk8_tcrq = valueStrs2[i];// "", + bean.jk8_wtszwz = valueStrs3[i];// "λ",// 5 + bean.jk8_wtms = valueStrs4[i];// "", + bean.jk8_jy = valueStrs5[i];// "", + try { + bean.jk8_zt = valueStrs6[i];// "״̬", + } catch (Exception e) { + bean.jk8_zt = ""; + // e.printStackTrace(); + } + bean.jk8_cljg = valueStrs7[i];// "˵", + + if (nameDecision.containsKey(bean.jk8_psr)) { + bean.jk8_jd = nameDecision.get(bean.jk8_psr); + } + System.out + .println("==================================>" + + valueStrs6[i]); + + this.valueLists.add(bean); + } + } + } + // Collections.sort(this.valueLists); + } catch (TCException e) { + e.printStackTrace(); + } + + } + +} diff --git a/src/com/teamcenter/rac/form/JK8_PCB_PropBean.java b/src/com/teamcenter/rac/form/JK8_PCB_PropBean.java new file mode 100644 index 0000000..217907a --- /dev/null +++ b/src/com/teamcenter/rac/form/JK8_PCB_PropBean.java @@ -0,0 +1,59 @@ +package com.teamcenter.rac.form; + +public class JK8_PCB_PropBean { + + public static final int COUNT = 9; + public String Companylogo=""; + public String MeasureType=""; + public String CommunicateMode=""; + public String Application=""; + public String Revisionlevel=""; + public String PCBNO=""; + public String ProjectName=""; + + public String getProjectName() { + return ProjectName; + } + public void setProjectName(String projectName) { + ProjectName = projectName; + } + public String getPCBNO() { + return PCBNO; + } + public void setPCBNO(String pCBNO) { + PCBNO = pCBNO; + } + public String getCompanylogo() { + return Companylogo; + } + public void setCompanylogo(String companylogo) { + Companylogo = companylogo; + } + public String getMeasureType() { + return MeasureType; + } + public void setMeasureType(String measureType) { + MeasureType = measureType; + } + public String getCommunicateMode() { + return CommunicateMode; + } + public void setCommunicateMode(String communicateMode) { + CommunicateMode = communicateMode; + } + public String getApplication() { + return Application; + } + public void setApplication(String application) { + Application = application; + } + public String getRevisionlevel() { + return Revisionlevel; + } + public void setRevisionlevel(String revisionlevel) { + Revisionlevel = revisionlevel; + } + + + +} diff --git a/src/com/teamcenter/rac/form/JK8_SBCPXH_Form.java b/src/com/teamcenter/rac/form/JK8_SBCPXH_Form.java new file mode 100644 index 0000000..159b097 --- /dev/null +++ b/src/com/teamcenter/rac/form/JK8_SBCPXH_Form.java @@ -0,0 +1,1257 @@ +package com.teamcenter.rac.form; + +//import java.awt.Dimension; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionListener; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.swing.BorderFactory; +import javax.swing.ButtonGroup; +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.JTextField; +import javax.swing.JViewport; + +import com.teamcenter.rac.common.lov.LOVUIComponent; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.stylesheet.AbstractRendering; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; +import com.teamcenter.rac.util.Registry; +import com.teamcenter.rac.util.iTextArea; +import com.teamcenter.rac.util.combobox.iComboBox; +//2019.05.16ˮƷͺʶ뵥 +//1²Ʒͺšʶ +public class JK8_SBCPXH_Form extends AbstractRendering { + private TCComponentForm form; + private TCSession session; + // private Registry registry = null; + private JScrollPane jsp; + private JPanel jpall; + private JPanel jp1; + private JPanel jp11; + private JPanel jp12; + + private JPanel jp2; + private JPanel jp21; + private JPanel jp22; + private JPanel jp221; + private JPanel jp222; + private JPanel jp23; + private JPanel jp231; + private JPanel jp232; + private JPanel jp24; + private JPanel jp25; + private JPanel jp251; + private JPanel jp26; + + private JPanel jp3; + private JPanel jp31; + + private JPanel jp4; + private JPanel jp41; + private JPanel jp42; + + private JPanel jp5; + private JLabel jlab11; + private JTextField jtxt11;// Ʒ + private JTextField jtxt12 = new JTextField(24);// Ŀ + private JTextField jtxt13 = new JTextField(24);// Ŀ + private JButton tj = new JButton("ύ"); + + // private JLabel jlab21; + // private JLabel jlab22; + private JLabel jlab23; + private JLabel jlab31; + + private JRadioButton jcb1;// ȼƷͺϢǼ + private JRadioButton jcb2;// ɼƷͺϢǼ + private JRadioButton jcb3;// еƷͺϢǼ + private JRadioButton jcb4;// + + // private JRadioButton myjcb;// + // private JRadioButton gyjcb;// + + private iComboBox box1 = new iComboBox();// ԭ + private iComboBox box2 = new iComboBox();// Ʒ1 + private iComboBox box3 = new iComboBox();// + private iComboBox box4 = new iComboBox();// + private iComboBox box5 = new iComboBox();// ICԤ + private iComboBox box6 = new iComboBox();// + private iComboBox box7 = new iComboBox();// ¶ѹ + private iComboBox box13 = new iComboBox();// + private iComboBox box12 = new iComboBox();// ͼ + + private iComboBox box8 = new iComboBox();// / + private iComboBox box9 = new iComboBox();// Ʒ + private iComboBox box10 = new iComboBox();// + private iComboBox box11 = new iComboBox();// Ʒѷʽ + + private iComboBox box14 = new iComboBox();// Ƿ 2018.3.20 + + private ButtonGroup group; + private ButtonGroup group1; + private JRadioButton jr1;// г1 + private JRadioButton jr2;// г2 + private JTextField jt23 = new JTextField(24);// ҵ + private JTextField jt24 = new JTextField(24);// + private JTextArea jt43 =new JTextArea(3,24);// ܸ + private JTextField jt44 = new JTextField(14);// г3 + private JTextField jt45 = new JTextField(24);// ͺ + private JTextField jt46 = new JTextField(24);// ·ͺ + private JTextField jt47 = new JTextField(24);// + private JTextField jt48 = new JTextField(24);// ICͺ + private JTextField jt49 = new JTextField(24);// ͻҪ + private JTextField jt10 = new JTextField(24);;// + private JTextField jt11 = new JTextField(24);;// + private JTextField jt12 = new JTextField(24);;// + private JTextField jt51 = new JTextField(32);// Ʒͺ + private JTextField jt52 = new JTextField(32);// ʶ + + private String sysc;// гѡֵ + private String[] txms;// ͨŶѡֵ + private String[] myb;// öѡֵ + private String[] llgg;// ѡֵ + + //private List txlist = new ArrayList();// ͨŶѡ + private List mylist = new ArrayList();// öѡ + private List lllist = new ArrayList();// ѡ + + private iComboBox box15 = new iComboBox();// ͨ 2018.6.6ѡij + + private HashMap realNameMap;// lovѡֵ + + private String isCheck; + + public JK8_SBCPXH_Form(TCComponentForm c) throws Exception { + + super(c); + form = c; + session = c.getSession(); + // registry = Registry.getRegistry(this); + String[] names = session.getPreferenceService().getStringValues( + "JK_CPXH_FORM"); + if (names != null) { + + realNameMap = new HashMap<>(); + for (int i = 0; i < names.length; i++) { + String[] s = names[i].split("="); + if (s != null && s.length == 2) { + String key = s[0]; + String value = s[1]; + realNameMap.put(key, value); + } else { + MessageBox.post("ѡ JK_CPXH_FORM ôϵԱ", "", + MessageBox.ERROR); + return; + } + + } + + } else { + MessageBox.post("ѡ JK_CPXH_FORM ڣϵԱ", "", + MessageBox.ERROR); + } + + // init(); + loadRendering(); + + jpall.addMouseMotionListener(new MouseMotionListener() { + + @Override + public void mouseMoved(MouseEvent arg0) { + // TODO Auto-generated method stub + + try { + isCheck = form.getTCProperty("fnd0IsCheckoutable") + .getDisplayableValue(); + } catch (TCException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + if ("".equals(isCheck)) { + if (jcb1.isSelected()) { + setJcb2(false); + setJcb3(false); + } else if (jcb2.isSelected()) { + setJcb1(false); + setJcb3(false); + } else if (jcb3.isSelected()) { + setJcb1(false); + setJcb2(false); + } else if (jcb4.isSelected()) { + setJcb1(false); + setJcb2(false); + setJcb3(false); + } else { + setJcb1(false); + setJcb2(false); + setJcb3(false); + } + + setIsKlc(); + setLxEn(); + setOwnerHave(); + } + + } + + + @Override + public void mouseDragged(MouseEvent arg0) { + // TODO Auto-generated method stub + + } + }); + + if (!jr2.isSelected()) { + jt44.setEnabled(false); + } + jt51.setEnabled(false); + jt52.setEnabled(false); + + System.out.println("end"); + } + + private void init() { + // TODO Auto-generated method stub + setLayout(new BorderLayout()); + // setBackground(Color.white); + jpall = new JPanel(new PropertyLayout()); + jp1 = new JPanel(new PropertyLayout()); + jp2 = new JPanel(new PropertyLayout()); + jp3 = new JPanel(new PropertyLayout()); + jp4 = new JPanel(new PropertyLayout()); + jp5 = new JPanel(new PropertyLayout()); + // jp1ʼ + jp11 = new JPanel(new PropertyLayout()); + jp12 = new JPanel(new PropertyLayout()); + jlab11 = new JLabel(" ²Ʒͺšʶ뵥 "); + jlab11.setFont(new Font("", 1, 24)); + jtxt11 = new JTextField(); + jtxt11.setColumns(60); + jtxt11.setBackground(Color.white); + jp11.add("1.1.left.top", jlab11); + // jp11.add("1.2.right.top", tj); + // tj.addActionListener(new ActionListener() { + // + // @Override + // public void actionPerformed(ActionEvent actionevent) { + // // TODO Auto-generated method stub + // saveRendering(); + // } + // }); + + jp12.add("1.1.left.top", new JLabel(" Ʒƣ ")); + jp12.add("1.2.right.top", getjl()); + jp12.add("1.3.left.top", jtxt11); + jp12.add("2.1.left.top", new JLabel(" Ŀƣ ")); + jp12.add("2.2.right.top", getjl()); + jp12.add("2.3.left.top", jtxt12); + jp12.add("3.1.left.top", new JLabel(" Ŀţ ")); + jp12.add("3.2.right.top", getjl()); + jp12.add("3.3.left.top", jtxt13); + jp1.add("1.1.left.top", jp11); + jp1.add("2.1.left.top", jp12); + + // jp2ʼ + jcb1 = new JRadioButton("ȼƷͺϢǼ"); + jcb1.setFont(new Font("", 0, 16)); + jcb1.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + if (jcb1.isSelected()) { + setJcbTxt2(); + setJcbTxt3(); + setJcb1(true); + setJcb2(false); + setJcb3(false); + } + + } + }); + jcb2 = new JRadioButton("ɼƷͺϢǼ"); + jcb2.setFont(new Font("", 0, 16)); + jcb2.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + setJcbTxt1(); + setJcbTxt3(); + setJcb1(false); + setJcb2(true); + setJcb3(false); + } + }); + jcb3 = new JRadioButton("еƷͺϢǼ"); + jcb3.setFont(new Font("", 0, 16)); + jcb3.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + setJcbTxt1(); + setJcbTxt2(); + setJcb1(false); + setJcb2(false); + setJcb3(true); + } + }); + jcb4 = new JRadioButton(""); + jcb4.setFont(new Font("", 0, 16)); + jcb4.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + setJcbTxt1(); + setJcbTxt2(); + setJcbTxt3(); + setJcb1(false); + setJcb2(false); + setJcb3(false); + } + }); + group1 = new ButtonGroup(); + group1.add(jcb1); + group1.add(jcb2); + group1.add(jcb3); + group1.add(jcb4); + // jlab21 = new JLabel(" ȼƷͺϢǼ "); + // jlab21.setFont(new Font("", 0, 16)); + // jlab22 = new JLabel("ɼƷͺϢǼ"); + // jlab22.setFont(new Font("", 0, 16)); + jp21 = new JPanel(new PropertyLayout()); + jp22 = new JPanel(new PropertyLayout()); + jp23 = new JPanel(new PropertyLayout()); + jp24 = new JPanel(new PropertyLayout()); + jp25 = new JPanel(new PropertyLayout()); + jp26 = new JPanel(new PropertyLayout()); + + jp21.add("1.1.left.top", new JLabel(" ԭ: ")); + jp21.add("1.2.right.top", getjl()); + setLov(box1, "ԭ"); + jp21.add("1.3.left.top", box1); + jp21.add("2.1.left.top", new JLabel(" Ʒ: ")); + jp21.add("2.2.right.top", getjl()); + setLov(box2, "Ʒ1"); + jp21.add("2.3.left.top", box2); + + jp221 = new JPanel(new PropertyLayout()); + jp222 = new JPanel(new PropertyLayout()); + + jp221.add("1.1.right.top", new JLabel("ͨģʽ:")); + jp221.add("1.2.right.top", getjl()); + //setLov(box15, "ͨģʽѡ"); + setLov(box15, "ͨģʽ"); + jp221.add("1.3.right.top", box15); +// String[] s1 = realNameMap.get("ͨģʽѡ").split(","); +// for (int j = 0; j < s1.length; j++) { +// JRadioButton jcb = new JRadioButton(s1[j]); +// if (txms != null && txms.length > 0) { +// for (String s : txms) { +// if (s1[j].equals(s)) { +// jcb.setSelected(true);// ݱԸֵ +// } +// } +// } +// txlist.add(jcb); +// jp221.add("1." + (j + 3) + ".right.top", jcb); +// } + jp222.add("1.1.left.top", new JLabel(":")); + setLov(box3, ""); + jp222.add("1.2.left.top", getjl()); + jp222.add("1.3.left.top", box3); + + jp22.add("1.1.left.top", jp221); + jp22.add("2.1.left.top", jp222); + + jp231 = new JPanel(new PropertyLayout()); + // myjcb = new JRadioButton("ñ:"); + jp231.add("1.1.left.top", new JLabel(" ñѡ:")); + String[] s2 = realNameMap.get("ñ").split(","); + for (int j = 0; j < s2.length; j++) { + JRadioButton jcb = new JRadioButton(s2[j]); + if (myb != null && myb.length > 0) { + for (String s : myb) { + if (s2[j].equals(s)) { + jcb.setSelected(true);// ݱԸֵ + } + } + } + mylist.add(jcb); + jp231.add("1." + (j + 2) + ".left.top", jcb); + } + jp232 = new JPanel(new PropertyLayout()); + // gyjcb = new JRadioButton("ҵ:"); + + jp232.add("1.1.left.top", new JLabel(" :")); + jp232.add("1.2.right.top", getjl()); + setLov(box14, ""); + + jp232.add("1.3.left.top", box14); + jp232.add("2.1.left.top", new JLabel(" ҵ:")); + jp232.add("2.2.left.top", new JLabel(" ")); + jp232.add("2.3.left.top", jt23); + jp232.add("3.1.left.top", new JLabel(" :")); + jp232.add("3.2.left.top", new JLabel(" ")); + jp232.add("3.3.left.top", jt24); + + jp23.add("1.1.left.top", new JLabel(" (ƷΧλΪ)")); + jp23.add("1.2.left.top", getjl()); + jp23.add("2.1.left.top", jp231); + jp23.add("3.1.left.top", jp232); + + jp24.add("1.1.left.top", new JLabel(" :")); + box4 = new iComboBox(); + setLov(box4, ""); + jp24.add("1.2.right.top", getjl()); + jp24.add("1.3.left.top", box4); + + jp24.add("2.1.left.top", new JLabel(" ICԤ:")); + setLov(box5, "ICԤ"); + jp24.add("2.2.left.top", new JLabel(" ")); + jp24.add("2.3.left.top", box5); + + jp24.add("3.1.left.top", new JLabel(" :")); + setLov(box6, ""); + jp24.add("3.2.left.top", getjl());//2019.05.16 + jp24.add("3.3.left.top", box6); + + jp24.add("4.1.left.top", new JLabel(" :")); + setLov(box7, "");//2018.6.1ijɲ + jp24.add("4.2.left.top", new JLabel(" ")); + jp24.add("4.3.left.top", box7); + + jp24.add("5.1.left.top", new JLabel(" :")); + setLov(box13, ""); + jp24.add("5.2.left.top", new JLabel(" ")); + jp24.add("5.3.left.top", box13); + + jp251 = new JPanel(new PropertyLayout()); + jp251.add("1.1.left.top", new JLabel("ͼ:")); + setLov(box12, "ͼ"); + jp251.add("1.2.right.top", getjl()); + jp251.add("1.3.left.top", box12); + jp251.add("2.1.left.top", new JLabel("񣨶ѡ:")); + jp251.add("2.2.right.top", getjl()); + String[] s3 = realNameMap.get("").split(","); + for (int j = 0; j < s3.length; j++) { + JRadioButton jcb = new JRadioButton(s3[j]); + if (llgg != null && llgg.length > 0) { + for (String s : llgg) { + if (s3[j].equals(s)) { + jcb.setSelected(true);// ݱԸֵ + } + } + } + lllist.add(jcb); + jp251.add("2." + (j + 3) + ".left.top", jcb); + } + jp25.add("1.1.left.top", jcb3); + jp25.add("2.1.left.top", jp251); + + // jlab23 = new JLabel(registry.getString("ע")); + jp26.add("1.1.left.top", jcb4); + // jp26.add("2.1.left.top", jlab23); + + JPanel jp2x = new JPanel(new PropertyLayout()); + jp2x.add("1.1.left.top", jcb1); + jp2x.add("2.1.left.top", jp21); + jp2x.add("3.1.left.top", jp23); + jp2x.add("4.1.left.top", jp24); + jp2x.setBorder(BorderFactory.createTitledBorder("")); + jp2x.setBorder(BorderFactory.createLineBorder(Color.white, 3)); + JPanel jp2y = new JPanel(new PropertyLayout()); + JPanel jp2y1 = new JPanel(new PropertyLayout()); + + jp2y1.add("1.1.left.top", jcb2); + jp2y1.add("2.1.left.top", jp22); + jp2y.add("1.1.left.top", jp2y1); + jp2y1.setBorder(BorderFactory.createTitledBorder("")); + jp2y1.setBorder(BorderFactory.createLineBorder(Color.white, 3)); + jp2y.add("2.1.left.top", jp25); + jp25.setBorder(BorderFactory.createTitledBorder("")); + jp25.setBorder(BorderFactory.createLineBorder(Color.white, 3)); + jp2y.add("3.1.left.top", jp26); + + jp2.add("1.1.left.top", jp2x); + jp2.add("1.2.left.top", jp2y); + + // jp2.add("1.1.left.top", jcb1); + // jp2.add("1.2.left.top", jcb2); + // jp2.add("2.1.left.top", jp21);// .preferred.preferred + // jp2.add("2.2.left.top", jp22); + // jp2.add("3.1.left.top", jp23); + // jp2.add("3.2.left.top", jp25); + // jp2.add("4.1.left.top", jp24); + // jp2.add("4.2.left.top", jp26); + + // jp3ʼ + jlab31 = new JLabel(" ²ƷʶϢǼ"); + jlab31.setFont(new Font("", 0, 16)); + + jp31 = new JPanel(new PropertyLayout()); + jp31.add("1.1.left.top", new JLabel(" /:")); + setLov(box8, "/"); + jp31.add("1.2.right.top", getjl()); + jp31.add("1.3.left.top", box8); + jp31.add("2.1.left.top", new JLabel(" Ʒ:")); + jp31.add("2.2.right.top", getjl()); + setLov(box9, "Ʒ"); + jp31.add("2.3.left.top", box9); + jp31.add("3.1.left.top", new JLabel(" :")); + setLov(box10, ""); + jp31.add("3.2.right.top", getjl()); + jp31.add("3.3.left.top", box10); + + jp3.add("1.1.left.top", jlab31); + jp3.add("2.1.left.top", jp31); + + // jp4ʼ + jp41 = new JPanel(new PropertyLayout()); + jp42 = new JPanel(new PropertyLayout()); + + jp41.add("1.1.left.top", new JLabel(" Ʒѷʽ")); + setLov(box11, "Ʒѷʽ"); + jp41.add("1.2.left.top", box11); + jp41.add("2.1.left.top", new JLabel(" г")); + jr1 = new JRadioButton("ͨ");// ѡť + jr1.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + if (jr1.isSelected()) { + jt44.setText(""); + jt44.setEnabled(false); + } + } + }); + jr2 = new JRadioButton("ר");// ѡť + jr2.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + if (jr2.isSelected()) { + jt44.setEnabled(true); + } + } + }); + group = new ButtonGroup(); + group.add(jr1); + group.add(jr2); + jp41.add("2.2.left.top", jr1); + jp41.add("2.3.left.top", jr2); + jp41.add("2.4.left.top", jt44); + jp41.add("3.1.left.top", new JLabel(" ·ͺţ")); + jp41.add("3.2.left.top", jt46); + jp41.add("4.1.left.top", new JLabel(" ICͺţ")); + jp41.add("4.2.left.top", jt48); + jp41.add("5.1.left.top", new JLabel(" ţ")); + jp41.add("5.2.left.top", jt10); + jp41.add("6.1.left.top", new JLabel(" ")); + jp41.add("7.1.left.top", new JLabel(" ׳ң")); + jp41.add("7.2.left.top", jt12); + + JScrollPane jspane1=new JScrollPane(jt43); + jt43.setLineWrap(true); + jp42.add("1.1.left.top", new JLabel(" ܸ ")); + jp42.add("1.2.right.top", getjl()); + jp42.add("1.3.left.top", jspane1);//2019.6.24 Ĺܸ Ҫ + jp42.add("2.1.left.top", new JLabel(" ͺţ ")); + jp42.add("2.2.left.top", new JLabel(" ")); + jp42.add("2.3.left.top", jt45); + jp42.add("3.1.left.top", new JLabel(" ")); + jp42.add("3.2.left.top", new JLabel(" ")); + jp42.add("3.3.left.top", jt47); + jp42.add("4.1.left.top", new JLabel(" ͻҪ")); + jp42.add("4.2.left.top", new JLabel(" ")); + jp42.add("4.3.left.top", jt49); + jp42.add("5.1.left.top", new JLabel(" ͣ")); + jp42.add("5.2.left.top", new JLabel(" ")); + jp42.add("5.3.left.top", jt11); + + jp4.add("1.1.left.top", jp41); + jp4.add("1.2.left.top", jp42); + + // jp5ʼ + jp5.add("1.1.left.top", new JLabel(" Ʒͺţ ")); + jp5.add("1.2.left.top", jt51); + jp5.add("1.3.left.top", new JLabel(" ʶţ")); + jp5.add("1.4.left.top", jt52); + + jpall.add("1.1.left.top", jp1); + jpall.add("2.1.left.top", new JLabel("")); + jpall.add("3.1.left.top", jp2); + jpall.add("4.1.left.top", new JLabel("")); + jpall.add("5.1.left.top", jp3); + jpall.add("6.1.left.top", new JLabel("")); + jpall.add("7.1.left.top", jp4); + jpall.add("8.1.left.top", new JLabel("")); + jpall.add("9.1.left.top", jp5); + // jpall.setPreferredSize(new Dimension(700, 650)); + jsp = new JScrollPane(jpall);// + jsp.setPreferredSize(new Dimension(700, 600)); + this.add(jsp, "Center"); + setVisible(true); + + } + + private void setLov(iComboBox box, String st) { + // TODO Auto-generated method stub + box.setTextFieldLength(20); + box.setAutoCompleteSuggestive(false); + box.addItems(realNameMap.get(st).split(",")); + } + + @Override + public void loadRendering() throws TCException { + // TODO Auto-generated method stub + sysc = form.getTCProperty("jk8ApplyMarket").getStringValue();// гѡֵ + txms = form.getTCProperty("jk8CommunicateMode").getStringValue() + .split("");// ͨģʽѡ: + myb = form.getTCProperty("jk8CivilMeter").getStringValue().split("");// ñ + llgg = form.getTCProperty("jk8FlowSpecification").getStringValue() + .split("");// + + init(); + + if (sysc != null && !sysc.equals("")) {// гѡ + + if (sysc.equals("ͨ")) { + jr1.setSelected(true); + } else if (sysc.contains("ר")) { + jr2.setSelected(true); + String[] strs=form.getTCProperty("jk8ApplyMarket").getStringValue().split(";"); + if(strs!=null&&strs.length>1){ + jt44.setText(strs[1]);// ר + } + + } + } + + String str_jcb = form.getTCProperty("jk8ApplyType").getStringValue(); + if (str_jcb != null && !str_jcb.equals("")) { + if (str_jcb.equals(jcb1.getText())) { + jcb1.setSelected(true); + } else if (str_jcb.equals(jcb2.getText())) { + jcb2.setSelected(true); + } else if (str_jcb.equals(jcb3.getText())) { + jcb3.setSelected(true); + } else if (str_jcb.equals(jcb4.getText())) { + jcb4.setSelected(true); + } + } + + jtxt11.setText(form.getTCProperty("jk8ProductName").getStringValue());// Ʒ + jtxt12.setText(form.getTCProperty("jk8ProjectName").getStringValue());// Ŀ + jtxt13.setText(form.getTCProperty("jk8ProjectNO").getStringValue());// Ŀ + box1.setText(form.getTCProperty("jk8MeasureType").getStringValue());// ԭ + String str = form.getTCProperty("jk8ProductType1").getStringValue(); + if (str != null && str.contains("tb")) { + str = ""; + } + box2.setText(str);// Ʒ1 + box3.setText(form.getTCProperty("jk8ShellType").getStringValue());// + box4.setText(form.getTCProperty("jk8BaseMeterShellType") + .getStringValue());// + box5.setText(form.getTCProperty("jk8ICCardPrepaidFunc") + .getStringValue());// ICԤ + box6.setText(form.getTCProperty("jk8InternetOfThingFunc") + .getStringValue()); // + box7.setText(form.getTCProperty("jk8TempPressCompFunc") + .getStringValue()); // ѹ + box13.setText(form.getTCProperty("jk8SecurityFunc").getStringValue()); // + + box8.setText(form.getTCProperty("jk8BMManufactor").getStringValue());// / + box9.setText(form.getTCProperty("jk8ProductType").getStringValue());// Ʒ + box10.setText(form.getTCProperty("jk8ContrlCompType").getStringValue());// + box11.setText(form.getTCProperty("jk8BillingMode").getStringValue());// Ʒѷʽ + box12.setText(form.getTCProperty("jk8MeterTypeShellMaterial") + .getStringValue());// ͼ + + box14.setText(form.getTCProperty("jk8WideRange").getStringValue());// 2018.3.20 + + box15.setText(form.getTCProperty("jk8CommunicateMode").getStringValue());// ͨѶʽ2019.4.25 + + + jt23.setText(form.getTCProperty("jk8IndustrialMater").getStringValue());// ҵ + jt24.setText(form.getTCProperty("jk8FowMeter").getStringValue());// + + jt43.setText(form.getTCProperty("jk8FunctionOverview").getStringValue());// ܸ + // jt44.setText(form.getTCProperty("jk_xcp_sysc").getStringValue());// + // г3 + jt45.setText(form.getTCProperty("jk8InsteadType").getStringValue());// ͺ + jt46.setText(form.getTCProperty("jk8CircBoardModNO").getStringValue());// ·ͺ + jt47.setText(form.getTCProperty("jk8ProgramFeatures").getStringValue());// + jt48.setText(form.getTCProperty("jk8ICCardType").getStringValue());// ICͺ + jt49.setText(form.getTCProperty("jk8CustSpecRequirements") + .getStringValue());// ͻҪ + jt51.setText(form.getTCProperty("jk8ProductModNO").getStringValue());// Ʒͺ + jt52.setText(form.getTCProperty("jk8ProductIdentifyNO") + .getStringValue());// ʶ + + jt10.setText(form.getTCProperty("jk8Valve").getStringValue());// + jt11.setText(form.getTCProperty("jk8EncryptType").getStringValue());// + jt12.setText(form.getTCProperty("jk8BMManfMatched").getStringValue());// + + } + + + +/* @Override + public Map getRenderingModified() { + Map modifiedRendering = new HashMap (); + try { + System.out.println("getRenderingModifiedʼ"); + saveRendering(); + }catch(Exception ex){ + ex.toString(); + System.out.println(ex.toString()); + } + + + return modifiedRendering; + }*/ + + public boolean isRenderingModified() { + System.out.println("isRenderingModified"); + + String sysc = ""; + if (jr1.isSelected()) { + sysc = jr1.getText(); + } else if (jr2.isSelected()) { + sysc = jr2.getText(); + } + String jcb_str = ""; + if (jcb1.isSelected()) { + jcb_str = jcb1.getText(); + } else if (jcb2.isSelected()) { + jcb_str = jcb2.getText(); + + } else if (jcb3.isSelected()) { + jcb_str = jcb3.getText(); + + } else if (jcb4.isSelected()) { + jcb_str = jcb4.getText(); + + } + try { + if(isrend(form.getTCProperty("jk8ApplyMarket"),sysc + ";" + jt44.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ApplyType"),jcb_str)){ + return true; + } +// if(isrend(form.getTCProperty("jk8CommunicateMode"),getListtxt(txlist))){ +// return true; +// } + if(isrend(form.getTCProperty("jk8CommunicateMode"),box15.getTextField().getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8CivilMeter"),getListtxt(mylist))){ + return true; + } + if(isrend(form.getTCProperty("jk8FlowSpecification"),getListtxt(lllist))){ + return true; + } + if(isrend(form.getTCProperty("jk8ProductName"),jtxt11.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ProjectName"),jtxt12.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ProjectNO"),jtxt13.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8MeasureType"),box1.getTextField().getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ProductType1"),box2.getTextField().getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ShellType"),box3.getTextField().getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8BaseMeterShellType"),box4.getTextField().getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ICCardPrepaidFunc"),box5.getTextField().getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8InternetOfThingFunc"),box6.getTextField().getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8TempPressCompFunc"),box7.getTextField().getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8SecurityFunc"),box13.getTextField().getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8BMManufactor"),box8.getTextField().getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ProductType"),box9.getTextField().getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ContrlCompType"),box10.getTextField().getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8BillingMode"),box11.getTextField().getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8MeterTypeShellMaterial"),box12.getTextField().getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8WideRange"),box14.getTextField().getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8IndustrialMater"),jt23.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8FowMeter"),jt24.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8FunctionOverview"),jt43.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8InsteadType"),jt45.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8CircBoardModNO"),jt46.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ProgramFeatures"),jt47.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ICCardType"),jt48.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8CustSpecRequirements"),jt49.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ProductModNO"),jt51.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ProductIdentifyNO"),jt52.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8Valve"),jt10.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8EncryptType"),jt11.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8BMManfMatched"),jt12.getText())){ + return true; + } + + + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + }// гѡ + return false; + } + + + + private boolean isrend(TCProperty tcProperty, String jcb_str) { + // TODO Auto-generated method stub + if(tcProperty!=null&&jcb_str!=null&&(!jcb_str.equals(tcProperty.getStringValue()))){ + System.out.println(jcb_str); + return true; + } + return false; + } + + @Override + public void saveRendering() { + // TODO Auto-generated method stub + boolean isno=true; + if ("".equals(jtxt11.getText()) || "".equals(jtxt12.getText()) + || "".equals(jtxt13.getText()) || "".equals(jt43.getText()) + || "".equals(box8.getTextField().getText()) + || "".equals(box9.getTextField().getText()) + || "".equals(box10.getTextField().getText()) + ) { + isno=false; + } + if(jcb1.isSelected()||jcb2.isSelected()||jcb3.isSelected()||jcb4.isSelected()){ + if (jcb1.isSelected()) { + if ("".equals(box1.getTextField().getText()) + || "".equals(box2.getTextField().getText()) + || "".equals(box14.getTextField().getText()) + || "".equals(box4.getTextField().getText()) + || "".equals(box6.getTextField().getText()) + || ("".equals(getListtxt(mylist)) + && "".equals(jt23.getText()) && "".equals(jt24 + .getText()))) { + isno=false; + } + + + } else if (jcb2.isSelected()) { + if ("".equals(box3.getTextField().getText()) + ||"".equals(box15.getTextField().getText())) { + isno=false; + } + + } else if (jcb3.isSelected()) { + if ("".equals(box12.getTextField().getText()) + || "".equals(getListtxt(lllist))) { + isno=false; + } + + } + + }else{ + isno=false; + + } + + if(isno){ + if ("".equals(jt52.getText())) { + try { + String sysc = ""; + if (jr1.isSelected()) { + sysc = jr1.getText(); + } else if (jr2.isSelected()) { + sysc = jr2.getText(); + } + form.getTCProperty("jk8ApplyMarket").setStringValue( + sysc + ";" + jt44.getText());// гѡ + + String jcb_str = ""; + if (jcb1.isSelected()) { + jcb_str = jcb1.getText(); + } else if (jcb2.isSelected()) { + jcb_str = jcb2.getText(); + + } else if (jcb3.isSelected()) { + jcb_str = jcb3.getText(); + + } else if (jcb4.isSelected()) { + jcb_str = jcb4.getText(); + + } + form.getTCProperty("jk8ApplyType").setStringValue(jcb_str);// ܵѡ + +// form.getTCProperty("jk8CommunicateMode").setStringValue( +// getListtxt(txlist));// ͨģʽѡ + form.getTCProperty("jk8CommunicateMode").setStringValue( + box15.getTextField().getText());// ͨģʽѡ + + form.getTCProperty("jk8CivilMeter").setStringValue( + getListtxt(mylist));// ñ + + form.getTCProperty("jk8FlowSpecification").setStringValue( + getListtxt(lllist));// + + form.getTCProperty("jk8ProductName").setStringValue( + jtxt11.getText());// Ʒ + form.getTCProperty("jk8ProjectName").setStringValue( + jtxt12.getText());// Ŀ + form.getTCProperty("jk8ProjectNO").setStringValue( + jtxt13.getText());// Ŀ + form.getTCProperty("jk8MeasureType").setStringValue( + box1.getTextField().getText());// ԭ + form.getTCProperty("jk8ProductType1").setStringValue( + box2.getTextField().getText());// Ʒ1 + form.getTCProperty("jk8ShellType").setStringValue( + box3.getTextField().getText());// + form.getTCProperty("jk8BaseMeterShellType").setStringValue( + box4.getTextField().getText());// + form.getTCProperty("jk8ICCardPrepaidFunc").setStringValue( + box5.getTextField().getText());// ICԤ + form.getTCProperty("jk8InternetOfThingFunc").setStringValue( + box6.getTextField().getText()); // + form.getTCProperty("jk8TempPressCompFunc").setStringValue( + box7.getTextField().getText()); // ѹ + form.getTCProperty("jk8SecurityFunc").setStringValue( + box13.getTextField().getText()); // + + form.getTCProperty("jk8BMManufactor").setStringValue( + box8.getTextField().getText());// / + form.getTCProperty("jk8ProductType").setStringValue( + box9.getTextField().getText());// Ʒ + form.getTCProperty("jk8ContrlCompType").setStringValue( + box10.getTextField().getText());// + form.getTCProperty("jk8BillingMode").setStringValue( + box11.getTextField().getText());// Ʒѷʽ + form.getTCProperty("jk8MeterTypeShellMaterial").setStringValue( + box12.getTextField().getText());// ͼ + + form.getTCProperty("jk8WideRange").setStringValue( + box14.getTextField().getText());// + form.getTCProperty("jk8IndustrialMater").setStringValue( + jt23.getText());// ҵ + form.getTCProperty("jk8FowMeter") + .setStringValue(jt24.getText());// + form.getTCProperty("jk8FunctionOverview").setStringValue( + jt43.getText());// ܸ + // form.getTCProperty("jk_xcp_sysc").setStringValue(jt44.getText());// + // г3 + form.getTCProperty("jk8InsteadType").setStringValue( + jt45.getText());// ͺ + form.getTCProperty("jk8CircBoardModNO").setStringValue( + jt46.getText());// ·ͺ + form.getTCProperty("jk8ProgramFeatures").setStringValue( + jt47.getText());// + form.getTCProperty("jk8ICCardType").setStringValue( + jt48.getText());// ICͺ + form.getTCProperty("jk8CustSpecRequirements").setStringValue( + jt49.getText());// ͻҪ + form.getTCProperty("jk8ProductModNO").setStringValue( + jt51.getText());// Ʒͺ + form.getTCProperty("jk8ProductIdentifyNO").setStringValue( + jt52.getText());// ʶ + + form.getTCProperty("jk8Valve").setStringValue(jt10.getText());// + form.getTCProperty("jk8EncryptType").setStringValue( + jt11.getText());// + form.getTCProperty("jk8BMManfMatched").setStringValue( + jt12.getText());// + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } else { + MessageBox.post("ʶѴ,޷ٴα", "", MessageBox.ERROR); + } + }else{ + MessageBox.post("޷,ȷȫд!!", "", MessageBox.ERROR); + } + + } + + // ƴӶѡַ + private String getListtxt(List list) { + // TODO Auto-generated method stub + String txms = ""; + for (int i = 0; i < list.size(); i++) { + if (list.get(i).isSelected()) { + txms = txms + "" + list.get(i).getText(); + } + } + if (txms.length() > 1) { + txms = txms.substring(1); + } + return txms; + } + + // ÷ӵ߲ɱ༭ + public void setOwnerHave() { + try { + + String user = session.getUserName(); + String owning_user = form.getProperty("owning_user"); + // System.out.println("owning_user.indexOf(user)="+owning_user.indexOf(user)); + if (owning_user.indexOf(user) < 0) { + // tj.setEnabled(false); + jcb1.setEnabled(false); + jcb2.setEnabled(false); + jcb3.setEnabled(false); + jcb4.setEnabled(false); + jtxt11.setEnabled(false); + jtxt12.setEnabled(false); + jtxt13.setEnabled(false); + jt51.setEnabled(false); + jt52.setEnabled(false); + setJcb1(false); + setJcb2(false); + setJcb3(false); + setOther(false); + jt44.setEnabled(false); + + } + } catch (TCException e) { + System.out.println("ӵǷʱļеòȷҲ"); + e.printStackTrace(); + } + } + + // 1 + private void setJcbTxt1() { + // TODO Auto-generated method stub + box1.setText(""); + box2.setText(""); + box14.setText(""); + box4.setText(""); + box5.setText(""); + box6.setText(""); + box7.setText(""); + box13.setText(""); + jt23.setText(""); + jt24.setText(""); + for (int i = 0; i < mylist.size(); i++) { + mylist.get(i).setSelected(false); + } + + } + + // 2 + private void setJcbTxt2() { + // TODO Auto-generated method stub +// for (int i = 0; i < txlist.size(); i++) { +// txlist.get(i).setSelected(false); +// } + box15.setText(""); + box3.setText(""); + + } + + // 3 + private void setJcbTxt3() { + // TODO Auto-generated method stub + box12.setText(""); + for (int i = 0; i < lllist.size(); i++) { + lllist.get(i).setSelected(false); + } + } + + // ȼƷͺϢǼǷɱ༭ + private void setJcb1(boolean is) { + // TODO Auto-generated method stub + box1.setEnabled(is); + box2.setEnabled(is); + box14.setEnabled(is); + box4.setEnabled(is); + box5.setEnabled(is); + box6.setEnabled(is); + box7.setEnabled(is); + box13.setEnabled(is); + + jt24.setEnabled(is); + if (!is) {// isfalse,true + for (int i = 0; i < mylist.size(); i++) { + mylist.get(i).setEnabled(is); + } + jt23.setEnabled(is); + } + } + + // ɼƷͺϢǼǷɱ༭ + private void setJcb2(boolean is) { + // TODO Auto-generated method stub +// for (int i = 0; i < txlist.size(); i++) { +// txlist.get(i).setEnabled(is); +// } + box15.setEnabled(is); + box3.setEnabled(is); + } + + // еƷͺϢǼǷɱ༭ + private void setJcb3(boolean is) { + // TODO Auto-generated method stub + box12.setEnabled(is); + for (int i = 0; i < lllist.size(); i++) { + lllist.get(i).setEnabled(is); + } + } + + // ·Ƿɱ༭ + private void setOther(boolean is) { + // TODO Auto-generated method stub + box8.setEnabled(is); + box9.setEnabled(is); + box10.setEnabled(is); + box11.setEnabled(is); + jt43.setEnabled(is); + // jt44.setEnabled(is); + jt45.setEnabled(is); + jt46.setEnabled(is); + jt47.setEnabled(is); + jt48.setEnabled(is); + jt49.setEnabled(is); + jt10.setEnabled(is); + jt11.setEnabled(is); + jt12.setEnabled(is); + jr1.setEnabled(is); + jr2.setEnabled(is); + } + + private void setLxEn() { + String str = box2.getTextField().getText(); + for (int i = 0; i < mylist.size(); i++) { + mylist.get(i).setEnabled(false); + } + jt23.setEnabled(false); + jt24.setEnabled(false); + if (str.equals("ñ")) { + for (int i = 0; i < mylist.size(); i++) { + mylist.get(i).setEnabled(true); + } + jt23.setText(""); + jt24.setText(""); + } else if (str.equals("ҵ")) { + for (int i = 0; i < mylist.size(); i++) { + mylist.get(i).setSelected(false); + } + jt23.setEnabled(true); + jt24.setText(""); + } else if (str.equals("")) { + for (int i = 0; i < mylist.size(); i++) { + mylist.get(i).setSelected(false); + } + jt23.setText(""); + jt24.setEnabled(true); + + } + } + private ButtonGroup groupklc=new ButtonGroup(); + // ֻܵѡ + private void setIsKlc() { + // TODO Auto-generated method stub + String str = box14.getTextField().getText(); + if("".equals(str)){ + + boolean issel=false; + for (int i = 0; i < mylist.size(); i++) { + groupklc.add(mylist.get(i)); +// if(issel){ +// mylist.get(i).setSelected(false); +// } +// if(mylist.get(i).isSelected()){ +// issel=true; +// } + } + + + + }else{ + for (int i = 0; i < mylist.size(); i++) { + groupklc.remove(mylist.get(i)); + } + + } + } + + private JLabel getjl() { + JLabel bt = new JLabel("*"); + bt.setForeground(Color.red); + return bt; + } +} diff --git a/src/com/teamcenter/rac/form/JK8_SBH_Form.java b/src/com/teamcenter/rac/form/JK8_SBH_Form.java new file mode 100644 index 0000000..3159588 --- /dev/null +++ b/src/com/teamcenter/rac/form/JK8_SBH_Form.java @@ -0,0 +1,1245 @@ +package com.teamcenter.rac.form; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionListener; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import java.util.HashMap; +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextField; + +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.stylesheet.AbstractRendering; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; + +//2вƷͺţ²Ʒʶ +public class JK8_SBH_Form extends AbstractRendering { + /** + * + */ + private static final long serialVersionUID = 1L; + private TCComponentForm form; + private TCSession session; + // private JButton tijiao; + private JButton yanzhen; + private JPanel mainPanel; + + private JPanel firstJPanel; + private JPanel firstJPanel_1; + private JPanel secondJPanel; + private JPanel secondJPanel_1; + private JPanel secondJPanel_2; + private JPanel secondJPanel_3; + private JPanel secondJPanel_4; + private JPanel secondJPanel_5; + private JPanel secondJPanel_6; + private JPanel thirdJPanel; + private JScrollPane jsp; + // private Registry registry = null; +// private ButtonGroup group; + private JPanel topJPanel; +// private JPanel charu1; +// private JPanel charu2; + + private JLabel jl1; + private JLabel jl2; + private JLabel jl3; + private JLabel jl4; + + + + private JTextField jt01;// Ŀ + private JTextField jt02;// Ŀ + private JTextField jt03;// ֤ + private JTextField jt04;// ֤ + private JTextField jt05;// ʼ + private JTextField jt06;// ע + private JTextField jt1; +// private JTextArea jt2 ; +// private JTextField jt3; +// private JTextField jt4; +// private JTextField jt5; +// private JTextField jt6; +// private JTextField jt7; +// private JTextField jt8; + private JTextField jt9; +// private JTextField jt10;// +// private JTextField jt11;// +// private JTextField jt12;// + + private JTextField jt13;//ͻ + + private JAutoCompleteComboBox box1 = new JAutoCompleteComboBox();// + private JAutoCompleteComboBox box2 = new JAutoCompleteComboBox();// Ʒ + private JAutoCompleteComboBox box3 = new JAutoCompleteComboBox();// + private JAutoCompleteComboBox box4 = new JAutoCompleteComboBox();// ˮ + private JAutoCompleteComboBox box5 = new JAutoCompleteComboBox();// Ʒ + private JAutoCompleteComboBox box6 = new JAutoCompleteComboBox();// ģ + private JAutoCompleteComboBox box7 = new JAutoCompleteComboBox();// оƬ + private JAutoCompleteComboBox box8 = new JAutoCompleteComboBox();// Э + private JAutoCompleteComboBox box9 = new JAutoCompleteComboBox();// ֹ淧 + private JAutoCompleteComboBox box10 = new JAutoCompleteComboBox();// ȡѹ + private JAutoCompleteComboBox box11 = new JAutoCompleteComboBox();// ƤĤ + private JAutoCompleteComboBox box12 = new JAutoCompleteComboBox();// е² + private JAutoCompleteComboBox box13 = new JAutoCompleteComboBox();// + private JAutoCompleteComboBox box14 = new JAutoCompleteComboBox();// ɹʽ + private JAutoCompleteComboBox box15 = new JAutoCompleteComboBox();// ɫ + private JAutoCompleteComboBox box16 = new JAutoCompleteComboBox();// ת + private JAutoCompleteComboBox box17 = new JAutoCompleteComboBox();// + private JAutoCompleteComboBox box18 = new JAutoCompleteComboBox();// ۻר + private JAutoCompleteComboBox box19 = new JAutoCompleteComboBox();// װlogo + private JAutoCompleteComboBox box20 = new JAutoCompleteComboBox();// ÿ̨ + private JAutoCompleteComboBox box21 = new JAutoCompleteComboBox();// Ʒlogo + private JAutoCompleteComboBox box22 = new JAutoCompleteComboBox();// ⲿ + private JAutoCompleteComboBox box23 = new JAutoCompleteComboBox();// ַ + private JAutoCompleteComboBox box24 = new JAutoCompleteComboBox();// ܵ + private JAutoCompleteComboBox box25 = new JAutoCompleteComboBox();// ʱ﮵ + private JAutoCompleteComboBox box26 = new JAutoCompleteComboBox();// ϴ + private JAutoCompleteComboBox box27 = new JAutoCompleteComboBox();// Ʒʽ + private JAutoCompleteComboBox box28 = new JAutoCompleteComboBox();// ûѷʽ + private JAutoCompleteComboBox box29 = new JAutoCompleteComboBox();// ICͺ + private JAutoCompleteComboBox box30 = new JAutoCompleteComboBox();// + + private JAutoCompleteComboBox box31 = new JAutoCompleteComboBox();// + private JAutoCompleteComboBox box32 = new JAutoCompleteComboBox();// Ʒϵ + +// private iComboBox box1 = new iComboBox();// / +// private iComboBox box2 = new iComboBox();// Ʒ +// private iComboBox box3 = new iComboBox();// +// private iComboBox box4 = new iComboBox();// Ʒѷʽ + +// private JRadioButton radioButton1; +// private JRadioButton radioButton2; +// private String sysc = "";// г + private HashMap realNameMap;// lovѡֵ + private String jt;// Ʒͺ + + private String isCheck; + private boolean is = false; + + public JK8_SBH_Form(TCComponentForm arg0) throws Exception { + super(arg0); + // Auto-generated constructor stub + try { + form = arg0; + session = arg0.getSession(); + // registry = Registry.getRegistry(this); + String[] names = session.getPreferenceService().getStringValues("JK_CPXH_FORM"); + if (names != null) { + + realNameMap = new HashMap<>(); + for (int i = 0; i < names.length; i++) { + String[] s = names[i].split("="); + if (s != null && s.length == 2) { + String key = s[0]; + String value = s[1]; + realNameMap.put(key, value); + } + + } + + } else { + MessageBox.post("ѡ JK_CPXH_FORM ڣϵԱ", "", MessageBox.ERROR); + } + initializeUI(); + loadRendering(); + + mainPanel.addMouseMotionListener(new MouseMotionListener() { + + @Override + public void mouseMoved(MouseEvent e) { + // Auto-generated method stub + try { + isCheck = form.getTCProperty("fnd0IsCheckoutable") + .getDisplayableValue(); + } catch (TCException e1) { + // Auto-generated catch block + e1.printStackTrace(); + } + if ("".equals(isCheck)) { +// MessageBox.post("is="+String.valueOf(is),"",MessageBox.INFORMATION); + seten(is); + setOwnerHave(); + } + } + + @Override + public void mouseDragged(MouseEvent e) { + // Auto-generated method stub + + } + }); + +// if (!radioButton2.isSelected()) { +// jt3.setEnabled(false); +// } + jt9.setEnabled(false); + + }catch(Exception e) { + e.printStackTrace(); + //ӡ쳣 + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + e.printStackTrace(new PrintStream(baos)); + String exception = "formͣ"+form.getType()+"\n"; + exception += baos.toString(); + MessageBox.post(exception,"쳣",MessageBox.INFORMATION); + } + + } + + @SuppressWarnings("unchecked") + private void setLOV(JAutoCompleteComboBox box, String st, int length) { + // Auto-generated method stub +// box.setAutoCompleteSuggestive(false); +// box.addItems(realNameMap.get(st).split(",")); + +// box.removeAll(); +// box.removeAllItems(); + box.addItem(""); + String[] temparr = realNameMap.get(st).split(","); +// System.out.println(st+">>"+Arrays.toString(temparr)); + for(String s: temparr) { + box.addItem(s); + } + box.setTextLength(length); + } + + public void initializeUI() { +// System.out.println("UI-----Start"); + setLayout(new BorderLayout()); + //initPanel(); + + jsp = new JScrollPane(initPanel()); + jsp.setPreferredSize(new Dimension(450, 490)); + jsp.getVerticalScrollBar().setUnitIncrement(20); + + add(jsp, "Center"); + this.setVisible(true); + this.setBackground(Color.lightGray); + } + + @SuppressWarnings("unchecked") + public JPanel initPanel() { +// System.out.println("--------------------------"); + mainPanel = new JPanel(new PropertyLayout()); + this.setSize(new Dimension(650, 260)); + jt01 = new JTextField(20); + jt02 = new JTextField(20); + jt03 = new JTextField(10); + jt04 = new JTextField(10); + jt05 = new JTextField(30); + jt06 = new JTextField(30); + jt1 = new JTextField(20); +// jt2 =new JTextArea(3,20); +// jt3 = new JTextField(20); +// jt4 = new JTextField(20); +// jt5 = new JTextField(20); +// jt6 = new JTextField(20); +// jt7 = new JTextField(20); +// jt8 = new JTextField(20); + jt9 = new JTextField(30); +// jt10 = new JTextField(20); +// jt11 = new JTextField(20); +// jt12 = new JTextField(20); + jt13 = new JTextField(20); + + jl1 = new JLabel(" ²Ʒʶ뵥"); + jl1.setFont(new Font("", 1, 24)); + jl2 = new JLabel(" Ʒ"); + jl2.setFont(new Font("", 1, 18)); + jl3 = new JLabel(" &ֵ"); + jl3.setFont(new Font("", 1, 18)); + jl4 = new JLabel(" Ӳѡ"); + jl4.setFont(new Font("", 1, 18)); + + topJPanel = new JPanel(new PropertyLayout()); + topJPanel.add("1.1.left.top.preferred.preferred", jl1); + topJPanel.add("1.2.left.top.preferred.preferred", new JLabel(" ")); + // tijiao = new JButton("ύ"); + // tijiao.setPreferredSize(new Dimension(70, 30)); + // topJPanel.add("1.3.left.top.preferred.preferred", tijiao); + + firstJPanel = new JPanel(new PropertyLayout()); + firstJPanel.add("1.1.left.top.preferred.preferred", new JLabel("Ʒͺ:")); + firstJPanel.add("1.2.right.top.preferred.preferred", getjl()); + firstJPanel.add("1.3.left.top.preferred.preferred", jt1); + firstJPanel.add("1.4.left.top.preferred.preferred", new JLabel(" ")); + yanzhen = new JButton("֤Ʒͺ"); + firstJPanel.add("1.5.left.top.preferred.preferred", yanzhen); + firstJPanel.add("2.1.left.top.preferred.preferred", new JLabel("Ŀ:")); + firstJPanel.add("2.2.right.top.preferred.preferred", getjl()); + firstJPanel.add("2.3.left.top.preferred.preferred", jt01); + firstJPanel.add("3.1.left.top.preferred.preferred", new JLabel("Ŀ:")); + firstJPanel.add("3.2.right.top.preferred.preferred", getjl()); + firstJPanel.add("3.3.left.top.preferred.preferred", jt02); + yanzhen.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // Auto-generated method stub + System.out.println("֤"); + yzbut(); + } + }); + + + firstJPanel_1 = new JPanel(new PropertyLayout()); + firstJPanel_1.add("1.1.left.top.preferred.preferred", new JLabel(":")); + firstJPanel_1.add("1.2.right.top.preferred.preferred", getjl()); + firstJPanel_1.add("1.3.left.top.preferred.preferred", box1); + setLOV(box1,"",15); + + firstJPanel_1.add("1.4.left.top.preferred.preferred",new JLabel(" ")); + firstJPanel_1.add("1.5.left.top.preferred.preferred", new JLabel("Ʒ:")); + firstJPanel_1.add("1.6.right.top.preferred.preferred", getjl()); + firstJPanel_1.add("1.7.left.top.preferred.preferred", box2); + setLOV(box2,"Ʒ",15); + + firstJPanel_1.add("2.1.left.top.preferred.preferred", new JLabel(":")); + firstJPanel_1.add("2.2.right.top.preferred.preferred", getjl()); + firstJPanel_1.add("2.3.left.top.preferred.preferred", box3); + setLOV(box3,"",15); + + firstJPanel_1.add("2.4.left.top.preferred.preferred",new JLabel(" ")); + firstJPanel_1.add("2.5.left.top.preferred.preferred", new JLabel(" ˮ:")); + firstJPanel_1.add("2.6.right.top.preferred.preferred", getjl()); + firstJPanel_1.add("2.7.left.top.preferred.preferred", box4); + + for(int i = 0;i<100;i++) { + String temp = String.format("%02d", i); + box4.addItem(temp); + } + box4.setTextLength(15); + //TODO + firstJPanel_1.add("3.1.left.top.preferred.preferred", new JLabel("߻:")); + firstJPanel_1.add("3.2.right.top.preferred.preferred", getjl()); + firstJPanel_1.add("3.3.left.top.preferred.preferred", box31); + setLOV(box31, "߻", 15); + + firstJPanel_1.add("3.4.left.top.preferred.preferred",new JLabel(" ")); + firstJPanel_1.add("3.5.left.top.preferred.preferred", new JLabel(" ͻ:")); + firstJPanel_1.add("3.6.right.top.preferred.preferred", getjl()); + firstJPanel_1.add("3.7.left.top.preferred.preferred", jt13); + + secondJPanel = new JPanel(new PropertyLayout()); + secondJPanel.add("1.1.left.top.preferred.prefereed",jl2); + + secondJPanel_1 = new JPanel(new PropertyLayout()); + secondJPanel_1.add("1.1.left.top.preferred.preferred", new JLabel("Ʒϵ:")); + secondJPanel_1.add("1.2.left.top.preferred.preferred", box32); + setLOV(box32,"Ʒϵ",10); + secondJPanel_1.add("2.1.left.top.preferred.preferred",new JLabel("Ʒ:")); + secondJPanel_1.add("2.2.left.top.preferred.preferred",box5); + setLOV(box5,"Ʒ",10); + secondJPanel_1.add("2.3.left.top.preferred.preferred",new JLabel(" ֤:")); + secondJPanel_1.add("2.4.left.top.preferred.preferred",jt03); + secondJPanel_1.add("2.5.left.top.preferred.preferred",new JLabel(" ֤:")); + secondJPanel_1.add("2.6.left.top.preferred.preferred",jt04); + secondJPanel_1.add("3.1.left.top.preferred.preferred",new JLabel(" ģ:")); + secondJPanel_1.add("3.2.left.top.preferred.preferred",box6); + setLOV(box6,"ģ",10); + secondJPanel_1.add("3.3.left.top.preferred.preferred",new JLabel(" оƬ:")); + secondJPanel_1.add("3.4.left.top.preferred.preferred",box7); + setLOV(box7,"оƬ",10); + secondJPanel_1.add("3.5.left.top.preferred.preferred",new JLabel(" Э:")); + secondJPanel_1.add("3.6.left.top.preferred.preferred",box8); + setLOV(box8,"Э",10); + + secondJPanel_2 = new JPanel(new PropertyLayout()); + secondJPanel_2.add("1.1.left.top.preferred.prefereed",jl3); + + secondJPanel_3 = new JPanel(new PropertyLayout()); + secondJPanel_3.add("1.1.left.top.preferred.preferred",new JLabel(" ֹ淧:")); + secondJPanel_3.add("1.2.left.top.preferred.preferred",box9); + setLOV(box9,"ֹ淧",10); + + secondJPanel_3.add("1.3.left.top.preferred.preferred",new JLabel(" ")); + secondJPanel_3.add("1.4.left.top.preferred.preferred",new JLabel(" ȡѹ:")); + secondJPanel_3.add("1.5.left.top.preferred.preferred",box10); + setLOV(box10, "ȡѹ", 10); + + secondJPanel_3.add("1.6.left.top.preferred.preferred",new JLabel(" ")); + secondJPanel_3.add("1.7.left.top.preferred.preferred",new JLabel("ƤĤ:")); + secondJPanel_3.add("1.8.left.top.preferred.preferred",box11); + setLOV(box11, "ƤĤ", 10); + + secondJPanel_3.add("2.1.left.top.preferred.preferred",new JLabel("е²:")); + secondJPanel_3.add("2.2.left.top.preferred.preferred",box12); + setLOV(box12,"е²",10); + + secondJPanel_3.add("2.3.left.top.preferred.preferred",new JLabel(" ")); + secondJPanel_3.add("2.4.left.top.preferred.preferred",new JLabel(" :")); + secondJPanel_3.add("2.5.left.top.preferred.preferred",box13); + setLOV(box13, "", 10); + + secondJPanel_3.add("2.6.left.top.preferred.preferred",new JLabel(" ")); + secondJPanel_3.add("2.7.left.top.preferred.preferred",new JLabel("ɹʽ:")); + secondJPanel_3.add("2.8.left.top.preferred.preferred",box14); + setLOV(box14, "ɹʽ", 10); + + secondJPanel_3.add("3.1.left.top.preferred.preferred",new JLabel("ɫ:")); + secondJPanel_3.add("3.2.left.top.preferred.preferred",box15); + setLOV(box15,"ɫ",10); + + secondJPanel_3.add("3.3.left.top.preferred.preferred",new JLabel(" ")); + secondJPanel_3.add("3.4.left.top.preferred.preferred",new JLabel("ת:")); + secondJPanel_3.add("3.5.left.top.preferred.preferred",box16); + setLOV(box16, "ת", 10); + + secondJPanel_3.add("3.6.left.top.preferred.preferred",new JLabel(" ")); + secondJPanel_3.add("3.7.left.top.preferred.preferred",new JLabel(" :")); + secondJPanel_3.add("3.8.left.top.preferred.preferred",box17); + setLOV(box17, "", 10); + + secondJPanel_3.add("4.1.left.top.preferred.preferred",new JLabel("ۻר:")); + secondJPanel_3.add("4.2.left.top.preferred.preferred",box18); + setLOV(box18,"ۻר",10); + + secondJPanel_3.add("4.3.left.top.preferred.preferred",new JLabel(" ")); + secondJPanel_3.add("4.4.left.top.preferred.preferred",new JLabel("װlogo:")); + secondJPanel_3.add("4.5.left.top.preferred.preferred",box19); + setLOV(box19, "װlogo", 10); + + secondJPanel_3.add("4.6.left.top.preferred.preferred",new JLabel(" ")); + secondJPanel_3.add("4.7.left.top.preferred.preferred",new JLabel("ÿ̨:")); + secondJPanel_3.add("4.8.left.top.preferred.preferred",box20); + setLOV(box20, "ÿ̨", 10); + + secondJPanel_3.add("5.1.left.top.preferred.preferred",new JLabel("Ʒlogo:")); + secondJPanel_3.add("5.2.left.top.preferred.preferred",box21); + setLOV(box21,"Ʒlogo",10); + + secondJPanel_4 = new JPanel(new PropertyLayout()); + secondJPanel_4.add("1.1.left.top.preferred.prefereed",jl4); + + secondJPanel_5 = new JPanel(new PropertyLayout()); + secondJPanel_5.add("1.1.left.top.preferred.preferred",new JLabel("ⲿ:")); + secondJPanel_5.add("1.2.left.top.preferred.preferred",box22); + setLOV(box22,"ⲿ",10); + + secondJPanel_5.add("1.3.left.top.preferred.preferred",new JLabel(" ")); + secondJPanel_5.add("1.4.left.top.preferred.preferred",new JLabel("ַ:")); + secondJPanel_5.add("1.5.left.top.preferred.preferred",box23); + setLOV(box23, "ַ", 10); + + secondJPanel_5.add("1.6.left.top.preferred.preferred",new JLabel(" ")); + secondJPanel_5.add("1.7.left.top.preferred.preferred",new JLabel("ܵ:")); + secondJPanel_5.add("1.8.left.top.preferred.preferred",box24); + setLOV(box24, "ܵ", 10); + + secondJPanel_5.add("2.1.left.top.preferred.preferred",new JLabel("ʱ﮵:")); + secondJPanel_5.add("2.2.left.top.preferred.preferred",box25); + setLOV(box25,"ʱ﮵",10); + + secondJPanel_5.add("2.3.left.top.preferred.preferred",new JLabel(" ")); + secondJPanel_5.add("2.4.left.top.preferred.preferred",new JLabel("ϴ:")); + secondJPanel_5.add("2.5.left.top.preferred.preferred",box26); + setLOV(box26, "ϴ", 10); + + secondJPanel_5.add("3.1.left.top.preferred.preferred",new JLabel("Ʒʽ:")); + secondJPanel_5.add("3.2.left.top.preferred.preferred",box27); + setLOV(box27,"Ʒʽ",10); + + secondJPanel_5.add("3.3.left.top.preferred.preferred",new JLabel(" ")); + secondJPanel_5.add("3.4.left.top.preferred.preferred",new JLabel("ûѷʽ:")); + secondJPanel_5.add("3.5.left.top.preferred.preferred",box28); + setLOV(box28, "ûѷʽ", 10); + + secondJPanel_5.add("4.1.left.top.preferred.preferred",new JLabel("ICͺ:")); + secondJPanel_5.add("4.2.left.top.preferred.preferred",box29); + setLOV(box29,"ICͺ",10); + + secondJPanel_5.add("4.3.left.top.preferred.preferred",new JLabel(" ")); + secondJPanel_5.add("4.4.left.top.preferred.preferred",new JLabel(":")); + secondJPanel_5.add("4.5.left.top.preferred.preferred",box30); + setLOV(box30, "", 10); + + secondJPanel_6 = new JPanel(new PropertyLayout()); + secondJPanel_6.add("1.1.left.top.preferred.preferred",new JLabel("ʼ:")); + secondJPanel_6.add("1.2.left.top.preferred.preferred",jt05); + secondJPanel_6.add("2.1.left.top.preferred.preferred",new JLabel(" ע:")); + secondJPanel_6.add("2.2.left.top.preferred.preferred",jt06); + + box1.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // Auto-generated method stub + String text = box1.getText(); + if(text!=null) { + if(text.equals("J-")) { + box9.setText("ѡ");// ֹ淧 + box10.setText("");// ȡѹ + box11.setText("ѡ");// ƤĤ + box12.setText("");// е² + box13.setText("ѡ");// + box14.setText("ѡ");// ɹʽ + box15.setText("ɫ");// ɫ + box16.setText("0.9");// ת + box17.setText("÷");// + box18.setText("ѡ");// ۻר + box19.setText("ѡ");// װlogo + box19.setEnabled(false);// װlogo + box20.setText("ѡ");// ÿ̨ + box21.setText("ѡ");// Ʒlogo + box22.setText("");// ⲿ + box23.setText("");// ַ + box24.setText("");// ܵ + box25.setText("");// ʱ﮵ + box26.setText("");// ϴ + box27.setText("");// Ʒʽ + box28.setText("");// ûѷʽ + }else { + box9.setText("ѡ");// ֹ淧 + box10.setText("ѡ");// ȡѹ + box11.setText("ѡ");// ƤĤ + box12.setText("ѡ");// е² + box13.setText("ѡ");// + box14.setText("ѡ");// ɹʽ + box15.setText("ɫ");// ɫ + box16.setText("1.2");// ת + box17.setText("÷");// + box18.setText("ѡ");// ۻר + box19.setText("ѡ");// װlogo + box20.setText("ѡ");// ÿ̨ + box21.setText("ѡ");// Ʒlogo + box21.setEnabled(false);// Ʒlogo + box22.setText("");// ⲿ + box23.setText("");// ַ + box24.setText("");// ܵ + box25.setText("");// ʱ﮵ + box26.setText("");// ϴ + box27.setText("");// Ʒʽ + box28.setText("");// ûѷʽ + } + } + } + }); + + + +// charu1 = new JPanel(new PropertyLayout()); +// charu1.add("1.1.left.top.preferred.preferred", jl2); +// +// charu2 = new JPanel(new PropertyLayout()); +// charu2.add("1.1.left.top.preferred.preferred", +// new JLabel(" /:")); +// charu2.add("1.2.right.top.preferred.preferred", getjl()); +// setLov(box1, "/"); +// charu2.add("1.3.left.top.preferred.preferred", box1); +// charu2.add("2.1.left.top.preferred.preferred", new JLabel(" Ʒ:")); +// charu2.add("2.2.right.top.preferred.preferred", getjl()); +// // Ʒ +// setLov(box2, "Ʒ"); +// charu2.add("2.3.left.top.preferred.preferred", box2); +// charu2.add("3.1.left.top.preferred.preferred", new JLabel(" :")); +// // +// setLov(box3, ""); +// charu2.add("3.2.right.top.preferred.preferred", getjl()); +// charu2.add("3.3.left.top.preferred.preferred", box3); +// +// secondJPanel = new JPanel(new PropertyLayout()); +// secondJPanel_1 = new JPanel(new PropertyLayout()); +// secondJPanel_1.add("1.1.left.top.preferred.preferred", new JLabel( +// " Ʒѷʽ ")); +// setLov(box4, "Ʒѷʽ"); +// secondJPanel_1.add("1.2.left.top.preferred.preferred", box4); +// secondJPanel_1.add("2.1.left.top.preferred.preferred", new JLabel( +// " г")); +// radioButton1 = new JRadioButton("ͨ");// ѡť +// radioButton2 = new JRadioButton("ר");// ѡť +// radioButton1.addActionListener(new ActionListener() { +// +// @Override +// public void actionPerformed(ActionEvent e) { +// // Auto-generated method stub +// if (radioButton1.isSelected()) { +// jt3.setText(""); +// jt3.setEnabled(false); +// } +// } +// }); +// radioButton2 = new JRadioButton("ר");// ѡť +// radioButton2.addActionListener(new ActionListener() { +// +// @Override +// public void actionPerformed(ActionEvent e) { +// // Auto-generated method stub +// if (radioButton2.isSelected()) { +// jt3.setEnabled(true); +// } +// } +// }); +// group = new ButtonGroup(); +// group.add(radioButton1); +// group.add(radioButton2); +// secondJPanel_1.add("2.2.left.top.preferred.preferred", radioButton1); +// secondJPanel_1.add("2.3.left.top.preferred.preferred", radioButton2); +// secondJPanel_1.add("2.4.left.top.preferred.preferred", jt3); +// secondJPanel_1.add("3.1.left.top.preferred.preferred", new JLabel( +// " ·ͺţ")); +// secondJPanel_1.add("3.2.left.top.preferred.preferred", jt5); +// secondJPanel_1.add("4.1.left.top.preferred.preferred", new JLabel( +// " ICͺţ")); +// secondJPanel_1.add("4.2.left.top.preferred.preferred", jt7); +// +// secondJPanel_1.add("5.1.left.top.preferred.preferred", new JLabel( +// " ţ")); +// secondJPanel_1.add("5.2.left.top.preferred.preferred", jt10); +// +// secondJPanel_1.add("6.1.left.top.preferred.preferred", new JLabel( +// " ")); +// secondJPanel_1.add("7.1.left.top.preferred.preferred", new JLabel( +// " ׳ң")); +// secondJPanel_1.add("7.2.left.top.preferred.preferred", jt12); +// +// secondJPanel_2 = new JPanel(new PropertyLayout()); +// +// JScrollPane jspane1=new JScrollPane(jt2); +// jt2.setLineWrap(true); +// secondJPanel_2.add("1.1.left.top.preferred.preferred", new JLabel( +// " ܸ ")); +// secondJPanel_2.add("1.2.left.top.preferred.preferred", getjl()); +// secondJPanel_2.add("1.3.left.top.preferred.preferred", jspane1);//2019.6.24 Ĺܸ Ҫ +// secondJPanel_2.add("2.1.left.top.preferred.preferred", new JLabel( +// " ͺţ ")); +// secondJPanel_2.add("2.2.left.top.preferred.preferred", jt4); +// +// secondJPanel_2.add("3.1.left.top.preferred.preferred", new JLabel( +// " ")); +// secondJPanel_2.add("3.2.left.top.preferred.preferred", jt6); +// +// secondJPanel_2.add("4.1.left.top.preferred.preferred", new JLabel( +// " ͻҪ")); +// secondJPanel_2.add("4.2.left.top.preferred.preferred", jt8); +// secondJPanel_2.add("5.1.left.top.preferred.preferred", new JLabel( +// " ͣ")); +// secondJPanel_2.add("5.2.left.top.preferred.preferred", jt11); +// secondJPanel.add("1.1.left.top.preferred.preferred", secondJPanel_1); +// secondJPanel.add("1.2.left.top.preferred.preferred", secondJPanel_2); + + thirdJPanel = new JPanel(new PropertyLayout()); + thirdJPanel.add("1.1.left.top.preferred.preferred", new JLabel(" ʶ:")); + thirdJPanel.add("1.2.left.top.preferred.preferred", jt9); + + mainPanel.add("1.1.left.top.preferred.preferred", topJPanel); + mainPanel.add("2.1.left.top.preferred.preferred", firstJPanel); + mainPanel.add("3.1.left.top.preferred.preferred", firstJPanel_1); + mainPanel.add("4.1.left.top.preferred.preferred", secondJPanel); + mainPanel.add("5.1.left.top.preferred.preferred", secondJPanel_1); + mainPanel.add("6.1.left.top.preferred.preferred", secondJPanel_2); + mainPanel.add("7.1.left.top.preferred.preferred", secondJPanel_3); + mainPanel.add("8.1.left.top.preferred.preferred", secondJPanel_4); + mainPanel.add("9.1.left.top.preferred.preferred", secondJPanel_5); + mainPanel.add("10.1.left.top.preferred.preferred", secondJPanel_6); + mainPanel.add("11.1.left.top.preferred.preferred", thirdJPanel); + return mainPanel; + } + + @Override + public void loadRendering() throws TCException { + System.out.println("loadRendering"); + jt1.setText(form.getTCProperty("jk8ProductModNO").getStringValue());// Ʒͺ + jt01.setText(form.getTCProperty("jk8ProjectName").getStringValue());// Ŀ + jt02.setText(form.getTCProperty("jk8ProjectNO").getStringValue());// Ŀ + String jk8BMManufactor = form.getTCProperty("jk8BMManufactor").getStringValue();// / + box1.setText(jk8BMManufactor); + System.out.println("ǰң"+jk8BMManufactor); + if("J-".equals(jk8BMManufactor)) { + box19.setEnabled(false); + }else { + box21.setEnabled(false); + } +// box2.setText(form.getTCProperty("jk8ProductType").getStringValue());// Ʒ + box2.setText(form.getTCProperty("jk8ProductType_select").getStringValue());// Ʒ + box3.setText(form.getTCProperty("jk8ContrlCompType").getStringValue());// +// String jk8ProductIdentifyNO = form.getTCProperty("jk8ProductIdentifyNO").getStringValue();//ʶ +// if(jk8ProductIdentifyNO!=null&&jk8ProductIdentifyNO.length()>0) { +// box4.setText(jk8ProductIdentifyNO.substring(jk8ProductIdentifyNO.length()-2));// ˮ +// } + box4.setText(form.getTCProperty("jk8SerialCode").getStringValue()); + box5.setText(form.getTCProperty("jk8ProductName").getStringValue()); + box6.setText(form.getTCProperty("jk8Module").getStringValue()); + box7.setText(form.getTCProperty("jk8Chip").getStringValue()); + box8.setText(form.getTCProperty("jk8Agreement").getStringValue()); + box9.setText(form.getTCProperty("jk8BackstopValve").getStringValue()); + box10.setText(form.getTCProperty("jk8PressureTap").getStringValue()); + box11.setText(form.getTCProperty("jk8ImpSkin").getStringValue()); + box12.setText(form.getTCProperty("jk8MechTempC").getStringValue()); + box13.setText(form.getTCProperty("jk8WideRange").getStringValue()); + box14.setText(form.getTCProperty("jk8BMBuy").getStringValue()); + box15.setText(form.getTCProperty("jk8BMColor").getStringValue()); + box16.setText(form.getTCProperty("jk8GyratoryVolume").getStringValue()); + box17.setText(form.getTCProperty("jk8Valve").getStringValue()); + box18.setText(form.getTCProperty("jk8ForHK").getStringValue()); + box19.setText(form.getTCProperty("jk8PackageLogo").getStringValue()); + box20.setText(form.getTCProperty("jk8PerBoxUnits").getStringValue()); + box21.setText(form.getTCProperty("jk8ProductLogo").getStringValue()); + box22.setText(form.getTCProperty("jk8ExAlarm").getStringValue()); + box23.setText(form.getTCProperty("jk8FaceAntiRemove").getStringValue()); + box24.setText(form.getTCProperty("jk8PipeAntiRemove").getStringValue()); + box25.setText(form.getTCProperty("jk8ClockLiBattey").getStringValue()); + box26.setText(form.getTCProperty("jk8UploadPowerFail").getStringValue()); + box27.setText(form.getTCProperty("jk8SupplyMode").getStringValue()); + box28.setText(form.getTCProperty("jk8UserPayMethod").getStringValue()); + box29.setText(form.getTCProperty("jk8ICCardType").getStringValue()); + box30.setText(form.getTCProperty("jk8EncryptType").getStringValue()); + box31.setText(form.getTCProperty("jk8Customized").getStringValue()); + box32.setText(form.getTCProperty("jk8ProductFamily").getStringValue()); + + jt03.setText(form.getTCProperty("jk8FlameproofType").getStringValue()); + jt04.setText(form.getTCProperty("jk8TypeCerNo").getStringValue()); + jt05.setText(form.getTCProperty("jk8InitConfig").getStringValue()); + jt06.setText(form.getTCProperty("jk8Remarks").getStringValue()); + + +// box4.setText(form.getTCProperty("jk8BillingMode").getStringValue());// Ʒѷʽ +// jt5.setText(form.getTCProperty("jk8CircBoardModNO").getStringValue());// ·ͺ +// jt2.setText(form.getTCProperty("jk8FunctionOverview").getStringValue());// ܸ +// jt4.setText(form.getTCProperty("jk8InsteadType").getStringValue());// ͺ +// jt6.setText(form.getTCProperty("jk8ProgramFeatures").getStringValue());// +// jt8.setText(form.getTCProperty("jk8CustSpecRequirements").getStringValue());// ͻҪ +// jt7.setText(form.getTCProperty("jk8ICCardType").getStringValue());// ICͺ +// jt10.setText(form.getTCProperty("jk8Valve").getStringValue());// +// jt11.setText(form.getTCProperty("jk8EncryptType").getStringValue());// +// jt12.setText(form.getTCProperty("jk8BMManfMatched").getStringValue());// + + jt9.setText(form.getTCProperty("jk8ProductIdentifyNO").getStringValue());// ʶ + jt13.setText(form.getTCProperty("jk8Customer").getStringValue()); + +// sysc = form.getTCProperty("jk8ApplyMarket").getStringValue();// гѡֵ +// if (sysc.equals("ͨ")) { +// radioButton1.setSelected(true); +// } else if (sysc.contains("ר")) { +// radioButton2.setSelected(true); +// String[] strs=form.getTCProperty("jk8ApplyMarket").getStringValue().split(";"); +// if(strs!=null&&strs.length>1){ +// jt3.setText(strs[1]);// ר +// } +// } + + } + + /*@Override + public Map getRenderingModified() { + Map modifiedRendering = new HashMap (); + try { + System.out.println("getRenderingModifiedʼ"); + saveRendering(); + }catch(Exception ex){ + ex.toString(); + System.out.println(ex.toString()); + } + + + return modifiedRendering; + }*/ + + public boolean isRenderingModified() { + System.out.println("isRenderingModified"); + + try { + + if(isrend(form.getTCProperty("jk8ProductModNO"),jt1.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ProjectName"),jt01.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ProjectNO"),jt02.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8BMManufactor"),box1.getText())){ + return true; + } +// if(isrend(form.getTCProperty("jk8ProductType"),box2.getText())){ +// return true; +// } + if(isrend(form.getTCProperty("jk8ProductType_select"),box2.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ContrlCompType"),box3.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8SerialCode"),box4.getText())){ + return true; + } +// String jk8ProductIdentifyNO = form.getTCProperty("jk8ProductIdentifyNO").getStringValue();//ʶ +// if(jk8ProductIdentifyNO!=null) { +// if(!jk8ProductIdentifyNO.substring(jk8ProductIdentifyNO.length()-2).equals(box4.getText())){ +// return true; +// } +// } + if(isrend(form.getTCProperty("jk8ProductName"),box5.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8Module"),box6.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8Chip"),box7.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8Agreement"),box8.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8BackstopValve"),box9.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8PressureTap"),box10.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ImpSkin"),box11.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8MechTempC"),box12.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8WideRange"),box13.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8BMBuy"),box14.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8BMColor"),box15.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8GyratoryVolume"),box16.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8Valve"),box17.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ForHK"),box18.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8PackageLogo"),box19.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8PerBoxUnits"),box20.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ProductLogo"),box21.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ExAlarm"),box22.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8FaceAntiRemove"),box23.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8PipeAntiRemove"),box24.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ClockLiBattey"),box25.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8UploadPowerFail"),box26.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8SupplyMode"),box27.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8UserPayMethod"),box28.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ICCardType"),box29.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8EncryptType"),box30.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8Customized"),box31.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ProductFamily"),box32.getText())){ + return true; + } + + if(isrend(form.getTCProperty("jk8FlameproofType"),jt03.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8TypeCerNo"),jt04.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8InitConfig"),jt05.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8Remarks"),jt06.getText())){ + return true; + } + +// if(isrend(form.getTCProperty("jk8CircBoardModNO"),jt5.getText())){ +// return true; +// } +// if(isrend(form.getTCProperty("jk8FunctionOverview"),jt2.getText())){ +// return true; +// } +// if(isrend(form.getTCProperty("jk8InsteadType"),jt4.getText())){ +// return true; +// } +// if(isrend(form.getTCProperty("jk8ProgramFeatures"),jt6.getText())){ +// return true; +// } +// if(isrend(form.getTCProperty("jk8CustSpecRequirements"),jt8.getText())){ +// return true; +// } +// if(isrend(form.getTCProperty("jk8ICCardType"),jt7.getText())){ +// return true; +// } + if(isrend(form.getTCProperty("jk8ProductIdentifyNO"),jt9.getText())){ + return true; + } +// if(isrend(form.getTCProperty("jk8Valve"),jt10.getText())){ +// return true; +// } +// if(isrend(form.getTCProperty("jk8EncryptType"),jt11.getText())){ +// return true; +// } +// if(isrend(form.getTCProperty("jk8BMManfMatched"),jt12.getText())){ +// return true; +// } + if(isrend(form.getTCProperty("jk8Customer"),jt13.getText())){ + return true; + } +// +// if (radioButton1.isSelected()) { +// if(isrend(form.getTCProperty("jk8ApplyMarket"),radioButton1.getText())){ +// return true; +// } +// } +// if (radioButton2.isSelected()) { +// if(isrend(form.getTCProperty("jk8ApplyMarket"),radioButton2.getText() + ";" + jt3.getText())){ +// return true; +// } +// } + + + } catch (TCException e) { + // Auto-generated catch block + e.printStackTrace(); + }// гѡ + return false; + } + + + private boolean isrend(TCProperty tcProperty, String str) { + // Auto-generated method stub + if(str == null)str = ""; + if(tcProperty!=null&&(!str.equals(tcProperty.getStringValue()))){ + System.out.println(str); + return true; + } + return false; + } + + @Override + public void saveRendering() { + System.out.println("saveRendering"); + if ("".equals(jt1.getText()) + || "".equals(jt01.getText()) + || "".equals(jt02.getText()) + || "".equals(box4.getText()) + || "".equals(box1.getText()) + || "".equals(box2.getText()) + || "".equals(box3.getText()) + || "".equals(box31.getText()) + || "".equals(jt13.getText()) + ) { + MessageBox.post("޷,ȷȫд!!", "", MessageBox.ERROR); + System.out.println("޷,ȷȫд!!"); + }else{ + if ("".equals(jt9.getText())) { + try { + form.getTCProperty("jk8ProductModNO").setStringValue(jt1.getText());// Ʒͺ + form.getTCProperty("jk8ProjectName").setStringValue(jt01.getText());// Ŀ + form.getTCProperty("jk8ProjectNO").setStringValue(jt02.getText());// Ŀ + form.getTCProperty("jk8FlameproofType").setStringValue(jt03.getText()); + form.getTCProperty("jk8TypeCerNo").setStringValue(jt04.getText()); + form.getTCProperty("jk8InitConfig").setStringValue(jt05.getText()); + form.getTCProperty("jk8Remarks").setStringValue(jt06.getText()); + form.getTCProperty("jk8BMManufactor").setStringValue(box1.getText());// / +// form.getTCProperty("jk8ProductType").setStringValue(box2.getText());// Ʒ + form.getTCProperty("jk8ProductType_select").setStringValue(box2.getText());// Ʒ + form.getTCProperty("jk8ContrlCompType").setStringValue(box3.getText());// + form.getTCProperty("jk8SerialCode").setStringValue(box4.getText());// ˮ + form.getTCProperty("jk8ProductName").setStringValue(box5.getText()); + form.getTCProperty("jk8Module").setStringValue(box6.getText()); + form.getTCProperty("jk8Chip").setStringValue(box7.getText()); + form.getTCProperty("jk8Agreement").setStringValue(box8.getText()); + form.getTCProperty("jk8BackstopValve").setStringValue(box9.getText()); + form.getTCProperty("jk8PressureTap").setStringValue(box10.getText()); + form.getTCProperty("jk8ImpSkin").setStringValue(box11.getText()); + form.getTCProperty("jk8MechTempC").setStringValue(box12.getText()); + form.getTCProperty("jk8WideRange").setStringValue(box13.getText()); + form.getTCProperty("jk8BMBuy").setStringValue(box14.getText()); + form.getTCProperty("jk8BMColor").setStringValue(box15.getText()); + form.getTCProperty("jk8GyratoryVolume").setStringValue(box16.getText()); + form.getTCProperty("jk8Valve").setStringValue(box17.getText()); + form.getTCProperty("jk8ForHK").setStringValue(box18.getText()); + form.getTCProperty("jk8PackageLogo").setStringValue(box19.getText()); + form.getTCProperty("jk8PerBoxUnits").setStringValue(box20.getText()); + form.getTCProperty("jk8ProductLogo").setStringValue(box21.getText()); + form.getTCProperty("jk8ExAlarm").setStringValue(box22.getText()); + form.getTCProperty("jk8FaceAntiRemove").setStringValue(box23.getText()); + form.getTCProperty("jk8PipeAntiRemove").setStringValue(box24.getText()); + form.getTCProperty("jk8ClockLiBattey").setStringValue(box25.getText()); + form.getTCProperty("jk8UploadPowerFail").setStringValue(box26.getText()); + form.getTCProperty("jk8SupplyMode").setStringValue(box27.getText()); + form.getTCProperty("jk8UserPayMethod").setStringValue(box28.getText()); + form.getTCProperty("jk8ICCardType").setStringValue(box29.getText()); + form.getTCProperty("jk8EncryptType").setStringValue(box30.getText()); + form.getTCProperty("jk8Customized").setStringValue(box31.getText()); + form.getTCProperty("jk8ProductFamily").setStringValue(box32.getText()); +// form.getTCProperty("jk8CircBoardModNO").setStringValue(jt5.getText());// ·ͺ +// form.getTCProperty("jk8FunctionOverview").setStringValue(jt2.getText());// ܸ +// form.getTCProperty("jk8InsteadType").setStringValue(jt4.getText());// ͺ +// form.getTCProperty("jk8ProgramFeatures").setStringValue(jt6.getText());// +// form.getTCProperty("jk8CustSpecRequirements").setStringValue(jt8.getText());// ͻҪ +// form.getTCProperty("jk8ICCardType").setStringValue(jt7.getText());// ICͺ +// form.getTCProperty("jk8ProductIdentifyNO").setStringValue(jt9.getText());// ʶ +// form.getTCProperty("jk8Valve").setStringValue(jt10.getText());// +// form.getTCProperty("jk8EncryptType").setStringValue(jt11.getText());// +// form.getTCProperty("jk8BMManfMatched").setStringValue(jt12.getText());// + form.getTCProperty("jk8Customer").setStringValue(jt13.getText());// +// if (radioButton1.isSelected()) { +// form.getTCProperty("jk8ApplyMarket").setStringValue(radioButton1.getText());// г +// } +// if (radioButton2.isSelected()) { +// form.getTCProperty("jk8ApplyMarket").setStringValue(radioButton2.getText() + ";" + jt3.getText());// г +// } + + } catch (Exception e) { + // Auto-generated catch block + e.printStackTrace(); + } + } else { + MessageBox.post("ʶѴ,޷ٴα", "", MessageBox.ERROR); + System.out.println("ʶѴ,޷ٴα"); + } + } + + } + + public void setOwnerHave() { + try { + + String user = session.getUserName(); + String owning_user = form.getProperty("owning_user"); + // System.out.println("owning_user.indexOf(user)="+owning_user.indexOf(user)); + if (owning_user.indexOf(user) < 0) { + jt1.setEnabled(false); + jt01.setEnabled(false); + jt02.setEnabled(false); + jt03.setEnabled(false); + jt04.setEnabled(false); + jt05.setEnabled(false); + jt06.setEnabled(false); + yanzhen.setEnabled(false); + box1.setEnabled(false); + box2.setEnabled(false); + box3.setEnabled(false); + box4.setEnabled(false); + box5.setEnabled(false); + box6.setEnabled(false); + box7.setEnabled(false); + box8.setEnabled(false); + box9.setEnabled(false); + box10.setEnabled(false); + box11.setEnabled(false); + box12.setEnabled(false); + box13.setEnabled(false); + box14.setEnabled(false); + box15.setEnabled(false); + box16.setEnabled(false); + box17.setEnabled(false); + box18.setEnabled(false); + box19.setEnabled(false); + box20.setEnabled(false); + box21.setEnabled(false); + box22.setEnabled(false); + box23.setEnabled(false); + box24.setEnabled(false); + box25.setEnabled(false); + box26.setEnabled(false); + box27.setEnabled(false); + box28.setEnabled(false); + box29.setEnabled(false); + box30.setEnabled(false); + box31.setEnabled(false); + box32.setEnabled(false); +// jt2.setEnabled(false); +// jt3.setEnabled(false); +// jt4.setEnabled(false); +// jt5.setEnabled(false); +// jt6.setEnabled(false); +// jt7.setEnabled(false); +// jt8.setEnabled(false); + jt9.setEnabled(false); +// jt10.setEnabled(false); +// jt11.setEnabled(false); +// jt12.setEnabled(false); + jt13.setEnabled(false); +// radioButton1.setEnabled(false); +// radioButton2.setEnabled(false); + + } + } catch (Exception e) { + System.out.println("ӵǷʱļеòȷҲ"); + e.printStackTrace(); + } + } + + public void seten(boolean is) { +// MessageBox.post("seten()"+"\n"+String.valueOf(is),"",MessageBox.INFORMATION); + jt01.setEnabled(is); + jt02.setEnabled(is); + jt03.setEnabled(is); + jt04.setEnabled(is); + jt05.setEnabled(is); + jt06.setEnabled(is); + box1.setEnabled(is); + box2.setEnabled(is); + box3.setEnabled(is); + box4.setEnabled(is); + box5.setEnabled(is); + box6.setEnabled(is); + box7.setEnabled(is); + box8.setEnabled(is); + box9.setEnabled(is); + box10.setEnabled(is); + box11.setEnabled(is); + box12.setEnabled(is); + box13.setEnabled(is); + box14.setEnabled(is); + box15.setEnabled(is); + box16.setEnabled(is); + box17.setEnabled(is); + box18.setEnabled(is); + box19.setEnabled(is); + box20.setEnabled(is); + box21.setEnabled(is); + box22.setEnabled(is); + box23.setEnabled(is); + box24.setEnabled(is); + box25.setEnabled(is); + box26.setEnabled(is); + box27.setEnabled(is); + box28.setEnabled(is); + box29.setEnabled(is); + box30.setEnabled(is); + box31.setEnabled(is); + box32.setEnabled(is); + + +// jt2.setEnabled(is); +// // jt3.setEnabled(is); +// jt4.setEnabled(is); +// jt5.setEnabled(is); +// jt6.setEnabled(is); +// jt7.setEnabled(is); +// jt8.setEnabled(is); +// jt10.setEnabled(is); +// jt11.setEnabled(is); +// jt12.setEnabled(is); + jt13.setEnabled(is); +// radioButton1.setEnabled(is); +// radioButton2.setEnabled(is); + } + + private void yzbut() { + // Auto-generated method stub + + jt = jt1.getText(); + if (jt != null && !jt.equals("") && !jt.equals("")) { + TCPreferenceService pref = session.getPreferenceService(); + String puid = pref.getStringValue("JK_SQB_FORM_PUID");// ѡpuid + if (puid == null) { + MessageBox.post("ѡδҵϵԱ", "", MessageBox.ERROR); + } + + TCComponentForm formAll; + try { + formAll = (TCComponentForm) session.stringToComponent(puid); + if (formAll == null) { + MessageBox.post("δҵϵԱ", "", MessageBox.ERROR); + } + boolean ishave1 = false; + ishave1 = ishave("jk8ProductModNO", "jk8ProductIdentifyNO", formAll);// Դ + + if (ishave1) { + MessageBox.post("ҵƷͺţòƷͺſ", "ɹ", MessageBox.INFORMATION); + } else { + MessageBox.post("δҵƷͺţдIJƷͺǷȷ", "", MessageBox.ERROR); + } + } catch (Exception e) { + // Auto-generated catch block + e.printStackTrace(); + MessageBox.post(e.getMessage(), "", MessageBox.ERROR); + } + } else { + MessageBox.post("ƷͺŲΪգдٵť", "", MessageBox.ERROR); + } + } + + private boolean ishave(String cpxh_all, String sbh_all, TCComponentForm formAll) { + // Auto-generated method stub + boolean bo = false; + try { + String[] cpxhs = formAll.getTCProperty(cpxh_all).getStringValueArray();// ܲƷͺ +// StringBuilder sb = new StringBuilder(); +// for(String s: cpxhs) { +// sb.append(s).append(","); +// } +// MessageBox.post(sb.toString(),"",MessageBox.INFORMATION); + String lx = ""; + String name = ""; + for (int i = 0; i < cpxhs.length; i++) { + if (jt.equals(cpxhs[i])) { + lx = formAll.getTCProperty("jk8ProductType").getStringValueArray()[i];// Ʒ + name = formAll.getTCProperty("jk8ProductName").getStringValueArray()[i];// Ʒ + bo = true; +// MessageBox.post("ҵͺ"+"\n"+String.valueOf(bo),"",MessageBox.INFORMATION); + MessageBox.post("Ʒͣ"+lx+"\nƷƣ"+name,"",MessageBox.INFORMATION); + System.out.println("Ʒ:" + lx); + System.out.println("Ʒ:" + name); + form.getTCProperty("jk8ProductType").setStringValue(lx);// Ʒ + form.getTCProperty("jk8ProductName").setStringValue(name);// Ʒ + is = bo; + seten(bo); + break; + } + } + } catch (Exception e) { + // Auto-generated catch block + e.printStackTrace(); + //ӡ쳣 + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + e.printStackTrace(new PrintStream(baos)); + String exception = "formͣ"+form.getType()+"\n"; + exception += baos.toString(); + MessageBox.post(exception,"쳣",MessageBox.INFORMATION); + } + return bo; + } + + private JLabel getjl() { + JLabel bt = new JLabel("*"); + bt.setForeground(Color.red); + return bt; + } + +} diff --git a/src/com/teamcenter/rac/form/JK8_TSSBH_Form.java b/src/com/teamcenter/rac/form/JK8_TSSBH_Form.java new file mode 100644 index 0000000..1daef68 --- /dev/null +++ b/src/com/teamcenter/rac/form/JK8_TSSBH_Form.java @@ -0,0 +1,711 @@ +package com.teamcenter.rac.form; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionListener; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.swing.ButtonGroup; +import javax.swing.DefaultComboBoxModel; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.JTextField; + +import com.teamcenter.rac.aif.kernel.AIFComponentContext; +import com.teamcenter.rac.kernel.TCComponentFolder; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.stylesheet.AbstractRendering; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; +import com.teamcenter.rac.util.Registry; +import com.teamcenter.rac.util.combobox.iComboBox; +import com.teamcenter.soa.exceptions.NotLoadedException; + +//4ҪƷʶ +public class JK8_TSSBH_Form extends AbstractRendering { + + private TCSession session; + private TCComponentForm form; + private JButton tijiao; + private JButton yanzhen; + private JPanel mainPanel; + + private JPanel topPanel; + private JPanel firstJPanel; + private JPanel secondJPanel; + private JPanel secondJPanel_1; + private JPanel secondJPanel_2; + private JPanel thirdJPanel; + private JRadioButton radioButton1; + private JRadioButton radioButton2; + private ButtonGroup group; + + private JTextField jt1; + private JTextField jt2; + private JTextArea jt3; + private JTextField jt4; + private JTextField jt5; + private JTextField jt6; + private JTextField jt7; + private JTextField jt8; + private JTextField jt9; + private JTextField jt10; + private JTextField jt11; + + private JTextField jt12;// + private JTextField jt13;// + private JTextField jt14;// + private JTextField jt01;// Ŀ + private JTextField jt02;// Ŀ + + // private JComboBox comBox0; + // private JComboBox comBox; + private iComboBox comBox0 = new iComboBox(); + private iComboBox comBox = new iComboBox(); + + private JLabel jl1; + private JLabel jl2; + private JLabel jl3; + private JLabel jl4; + + private String jt;// ׼ʶ + + private String jzsbh = "";// ׼ʶ + private String tsyq = "";// Ҫ + private String jffs = "";// Ʒѷʽ + private String gngs = "";// ܸ + private String sysc = "";// г + private String tdxh = "";// ͺ + private String xlbxh = "";// ·ͺ + private String cxtz = "";// + private String ickxh = "";// ICͺ + private String khtsyq = "";// ͻҪ + private String cpxh = "";// Ʒͺ + private String sbh = "";// ʶ + + private String isCheck; + + private HashMap realNameMap; + + // private Registry registry = null; + + public JK8_TSSBH_Form(TCComponentForm arg0) throws Exception { + super(arg0); + form = arg0; + session = arg0.getSession(); + // // TODO Auto-generated constructor stub + // registry = Registry.getRegistry("com.teamcenter.rac.form.form_user"); + String[] names = session.getPreferenceService().getStringValues( + "JK_CPXH_FORM"); + if (names != null) { + + realNameMap = new HashMap<>(); + for (int i = 0; i < names.length; i++) { + String[] s = names[i].split("="); + if (s != null && s.length == 2) { + String key = s[0]; + String value = s[1]; + realNameMap.put(key, value); + } + + } + + } else { + MessageBox.post("ѡ JK_CPXH_FORM ڣϵԱ", "", + MessageBox.ERROR); + } + initPanel(); + loadRendering(); + mainPanel.addMouseMotionListener(new MouseMotionListener() { + + @Override + public void mouseMoved(MouseEvent e) { + // TODO Auto-generated method stub + try { + isCheck = form.getTCProperty("fnd0IsCheckoutable") + .getDisplayableValue(); + } catch (TCException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + if ("".equals(isCheck)) { + seten(!"".equals(jt10.getText())); + setOwnerHave(); + } + } + + @Override + public void mouseDragged(MouseEvent e) { + // TODO Auto-generated method stub + + } + }); + + if (!radioButton2.isSelected()) { + jt4.setEnabled(false); + } + jt10.setEnabled(false); + jt11.setEnabled(false); + + } + + public void initPanel() { + System.out.println("--------------------------"); + jt1 = new JTextField(20); + jt2 = new JTextField(20); + jt3 = new JTextArea(3,20); + jt4 = new JTextField(20); + jt5 = new JTextField(20); + jt6 = new JTextField(20); + jt7 = new JTextField(20); + jt8 = new JTextField(20); + jt9 = new JTextField(20); + jt10 = new JTextField(25); + jt11 = new JTextField(25); + jt12 = new JTextField(20); + jt13 = new JTextField(20); + jt14 = new JTextField(20); + jt01 = new JTextField(20); + jt02 = new JTextField(20); + + jl1 = new JLabel(" ׼ʶţ"); + jl1.setSize(50, 20); + jl2 = new JLabel(" ҪƷʶϢǼ"); + jl2.setSize(70, 20); + jl3 = new JLabel(" Ʒѷʽ"); + jl3.setSize(70, 20); + jl4 = new JLabel(" ҪƷʶ"); + jl4.setFont(new Font("", 0, 24)); + jl2.setFont(new Font("", 0, 20)); + mainPanel = new JPanel(new PropertyLayout()); + this.setSize(new Dimension(600, 200)); + this.setLayout(new BorderLayout()); + + topPanel = new JPanel(new PropertyLayout()); + + topPanel.add("1.1.left.top.preferred.preferred", jl4); + topPanel.add("1.2.left.top.preferred.preferred", new JLabel( + " ")); + // tijiao = new JButton("ύ"); + // tijiao.setEnabled(true); + // tijiao.setPreferredSize(new Dimension(70, 20)); + // tijiao.addActionListener(new ActionListener() { + // + // @Override + // public void actionPerformed(ActionEvent e) { + // // TODO Auto-generated method stub + // System.out.println("ύ"); + // saveRendering(); + // } + // }); + // topPanel.add("1.3.left.bottom.preferred.preferred", tijiao); + + firstJPanel = new JPanel(new PropertyLayout()); + // firstJPanel.setBorder(new + // TitledBorder(BorderFactory.createEtchedBorder())); + // firstJPanel.setBorder(new + // TitledBorder(BorderFactory.createEtchedBorder(),"",2,7)); + + topPanel.add("2.1.left.top", new JLabel("")); + topPanel.add("2.1.left.top", jl2); + firstJPanel.add("1.1.left.top", jl1); + firstJPanel.add("1.2.left.top", getjl()); + firstJPanel.add("1.3.left.top", jt1); + yanzhen = new JButton("֤ʶ"); + yanzhen.setEnabled(true); + yanzhen.setPreferredSize(new Dimension(100, 20)); + yanzhen.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + System.out.println("֤"); + + yzbut(); + + } + + }); + firstJPanel.add("1.4.left.top", yanzhen); + firstJPanel.add("2.1.left.top", new JLabel(" Ŀ:")); + firstJPanel.add("2.2.left.top", new JLabel(" ")); + firstJPanel.add("2.3.left.top", jt01); + firstJPanel.add("3.1.left.top", new JLabel(" Ŀ:")); + firstJPanel.add("3.2.left.top", new JLabel(" ")); + firstJPanel.add("3.3.left.top", jt02); + firstJPanel.add("4.1.left.top", new JLabel(" Ҫ:")); + + setLov(comBox0, "Ҫ"); + firstJPanel.add("4.2.right.top.preferred.preferred", getjl()); + firstJPanel.add("4.3.left.top.preferred.preferred", comBox0); + + secondJPanel = new JPanel(new PropertyLayout()); + secondJPanel_1 = new JPanel(new PropertyLayout()); + secondJPanel_1.add("1.1.left.top", jl3); + setLov(comBox, "Ʒѷʽ"); + + secondJPanel_1.add("1.2.left.top", comBox); + secondJPanel_1.add("2.1.left.top", new JLabel(" г")); + // secondJPanel.add("2.2.left.top.preferred.preferred", + // new JLabel(" Ʒѷʽ")); + radioButton1 = new JRadioButton("ͨ");// ѡť + radioButton1.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + if (radioButton1.isSelected()) { + jt4.setText(""); + jt4.setEnabled(false); + } + } + }); + radioButton2 = new JRadioButton("ר");// ѡť + radioButton2.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + if (radioButton2.isSelected()) { + jt4.setEnabled(true); + } + } + }); + + group = new ButtonGroup(); + group.add(radioButton1); + group.add(radioButton2); + secondJPanel_1.add("2.2.left.top", radioButton1); + secondJPanel_1.add("2.3.left.top", radioButton2); + secondJPanel_1.add("2.4.left.top", jt4); + secondJPanel_1.add("3.1.left.top", new JLabel(" ·ͺţ")); + secondJPanel_1.add("3.2.left.top", jt6); + secondJPanel_1.add("4.1.left.top", new JLabel(" ICͺţ")); + secondJPanel_1.add("4.2.left.top", jt8); + secondJPanel_1.add("5.1.left.top.preferred.preferred", new JLabel( + " ţ")); + secondJPanel_1.add("5.2.left.top.preferred.preferred", jt12); + + // secondJPanel_1.add("6.1.left.top.preferred.preferred", new JLabel( + // " ")); + // secondJPanel_1.add("7.1.left.top.preferred.preferred", new JLabel( + // " ׳ң")); + // secondJPanel_1.add("7.2.left.top.preferred.preferred", jt14); + + secondJPanel_2 = new JPanel(new PropertyLayout()); + + JScrollPane jspane1=new JScrollPane(jt3); + jt3.setLineWrap(true); + secondJPanel_2.add("1.1.left.top.preferred.preferred", new JLabel( + " ܸ ")); + secondJPanel_2.add("1.2.left.top.preferred.preferred", jspane1);//2019.6.24 Ĺܸ Ҫ + secondJPanel_2.add("2.1.left.top.preferred.preferred", new JLabel( + " ͺţ ")); + secondJPanel_2.add("2.2.left.top.preferred.preferred", jt5); + + secondJPanel_2.add("3.1.left.top.preferred.preferred", new JLabel( + " ")); + secondJPanel_2.add("3.2.left.top.preferred.preferred", jt7); + + secondJPanel_2.add("4.1.left.top.preferred.preferred", new JLabel( + " ͻҪ")); + secondJPanel_2.add("4.2.left.top.preferred.preferred", jt9); + secondJPanel_2.add("5.1.left.top.preferred.preferred", new JLabel( + " ͣ")); + secondJPanel_2.add("5.2.left.top.preferred.preferred", jt13); + + secondJPanel.add("1.1.left.top", secondJPanel_1); + secondJPanel.add("1.2.left.top.preferred.preferred", secondJPanel_2); + + thirdJPanel = new JPanel(new PropertyLayout()); + thirdJPanel.add("1.1.left.top.preferred.preferred", new JLabel( + " Ʒͺţ ")); + thirdJPanel.add("1.2.left.top.preferred.preferred", jt10); + thirdJPanel.add("1.3.left.top.preferred.preferred", new JLabel( + " ʶţ")); + thirdJPanel.add("1.4.left.top.preferred.preferred", jt11); + + mainPanel.add("1.1.left.top.preferred.preferred", topPanel); + mainPanel.add("2.1.left.top.preferred.preferred", firstJPanel); + mainPanel.add("3.1.left.top.preferred.preferred", secondJPanel); + mainPanel.add("4.1.left.top.preferred.preferred", thirdJPanel); + this.add(mainPanel); + this.setVisible(true); + this.setBackground(Color.LIGHT_GRAY); + } + + @Override + public void loadRendering() throws TCException { + // TODO Auto-generated method stub + System.out.println("loadRendering"); + + comBox0.setText(form.getTCProperty("jk8SpecRequirements") + .getStringValue());// Ҫ + comBox.setText(form.getTCProperty("jk8BillingMode").getStringValue());// Ʒѷʽ + + String sysc = form.getTCProperty("jk8ApplyMarket").getStringValue(); + if (sysc != null && !sysc.equals("")) {// гѡ + + if (sysc.equals("ͨ")) { + radioButton1.setSelected(true); + } else if (sysc.contains("ר")) { + radioButton2.setSelected(true); + String[] strs=form.getTCProperty("jk8ApplyMarket").getStringValue().split(";"); + if(strs!=null&&strs.length>1){ + jt4.setText(strs[1]);// ר + } + + + } + } + + jt1.setText(form.getTCProperty("jk8BaseIdentifyNO").getStringValue());// ׼ʶ + jt3.setText(form.getTCProperty("jk8FunctionOverview").getStringValue());// ܸ + // jt4.setText(form.getTCProperty("jk_tsy_sysc").getStringValue());// + // г3 + jt5.setText(form.getTCProperty("jk8InsteadType").getStringValue());// ͺ + jt6.setText(form.getTCProperty("jk8CircBoardModNO").getStringValue());// ·ͺ + jt7.setText(form.getTCProperty("jk8ProgramFeatures").getStringValue());// + jt8.setText(form.getTCProperty("jk8ICCardType").getStringValue());// ICͺ + jt9.setText(form.getTCProperty("jk8CustSpecRequirements") + .getStringValue());// ͻҪ + jt10.setText(form.getTCProperty("jk8ProductModNO").getStringValue());// Ʒͺ + jt11.setText(form.getTCProperty("jk8ProductIdentifyNO") + .getStringValue());// ʶ + jt12.setText(form.getTCProperty("jk8Valve").getStringValue());// + jt13.setText(form.getTCProperty("jk8EncryptType").getStringValue());// + // jt14.setText(form.getTCProperty("jk8BMManfMatched").getStringValue());// + // + jt01.setText(form.getTCProperty("jk8ProjectName").getStringValue());// Ŀ + jt02.setText(form.getTCProperty("jk8ProjectNO").getStringValue());// Ŀ + + seten(!"".equals(jt10.getText())); + } + + +/* @Override + public Map getRenderingModified() { + Map modifiedRendering = new HashMap (); + try { + System.out.println("getRenderingModifiedʼ"); + saveRendering(); + }catch(Exception ex){ + ex.toString(); + System.out.println(ex.toString()); + } + + + return modifiedRendering; + }*/ + + public boolean isRenderingModified() { + System.out.println("isRenderingModified"); + + try { + + if(isrend(form.getTCProperty("jk8SpecRequirements"),comBox0.getTextField().getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8BillingMode"),comBox.getTextField().getText())){ + return true; + } + if (radioButton1.isSelected()) { + if(isrend(form.getTCProperty("jk8ApplyMarket"),radioButton1.getText())){ + return true; + } + } else if (radioButton2.isSelected()) { + if(isrend(form.getTCProperty("jk8ApplyMarket"),radioButton2.getText() + ";" + jt4.getText())){ + return true; + } + } + if(isrend(form.getTCProperty("jk8BaseIdentifyNO"),jt1.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8FunctionOverview"),jt3.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8InsteadType"),jt5.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8CircBoardModNO"),jt6.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ProgramFeatures"),jt7.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ICCardType"),jt8.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8CustSpecRequirements"),jt9.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ProductModNO"),jt10.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ProductIdentifyNO"),jt11.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8Valve"),jt12.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8EncryptType"),jt13.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ProjectName"),jt01.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ProjectNO"),jt02.getText())){ + return true; + } + + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + }// гѡ + return false; + } + + + private boolean isrend(TCProperty tcProperty, String str) { + // TODO Auto-generated method stub + if(tcProperty!=null&&str!=null&&(!str.equals(tcProperty.getStringValue()))){ + System.out.println(str); + return true; + } + return false; + } + + + + @Override + public void saveRendering() { + // TODO Auto-generated method stub + if ("".equals(jt1.getText()) + || "".equals(comBox0.getTextField().getText())) { + MessageBox.post("޷,ȷȫд!!", "", MessageBox.ERROR); + + }else{ + if ("".equals(jt11.getText())) { + try { + form.getTCProperty("jk8SpecRequirements").setStringValue( + comBox0.getTextField().getText());// Ҫ + form.getTCProperty("jk8BillingMode").setStringValue( + comBox.getTextField().getText());// Ʒѷʽ + + if (radioButton1.isSelected()) { + form.getTCProperty("jk8ApplyMarket").setStringValue( + radioButton1.getText()); + } else if (radioButton2.isSelected()) { + form.getTCProperty("jk8ApplyMarket").setStringValue( + radioButton2.getText() + ";" + jt4.getText()); + } + + form.getTCProperty("jk8BaseIdentifyNO").setStringValue( + jt1.getText());// ׼ʶ + form.getTCProperty("jk8FunctionOverview").setStringValue( + jt3.getText());// ܸ + // form.getTCProperty("jk_tsy_sysc").setStringValue(jt4.getText());// + // г3 + form.getTCProperty("jk8InsteadType").setStringValue( + jt5.getText());// ͺ + form.getTCProperty("jk8CircBoardModNO").setStringValue( + jt6.getText());// ·ͺ + form.getTCProperty("jk8ProgramFeatures").setStringValue( + jt7.getText());// + form.getTCProperty("jk8ICCardType").setStringValue( + jt8.getText());// ICͺ + form.getTCProperty("jk8CustSpecRequirements").setStringValue( + jt9.getText());// ͻҪ + form.getTCProperty("jk8ProductModNO").setStringValue( + jt10.getText());// Ʒͺ + form.getTCProperty("jk8ProductIdentifyNO").setStringValue( + jt11.getText());// ʶ + form.getTCProperty("jk8Valve").setStringValue(jt12.getText());// + form.getTCProperty("jk8EncryptType").setStringValue( + jt13.getText());// + // form.getTCProperty("jk8BMManfMatched").setStringValue(jt14.getText());// + // + + form.getTCProperty("jk8ProjectName").setStringValue( + jt01.getText());// Ŀ + form.getTCProperty("jk8ProjectNO").setStringValue( + jt02.getText());// Ŀ + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } else { + MessageBox.post("ʶѴ,޷ٴα", "", MessageBox.ERROR); + } + } + + + + } + + public void setOwnerHave() { + try { + + String user = session.getUserName(); + String owning_user = form.getProperty("owning_user"); + // System.out.println("owning_user.indexOf(user)="+owning_user.indexOf(user)); + if (owning_user.indexOf(user) < 0) { + jt1.setEnabled(false); + yanzhen.setEnabled(false); + comBox0.setEnabled(false); + comBox.setEnabled(false); + jt3.setEnabled(false); + jt4.setEnabled(false); + jt5.setEnabled(false); + jt6.setEnabled(false); + jt7.setEnabled(false); + jt8.setEnabled(false); + jt9.setEnabled(false); + jt10.setEnabled(false); + jt11.setEnabled(false); + jt12.setEnabled(false); + jt13.setEnabled(false); + jt14.setEnabled(false); + jt01.setEnabled(false); + jt02.setEnabled(false); + radioButton1.setEnabled(false); + radioButton2.setEnabled(false); + + } + } catch (TCException e) { + System.out.println("ӵǷʱļеòȷҲ"); + e.printStackTrace(); + } + } + + public void seten(boolean is) { + comBox0.setEnabled(is); + comBox.setEnabled(is); + jt3.setEnabled(is); + jt5.setEnabled(is); + jt6.setEnabled(is); + jt7.setEnabled(is); + jt8.setEnabled(is); + jt9.setEnabled(is); + + jt12.setEnabled(is); + jt13.setEnabled(is); + jt14.setEnabled(is); + radioButton1.setEnabled(is); + radioButton2.setEnabled(is); + jt01.setEnabled(is); + jt02.setEnabled(is); + } + + private void setLov(iComboBox box, String st) { + // TODO Auto-generated method stub + box.setTextFieldLength(20); + box.setAutoCompleteSuggestive(false); + box.addItems(realNameMap.get(st).split(",")); + } + + private void yzbut() { + // TODO Auto-generated method stub + + jt = jt1.getText(); + if (jt != null && !jt.equals("")) { + TCPreferenceService pref = session.getPreferenceService(); + String puid = pref.getStringValue("JK_SQB_FORM_PUID"); + if (puid == null) { + MessageBox.post("ѡδҵϵԱ", "", MessageBox.ERROR); + } + + TCComponentForm formAll; + try { + formAll = (TCComponentForm) session.stringToComponent(puid); + if (formAll == null) { + MessageBox.post("δҵϵԱ", "", MessageBox.ERROR); + } + boolean ishave1 = ishave("jk8ProductIdentifyNO", + "jk8ProductModNO", formAll);// Դ + + if (ishave1) { + MessageBox.post("ҵʶţƷͺ", "ɹ", + MessageBox.INFORMATION); + } else { + MessageBox.post("δҵʶţдĻ׼ʶǷȷ", "", + MessageBox.ERROR); + } + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + } + + private boolean ishave(String sbh_all, String cpxh_all, + TCComponentForm formAll) { + // TODO Auto-generated method stub + boolean bo = false; + try { + String[] sbhs = formAll.getTCProperty(sbh_all) + .getStringValueArray();// ʶ + + String cpxh = ""; + String jbcj = ""; + String lx = ""; + String name = ""; + for (int i = 0; i < sbhs.length; i++) { + if (jt.equals(sbhs[i])) { + cpxh = formAll.getTCProperty(cpxh_all) + .getStringValueArray()[i];// 鵽IJƷͺ + jbcj = formAll.getTCProperty("jk8BaseMeterManufactor") + .getStringValueArray()[i];// / + lx = formAll.getTCProperty("jk8ProductType") + .getStringValueArray()[i];// Ʒ + name = formAll.getTCProperty("jk8ProductName") + .getStringValueArray()[i];// Ʒ + bo = true; + } + } + System.out.println("Ʒ:" + lx); + if (bo) { + if (cpxh != null) { + jt10.setText(cpxh); + } else { + jt10.setText(""); + } + } + form.getTCProperty("jk8BMManufactor").setStringValue(jbcj);// / + form.getTCProperty("jk8ProductType").setStringValue(lx);// Ʒ + form.getTCProperty("jk8ProductName").setStringValue(name);// Ʒ + seten(bo); + + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return bo; + } + + private JLabel getjl() { + JLabel bt = new JLabel("*"); + bt.setForeground(Color.red); + return bt; + } +} diff --git a/src/com/teamcenter/rac/form/JK8_WATER_DERIVATIVES_SBH_Form.java b/src/com/teamcenter/rac/form/JK8_WATER_DERIVATIVES_SBH_Form.java new file mode 100644 index 0000000..09fe8cd --- /dev/null +++ b/src/com/teamcenter/rac/form/JK8_WATER_DERIVATIVES_SBH_Form.java @@ -0,0 +1,631 @@ +package com.teamcenter.rac.form; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionListener; +import java.util.HashMap; + +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; + +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.stylesheet.AbstractRendering; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; +import com.teamcenter.rac.util.combobox.iComboBox; + +//3Ʒʶ +public class JK8_WATER_DERIVATIVES_SBH_Form extends AbstractRendering implements ItemListener { + + // private JButton tijiao; + private JButton yanzhen; + private JPanel mainPanel; + + private JPanel topPanel; + private JPanel topPanel_1; +// private JPanel topPanel_2; + private JPanel firstJPanel; + private JPanel secondJPanel; + private JPanel secondJPanel_1; + private JPanel secondJPanel_2; + private JPanel thirdJPanel; + private TCComponentForm form; + private TCSession session; + + String jffs = ""; + private JComboBox comBox; + private JTextField jt1;//׼ʶ + private JTextField jt2;// + private JTextField jtjbcj;// + private JTextField jt3;// + private JTextField jt4;//Ʒ + + private JTextField jt10;//Ʒͺ + private JTextField jt11;//ʶ + + private JLabel jl1; + private JLabel jl2; +// private JLabel jl3;//Ʒ + private JLabel jl4; + + // private Registry registry = null; +// private iComboBox box3 = new iComboBox();// + private iComboBox box5 = new iComboBox();// ֹ + private JTextField khgn= new JTextField(20); + private iComboBox box6 = new iComboBox();// ط + private JTextField bjgf= new JTextField(20); + private iComboBox box7 = new iComboBox();// Կ + private JTextField my= new JTextField(20); + private iComboBox box8 = new iComboBox();// ûԴ㹦 + private JTextField yhql= new JTextField(20); + private iComboBox box9 = new iComboBox();// ¶Ȳ + private JTextField wdbc= new JTextField(20); + private iComboBox box10 = new iComboBox();// + private JTextField glbh= new JTextField(20); + private iComboBox box11 = new iComboBox();// + private JTextField wymp= new JTextField(20); + private HashMap realNameMap; + + private String jt;// ׼ʶ + + private String isCheck; + + private JTextField jt01;// Ŀ + private JTextField jt02;// Ŀ + private JTextField jt03;// Ʒ + + public JK8_WATER_DERIVATIVES_SBH_Form(TCComponentForm arg0) throws Exception { + super(arg0); + form = arg0; + session = arg0.getSession(); + // registry = Registry.getRegistry("com.teamcenter.rac.form.form_user"); + String[] names = session.getPreferenceService().getStringValues( + "JK8_WATER_DERIVATIVES_SBH_FORM"); + if (names != null) { + + realNameMap = new HashMap<>(); + for (int i = 0; i < names.length; i++) { + String[] s = names[i].split("="); + if (s != null && s.length == 2) { + String key = s[0]; + String value = s[1]; + realNameMap.put(key, value); + } + + } + + } else { + MessageBox.post("ѡ JK8_WATER_DERIVATIVES_SBH_FORM ڣϵԱ", "", + MessageBox.ERROR); + } + initializeUI(); + loadRendering(); + + mainPanel.addMouseMotionListener(new MouseMotionListener() { + + @Override + public void mouseMoved(MouseEvent e) { + try { + isCheck = form.getTCProperty("fnd0IsCheckoutable") + .getDisplayableValue(); + } catch (TCException e1) { + e1.printStackTrace(); + } + if ("".equals(isCheck)) { + seten(!"".equals(jt10.getText())); + setOwnerHave(); + } + } + + @Override + public void mouseDragged(MouseEvent e) { + + } + }); + + + jt10.setEnabled(false); + jt11.setEnabled(false); + + } + + public void initializeUI() { + System.out.println("UI-----Start"); + initPanel(); + + } + + private void setLov(iComboBox box, String st) { + box.setTextFieldLength(18); + box.setAutoCompleteSuggestive(false); + box.addItems(realNameMap.get(st).split(",")); + } + + public void initPanel() { + System.out.println("--------------------------"); + jt1 = new JTextField(20); + jt2 = new JTextField(20); + jtjbcj = new JTextField(20); + jt3 = new JTextField(20); + jt4 = new JTextField(20); + jt4.setEnabled(false); + jtjbcj.setEnabled(false); + jt2.setEnabled(false); + jt3.setEnabled(false); + + + jt10 = new JTextField(25); + jt11 = new JTextField(25); + jt01 = new JTextField(20); + jt02 = new JTextField(20); + jt03 = new JTextField(20); + + jl1 = new JLabel(" ׼ʶ:"); + jl1.setSize(50, 20); + jl2 = new JLabel(" ˮƷʶϢǼ"); + jl2.setSize(70, 20); +// jl3 = new JLabel(" Ʒͣ"); +// jl3.setSize(70, 20); + jl4 = new JLabel(" ˮƷʶ"); + jl4.setFont(new Font("", 0, 24)); + jl2.setFont(new Font("", 0, 20)); + mainPanel = new JPanel(new PropertyLayout()); + this.setSize(new Dimension(650, 250)); + this.setLayout(new BorderLayout()); + + topPanel = new JPanel(new PropertyLayout()); + topPanel_1 = new JPanel(new PropertyLayout()); + topPanel_1.add("1.1.left.top.preferred.preferred", jl4); + topPanel_1.add("1.2.left.top.preferred.preferred", new JLabel( + " ")); + topPanel.add("1.1.left.top.preferred.preferred", topPanel_1); + // topPanel.add("1.2.right.bottom.preferred.preferred", topPanel_2); + + firstJPanel = new JPanel(new PropertyLayout()); + +// topPanel.add("2.1.left.top.preferred.preferred", new JLabel(""));// ƷʶϢǼ + topPanel.add("2.1.left.top.preferred.preferred", jl2); + firstJPanel.add("1.1.left.top.preferred.preferred", jl1); + firstJPanel.add("1.2.right.top.preferred.preferred", getjl()); + firstJPanel.add("1.3.left.top.preferred.preferred", jt1); + yanzhen = new JButton("֤ʶ"); + yanzhen.setEnabled(true); + yanzhen.setPreferredSize(new Dimension(100, 20)); + yanzhen.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + System.out.println("֤"); + yzbut(); + + } + }); + firstJPanel.add("1.4.left.top.preferred.preferred", yanzhen); + firstJPanel.add("2.1.left.top.preferred.preferred", new JLabel( + " Ŀƣ")); + firstJPanel.add("2.2.right.top.preferred.preferred", getjl()); + firstJPanel.add("2.3.left.top.preferred.preferred", jt01); + firstJPanel.add("3.1.left.top.preferred.preferred", new JLabel( + " Ŀţ")); + firstJPanel.add("3.2.right.top.preferred.preferred", getjl()); + firstJPanel.add("3.3.left.top.preferred.preferred", jt02); + firstJPanel.add("4.1.left.top.preferred.preferred", new JLabel( + " Ʒƣ")); + firstJPanel.add("4.2.right.top.preferred.preferred", getjl()); + firstJPanel.add("4.3.left.top.preferred.preferred", jt03); + secondJPanel = new JPanel(new PropertyLayout()); + secondJPanel_1 = new JPanel(new PropertyLayout()); + + /* secondJPanel_1.add("1.1.left.top.preferred.preferred", jl3); + secondJPanel_1.add("1.2.left.top.preferred.preferred", jt4);*/ + + secondJPanel_1.add("1.1.left.top.preferred.preferred", new JLabel( + " ʣ")); + secondJPanel_1.add("1.2.left.top.preferred.preferred", jt2); + + secondJPanel_1.add("1.3.left.top.preferred.preferred", new JLabel( + " ң")); +// setLov(box3, ""); + secondJPanel_1.add("1.4.left.top.preferred.preferred", jtjbcj); + + secondJPanel_1.add("2.1.left.top.preferred.preferred", new JLabel( + " ͣ")); + secondJPanel_1.add("2.2.left.top.preferred.preferred", jt3); + // + secondJPanel_2 = new JPanel(new PropertyLayout()); + + /* secondJPanel_2.add("1.1.left.top.preferred.preferred", new JLabel(" ֹܣ")); +// setLov(box5, "ֹ"); + secondJPanel_2.add("1.2.left.top.preferred.preferred", khgn);*/ + + secondJPanel_2.add("1.1.left.top.preferred.preferred", new JLabel(" طܣ")); +// setLov(box6, "ط"); + secondJPanel_2.add("1.2.left.top.preferred.preferred", bjgf); + + /*secondJPanel_2.add("2.1.left.top.preferred.preferred", new JLabel(" Կ")); +// setLov(box7, "Կ"); + secondJPanel_2.add("2.2.left.top.preferred.preferred", my); + + secondJPanel_2.add("2.3.left.top.preferred.preferred", new JLabel(" ûԴ㹦ܣ")); +// setLov(box8, "ûԴ㹦"); + secondJPanel_2.add("2.4.left.top.preferred.preferred", yhql); + + secondJPanel_2.add("3.1.left.top.preferred.preferred", new JLabel(" ¶Ȳ")); +// setLov(box9, "¶Ȳ"); + secondJPanel_2.add("3.2.left.top.preferred.preferred", wdbc); + + secondJPanel_2.add("3.3.left.top.preferred.preferred", new JLabel(" ")); +// setLov(box10, ""); + secondJPanel_2.add("3.4.left.top.preferred.preferred", glbh);*/ + + secondJPanel_2.add("1.3.left.top.preferred.preferred", new JLabel(" ƣ")); +// setLov(box11, ""); + secondJPanel_2.add("1.4.left.top.preferred.preferred", wymp); + + + + secondJPanel.add("1.1.left.top.preferred.preferred", secondJPanel_1); + secondJPanel.add("2.1.left.top.preferred.preferred", secondJPanel_2); + thirdJPanel = new JPanel(new PropertyLayout()); + thirdJPanel.add("1.1.left.top.preferred.preferred", new JLabel( + " Ʒͺţ ")); + thirdJPanel.add("1.2.left.top.preferred.preferred", jt10); + thirdJPanel.add("1.3.left.top.preferred.preferred", new JLabel( + " ʶţ")); + thirdJPanel.add("1.4.left.top.preferred.preferred", jt11); + + mainPanel.add("1.1.left.top.preferred.preferred", topPanel); + mainPanel.add("2.1.left.top.preferred.preferred", firstJPanel); + mainPanel.add("3.1.left.top.preferred.preferred", secondJPanel); + mainPanel.add("4.1.left.top.preferred.preferred", thirdJPanel); + this.add(mainPanel); + this.setVisible(true); + this.setBackground(Color.LIGHT_GRAY); + } + + @Override + public void loadRendering() throws TCException { + System.out.println("loadRendering"); + + jt1.setText(form.getTCProperty("jk8BaseIdentifyNO").getStringValue());// ׼ʶ +// box3.setText(form.getTCProperty("jk8BMManufactor").getStringValue());// + jtjbcj.setText(form.getTCProperty("jk8BMManufactor").getStringValue());// + + jt01.setText(form.getTCProperty("jk8ProjectName").getStringValue());// Ŀ + jt02.setText(form.getTCProperty("jk8ProjectNO").getStringValue());// Ŀ + jt03.setText(form.getTCProperty("jk8ProductName").getStringValue());// Ʒ + + jt4.setText(form.getTCProperty("jk8ProductType").getStringValue());// Ʒ + jt2.setText(form.getTCProperty("jk8BMMaterial").getStringValue());// + jt3.setText(form.getTCProperty("jk8ContrlCompType").getStringValue());// + + /*box5.setText(form.getTCProperty("jk8ForbOpenAccount").getStringValue());// ֹ + box6.setText(form.getTCProperty("jk8SecurityFunc").getStringValue());// ط + box7.setText(form.getTCProperty("jk8SecretKey").getStringValue());// Կ + + box8.setText(form.getTCProperty("jk8WithZero").getStringValue());// ûԴ㹦 + box9.setText(form.getTCProperty("jk8TempPressCompFunc").getStringValue());// ¶Ȳ + box10.setText(form.getTCProperty("jk8OvercurrentPro").getStringValue());// + box11.setText(form.getTCProperty("jk8ForeignLanName").getStringValue());// +*/ +// khgn.setText(form.getTCProperty("jk8ForbOpenAccount").getStringValue());// ֹ + bjgf.setText(form.getTCProperty("jk8SecurityFunc").getStringValue());// ط +// my.setText(form.getTCProperty("jk8SecretKey").getStringValue());// Կ +// yhql.setText(form.getTCProperty("jk8WithZero").getStringValue());// ûԴ㹦 +// wdbc.setText(form.getTCProperty("jk8TempPressCompFunc").getStringValue());// ¶Ȳ +// glbh.setText(form.getTCProperty("jk8OvercurrentPro").getStringValue());// + wymp.setText(form.getTCProperty("jk8ForeignLanName").getStringValue());// + + jt10.setText(form.getTCProperty("jk8ProductModNO").getStringValue());// Ʒͺ + jt11.setText(form.getTCProperty("jk8ProductIdentifyNO").getStringValue());// ʶ + + } + + + + @Override + public void saveRendering() { + //TODO ȷЩDZҪ + System.out.println(jt01.getText()); + System.out.println(jt02.getText()); + System.out.println(jt1.getText()); + if ( "".equals(jt1.getText())) { + MessageBox.post("޷,ȷȫд!!", "", MessageBox.ERROR); + }else{ + //ʶΪգôԱϢ + if ("".equals(jt11.getText())) { + try { + form.getTCProperty("jk8ProjectName").setStringValue( + jt01.getText());// Ŀ + form.getTCProperty("jk8ProjectNO").setStringValue( + jt02.getText());// Ŀ + form.getTCProperty("jk8ProductName").setStringValue( + jt03.getText());// Ʒ + form.getTCProperty("jk8BaseIdentifyNO").setStringValue( + jt1.getText());// ׼ʶ +// form.getTCProperty("jk8BMManufactor").setStringValue(box3.getTextField().getText());// + form.getTCProperty("jk8BMManufactor").setStringValue( + jtjbcj.getText());// + form.getTCProperty("jk8ProductType").setStringValue( + jt4.getText());// Ʒ + form.getTCProperty("jk8BMMaterial").setStringValue( + jt2.getText());// + form.getTCProperty("jk8ContrlCompType").setStringValue( + jt3.getText());// + form.getTCProperty("jk8ProductModNO").setStringValue( + jt10.getText());// Ʒͺ + form.getTCProperty("jk8ProductIdentifyNO").setStringValue( + jt11.getText());// ʶ + +// form.getTCProperty("jk8ForbOpenAccount").setStringValue(khgn.getText());// ֹ + form.getTCProperty("jk8SecurityFunc").setStringValue(bjgf.getText());// ط +// form.getTCProperty("jk8SecretKey").setStringValue(my.getText());// Կ +// form.getTCProperty("jk8WithZero").setStringValue(yhql.getText());// ûԴ㹦 +// form.getTCProperty("jk8TempPressCompFunc").setStringValue(wdbc.getText());// ¶Ȳ +// form.getTCProperty("jk8OvercurrentPro").setStringValue(glbh.getText());// + form.getTCProperty("jk8ForeignLanName").setStringValue(wymp.getText());// + + } catch (Exception e) { + e.printStackTrace(); + } + } else { + MessageBox.post("ʶѴ,޷ٴα", "", MessageBox.ERROR); + } + } + + + } + + //DZ˾Ͳ޸ + public void setOwnerHave() { + try { + + String user = session.getUserName(); + String owning_user = form.getProperty("owning_user"); + // System.out.println("owning_user.indexOf(user)="+owning_user.indexOf(user)); + if (owning_user.indexOf(user) < 0) {//û߲ͬһ˾ͽֹ޸ + jt1.setEnabled(false); + jt2.setEnabled(false); + jt3.setEnabled(false); + jt4.setEnabled(false); + yanzhen.setEnabled(false); +// box3.setEnabled(false); + jtjbcj.setEnabled(false); + box5.setEnabled(false); + box6.setEnabled(false); + box7.setEnabled(false); + box8.setEnabled(false); + box9.setEnabled(false); + box10.setEnabled(false); + box11.setEnabled(false); + jt10.setEnabled(false); + jt11.setEnabled(false); + jt01.setEnabled(false); + jt02.setEnabled(false); + jt03.setEnabled(false); + + } + } catch (TCException e) { + System.out.println("ӵǷʱļеòȷҲ"); + e.printStackTrace(); + } + } + + //׼ʶŶԵϾ༭ + public void seten(boolean is) { +// jtjbcj.setEnabled(is);// + box5.setEnabled(is);//ֹ + box6.setEnabled(is);//ط + box7.setEnabled(is);// Կ + box8.setEnabled(is);//ûԴ㹦 + box9.setEnabled(is);//¶Ȳ + box10.setEnabled(is);// + box11.setEnabled(is);// + jt01.setEnabled(is);//Ŀ + jt02.setEnabled(is);//Ŀ + jt03.setEnabled(is);//Ʒ + + } + + @Override + public void itemStateChanged(ItemEvent e) { + Object object = e.getSource(); + if (object.equals(comBox)) { + System.out.println("ѡ" + e.getItem() + ""); + if (e.getStateChange() == ItemEvent.SELECTED) { + + if (e.getItem() != null) { + jffs = (String) e.getItem(); + jffs = jffs.trim(); + System.out.println(jffs); + } else { + return; + } + + } + } + } + + private void yzbut() { + jt = jt1.getText(); + if (jt != null && !jt.equals("")) { + TCPreferenceService pref = session.getPreferenceService(); + String puid = pref.getStringValue("JK_WATER_SQB_FORM_PUID");//h3f1AjBIYvbLjA + if (puid == null) { + MessageBox.post("ѡδҵϵԱ", "", MessageBox.ERROR); + return; + } + + TCComponentForm formAll; + try { + formAll = (TCComponentForm) session.stringToComponent(puid); + if (formAll == null) { + MessageBox.post("δҵϵԱ", "", MessageBox.ERROR); + } + boolean ishave1 = ishave("jk8ProductIdentifyNO", + "jk8ProductModNO", formAll);// ܱ + + if (ishave1) { + MessageBox.post("ҵʶţƷͺ", "ɹ", + MessageBox.INFORMATION); + } else { + MessageBox.post("δҵʶţдĻ׼ʶǷȷ", "", + MessageBox.ERROR); + } + } catch (TCException e) { + e.printStackTrace(); + } + } + + } + + private boolean ishave(String sbh_all, String cpxh_all, + TCComponentForm formAll) { + boolean bo = false; + try { + String[] sbhs = formAll.getTCProperty(sbh_all) + .getStringValueArray();// ʶ + String cpxh = ""; + String cplx = "";//Ʒ + String jbcj = "";// + String kzqzjlx = "";// + String jbcz = "";// + String gjgg="";//ܾ + String jg="";//ṹ + //String txfs="";//ͨŷʽ//20210201ͨŷʽȥ,֪Ϊʲô֮ǰûȥ + for (int i = 0; i < sbhs.length; i++) { + if (jt.equals(sbhs[i])) { + cpxh = formAll.getTCProperty(cpxh_all) + .getStringValueArray()[i];// 鵽IJƷͺ + jbcj = formAll.getTCProperty("jk8BMManufactor") + .getStringValueArray()[i];// + cplx = formAll.getTCProperty("jk8ProductTypePMN") + .getStringValueArray()[i];// Ʒ + kzqzjlx = formAll.getTCProperty("jk8ContrlCompType") + .getStringValueArray()[i];// + jbcz = formAll.getTCProperty("jk8BMMaterial") + .getStringValueArray()[i];// + gjgg = formAll.getTCProperty("jk8PipeDSpec") + .getStringValueArray()[i];// ܾ + jg = formAll.getTCProperty("jk8Structure") + .getStringValueArray()[i];// ṹ + +// txfs = formAll.getTCProperty("jk8CommunicateMode") +// .getStringValueArray()[i];// ͨŷʽ + bo = true; + break; + } + } + + System.out.println("Ʒ:" + cplx); + if (bo) { + if (cpxh != null) { + jt10.setText(cpxh);//Ʒͺ + jt4.setText(cplx);//Ʒ + jt2.setText(jbcz);// + jt3.setText(kzqzjlx);// + jt1.setText(jt);//׼ʶ +// box3.setText(jbcj);// // + jtjbcj.setText(jbcj);// // + } else { + jt10.setText(""); + } + } + + form.getTCProperty("jk8BaseIdentifyNO").setStringValue(jt);// ׼ʶ + form.getTCProperty("jk8BMManufactor").setStringValue(jbcj);// + form.getTCProperty("jk8ProductType").setStringValue(cplx);// Ʒ + form.getTCProperty("jk8ContrlCompType").setStringValue(kzqzjlx);// + form.getTCProperty("jk8BMMaterial").setStringValue(jbcz);// + form.getTCProperty("jk8ProductModNO").setStringValue(cpxh);// Ʒͺ + form.getTCProperty("jk8PipeDSpec").setStringValue(gjgg);// ܾ + form.getTCProperty("jk8Structure").setStringValue(jg);// ṹ + //form.getTCProperty("jk8CommunicateMode").setStringValue(txfs);// ͨŷʽ + seten(bo); + } catch (TCException e) { + e.printStackTrace(); + } + return bo; + } + + private JLabel getjl() { + JLabel bt = new JLabel("*"); + bt.setForeground(Color.red); + return bt; + } + + public boolean isRenderingModified() { + System.out.println("isRenderingModified"); + + try { + + if (isrend(form.getTCProperty("jk8ProjectName"), jt01.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ProjectNO"), jt02.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ProductName"), jt03.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8BaseIdentifyNO"), jt1.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8BMManufactor"), jtjbcj.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ProductType"), jt4.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8BMMaterial"),jt2.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ContrlCompType"), jt3.getText())) { + return true; + } + + if (isrend(form.getTCProperty("jk8ProductModNO"), jt10.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ProductIdentifyNO"), jt11.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8SecurityFunc"), bjgf.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ForeignLanName"), wymp.getText())) { + return true; + } + + + } catch (TCException e) { + e.printStackTrace(); + } // гѡ + return false; + } + + + private boolean isrend(TCProperty tcProperty, String str) { + if(tcProperty!=null&&str!=null&&(!str.equals(tcProperty.getStringValue()))){ + System.out.println(str); + return true; + } + return false; + } + + +} diff --git a/src/com/teamcenter/rac/form/JK8_WATER_PRODUCT_MODEL_Form.java b/src/com/teamcenter/rac/form/JK8_WATER_PRODUCT_MODEL_Form.java new file mode 100644 index 0000000..aa5328f --- /dev/null +++ b/src/com/teamcenter/rac/form/JK8_WATER_PRODUCT_MODEL_Form.java @@ -0,0 +1,520 @@ +package com.teamcenter.rac.form; + +//import java.awt.Dimension; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionListener; +import java.util.HashMap; + +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.JTextField; + +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.stylesheet.AbstractRendering; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; +import com.teamcenter.rac.util.combobox.iComboBox; + +//ˮƷͺʶ뵥 +public class JK8_WATER_PRODUCT_MODEL_Form extends AbstractRendering { + private TCComponentForm form; + private TCSession session; + // private Registry registry = null; + private JScrollPane jsp; + private JPanel jpall; + private JPanel jp1; + private JPanel jp11; + private JPanel jp12; + + private JPanel jp2; + private JPanel jp21; + private JPanel jp22; + + private JPanel jp3; + private JPanel jp31; + private JPanel jp32; + + private JPanel jp4; + + private JLabel jlab11; + private JTextField jtxt11;// Ʒ + private JTextField jtxt12 = new JTextField(24);// Ŀ + private JTextField jtxt13 = new JTextField(24);// Ŀ + + private JButton tj = new JButton("ύ"); + + private JLabel jlab21; + // private JLabel jlab22; + private JLabel jlab31; + + + + // private JRadioButton myjcb;// + // private JRadioButton gyjcb;// + + private iComboBox box1 = new iComboBox();// Ʒ + private iComboBox box2 = new iComboBox();// ṹ +// private iComboBox box3 = new iComboBox();// ͨŷʽ +// private iComboBox box4 = new iComboBox();// ʶŲƷ + private iComboBox box5 = new iComboBox();// + private iComboBox box6 = new iComboBox();// + private iComboBox box7 = new iComboBox();// + /** add ȡͨŷʽ**/ + private iComboBox boxCharact = new iComboBox();// + private iComboBox boxMaterial = new iComboBox();// + + private JTextField jtxt21 = new JTextField(21);// ܾ + private JTextField jtxt41 = new JTextField(21);// Ʒͺ + private JTextField jtxt42 = new JTextField(21);// ʶ + + /** 1 **/ + private JTextArea comment = new JTextArea(3,21); + + private HashMap realNameMap;// lovѡֵ + + private String isCheck; + + public JK8_WATER_PRODUCT_MODEL_Form(TCComponentForm c) throws Exception { + + super(c); + form = c; + session = c.getSession(); + // registry = Registry.getRegistry(this); + String[] names = session.getPreferenceService().getStringValues( + "JK_WATER_METER_FORM");//ֵ ṹ=ֵA,ֵB,ֵC + if (names != null) { + + realNameMap = new HashMap<>(); + for (int i = 0; i < names.length; i++) { + String[] s = names[i].split("="); + if (s != null && s.length == 2) { + String key = s[0]; + String value = s[1]; + realNameMap.put(key, value); + } else { + MessageBox.post("ѡ JK_WATER_METER_FORM ôϵԱ", "", + MessageBox.ERROR); + return; + } + + } + + } else { + MessageBox.post("ѡ JK_WATER_METER_FORM ڣϵԱ", "", + MessageBox.ERROR); + } + + // init(); + loadRendering(); + + jpall.addMouseMotionListener(new MouseMotionListener() { + + @Override + public void mouseMoved(MouseEvent arg0) { + try { + isCheck = form.getTCProperty("fnd0IsCheckoutable") + .getDisplayableValue(); + } catch (TCException e1) { + + e1.printStackTrace(); + } + if ("".equals(isCheck)) { + + + setOwnerHave(); + } + + } + + + @Override + public void mouseDragged(MouseEvent arg0) { + + + } + }); + + jtxt41.setEnabled(false); + jtxt42.setEnabled(false); + if(box1.getTextField().getText().equals("")) { + box2.setVisible(false); + } + System.out.println("end"); + } + + private void init() { + setLayout(new BorderLayout()); + jpall = new JPanel(new PropertyLayout()); + jp1 = new JPanel(new PropertyLayout()); + jp2 = new JPanel(new PropertyLayout()); + jp3 = new JPanel(new PropertyLayout()); + jp4 = new JPanel(new PropertyLayout()); + // jp1ʼ + jp11 = new JPanel(new PropertyLayout()); + jp12 = new JPanel(new PropertyLayout()); + jlab11 = new JLabel(" ˮƷͺšʶ뵥 "); + jlab11.setFont(new Font("", 1, 24)); + jtxt11 = new JTextField(); + jtxt11.setColumns(60); + jtxt11.setBackground(Color.white); + jp11.add("1.1.left.top", jlab11); + + + jp12.add("1.1.left.top", new JLabel(" Ʒƣ ")); + jp12.add("1.2.right.top", getjl()); + jp12.add("1.3.left.top", jtxt11); + jp12.add("2.1.left.top", new JLabel(" Ŀƣ ")); + jp12.add("2.2.right.top", getjl()); + jp12.add("2.3.left.top", jtxt12); + jp12.add("3.1.left.top", new JLabel(" Ŀţ ")); + jp12.add("3.2.right.top", getjl()); + jp12.add("3.3.left.top", jtxt13); + jp1.add("1.1.left.top", jp11); + jp1.add("2.1.left.top", jp12); + + + jp21 = new JPanel(new PropertyLayout()); + jp22 = new JPanel(new PropertyLayout()); + + jlab21= new JLabel(" ˮƷͺϢǼ: "); + jp21.add("1.1.left.top",jlab21); + jlab21.setFont(new Font("", 0, 16)); + jp22.add("1.1.left.top", new JLabel(" Ʒ: ")); + jp22.add("1.2.right.top", getjl()); + setLov(box1, "Ʒ"); + + jp22.add("1.3.left.top", box1); + jp22.add("1.4.left.top", new JLabel(" ܾ:")); + jp22.add("1.5.right.top", getjl()); + jp22.add("1.6.left.top", jtxt21); + + + jp22.add("2.1.left.top", new JLabel(" ṹ:")); + setLov(box2, "ṹ"); + jp22.add("2.2.left.top", getjl()); + jp22.add("2.3.left.top", box2); + /* jp22.add("2.4.left.top", new JLabel(" ͨŷʽ:")); + setLov(box3, "ͨŷʽ");*/ + /** add **/ + jp22.add("2.4.left.top", new JLabel(" :")); + setLov(boxCharact, ""); + // jp22.add("2.5.left.top", getjl()); + jp22.add("2.5.left.top", new JLabel(" ")); + jp22.add("2.6.left.top", boxCharact); + + /** add **/ + jp22.add("3.1.left.top", new JLabel(" :")); + setLov(boxMaterial, ""); + // jp22.add("3.2.left.top", getjl()); + jp22.add("3.2.left.top", new JLabel(" ")); + jp22.add("3.3.left.top", boxMaterial); + + /** add 1 **/ + /* jp22.add("3.1.left.top", new JLabel(" :") ); + jp22.add("3.2.right.top", new JLabel(" ") ); + jp22.add("3.3.left.top", comment1 );*/ + + box1.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + if (box1.getTextField().getText().equals("")) { + box2.setSelectedIndex(-1); + box2.setEnabled(false); + box2.setVisible(false); + }else { + box2.setEnabled(true); + box2.setVisible(true); + } + + } + }); + jp2.add("1.1.left.top", jp21); + jp2.add("2.1.left.top", jp22); + + + jlab31 = new JLabel(" ˮʶϢǼ"); + jlab31.setFont(new Font("", 0, 16)); + + jp32 = new JPanel(new PropertyLayout()); + /*jp32.add("1.1.left.top", new JLabel(" Ʒ:")); + setLov(box4, "Ʒ"); + jp32.add("1.2.right.top", getjl()); + jp32.add("1.3.left.top", box4);*/ + jp32.add("1.1.left.top", new JLabel(" :")); + jp32.add("1.2.right.top", getjl()); + setLov(box5, ""); + jp32.add("1.3.left.top", box5); + jp32.add("1.4.left.top", new JLabel(" :")); + setLov(box6, ""); + jp32.add("1.5.right.top", getjl()); + jp32.add("1.6.left.top", box6); + jp32.add("2.1.left.top", new JLabel(" :")); + setLov(box7, ""); + jp32.add("2.2.right.top", getjl()); + jp32.add("2.3.left.top", box7); + + /** add 2 **/ + jp32.add("3.1.left.top", new JLabel(" :") ); + jp32.add("3.2.right.top", getjl() ); + jp32.add("3.3.left.top", comment ); + comment.setLineWrap(true); + + jp3.add("1.1.left.top", jlab31); + jp3.add("2.1.left.top", jp32); + + // jp4ʼ + jp4.add("1.1.left.top", new JLabel(" Ʒͺţ ")); + jp4.add("1.2.right.top", new JLabel(" ")); + jp4.add("1.3.left.top", jtxt41); + jp4.add("1.4.left.top", new JLabel(" ʶţ")); + jp4.add("1.5.right.top", new JLabel(" ")); + jp4.add("1.6.left.top", jtxt42); + + jpall.add("1.1.left.top", jp1); + jpall.add("2.1.left.top", new JLabel("")); + jpall.add("3.1.left.top", jp2); + jpall.add("4.1.left.top", new JLabel("")); + jpall.add("5.1.left.top", jp3); + jpall.add("6.1.left.top", new JLabel("")); + jpall.add("7.1.left.top", jp4); + jpall.add("8.1.left.top", new JLabel("")); + jsp = new JScrollPane(jpall);// + jsp.setPreferredSize(new Dimension(700, 600)); + this.add(jsp, "Center"); + setVisible(true); + + } + + private void setLov(iComboBox box, String st) { + box.setTextFieldLength(20); + box.setAutoCompleteSuggestive(false); + box.addItems(realNameMap.get(st).split(",")); + } + + @Override + public void loadRendering() throws TCException { + init(); + + jtxt11.setText(form.getTCProperty("jk8ProductName").getStringValue());// Ʒ + jtxt12.setText(form.getTCProperty("jk8ProjectName").getStringValue());// Ŀ + jtxt13.setText(form.getTCProperty("jk8ProjectNO").getStringValue());// Ŀ + box1.setText(form.getTCProperty("jk8ProductTypePMN").getStringValue());// Ʒͺ֮Ʒ + System.out.println("Ʒ-----"+box1.getTextField().getText()); + System.out.println("--------"+form.getTCProperty("jk8ProductTypePMN").getStringValue()); + if(form.getTCProperty("jk8ProductTypePMN").getStringValue().equals("")) { + box2.setEnabled(false); + }else { + box2.setEnabled(true); + + } + + String structure = form.getTCProperty("jk8Structure").getStringValue();//ṹ + box2.setText(structure);// ṹ + // box3.setText(form.getTCProperty("jk8CommunicateMode").getStringValue());// ͨŷʽ + /** add **/ + boxCharact.setText(form.getTCProperty("jk8Feature").getStringValue());// + boxMaterial.setText(form.getTCProperty("jk8Texture").getStringValue());// + +// box4.setText(form.getTCProperty("jk8ProductTypePIN").getStringValue());// ʶ֮Ʒ + box5.setText(form.getTCProperty("jk8BMMaterial").getStringValue());// + box6.setText(form.getTCProperty("jk8BMManufactor").getStringValue()); // + box7.setText(form.getTCProperty("jk8ContrlCompType").getStringValue()); // + + jtxt21.setText(form.getTCProperty("jk8PipeDSpec").getStringValue());// ܾ + jtxt41.setText(form.getTCProperty("jk8ProductModNO").getStringValue());// Ʒͺ + jtxt42.setText(form.getTCProperty("jk8ProductIdentifyNO").getStringValue());// ʶ + + // + comment.setText(form.getTCProperty("jk8FunctionOverview").getStringValue()); + + } + + // + @Override + public void saveRendering() { + boolean isno=true; + //Ʒbox1ѡΪʱṹbox2ΪΪƷѡʱձ׼˵ûнṹλ + if ("".equals(jtxt11.getText()) || "".equals(jtxt12.getText()) + || "".equals(jtxt13.getText()) + ||"".equals(box1.getTextField().getText()) + ||"".equals(box2.getTextField().getText()) + || "".equals(comment.getText()) + ) { + isno=false; + } + if (!"".equals(jtxt11.getText())&&! "".equals(jtxt12.getText())&& !"".equals(jtxt13.getText()) + &&"".equals(box1.getTextField().getText())&&! "".equals(comment.getText())) { + isno=true; + } + + if(isno){ + try { + form.getTCProperty("jk8ProductName").setStringValue(jtxt11.getText());// Ʒ + form.getTCProperty("jk8ProjectName").setStringValue(jtxt12.getText());// Ŀ + form.getTCProperty("jk8ProjectNO").setStringValue(jtxt13.getText());// Ŀ + form.getTCProperty("jk8PipeDSpec").setStringValue(jtxt21.getText());// ܾ + form.getTCProperty("jk8ProductModNO").setStringValue(jtxt41.getText());// Ʒͺ + form.getTCProperty("jk8ProductIdentifyNO").setStringValue(jtxt42.getText());// ʶ + form.getTCProperty("jk8ProductTypePMN").setStringValue(box1.getTextField().getText());// ƷͺŵIJƷ + form.getTCProperty("jk8Structure").setStringValue(box2.getTextField().getText());// ṹ + // form.getTCProperty("jk8CommunicateMode").setStringValue(box3.getTextField().getText());// ͨŷʽ + /** add **/ + form.getTCProperty("jk8Feature").setStringValue(boxCharact.getTextField().getText());// + form.getTCProperty("jk8Texture").setStringValue(boxMaterial.getTextField().getText());// +// form.getTCProperty("jk8ProductTypePIN").setStringValue( +// box4.getTextField().getText());// ʶŵIJƷ + form.getTCProperty("jk8BMMaterial").setStringValue(box5.getTextField().getText());// + form.getTCProperty("jk8BMManufactor").setStringValue(box6.getTextField().getText()); // + form.getTCProperty("jk8ContrlCompType").setStringValue(box7.getTextField().getText()); // +// MessageBox.post("ʶѴ,޷ٴα", "", MessageBox.ERROR); + + // + form.getTCProperty("jk8FunctionOverview").setStringValue(comment.getText()); + + + } catch (TCException e) { + e.printStackTrace(); + } + }else{ + MessageBox.post("޷,ȷȫд!!", "", MessageBox.ERROR); + + } + + } + + // ƴӶѡַ + + // ÷ӵ߲ɱ༭ + public void setOwnerHave() { + try { + + String user = session.getUserName(); + String owning_user = form.getProperty("owning_user"); + // System.out.println("owning_user.indexOf(user)="+owning_user.indexOf(user)); + if (owning_user.indexOf(user) < 0) { + + jtxt11.setEnabled(false); + jtxt12.setEnabled(false); + jtxt13.setEnabled(false); + jtxt21.setEnabled(false); + jtxt41.setEnabled(false); + jtxt42.setEnabled(false); + + } + } catch (TCException e) { + System.out.println("ӵǷʱļеòȷҲ"); + e.printStackTrace(); + } + } + + + // ˮƷͺϢǼǷɱ༭ + private void setJcb1(boolean is) { + box1.setEnabled(is); + box2.setEnabled(is); +// box3.setEnabled(is); + /** add **/ + boxCharact.setEnabled(is); + boxMaterial.setEnabled(is); +// box4.setEnabled(is); + box5.setEnabled(is); + box6.setEnabled(is); + box7.setEnabled(is); + + } + + + public boolean isRenderingModified() { + System.out.println("isRenderingModified"); + + try { + + if (isrend(form.getTCProperty("jk8ProductName"), jtxt11.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ProjectName"), jtxt12.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ProjectNO"), jtxt13.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8PipeDSpec"), jtxt21.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ProductModNO"), jtxt41.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ProductIdentifyNO"), jtxt42.getText())) { + + return true; + } + if (isrend(form.getTCProperty("jk8ProductTypePMN"), box1.getTextField().getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8Structure"), box2.getTextField().getText())) { + return true; + } + + /* if (isrend(form.getTCProperty("jk8CommunicateMode"), box3.getTextField().getText())) { + return true; + }*/ + /** add **/ + if (isrend(form.getTCProperty("jk8Feature"), boxCharact.getTextField().getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8Texture"), boxMaterial.getTextField().getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8BMMaterial"), box5.getTextField().getText())) { + return true; + } + + if (isrend(form.getTCProperty("jk8BMManufactor"), box6.getTextField().getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ContrlCompType"), box7.getTextField().getText())) { + return true; + } + + // + if (isrend(form.getTCProperty("jk8FunctionOverview"), comment.getText())) { + return true; + } + } catch (TCException e) { + e.printStackTrace(); + } // гѡ + return false; + } + + + private boolean isrend(TCProperty tcProperty, String str) { + if(tcProperty!=null&&str!=null&&(!str.equals(tcProperty.getStringValue()))){ + System.out.println(str); + return true; + } + return false; + } + + + + // ֻܵѡ + + private JLabel getjl() { + JLabel bt = new JLabel("*"); + bt.setForeground(Color.red); + return bt; + } +} diff --git a/src/com/teamcenter/rac/form/JK8_WATER_PRODUCT_MODEL_Form_old.java b/src/com/teamcenter/rac/form/JK8_WATER_PRODUCT_MODEL_Form_old.java new file mode 100644 index 0000000..eb49413 --- /dev/null +++ b/src/com/teamcenter/rac/form/JK8_WATER_PRODUCT_MODEL_Form_old.java @@ -0,0 +1,490 @@ +package com.teamcenter.rac.form; + +//import java.awt.Dimension; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionListener; +import java.util.HashMap; + +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextField; + +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.stylesheet.AbstractRendering; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; +import com.teamcenter.rac.util.combobox.iComboBox; + +//ˮƷͺʶ뵥 +public class JK8_WATER_PRODUCT_MODEL_Form_old extends AbstractRendering { + private TCComponentForm form; + private TCSession session; + // private Registry registry = null; + private JScrollPane jsp; + private JPanel jpall; + private JPanel jp1; + private JPanel jp11; + private JPanel jp12; + + private JPanel jp2; + private JPanel jp21; + private JPanel jp22; + + + + private JPanel jp3; + private JPanel jp31; + private JPanel jp32; + + private JPanel jp4; + + + + private JLabel jlab11; + private JTextField jtxt11;// Ʒ + private JTextField jtxt12 = new JTextField(24);// Ŀ + private JTextField jtxt13 = new JTextField(24);// Ŀ + + private JButton tj = new JButton("ύ"); + + private JLabel jlab21; + // private JLabel jlab22; + private JLabel jlab31; + + + + // private JRadioButton myjcb;// + // private JRadioButton gyjcb;// + + private iComboBox box1 = new iComboBox();// Ʒ + private iComboBox box2 = new iComboBox();// ṹ + private iComboBox box3 = new iComboBox();// ͨŷʽ +// private iComboBox box4 = new iComboBox();// ʶŲƷ + private iComboBox box5 = new iComboBox();// + private iComboBox box6 = new iComboBox();// + private iComboBox box7 = new iComboBox();// + + + + private JTextField jtxt21 = new JTextField(24);// ܾ + private JTextField jtxt41 = new JTextField(24);// Ʒͺ + private JTextField jtxt42 = new JTextField(24);// ʶ + + + + + + private HashMap realNameMap;// lovѡֵ + + private String isCheck; + + public JK8_WATER_PRODUCT_MODEL_Form_old(TCComponentForm c) throws Exception { + + super(c); + form = c; + session = c.getSession(); + // registry = Registry.getRegistry(this); + String[] names = session.getPreferenceService().getStringValues( + "JK_WATER_METER_FORM");//ֵ ṹ=ֵA,ֵB,ֵC + if (names != null) { + + realNameMap = new HashMap<>(); + for (int i = 0; i < names.length; i++) { + String[] s = names[i].split("="); + if (s != null && s.length == 2) { + String key = s[0]; + String value = s[1]; + realNameMap.put(key, value); + } else { + MessageBox.post("ѡ JK_WATER_METER_FORM ôϵԱ", "", + MessageBox.ERROR); + return; + } + + } + + } else { + MessageBox.post("ѡ JK_WATER_METER_FORM ڣϵԱ", "", + MessageBox.ERROR); + } + + // init(); + loadRendering(); + + jpall.addMouseMotionListener(new MouseMotionListener() { + + @Override + public void mouseMoved(MouseEvent arg0) { + try { + isCheck = form.getTCProperty("fnd0IsCheckoutable") + .getDisplayableValue(); + } catch (TCException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + if ("".equals(isCheck)) { + + + setOwnerHave(); + } + + } + + + @Override + public void mouseDragged(MouseEvent arg0) { + // TODO Auto-generated method stub + + } + }); + + jtxt41.setEnabled(false); + jtxt42.setEnabled(false); + if(box1.getTextField().getText().equals("")) { + box2.setVisible(false); + } + System.out.println("end"); + } + + private void init() { + setLayout(new BorderLayout()); + jpall = new JPanel(new PropertyLayout()); + jp1 = new JPanel(new PropertyLayout()); + jp2 = new JPanel(new PropertyLayout()); + jp3 = new JPanel(new PropertyLayout()); + jp4 = new JPanel(new PropertyLayout()); + // jp1ʼ + jp11 = new JPanel(new PropertyLayout()); + jp12 = new JPanel(new PropertyLayout()); + jlab11 = new JLabel(" ˮƷͺšʶ뵥 "); + jlab11.setFont(new Font("", 1, 24)); + jtxt11 = new JTextField(); + jtxt11.setColumns(60); + jtxt11.setBackground(Color.white); + jp11.add("1.1.left.top", jlab11); + + + jp12.add("1.1.left.top", new JLabel(" Ʒƣ ")); + jp12.add("1.2.right.top", getjl()); + jp12.add("1.3.left.top", jtxt11); + jp12.add("2.1.left.top", new JLabel(" Ŀƣ ")); + jp12.add("2.2.right.top", getjl()); + jp12.add("2.3.left.top", jtxt12); + jp12.add("3.1.left.top", new JLabel(" Ŀţ ")); + jp12.add("3.2.right.top", getjl()); + jp12.add("3.3.left.top", jtxt13); + jp1.add("1.1.left.top", jp11); + jp1.add("2.1.left.top", jp12); + + + jp21 = new JPanel(new PropertyLayout()); + jp22 = new JPanel(new PropertyLayout()); + + jlab21= new JLabel(" ˮƷͺϢǼ: "); + jp21.add("1.1.left.top",jlab21); + jlab21.setFont(new Font("", 0, 16)); + jp22.add("1.1.left.top", new JLabel(" Ʒ: ")); + jp22.add("1.2.right.top", getjl()); + setLov(box1, "Ʒ"); + + jp22.add("1.3.left.top", box1); + jp22.add("1.4.left.top", new JLabel(" ܾ:")); + jp22.add("1.5.right.top", getjl()); + jp22.add("1.6.left.top", jtxt21); + + + jp22.add("2.1.left.top", new JLabel(" ṹ:")); + setLov(box2, "ṹ"); + jp22.add("2.2.left.top", getjl()); + jp22.add("2.3.left.top", box2); + jp22.add("2.4.left.top", new JLabel(" ͨŷʽ:")); + setLov(box3, "ͨŷʽ"); + jp22.add("2.5.left.top", getjl()); + jp22.add("2.6.left.top", box3); + box1.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + if (box1.getTextField().getText().equals("")) { + box2.setSelectedIndex(-1); + box2.setEnabled(false); + box2.setVisible(false); + }else { + box2.setEnabled(true); + box2.setVisible(true); + } + + } + }); + jp2.add("1.1.left.top", jp21); + jp2.add("2.1.left.top", jp22); + + + jlab31 = new JLabel(" ˮʶϢǼ"); + jlab31.setFont(new Font("", 0, 16)); + + jp32 = new JPanel(new PropertyLayout()); + /*jp32.add("1.1.left.top", new JLabel(" Ʒ:")); + setLov(box4, "Ʒ"); + jp32.add("1.2.right.top", getjl()); + jp32.add("1.3.left.top", box4);*/ + jp32.add("1.1.left.top", new JLabel(" :")); + jp32.add("1.2.right.top", getjl()); + setLov(box5, ""); + jp32.add("1.3.left.top", box5); + jp32.add("1.4.left.top", new JLabel(" :")); + setLov(box6, ""); + jp32.add("1.5.right.top", getjl()); + jp32.add("1.6.left.top", box6); + jp32.add("2.1.left.top", new JLabel(" :")); + setLov(box7, ""); + jp32.add("2.2.right.top", getjl()); + jp32.add("2.3.left.top", box7); + + jp3.add("1.1.left.top", jlab31); + jp3.add("2.1.left.top", jp32); + + // jp4ʼ + jp4.add("1.1.left.top", new JLabel(" Ʒͺţ ")); + jp4.add("1.2.left.top", jtxt41); + jp4.add("1.3.left.top", new JLabel(" ʶţ")); + jp4.add("1.4.left.top", jtxt42); + + jpall.add("1.1.left.top", jp1); + jpall.add("2.1.left.top", new JLabel("")); + jpall.add("3.1.left.top", jp2); + jpall.add("4.1.left.top", new JLabel("")); + jpall.add("5.1.left.top", jp3); + jpall.add("6.1.left.top", new JLabel("")); + jpall.add("7.1.left.top", jp4); + jpall.add("8.1.left.top", new JLabel("")); + jsp = new JScrollPane(jpall);// + jsp.setPreferredSize(new Dimension(700, 600)); + this.add(jsp, "Center"); + setVisible(true); + + } + + private void setLov(iComboBox box, String st) { + box.setTextFieldLength(20); + box.setAutoCompleteSuggestive(false); + box.addItems(realNameMap.get(st).split(",")); + } + + @Override + public void loadRendering() throws TCException { + init(); + + jtxt11.setText(form.getTCProperty("jk8ProductName").getStringValue());// Ʒ + jtxt12.setText(form.getTCProperty("jk8ProjectName").getStringValue());// Ŀ + jtxt13.setText(form.getTCProperty("jk8ProjectNO").getStringValue());// Ŀ + box1.setText(form.getTCProperty("jk8ProductTypePMN").getStringValue());// Ʒͺ֮Ʒ + System.out.println("Ʒ-----"+box1.getTextField().getText()); + System.out.println("--------"+form.getTCProperty("jk8ProductTypePMN").getStringValue()); + if(form.getTCProperty("jk8ProductTypePMN").getStringValue().equals("")) { + box2.setEnabled(false); + }else { + box2.setEnabled(true); + + } + + String structure = form.getTCProperty("jk8Structure").getStringValue();//ṹ + box2.setText(structure);// ṹ + box3.setText(form.getTCProperty("jk8CommunicateMode").getStringValue());// ͨŷʽ +// box4.setText(form.getTCProperty("jk8ProductTypePIN").getStringValue());// ʶ֮Ʒ + box5.setText(form.getTCProperty("jk8BMMaterial").getStringValue());// + box6.setText(form.getTCProperty("jk8BMManufactor").getStringValue()); // + box7.setText(form.getTCProperty("jk8ContrlCompType").getStringValue()); // + + jtxt21.setText(form.getTCProperty("jk8PipeDSpec").getStringValue());// ܾ + jtxt41.setText(form.getTCProperty("jk8ProductModNO").getStringValue());// Ʒͺ + jtxt42.setText(form.getTCProperty("jk8ProductIdentifyNO").getStringValue());// ʶ + + + } + + + + + + + + + + // + @Override + public void saveRendering() { + boolean isno=true; + //Ʒbox1ѡΪʱṹbox2ΪΪƷѡʱձ׼˵ûнṹλ + if ("".equals(jtxt11.getText()) || "".equals(jtxt12.getText()) + || "".equals(jtxt13.getText()) + ||"".equals(box1.getTextField().getText()) + ||"".equals(box2.getTextField().getText()) + || "".equals(box3.getTextField().getText()) + ) { + isno=false; + } + if (!"".equals(jtxt11.getText()) + &&! "".equals(jtxt12.getText()) + && !"".equals(jtxt13.getText()) + &&"".equals(box1.getTextField().getText()) + + &&! "".equals(box3.getTextField().getText()) + ) { + isno=true; + } + + if(isno){ + try { + form.getTCProperty("jk8ProductName").setStringValue( + jtxt11.getText());// Ʒ + form.getTCProperty("jk8ProjectName").setStringValue( + jtxt12.getText());// Ŀ + form.getTCProperty("jk8ProjectNO").setStringValue(jtxt13.getText());// Ŀ + form.getTCProperty("jk8PipeDSpec").setStringValue(jtxt21.getText());// ܾ + form.getTCProperty("jk8ProductModNO").setStringValue(jtxt41.getText());// Ʒͺ + form.getTCProperty("jk8ProductIdentifyNO").setStringValue(jtxt42.getText());// ʶ + form.getTCProperty("jk8ProductTypePMN").setStringValue( + box1.getTextField().getText());// ƷͺŵIJƷ + form.getTCProperty("jk8Structure").setStringValue( + box2.getTextField().getText());// ṹ + form.getTCProperty("jk8CommunicateMode").setStringValue( + box3.getTextField().getText());// ͨŷʽ +// form.getTCProperty("jk8ProductTypePIN").setStringValue( +// box4.getTextField().getText());// ʶŵIJƷ + form.getTCProperty("jk8BMMaterial").setStringValue( + box5.getTextField().getText());// + form.getTCProperty("jk8BMManufactor").setStringValue( + box6.getTextField().getText()); // + form.getTCProperty("jk8ContrlCompType").setStringValue( + box7.getTextField().getText()); // +// MessageBox.post("ʶѴ,޷ٴα", "", MessageBox.ERROR); + } catch (TCException e) { + e.printStackTrace(); + } + }else{ + MessageBox.post("޷,ȷȫд!!", "", MessageBox.ERROR); + } + + } + + // ƴӶѡַ + + // ÷ӵ߲ɱ༭ + public void setOwnerHave() { + try { + + String user = session.getUserName(); + String owning_user = form.getProperty("owning_user"); + // System.out.println("owning_user.indexOf(user)="+owning_user.indexOf(user)); + if (owning_user.indexOf(user) < 0) { + + jtxt11.setEnabled(false); + jtxt12.setEnabled(false); + jtxt13.setEnabled(false); + jtxt21.setEnabled(false); + jtxt41.setEnabled(false); + jtxt42.setEnabled(false); + + } + } catch (TCException e) { + System.out.println("ӵǷʱļеòȷҲ"); + e.printStackTrace(); + } + } + + + // ˮƷͺϢǼǷɱ༭ + private void setJcb1(boolean is) { + box1.setEnabled(is); + box2.setEnabled(is); + box3.setEnabled(is); +// box4.setEnabled(is); + box5.setEnabled(is); + box6.setEnabled(is); + box7.setEnabled(is); + + } + + + public boolean isRenderingModified() { + System.out.println("isRenderingModified"); + + try { + + if (isrend(form.getTCProperty("jk8ProductName"), jtxt11.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ProjectName"), jtxt12.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ProjectNO"), jtxt13.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8PipeDSpec"), jtxt21.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ProductModNO"), jtxt41.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ProductIdentifyNO"), jtxt42.getText())) { + + return true; + } + if (isrend(form.getTCProperty("jk8ProductTypePMN"), box1.getTextField().getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8Structure"), box2.getTextField().getText())) { + return true; + } + + if (isrend(form.getTCProperty("jk8CommunicateMode"), box3.getTextField().getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8BMMaterial"), box5.getTextField().getText())) { + return true; + } + + if (isrend(form.getTCProperty("jk8BMManufactor"), box6.getTextField().getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ContrlCompType"), box7.getTextField().getText())) { + return true; + } + + } catch (TCException e) { + e.printStackTrace(); + } // гѡ + return false; + } + + + private boolean isrend(TCProperty tcProperty, String str) { + if(tcProperty!=null&&str!=null&&(!str.equals(tcProperty.getStringValue()))){ + System.out.println(str); + return true; + } + return false; + } + + + + // ֻܵѡ + + private JLabel getjl() { + JLabel bt = new JLabel("*"); + bt.setForeground(Color.red); + return bt; + } +} diff --git a/src/com/teamcenter/rac/form/JK8_WATER_SBH_Form.java b/src/com/teamcenter/rac/form/JK8_WATER_SBH_Form.java new file mode 100644 index 0000000..d8a2740 --- /dev/null +++ b/src/com/teamcenter/rac/form/JK8_WATER_SBH_Form.java @@ -0,0 +1,627 @@ +package com.teamcenter.rac.form; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionListener; +import java.util.HashMap; + +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextField; + +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.stylesheet.AbstractRendering; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; +import com.teamcenter.rac.util.combobox.iComboBox; + +//2вƷͺţˮƷʶ +public class JK8_WATER_SBH_Form extends AbstractRendering { + + private static final long serialVersionUID = 1L; + private TCComponentForm form; + private TCSession session; + private JButton yanzhen; + private JPanel mainPanel; + + private JPanel firstJPanel; +// private JPanel secondJPanel; +// private JPanel secondJPanel_1; + private JPanel thirdJPanel; + private JScrollPane jsp; + // private Registry registry = null; + private JPanel topJPanel; + private JPanel charu1; + private JPanel charu2; + + private JLabel jl1; + private JLabel jl2; + + private JTextField jt01;// Ŀ + private JTextField jt02;// Ŀ + private JTextField jt03;// Ʒ + private JTextField jt04;// Ʒ + private JTextField jt05;// ṹ + private JTextField jt06;// ܾ +// private JTextField jt07;// ͨŷʽ + /****/ + private JTextField tzText; + /****/ + private JTextField czText; + private JTextField jt1;//Ʒͺ + private JTextField jt2; + + private JTextField jt9;//ʶ + +// private iComboBox box1 = new iComboBox();// Ʒ + private iComboBox box2 = new iComboBox();// + private iComboBox box3 = new iComboBox();// + private iComboBox box4 = new iComboBox();// + + + private HashMap realNameMap;// lovѡֵ + private String jt;// Ʒͺ + + private String isCheck; + private boolean is = false; + + public JK8_WATER_SBH_Form(TCComponentForm arg0) throws Exception { + super(arg0); + form = arg0; + session = arg0.getSession(); + // registry = Registry.getRegistry(this); + String[] names = session.getPreferenceService().getStringValues("JK_WATER_METER_FORM"); + if (names != null) { + + realNameMap = new HashMap<>(); + for (int i = 0; i < names.length; i++) { + String[] s = names[i].split("="); + if (s != null && s.length == 2) { + String key = s[0]; + String value = s[1]; + realNameMap.put(key, value); + } + + } + + } else { + MessageBox.post("ѡ JK_WATER_METER_FORM ڣϵԱ", "", MessageBox.ERROR); + } + initializeUI(); + loadRendering(); + + mainPanel.addMouseMotionListener(new MouseMotionListener() { + + @Override + public void mouseMoved(MouseEvent e) { + + try { + isCheck = form.getTCProperty("fnd0IsCheckoutable").getDisplayableValue(); + } catch (TCException e1) { + + e1.printStackTrace(); + } + if ("".equals(isCheck)) { + seten(is); + setOwnerHave(); + } + } + + @Override + public void mouseDragged(MouseEvent e) { + + + } + }); + + jt9.setEnabled(false); + + } + + private void setLov(iComboBox box, String st) { + + box.setTextFieldLength(18); + box.setAutoCompleteSuggestive(false); + box.addItems(realNameMap.get(st).split(",")); + } + + public void initializeUI() { + System.out.println("UI-----Start"); + setLayout(new BorderLayout()); + initPanel(); + + jsp = new JScrollPane(initPanel()); + jsp.setPreferredSize(new Dimension(450, 490)); + jsp.getVerticalScrollBar().setUnitIncrement(20); + + add(jsp, "Center"); + this.setVisible(true); + this.setBackground(Color.lightGray); + } + + public JPanel initPanel() { + System.out.println("--------------------------"); + mainPanel = new JPanel(new PropertyLayout()); + this.setSize(new Dimension(650, 320)); + jt01 = new JTextField(30); + jt02 = new JTextField(30); + jt03 = new JTextField(30); + jt04 = new JTextField(30); + jt05 = new JTextField(30); + jt06 = new JTextField(30); + // jt07 = new JTextField(30); + tzText = new JTextField(30); + czText = new JTextField(30); + jt1 = new JTextField(30); + + jt9 = new JTextField(20); + + + jl1 = new JLabel(" ˮƷʶ"); + jl1.setFont(new Font("", 1, 24)); + jl2 = new JLabel(" ˮƷʶϢǼ"); + jl2.setFont(new Font("", 1, 18)); + + topJPanel = new JPanel(new PropertyLayout()); + topJPanel.add("1.1.left.top.preferred.preferred", jl1); + topJPanel.add("1.2.left.top.preferred.preferred", new JLabel( + " ")); + // tijiao = new JButton("ύ"); + // tijiao.setPreferredSize(new Dimension(70, 30)); + // topJPanel.add("1.3.left.top.preferred.preferred", tijiao); + + firstJPanel = new JPanel(new PropertyLayout()); + firstJPanel.add("1.1.left.top.preferred.preferred", new JLabel( + " Ʒͺ:")); + firstJPanel.add("1.2.right.top.preferred.preferred", getjl()); + firstJPanel.add("1.3.left.top.preferred.preferred", jt1); + firstJPanel + .add("1.4.left.top.preferred.preferred", new JLabel(" ")); + yanzhen = new JButton("֤Ʒͺ"); + firstJPanel.add("1.5.left.top.preferred.preferred", yanzhen); + firstJPanel.add("2.1.left.top.preferred.preferred", new JLabel( + " Ŀ:")); +// firstJPanel.add("2.2.right.top.preferred.preferred", getjl()); + firstJPanel.add("2.2.left.top.preferred.preferred", jt01); + firstJPanel.add("3.1.left.top.preferred.preferred", new JLabel( + " Ŀ:")); +// firstJPanel.add("3.2.right.top.preferred.preferred", getjl()); + firstJPanel.add("3.2.left.top.preferred.preferred", jt02); + firstJPanel.add("4.1.left.top.preferred.preferred", new JLabel( + " Ʒ:")); +// firstJPanel.add("4.2.right.top.preferred.preferred", getjl()); + firstJPanel.add("4.2.left.top.preferred.preferred", jt03); + firstJPanel.add("5.1.left.top.preferred.preferred", new JLabel(" Ʒ:")); + firstJPanel.add("5.2.left.top.preferred.preferred", jt04); + firstJPanel.add("6.1.left.top.preferred.preferred", new JLabel(" ṹ:")); + firstJPanel.add("6.2.left.top.preferred.preferred", jt05); + firstJPanel.add("7.1.left.top.preferred.preferred", new JLabel(" ܾ:")); + firstJPanel.add("7.2.left.top.preferred.preferred", jt06); + /* firstJPanel.add("8.1.left.top.preferred.preferred", new JLabel(" ͨŷʽ:")); + firstJPanel.add("8.2.left.top.preferred.preferred", jt07);*/ + firstJPanel.add("8.1.left.top.preferred.preferred", new JLabel(" :")); + firstJPanel.add("8.2.left.top.preferred.preferred", tzText); + firstJPanel.add("9.1.left.top.preferred.preferred", new JLabel(" :")); + firstJPanel.add("9.2.left.top.preferred.preferred", czText); + yanzhen.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + System.out.println("֤"); + yzbut(); + } + }); + charu1 = new JPanel(new PropertyLayout()); + charu1.add("1.1.left.top.preferred.preferred", jl2); + + charu2 = new JPanel(new PropertyLayout()); + /*charu2.add("1.1.left.top.preferred.preferred", + new JLabel(" Ʒ:")); + charu2.add("1.2.right.top.preferred.preferred", getjl()); + setLov(box1, "Ʒ"); + charu2.add("1.3.left.top.preferred.preferred", box1);*/ + charu2.add("1.1.left.top.preferred.preferred", new JLabel(" :")); + charu2.add("1.2.right.top.preferred.preferred", getjl()); + // Ʒ + setLov(box2, ""); + charu2.add("1.3.left.top.preferred.preferred", box2); + charu2.add("2.1.left.top.preferred.preferred", new JLabel(" :")); + // + setLov(box3, ""); + charu2.add("2.2.right.top.preferred.preferred", getjl()); + charu2.add("2.3.left.top.preferred.preferred", box3); + charu2.add("3.1.left.top.preferred.preferred", new JLabel( + " :")); + setLov(box4, ""); + charu2.add("3.2.left.top.preferred.preferred", getjl()); + charu2.add("3.3.left.top.preferred.preferred", box4); + + + + /*secondJPanel = new JPanel(new PropertyLayout()); + secondJPanel_1 = new JPanel(new PropertyLayout()); + secondJPanel_1.add("1.1.left.top.preferred.preferred", new JLabel( + " ͣ ")); + setLov(box4, ""); + secondJPanel_1.add("1.2.left.top.preferred.preferred", getjl()); + secondJPanel_1.add("1.3.left.top.preferred.preferred", box4); + + secondJPanel.add("1.1.left.top.preferred.preferred", secondJPanel_1);*/ + + thirdJPanel = new JPanel(new PropertyLayout()); + thirdJPanel.add("1.1.left.top.preferred.preferred", new JLabel( + " ʶţ ")); + thirdJPanel.add("1.2.left.top.preferred.preferred", jt9); + + mainPanel.add("1.1.left.top.preferred.preferred", topJPanel); + mainPanel.add("2.1.left.top.preferred.preferred", firstJPanel); + mainPanel.add("3.1.left.top.preferred.preferred", charu1); + mainPanel.add("4.1.left.top.preferred.preferred", charu2); +// mainPanel.add("5.1.left.top.preferred.preferred", secondJPanel); + mainPanel.add("5.1.left.top.preferred.preferred", thirdJPanel); + + jt01.setEnabled(false); + jt02.setEnabled(false); + jt03.setEnabled(false); + jt04.setEnabled(false); + jt05.setEnabled(false); + jt06.setEnabled(false); + + // jt07.setEnabled(false); + tzText.setEnabled(false); + czText.setEnabled(false); +// box1.setEnabled(false); + box2.setEnabled(false); + box3.setEnabled(false); + box4.setEnabled(false); + return mainPanel; + + } + + @Override + public void loadRendering() throws TCException { + jt1.setText(form.getTCProperty("jk8ProductModNO").getStringValue());// Ʒͺ + jt01.setText(form.getTCProperty("jk8ProjectName").getStringValue());// Ŀ + jt02.setText(form.getTCProperty("jk8ProjectNO").getStringValue());// Ŀ + jt03.setText(form.getTCProperty("jk8ProductName").getStringValue());// Ʒ + jt04.setText(form.getTCProperty("jk8ProductTypePMN").getStringValue());// Ʒ + jt05.setText(form.getTCProperty("jk8Structure").getStringValue());// ṹ + jt06.setText(form.getTCProperty("jk8PipeDSpec").getStringValue());// ܾ + // jt07.setText(form.getTCProperty("jk8CommunicateMode").getStringValue());// ͨŷʽ + + tzText.setText(form.getTCProperty("jk8Feature").getStringValue());// + czText.setText(form.getTCProperty("jk8Texture").getStringValue());// + +// box1.setText(form.getTCProperty("jk8ProductTypePIN").getStringValue());// ʶŵIJƷ + box2.setText(form.getTCProperty("jk8BMMaterial").getStringValue());// + box3.setText(form.getTCProperty("jk8BMManufactor").getStringValue());// + box4.setText(form.getTCProperty("jk8ContrlCompType").getStringValue());// + + + + jt9.setText(form.getTCProperty("jk8ProductIdentifyNO").getStringValue());// ʶ + + //sysc = form.getTCProperty("jk8ApplyMarket").getStringValue();// гѡֵ + + + } + + /*@Override + public Map getRenderingModified() { + Map modifiedRendering = new HashMap (); + try { + System.out.println("getRenderingModifiedʼ"); + saveRendering(); + }catch(Exception ex){ + ex.toString(); + System.out.println(ex.toString()); + } + + + return modifiedRendering; + }*/ + + public boolean isRenderingModified() { + System.out.println("isRenderingModified"); + +// box1.setText(form.getTCProperty("jk8ProductTypePIN").getStringValue());// ʶŵIJƷ + + try { + + if(isrend(form.getTCProperty("jk8ProductModNO"),jt1.getText())){ + return true; + } + + if(isrend(form.getTCProperty("jk8ProjectName"),jt01.getText())){ + return true; + } + + if(isrend(form.getTCProperty("jk8ProjectNO"),jt02.getText())){ + return true; + } + + if(isrend(form.getTCProperty("jk8ProductName"),jt03.getText())){ + return true; + } + + if(isrend(form.getTCProperty("jk8ProductTypePMN"),jt04.getText())){ + return true; + } + + if(isrend(form.getTCProperty("jk8Structure"),jt05.getText())){ + return true; + } + + if(isrend(form.getTCProperty("jk8PipeDSpec"),jt06.getText())){ + return true; + } + + /* if(isrend(form.getTCProperty("jk8CommunicateMode"),jt07.getText())){ + return true; + }*/ + + if(isrend(form.getTCProperty("jk8Feature"),tzText.getText())){ + return true; + } + + if(isrend(form.getTCProperty("jk8Texture"),czText.getText())){ + return true; + } + /*if(isrend(form.getTCProperty("jk8BMManufactor"),box1.getTextField().getText())){ + return true; + }*/ + if(isrend(form.getTCProperty("jk8BMMaterial"),box2.getTextField().getText())){ + return true; + } + + if(isrend(form.getTCProperty("jk8BMManufactor"),box3.getTextField().getText())){ + return true; + } + + if(isrend(form.getTCProperty("jk8ContrlCompType"),box4.getTextField().getText())){ + return true; + } + + if(isrend(form.getTCProperty("jk8ProductIdentifyNO"),jt9.getText())){ + return true; + } + + } catch (TCException e) { + e.printStackTrace(); + }// гѡ + return false; + } + + + private boolean isrend(TCProperty tcProperty, String str) { + if(tcProperty!=null&&str!=null&&(!str.equals(tcProperty.getStringValue()))){ + System.out.println(str); + return true; + } + return false; + } + + @Override + public void saveRendering() { + if ( + "".equals(jt1.getText()) +// || "".equals(jt01.getText()) +// || "".equals(jt02.getText()) +// || "".equals(jt2.getText()) +// || "".equals(box1.getTextField().getText()) + || "".equals(box2.getTextField().getText()) + || "".equals(box3.getTextField().getText()) + || "".equals(box4.getTextField().getText()) + ) { + MessageBox.post("޷,ȷȫд!!", "", MessageBox.ERROR); + + }else{ + if ("".equals(jt9.getText())) { + try { + form.getTCProperty("jk8ProductModNO").setStringValue( + jt1.getText());// Ʒͺ + form.getTCProperty("jk8ProjectName").setStringValue( + jt01.getText());// Ŀ + form.getTCProperty("jk8ProjectNO").setStringValue( + jt02.getText());// Ŀ + form.getTCProperty("jk8ProductName").setStringValue( + jt03.getText());// Ʒ + form.getTCProperty("jk8ProductTypePMN").setStringValue(jt04.getText());// + form.getTCProperty("jk8Structure").setStringValue(jt05.getText());// + form.getTCProperty("jk8PipeDSpec").setStringValue(jt06.getText());// + // form.getTCProperty("jk8CommunicateMode").setStringValue(jt07.getText());// + form.getTCProperty("jk8Feature").setStringValue(tzText.getText());// + form.getTCProperty("jk8Texture").setStringValue(czText.getText());// + /* form.getTCProperty("jk8ProductTypePIN").setStringValue( + box1.getTextField().getText());// Ʒ +*/ form.getTCProperty("jk8BMMaterial").setStringValue(box2.getTextField().getText());// + form.getTCProperty("jk8BMManufactor").setStringValue(box3.getTextField().getText());// + form.getTCProperty("jk8ContrlCompType").setStringValue(box4.getTextField().getText());// + form.getTCProperty("jk8ProductIdentifyNO").setStringValue(jt9.getText());// ʶ + + } catch (Exception e) { + e.printStackTrace(); + } + } else { +// MessageBox.post("ʶѴ,޷ٴα", "", MessageBox.ERROR); + } + } + + } + + public void setOwnerHave() { + try { + + String user = session.getUserName(); + String owning_user = form.getProperty("owning_user"); + // System.out.println("owning_user.indexOf(user)="+owning_user.indexOf(user)); + if (owning_user.indexOf(user) < 0) { + jt1.setEnabled(false); + jt01.setEnabled(false); + jt02.setEnabled(false); + jt03.setEnabled(false); + jt04.setEnabled(false); + jt05.setEnabled(false); + jt06.setEnabled(false); + // jt07.setEnabled(false); + tzText.setEnabled(false); + czText.setEnabled(false); + yanzhen.setEnabled(false); +// box1.setEnabled(false); + box2.setEnabled(false); + box3.setEnabled(false); + box4.setEnabled(false); + jt9.setEnabled(false); + + } + } catch (TCException e) { + System.out.println("ӵǷʱļеòȷҲ"); + e.printStackTrace(); + } + } + + public void seten(boolean is) { + /*jt01.setEnabled(is); + jt02.setEnabled(is); + jt03.setEnabled(is);*/ +// box1.setEnabled(is); + box2.setEnabled(is); + box3.setEnabled(is); + box4.setEnabled(is); + +// jt9.setEnabled(is); + + } + + private void yzbut() { + + + jt = jt1.getText(); + if (jt != null && !jt.equals("") && !jt.equals("")) { + TCPreferenceService pref = session.getPreferenceService(); + String puid = pref.getStringValue("JK_WATER_SQB_FORM_PUID");// ѡpuid + if (puid == null) { + MessageBox.post("ѡδҵϵԱ", "", MessageBox.ERROR); + } + + TCComponentForm formAll; + try { + formAll = (TCComponentForm) session.stringToComponent(puid); + if (formAll == null) { + MessageBox.post("δҵϵԱ", "", MessageBox.ERROR); + } + boolean ishave1 = ishave("jk8ProductModNO","jk8ProductIdentifyNO", + formAll);// ܱ// ²ƷͺŵǼDZеIJƷͺţʶţ + + if (ishave1) { + jt01.setEnabled(true); + jt02.setEnabled(true); + jt03.setEnabled(true); +// box1.setEnabled(true); + box2.setEnabled(true); + box3.setEnabled(true); + box4.setEnabled(true); + jt03.setText(form.getProperty("jk8ProductName"));// Ʒ + jt04.setText(form.getProperty("jk8ProductTypePMN"));// Ʒ + jt05.setText(form.getProperty("jk8Structure"));// ṹ + jt06.setText(form.getProperty("jk8PipeDSpec"));// ܾ + // jt07.setText(form.getProperty("jk8CommunicateMode"));// ͨŷʽ + tzText.setText(form.getProperty("jk8Feature"));// + czText.setText(form.getProperty("jk8Texture"));// + MessageBox.post("ҵƷͺţòƷͺſ", "ɹ", MessageBox.INFORMATION); + } else { + jt01.setEnabled(false); + jt02.setEnabled(false); + jt03.setEnabled(false); +// box1.setEnabled(false); + box2.setEnabled(false); + box3.setEnabled(false); + box4.setEnabled(false); + jt03.setText("");// Ʒ + jt04.setText("");// Ʒ + jt05.setText("");// ṹ + jt06.setText("");// ܾ + // jt07.setText("");// ͨŷʽ + tzText.setText("");// + czText.setText("");// + MessageBox.post("δҵƷͺţдIJƷͺǷȷ", "", + MessageBox.ERROR); + } + } catch (TCException e) { + e.printStackTrace(); + MessageBox.post(e.getMessage(), "", MessageBox.ERROR); + } + } else { + MessageBox.post("ƷͺŲΪգдٵť", "", MessageBox.ERROR); + } + + } + + private boolean ishave(String cpxh_all, String sbh_all, + TCComponentForm formAll) { + boolean bo = false; + try { + String[] cpxhs = formAll.getTCProperty(cpxh_all) + .getStringValueArray();// ܲƷͺ + String lx = ""; + String name = ""; + String jg=""; + String gjgg=""; + // String txfs=""; + String tz = ""; + String cz = ""; + for (int i = 0; i < cpxhs.length; i++) { + if (jt.equals(cpxhs[i])) { + lx = formAll.getTCProperty("jk8ProductTypePMN")//ϵͳjk8ProductType + .getStringValueArray()[i];// Ʒ + name = formAll.getTCProperty("jk8ProductName") + .getStringValueArray()[i];// Ʒ + jg = formAll.getTCProperty("jk8Structure") + .getStringValueArray()[i];// ṹ + gjgg = formAll.getTCProperty("jk8PipeDSpec") + .getStringValueArray()[i];// ܾ + // txfs = formAll.getTCProperty("jk8CommunicateMode") + // .getStringValueArray()[i];// ͨŷʽ + tz = formAll.getTCProperty("jk8Feature") + .getStringValueArray()[i];// + cz = formAll.getTCProperty("jk8Texture") + .getStringValueArray()[i];// + bo = true; + break; + } + } + System.out.println("Ʒ:" + lx); + System.out.println("Ʒ:" + name); + form.getTCProperty("jk8ProductTypePMN").setStringValue(lx);// ƷͺŵIJƷ + form.getTCProperty("jk8ProductName").setStringValue(name);// Ʒ + form.getTCProperty("jk8Structure").setStringValue(jg);// ṹ + form.getTCProperty("jk8PipeDSpec").setStringValue(gjgg);// ܾ + // form.getTCProperty("jk8CommunicateMode").setStringValue(txfs);// ͨŷʽ + form.getTCProperty("jk8Feature").setStringValue(tz);// + form.getTCProperty("jk8Texture").setStringValue(cz);// + seten(bo);//òɱ༭ + is = bo; + } catch (TCException e) { + e.printStackTrace(); + } + return bo; + } + + private JLabel getjl() { + JLabel bt = new JLabel("*"); + bt.setForeground(Color.red); + return bt; + } + +} diff --git a/src/com/teamcenter/rac/form/JK8_WATER_SBH_SUMMARY_Form.java b/src/com/teamcenter/rac/form/JK8_WATER_SBH_SUMMARY_Form.java new file mode 100644 index 0000000..ebfc264 --- /dev/null +++ b/src/com/teamcenter/rac/form/JK8_WATER_SBH_SUMMARY_Form.java @@ -0,0 +1,478 @@ +package com.teamcenter.rac.form; + +import java.awt.BorderLayout; +import java.awt.Font; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.List; + +import javax.swing.DefaultCellEditor; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTabbedPane; +import javax.swing.JTable; +import javax.swing.RowSorter; +import javax.swing.table.DefaultTableModel; +import javax.swing.table.TableCellEditor; +import javax.swing.table.TableColumn; +import javax.swing.table.TableModel; +import javax.swing.table.TableRowSorter; + +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.stylesheet.AbstractRendering; +import com.teamcenter.rac.util.MessageBox; + +//²Ʒͺűܱ +//ˮܱ +public class JK8_WATER_SBH_SUMMARY_Form extends AbstractRendering { + private List ta1 = new ArrayList<>(); + private Object[][] table1 = null; + + // IDEȡֵ + private String[] lx; + private String[] xmmc;// Ŀ + private String[] xmbh;// Ŀ + private String[] cpxh;// Ʒͺ + private String[] sbh;// ʶ + private String[] cpmc;// Ʒ + private String[] jbcj;// + private String[] jbcz;// + private String[] kzqzjlx;// + private String[] cplx;// Ʒ + private String[] jg;// ṹ + private String[] gjgg;// ܾ +// private String[] txfs;// ͨŷʽ + /** add **/ + private String[] tz;// + private String[] cz;// + private String[] gnms;// + + private String[] bz;// bz + private String[] sqr;// + private String[] djrq;// Ǽ + private String[] status;// ״̬ + + + // ȡֵ + private String[] lx1; + private String[] xmmc1;// Ŀ + private String[] xmbh1;// Ŀ + private String[] cpxh1;// Ʒͺ + private String[] sbh1;// ʶ + private String[] cpmc1;// Ʒ + private String[] jbcj1;// + private String[] jbcz1;// ICͺ + private String[] kzqzjlx1;// + private String[] cplx1;// Ʒ + private String[] jg1;// ṹ + private String[] gjgg1;// ܾ +// private String[] txfs1;// ͨŷʽ + /** add **/ + private String[] tz1;// + private String[] cz1;// + // private String[] u8mmh1;// U8 +// private String[] fm1;// +// private String[] jmlx1;// + private String[] sqr1;// + private String[] djrq1;// Ǽ +// private String[] sysc1;// г +// private String[] ptjbcj1;// ׻ + private String[] status1;// ״̬ + private String[] bz1;// ע +// private String[] fmlx1;// " +// private String[] txfs1;// ͨŷʽ +// private String[] gdlx1;// 緽ʽ + + private String[] gnms1;// + + private JLabel biaoti; + + private JPanel Panel; + private JPanel topJPanel; + private JPanel mainJPanel; + private JTabbedPane tabPane; + private JPanel biao1; + + + // private JButton outBut=new JButton(""); + private JButton addBut = new JButton(""); + private JTable dataTable1;// 1 + +/* + private Object[] obj = new Object[] { "", "Ŀ", "Ŀ", "Ʒͺ", "ʶ",//5 + "Ʒ","ṹ","ܾ","ͨŷʽ","Ʒ",//10 + "", "", "", "ע" ,"",//15 + "Ǽ","״̬"};//17 ˮ +*/ + private Object[] obj = new Object[] { "", "Ŀ", "Ŀ", "Ʒͺ", "ʶ", + "Ʒ","ṹ","ܾ",/*"ͨŷʽ",*/"","", + "Ʒ","", "", "", "", + "ע" ,"","Ǽ","״̬"}; // 19 + + private TCComponentForm form = null; + private TCSession session; + + private String name; + private String[] lovvals; + private boolean is = false; + + public JK8_WATER_SBH_SUMMARY_Form(TCComponentForm arg0) throws Exception { + super(arg0); + this.form = arg0; + this.session = arg0.getSession(); + name = session.getUser().getProperty("user_name"); + System.out.println("name=" + name); + TCPreferenceService pref = session.getPreferenceService(); + String[] names = pref.getStringValues("JK_WATER_HZB_Power");// ѡȨû + if (names != null) { + for (int i = 0; i < names.length; i++) { + System.out.println("Ȩ=" + names[i]); + if (names[i].equals(name)) { + System.out.println(""); + is = true; + } + } + } + lovvals = pref.getStringValues("JK_WATER_SUMMARY_STATUSLOV");// ״̬lov + if(lovvals==null||lovvals.length==0){ + MessageBox.post("ѡJK_WATER_SUMMARY_STATUSLOV","",MessageBox.WARNING); + return; + } + loadRendering(); + } + + public void initPanel() { + this.setLayout(new BorderLayout()); + Panel = new JPanel(new BorderLayout()); + topJPanel = new JPanel(new BorderLayout()); + biaoti = new JLabel("ˮƷͺʶŵǼDZ"); + biaoti.setFont(new Font("", 1, 24)); + // topJPanel.add("1.1.left.top", biaoti); + topJPanel.add(BorderLayout.CENTER, biaoti); + // topJPanel.add(BorderLayout.EAST, outBut); + if (is) { + topJPanel.add(BorderLayout.EAST, addBut); + } + mainJPanel = new JPanel(new BorderLayout()); + + biao1 = new JPanel(new BorderLayout()); + + // ǩҳ JTabbedPane + tabPane = new JTabbedPane(); + // + tabPane.add("ˮ", biao1); + // ñ + this.dataTable1 = getjTable(this.dataTable1, null, obj, table1); + biao1.add(new JScrollPane(this.dataTable1), BorderLayout.CENTER); + + + + settablecol(dataTable1);//״̬ + + setxh(dataTable1);// + dataTable1.setEnabled(false);// òɱ༭ + + mainJPanel.add(tabPane, BorderLayout.CENTER); + + Panel.add(topJPanel, BorderLayout.NORTH); + Panel.add(mainJPanel, BorderLayout.CENTER); + this.add(Panel); + this.setVisible(true); + + addBut.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + addrow(); + } + }); + + + } + + private void settablecol(JTable dataTable) { + + TableColumn tc=dataTable.getColumn("״̬");// ȡһ + JComboBox cbx = new JComboBox(lovvals);// б + TableCellEditor tce=new DefaultCellEditor(cbx);// ༭ + tc.setCellEditor(tce); + } + + public void addrow() { + + System.out.println(""); + String paname = tabPane.getTitleAt(tabPane.getSelectedIndex()); + System.out.println("ǰѡ:" + paname); + switch (paname) { + case "ˮ": + ((DefaultTableModel) dataTable1.getModel()).addRow(new String[18]); + setxh(dataTable1); + break; + default: + break; + } + + } + + // Jtableͨ÷ + public JTable getjTable(JTable partsTable, DefaultTableModel dtm, + Object[] titleNames, Object[][] values) { + int simpleLen = 105; + int totleLen = 900; + if (partsTable == null) { + + DefaultTableModel dtm1 = getTableModel(dtm, titleNames, values); + partsTable = new JTable(dtm1) { + public boolean isCelEditable(int row, int column) { + if(column==13) {//ע޸ + + return false; + }else { + return true; + + } + } + }; + RowSorter sorter = new TableRowSorter(dtm1); + // partsTable = new JTable(dtm); + partsTable.setRowSorter(sorter); + + if (simpleLen * titleNames.length >= totleLen) { + for (int i = 0; i < titleNames.length; i++) { + partsTable.getColumnModel().getColumn(i) + .setPreferredWidth(105); + } + partsTable.setAutoResizeMode(0); + } else { + partsTable.setAutoResizeMode(1); + } + } + return partsTable; + } + + // tableؼ + public DefaultTableModel getTableModel(DefaultTableModel dtm, + Object[] columnNameObjects, Object[][] objects) { + if (dtm == null) { + dtm = new DefaultTableModel(objects, columnNameObjects) + ; + } + return dtm; + } + + // ųʼ + private void setxh(JTable table) { + int cl = table.getRowCount(); + for (int i = 0; i < cl; i++) { + table.setValueAt(i + 1 + "", i, 0); + } + } + + @Override + public void loadRendering() throws TCException { + lx = form.getTCProperty("jk8ProductTypePMN").getStringArrayValue();//ͿпޣֻˮһࣻͣԻҪ + xmbh = form.getTCProperty("jk8ProjectNO").getStringArrayValue();// Ŀ + xmmc = form.getTCProperty("jk8ProjectName").getStringArrayValue();// Ŀ + cpxh = form.getTCProperty("jk8ProductModNO").getStringArrayValue();// Ʒͺ + sbh = form.getTCProperty("jk8ProductIdentifyNO").getStringArrayValue();// ʶ + + cpmc = form.getTCProperty("jk8ProductName").getStringArrayValue();// Ʒ + jbcj = form.getTCProperty("jk8BMManufactor").getStringArrayValue();// + jbcz = form.getTCProperty("jk8BMMaterial").getStringArrayValue();// + kzqzjlx = form.getTCProperty("jk8ContrlCompType").getStringArrayValue();// + bz = form.getTCProperty("jk8Note").getStringArrayValue();// ע + + sqr = form.getTCProperty("jk8Applicant").getStringArrayValue();// + djrq = form.getTCProperty("jk8RecordDate").getStringArrayValue();// Ǽ + status = form.getTCProperty("jk8Status").getStringArrayValue();// ״̬ + cplx = form.getTCProperty("jk8ProductTypePMN").getStringArrayValue();// Ʒ + gjgg = form.getTCProperty("jk8PipeDSpec").getStringArrayValue();// ܾ +// txfs = form.getTCProperty("jk8CommunicateMode").getStringArrayValue();// ͨŷʽ + /** add **/ + tz = form.getTCProperty("jk8Feature").getStringArrayValue();// + cz = form.getTCProperty("jk8Texture").getStringArrayValue();// + jg = form.getTCProperty("jk8Structure").getStringArrayValue();// ṹ + /** **/ + gnms = form.getTCProperty("jk8FunctionOverview").getStringArrayValue();// + + if (lx != null) { + for (int i = 0; i < lx.length; i++) { + System.out.println("lx=" + lx[i]); + if (true){ + //if (lx[i] != null){ + /* ta1.add(new String[] { "", xmmc[i], xmbh[i], cpxh[i], + sbh[i], cplx[i],jg[i],gjgg[i],txfs[i], + cpmc[i], jbcj[i], jbcz[i], kzqzjlx[i],gnms[i], + bz[i],sqr[i], djrq[i] ,status[i]});*/ + ta1.add(new String[] { "", xmmc[i], xmbh[i], cpxh[i], + sbh[i], cplx[i],jg[i],gjgg[i],tz[i],cz[i], + cpmc[i], jbcj[i], jbcz[i], kzqzjlx[i],gnms[i], + bz[i],sqr[i], djrq[i] ,status[i]}); +/* switch (lx[i]) { + case "tb1": + ta1.add(new String[] { "", xmmc[i], xmbh[i], cpxh[i], + sbh[i], cplx[i],jg[i],gjgg[i],txfs[i], + cpmc[i], jbcj[i], jbcz[i], kzqzjlx[i], + bz[i], sqr[i], djrq[i] ,status[i]}); + break; + + default: + + break; + + } +*/ } + + } + + if (ta1 != null) { + table1 = new Object[ta1.size()][13]; + add(table1, ta1); + } + + } + initPanel(); + + } + + // תΪά + private void add(Object[][] obj, List tb) { + + for (int i = 0; i < tb.size(); i++) { + obj[i] = tb.get(i); + } + } + + @Override + public void saveRendering() { + int rowCount1 = dataTable1.getRowCount(); + + System.out.println("rowcount1=" + rowCount1); + int count = rowCount1 ; + + // ʼ + lx1 = new String[count]; + xmmc1 = new String[count];// Ŀ + xmbh1 = new String[count];// Ŀ + cpxh1 = new String[count];// Ʒͺ + sbh1 = new String[count];// ʶ + cpmc1 = new String[count];// Ʒ + jbcj1 = new String[count];// + jbcz1 = new String[count];// + kzqzjlx1 = new String[count];// + cplx1 = new String[count];// Ʒ + jg1 = new String[count];// ṹ + gjgg1 = new String[count];// ܾ +// txfs1 = new String[count];// ͨŷʽ + tz1 = new String[count];// + cz1 = new String[count];// + // u8mmh1 = new String[count];// U8 + sqr1 = new String[count];// + djrq1 = new String[count];// Ǽ + status1 = new String[count];// ״̬ + bz1 = new String[count];// ע + gnms1 = new String[count];// + // ѭÿУֵformӦԡ + for (int j = 0; j < rowCount1; j++) { + lx1[j] = "tb1"; + xmmc1[j] = dataTable1.getValueAt(j, 1) == null ? "" + : (String) dataTable1.getValueAt(j, 1);// Ŀ + xmbh1[j] = dataTable1.getValueAt(j, 2) == null ? "" + : (String) dataTable1.getValueAt(j, 2);// Ŀ + cpxh1[j] = dataTable1.getValueAt(j, 3) == null ? "" + : (String) dataTable1.getValueAt(j, 3); + sbh1[j] = dataTable1.getValueAt(j, 4) == null ? "" + : (String) dataTable1.getValueAt(j, 4);// ʶ + cplx1[j] = dataTable1.getValueAt(j, 5) == null ? "" + : (String) dataTable1.getValueAt(j, 5);// Ʒ + jg1[j] = dataTable1.getValueAt(j, 6) == null ? "" + : (String) dataTable1.getValueAt(j, 6);// ṹ + gjgg1[j] = dataTable1.getValueAt(j, 7) == null ? "" + : (String) dataTable1.getValueAt(j, 7);// ܾ + /* txfs1[j] = dataTable1.getValueAt(j, 8) == null ? "" + : (String) dataTable1.getValueAt(j, 8);// ͨŷʽ +*/ tz1[j] = dataTable1.getValueAt(j, 8) == null ? "" + : (String) dataTable1.getValueAt(j, 8);// + cz[j] = dataTable1.getValueAt(j, 9) == null ? "" + : (String) dataTable1.getValueAt(j, 9);// + cpmc1[j] = dataTable1.getValueAt(j, 10) == null ? "" + : (String) dataTable1.getValueAt(j, 10);// Ʒ + jbcj1[j] = dataTable1.getValueAt(j, 11) == null ? "" + : (String) dataTable1.getValueAt(j, 11);// + jbcz1[j] = dataTable1.getValueAt(j, 12) == null ? "" + : (String) dataTable1.getValueAt(j, 12);// + kzqzjlx1[j] = dataTable1.getValueAt(j, 13) == null ? "" + : (String) dataTable1.getValueAt(j, 13);// + gnms1[j] = dataTable1.getValueAt(j, 14) == null ? "" + : (String) dataTable1.getValueAt(j, 14);// + bz1[j] = dataTable1.getValueAt(j, 15) == null ? "" + : (String) dataTable1.getValueAt(j, 15);// ע + sqr1[j] = dataTable1.getValueAt(j, 16) == null ? "" + : (String) dataTable1.getValueAt(j, 16);// + djrq1[j] = dataTable1.getValueAt(j, 17) == null ? "" + : (String) dataTable1.getValueAt(j, 17);// Ǽ + status1[j] = dataTable1.getValueAt(j, 18) == null ? "" + : (String) dataTable1.getValueAt(j, 18);// ״̬ + + } + + try { + form.getTCProperty("jk8ProjectName").setStringValueArray(xmmc1); + form.getTCProperty("jk8ProjectNO").setStringValueArray(xmbh1); + form.getTCProperty("jk8ProductTypePMN").setStringValueArray(lx1);// + form.getTCProperty("jk8ProductModNO").setStringValueArray(cpxh1); + form.getTCProperty("jk8ProductIdentifyNO").setStringValueArray(sbh1); + form.getTCProperty("jk8ProductName").setStringValueArray(cpmc1); + form.getTCProperty("jk8BMManufactor").setStringValueArray(jbcj1); + form.getTCProperty("jk8BMMaterial").setStringValueArray(jbcz1);// + form.getTCProperty("jk8ContrlCompType").setStringValueArray(kzqzjlx1);// + form.getTCProperty("jk8Applicant").setStringValueArray(sqr1); + form.getTCProperty("jk8RecordDate").setStringValueArray(djrq1); + + + form.getTCProperty("jk8Status").setStringValueArray(status1); //״̬jk8Status + form.getTCProperty("jk8Note").setStringValueArray(bz1);//ע + form.getTCProperty("jk8ProductTypePMN").setStringValueArray(cplx1); //Ʒ + form.getTCProperty("jk8Structure").setStringValueArray(jg1);//ṹ + form.getTCProperty("jk8PipeDSpec").setStringValueArray(gjgg1); //ܾ + // form.getTCProperty("jk8CommunicateMode").setStringValueArray(txfs1);//ͨŷʽ + form.getTCProperty("jk8Feature").setStringValueArray(tz1);// + form.getTCProperty("jk8Texture").setStringValueArray(cz1);// + /** add **/ + form.getTCProperty("jk8FunctionOverview").setStringValueArray(gnms1);// + } catch (TCException e) { + e.printStackTrace(); + } + + } + + + + public boolean isrend(Object[] jkfxget, Object[] jkfxset) { + + if (jkfxget != null && jkfxset != null) { + if (jkfxget.length == jkfxset.length) { + for (int i = 0; i < jkfxset.length; i++) { + if (jkfxget[i] != null && (!jkfxget[i].equals(jkfxset[i]))) { + return true; + } + if (jkfxget[i] == null && jkfxset[i] != null&&(!jkfxset[i].equals(""))) { + return true; + } + } + } else { + return true; + } + } + + return false; + } + +} diff --git a/src/com/teamcenter/rac/form/JK8_WATER_SBH_SUMMARY_Form_old.java b/src/com/teamcenter/rac/form/JK8_WATER_SBH_SUMMARY_Form_old.java new file mode 100644 index 0000000..c379f0b --- /dev/null +++ b/src/com/teamcenter/rac/form/JK8_WATER_SBH_SUMMARY_Form_old.java @@ -0,0 +1,444 @@ +package com.teamcenter.rac.form; + +import java.awt.BorderLayout; +import java.awt.Font; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.List; + +import javax.swing.DefaultCellEditor; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTabbedPane; +import javax.swing.JTable; +import javax.swing.RowSorter; +import javax.swing.table.DefaultTableModel; +import javax.swing.table.TableCellEditor; +import javax.swing.table.TableColumn; +import javax.swing.table.TableModel; +import javax.swing.table.TableRowSorter; + +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.stylesheet.AbstractRendering; +import com.teamcenter.rac.util.MessageBox; + +//²Ʒͺűܱ +public class JK8_WATER_SBH_SUMMARY_Form_old extends AbstractRendering { + private List ta1 = new ArrayList<>(); + private Object[][] table1 = null; + + // IDEȡֵ + private String[] lx; + private String[] xmmc;// Ŀ + private String[] xmbh;// Ŀ + private String[] cpxh;// Ʒͺ + private String[] sbh;// ʶ + private String[] cpmc;// Ʒ + private String[] jbcj;// + private String[] jbcz;// + private String[] kzqzjlx;// + private String[] cplx;// Ʒ + private String[] jg;// ṹ + private String[] gjgg;// ܾ + private String[] txfs;// ͨŷʽ + + + private String[] bz;// bz + private String[] sqr;// + private String[] djrq;// Ǽ + private String[] status;// ״̬ + + + // ȡֵ + private String[] lx1; + private String[] xmmc1;// Ŀ + private String[] xmbh1;// Ŀ + private String[] cpxh1;// Ʒͺ + private String[] sbh1;// ʶ + private String[] cpmc1;// Ʒ + private String[] jbcj1;// + private String[] jbcz1;// ICͺ + private String[] kzqzjlx1;// + private String[] cplx1;// Ʒ + private String[] jg1;// ṹ + private String[] gjgg1;// ܾ + private String[] txfs1;// ͨŷʽ + // private String[] u8mmh1;// U8 +// private String[] fm1;// +// private String[] jmlx1;// + private String[] sqr1;// + private String[] djrq1;// Ǽ +// private String[] sysc1;// г +// private String[] ptjbcj1;// ׻ + private String[] status1;// ״̬ + private String[] bz1;// ע +// private String[] fmlx1;// " +// private String[] txfs1;// ͨŷʽ +// private String[] gdlx1;// 緽ʽ + + private JLabel biaoti; + + private JPanel Panel; + private JPanel topJPanel; + private JPanel mainJPanel; + private JTabbedPane tabPane; + private JPanel biao1; + + + // private JButton outBut=new JButton(""); + private JButton addBut = new JButton(""); + private JTable dataTable1;// 1 + + + private Object[] obj = new Object[] { "", "Ŀ", "Ŀ", "Ʒͺ", "ʶ",//5 + "Ʒ","ṹ","ܾ","ͨŷʽ","Ʒ",//10 + "", "", "", "ע" ,"",//15 + "Ǽ","״̬"};//17 ˮ + + + private TCComponentForm form = null; + private TCSession session; + + private String name; + private String[] lovvals; + private boolean is = false; + + public JK8_WATER_SBH_SUMMARY_Form_old(TCComponentForm arg0) throws Exception { + super(arg0); + this.form = arg0; + this.session = arg0.getSession(); + name = session.getUser().getProperty("user_name"); + System.out.println("name=" + name); + TCPreferenceService pref = session.getPreferenceService(); + String[] names = pref.getStringValues("JK_WATER_HZB_Power");// ѡȨû + if (names != null) { + for (int i = 0; i < names.length; i++) { + System.out.println("Ȩ=" + names[i]); + if (names[i].equals(name)) { + System.out.println(""); + is = true; + } + } + } + lovvals = pref.getStringValues("JK_WATER_SUMMARY_STATUSLOV");// ״̬lov + if(lovvals==null||lovvals.length==0){ + MessageBox.post("ѡJK_WATER_SUMMARY_STATUSLOV","",MessageBox.WARNING); + return; + } + loadRendering(); + } + + public void initPanel() { + this.setLayout(new BorderLayout()); + Panel = new JPanel(new BorderLayout()); + topJPanel = new JPanel(new BorderLayout()); + biaoti = new JLabel("ˮƷͺʶŵǼDZ"); + biaoti.setFont(new Font("", 1, 24)); + // topJPanel.add("1.1.left.top", biaoti); + topJPanel.add(BorderLayout.CENTER, biaoti); + // topJPanel.add(BorderLayout.EAST, outBut); + if (is) { + topJPanel.add(BorderLayout.EAST, addBut); + } + mainJPanel = new JPanel(new BorderLayout()); + + biao1 = new JPanel(new BorderLayout()); + + // ǩҳ JTabbedPane + tabPane = new JTabbedPane(); + // + tabPane.add("ˮ", biao1); + // ñ + this.dataTable1 = getjTable(this.dataTable1, null, obj, table1); + biao1.add(new JScrollPane(this.dataTable1), BorderLayout.CENTER); + + + + settablecol(dataTable1);//״̬ + + setxh(dataTable1);// + dataTable1.setEnabled(false);// òɱ༭ + + mainJPanel.add(tabPane, BorderLayout.CENTER); + + Panel.add(topJPanel, BorderLayout.NORTH); + Panel.add(mainJPanel, BorderLayout.CENTER); + this.add(Panel); + this.setVisible(true); + + addBut.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + addrow(); + } + }); + + + } + + private void settablecol(JTable dataTable) { + // TODO Auto-generated method stub + TableColumn tc=dataTable.getColumn("״̬");// ȡһ + JComboBox cbx = new JComboBox(lovvals);// б + TableCellEditor tce=new DefaultCellEditor(cbx);// ༭ + tc.setCellEditor(tce); + } + + public void addrow() { + // TODO Auto-generated method stub + System.out.println(""); + String paname = tabPane.getTitleAt(tabPane.getSelectedIndex()); + System.out.println("ǰѡ:" + paname); + switch (paname) { + case "ˮ": + ((DefaultTableModel) dataTable1.getModel()).addRow(new String[18]); + setxh(dataTable1); + break; + default: + break; + } + + } + + // Jtableͨ÷ + public JTable getjTable(JTable partsTable, DefaultTableModel dtm, + Object[] titleNames, Object[][] values) { + int simpleLen = 105; + int totleLen = 900; + if (partsTable == null) { + + DefaultTableModel dtm1 = getTableModel(dtm, titleNames, values); + partsTable = new JTable(dtm1) { + public boolean isCelEditable(int row, int column) { + if(column==13) {//ע޸ + + return false; + }else { + return true; + + } + } + }; + RowSorter sorter = new TableRowSorter(dtm1); + // partsTable = new JTable(dtm); + partsTable.setRowSorter(sorter); + + if (simpleLen * titleNames.length >= totleLen) { + for (int i = 0; i < titleNames.length; i++) { + partsTable.getColumnModel().getColumn(i) + .setPreferredWidth(105); + } + partsTable.setAutoResizeMode(0); + } else { + partsTable.setAutoResizeMode(1); + } + } + return partsTable; + } + + // tableؼ + public DefaultTableModel getTableModel(DefaultTableModel dtm, + Object[] columnNameObjects, Object[][] objects) { + if (dtm == null) { + dtm = new DefaultTableModel(objects, columnNameObjects) + ; + } + return dtm; + } + + // ųʼ + private void setxh(JTable table) { + int cl = table.getRowCount(); + for (int i = 0; i < cl; i++) { + table.setValueAt(i + 1 + "", i, 0); + } + } + + @Override + public void loadRendering() throws TCException { + lx = form.getTCProperty("jk8ProductTypePMN").getStringArrayValue();//ͿпޣֻˮһࣻͣԻҪ + xmbh = form.getTCProperty("jk8ProjectNO").getStringArrayValue();// Ŀ + xmmc = form.getTCProperty("jk8ProjectName").getStringArrayValue();// Ŀ + cpxh = form.getTCProperty("jk8ProductModNO").getStringArrayValue();// Ʒͺ + sbh = form.getTCProperty("jk8ProductIdentifyNO").getStringArrayValue();// ʶ + + cpmc = form.getTCProperty("jk8ProductName").getStringArrayValue();// Ʒ + jbcj = form.getTCProperty("jk8BMManufactor").getStringArrayValue();// + jbcz = form.getTCProperty("jk8BMMaterial").getStringArrayValue();// + kzqzjlx = form.getTCProperty("jk8ContrlCompType").getStringArrayValue();// + bz = form.getTCProperty("jk8Note").getStringArrayValue();// ע + + sqr = form.getTCProperty("jk8Applicant").getStringArrayValue();// + djrq = form.getTCProperty("jk8RecordDate").getStringArrayValue();// Ǽ + status = form.getTCProperty("jk8Status").getStringArrayValue();// ״̬ + cplx = form.getTCProperty("jk8ProductTypePMN").getStringArrayValue();// Ʒ + gjgg = form.getTCProperty("jk8PipeDSpec").getStringArrayValue();// ܾ + txfs = form.getTCProperty("jk8CommunicateMode").getStringArrayValue();// ͨŷʽ + jg = form.getTCProperty("jk8Structure").getStringArrayValue();// ṹ + + + if (lx != null) { + for (int i = 0; i < lx.length; i++) { + System.out.println("lx=" + lx[i]); + if (true){ + //if (lx[i] != null){ + ta1.add(new String[] { "", xmmc[i], xmbh[i], cpxh[i], + sbh[i], cplx[i],jg[i],gjgg[i],txfs[i], + cpmc[i], jbcj[i], jbcz[i], kzqzjlx[i], + bz[i],sqr[i], djrq[i] ,status[i]}); +/* switch (lx[i]) { + case "tb1": + ta1.add(new String[] { "", xmmc[i], xmbh[i], cpxh[i], + sbh[i], cplx[i],jg[i],gjgg[i],txfs[i], + cpmc[i], jbcj[i], jbcz[i], kzqzjlx[i], + bz[i], sqr[i], djrq[i] ,status[i]}); + break; + + default: + + break; + + } +*/ } + + } + + if (ta1 != null) { + table1 = new Object[ta1.size()][13]; + add(table1, ta1); + } + + } + initPanel(); + + } + + // תΪά + private void add(Object[][] obj, List tb) { + // TODO Auto-generated method stub + for (int i = 0; i < tb.size(); i++) { + obj[i] = tb.get(i); + } + } + + @Override + public void saveRendering() { + int rowCount1 = dataTable1.getRowCount(); + + System.out.println("rowcount1=" + rowCount1); + int count = rowCount1 ; + + // ʼ + lx1 = new String[count]; + xmmc1 = new String[count];// Ŀ + xmbh1 = new String[count];// Ŀ + cpxh1 = new String[count];// Ʒͺ + sbh1 = new String[count];// ʶ + cpmc1 = new String[count];// Ʒ + jbcj1 = new String[count];// + jbcz1 = new String[count];// + kzqzjlx1 = new String[count];// + cplx1 = new String[count];// Ʒ + jg1 = new String[count];// ṹ + gjgg1 = new String[count];// ܾ + txfs1 = new String[count];// ͨŷʽ + // u8mmh1 = new String[count];// U8 + sqr1 = new String[count];// + djrq1 = new String[count];// Ǽ + status1 = new String[count];// ״̬ + bz1 = new String[count];// ע + + // ѭÿУֵformӦԡ + for (int j = 0; j < rowCount1; j++) { + lx1[j] = "tb1"; + xmmc1[j] = dataTable1.getValueAt(j, 1) == null ? "" + : (String) dataTable1.getValueAt(j, 1);// Ŀ + xmbh1[j] = dataTable1.getValueAt(j, 2) == null ? "" + : (String) dataTable1.getValueAt(j, 2);// Ŀ + cpxh1[j] = dataTable1.getValueAt(j, 3) == null ? "" + : (String) dataTable1.getValueAt(j, 3); + sbh1[j] = dataTable1.getValueAt(j, 4) == null ? "" + : (String) dataTable1.getValueAt(j, 4);// ʶ + cplx1[j] = dataTable1.getValueAt(j, 5) == null ? "" + : (String) dataTable1.getValueAt(j, 5);// Ʒ + jg1[j] = dataTable1.getValueAt(j, 6) == null ? "" + : (String) dataTable1.getValueAt(j, 6);// ṹ + gjgg1[j] = dataTable1.getValueAt(j, 7) == null ? "" + : (String) dataTable1.getValueAt(j, 7);// ܾ + txfs1[j] = dataTable1.getValueAt(j, 8) == null ? "" + : (String) dataTable1.getValueAt(j, 8);// ͨŷʽ + cpmc1[j] = dataTable1.getValueAt(j, 9) == null ? "" + : (String) dataTable1.getValueAt(j, 9);// Ʒ + jbcj1[j] = dataTable1.getValueAt(j, 10) == null ? "" + : (String) dataTable1.getValueAt(j, 10);// + jbcz1[j] = dataTable1.getValueAt(j, 11) == null ? "" + : (String) dataTable1.getValueAt(j, 11);// + kzqzjlx1[j] = dataTable1.getValueAt(j, 12) == null ? "" + : (String) dataTable1.getValueAt(j, 12);// + sqr1[j] = dataTable1.getValueAt(j, 14) == null ? "" + : (String) dataTable1.getValueAt(j, 14);// + djrq1[j] = dataTable1.getValueAt(j, 15) == null ? "" + : (String) dataTable1.getValueAt(j, 15);// Ǽ + status1[j] = dataTable1.getValueAt(j, 16) == null ? "" + : (String) dataTable1.getValueAt(j, 16);// ״̬ + bz1[j] = dataTable1.getValueAt(j, 13) == null ? "" + : (String) dataTable1.getValueAt(j, 13);// ע + } + + try { + form.getTCProperty("jk8ProjectName").setStringValueArray(xmmc1); + form.getTCProperty("jk8ProjectNO").setStringValueArray(xmbh1); + form.getTCProperty("jk8ProductTypePMN").setStringValueArray(lx1);// + form.getTCProperty("jk8ProductModNO").setStringValueArray(cpxh1); + form.getTCProperty("jk8ProductIdentifyNO").setStringValueArray(sbh1); + form.getTCProperty("jk8ProductName").setStringValueArray(cpmc1); + form.getTCProperty("jk8BMManufactor").setStringValueArray(jbcj1); + form.getTCProperty("jk8BMMaterial").setStringValueArray(jbcz1);// + form.getTCProperty("jk8ContrlCompType").setStringValueArray(kzqzjlx1);// + form.getTCProperty("jk8Applicant").setStringValueArray(sqr1); + form.getTCProperty("jk8RecordDate").setStringValueArray(djrq1); + + + form.getTCProperty("jk8Status").setStringValueArray(status1); //״̬jk8Status + form.getTCProperty("jk8Note").setStringValueArray(bz1);//ע + form.getTCProperty("jk8ProductTypePMN").setStringValueArray(cplx1); //Ʒ + form.getTCProperty("jk8Structure").setStringValueArray(jg1);//ṹ + form.getTCProperty("jk8PipeDSpec").setStringValueArray(gjgg1); //ܾ + form.getTCProperty("jk8CommunicateMode").setStringValueArray(txfs1);//ͨŷʽ + } catch (TCException e) { + e.printStackTrace(); + } + + } + + + + public boolean isrend(Object[] jkfxget, Object[] jkfxset) { + // TODO Auto-generated method stub + if (jkfxget != null && jkfxset != null) { + if (jkfxget.length == jkfxset.length) { + for (int i = 0; i < jkfxset.length; i++) { + if (jkfxget[i] != null && (!jkfxget[i].equals(jkfxset[i]))) { + return true; + } + if (jkfxget[i] == null && jkfxset[i] != null&&(!jkfxset[i].equals(""))) { + return true; + } + } + } else { + return true; + } + } + + return false; + } + +} diff --git a/src/com/teamcenter/rac/form/JK8_WATER_SPECIAL_SBH_Form.java b/src/com/teamcenter/rac/form/JK8_WATER_SPECIAL_SBH_Form.java new file mode 100644 index 0000000..1edb353 --- /dev/null +++ b/src/com/teamcenter/rac/form/JK8_WATER_SPECIAL_SBH_Form.java @@ -0,0 +1,549 @@ +package com.teamcenter.rac.form; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionListener; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.swing.ButtonGroup; +import javax.swing.DefaultComboBoxModel; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JTextField; + +import com.teamcenter.rac.aif.kernel.AIFComponentContext; +import com.teamcenter.rac.kernel.TCComponentFolder; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.stylesheet.AbstractRendering; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; +import com.teamcenter.rac.util.Registry; +import com.teamcenter.rac.util.combobox.iComboBox; +//import com.teamcenter.soa.exceptions.NotLoadedException; + +//ҪˮƷʶ +public class JK8_WATER_SPECIAL_SBH_Form extends AbstractRendering { + + private TCSession session; + private TCComponentForm form; + private JButton tijiao; + private JButton yanzhen; + private JPanel mainPanel; + + private JPanel topPanel; + private JPanel firstJPanel; + private JPanel secondJPanel; + private JPanel secondJPanel_1; + private JPanel thirdJPanel; + + private JTextField jt1;//׼ʶ + private JTextField jt4; + private JTextField jt6;// + private JTextField jt8;// + private JTextField jt10;//Ʒͺ + private JTextField jt11;//ʶ + + private JTextField jt12;// Ʒ + private JTextField jt13;// + private JTextField jt01;// Ŀ + private JTextField jt02;// Ŀ + private JTextField jt03;// Ʒ + + // private JComboBox comBox0; + // private JComboBox comBox; + private iComboBox comBox0 = new iComboBox();//Ҫ + private iComboBox comBox = new iComboBox();// + + private JLabel jl1; + private JLabel jl2; + private JLabel jl3; + private JLabel jl4; + + private String jt;// ׼ʶ + + + + private String isCheck; + + private HashMap realNameMap; + + // private Registry registry = null; + + public JK8_WATER_SPECIAL_SBH_Form(TCComponentForm arg0) throws Exception { + super(arg0); + form = arg0; + session = arg0.getSession(); + // registry = Registry.getRegistry("com.teamcenter.rac.form.form_user"); + String[] names = session.getPreferenceService().getStringValues("JK_WATER_METER_FORM"); + if (names != null) { + + realNameMap = new HashMap<>(); + for (int i = 0; i < names.length; i++) { + String[] s = names[i].split("="); + if (s != null && s.length == 2) { + String key = s[0]; + String value = s[1]; + realNameMap.put(key, value); + } + + } + + } else { + MessageBox.post("ѡ JK_WATER_METER_FORM ڣϵԱ", "", + MessageBox.ERROR); + } + initPanel(); + loadRendering(); + mainPanel.addMouseMotionListener(new MouseMotionListener() { + + @Override + public void mouseMoved(MouseEvent e) { + try { + isCheck = form.getTCProperty("fnd0IsCheckoutable") + .getDisplayableValue(); + } catch (TCException e1) { + e1.printStackTrace(); + } + if ("".equals(isCheck)) { + seten(false); + setOwnerHave(); + } + } + + @Override + public void mouseDragged(MouseEvent e) { + + } + }); + + jt10.setEnabled(false); + jt11.setEnabled(false); + + } + + public void initPanel() { + System.out.println("--------------------------"); + jt1 = new JTextField(20); + jt4 = new JTextField(20); + jt6 = new JTextField(20); + jt8 = new JTextField(20); + jt10 = new JTextField(25); + jt11 = new JTextField(25); + jt12 = new JTextField(20); + jt13 = new JTextField(20); + jt01 = new JTextField(20); + jt02 = new JTextField(20); + jt03 = new JTextField(20); + + jl1 = new JLabel(" ׼ʶţ"); + jl1.setSize(50, 20); + jl2 = new JLabel(" ҪˮƷʶϢǼ"); + jl2.setSize(70, 20); + jl3 = new JLabel(" Ʒͣ"); + jl3.setSize(70, 20); + jl4 = new JLabel(" ҪˮƷʶ"); + jl4.setFont(new Font("", 0, 24)); + jl2.setFont(new Font("", 0, 20)); + mainPanel = new JPanel(new PropertyLayout()); + this.setSize(new Dimension(600, 200)); + this.setLayout(new BorderLayout()); + + topPanel = new JPanel(new PropertyLayout()); + + topPanel.add("1.1.left.top.preferred.preferred", jl4); + topPanel.add("1.2.left.top.preferred.preferred", new JLabel( + " ")); + // tijiao = new JButton("ύ"); + // tijiao.setEnabled(true); + // tijiao.setPreferredSize(new Dimension(70, 20)); + // tijiao.addActionListener(new ActionListener() { + // + // @Override + // public void actionPerformed(ActionEvent e) { + // // TODO Auto-generated method stub + // System.out.println("ύ"); + // saveRendering(); + // } + // }); + // topPanel.add("1.3.left.bottom.preferred.preferred", tijiao); + + firstJPanel = new JPanel(new PropertyLayout()); + // firstJPanel.setBorder(new + // TitledBorder(BorderFactory.createEtchedBorder())); + // firstJPanel.setBorder(new + // TitledBorder(BorderFactory.createEtchedBorder(),"",2,7)); + + topPanel.add("2.1.left.top", new JLabel("")); + topPanel.add("2.1.left.top", jl2); + firstJPanel.add("1.1.left.top", jl1); + firstJPanel.add("1.2.left.top", getjl()); + firstJPanel.add("1.3.left.top", jt1); + yanzhen = new JButton("֤ʶ"); + yanzhen.setEnabled(true); + yanzhen.setPreferredSize(new Dimension(100, 20)); + yanzhen.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + System.out.println("֤"); + + yzbut(); + + } + + }); + firstJPanel.add("1.4.left.top", yanzhen); + firstJPanel.add("2.1.left.top", new JLabel(" Ŀ:")); + firstJPanel.add("2.2.left.top", new JLabel(" ")); + firstJPanel.add("2.3.left.top", jt01); + firstJPanel.add("3.1.left.top", new JLabel(" Ŀ:")); + firstJPanel.add("3.2.left.top", new JLabel(" ")); + firstJPanel.add("3.3.left.top", jt02); + firstJPanel.add("4.1.left.top", new JLabel(" Ʒ:")); + firstJPanel.add("4.2.left.top", new JLabel(" ")); + firstJPanel.add("4.3.left.top", jt03); + firstJPanel.add("5.1.left.top", new JLabel(" Ҫ:")); + + setLov(comBox0, "Ҫ"); + firstJPanel.add("5.2.right.top.preferred.preferred", getjl()); + firstJPanel.add("5.3.left.top.preferred.preferred", comBox0); + + secondJPanel = new JPanel(new PropertyLayout()); + secondJPanel_1 = new JPanel(new PropertyLayout()); + secondJPanel_1.add("1.1.left.top", jl3); + + secondJPanel_1.add("1.2.left.top", jt12);//Ʒ + secondJPanel_1.add("2.1.left.top", new JLabel(" ʣ")); +// setLov(comBox, ""); + secondJPanel_1.add("2.2.left.top", jt13); + secondJPanel_1.add("3.1.left.top", new JLabel(" ң")); + secondJPanel_1.add("3.2.left.top", jt6); + secondJPanel_1.add("4.1.left.top", new JLabel(" ͣ")); + secondJPanel_1.add("4.2.left.top", jt8); + + + secondJPanel.add("1.1.left.top", secondJPanel_1); + + thirdJPanel = new JPanel(new PropertyLayout()); + thirdJPanel.add("1.1.left.top.preferred.preferred", new JLabel( + " Ʒͺţ ")); + thirdJPanel.add("1.2.left.top.preferred.preferred", jt10); + thirdJPanel.add("1.3.left.top.preferred.preferred", new JLabel( + " ʶţ")); + thirdJPanel.add("1.4.left.top.preferred.preferred", jt11); + + mainPanel.add("1.1.left.top.preferred.preferred", topPanel); + mainPanel.add("2.1.left.top.preferred.preferred", firstJPanel); + mainPanel.add("3.1.left.top.preferred.preferred", secondJPanel); + mainPanel.add("4.1.left.top.preferred.preferred", thirdJPanel); + this.add(mainPanel); + this.setVisible(true); + this.setBackground(Color.LIGHT_GRAY); + } + + @Override + public void loadRendering() throws TCException { + System.out.println("loadRendering"); + + comBox0.setText(form.getTCProperty("jk8Specialrequirements").getStringValue());// Ҫ ϵͳjk8SpecialRequirements ʽϵͳjk8Specialrequirements + jt13.setText(form.getTCProperty("jk8BMMaterial").getStringValue());//TODO + + + jt1.setText(form.getTCProperty("jk8BaseIdentifyNO").getStringValue());// ׼ʶ + // jt4.setText(form.getTCProperty("jk_tsy_sysc").getStringValue());// + jt6.setText(form.getTCProperty("jk8BMManufactor").getStringValue());// + jt8.setText(form.getTCProperty("jk8ContrlCompType").getStringValue());// + jt10.setText(form.getTCProperty("jk8ProductModNO").getStringValue());// Ʒͺ + jt11.setText(form.getTCProperty("jk8ProductIdentifyNO").getStringValue());// ʶ + jt12.setText(form.getTCProperty("jk8ProductTypePIN").getStringValue());// Ʒ + // jt14.setText(form.getTCProperty("jk8BMManfMatched").getStringValue());// + // + jt01.setText(form.getTCProperty("jk8ProjectName").getStringValue());// Ŀ + jt02.setText(form.getTCProperty("jk8ProjectNO").getStringValue());// Ŀ + jt03.setText(form.getTCProperty("jk8ProductName").getStringValue());// Ʒ + + seten(true);//ɱ༭ + } + + +/* @Override + public Map getRenderingModified() { + Map modifiedRendering = new HashMap (); + try { + System.out.println("getRenderingModifiedʼ"); + saveRendering(); + }catch(Exception ex){ + ex.toString(); + System.out.println(ex.toString()); + } + + + return modifiedRendering; + }*/ + + + + + + + @Override + public void saveRendering() { + if ("".equals(jt1.getText()) + || "".equals(comBox0.getTextField().getText())) { + MessageBox.post("޷,ȷȫд!!", "", MessageBox.ERROR); + + }else{ + if ("".equals(jt11.getText())) { + try { + form.getTCProperty("jk8Specialrequirements").setStringValue(comBox0.getTextField().getText());// Ҫ + form.getTCProperty("jk8BMMaterial").setStringValue(jt13.getText());// + + + form.getTCProperty("jk8BaseIdentifyNO").setStringValue(jt1.getText());// ׼ʶ + // г3 + form.getTCProperty("jk8BMManufactor").setStringValue(jt6.getText());// + form.getTCProperty("jk8ContrlCompType").setStringValue(jt8.getText());// + form.getTCProperty("jk8ProductModNO").setStringValue(jt10.getText());// Ʒͺ + form.getTCProperty("jk8ProductIdentifyNO").setStringValue(jt11.getText());// ʶ + form.getTCProperty("jk8ProductTypePIN").setStringValue(jt12.getText());// Ʒ + form.getTCProperty("jk8ProjectName").setStringValue(jt01.getText());// Ŀ + form.getTCProperty("jk8ProjectNO").setStringValue(jt02.getText());// Ŀ + form.getTCProperty("jk8ProductName").setStringValue(jt03.getText());// Ʒ + } catch (TCException e) { + e.printStackTrace(); + } + } else { + MessageBox.post("ʶѴ,޷ٴα", "", MessageBox.ERROR); + } + } + + + + } + + public void setOwnerHave() { + try { + + String user = session.getUserName(); + String owning_user = form.getProperty("owning_user"); + if (owning_user.indexOf(user) < 0) { + jt1.setEnabled(false); + yanzhen.setEnabled(false); + comBox0.setEnabled(false); + comBox.setEnabled(false); + jt4.setEnabled(false); + jt6.setEnabled(false); + jt8.setEnabled(false); + jt10.setEnabled(false); + jt11.setEnabled(false); + jt12.setEnabled(false); + jt13.setEnabled(false); + jt01.setEnabled(false); + jt02.setEnabled(false); + jt03.setEnabled(false); + } + } catch (TCException e) { + System.out.println("ӵǷʱļеòȷҲ"); + e.printStackTrace(); + } + } + + public void seten(boolean is) { + comBox0.setEnabled(true); + comBox.setEnabled(is);// + jt6.setEnabled(false);// + jt8.setEnabled(false);// + + jt12.setEnabled(false);//Ʒ + jt13.setEnabled(false);//Ʒ + jt01.setEnabled(true); + jt02.setEnabled(true); + jt03.setEnabled(true); + } + + private void setLov(iComboBox box, String st) { + // TODO Auto-generated method stub + box.setTextFieldLength(20); + box.setAutoCompleteSuggestive(false); + box.addItems(realNameMap.get(st).split(",")); + } + + private void yzbut() { + // TODO Auto-generated method stub + + jt = jt1.getText(); + if (jt != null && !jt.equals("")) { + TCPreferenceService pref = session.getPreferenceService(); + String puid = pref.getStringValue("JK_WATER_SQB_FORM_PUID"); + if (puid == null) { + MessageBox.post("ѡδҵϵԱ", "", MessageBox.ERROR); + } + + TCComponentForm formAll; + try { + formAll = (TCComponentForm) session.stringToComponent(puid); + if (formAll == null) { + MessageBox.post("δҵϵԱ", "", MessageBox.ERROR); + } + boolean ishave1 = ishave("jk8ProductIdentifyNO", + "jk8ProductModNO", formAll);// Դ + + if (ishave1) { + MessageBox.post("ҵʶţƷͺ", "ɹ", + MessageBox.INFORMATION); + } else { + MessageBox.post("δҵʶţдĻ׼ʶǷȷ", "", + MessageBox.ERROR); + } + } catch (TCException e) { + e.printStackTrace(); + } + } + + } + + private boolean ishave(String sbh_all, String cpxh_all, + TCComponentForm formAll) { + boolean bo = false; + try { + String[] sbhs = formAll.getTCProperty(sbh_all) + .getStringValueArray();// ʶ + + String cpxh = ""; + String jbcj = ""; + String jbcz = ""; + String lx = ""; + String type = ""; + String gjgg="";//ܾ + String jg="";//ṹ + String txfs="";//ͨŷʽ + for (int i = 0; i < sbhs.length; i++) { + System.out.println("ǰʶţ"+sbhs[i]); + if (jt.equals(sbhs[i]) +// &&jt.contains(".") + ) { + System.out.println("ҵʶ"); + cpxh = formAll.getTCProperty(cpxh_all) + .getStringValueArray()[i];// 鵽IJƷͺ + jbcj = formAll.getTCProperty("jk8BMManufactor") + .getStringValueArray()[i];// + jbcz = formAll.getTCProperty("jk8BMMaterial") + .getStringValueArray()[i];// + lx = formAll.getTCProperty("jk8ProductTypePMN")//ϵͳjk8ProductType + .getStringValueArray()[i];// Ʒ + type = formAll.getTCProperty("jk8ContrlCompType") + .getStringValueArray()[i];// + gjgg = formAll.getTCProperty("jk8PipeDSpec") + .getStringValueArray()[i];// ܾ + jg = formAll.getTCProperty("jk8Structure") + .getStringValueArray()[i];// ṹ + txfs = formAll.getTCProperty("jk8CommunicateMode") + .getStringValueArray()[i];// ͨŷʽ + bo = true; + } + } + System.out.println("Ʒ:" + lx); + if (bo) { + if (cpxh != null) { + jt10.setText(cpxh); + } else { + jt10.setText(""); + } + } + jt13.setText(jbcz); + jt6.setText(jbcj); + jt12.setText(lx); + jt8.setText(type); + form.getTCProperty("jk8BMManufactor").setStringValue(jbcj);// + form.getTCProperty("jk8BMMaterial").setStringValue(jbcz);// + form.getTCProperty("jk8ProductTypePIN").setStringValue(lx);// Ʒ + form.getTCProperty("jk8ContrlCompType").setStringValue(type);// + form.getTCProperty("jk8PipeDSpec").setStringValue(gjgg);// ܾ + form.getTCProperty("jk8Structure").setStringValue(jg);// ṹ + form.getTCProperty("jk8CommunicateMode").setStringValue(txfs);// ͨŷʽ + seten(bo); + + } catch (TCException e) { + e.printStackTrace(); + } + return bo; + } + + private JLabel getjl() { + JLabel bt = new JLabel("*"); + bt.setForeground(Color.red); + return bt; + } + public boolean isRenderingModified() { + System.out.println("isRenderingModified"); + try { + + if (isrend(form.getTCProperty("jk8Specialrequirements"), comBox0.getTextField().getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8BMMaterial"), jt13.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8BaseIdentifyNO"), jt1.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8BMManufactor"), jt6.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ContrlCompType"), jt8.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ProductModNO"), jt10.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ProductIdentifyNO"),jt11.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ProductTypePIN"), jt12.getText())) { + return true; + } + + if (isrend(form.getTCProperty("jk8ProjectName"), jt01.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ProjectNO"), jt02.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ProductName"), jt03.getText())) { + return true; + } + + + + } catch (TCException e) { + e.printStackTrace(); + } // гѡ + return false; + } + + + private boolean isrend(TCProperty tcProperty, String str) { + if(tcProperty!=null&&str!=null&&(!str.equals(tcProperty.getStringValue()))){ + System.out.println(str); + return true; + } + return false; + } +} diff --git a/src/com/teamcenter/rac/form/JK8_WarnrModINApp_Form.java b/src/com/teamcenter/rac/form/JK8_WarnrModINApp_Form.java new file mode 100644 index 0000000..5c0ef94 --- /dev/null +++ b/src/com/teamcenter/rac/form/JK8_WarnrModINApp_Form.java @@ -0,0 +1,444 @@ +package com.teamcenter.rac.form; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionListener; +import java.util.HashMap; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextField; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.stylesheet.AbstractRendering; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; +import com.teamcenter.rac.util.combobox.iComboBox; + + +/** + * Ʒͺʶ(޲Ʒͺ) + */ +public class JK8_WarnrModINApp_Form extends AbstractRendering{ + + private static final long serialVersionUID = 1L; + private TCComponentForm form; + private TCSession session; + private JScrollPane jsp; + private JPanel jpall; + private JPanel jpall_1; + private JPanel jpall_2; + private JPanel jpal2; + private JPanel jpal2_1; + private JPanel jpal2_2; + private JPanel jpal3_1; + private JPanel jpal3_2; + private JPanel jpal3; + private JPanel jpal4; + private JPanel jp1; + + private JTextField productName = new JTextField();// Ʒ + private JTextField projectName = new JTextField(24);// Ŀ + private JTextField projectID = new JTextField(24);// Ŀ + + private iComboBox box2 = new iComboBox();// ̽ + private iComboBox box3 = new iComboBox();// Ӧó + private iComboBox box4 = new iComboBox();// + private iComboBox box5 = new iComboBox();// Ʒ + private iComboBox box6 = new iComboBox();// ͨŷʽ + + private iComboBox box7 = new iComboBox();// 緽ʽ + private iComboBox box8 = new iComboBox();// ź + private iComboBox box9 = new iComboBox();// ͨŷʽ(ʶ) + + private JTextField xh = new JTextField(24);// Ʒͺ + private JTextField sbh = new JTextField(24);// Ʒʶ + + + + private HashMap realNameMap;// lovѡֵ + private String isCheck; + + public JK8_WarnrModINApp_Form(TCComponentForm c) throws Exception { + + super(c); + form = c; + session = c.getSession(); + // registry = Registry.getRegistry(this); + String[] names = session.getPreferenceService().getStringValues("JK_WARNER_METER_FORM"); + if (names != null) { + + realNameMap = new HashMap<>(); + for (int i = 0; i < names.length; i++) { + String[] s = names[i].split("="); + if (s != null && s.length == 2) { + String key = s[0]; + String value = s[1]; + realNameMap.put(key, value); + } else { + MessageBox.post("ѡ JK_WARNER_METER_FORM ôϵԱ", "", + MessageBox.ERROR); + return; + } + + } + + } else { + MessageBox.post("ѡ JK_WARNER_METER_FORM ڣϵԱ", "", + MessageBox.ERROR); + } + + loadRendering(); + + jp1.addMouseMotionListener(new MouseMotionListener() { + + @Override + public void mouseMoved(MouseEvent arg0) { + + try { + isCheck = form.getTCProperty("fnd0IsCheckoutable").getDisplayableValue(); + } catch (TCException e1) { + e1.printStackTrace(); + } + if ("".equals(isCheck)) { + + setOwnerHave(); + } + } + @Override + public void mouseDragged(MouseEvent arg0) { + + } + }); + + xh.setEnabled(false); + sbh.setEnabled(false); + System.out.println("end"); + } + +/* Ʒƣֶ룩 + Ŀƣֶ룩 + Ŀţֶ룩 + ƷͺϢǼǣ + ̽壺ѡťɶѡֵ飨Ȼ飨Һһ̼˹ú + ӦóҡƷͨ͡ŷʽ + дʽѡֵȡѡJK_WARNER_METER_FORM + ƷʶϢǼǣ + 緽ʽźšͨŷʽ + дʽѡֵȡѡJK_WARNER_METER_FORM + ƷͺšƷʶ + дʽɲ˵ʱݹԶ䣬Ҳ޸ */ + private void init() { + setLayout(new BorderLayout()); + // setBackground(Color.white); + jpall = new JPanel(new PropertyLayout()); //ͷϢ + jpall_1 = new JPanel(new PropertyLayout()); + jpall_2 = new JPanel(new PropertyLayout()); + + jpal2 = new JPanel(new PropertyLayout()); //ƷƣĿƵϢ + jpal2_1 = new JPanel(new PropertyLayout()); + jpal2_2 = new JPanel(new PropertyLayout()); + + jpal3 = new JPanel(new PropertyLayout()); //ƷʶϢǼ + jpal3_1 = new JPanel(new PropertyLayout()); + jpal3_2 = new JPanel(new PropertyLayout()); + + jpal4 = new JPanel(new PropertyLayout()); //ƷͺţƷʶ + jp1 = new JPanel(new PropertyLayout()); // JPanel + + JLabel jlab11 = new JLabel("Ʒͺšʶ "); + jlab11.setFont(new Font("", 1, 24)); + jpall_1.add("1.1.left.top", jlab11); + + productName = new JTextField(); + productName.setColumns(60); + productName.setBackground(Color.white); + + jpall_2.add("1.1.left.top", new JLabel(" Ʒƣ")); + jpall_2.add("1.2.right.top", getjl()); + jpall_2.add("1.3.left.top", productName); + jpall_2.add("2.1.left.top", new JLabel(" Ŀƣ")); + jpall_2.add("2.2.right.top", getjl()); + jpall_2.add("2.3.left.top", projectName); + jpall_2.add("3.1.left.top", new JLabel(" Ŀţ")); + jpall_2.add("3.2.right.top", getjl()); + jpall_2.add("3.3.left.top", projectID); + //װ + jpall.add("1.1.left.top", jpall_1); + jpall.add("2.1.left.top", jpall_2); + + //ƷͺϢǼ + JLabel jlablInfo1 = new JLabel("ƷͺϢǼ "); + jlablInfo1.setFont(new Font("", 0, 16)); + jpal2_1.add("1.1.right.top", jlablInfo1); + + jpal2_2.add("1.1.left.top", new JLabel(" ̽: ")); + jpal2_2.add("1.2.right.top", getjl()); + setLov(box2, "̽"); + jpal2_2.add("1.3.left.top", box2); + + jpal2_2.add("1.4.left.top", new JLabel(" Ӧó: ")); + jpal2_2.add("1.5.right.top", getjl()); + setLov(box3, "Ӧó"); + jpal2_2.add("1.6.left.top", box3); + + jpal2_2.add("2.1.left.top", new JLabel(" : ")); + jpal2_2.add("2.2.right.top", getjl()); + setLov(box4, ""); + jpal2_2.add("2.3.left.top", box4); + + jpal2_2.add("2.4.left.top", new JLabel(" Ʒ: ")); + jpal2_2.add("2.5.right.top", getjl()); + setLov(box5, "Ʒ"); + jpal2_2.add("2.6.left.top", box5); + + jpal2_2.add("3.1.left.top", new JLabel(" ͨŷʽ: ")); + jpal2_2.add("3.2.right.top", getjl()); + setLov(box6, "ͨŷʽ2"); + jpal2_2.add("3.3.left.top", box6); + //װ + jpal2.add("1.1.left.top", jpal2_1); + jpal2.add("2.1.left.top", jpal2_2); + + //ƷʶϢǼ + JLabel jlablInfo2 = new JLabel("ƷʶϢǼǣ "); + jlablInfo2.setFont(new Font("", 0, 16)); + jpal3_1.add("1.1.right.top", jlablInfo2); + + jpal3_2.add("1.1.left.top", new JLabel(" 緽ʽ: ")); + jpal3_2.add("1.2.right.top", getjl()); + setLov(box7, "緽ʽ"); + jpal3_2.add("1.3.left.top", box7); + + jpal3_2.add("1.4.left.top", new JLabel(" ź: ")); + jpal3_2.add("1.5.left.top", getjl()); + setLov(box8, "ź"); + jpal3_2.add("1.6.left.top", box8); + + jpal3_2.add("2.1.left.top", new JLabel(" ͨŷʽ: ")); + jpal3_2.add("2.2.right.top", new JLabel(" ")); + setLov(box9, "ͨŷʽ"); + jpal3_2.add("2.3.left.top", box9); + + jpal3.add("1.1.left.top", jpal3_1); + jpal3.add("2.1.left.top", jpal3_2); + + //ƷͺţƷʶ + jpal4.add("1.1.left.top", new JLabel(" Ʒͺţ")); + jpal4.add("1.2.right.top", new JLabel(" ")); + jpal4.add("1.3.left.top", xh); + + jpal4.add("1.4.left.top", new JLabel(" Ʒʶţ")); + jpal4.add("1.5.right.top", new JLabel(" ")); + jpal4.add("1.6.left.top", sbh); + + jp1.add("1.1.left.top", jpall); + jp1.add("2.1.left.top", new JLabel("")); + jp1.add("3.1.left.top", jpal2); + jp1.add("4.1.left.top", new JLabel("")); + jp1.add("5.1.left.top", jpal3); + jp1.add("6.1.left.top", new JLabel("")); + jp1.add("7.1.left.top", jpal4); + jp1.add("8.1.left.top", new JLabel("")); + + jsp = new JScrollPane(jp1);// + jsp.setPreferredSize(new Dimension(700, 600)); + this.add(jsp, "Center"); + setVisible(true); + + } + + private void setLov(iComboBox box, String st) { + box.setTextFieldLength(20); + box.setAutoCompleteSuggestive(false); + if(realNameMap.containsKey(st)){ + box.addItems(realNameMap.get(st).split(",")); + }else{ + box.addItem(""); + } + } + + @Override + public void loadRendering() throws TCException { + init(); + productName.setText(form.getTCProperty("jk8ProductName").getStringValue());// Ʒ + projectName.setText(form.getTCProperty("jk8ProjectName").getStringValue());// Ŀ + projectID.setText(form.getTCProperty("jk8ProjectNO").getStringValue()); // Ŀ + + box2.setText(form.getTCProperty("jk8Gas").getStringValue()); // ̽ + box3.setText(form.getTCProperty("jk8ApplicationPlace").getStringValue()); // Ӧó + box4.setText(form.getTCProperty("jk8Manufacturer").getStringValue()); // + box5.setText(form.getTCProperty("jk8ProductType").getStringValue()); // Ʒ + box6.setText(form.getTCProperty("jk8CommunicateMode2").getStringValue()); // ͨŷʽ2 + + box7.setText(form.getTCProperty("jk8PowerSupplyMode").getStringValue()); // 緽ʽ + box8.setText(form.getTCProperty("jk8OutputSignal").getStringValue()); // ź + box9.setText(form.getTCProperty("jk8CommunicateMode").getStringValue()); // ͨŷʽ + + xh.setText(form.getTCProperty("jk8ProductModNO").getStringValue()); // Ʒͺ + sbh.setText(form.getTCProperty("jk8ProductIdentifyNO").getStringValue()); // ʶ + + } + + @Override + public void saveRendering() { + if ("".equals(productName.getText()) + /* || "".equals(projectName.getText()) + || "".equals(projectID.getText())*/ + || "".equals(box2.getTextField().getText()) + || "".equals(box3.getTextField().getText()) + || "".equals(box4.getTextField().getText()) + || "".equals(box5.getTextField().getText()) + || "".equals(box6.getTextField().getText()) + || "".equals(box7.getTextField().getText()) + || "".equals(box8.getTextField().getText()) + //|| "".equals(box9.getTextField().getText()) + ) { + + MessageBox.post("޷,ȷȫд!!", "", MessageBox.ERROR); + return; + } + + if ("".equals(xh.getText())) { + try { + + form.getTCProperty("jk8ProductName").setStringValue( + productName.getText()); // Ʒ + form.getTCProperty("jk8ProjectName").setStringValue( + projectName.getText()); // Ŀ + form.getTCProperty("jk8ProjectNO").setStringValue( + projectID.getText()); // Ŀ + + form.getTCProperty("jk8Gas").setStringValue( + box2.getTextField().getText());// ̽ + form.getTCProperty("jk8ApplicationPlace").setStringValue( + box3.getTextField().getText());// Ӧó + form.getTCProperty("jk8Manufacturer").setStringValue( + box4.getTextField().getText());// + form.getTCProperty("jk8ProductType").setStringValue( + box5.getTextField().getText());// Ʒ + form.getTCProperty("jk8CommunicateMode2").setStringValue( + box6.getTextField().getText());// ͨŷʽ2 + + form.getTCProperty("jk8PowerSupplyMode").setStringValue( + box7.getTextField().getText());// 緽ʽ + form.getTCProperty("jk8OutputSignal").setStringValue( + box8.getTextField().getText());// ź + form.getTCProperty("jk8CommunicateMode").setStringValue( + box9.getTextField().getText());// ͨŷʽ + + form.getTCProperty("jk8ProductModNO").setStringValue( + xh.getText()); // Ʒͺ + form.getTCProperty("jk8ProductIdentifyNO").setStringValue( + sbh.getText()); // Ʒʶ + + + } catch (TCException e) { + e.printStackTrace(); + } + } else { + MessageBox.post("ƷͺѴ,޷ٴα", "", MessageBox.ERROR); + } + } + + // ÷ӵ߲ɱ༭ + public void setOwnerHave() { + try { + + String user = session.getUserName(); + String owning_user = form.getProperty("owning_user"); + // System.out.println("owning_user.indexOf(user)="+owning_user.indexOf(user)); + if (owning_user.indexOf(user) < 0) { + // tj.setEnabled(false); + productName.setEnabled(false); + projectName.setEnabled(false); + projectID.setEnabled(false); + + box2.setEnabled(false); + box3.setEnabled(false); + box4.setEnabled(false); + box5.setEnabled(false); + box6.setEnabled(false); + box7.setEnabled(false); + box8.setEnabled(false); + box9.setEnabled(false); + xh.setEnabled(false); + sbh.setEnabled(false); + + } + } catch (TCException e) { + System.out.println("ӵǷʱļеòȷҲ"); + e.printStackTrace(); + } + } + + private JLabel getjl() { + JLabel bt = new JLabel("*"); + bt.setForeground(Color.red); + return bt; + } + private boolean isrend(TCProperty tcProperty, String str) { + if(tcProperty!=null&&str!=null&&(!str.equals(tcProperty.getStringValue()))){ + System.out.println(str); + return true; + } + return false; + } + public boolean isRenderingModified() { + System.out.println("isRenderingModified"); + + try { + + if (isrend(form.getTCProperty("jk8ProductName"), productName.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ProjectName"), projectName.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ProjectNO"), projectID.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8Gas"), box2.getTextField().getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ApplicationPlace"), box3.getTextField().getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8Manufacturer"), box4.getTextField().getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ProductType"), box5.getTextField().getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8CommunicateMode2"), box6.getTextField().getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8PowerSupplyMode"), box7.getTextField().getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8OutputSignal"), box8.getTextField().getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8CommunicateMode"), box9.getTextField().getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ProductModNO"), xh.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ProductIdentifyNO"), sbh.getText())) { + return true; + } + + } catch (TCException e) { + e.printStackTrace(); + } // гѡ + return false; + } + + +} diff --git a/src/com/teamcenter/rac/form/JK8_WarnrNPINOApp_Form.java b/src/com/teamcenter/rac/form/JK8_WarnrNPINOApp_Form.java new file mode 100644 index 0000000..9931911 --- /dev/null +++ b/src/com/teamcenter/rac/form/JK8_WarnrNPINOApp_Form.java @@ -0,0 +1,562 @@ +package com.teamcenter.rac.form; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionListener; +import java.util.HashMap; + +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextField; + +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.stylesheet.AbstractRendering; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; +import com.teamcenter.rac.util.combobox.iComboBox; + + +/** + * Ʒʶ(вƷͺ) + */ +public class JK8_WarnrNPINOApp_Form extends AbstractRendering{ + + private static final long serialVersionUID = 1L; + private TCComponentForm form; + private TCSession session; + private JButton yanzhen; + private JPanel mainPanel; //JPanel + private JPanel topJPanel; //ͷϢ + private JPanel firstJPanel; //ƷƣĿƵϢ + private JPanel secondJPanel; //ƷͺϢǼ + private JPanel thirdJPanel; //ƷʶϢǼ + private JPanel fourthJPanel;; //Ʒʶ + private JScrollPane jsp; + + private JLabel jl1; + private JLabel jl2; + + private JTextField projectName; // Ŀ + private JTextField projectID; // Ŀ + private JTextField productName;// Ʒ + +// private iComboBox box2 = new iComboBox();// ̽ +// private iComboBox box3 = new iComboBox();// Ӧó +// private iComboBox box4 = new iComboBox();// +// private iComboBox box5 = new iComboBox();// Ʒ +// private iComboBox box6 = new iComboBox();// ͨŷʽ + + private iComboBox box7 = new iComboBox();// 緽ʽ + private iComboBox box8 = new iComboBox();// ź + private iComboBox box9 = new iComboBox();// ͨŷʽ + + private JTextField xh = new JTextField(24);// Ʒͺ + private JTextField sbh = new JTextField(24);// Ʒʶ + + + private HashMap realNameMap;// lovѡֵ + private String jt;// Ʒͺ + + private String isCheck; + private boolean is = false; + + public JK8_WarnrNPINOApp_Form(TCComponentForm arg0) throws Exception { + super(arg0); + + form = arg0; + session = arg0.getSession(); + // registry = Registry.getRegistry(this); + String[] names = session.getPreferenceService().getStringValues("JK_WARNER_METER_FORM"); + if (names != null) { + + realNameMap = new HashMap<>(); + for (int i = 0; i < names.length; i++) { + String[] s = names[i].split("="); + if (s != null && s.length == 2) { + String key = s[0]; + String value = s[1]; + realNameMap.put(key, value); + } + + } + + } else { + MessageBox.post("ѡ JK_WARNER_METER_FORM ڣϵԱ", "", + MessageBox.ERROR); + } + initializeUI(); + loadRendering(); + + mainPanel.addMouseMotionListener(new MouseMotionListener() { + + @Override + public void mouseMoved(MouseEvent e) { + + try { + isCheck = form.getTCProperty("fnd0IsCheckoutable") + .getDisplayableValue(); + } catch (TCException e1) { + + e1.printStackTrace(); + } + if ("".equals(isCheck)) { + seten(is); + setOwnerHave(); + } + } + + @Override + public void mouseDragged(MouseEvent e) { + + + } + }); + + sbh.setEnabled(false); + + } + + private void setLov(iComboBox box, String st) { + + box.setTextFieldLength(18); + box.setAutoCompleteSuggestive(false); + if(realNameMap.containsKey(st)){ + box.addItems(realNameMap.get(st).split(",")); + }else{ + box.addItem(""); + } + + } + + public void initializeUI() { + System.out.println("UI-----Start"); + setLayout(new BorderLayout()); + initPanel(); + + jsp = new JScrollPane(initPanel()); + jsp.setPreferredSize(new Dimension(700, 400)); + jsp.getVerticalScrollBar().setUnitIncrement(20); + + add(jsp, "Center"); + this.setVisible(true); + this.setBackground(Color.lightGray); + } + + public JPanel initPanel() { + System.out.println("--------------------------"); + mainPanel = new JPanel(new PropertyLayout()); + + projectName = new JTextField(30); + projectID = new JTextField(30); + productName = new JTextField(30); + xh = new JTextField(30); + sbh = new JTextField(20); + + jl1 = new JLabel(" Ʒʶ"); + jl1.setFont(new Font("", 1, 24)); + jl2 = new JLabel(" ²ƷʶϢǼ"); + jl2.setFont(new Font("", 1, 18)); + + topJPanel = new JPanel(new PropertyLayout()); + topJPanel.add("1.1.left.top", jl1); + topJPanel.add("1.2.left.top", new JLabel( + " ")); + + firstJPanel = new JPanel(new PropertyLayout()); + firstJPanel.add("1.1.left.top", new JLabel(" Ʒͺ:")); + firstJPanel.add("1.2.right.top", getjl()); + firstJPanel.add("1.3.left.top", xh); + firstJPanel.add("1.4.left.top", new JLabel(" ")); + yanzhen = new JButton("֤Ʒͺ"); + firstJPanel.add("1.5.left.top", yanzhen); + firstJPanel.add("2.1.left.top", new JLabel(" Ʒ:")); + firstJPanel.add("2.2.right.top", getjl()); + firstJPanel.add("2.3.left.top", productName); + firstJPanel.add("3.1.left.top", new JLabel(" Ŀ:")); + firstJPanel.add("3.2.right.top", getjl()); + firstJPanel.add("3.3.left.top", projectName); + firstJPanel.add("4.1.left.top", new JLabel(" Ŀ:")); + firstJPanel.add("4.2.right.top", getjl()); + firstJPanel.add("4.3.left.top", projectID); + yanzhen.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + + System.out.println("֤"); + yzbut(); + } + }); + + //ƷͺϢǼ +// secondJPanel = new JPanel(new PropertyLayout()); +// JLabel jlablInfo1 = new JLabel("ƷͺϢǼ "); +// jlablInfo1.setFont(new Font("", 0, 16)); +// secondJPanel.add("1.1.right.top", jlablInfo1); +// +// secondJPanel.add("2.1.left.top", new JLabel(" ̽: ")); +// secondJPanel.add("2.2.right.top", getjl()); +// setLov(box2, "̽"); +// secondJPanel.add("2.3.left.top", box2); +// +// secondJPanel.add("2.4.left.top", new JLabel(" Ӧó: ")); +// secondJPanel.add("2.5.right.top", getjl()); +// setLov(box3, "Ӧó"); +// secondJPanel.add("2.6.left.top", box3); +// +// secondJPanel.add("3.1.left.top", new JLabel(" : ")); +// secondJPanel.add("3.2.right.top", getjl()); +// setLov(box4, ""); +// secondJPanel.add("3.3.left.top", box4); +// +// secondJPanel.add("3.4.left.top", new JLabel(" Ʒ: ")); +// secondJPanel.add("3.5.right.top", getjl()); +// setLov(box5, "Ʒ"); +// secondJPanel.add("3.6.left.top", box5); +// +// secondJPanel.add("4.1.left.top", new JLabel(" ͨŷʽ: ")); +// secondJPanel.add("4.2.right.top", getjl()); +// setLov(box6, "ͨŷʽ2"); +// secondJPanel.add("4.3.left.top", box6); + + //ƷͺϢǼ + thirdJPanel = new JPanel(new PropertyLayout()); + JLabel jlablInfo2 = new JLabel("ƷʶϢǼǣ "); + jlablInfo2.setFont(new Font("", 0, 16)); + thirdJPanel.add("1.1.right.top", jlablInfo2); + + thirdJPanel.add("2.1.left.top", new JLabel(" 緽ʽ: ")); + thirdJPanel.add("2.2.right.top", getjl()); + setLov(box7, "緽ʽ"); + thirdJPanel.add("2.3.left.top", box7); + + thirdJPanel.add("2.4.left.top", new JLabel(" ź: ")); + thirdJPanel.add("2.5.right.top", getjl()); + setLov(box8, "ź"); + thirdJPanel.add("2.6.left.top", box8); + + thirdJPanel.add("3.1.left.top", new JLabel(" ͨŷʽ: ")); + thirdJPanel.add("3.2.right.top", new JLabel(" ")); + setLov(box9, "ͨŷʽ"); + thirdJPanel.add("3.3.left.top", box9); + + //ƷͺţƷʶ + fourthJPanel = new JPanel(new PropertyLayout()); + + fourthJPanel.add("1.1.left.top", new JLabel(" Ʒʶţ")); + fourthJPanel.add("1.2.left.top", sbh); + + mainPanel.add("1.1.left.top", topJPanel); + mainPanel.add("2.1.left.top", firstJPanel); + //mainPanel.add("3.1.left.top", secondJPanel);//2021/04/29 ȡ + mainPanel.add("3.1.left.top", thirdJPanel); + mainPanel.add("4.1.left.top", fourthJPanel); + return mainPanel; + + } + + @Override + public void loadRendering() throws TCException { + + productName.setText(form.getTCProperty("jk8ProductName").getStringValue()); // Ʒ + projectName.setText(form.getTCProperty("jk8ProjectName").getStringValue()); // Ŀ + projectID.setText(form.getTCProperty("jk8ProjectNO").getStringValue()); // Ŀ + +// box2.setText(form.getTCProperty("jk8Gas").getStringValue()); // ̽ +// box3.setText(form.getTCProperty("jk8ApplicationPlace").getStringValue()); // Ӧó +// box4.setText(form.getTCProperty("jk8Manufacturer").getStringValue()); // +// box5.setText(form.getTCProperty("jk8ProductType").getStringValue()); // Ʒ +// box6.setText(form.getTCProperty("jk8CommunicateMode2").getStringValue()); // ͨŷʽ + + box7.setText(form.getTCProperty("jk8PowerSupplyMode").getStringValue()); // 緽ʽ + box8.setText(form.getTCProperty("jk8OutputSignal").getStringValue()); // ź + box9.setText(form.getTCProperty("jk8CommunicateMode").getStringValue()); // ͨŷʽ + + xh.setText(form.getTCProperty("jk8ProductModNO").getStringValue()); // Ʒͺ + sbh.setText(form.getTCProperty("jk8ProductIdentifyNO").getStringValue()); // Ʒʶ + + } + + public boolean isRenderingModified() { + System.out.println("isRenderingModified"); + + try { + + if (isrend(form.getTCProperty("jk8ProductName"), productName.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ProjectName"), projectName.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ProjectNO"), projectID.getText())) { + return true; + } +// if (isrend(form.getTCProperty("jk8Gas"), box2.getTextField().getText())) { +// return true; +// } +// if (isrend(form.getTCProperty("jk8ApplicationPlace"), box3.getTextField().getText())) { +// return true; +// } +// if (isrend(form.getTCProperty("jk8Manufacturer"), box4.getTextField().getText())) { +// return true; +// } +// if (isrend(form.getTCProperty("jk8ProductType"), box5.getTextField().getText())) { +// return true; +// } +// if (isrend(form.getTCProperty("jk8CommunicateMode2"), box6.getTextField().getText())) { +// return true; +// } + if (isrend(form.getTCProperty("jk8PowerSupplyMode"), box7.getTextField().getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8OutputSignal"), box8.getTextField().getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8CommunicateMode"), box9.getTextField().getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ProductModNO"), xh.getText())) { + return true; + } + if (isrend(form.getTCProperty("jk8ProductIdentifyNO"), sbh.getText())) { + return true; + } + + } catch (TCException e) { + + e.printStackTrace(); + return false; + }// гѡ + return false; + } + + private boolean isrend(TCProperty tcProperty, String str) { + + if (tcProperty != null && str != null + && (!str.equals(tcProperty.getStringValue()))) { + System.out.println(str); + return true; + } + return false; + } + + @Override + public void saveRendering() { + + if ("".equals(productName.getText()) + /* || "".equals(projectName.getText()) + || "".equals(projectID.getText())*/ +// || "".equals(box2.getTextField().getText()) +// || "".equals(box3.getTextField().getText()) +// || "".equals(box4.getTextField().getText()) +// || "".equals(box5.getTextField().getText()) +// || "".equals(box6.getTextField().getText()) + || "".equals(box7.getTextField().getText()) + || "".equals(box8.getTextField().getText()) +// || "".equals(box9.getTextField().getText()) + ) { + + MessageBox.post("޷,ȷȫд!!", "", MessageBox.ERROR); + return; + }else { + if ("".equals(sbh.getText())) { + try { + + form.getTCProperty("jk8ProductName").setStringValue( + productName.getText()); // Ʒ + form.getTCProperty("jk8ProjectName").setStringValue( + projectName.getText()); // Ŀ + form.getTCProperty("jk8ProjectNO").setStringValue( + projectID.getText()); // Ŀ + +// form.getTCProperty("jk8Gas").setStringValue( +// box2.getTextField().getText());// ̽ +// form.getTCProperty("jk8ApplicationPlace").setStringValue( +// box3.getTextField().getText());// Ӧó +// form.getTCProperty("jk8Manufacturer").setStringValue( +// box4.getTextField().getText());// +// form.getTCProperty("jk8ProductType").setStringValue( +// box5.getTextField().getText());// Ʒ +// form.getTCProperty("jk8CommunicateMode2").setStringValue( +// box6.getTextField().getText());// ͨŷʽ + + form.getTCProperty("jk8PowerSupplyMode").setStringValue( + box7.getTextField().getText());// 緽ʽ + form.getTCProperty("jk8OutputSignal").setStringValue( + box8.getTextField().getText());// ź + form.getTCProperty("jk8CommunicateMode").setStringValue( + box9.getTextField().getText());// ͨŷʽ + + form.getTCProperty("jk8ProductModNO").setStringValue( + xh.getText()); // Ʒͺ + form.getTCProperty("jk8ProductIdentifyNO").setStringValue( + sbh.getText()); // Ʒʶ + + + } catch (Exception e) { + + e.printStackTrace(); + } + } else { + MessageBox.post("ʶѴ,޷ٴα", "", MessageBox.ERROR); + } + } + + } + + public void setOwnerHave() { + try { + + String user = session.getUserName(); + String owning_user = form.getProperty("owning_user"); + // System.out.println("owning_user.indexOf(user)="+owning_user.indexOf(user)); + if (owning_user.indexOf(user) < 0) { + productName.setEnabled(false); + projectName.setEnabled(false); + projectID.setEnabled(false); + +// box2.setEnabled(false); +// box3.setEnabled(false); +// box4.setEnabled(false); +// box5.setEnabled(false); +// box6.setEnabled(false); + box7.setEnabled(false); + box8.setEnabled(false); + box9.setEnabled(false); + xh.setEnabled(false); + sbh.setEnabled(false); + + } + } catch (TCException e) { + System.out.println("ӵǷʱļеòȷҲ"); + e.printStackTrace(); + } + } + + public void seten(boolean is) { + productName.setEnabled(is); + projectName.setEnabled(is); + projectID.setEnabled(is); + +// box2.setEnabled(is); +// box3.setEnabled(is); +// box4.setEnabled(is); +// box5.setEnabled(is); +// box6.setEnabled(is); + box7.setEnabled(is); + box8.setEnabled(is); + box9.setEnabled(is); +// xh.setEnabled(is); + sbh.setEnabled(is); + + } + + private void yzbut() { + + + jt = xh.getText(); + if (jt != null && !jt.equals("") && !jt.equals("")) { + TCPreferenceService pref = session.getPreferenceService(); + String puid = pref.getStringValue("JK_SQB_FORM_PUID");// ѡpuid + if (puid == null) { + MessageBox.post("ѡJK_SQB_FORM_PUIDδҵϵԱ", "", MessageBox.ERROR); + } + + TCComponentForm formAll; + try { + formAll = (TCComponentForm) session.stringToComponent(puid); + if (formAll == null) { + MessageBox.post("ܱδҵϵԱ", "", MessageBox.ERROR); + } + boolean ishave1 = ishave("jk8ProductModNO","jk8ProductIdentifyNO", formAll);// Դ + + if (ishave1) { + box7.setEnabled(true); + box8.setEnabled(true); + box9.setEnabled(true); + projectName.setText(form.getProperty("jk8ProductName")); // Ʒ + projectID.setText(form.getProperty("jk8ProjectNO")); // Ŀ + productName.setText(form.getProperty("jk8ProjectName")); // Ŀ +// box2.setText(form.getProperty("jk8Gas")); // ̽ +// box3.setText(form.getProperty("jk8ApplicationPlace")); // Ӧó +// box4.setText(form.getProperty("jk8Manufacturer")); // +// box5.setText(form.getProperty("jk8ProductType")); // Ʒ +// box6.setText(form.getProperty("jk8CommunicateMode2")); // ͨŷʽ + box7.setText(form.getProperty("jk8PowerSupplyMode")); // 緽ʽ + box8.setText(form.getProperty("jk8OutputSignal")); // ź + box9.setText(form.getProperty("jk8CommunicateMode")); // ͨŷʽ + MessageBox.post("ҵƷͺţòƷͺſ", "ɹ", MessageBox.INFORMATION); + } else { + projectName.setEnabled(false); + projectID.setEnabled(false); + productName.setEnabled(false); +// box2.setEnabled(false); +// box3.setEnabled(false); +// box4.setEnabled(false); +// box5.setEnabled(false); +// box6.setEnabled(false); + + box7.setEnabled(false); + box8.setEnabled(false); + box9.setEnabled(false); + + MessageBox.post("δҵƷͺţдIJƷͺǷȷ", "", MessageBox.ERROR); + } + } catch (TCException e) { + + e.printStackTrace(); + MessageBox.post(e.getMessage(), "", MessageBox.ERROR); + } + } else { + MessageBox.post("ƷͺŲΪգдٵť", "", MessageBox.ERROR); + } + + } + + private boolean ishave(String cpxh_all, String sbh_all,TCComponentForm formAll) { + + boolean bo = false; + try { + String[] cpxhs = formAll.getTCProperty(cpxh_all) + .getStringValueArray();// ܲƷͺ + String lx = ""; + String name = ""; + for (int i = 0; i < cpxhs.length; i++) { + if (jt.equals(cpxhs[i])) { + lx = formAll.getTCProperty("jk8ProductType").getStringValueArray()[i];// Ʒ + + if ("tb12".equals(lx)) {// жǷ񱨾 + bo = true; + break; + } + + } + } + + seten(bo); + is = bo; + } catch (TCException e) { + + e.printStackTrace(); + } + return bo; + } + + private JLabel getjl() { + JLabel bt = new JLabel("*"); + bt.setForeground(Color.red); + return bt; + } + +} diff --git a/src/com/teamcenter/rac/form/JK8_XCPXH_Form.java b/src/com/teamcenter/rac/form/JK8_XCPXH_Form.java new file mode 100644 index 0000000..5f9b451 --- /dev/null +++ b/src/com/teamcenter/rac/form/JK8_XCPXH_Form.java @@ -0,0 +1,2238 @@ +package com.teamcenter.rac.form; + +import java.awt.BorderLayout; +import java.awt.Font; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import java.util.ArrayList; +import java.util.List; +import javax.swing.DefaultCellEditor; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTabbedPane; +import javax.swing.JTable; +import javax.swing.RowSorter; +import javax.swing.table.DefaultTableModel; +import javax.swing.table.TableCellEditor; +import javax.swing.table.TableColumn; +import javax.swing.table.TableModel; +import javax.swing.table.TableRowSorter; + +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.stylesheet.AbstractRendering; +import com.teamcenter.rac.util.MessageBox; + +//²Ʒͺűܱ +public class JK8_XCPXH_Form extends AbstractRendering { + /** + * + */ + private static final long serialVersionUID = 1L; + private String errorInfo = ""; + private List ta1 = new ArrayList<>(); + private List ta2 = new ArrayList<>(); + private List ta3 = new ArrayList<>(); + private List ta4 = new ArrayList<>(); + private List ta5 = new ArrayList<>(); + private List ta6 = new ArrayList<>(); + private List ta7 = new ArrayList<>(); + private List ta8 = new ArrayList<>(); + private List ta9 = new ArrayList<>(); + private List ta10 = new ArrayList<>(); + private List ta11 = new ArrayList<>(); + private List ta12 = new ArrayList<>();// + private Object[][] table1 = null; + private Object[][] table2 = null; + private Object[][] table3 = null; + private Object[][] table4 = null; + private Object[][] table5 = null; + private Object[][] table6 = null; + private Object[][] table7 = null; + private Object[][] table8 = null; + private Object[][] table9 = null; + private Object[][] table10 = null; + private Object[][] table11 = null; + private Object[][] table12 = null;// + + private JLabel biaoti; + + private JPanel Panel; + private JPanel topJPanel; + private JPanel mainJPanel; + private JTabbedPane tabPane; + private JPanel biao1; + private JPanel biao2; + private JPanel biao3; + private JPanel biao4; + private JPanel biao5; + private JPanel biao6; + private JPanel biao7; + private JPanel biao8; + private JPanel biao9; + private JPanel biao10; + private JPanel biao11; + private JPanel biao12;// + + // private JButton outBut=new JButton(""); + private JButton addBut = new JButton(""); + private JTable dataTable1;// 1 ñ + private JTable dataTable2;// 2 + private JTable dataTable3;// 3 + private JTable dataTable4;// 4 + private JTable dataTable5;// 5 + private JTable dataTable6;// 6 + private JTable dataTable7;// 7 + private JTable dataTable8;// 8 + private JTable dataTable9;// 9 + private JTable dataTable10;// 10 + private JTable dataTable11;// 11 + private JTable dataTable12;// 12 + private JTable partsTable1;// 12ʱ + /** + * ʶ Ʒ ֤ ֤ ʼ + * ģ оƬ Э ֹ淧 ȡѹ ƤĤ + * е² ɹʽ ɫ + * ת ⲿ ַ ܵ + * ʱ﮵ ϴ ۻר װlogo + * ÿ̨ Ʒʽ ûѷʽ ICͺ + * Ŀ Ŀ Ŀ + * ע Ƿͣ ͣԭ ͣۺ²Ʒ + + */ + private Object[] obj = new Object[] { "", "ʶ", "߻", "ͻ", "Ʒ", "Ʒͺ", "֤", "֤", "Ʒϵ",//TODO + "ʼ", "ģ", "оƬ", "Э", "Ʒ","","", "ֹ淧", "ȡѹ", "ƤĤ", "е²", + "", "ɹʽ", "ɫ", "ת","ۻר" ,"","ʱ﮵", + "ⲿ","ַ","ܵ","ϴ","װlogo","ÿ̨","Ʒʽ","ûѷʽ", + "ICͺ","","Ŀ","Ŀ","Ŀ","ע","Ƿͣ","ͣԭ","ͣۺ²Ʒ","",""};// ñ + private Object[] obj2 = new Object[] { "", "Ŀ", "Ŀ", "Ʒͺ", "ʶ", + "Ʒ", "·ͺ", "ܸ", "ͺ", "", "Ǽ" ,"״̬"};// ҵ + private Object[] obj3 = new Object[] { "", "Ŀ", "Ŀ", "Ʒͺ", "ʶ", + "Ʒ", "ܸ", "г", "", "Ǽ","״̬" };// ɼ + private Object[] obj4 = new Object[] { "", "Ŀ", "Ŀ", "Ʒͺ", "ʶ", + "Ʒ", "׻", "ܸ", "", "Ǽ" ,"״̬"};// + private Object[] obj5 = new Object[] { "", "Ŀ", "Ŀ", "Ʒ", + "Ʒͺ", "ʶ", "ܸ", "", "Ǽ","״̬" };// ֳֵֻ,,ģ, , + private Object[] obj6 = new Object[] { "", "Ŀ", "Ŀ", "Ʒ", + "Ʒͺ", "ʶ", "","ͨŷʽ","緽ʽ", "", "Ǽ","״̬" }; // + private Object[] obj7 = new Object[] { "", + "Ŀ", "Ŀ", "Ʒ",//3 + "Ʒͺ", "Ӧó","̽","","ͨŷʽ(л)","ͨŷʽ", + "緽ʽ","ź","ʶ","", "Ǽ","״̬" + }; // + private TCComponentForm form = null; + private TCSession session; + + private String name; + private String[] lovvals; + private boolean is = false; + + public JK8_XCPXH_Form(TCComponentForm arg0) throws Exception { + super(arg0); + try { + this.form = arg0; + this.session = arg0.getSession(); + name = session.getUser().getProperty("user_name"); + System.out.println("name=" + name); + TCPreferenceService pref = session.getPreferenceService(); + String[] names = pref.getStringValues("JK_HZB_Power");// ѡȨû + if (names != null) { + for (int i = 0; i < names.length; i++) { + System.out.println("Ȩ=" + names[i]); + if (names[i].equals(name)) { + System.out.println(""); + is = true; + } + } + } + lovvals = pref.getStringValues("JK_HZB_STATUSLOV");// ״̬lov + if(lovvals==null||lovvals.length==0){ + MessageBox.post("ѡJK_HZB_STATUSLOV","",MessageBox.WARNING); + return; + } + loadRendering(); + + }catch (Exception e) { + e.printStackTrace(); + //ӡ쳣 + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + e.printStackTrace(new PrintStream(baos)); + String exception = baos.toString(); + MessageBox.post(exception,"쳣",MessageBox.INFORMATION); + if(errorInfo.length()>0) { + MessageBox.post(errorInfo,"",MessageBox.INFORMATION); + } + } + } + + public void initPanel() { + this.setLayout(new BorderLayout()); + Panel = new JPanel(new BorderLayout()); + topJPanel = new JPanel(new BorderLayout()); + biaoti = new JLabel("²ƷͺʶŵǼDZ"); + biaoti.setFont(new Font("", 1, 24)); + // topJPanel.add("1.1.left.top", biaoti); + topJPanel.add(BorderLayout.CENTER, biaoti); + // topJPanel.add(BorderLayout.EAST, outBut); + if (is) { + + topJPanel.add(BorderLayout.EAST, addBut); + } + mainJPanel = new JPanel(new BorderLayout()); + + biao1 = new JPanel(new BorderLayout()); + biao2 = new JPanel(new BorderLayout()); + biao3 = new JPanel(new BorderLayout()); + biao4 = new JPanel(new BorderLayout()); + biao5 = new JPanel(new BorderLayout()); + biao6 = new JPanel(new BorderLayout()); + biao7 = new JPanel(new BorderLayout()); + biao8 = new JPanel(new BorderLayout()); + biao9 = new JPanel(new BorderLayout()); + biao10 = new JPanel(new BorderLayout()); + biao11 = new JPanel(new BorderLayout()); + biao12 = new JPanel(new BorderLayout());// + // ǩҳ JTabbedPane + tabPane = new JTabbedPane(); + // + tabPane.add("ñ", biao1); + // ñ + this.dataTable1 = getjTable(this.dataTable1, null, obj, table1,"table1"); + biao1.add(new JScrollPane(this.dataTable1), BorderLayout.CENTER); + + + // int rowCount = this.dataTable1.getRowCount(); + // Object[][] values = new Object[1][5]; + // + // for (int i = rowCount - 1; i >= 0; i--) { + // ((DefaultTableModel) this.dataTable1.getModel()).removeRow(i); + // } + // + // for (int i = 0; i < values.length; i++) { + // ((DefaultTableModel) this.dataTable1.getModel()).addRow(values[i]); + // } + + tabPane.add("ҵ", biao2); + this.dataTable2 = getjTable(this.dataTable2, null, obj2, table2,"table2"); + biao2.add(new JScrollPane(this.dataTable2), BorderLayout.CENTER); + + + tabPane.add("ɼ", biao3); + this.dataTable3 = getjTable(this.dataTable3, null, obj3, table3,"table3"); + biao3.add(new JScrollPane(this.dataTable3), BorderLayout.CENTER); + + tabPane.add("", biao4); + this.dataTable4 = getjTable(this.dataTable4, null, obj4, table4,"table4"); + biao4.add(new JScrollPane(this.dataTable4), BorderLayout.CENTER); + + tabPane.add("", biao5); + this.dataTable5 = getjTable(this.dataTable5, null, obj5, table5,"table5"); + biao5.add(new JScrollPane(this.dataTable5), BorderLayout.CENTER); + + tabPane.add("ֵ", biao6); + this.dataTable6 = getjTable(this.dataTable6, null, obj5, table6,"table6"); + biao6.add(new JScrollPane(this.dataTable6), BorderLayout.CENTER); + + tabPane.add("ֳֻ", biao7); + this.dataTable7 = getjTable(this.dataTable7, null, obj5, table7,"table7"); + biao7.add(new JScrollPane(this.dataTable7), BorderLayout.CENTER); + + tabPane.add("", biao8); + this.dataTable8 = getjTable(this.dataTable8, null, obj5, table8,"table8"); + biao8.add(new JScrollPane(this.dataTable8), BorderLayout.CENTER); + + tabPane.add("ģ", biao9); + this.dataTable9 = getjTable(this.dataTable9, null, obj5, table9,"table9"); + biao9.add(new JScrollPane(this.dataTable9), BorderLayout.CENTER); + + tabPane.add("", biao10); + this.dataTable10 = getjTable(this.dataTable10, null, obj6, table10,"table10"); + biao10.add(new JScrollPane(this.dataTable10), BorderLayout.CENTER); + + tabPane.add("", biao12); + this.dataTable12 = getjTable(this.dataTable12, null, obj7, table12,"table12"); + biao12.add(new JScrollPane(this.dataTable12), BorderLayout.CENTER); + + tabPane.add("", biao11); + this.dataTable11 = getjTable(this.dataTable11, null, obj5, table11,"table11"); + biao11.add(new JScrollPane(this.dataTable11), BorderLayout.CENTER); + + +// settablecol(dataTable1);//״̬ + settablecol(dataTable2); + settablecol(dataTable3); + settablecol(dataTable4); + settablecol(dataTable5); + settablecol(dataTable6); + settablecol(dataTable7); + settablecol(dataTable8); + settablecol(dataTable9); + settablecol(dataTable10); + settablecol(dataTable11); + settablecol(dataTable12); + settablecol1(dataTable12);//ͨŷʽ(л) + setxh(dataTable1);// + setxh(dataTable2); + setxh(dataTable3); + setxh(dataTable4); + setxh(dataTable5); + setxh(dataTable6); + setxh(dataTable7); + setxh(dataTable8); + setxh(dataTable9); + setxh(dataTable10); + setxh(dataTable11); + setxh(dataTable12); + dataTable1.setEnabled(false);// òɱ༭ + dataTable2.setEnabled(false); + dataTable3.setEnabled(false); + dataTable4.setEnabled(false); + dataTable5.setEnabled(false); + dataTable6.setEnabled(false); + dataTable7.setEnabled(false); + dataTable8.setEnabled(false); + dataTable9.setEnabled(false); + dataTable10.setEnabled(false); + dataTable11.setEnabled(false); + dataTable12.setEnabled(false); + + mainJPanel.add(tabPane, BorderLayout.CENTER); + + Panel.add(topJPanel, BorderLayout.NORTH); + Panel.add(mainJPanel, BorderLayout.CENTER); + this.add(Panel); + this.setVisible(true); + + addBut.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + addrow(); + } + }); + + // outBut.addActionListener(new ActionListener() { + // + // @Override + // public void actionPerformed(ActionEvent e) { + // MessageBox.post("ùδ,ڴ!!!","ʾ",MessageBox.INFORMATION); + // // Map maptab=new HashMap(); + // // maptab.put("ñ", dataTable1); + // // maptab.put("ҵ", dataTable2); + // // maptab.put("ɼ", dataTable3); + // // maptab.put("", dataTable4); + // // maptab.put("", dataTable5); + // // maptab.put("ֵ", dataTable6); + // // maptab.put("ֳֻ", dataTable7); + // // ExportHZb_Dialog dia=new ExportHZb_Dialog(maptab,session); + // // new Thread(dia).start(); + // + // } + // }); + + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + private void settablecol(JTable dataTable) { + TableColumn tc=dataTable.getColumn("״̬");// ȡһ + JComboBox cbx = new JComboBox(lovvals);// б + TableCellEditor tce=new DefaultCellEditor(cbx);// ༭ + tc.setCellEditor(tce); + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + private void settablecol1(JTable dataTable) { + TableColumn tc=dataTable.getColumn("ͨŷʽ(л)");// ȡһ + JComboBox cbx = new JComboBox(new String[]{"",""});// б + TableCellEditor tce=new DefaultCellEditor(cbx);// ༭ + tc.setCellEditor(tce); + } + + public void addrow() { + System.out.println(""); + String paname = tabPane.getTitleAt(tabPane.getSelectedIndex()); + System.out.println("ǰѡ:" + paname); + switch (paname) { + case "ñ": + ((DefaultTableModel) dataTable1.getModel()).addRow(new String[38]); + setxh(dataTable1); + break; + case "ҵ": + ((DefaultTableModel) dataTable2.getModel()).addRow(new String[12]); + setxh(dataTable2); + break; + case "ɼ": + ((DefaultTableModel) dataTable3.getModel()).addRow(new String[11]); + setxh(dataTable3); + break; + case "": + ((DefaultTableModel) dataTable4.getModel()).addRow(new String[11]); + setxh(dataTable4); + break; + case "": + ((DefaultTableModel) dataTable5.getModel()).addRow(new String[10]); + setxh(dataTable5); + break; + case "ֵ": + ((DefaultTableModel) dataTable6.getModel()).addRow(new String[10]); + setxh(dataTable6); + break; + case "ֳֻ": + ((DefaultTableModel) dataTable7.getModel()).addRow(new String[10]); + setxh(dataTable7); + break; + case "": + ((DefaultTableModel) dataTable8.getModel()).addRow(new String[10]); + setxh(dataTable8); + break; + case "ģ": + ((DefaultTableModel) dataTable9.getModel()).addRow(new String[10]); + setxh(dataTable9); + break; + case "": + ((DefaultTableModel) dataTable10.getModel()).addRow(new String[13]); + setxh(dataTable10); + break; + case "": + ((DefaultTableModel) dataTable12.getModel()).addRow(new String[16]);// + setxh(dataTable12); + break; + case "": + ((DefaultTableModel) dataTable11.getModel()).addRow(new String[10]); + setxh(dataTable11); + break; + default: + break; + } + + } + + // Jtableͨ÷ + public JTable getjTable(JTable partsTable, DefaultTableModel dtm, Object[] titleNames, Object[][] values,String str) { + + int simpleLen = 105; + int totleLen = 900; + if (partsTable == null) { + if(str.trim().equals("table12")){ + partsTable1 = null; + DefaultTableModel dtm1 = getTableModel(dtm, titleNames, values); + partsTable1 = new JTable(dtm1) { + /** + * + */ + private static final long serialVersionUID = 1L; + + @SuppressWarnings("unused") + public boolean isCelEditable(int row, int column) { + if(column == 9){ + if(partsTable1.getValueAt(row, 8).toString().trim().equals("")){ + return true; + }else{ + return false; + } + }else{ + return true; + + } + } + }; + partsTable = partsTable1; + RowSorter sorter = new TableRowSorter(dtm1); + // partsTable = new JTable(dtm); + partsTable.setRowSorter(sorter); + + if (simpleLen * titleNames.length >= totleLen) { + for (int i = 0; i < titleNames.length; i++) { + partsTable.getColumnModel().getColumn(i) + .setPreferredWidth(105); + } + partsTable.setAutoResizeMode(0); + } else { + partsTable.setAutoResizeMode(1); + } + }else{ + DefaultTableModel dtm1 = getTableModel(dtm, titleNames, values); + partsTable = new JTable(dtm1) { + /** + * + */ + private static final long serialVersionUID = 1L; + + @SuppressWarnings("unused") + public boolean isCelEditable(int row, int column) { + return false; + } + }; + RowSorter sorter = new TableRowSorter(dtm1); + // partsTable = new JTable(dtm); + partsTable.setRowSorter(sorter); + + if (simpleLen * titleNames.length >= totleLen) { + for (int i = 0; i < titleNames.length; i++) { + partsTable.getColumnModel().getColumn(i).setPreferredWidth(105); + } + partsTable.setAutoResizeMode(0); + } else { + partsTable.setAutoResizeMode(1); + } + } + } + + return partsTable; + } + + // tableؼ + public DefaultTableModel getTableModel(DefaultTableModel dtm, Object[] columnNameObjects, Object[][] objects) { + if (dtm == null) { + dtm = new DefaultTableModel(objects, columnNameObjects) + // { + // public Class getColumnClass(int column) { + // Class returnValue; + // if ((column >= 0) && (column < getColumnCount())) { + // returnValue = getValueAt(0, column).getClass(); + // } else { + // returnValue = Object.class; + // } + // return returnValue; + // } + // } + ; + } + return dtm; + } + + // ųʼ + private void setxh(JTable table) { + int cl = table.getRowCount(); + for (int i = 0; i < cl; i++) { + table.setValueAt(i + 1 + "", i, 0); + } + } + + @Override + public void loadRendering() throws TCException { + String[] lx = form.getTCProperty("jk8ProductType").getStringArrayValue(); + String[] t1_xmbh = form.getTCProperty("jk8ProjectNO").getStringArrayValue();// Ŀ + String[] t1_xmmc = form.getTCProperty("jk8ProjectName").getStringArrayValue();// Ŀ + String[] t1_cpxh = form.getTCProperty("jk8ProductModNO").getStringArrayValue();// Ʒͺ + String[] t1_sbh = form.getTCProperty("jk8ProductIdentifyNO").getStringArrayValue();// ʶ + String[] t1_cpmc = form.getTCProperty("jk8ProductName").getStringArrayValue();// Ʒ +// String[] jbcj = form.getTCProperty("jk8BaseMeterManufactor").getStringArrayValue();// + String[] t1_ickxh = form.getTCProperty("jk8ICCardType").getStringArrayValue();// ICͺ + String[] xlbxh = form.getTCProperty("jk8CircBoardModNO").getStringArrayValue();// ·ͺ +// String[] cxtz = form.getTCProperty("jk8ProgramFeatures").getStringArrayValue();// + String[] tdxh = form.getTCProperty("jk8InsteadType").getStringArrayValue();// ͺ + String[] gngs = form.getTCProperty("jk8FunctionOverview").getStringArrayValue();// ܸ +// String[] khtsyq = form.getTCProperty("jk8CustSpecRequirements").getStringArrayValue();// ͻҪ + // u8mmh = form.getTCProperty("jk8U8NO").getStringArrayValue();// U8 + String[] t1_fm = form.getTCProperty("jk8Valve").getStringArrayValue();// + String[] t1_jmlx = form.getTCProperty("jk8EncryptType").getStringArrayValue();// + String[] sqr = form.getTCProperty("jk8Applicant").getStringArrayValue();// + String[] djrq = form.getTCProperty("jk8RecordDate").getStringArrayValue();// Ǽ + String[] sysc = form.getTCProperty("jk8ApplyMarket").getStringArrayValue();// г + String[] ptjbcj = form.getTCProperty("jk8BMManfMatched").getStringArrayValue();// ׻ + + String[] status = form.getTCProperty("jk8Status").getStringArrayValue();// ״̬ + String[] fmlx = form.getTCProperty("jk8ValveType").getStringArrayValue();// + String[] txfs = form.getTCProperty("jk8CommunicateMode").getStringArrayValue();// ͨŷʽ + String[] gdlx = form.getTCProperty("jk8PowerSupplyMode").getStringArrayValue();// 緽 + String[] tcqt = form.getTCProperty("jk8GasType").getStringArrayValue();// ̽ + String[] yycs = form.getTCProperty("jk8UsePlace").getStringArrayValue();// ʹó + String[] txyn = form.getTCProperty("jk8CommunicateMode2").getStringArrayValue();// ͨŷʽ(л) + String[] scxh = form.getTCProperty("jk8OutputSignal").getStringArrayValue();// ź + String[] sccj = form.getTCProperty("jk8Manufacturer").getStringArrayValue();// + + String[] t1_fbzh = form.getTCProperty("jk8FlameproofType").getStringArrayValue();// ֤ + String[] t1_xpzh = form.getTCProperty("jk8TypeCerNo").getStringArrayValue();// ֤ + String[] t1_cspz = form.getTCProperty("jk8InitConfig").getStringArrayValue();// ʼ + String[] t1_mz = form.getTCProperty("jk8Module").getStringArrayValue();// ģ + String[] t1_xp = form.getTCProperty("jk8Chip").getStringArrayValue();// оƬ + String[] t1_xy = form.getTCProperty("jk8Agreement").getStringArrayValue();// Э + String[] t1_znf = form.getTCProperty("jk8BackstopValve").getStringArrayValue();// ֹ淧 + String[] t1_qyk = form.getTCProperty("jk8PressureTap").getStringArrayValue();// ȡѹ + String[] t1_jkpm = form.getTCProperty("jk8ImpSkin").getStringArrayValue();// ƤĤ + String[] t1_jxwb = form.getTCProperty("jk8MechTempC").getStringArrayValue();// е² + String[] t1_klc = form.getTCProperty("jk8WideRange").getStringArrayValue();// + String[] t1_jbcgfs = form.getTCProperty("jk8BMBuy").getStringArrayValue();// ɹʽ + String[] t1_jbys = form.getTCProperty("jk8BMColor").getStringArrayValue();// ɫ + String[] t1_hztj = form.getTCProperty("jk8GyratoryVolume").getStringArrayValue();// ת + String[] t1_wbbj = form.getTCProperty("jk8ExAlarm").getStringArrayValue();// ⲿ + String[] t1_mzfc = form.getTCProperty("jk8FaceAntiRemove").getStringArrayValue();// ַ + String[] t1_gdfc = form.getTCProperty("jk8PipeAntiRemove").getStringArrayValue();// ܵ + String[] t1_szld = form.getTCProperty("jk8ClockLiBattey").getStringArrayValue();// ʱ﮵ + String[] t1_ddsc = form.getTCProperty("jk8UploadPowerFail").getStringArrayValue();// ϴ + String[] t1_ghzy = form.getTCProperty("jk8ForHK").getStringArrayValue();// ۻר + String[] t1_wbzlogo = form.getTCProperty("jk8PackageLogo").getStringArrayValue();// װlogo + String[] t1_mxts = form.getTCProperty("jk8PerBoxUnits").getStringArrayValue();// ÿ̨ + String[] t1_cpghfs = form.getTCProperty("jk8SupplyMode").getStringArrayValue();// Ʒʽ + String[] t1_yhfffs = form.getTCProperty("jk8UserPayMethod").getStringArrayValue();// ûѷʽ + String[] t1_xmjl = form.getTCProperty("jk8ProjectManager").getStringArrayValue();// Ŀ + String[] t1_bz = form.getTCProperty("jk8Remarks").getStringArrayValue();// ע + String[] t1_sfts = form.getTCProperty("jk8StopSale").getStringArrayValue();// Ƿͣ + String[] t1_tsyy = form.getTCProperty("jk8ReasonsStopSale").getStringArrayValue();// ͣԭ + String[] t1_tshxcp = form.getTCProperty("jk8StopSaleNewProduct").getStringArrayValue();// ͣۺ²Ʒ + String[] t1_sqrq = form.getTCProperty("jk8ApplyDate").getStringArrayValue();// + + String[] t1_jxhdz = form.getTCProperty("jk8Customized").getStringArrayValue();// ߻ + String[] t1_kh = form.getTCProperty("jk8Customer").getStringArrayValue();// ͻ +// String[] t1_cpxh = form.getTCProperty("jk8ProductModNO").getStringArrayValue();// Ʒͺ + String[] t1_cpzxl = form.getTCProperty("jk8ProductFamily").getStringArrayValue();// Ʒϵ +// String[] t1_cplx = form.getTCProperty("jk8ProductType").getStringArrayValue();// Ʒ + String[] t1_lbdm = form.getTCProperty("jk8ContrlCompType").getStringArrayValue();// + String[] t1_lsm = form.getTCProperty("jk8Applicant").getStringArrayValue();// ˮ + String[] t1_jbcj = form.getTCProperty("jk8BMManufactor").getStringArrayValue();// + +// errorInfo += "lx.length="+lx.length+"\n"; +// errorInfo += "sccj.length="+sccj.length+"\n"; + //TODO + if (lx != null) { + for (int i = 0; i < lx.length; i++) { + System.out.println("lx=" + lx[i]); + if (lx[i] != null) + switch (lx[i]) { + case "tb1": + if(t1_fbzh.length>i &&t1_xpzh.length>i &&t1_cspz.length>i &&t1_mz.length>i + &&t1_xp.length>i &&t1_xy.length>i &&t1_znf.length>i &&t1_qyk.length>i &&t1_jkpm.length>i + &&t1_jxwb.length>i &&t1_klc.length>i &&t1_jbcgfs.length>i &&t1_jbys.length>i &&t1_hztj.length>i + &&t1_wbbj.length>i &&t1_mzfc.length>i &&t1_gdfc.length>i &&t1_szld.length>i &&t1_ddsc.length>i + &&t1_ghzy.length>i &&t1_wbzlogo.length>i &&t1_mxts.length>i &&t1_cpghfs.length>i + &&t1_yhfffs.length>i &&t1_xmjl.length>i &&t1_bz.length>i &&t1_sfts.length>i &&t1_tsyy.length>i + &&t1_tshxcp.length>i &&t1_sqrq.length>i + &&t1_jxhdz.length>i + &&t1_kh.length>i + &&t1_cpzxl.length>i + &&t1_lbdm.length>i + &&t1_lsm.length>i + &&t1_jbcj.length>i + ) { + ta1.add(new String[] { "", getv(t1_sbh[i]), getv(t1_jxhdz[i]), getv(t1_kh[i]), getv(t1_cpmc[i]), + getv(t1_cpxh[i]), getv(t1_fbzh[i]), getv(t1_xpzh[i]), getv(t1_cpzxl[i]), getv(t1_cspz[i]), + getv(t1_mz[i]), getv(t1_xp[i]), getv(t1_xy[i]), getv(lx[i]), getv(t1_lbdm[i]), + getv(t1_jbcj[i]), getv(t1_znf[i]), getv(t1_qyk[i]), getv(t1_jkpm[i]), getv(t1_jxwb[i]), + getv(t1_klc[i]), getv(t1_jbcgfs[i]), getv(t1_jbys[i]), getv(t1_hztj[i]) ,getv(t1_ghzy[i]), + getv(t1_fm[i]),getv(t1_szld[i]), + getv(t1_wbbj[i]), getv(t1_mzfc[i]),getv(t1_gdfc[i]),getv(t1_ddsc[i]), + getv(t1_wbzlogo[i]), + getv(t1_mxts[i]), getv(t1_cpghfs[i]),getv(t1_yhfffs[i]),getv(t1_ickxh[i]),getv(t1_jmlx[i]), + getv(t1_xmmc[i]), getv(t1_xmbh[i]), getv(t1_xmjl[i]), + getv(t1_bz[i]),getv(t1_sfts[i]),getv(t1_tsyy[i]),getv(t1_tshxcp[i]),getv(t1_lsm[i]), getv(t1_sqrq[i])}); + + }else { + ta1.add(new String[] { "", getv(t1_sbh[i]), "", "", getv(t1_cpmc[i]), getv(t1_cpxh[i]), "", + "", "", "", "", "", "", lx[i], "", "", "", + "", "", "", "", "", + "", "", "" ,getv(t1_fm[i]),"", + "","","","","","","", + "","",getv(t1_ickxh[i]),getv(t1_jmlx[i]),getv(t1_xmmc[i]),getv(t1_xmbh[i]),"", + "","","","",""}); + } + break; + case "tb2": + ta2.add(new String[] { "", getv(t1_xmmc[i]), getv(t1_xmbh[i]), getv(t1_cpxh[i]), + getv(t1_sbh[i]), getv(t1_cpmc[i]), getv(xlbxh[i]), getv(gngs[i]), getv(tdxh[i]), + getv(sqr[i]), getv(djrq[i]) ,getv(status[i])}); + break; + case "tb3": + ta3.add(new String[] { "", getv(t1_xmmc[i]), getv(t1_xmbh[i]), getv(t1_cpxh[i]), + getv(t1_sbh[i]), getv(t1_cpmc[i]), getv(gngs[i]), getv(sysc[i]), getv(sqr[i]), + getv(djrq[i]) ,getv(status[i])}); + break; + case "tb4": + ta4.add(new String[] { "", getv(t1_xmmc[i]), getv(t1_xmbh[i]), getv(t1_cpxh[i]), + getv(t1_sbh[i]), getv(t1_cpmc[i]), getv(ptjbcj[i]), getv(gngs[i]), getv(sqr[i]), + getv(djrq[i]),getv(status[i]) }); + break; + case "tb5": + ta5.add(new String[] { "", getv(t1_xmmc[i]), getv(t1_xmbh[i]), getv(t1_cpmc[i]), + getv(t1_cpxh[i]), getv(t1_sbh[i]), getv(gngs[i]), getv(sqr[i]), getv(djrq[i]) ,getv(status[i])}); + break; + case "tb6": + ta6.add(new String[] { "", getv(t1_xmmc[i]), getv(t1_xmbh[i]), getv(t1_cpmc[i]), + getv(t1_cpxh[i]), getv(t1_sbh[i]), getv(gngs[i]), getv(sqr[i]), getv(djrq[i]),getv(status[i]) }); + break; + case "tb7": + ta7.add(new String[] { "", getv(t1_xmmc[i]), getv(t1_xmbh[i]), getv(t1_cpmc[i]), + getv(t1_cpxh[i]), getv(t1_sbh[i]), getv(gngs[i]), getv(sqr[i]), getv(djrq[i]),getv(status[i]) }); + break; + case "tb8": + ta8.add(new String[] { "", getv(t1_xmmc[i]), getv(t1_xmbh[i]), getv(t1_cpmc[i]), + getv(t1_cpxh[i]), getv(t1_sbh[i]), getv(gngs[i]), getv(sqr[i]), getv(djrq[i]) ,getv(status[i])}); + break; + case "tb9": + ta9.add(new String[] { "", getv(t1_xmmc[i]), getv(t1_xmbh[i]), getv(t1_cpmc[i]), + getv(t1_cpxh[i]), getv(t1_sbh[i]), getv(gngs[i]), getv(sqr[i]), getv(djrq[i]) ,getv(status[i])}); + break; + case "tb10": + ta10.add(new String[] { "", getv(t1_xmmc[i]), getv(t1_xmbh[i]), getv(t1_cpmc[i]), + getv(t1_cpxh[i]), getv(t1_sbh[i]), getv(fmlx[i]),getv(txfs[i]),getv(gdlx[i]), getv(sqr[i]), + getv(djrq[i]),getv(status[i]) }); + break; + case "tb12":// + ta12.add(new String[] { "", getv(t1_xmmc[i]), getv(t1_xmbh[i]), getv(t1_cpmc[i]), + getv(t1_cpxh[i]), getv(yycs[i]), getv(tcqt[i]), getv(sccj[i]), getv(txyn[i]), getv(txfs[i]), + getv(gdlx[i]), getv(scxh[i]),getv(t1_sbh[i]),getv(sqr[i]), getv(djrq[i]),getv(status[i]) }); + break; + default: + ta11.add(new String[] { "", getv(t1_xmmc[i]), getv(t1_xmbh[i]), getv(t1_cpmc[i]), + getv(t1_cpxh[i]), getv(t1_sbh[i]), getv(gngs[i]), getv(sqr[i]), getv(djrq[i]) ,getv(status[i])}); + break; + + } + + } + + if (ta1 != null) { + table1 = new Object[ta1.size()][38]; + add(table1, ta1); + } + if (ta2 != null) { + table2 = new Object[ta2.size()][12]; + add(table2, ta2); + } + if (ta3 != null) { + table3 = new Object[ta3.size()][11]; + add(table3, ta3); + } + if (ta4 != null) { + table4 = new Object[ta4.size()][11]; + add(table4, ta4); + } + if (ta5 != null) { + table5 = new Object[ta5.size()][10]; + add(table5, ta5); + } + if (ta6 != null) { + table6 = new Object[ta6.size()][10]; + add(table6, ta6); + } + if (ta7 != null) { + table7 = new Object[ta7.size()][10]; + add(table7, ta7); + } + if (ta8 != null) { + table8 = new Object[ta8.size()][10]; + add(table8, ta8); + } + if (ta9 != null) { + table9 = new Object[ta9.size()][10]; + add(table9, ta9); + } + if (ta10 != null) { + table10 = new Object[ta10.size()][12]; + add(table10, ta10); + } + if (ta11 != null) { + table11 = new Object[ta11.size()][10]; + add(table11, ta11); + } + // + if (ta12 != null) { + table12 = new Object[ta12.size()][16]; + add(table12, ta12); + } + + } + initPanel(); + +// status = form.getTCProperty("jk8Status").getStringArrayValue();// ״̬ +// if(status==null||status.length0) { +// for (int i = 0; i < status.length; i++) { +// statusString[i]=status[i]; +// } +// } +// form.getTCProperty("jk8Status").setStringValueArray(statusString);// ״̬ +// } +// status = form.getTCProperty("jk8Status").getStringArrayValue();// ״̬ +// +// +// +// fmlx = form.getTCProperty("jk8ValveType").getStringArrayValue();// +// if(fmlx==null||fmlx.length0) { +// for (int i = 0; i < fmlx.length; i++) { +// fmlxString[i]=fmlx[i]; +// } +// } +// form.getTCProperty("jk8ValveType").setStringValueArray(fmlxString);// ״̬ +// } +// fmlx = form.getTCProperty("jk8ValveType").getStringArrayValue();// +// +// +// +// +// +// +// txfs = form.getTCProperty("jk8CommunicateMode").getStringArrayValue();// ͨŷʽ +// if(txfs==null||txfs.length0) { +// for (int i = 0; i < txfs.length; i++) { +// txfsString[i]=txfs[i]; +// } +// } +// form.getTCProperty("jk8CommunicateMode").setStringValueArray(txfsString);// ״̬ +// } +// txfs = form.getTCProperty("jk8CommunicateMode").getStringArrayValue();// ͨŷʽ +// +// +// +// +// +// gdlx = form.getTCProperty("jk8PowerSupplyMode").getStringArrayValue();// +// if(gdlx==null||gdlx.length0) { +// for (int i = 0; i < gdlx.length; i++) { +// gdlxString[i]=gdlx[i]; +// } +// } +// form.getTCProperty("jk8PowerSupplyMode").setStringValueArray(gdlxString);// ״̬ +// } +// gdlx = form.getTCProperty("jk8PowerSupplyMode").getStringArrayValue();// +// +// +// //2019.07.31 ʹó ⲿֵĹϵ ź Ʒ +// //2020.8.5 ̽ Ӧó ͨŷʽ(л) ź +// +// tcqt = form.getTCProperty("jk8GasType").getStringArrayValue();// +// if(tcqt==null||tcqt.length0) { +// for (int i = 0; i < tcqt.length; i++) { +// qtzlString[i]=tcqt[i]; +// } +// } +// form.getTCProperty("jk8GasType").setStringValueArray(qtzlString);// +// } +// tcqt = form.getTCProperty("jk8GasType").getStringArrayValue();// +// +// +// +// +// +// +// yycs = form.getTCProperty("jk8UsePlace").getStringArrayValue();// ʹó +// if(yycs==null||yycs.length0) { +// for (int i = 0; i < yycs.length; i++) { +// sycsString[i]=yycs[i]; +// } +// } +// form.getTCProperty("jk8UsePlace").setStringValueArray(sycsString);// ʹó +// } +// yycs = form.getTCProperty("jk8UsePlace").getStringArrayValue();// ʹó +// +// +// +// +// txyn = form.getTCProperty("jk8CommunicateMode2").getStringArrayValue();// ͨŷʽ(л) +// if(txyn==null||txyn.length0) { +// for (int i = 0; i < txyn.length; i++) { +// bjbfString[i]=txyn[i]; +// } +// } +// form.getTCProperty("jk8CommunicateMode2").setStringValueArray(bjbfString);// ͨŷʽ(л) +// } +// txyn = form.getTCProperty("jk8CommunicateMode2").getStringArrayValue();// ͨŷʽ(л) +// +// +// +// +// scxh = form.getTCProperty("jk8OutputSignal").getStringArrayValue();// ź +// if(scxh==null||scxh.length0) { +// for (int i = 0; i < scxh.length; i++) { +// scxh1zlString[i]=scxh[i]; +// } +// } +// form.getTCProperty("jk8OutputSignal").setStringValueArray(scxh1zlString);// ź +// } +// scxh = form.getTCProperty("jk8OutputSignal").getStringArrayValue();// ź +// +// +// +// +// +// sccj = form.getTCProperty("jk8Manufacturer").getStringArrayValue();// Ʒ +// if(sccj==null||sccj.length0) { +// for (int i = 0; i < sccj.length; i++) { +// cptzhString[i]=sccj[i]; +// } +// } +// System.out.println("shezhi-------------"); +// form.getTCProperty("jk8Manufacturer").setStringValueArray(cptzhString);// Ʒ +// System.out.println("shezhi2-------------"); +// } +// sccj = form.getTCProperty("jk8Manufacturer").getStringArrayValue();// Ʒ + + + + } + + // תΪά + private void add(Object[][] obj, List tb) { + for (int i = 0; i < tb.size(); i++) { + obj[i] = tb.get(i); + } + } + + public boolean isRenderingModified() { + if(isTableEdited(ta1, dataTable1)) + return true; + if(isTableEdited(ta2, dataTable2)) + return true; + if(isTableEdited(ta3, dataTable3)) + return true; + if(isTableEdited(ta4, dataTable4)) + return true; + if(isTableEdited(ta5, dataTable5)) + return true; + if(isTableEdited(ta6, dataTable6)) + return true; + if(isTableEdited(ta7, dataTable7)) + return true; + if(isTableEdited(ta8, dataTable8)) + return true; + if(isTableEdited(ta9, dataTable9)) + return true; + if(isTableEdited(ta10, dataTable10)) + return true; + if(isTableEdited(ta11, dataTable11)) + return true; + if(isTableEdited(ta12, dataTable12)) + return true; + return false; + } + + private boolean isTableEdited(List ta, JTable dataTable) { + if(ta.size() != dataTable.getRowCount()) + return true; + for(int i=0; i comBox; + private JTextField jt1;// ׼ʶ + private JTextField jt03;// ֤ + private JTextField jt04;// ֤ + private JTextField jt05;// ʼ + private JTextField jt06;// ע + private JTextField jt08;// ͻ +// private JTextField jt2; +// private JTextArea jt3; +// private JTextField jt4; +// private JTextField jt5; +// private JTextField jt6; +// private JTextField jt7; +// private JTextField jt8; +// private JTextField jt9; + private JTextField jt10; + private JTextField jt11; +// private JTextField jt12;// +// private JTextField jt13;// +// private JTextField jt14;// + + private JLabel jl1; + private JLabel jl2; + private JLabel jl3; + private JLabel jl4; + +// private JAutoCompleteComboBox box1 = new JAutoCompleteComboBox();// +// private JAutoCompleteComboBox box2 = new JAutoCompleteComboBox();// + private JAutoCompleteComboBox box3 = new JAutoCompleteComboBox();// ߻ TODO +// private JAutoCompleteComboBox box4 = new JAutoCompleteComboBox();// ˮ + private JAutoCompleteComboBox box5 = new JAutoCompleteComboBox();// Ʒ + private JAutoCompleteComboBox box6 = new JAutoCompleteComboBox();// ģ + private JAutoCompleteComboBox box7 = new JAutoCompleteComboBox();// оƬ + private JAutoCompleteComboBox box8 = new JAutoCompleteComboBox();// Э + private JAutoCompleteComboBox box9 = new JAutoCompleteComboBox();// ֹ淧 + private JAutoCompleteComboBox box10 = new JAutoCompleteComboBox();// ȡѹ + private JAutoCompleteComboBox box11 = new JAutoCompleteComboBox();// ƤĤ + private JAutoCompleteComboBox box12 = new JAutoCompleteComboBox();// е² + private JAutoCompleteComboBox box13 = new JAutoCompleteComboBox();// + private JAutoCompleteComboBox box14 = new JAutoCompleteComboBox();// ɹʽ + private JAutoCompleteComboBox box15 = new JAutoCompleteComboBox();// ɫ + private JAutoCompleteComboBox box16 = new JAutoCompleteComboBox();// ת + private JAutoCompleteComboBox box17 = new JAutoCompleteComboBox();// + private JAutoCompleteComboBox box18 = new JAutoCompleteComboBox();// ۻר + private JAutoCompleteComboBox box19 = new JAutoCompleteComboBox();// װlogo + private JAutoCompleteComboBox box20 = new JAutoCompleteComboBox();// ÿ̨ +// private JAutoCompleteComboBox box21 = new JAutoCompleteComboBox();// Ʒlogo + private JAutoCompleteComboBox box22 = new JAutoCompleteComboBox();// ⲿ + private JAutoCompleteComboBox box23 = new JAutoCompleteComboBox();// ַ + private JAutoCompleteComboBox box24 = new JAutoCompleteComboBox();// ܵ + private JAutoCompleteComboBox box25 = new JAutoCompleteComboBox();// ʱ﮵ + private JAutoCompleteComboBox box26 = new JAutoCompleteComboBox();// ϴ + private JAutoCompleteComboBox box27 = new JAutoCompleteComboBox();// Ʒʽ + private JAutoCompleteComboBox box28 = new JAutoCompleteComboBox();// ûѷʽ + private JAutoCompleteComboBox box29 = new JAutoCompleteComboBox();// ICͺ + private JAutoCompleteComboBox box30 = new JAutoCompleteComboBox();// + // private Registry registry = null; +// private iComboBox box1 = new iComboBox();// Ʒѷʽ +// private String sysc;// г + private HashMap realNameMap; + + private String jt;// ׼ʶ + + private String isCheck; + + private JTextField jt01;// Ŀ + private JTextField jt02;// Ŀ + + public JK8_YSSBH_Form(TCComponentForm arg0) throws Exception { + super(arg0); + try { + form = arg0; + session = arg0.getSession(); + // // Auto-generated constructor stub + // registry = Registry.getRegistry("com.teamcenter.rac.form.form_user"); + String[] names = session.getPreferenceService().getStringValues( + "JK_CPXH_FORM"); + if (names != null) { + + realNameMap = new HashMap<>(); + for (int i = 0; i < names.length; i++) { + String[] s = names[i].split("="); + if (s != null && s.length == 2) { + String key = s[0]; + String value = s[1]; + realNameMap.put(key, value); + } + + } + + } else { + MessageBox.post("ѡ JK_CPXH_FORM ڣϵԱ", "", + MessageBox.ERROR); + } + initializeUI(); + loadRendering(); + + mainPanel.addMouseMotionListener(new MouseMotionListener() { + + @Override + public void mouseMoved(MouseEvent e) { + // Auto-generated method stub + try { + isCheck = form.getTCProperty("fnd0IsCheckoutable").getDisplayableValue(); + } catch (Exception e1) { + // Auto-generated catch block + e1.printStackTrace(); + } + if ("".equals(isCheck)) { + seten(!"".equals(jt10.getText())); + setOwnerHave(); + } + } + + @Override + public void mouseDragged(MouseEvent e) { + // Auto-generated method stub + + } + }); + +// if (!radioButton2.isSelected()) { +// jt4.setEnabled(false); +// } + jt10.setEnabled(false); + jt11.setEnabled(false); + + }catch (Exception e) { + e.printStackTrace(); + //ӡ쳣 + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + e.printStackTrace(new PrintStream(baos)); + String exception = baos.toString(); + MessageBox.post(exception,"쳣",MessageBox.INFORMATION); + } + + } + + public void initializeUI() { + System.out.println("UI-----Start"); + initPanel(); + + } + + @SuppressWarnings("unchecked") + private void setLOV(JAutoCompleteComboBox box, String st, int length) { + // Auto-generated method stub +// box.setAutoCompleteSuggestive(false); +// box.addItems(realNameMap.get(st).split(",")); + String[] temparr = realNameMap.get(st).split(","); + box.addItem(""); + for(String s: temparr) { + box.addItem(s); + } + box.setTextLength(length); + } + + public void initPanel() { + System.out.println("--------------------------"); + jt1 = new JTextField(20); +// jt2 = new JTextField(20); +// jt3 =new JTextArea(3,20); +// jt4 = new JTextField(20); +// jt5 = new JTextField(20); +// jt6 = new JTextField(20); +// jt7 = new JTextField(20); +// jt8 = new JTextField(20); +// jt9 = new JTextField(20); + jt10 = new JTextField(25); + jt11 = new JTextField(25); +// jt12 = new JTextField(20); +// jt13 = new JTextField(20); +// jt14 = new JTextField(20); + jt01 = new JTextField(20); + jt02 = new JTextField(20); + jt03 = new JTextField(10); + jt04 = new JTextField(10); + jt05 = new JTextField(30); + jt06 = new JTextField(30); + jt08 = new JTextField(10); + + jl1 = new JLabel(" ʶ"); + jl1.setFont(new Font("", 1, 24)); + jl2 = new JLabel(" Ʒ"); + jl2.setFont(new Font("", 1, 18)); + jl3 = new JLabel(" &ֵ"); + jl3.setFont(new Font("", 1, 18)); + jl4 = new JLabel(" Ӳѡ"); + jl4.setFont(new Font("", 1, 18)); +// jl1 = new JLabel(" ׼ʶ:"); +// jl1.setSize(50, 20); +// jl2 = new JLabel(" ƷʶϢǼ"); +// jl2.setSize(70, 20); +// jl3 = new JLabel(" Ʒѷʽ"); +// jl3.setSize(70, 20); +// jl4 = new JLabel(" Ʒʶ"); +// jl4.setFont(new Font("", 0, 24)); +// jl2.setFont(new Font("", 0, 20)); + mainPanel = new JPanel(new PropertyLayout()); + this.setSize(new Dimension(650, 200)); + this.setLayout(new BorderLayout()); + + topJPanel = new JPanel(new PropertyLayout()); + topJPanel.add("1.1.left.top.preferred.preferred", jl1); + topJPanel.add("1.2.left.top.preferred.preferred", new JLabel(" ")); +// topPanel_1 = new JPanel(new PropertyLayout()); +// topPanel_1.add("1.1.left.top.preferred.preferred", jl4); +// topPanel_1.add("1.2.left.top.preferred.preferred", new JLabel(" ")); + // tijiao = new JButton("ύ"); + // tijiao.setEnabled(true); + // tijiao.setPreferredSize(new Dimension(70, 20)); + // tijiao.addActionListener(new ActionListener() { + // + // @Override + // public void actionPerformed(ActionEvent arg0) { + // // Auto-generated method stub + // saveRendering(); + // + // } + // }); + + // topPanel_2 = new JPanel(new PropertyLayout()); + // topPanel_2.add("1.1.right.bottom.preferred.preferred", tijiao); +// topPanel.add("1.1.left.top.preferred.preferred", topPanel_1); + // topPanel.add("1.2.right.bottom.preferred.preferred", topPanel_2); + +// firstJPanel = new JPanel(new PropertyLayout()); + +// topPanel.add("2.1.left.top.preferred.preferred", new JLabel(""));// ƷʶϢǼ +// topPanel.add("2.1.left.top.preferred.preferred", jl2); +// firstJPanel.add("1.1.left.top.preferred.preferred", jl1); +// firstJPanel.add("1.2.right.top.preferred.preferred", getjl()); +// firstJPanel.add("1.3.left.top.preferred.preferred", jt1); + firstJPanel = new JPanel(new PropertyLayout()); + firstJPanel.add("1.1.left.top.preferred.preferred", new JLabel("׼ʶţ")); + firstJPanel.add("1.2.right.top.preferred.preferred", getjl()); + firstJPanel.add("1.3.left.top.preferred.preferred", jt1); + firstJPanel.add("1.4.left.top.preferred.preferred", new JLabel(" ")); + yanzhen = new JButton("֤ʶ"); + firstJPanel.add("1.5.left.top.preferred.preferred", yanzhen); + firstJPanel.add("2.1.left.top.preferred.preferred", new JLabel("Ʒͺţ")); + firstJPanel.add("2.2.right.top.preferred.preferred", getjl()); + firstJPanel.add("2.3.left.top.preferred.preferred", jt10); + firstJPanel.add("3.1.left.top.preferred.preferred", new JLabel("Ŀƣ")); + firstJPanel.add("3.2.right.top.preferred.preferred", getjl()); + firstJPanel.add("3.3.left.top.preferred.preferred", jt01); + firstJPanel.add("4.1.left.top.preferred.preferred", new JLabel("Ŀţ")); + firstJPanel.add("4.2.right.top.preferred.preferred", getjl()); + firstJPanel.add("4.3.left.top.preferred.preferred", jt02); +// yanzhen = new JButton("֤ʶ"); + yanzhen.setEnabled(true); + yanzhen.setPreferredSize(new Dimension(100, 20)); + yanzhen.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + // Auto-generated method stub + System.out.println("֤"); + yzbut(); + + } + }); + + firstJPanel_1 = new JPanel(new PropertyLayout()); +// firstJPanel_1.add("1.1.left.top.preferred.preferred", new JLabel(":")); +// firstJPanel_1.add("1.2.right.top.preferred.preferred", getjl()); +// firstJPanel_1.add("1.3.left.top.preferred.preferred", box1); +// setLOV(box1,"",15); +// +// firstJPanel_1.add("1.4.left.top.preferred.preferred",new JLabel(" ")); +// firstJPanel_1.add("1.5.left.top.preferred.preferred", new JLabel(":")); +// firstJPanel_1.add("1.6.right.top.preferred.preferred", getjl()); +// firstJPanel_1.add("1.7.left.top.preferred.preferred", box2); +// setLOV(box2,"",15); + + firstJPanel_1.add("1.1.left.top.preferred.preferred", new JLabel("߻:")); + firstJPanel_1.add("1.2.right.top.preferred.preferred", getjl()); + firstJPanel_1.add("1.3.left.top.preferred.preferred", box3); + setLOV(box3,"߻",15); + + firstJPanel_1.add("1.4.left.top.preferred.preferred",new JLabel(" ")); + firstJPanel_1.add("1.5.left.top.preferred.preferred", new JLabel(" ͻ:")); + firstJPanel_1.add("1.6.right.top.preferred.preferred", getjl()); + firstJPanel_1.add("1.7.left.top.preferred.preferred", jt08); + + secondJPanel = new JPanel(new PropertyLayout()); + secondJPanel.add("1.1.left.top.preferred.prefereed",jl2); + + secondJPanel_1 = new JPanel(new PropertyLayout()); + secondJPanel_1.add("1.1.left.top.preferred.preferred",new JLabel("Ʒ:")); + secondJPanel_1.add("1.2.left.top.preferred.preferred",box5); + setLOV(box5,"Ʒ",10); + secondJPanel_1.add("1.3.left.top.preferred.preferred",new JLabel(" ֤:")); + secondJPanel_1.add("1.4.left.top.preferred.preferred",jt03); + secondJPanel_1.add("1.5.left.top.preferred.preferred",new JLabel(" ֤:")); + secondJPanel_1.add("1.6.left.top.preferred.preferred",jt04); + secondJPanel_1.add("2.1.left.top.preferred.preferred",new JLabel(" ģ:")); + secondJPanel_1.add("2.2.left.top.preferred.preferred",box6); + setLOV(box6,"ģ",10); + secondJPanel_1.add("2.3.left.top.preferred.preferred",new JLabel(" оƬ:")); + secondJPanel_1.add("2.4.left.top.preferred.preferred",box7); + setLOV(box7,"оƬ",10); + secondJPanel_1.add("2.5.left.top.preferred.preferred",new JLabel(" Э:")); + secondJPanel_1.add("2.6.left.top.preferred.preferred",box8); + setLOV(box8,"Э",10); + + secondJPanel_2 = new JPanel(new PropertyLayout()); + secondJPanel_2.add("1.1.left.top.preferred.prefereed",jl3); + + secondJPanel_3 = new JPanel(new PropertyLayout()); + secondJPanel_3.add("1.1.left.top.preferred.preferred",new JLabel(" ֹ淧:")); + secondJPanel_3.add("1.2.left.top.preferred.preferred",box9); + setLOV(box9,"ֹ淧",10); + + secondJPanel_3.add("1.3.left.top.preferred.preferred",new JLabel(" ")); + secondJPanel_3.add("1.4.left.top.preferred.preferred",new JLabel(" ȡѹ:")); + secondJPanel_3.add("1.5.left.top.preferred.preferred",box10); + setLOV(box10, "ȡѹ", 10); + + secondJPanel_3.add("1.6.left.top.preferred.preferred",new JLabel(" ")); + secondJPanel_3.add("1.7.left.top.preferred.preferred",new JLabel("ƤĤ:")); + secondJPanel_3.add("1.8.left.top.preferred.preferred",box11); + setLOV(box11, "ƤĤ", 10); + + secondJPanel_3.add("2.1.left.top.preferred.preferred",new JLabel("е²:")); + secondJPanel_3.add("2.2.left.top.preferred.preferred",box12); + setLOV(box12,"е²",10); + + secondJPanel_3.add("2.3.left.top.preferred.preferred",new JLabel(" ")); + secondJPanel_3.add("2.4.left.top.preferred.preferred",new JLabel(" :")); + secondJPanel_3.add("2.5.left.top.preferred.preferred",box13); + setLOV(box13, "", 10); + + secondJPanel_3.add("2.6.left.top.preferred.preferred",new JLabel(" ")); + secondJPanel_3.add("2.7.left.top.preferred.preferred",new JLabel("ɹʽ:")); + secondJPanel_3.add("2.8.left.top.preferred.preferred",box14); + setLOV(box14, "ɹʽ", 10); + + secondJPanel_3.add("3.1.left.top.preferred.preferred",new JLabel("ɫ:")); + secondJPanel_3.add("3.2.left.top.preferred.preferred",box15); + setLOV(box15,"ɫ",10); + + secondJPanel_3.add("3.3.left.top.preferred.preferred",new JLabel(" ")); + secondJPanel_3.add("3.4.left.top.preferred.preferred",new JLabel("ת:")); + secondJPanel_3.add("3.5.left.top.preferred.preferred",box16); + setLOV(box16, "ת", 10); + + secondJPanel_3.add("3.6.left.top.preferred.preferred",new JLabel(" ")); + secondJPanel_3.add("3.7.left.top.preferred.preferred",new JLabel(" :")); + secondJPanel_3.add("3.8.left.top.preferred.preferred",box17); + setLOV(box17, "", 10); + + secondJPanel_3.add("4.1.left.top.preferred.preferred",new JLabel("ۻר:")); + secondJPanel_3.add("4.2.left.top.preferred.preferred",box18); + setLOV(box18,"ۻר",10); + + secondJPanel_3.add("4.3.left.top.preferred.preferred",new JLabel(" ")); + secondJPanel_3.add("4.4.left.top.preferred.preferred",new JLabel("װlogo:")); + secondJPanel_3.add("4.5.left.top.preferred.preferred",box19); + setLOV(box19, "װlogo", 10); + + secondJPanel_3.add("4.6.left.top.preferred.preferred",new JLabel(" ")); + secondJPanel_3.add("4.7.left.top.preferred.preferred",new JLabel("ÿ̨:")); + secondJPanel_3.add("4.8.left.top.preferred.preferred",box20); + setLOV(box20, "ÿ̨", 10); + +// secondJPanel_3.add("4.1.left.top.preferred.preferred",new JLabel("Ʒlogo:")); +// secondJPanel_3.add("4.2.left.top.preferred.preferred",box18); +// setLOV(box21,"Ʒlogo",10); + + secondJPanel_4 = new JPanel(new PropertyLayout()); + secondJPanel_4.add("1.1.left.top.preferred.prefereed",jl4); + + secondJPanel_5 = new JPanel(new PropertyLayout()); + secondJPanel_5.add("1.1.left.top.preferred.preferred",new JLabel("ⲿ:")); + secondJPanel_5.add("1.2.left.top.preferred.preferred",box22); + setLOV(box22,"ⲿ",10); + + secondJPanel_5.add("1.3.left.top.preferred.preferred",new JLabel(" ")); + secondJPanel_5.add("1.4.left.top.preferred.preferred",new JLabel("ַ:")); + secondJPanel_5.add("1.5.left.top.preferred.preferred",box23); + setLOV(box23, "ַ", 10); + + secondJPanel_5.add("1.6.left.top.preferred.preferred",new JLabel(" ")); + secondJPanel_5.add("1.7.left.top.preferred.preferred",new JLabel("ܵ:")); + secondJPanel_5.add("1.8.left.top.preferred.preferred",box24); + setLOV(box24, "ܵ", 10); + + secondJPanel_5.add("2.1.left.top.preferred.preferred",new JLabel("ʱ﮵:")); + secondJPanel_5.add("2.2.left.top.preferred.preferred",box25); + setLOV(box25,"ʱ﮵",10); + + secondJPanel_5.add("2.3.left.top.preferred.preferred",new JLabel(" ")); + secondJPanel_5.add("2.4.left.top.preferred.preferred",new JLabel("ϴ:")); + secondJPanel_5.add("2.5.left.top.preferred.preferred",box26); + setLOV(box26, "ϴ", 10); + + secondJPanel_5.add("3.1.left.top.preferred.preferred",new JLabel("Ʒʽ:")); + secondJPanel_5.add("3.2.left.top.preferred.preferred",box27); + setLOV(box27,"Ʒʽ",10); + + secondJPanel_5.add("3.3.left.top.preferred.preferred",new JLabel(" ")); + secondJPanel_5.add("3.4.left.top.preferred.preferred",new JLabel("ûѷʽ:")); + secondJPanel_5.add("3.5.left.top.preferred.preferred",box28); + setLOV(box28, "ûѷʽ", 10); + + secondJPanel_5.add("4.1.left.top.preferred.preferred",new JLabel("ICͺ:")); + secondJPanel_5.add("4.2.left.top.preferred.preferred",box29); + setLOV(box29,"ICͺ",10); + + secondJPanel_5.add("4.3.left.top.preferred.preferred",new JLabel(" ")); + secondJPanel_5.add("4.4.left.top.preferred.preferred",new JLabel(":")); + secondJPanel_5.add("4.5.left.top.preferred.preferred",box30); + setLOV(box30, "", 10); + + secondJPanel_6 = new JPanel(new PropertyLayout()); + secondJPanel_6.add("1.1.left.top.preferred.preferred",new JLabel("ʼ:")); + secondJPanel_6.add("1.2.left.top.preferred.preferred",jt05); + secondJPanel_6.add("2.1.left.top.preferred.preferred",new JLabel(" ע:")); + secondJPanel_6.add("2.2.left.top.preferred.preferred",jt06); +// firstJPanel.add("1.4.left.top.preferred.preferred", yanzhen); +// firstJPanel.add("2.1.left.top.preferred.preferred", new JLabel(" Ŀƣ")); +// firstJPanel.add("2.2.right.top.preferred.preferred", getjl()); +// firstJPanel.add("2.3.left.top.preferred.preferred", jt01); +// firstJPanel.add("3.1.left.top.preferred.preferred", new JLabel(" Ŀţ")); +// firstJPanel.add("3.2.right.top.preferred.preferred", getjl()); +// firstJPanel.add("3.3.left.top.preferred.preferred", jt02); +// secondJPanel = new JPanel(new PropertyLayout()); +// secondJPanel_1 = new JPanel(new PropertyLayout()); +// secondJPanel_1.add("1.1.left.top.preferred.preferred", jl3); +// // Ʒѷʽ +// setLov(box1, "Ʒѷʽ"); +// secondJPanel_1.add("1.2.left.top.preferred.preferred", box1); +// +// secondJPanel_1.add("2.1.left.top.preferred.preferred", new JLabel(" г")); +// radioButton1 = new JRadioButton("ͨ");// ѡť +// radioButton2 = new JRadioButton("ר");// ѡť +// radioButton1.addActionListener(new ActionListener() { +// @Override +// public void actionPerformed(ActionEvent e) { +// // Auto-generated method stub +// if (radioButton1.isSelected()) { +// jt4.setText(""); +// jt4.setEnabled(false); +// } +// } +// }); +// radioButton2 = new JRadioButton("ר");// ѡť +// radioButton2.addActionListener(new ActionListener() { +// @Override +// public void actionPerformed(ActionEvent e) { +// // Auto-generated method stub +// if (radioButton2.isSelected()) { +// jt4.setEnabled(true); +// } +// } +// }); +// group = new ButtonGroup(); +// group.add(radioButton1); +// group.add(radioButton2); +// secondJPanel_1.add("2.2.left.top.preferred.preferred", radioButton1); +// secondJPanel_1.add("2.3.left.top.preferred.preferred", radioButton2); +// secondJPanel_1.add("2.4.left.top.preferred.preferred", jt4); +// secondJPanel_1.add("3.1.left.top.preferred.preferred", new JLabel(" ·ͺţ")); +// secondJPanel_1.add("3.2.left.top.preferred.preferred", jt6); +// secondJPanel_1.add("4.1.left.top.preferred.preferred", new JLabel(" ICͺţ")); +// secondJPanel_1.add("4.2.left.top.preferred.preferred", jt8); +// secondJPanel_1.add("5.1.left.top.preferred.preferred", new JLabel(" ţ")); +// secondJPanel_1.add("5.2.left.top.preferred.preferred", jt12); +// +// secondJPanel_1.add("6.1.left.top.preferred.preferred", new JLabel(" ")); +// secondJPanel_1.add("7.1.left.top.preferred.preferred", new JLabel(" ׳ң")); +// secondJPanel_1.add("7.2.left.top.preferred.preferred", jt14); +// +// secondJPanel_2 = new JPanel(new PropertyLayout()); +// JScrollPane jspane1=new JScrollPane(jt3); +// jt3.setLineWrap(true); +// secondJPanel_2.add("1.1.left.top.preferred.preferred", new JLabel(" ܸ ")); +// secondJPanel_2.add("1.2.left.top.preferred.preferred", jspane1);//2019.6.24 Ĺܸ Ҫ +// secondJPanel_2.add("2.1.left.top.preferred.preferred", new JLabel(" ͺţ ")); +// secondJPanel_2.add("2.2.left.top.preferred.preferred", jt5); +// +// secondJPanel_2.add("3.1.left.top.preferred.preferred", new JLabel(" ")); +// secondJPanel_2.add("3.2.left.top.preferred.preferred", jt7); +// +// secondJPanel_2.add("4.1.left.top.preferred.preferred", new JLabel(" ͻҪ")); +// secondJPanel_2.add("4.2.left.top.preferred.preferred", jt9); +// secondJPanel_2.add("5.1.left.top.preferred.preferred", new JLabel(" ͣ")); +// secondJPanel_2.add("5.2.left.top.preferred.preferred", jt13); +// secondJPanel.add("1.1.left.top.preferred.preferred", secondJPanel_1); +// secondJPanel.add("1.2.left.top.preferred.preferred", secondJPanel_2); + thirdJPanel = new JPanel(new PropertyLayout()); +// thirdJPanel.add("1.1.left.top.preferred.preferred", new JLabel(" Ʒͺţ ")); +// thirdJPanel.add("1.2.left.top.preferred.preferred", jt10); + thirdJPanel.add("1.1.left.top.preferred.preferred", new JLabel(" ʶţ")); + thirdJPanel.add("1.2.left.top.preferred.preferred", jt11); + + mainPanel.add("1.1.left.top.preferred.preferred", topJPanel); + mainPanel.add("2.1.left.top.preferred.preferred", firstJPanel); + mainPanel.add("3.1.left.top.preferred.preferred", firstJPanel_1); + mainPanel.add("4.1.left.top.preferred.preferred", secondJPanel); + mainPanel.add("5.1.left.top.preferred.preferred", secondJPanel_1); + mainPanel.add("6.1.left.top.preferred.preferred", secondJPanel_2); + mainPanel.add("7.1.left.top.preferred.preferred", secondJPanel_3); + mainPanel.add("8.1.left.top.preferred.preferred", secondJPanel_4); + mainPanel.add("9.1.left.top.preferred.preferred", secondJPanel_5); + mainPanel.add("10.1.left.top.preferred.preferred", secondJPanel_6); +// mainPanel.add("2.1.left.top.preferred.preferred", firstJPanel); +// mainPanel.add("3.1.left.top.preferred.preferred", secondJPanel); + mainPanel.add("11.1.left.top.preferred.preferred", thirdJPanel); + this.add(new JScrollPane(mainPanel)); + this.setVisible(true); + this.setBackground(Color.LIGHT_GRAY); + } + + @Override + public void loadRendering() throws TCException { + // Auto-generated method stub + System.out.println("loadRendering"); + + jt1.setText(form.getTCProperty("jk8BaseIdentifyNO").getStringValue());// ׼ʶ +// box1.setText(form.getTCProperty("jk8BillingMode").getStringValue());// Ʒѷʽ + + jt01.setText(form.getTCProperty("jk8ProjectName").getStringValue());// Ŀ + jt02.setText(form.getTCProperty("jk8ProjectNO").getStringValue());// Ŀ + +// jt6.setText(form.getTCProperty("jk8CircBoardModNO").getStringValue());// ·ͺ +// jt3.setText(form.getTCProperty("jk8FunctionOverview").getStringValue());// ܸ +// jt5.setText(form.getTCProperty("jk8InsteadType").getStringValue());// ͺ +// jt7.setText(form.getTCProperty("jk8ProgramFeatures").getStringValue());// +// jt9.setText(form.getTCProperty("jk8CustSpecRequirements") +// .getStringValue());// ͻҪ +// jt8.setText(form.getTCProperty("jk8ICCardType").getStringValue());// ICͺ + + jt10.setText(form.getTCProperty("jk8ProductModNO").getStringValue());// Ʒͺ + jt11.setText(form.getTCProperty("jk8ProductIdentifyNO").getStringValue());// ʶ + box3.setText(form.getTCProperty("jk8Customized").getStringValue());// ߻ + + box5.setText(form.getTCProperty("jk8ProductName").getStringValue()); + box6.setText(form.getTCProperty("jk8Module").getStringValue()); + box7.setText(form.getTCProperty("jk8Chip").getStringValue()); + box8.setText(form.getTCProperty("jk8Agreement").getStringValue()); + box9.setText(form.getTCProperty("jk8BackstopValve").getStringValue()); + box10.setText(form.getTCProperty("jk8PressureTap").getStringValue()); + box11.setText(form.getTCProperty("jk8ImpSkin").getStringValue()); + box12.setText(form.getTCProperty("jk8MechTempC").getStringValue()); + box13.setText(form.getTCProperty("jk8WideRange").getStringValue()); + box14.setText(form.getTCProperty("jk8BMBuy").getStringValue()); + box15.setText(form.getTCProperty("jk8BMColor").getStringValue()); + box16.setText(form.getTCProperty("jk8GyratoryVolume").getStringValue()); + box17.setText(form.getTCProperty("jk8Valve").getStringValue()); + box18.setText(form.getTCProperty("jk8ForHK").getStringValue()); + box19.setText(form.getTCProperty("jk8PackageLogo").getStringValue()); + box20.setText(form.getTCProperty("jk8PerBoxUnits").getStringValue()); +// box21.setText(form.getTCProperty("jk8ProductLogo").getStringValue()); + box22.setText(form.getTCProperty("jk8ExAlarm").getStringValue()); + box23.setText(form.getTCProperty("jk8FaceAntiRemove").getStringValue()); + box24.setText(form.getTCProperty("jk8PipeAntiRemove").getStringValue()); + box25.setText(form.getTCProperty("jk8ClockLiBattey").getStringValue()); + box26.setText(form.getTCProperty("jk8UploadPowerFail").getStringValue()); + box27.setText(form.getTCProperty("jk8SupplyMode").getStringValue()); + box28.setText(form.getTCProperty("jk8UserPayMethod").getStringValue()); + box29.setText(form.getTCProperty("jk8ICCardType").getStringValue()); + box30.setText(form.getTCProperty("jk8EncryptType").getStringValue()); + + jt03.setText(form.getTCProperty("jk8FlameproofType").getStringValue()); + jt04.setText(form.getTCProperty("jk8TypeCerNo").getStringValue()); + jt05.setText(form.getTCProperty("jk8InitConfig").getStringValue()); + jt06.setText(form.getTCProperty("jk8Remarks").getStringValue()); + jt08.setText(form.getTCProperty("jk8Customer").getStringValue()); +// jt12.setText(form.getTCProperty("jk8Valve").getStringValue());// +// jt13.setText(form.getTCProperty("jk8EncryptType").getStringValue());// +// jt14.setText(form.getTCProperty("jk8BMManfMatched").getStringValue());// +// +// if (form.getTCProperty("jk8ApplyMarket").getStringValue().equals("ͨ")) { +// radioButton1.setSelected(true); +// } else if (form.getTCProperty("jk8ApplyMarket").getStringValue().contains("ר")) { +// radioButton2.setSelected(true); +// String[] strs=form.getTCProperty("jk8ApplyMarket").getStringValue().split(";"); +// if(strs!=null&&strs.length>1){ +// jt4.setText(strs[1]);// ר +// } +// +// } + } + + +/* @Override + public Map getRenderingModified() { + Map modifiedRendering = new HashMap (); + try { + System.out.println("getRenderingModifiedʼ"); + saveRendering(); + }catch(Exception ex){ + ex.toString(); + System.out.println(ex.toString()); + } + return modifiedRendering; + }*/ + + public boolean isRenderingModified() { + System.out.println("isRenderingModified"); + + try { + if(isrend(form.getTCProperty("jk8BaseIdentifyNO"),jt1.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ProjectName"),jt01.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ProjectNO"),jt02.getText())){ + return true; + } + // if(isrend(form.getTCProperty("jk8BillingMode"),box1.getTextField().getText())){ + // return true; + // } + // if (radioButton1.isSelected()) { + // if(isrend(form.getTCProperty("jk8ApplyMarket"),radioButton1.getText())){ + // return true; + // } + // } + // if (radioButton2.isSelected()) { + // if(isrend(form.getTCProperty("jk8ApplyMarket"),radioButton2.getText() + ";" + jt4.getText())){ + // return true; + // } + // } + // if(isrend(form.getTCProperty("jk8CircBoardModNO"),jt6.getText())){ + // return true; + // } + // if(isrend(form.getTCProperty("jk8FunctionOverview"),jt3.getText())){ + // return true; + // } + // if(isrend(form.getTCProperty("jk8InsteadType"),jt5.getText())){ + // return true; + // } + // if(isrend(form.getTCProperty("jk8ProgramFeatures"),jt7.getText())){ + // return true; + // } + // if(isrend(form.getTCProperty("jk8CustSpecRequirements"),jt9.getText())){ + // return true; + // } + // if(isrend(form.getTCProperty("jk8ICCardType"),jt8.getText())){ + // return true; + // } + if(isrend(form.getTCProperty("jk8ProductModNO"),jt10.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ProductIdentifyNO"),jt11.getText())){ + return true; + } + // if(isrend(form.getTCProperty("jk8Valve"),jt12.getText())){ + // return true; + // } + // if(isrend(form.getTCProperty("jk8EncryptType"),jt13.getText())){ + // return true; + // } + // if(isrend(form.getTCProperty("jk8BMManfMatched"),jt14.getText())){ + // return true; + // } + if(isrend(form.getTCProperty("jk8Customized"),box3.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ProductName"),box5.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8Module"),box6.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8Chip"),box7.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8Agreement"),box8.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8BackstopValve"),box9.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8PressureTap"),box10.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ImpSkin"),box11.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8MechTempC"),box12.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8WideRange"),box13.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8BMBuy"),box14.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8BMColor"),box15.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8GyratoryVolume"),box16.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8Valve"),box17.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ForHK"),box18.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8PackageLogo"),box19.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8PerBoxUnits"),box20.getText())){ + return true; + } + // if(isrend(form.getTCProperty("jk8ProductLogo"),box21.getText())){ + // return true; + // } + if(isrend(form.getTCProperty("jk8ExAlarm"),box22.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8FaceAntiRemove"),box23.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8PipeAntiRemove"),box24.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ClockLiBattey"),box25.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8UploadPowerFail"),box26.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8SupplyMode"),box27.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8UserPayMethod"),box28.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ICCardType"),box29.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8EncryptType"),box30.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8FlameproofType"),jt03.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8TypeCerNo"),jt04.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8InitConfig"),jt05.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8Remarks"),jt06.getText())){ + return true; + } + } catch (Exception e) { + // Auto-generated catch block + e.printStackTrace(); + }// гѡ + return false; + } + + + private boolean isrend(TCProperty tcProperty, String str) { + // Auto-generated method stub + if(tcProperty!=null&&str!=null&&(!str.equals(tcProperty.getStringValue()))){ + System.out.println(str); + return true; + } + return false; + } + + + @Override + public void saveRendering() { + // Auto-generated method stub + if ("".equals(jt01.getText()) + || "".equals(jt02.getText()) + || "".equals(jt1.getText()) + || "".equals(jt10.getText()) + || "".equals(jt08.getText()) + || "".equals(box3.getText()) + ) { + MessageBox.post("޷,ȷȫд!!", "", MessageBox.ERROR); + }else{ + if ("".equals(jt11.getText())) { + try { + form.getTCProperty("jk8ProjectName").setStringValue(jt01.getText());// Ŀ + form.getTCProperty("jk8ProjectNO").setStringValue(jt02.getText());// Ŀ + form.getTCProperty("jk8BaseIdentifyNO").setStringValue(jt1.getText());// ׼ʶ +// form.getTCProperty("jk8BillingMode").setStringValue(box1.getTextField().getText());// Ʒѷʽ +// form.getTCProperty("jk8CircBoardModNO").setStringValue(jt6.getText());// ·ͺ +// form.getTCProperty("jk8FunctionOverview").setStringValue(jt3.getText());// ܸ +// form.getTCProperty("jk8InsteadType").setStringValue(jt5.getText());// ͺ +// form.getTCProperty("jk8ProgramFeatures").setStringValue(jt7.getText());// +// form.getTCProperty("jk8CustSpecRequirements").setStringValue(jt9.getText());// ͻҪ +// form.getTCProperty("jk8ICCardType").setStringValue(jt8.getText());// ICͺ + form.getTCProperty("jk8ProductModNO").setStringValue(jt10.getText());// Ʒͺ + form.getTCProperty("jk8ProductIdentifyNO").setStringValue(jt11.getText());// ʶ + form.getTCProperty("jk8FlameproofType").setStringValue(jt03.getText()); + form.getTCProperty("jk8TypeCerNo").setStringValue(jt04.getText()); + form.getTCProperty("jk8InitConfig").setStringValue(jt05.getText()); + form.getTCProperty("jk8Remarks").setStringValue(jt06.getText()); + form.getTCProperty("jk8Customer").setStringValue(jt08.getText()); + + form.getTCProperty("jk8Customized").setStringValue(box3.getText());// ߻ + form.getTCProperty("jk8ProductName").setStringValue(box5.getText()); + form.getTCProperty("jk8Module").setStringValue(box6.getText()); + form.getTCProperty("jk8Chip").setStringValue(box7.getText()); + form.getTCProperty("jk8Agreement").setStringValue(box8.getText()); + form.getTCProperty("jk8BackstopValve").setStringValue(box9.getText()); + form.getTCProperty("jk8PressureTap").setStringValue(box10.getText()); + form.getTCProperty("jk8ImpSkin").setStringValue(box11.getText()); + form.getTCProperty("jk8MechTempC").setStringValue(box12.getText()); + form.getTCProperty("jk8WideRange").setStringValue(box13.getText()); + form.getTCProperty("jk8BMBuy").setStringValue(box14.getText()); + form.getTCProperty("jk8BMColor").setStringValue(box15.getText()); + form.getTCProperty("jk8GyratoryVolume").setStringValue(box16.getText()); + form.getTCProperty("jk8Valve").setStringValue(box17.getText()); + form.getTCProperty("jk8ForHK").setStringValue(box18.getText()); + form.getTCProperty("jk8PackageLogo").setStringValue(box19.getText()); + form.getTCProperty("jk8PerBoxUnits").setStringValue(box20.getText()); +// form.getTCProperty("jk8ProductLogo").setStringValue(box21.getText()); + form.getTCProperty("jk8ExAlarm").setStringValue(box22.getText()); + form.getTCProperty("jk8FaceAntiRemove").setStringValue(box23.getText()); + form.getTCProperty("jk8PipeAntiRemove").setStringValue(box24.getText()); + form.getTCProperty("jk8ClockLiBattey").setStringValue(box25.getText()); + form.getTCProperty("jk8UploadPowerFail").setStringValue(box26.getText()); + form.getTCProperty("jk8SupplyMode").setStringValue(box27.getText()); + form.getTCProperty("jk8UserPayMethod").setStringValue(box28.getText()); + form.getTCProperty("jk8ICCardType").setStringValue(box29.getText()); + form.getTCProperty("jk8EncryptType").setStringValue(box30.getText()); +// form.getTCProperty("jk8Valve").setStringValue(jt12.getText());// +// form.getTCProperty("jk8EncryptType").setStringValue(jt13.getText());// +// form.getTCProperty("jk8BMManfMatched").setStringValue(jt14.getText());// +// +// if (radioButton1.isSelected()) { +// form.getTCProperty("jk8ApplyMarket").setStringValue(radioButton1.getText());// г +// } +// if (radioButton2.isSelected()) { +// form.getTCProperty("jk8ApplyMarket").setStringValue(radioButton2.getText() + ";" + jt4.getText());// г +// } + } catch (Exception e) { + // Auto-generated catch block + e.printStackTrace(); + } + } else { + MessageBox.post("ʶѴ,޷ٴα", "", MessageBox.ERROR); + } + } + } + + public void setOwnerHave() { + try { + + String user = session.getUserName(); + String owning_user = form.getProperty("owning_user"); + // System.out.println("owning_user.indexOf(user)="+owning_user.indexOf(user)); + if (owning_user.indexOf(user) < 0) { + jt1.setEnabled(false); + yanzhen.setEnabled(false); + jt03.setEnabled(false); + jt04.setEnabled(false); + jt05.setEnabled(false); + jt06.setEnabled(false); + jt08.setEnabled(false); +// box1.setEnabled(false); +// jt2.setEnabled(false); +// jt3.setEnabled(false); +// jt4.setEnabled(false); +// jt5.setEnabled(false); +// jt6.setEnabled(false); +// jt7.setEnabled(false); +// jt8.setEnabled(false); +// jt9.setEnabled(false); + jt10.setEnabled(false); + jt11.setEnabled(false); + box3.setEnabled(false); + box5.setEnabled(false); + box6.setEnabled(false); + box7.setEnabled(false); + box8.setEnabled(false); + box9.setEnabled(false); + box10.setEnabled(false); + box11.setEnabled(false); + box12.setEnabled(false); + box13.setEnabled(false); + box14.setEnabled(false); + box15.setEnabled(false); + box16.setEnabled(false); + box17.setEnabled(false); + box18.setEnabled(false); + box19.setEnabled(false); + box20.setEnabled(false); +// box21.setEnabled(false); + box22.setEnabled(false); + box23.setEnabled(false); + box24.setEnabled(false); + box25.setEnabled(false); + box26.setEnabled(false); + box27.setEnabled(false); + box28.setEnabled(false); + box29.setEnabled(false); + box30.setEnabled(false); +// jt12.setEnabled(false); +// jt13.setEnabled(false); +// jt14.setEnabled(false); +// radioButton1.setEnabled(false); +// radioButton2.setEnabled(false); + jt01.setEnabled(false); + jt02.setEnabled(false); + + } + } catch (Exception e) { + System.out.println("ӵǷʱļеòȷҲ"); + e.printStackTrace(); + } + } + + public void seten(boolean is) { +// box1.setEnabled(is); +// jt2.setEnabled(is); +// jt3.setEnabled(is); +// jt5.setEnabled(is); +// jt6.setEnabled(is); +// jt7.setEnabled(is); +// jt8.setEnabled(is); +// jt9.setEnabled(is); + // jt10.setEnabled(is); + // jt11.setEnabled(is); +// jt12.setEnabled(is); +// jt13.setEnabled(is); +// jt14.setEnabled(is); +// radioButton1.setEnabled(is); +// radioButton2.setEnabled(is); + jt01.setEnabled(is); + jt02.setEnabled(is); + jt03.setEnabled(is); + jt04.setEnabled(is); + jt05.setEnabled(is); + jt06.setEnabled(is); + jt08.setEnabled(is); + + jt10.setEnabled(is); + jt11.setEnabled(is); + + box3.setEnabled(is); + box5.setEnabled(is); + box6.setEnabled(is); + box7.setEnabled(is); + box8.setEnabled(is); + box9.setEnabled(is); + box10.setEnabled(is); + box11.setEnabled(is); + box12.setEnabled(is); + box13.setEnabled(is); + box14.setEnabled(is); + box15.setEnabled(is); + box16.setEnabled(is); + box17.setEnabled(is); + box18.setEnabled(is); + box19.setEnabled(is); + box20.setEnabled(is); +// box21.setEnabled(is); + box22.setEnabled(is); + box23.setEnabled(is); + box24.setEnabled(is); + box25.setEnabled(is); + box26.setEnabled(is); + box27.setEnabled(is); + box28.setEnabled(is); + box29.setEnabled(is); + box30.setEnabled(is); + } + + @Override + public void itemStateChanged(ItemEvent e) { + // Auto-generated method stub + Object object = e.getSource(); + if (object.equals(comBox)) { + System.out.println("ѡ" + e.getItem() + ""); + if (e.getStateChange() == ItemEvent.SELECTED) { + if (e.getItem() != null) { + jffs = (String) e.getItem(); + jffs = jffs.trim(); + System.out.println(jffs); + } else { + return; + } + + } + } + } + + private void yzbut() { + + jt = jt1.getText(); + System.out.println(jt); + System.out.println(jt.split("\\.").length); + if (jt != null && !jt.equals("")) { +// if(jt.split("\\.").length>1) { +// MessageBox.post("ʶ޷", "", MessageBox.ERROR); +// return; +// } + TCPreferenceService pref = session.getPreferenceService(); + String puid = pref.getStringValue("JK_SQB_FORM_PUID"); + if (puid == null) { + MessageBox.post("ѡδҵϵԱ", "", MessageBox.ERROR); + return; + } + + TCComponentForm formAll; + try { + formAll = (TCComponentForm) session.stringToComponent(puid); + if (formAll == null) { + MessageBox.post("δҵϵԱ", "", MessageBox.ERROR); + } + boolean ishave1 = ishave("jk8ProductIdentifyNO", "jk8ProductModNO", formAll);// ܱ + + if (ishave1) { + MessageBox.post("ҵʶţƷͺ", "ɹ", MessageBox.INFORMATION); + } else { + MessageBox.post("δҵʶţдĻ׼ʶǷȷ", "", MessageBox.ERROR); + } + } catch (Exception e) { + // Auto-generated catch block + e.printStackTrace(); + } + } + + } + + private boolean ishave(String sbh_all, String cpxh_all, TCComponentForm formAll) {//TODO + // Auto-generated method stub + boolean bo = false; + try { + String[] sbhs = formAll.getTCProperty(sbh_all).getStringValueArray();// ʶ + String cpxh = ""; +// String jbcj = ""; + String lx = ""; +// String name = ""; + for (int i = 0; i < sbhs.length; i++) { + if (jt.equals(sbhs[i])) { +// cpxh = formAll.getTCProperty(cpxh_all).getStringValueArray()[i];// 鵽IJƷͺ +// jbcj = formAll.getTCProperty("jk8BaseMeterManufactor").getStringValueArray()[i];// / +// lx = formAll.getTCProperty("jk8ProductType").getStringValueArray()[i];// Ʒ +// name = formAll.getTCProperty("jk8ProductName").getStringValueArray()[i];// Ʒ + lx = formAll.getTCProperty("jk8ProductType").getStringValueArray()[i];// Ʒ + form.getTCProperty("jk8ProductType").setStringValue(lx);// Ʒ + bo = true; + + String xmbh = formAll.getTCProperty("jk8ProjectNO").getStringArrayValue()[i];// Ŀ + String xmmc = formAll.getTCProperty("jk8ProjectName").getStringArrayValue()[i];// Ŀ + cpxh = formAll.getTCProperty("jk8ProductModNO").getStringArrayValue()[i];// Ʒͺ +// String sbh = formAll.getTCProperty("jk8ProductIdentifyNO").getStringArrayValue()[i];// ʶ +// jbcj = formAll.getTCProperty("jk8BaseMeterManufactor").getStringArrayValue()[i];// +// String ickxh = formAll.getTCProperty("jk8ICCardType").getStringArrayValue()[i];// ICͺ + + jt01.setText(xmmc);// Ŀ + jt02.setText(xmbh);// Ŀ + jt10.setText(cpxh);// Ʒͺ +// jt11.setText(sbh); +// box1.setText(jbcj); + box5.setText(formAll.getTCProperty("jk8ProductName").getStringArrayValue()[i]); + jt03.setText(formAll.getTCProperty("jk8FlameproofType").getStringArrayValue()[i]); + jt04.setText(formAll.getTCProperty("jk8TypeCerNo").getStringArrayValue()[i]); + box6.setText(formAll.getTCProperty("jk8Module").getStringArrayValue()[i]); + box7.setText(formAll.getTCProperty("jk8Chip").getStringArrayValue()[i]); + box8.setText(formAll.getTCProperty("jk8Agreement").getStringArrayValue()[i]); + box9.setText(formAll.getTCProperty("jk8BackstopValve").getStringArrayValue()[i]); + box10.setText(formAll.getTCProperty("jk8PressureTap").getStringArrayValue()[i]); + box11.setText(formAll.getTCProperty("jk8ImpSkin").getStringArrayValue()[i]); + box12.setText(formAll.getTCProperty("jk8MechTempC").getStringArrayValue()[i]); + box13.setText(formAll.getTCProperty("jk8WideRange").getStringArrayValue()[i]); + box14.setText(formAll.getTCProperty("jk8BMBuy").getStringArrayValue()[i]); + box15.setText(formAll.getTCProperty("jk8BMColor").getStringArrayValue()[i]); + box16.setText(formAll.getTCProperty("jk8GyratoryVolume").getStringArrayValue()[i]); + box17.setText(formAll.getTCProperty("jk8Valve").getStringArrayValue()[i]); + box18.setText(formAll.getTCProperty("jk8ForHK").getStringArrayValue()[i]); + box19.setText(formAll.getTCProperty("jk8PackageLogo").getStringArrayValue()[i]); + box20.setText(formAll.getTCProperty("jk8PerBoxUnits").getStringArrayValue()[i]); + box22.setText(formAll.getTCProperty("jk8ExAlarm").getStringArrayValue()[i]); + box23.setText(formAll.getTCProperty("jk8FaceAntiRemove").getStringArrayValue()[i]); + box24.setText(formAll.getTCProperty("jk8PipeAntiRemove").getStringArrayValue()[i]); + box25.setText(formAll.getTCProperty("jk8ClockLiBattey").getStringArrayValue()[i]); + box26.setText(formAll.getTCProperty("jk8UploadPowerFail").getStringArrayValue()[i]); + box27.setText(formAll.getTCProperty("jk8SupplyMode").getStringArrayValue()[i]); + box28.setText(formAll.getTCProperty("jk8UserPayMethod").getStringArrayValue()[i]); + box29.setText(formAll.getTCProperty("jk8ICCardType").getStringArrayValue()[i]); + box30.setText(formAll.getTCProperty("jk8EncryptType").getStringArrayValue()[i]); + jt06.setText(formAll.getTCProperty("jk8Remarks").getStringArrayValue()[i]); + + jt08.setText(formAll.getTCProperty("jk8Customer").getStringArrayValue()[i]); + box3.setText(formAll.getTCProperty("jk8Customized").getStringArrayValue()[i]); + } + } + + System.out.println("Ʒ:" + lx); + if (bo) { + if (cpxh != null) { + jt10.setText(cpxh); + } else { + jt10.setText(""); + } + } + +// form.getTCProperty("jk8BMManufactor").setStringValue(jbcj);// / +// form.getTCProperty("jk8ProductType").setStringValue(lx);// Ʒ +// form.getTCProperty("jk8ProductName").setStringValue(name);// Ʒ + seten(bo); + } catch (Exception e) { + e.printStackTrace(); + } + return bo; + } + + private JLabel getjl() { + JLabel bt = new JLabel("*"); + bt.setForeground(Color.red); + return bt; + } + +} diff --git a/src/com/teamcenter/rac/form/JK8_YZCPXHSQB_Form.java b/src/com/teamcenter/rac/form/JK8_YZCPXHSQB_Form.java new file mode 100644 index 0000000..17b7af0 --- /dev/null +++ b/src/com/teamcenter/rac/form/JK8_YZCPXHSQB_Form.java @@ -0,0 +1,1277 @@ +package com.teamcenter.rac.form; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionListener; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import java.util.HashMap; +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextField; +import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCPreferenceService; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.stylesheet.AbstractRendering; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; + +//5Ҳͬ +public class JK8_YZCPXHSQB_Form extends AbstractRendering { + /** + * + */ + private static final long serialVersionUID = 1L; + private TCComponentForm form; + private TCSession session; + // private JButton tijiao; + private JButton yanzhen; + private JPanel mainPanel; + + private JPanel firstJPanel; + private JPanel firstJPanel_1; + private JPanel secondJPanel; + private JPanel secondJPanel_1; + private JPanel secondJPanel_2; + private JPanel secondJPanel_3; + private JPanel secondJPanel_4; + private JPanel secondJPanel_5; + private JPanel secondJPanel_6; +// private JPanel secondJPanel; +// private JPanel secondJPanel_1; +// private JPanel secondJPanel_2; + private JPanel thirdJPanel; + private JScrollPane jsp; + // private Registry registry = null; +// private ButtonGroup group; + private JPanel topJPanel; +// private JPanel charu1; +// private JPanel charu2; + + private JLabel jl1; + private JLabel jl2; + private JLabel jl3; + private JLabel jl4; + + private JTextField jt01;// Ŀ + private JTextField jt02;// Ŀ + private JTextField jt03;// ֤ + private JTextField jt04;// ֤ + private JTextField jt05;// ʼ + private JTextField jt06;// ע + private JTextField jt07;// Ʒͺ + private JTextField jt08;// ͻ + private JTextField jt1; +// private JTextArea jt2;// ܸ +// private JTextField jt3;// г +// private JTextField jt4;// ͺ +// private JTextField jt5;// ICͺ +// private JTextField jt6;// +// private JTextField jt7;// ICͺ +// private JTextField jt8;// ͻҪ + private JTextField jt9;// ʶ +// private JTextField jt10;// +// private JTextField jt11;// +// private JTextField jt12;// +// private JTextField jt13;// Ʒͺ + + private JAutoCompleteComboBox box1 = new JAutoCompleteComboBox();// + private JAutoCompleteComboBox box2 = new JAutoCompleteComboBox();// + private JAutoCompleteComboBox box3 = new JAutoCompleteComboBox();// ߻//TODO +// private JAutoCompleteComboBox box4 = new JAutoCompleteComboBox();// ˮ + private JAutoCompleteComboBox box5 = new JAutoCompleteComboBox();// Ʒ + private JAutoCompleteComboBox box6 = new JAutoCompleteComboBox();// ģ + private JAutoCompleteComboBox box7 = new JAutoCompleteComboBox();// оƬ + private JAutoCompleteComboBox box8 = new JAutoCompleteComboBox();// Э + private JAutoCompleteComboBox box9 = new JAutoCompleteComboBox();// ֹ淧 + private JAutoCompleteComboBox box10 = new JAutoCompleteComboBox();// ȡѹ + private JAutoCompleteComboBox box11 = new JAutoCompleteComboBox();// ƤĤ + private JAutoCompleteComboBox box12 = new JAutoCompleteComboBox();// е² + private JAutoCompleteComboBox box13 = new JAutoCompleteComboBox();// + private JAutoCompleteComboBox box14 = new JAutoCompleteComboBox();// ɹʽ + private JAutoCompleteComboBox box15 = new JAutoCompleteComboBox();// ɫ + private JAutoCompleteComboBox box16 = new JAutoCompleteComboBox();// ת + private JAutoCompleteComboBox box17 = new JAutoCompleteComboBox();// + private JAutoCompleteComboBox box18 = new JAutoCompleteComboBox();// ۻר + private JAutoCompleteComboBox box19 = new JAutoCompleteComboBox();// װlogo + private JAutoCompleteComboBox box20 = new JAutoCompleteComboBox();// ÿ̨ +// private JAutoCompleteComboBox box21 = new JAutoCompleteComboBox();// Ʒlogo + private JAutoCompleteComboBox box22 = new JAutoCompleteComboBox();// ⲿ + private JAutoCompleteComboBox box23 = new JAutoCompleteComboBox();// ַ + private JAutoCompleteComboBox box24 = new JAutoCompleteComboBox();// ܵ + private JAutoCompleteComboBox box25 = new JAutoCompleteComboBox();// ʱ﮵ + private JAutoCompleteComboBox box26 = new JAutoCompleteComboBox();// ϴ + private JAutoCompleteComboBox box27 = new JAutoCompleteComboBox();// Ʒʽ + private JAutoCompleteComboBox box28 = new JAutoCompleteComboBox();// ûѷʽ + private JAutoCompleteComboBox box29 = new JAutoCompleteComboBox();// ICͺ + private JAutoCompleteComboBox box30 = new JAutoCompleteComboBox();// +// private iComboBox box1 = new iComboBox();// / +// private iComboBox box2 = new iComboBox();// Ʒ +// private iComboBox box3 = new iComboBox();// +// private iComboBox box4 = new iComboBox();// Ʒѷʽ + +// private JRadioButton radioButton1; +// private JRadioButton radioButton2; +// private String sysc = "";// г + private HashMap realNameMap;// lovѡֵ + private HashMap realNameMap_gz;// lovѡֵ + private String jt;// Ʒͺ + + private String isCheck; + private boolean is = false; + + private String xmmc = "";// Ŀ + private String xmbh = "";// Ŀ + private String cpxh = "";// Ʒͺ + private String sbh = "";// ʶ +// private String cpmc = "";// Ʒ + private String jbcj = "";// +// private String ickxh = "";// ICͺ +// private String xlbxh = "";// ·ͺ +// private String cxtz = "";// +// private String tdxh = "";// ͺ +// private String gngs = "";// ܸ +// private String khtsyq = "";// ͻҪ +// // private String[] u8mmh;// U8 +// private String fm = "";// +// private String jmlx = "";// +// private String sqr = "";// +// private String djrq = "";// Ǽ +// private String sysc1 = "";// г +// private String ptjbcj = "";// ׻ +// //2022/11/17 +// private String cplx = "";// Ʒʾֵ +// private String cplxgz = "";// Ʒʵֵ + + public JK8_YZCPXHSQB_Form(TCComponentForm arg0) throws Exception { + super(arg0); + // Auto-generated constructor stub + try { + form = arg0; + session = arg0.getSession(); + // registry = Registry.getRegistry(this); + String[] names = session.getPreferenceService().getStringValues("JK_CPXH_FORM"); + if (names != null) { + + realNameMap = new HashMap<>(); + for (int i = 0; i < names.length; i++) { + String[] s = names[i].split("="); + if (s != null && s.length == 2) { + String key = s[0]; + String value = s[1]; + realNameMap.put(key, value); + } + + } + + } else { + MessageBox.post("ѡ JK_CPXH_FORM ڣϵԱ", "", MessageBox.ERROR); + } + + String[] names1 = session.getPreferenceService().getStringValues("JK_SQB_GZ"); + if (names1 != null) { + realNameMap_gz = new HashMap<>(); + for (int i = 0; i < names1.length; i++) { + String[] s = names1[i].split(":"); + if (s != null && s.length == 2) { + String key = s[0]; + String value = s[1]; + realNameMap_gz.put(key, value); + } else { + MessageBox.post("ѡ JK_SQB_GZ ôϵԱ", "", MessageBox.ERROR); + return; + } + } + } else { + MessageBox.post("ѡ JK_SQB_GZ ڣϵԱ", "", MessageBox.ERROR); + } + initializeUI(); + loadRendering(); + + mainPanel.addMouseMotionListener(new MouseMotionListener() { + @Override + public void mouseMoved(MouseEvent e) { + // Auto-generated method stub + try { + isCheck = form.getTCProperty("fnd0IsCheckoutable").getDisplayableValue(); + } catch (Exception e1) { + // Auto-generated catch block + e1.printStackTrace(); + } + if ("".equals(isCheck)) { + seten(is); + setOwnerHave(); + } + } + + @Override + public void mouseDragged(MouseEvent e) { + // Auto-generated method stub + + } + }); + + // if (!radioButton2.isSelected()) { + // jt3.setEnabled(false); + // } + jt9.setEnabled(false); + // jt13.setEnabled(false); + + }catch (Exception e) { + e.printStackTrace(); + //ӡ쳣 + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + e.printStackTrace(new PrintStream(baos)); + String exception = baos.toString(); + MessageBox.post(exception,"쳣",MessageBox.INFORMATION); + } + + } + + @SuppressWarnings("unchecked") + private void setLOV(JAutoCompleteComboBox box, String st, int length) { + // Auto-generated method stub +// box.setAutoCompleteSuggestive(false); +// box.addItems(realNameMap.get(st).split(",")); + String[] temparr = realNameMap.get(st).split(","); + box.addItem(""); + for(String s: temparr) { + box.addItem(s); + } + box.setTextLength(length); + } + + public void initializeUI() { + System.out.println("UI-----Start"); + setLayout(new BorderLayout()); +// initPanel(); + + jsp = new JScrollPane(initPanel()); + jsp.setPreferredSize(new Dimension(450, 490)); + jsp.getVerticalScrollBar().setUnitIncrement(20); + + add(jsp, "Center"); + this.setVisible(true); + this.setBackground(Color.lightGray); + } + + public JPanel initPanel() { + System.out.println("--------------------------"); + mainPanel = new JPanel(new PropertyLayout()); + this.setSize(new Dimension(650, 260)); + jt01 = new JTextField(20); + jt02 = new JTextField(20); + jt03 = new JTextField(10); + jt04 = new JTextField(10); + jt05 = new JTextField(30); + jt06 = new JTextField(30); + jt07 = new JTextField(20); + jt08 = new JTextField(10); + jt1 = new JTextField(20); +// jt2 = new JTextArea(3,20); +// jt3 = new JTextField(20); +// jt4 = new JTextField(20); +// jt5 = new JTextField(20); +// jt6 = new JTextField(20); +// jt7 = new JTextField(20); +// jt8 = new JTextField(20); + jt9 = new JTextField(30); +// jt10 = new JTextField(20); +// jt11 = new JTextField(20); +// jt12 = new JTextField(20); +// jt13 = new JTextField(20); + + jl1 = new JLabel(" չƷʶ"); + jl1.setFont(new Font("", 1, 24)); + jl2 = new JLabel(" Ʒ"); + jl2.setFont(new Font("", 1, 18)); + jl3 = new JLabel(" &ֵ"); + jl3.setFont(new Font("", 1, 18)); + jl4 = new JLabel(" Ӳѡ"); + jl4.setFont(new Font("", 1, 18)); + + topJPanel = new JPanel(new PropertyLayout()); + topJPanel.add("1.1.left.top.preferred.preferred", jl1); + topJPanel.add("1.2.left.top.preferred.preferred", new JLabel( + " ")); + // tijiao = new JButton("ύ"); + // tijiao.setPreferredSize(new Dimension(70, 30)); + // topJPanel.add("1.3.left.top.preferred.preferred", tijiao); + + firstJPanel = new JPanel(new PropertyLayout()); + firstJPanel.add("1.1.left.top.preferred.preferred", new JLabel("׼ʶţ")); + firstJPanel.add("1.2.right.top.preferred.preferred", getjl()); + firstJPanel.add("1.3.left.top.preferred.preferred", jt1); + firstJPanel.add("1.4.left.top.preferred.preferred", new JLabel(" ")); + yanzhen = new JButton("֤ʶ"); + firstJPanel.add("1.5.left.top.preferred.preferred", yanzhen); + firstJPanel.add("2.1.left.top.preferred.preferred", new JLabel("Ʒͺţ")); + firstJPanel.add("2.2.right.top.preferred.preferred", getjl()); + firstJPanel.add("2.3.left.top.preferred.preferred", jt07); + firstJPanel.add("3.1.left.top.preferred.preferred", new JLabel("Ŀƣ")); + firstJPanel.add("3.2.right.top.preferred.preferred", getjl()); + firstJPanel.add("3.3.left.top.preferred.preferred", jt01); + firstJPanel.add("4.1.left.top.preferred.preferred", new JLabel("Ŀţ")); + firstJPanel.add("4.2.right.top.preferred.preferred", getjl()); + firstJPanel.add("4.3.left.top.preferred.preferred", jt02); + yanzhen.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + // Auto-generated method stub + System.out.println("֤"); + yzbut(); + } + }); + + firstJPanel_1 = new JPanel(new PropertyLayout()); + firstJPanel_1.add("1.1.left.top.preferred.preferred", new JLabel(":")); + firstJPanel_1.add("1.2.right.top.preferred.preferred", getjl()); + firstJPanel_1.add("1.3.left.top.preferred.preferred", box1); + setLOV(box1,"",15); + + firstJPanel_1.add("1.4.left.top.preferred.preferred",new JLabel(" ")); + firstJPanel_1.add("1.5.left.top.preferred.preferred", new JLabel(":")); + firstJPanel_1.add("1.6.right.top.preferred.preferred", getjl()); + firstJPanel_1.add("1.7.left.top.preferred.preferred", box2); + setLOV(box2,"",15); + + firstJPanel_1.add("2.1.left.top.preferred.preferred", new JLabel("߻:")); + firstJPanel_1.add("2.2.right.top.preferred.preferred", getjl()); + firstJPanel_1.add("2.3.left.top.preferred.preferred", box3); + setLOV(box3,"߻",15); + + firstJPanel_1.add("2.4.left.top.preferred.preferred",new JLabel(" ")); + firstJPanel_1.add("2.5.left.top.preferred.preferred", new JLabel(" ͻ:")); + firstJPanel_1.add("2.6.right.top.preferred.preferred", getjl()); + firstJPanel_1.add("2.7.left.top.preferred.preferred", jt08); + + secondJPanel = new JPanel(new PropertyLayout()); + secondJPanel.add("1.1.left.top.preferred.prefereed",jl2); + + secondJPanel_1 = new JPanel(new PropertyLayout()); + secondJPanel_1.add("1.1.left.top.preferred.preferred",new JLabel("Ʒ:")); + secondJPanel_1.add("1.2.left.top.preferred.preferred",box5); + setLOV(box5,"Ʒ",10); + secondJPanel_1.add("1.3.left.top.preferred.preferred",new JLabel(" ֤:")); + secondJPanel_1.add("1.4.left.top.preferred.preferred",jt03); + secondJPanel_1.add("1.5.left.top.preferred.preferred",new JLabel(" ֤:")); + secondJPanel_1.add("1.6.left.top.preferred.preferred",jt04); + secondJPanel_1.add("2.1.left.top.preferred.preferred",new JLabel(" ģ:")); + secondJPanel_1.add("2.2.left.top.preferred.preferred",box6); + setLOV(box6,"ģ",10); + secondJPanel_1.add("2.3.left.top.preferred.preferred",new JLabel(" оƬ:")); + secondJPanel_1.add("2.4.left.top.preferred.preferred",box7); + setLOV(box7,"оƬ",10); + secondJPanel_1.add("2.5.left.top.preferred.preferred",new JLabel(" Э:")); + secondJPanel_1.add("2.6.left.top.preferred.preferred",box8); + setLOV(box8,"Э",10); + + secondJPanel_2 = new JPanel(new PropertyLayout()); + secondJPanel_2.add("1.1.left.top.preferred.prefereed",jl3); + + secondJPanel_3 = new JPanel(new PropertyLayout()); + secondJPanel_3.add("1.1.left.top.preferred.preferred",new JLabel(" ֹ淧:")); + secondJPanel_3.add("1.2.left.top.preferred.preferred",box9); + setLOV(box9,"ֹ淧",10); + + secondJPanel_3.add("1.3.left.top.preferred.preferred",new JLabel(" ")); + secondJPanel_3.add("1.4.left.top.preferred.preferred",new JLabel(" ȡѹ:")); + secondJPanel_3.add("1.5.left.top.preferred.preferred",box10); + setLOV(box10, "ȡѹ", 10); + + secondJPanel_3.add("1.6.left.top.preferred.preferred",new JLabel(" ")); + secondJPanel_3.add("1.7.left.top.preferred.preferred",new JLabel("ƤĤ:")); + secondJPanel_3.add("1.8.left.top.preferred.preferred",box11); + setLOV(box11, "ƤĤ", 10); + + secondJPanel_3.add("2.1.left.top.preferred.preferred",new JLabel("е²:")); + secondJPanel_3.add("2.2.left.top.preferred.preferred",box12); + setLOV(box12,"е²",10); + + secondJPanel_3.add("2.3.left.top.preferred.preferred",new JLabel(" ")); + secondJPanel_3.add("2.4.left.top.preferred.preferred",new JLabel(" :")); + secondJPanel_3.add("2.5.left.top.preferred.preferred",box13); + setLOV(box13, "", 10); + + secondJPanel_3.add("2.6.left.top.preferred.preferred",new JLabel(" ")); + secondJPanel_3.add("2.7.left.top.preferred.preferred",new JLabel("ɹʽ:")); + secondJPanel_3.add("2.8.left.top.preferred.preferred",box14); + setLOV(box14, "ɹʽ", 10); + + secondJPanel_3.add("3.1.left.top.preferred.preferred",new JLabel("ɫ:")); + secondJPanel_3.add("3.2.left.top.preferred.preferred",box15); + setLOV(box15,"ɫ",10); + + secondJPanel_3.add("3.3.left.top.preferred.preferred",new JLabel(" ")); + secondJPanel_3.add("3.4.left.top.preferred.preferred",new JLabel("ת:")); + secondJPanel_3.add("3.5.left.top.preferred.preferred",box16); + setLOV(box16, "ת", 10); + + secondJPanel_3.add("3.6.left.top.preferred.preferred",new JLabel(" ")); + secondJPanel_3.add("3.7.left.top.preferred.preferred",new JLabel(" :")); + secondJPanel_3.add("3.8.left.top.preferred.preferred",box17); + setLOV(box17, "", 10); + + secondJPanel_3.add("4.1.left.top.preferred.preferred",new JLabel("ۻר:")); + secondJPanel_3.add("4.2.left.top.preferred.preferred",box18); + setLOV(box18,"ۻר",10); + + secondJPanel_3.add("4.3.left.top.preferred.preferred",new JLabel(" ")); + secondJPanel_3.add("4.4.left.top.preferred.preferred",new JLabel("װlogo:")); + secondJPanel_3.add("4.5.left.top.preferred.preferred",box19); + setLOV(box19, "װlogo", 10); + + secondJPanel_3.add("4.6.left.top.preferred.preferred",new JLabel(" ")); + secondJPanel_3.add("4.7.left.top.preferred.preferred",new JLabel("ÿ̨:")); + secondJPanel_3.add("4.8.left.top.preferred.preferred",box20); + setLOV(box20, "ÿ̨", 10); + +// secondJPanel_3.add("4.1.left.top.preferred.preferred",new JLabel("Ʒlogo:")); +// secondJPanel_3.add("4.2.left.top.preferred.preferred",box18); +// setLOV(box21,"Ʒlogo",10); + + secondJPanel_4 = new JPanel(new PropertyLayout()); + secondJPanel_4.add("1.1.left.top.preferred.prefereed",jl4); + + secondJPanel_5 = new JPanel(new PropertyLayout()); + secondJPanel_5.add("1.1.left.top.preferred.preferred",new JLabel("ⲿ:")); + secondJPanel_5.add("1.2.left.top.preferred.preferred",box22); + setLOV(box22,"ⲿ",10); + + secondJPanel_5.add("1.3.left.top.preferred.preferred",new JLabel(" ")); + secondJPanel_5.add("1.4.left.top.preferred.preferred",new JLabel("ַ:")); + secondJPanel_5.add("1.5.left.top.preferred.preferred",box23); + setLOV(box23, "ַ", 10); + + secondJPanel_5.add("1.6.left.top.preferred.preferred",new JLabel(" ")); + secondJPanel_5.add("1.7.left.top.preferred.preferred",new JLabel("ܵ:")); + secondJPanel_5.add("1.8.left.top.preferred.preferred",box24); + setLOV(box24, "ܵ", 10); + + secondJPanel_5.add("2.1.left.top.preferred.preferred",new JLabel("ʱ﮵:")); + secondJPanel_5.add("2.2.left.top.preferred.preferred",box25); + setLOV(box25,"ʱ﮵",10); + + secondJPanel_5.add("2.3.left.top.preferred.preferred",new JLabel(" ")); + secondJPanel_5.add("2.4.left.top.preferred.preferred",new JLabel("ϴ:")); + secondJPanel_5.add("2.5.left.top.preferred.preferred",box26); + setLOV(box26, "ϴ", 10); + + secondJPanel_5.add("3.1.left.top.preferred.preferred",new JLabel("Ʒʽ:")); + secondJPanel_5.add("3.2.left.top.preferred.preferred",box27); + setLOV(box27,"Ʒʽ",10); + + secondJPanel_5.add("3.3.left.top.preferred.preferred",new JLabel(" ")); + secondJPanel_5.add("3.4.left.top.preferred.preferred",new JLabel("ûѷʽ:")); + secondJPanel_5.add("3.5.left.top.preferred.preferred",box28); + setLOV(box28, "ûѷʽ", 10); + + secondJPanel_5.add("4.1.left.top.preferred.preferred",new JLabel("ICͺ:")); + secondJPanel_5.add("4.2.left.top.preferred.preferred",box29); + setLOV(box29,"ICͺ",10); + + secondJPanel_5.add("4.3.left.top.preferred.preferred",new JLabel(" ")); + secondJPanel_5.add("4.4.left.top.preferred.preferred",new JLabel(":")); + secondJPanel_5.add("4.5.left.top.preferred.preferred",box30); + setLOV(box30, "", 10); + + secondJPanel_6 = new JPanel(new PropertyLayout()); + secondJPanel_6.add("1.1.left.top.preferred.preferred",new JLabel("ʼ:")); + secondJPanel_6.add("1.2.left.top.preferred.preferred",jt05); + secondJPanel_6.add("2.1.left.top.preferred.preferred",new JLabel(" ע:")); + secondJPanel_6.add("2.2.left.top.preferred.preferred",jt06); +// charu1 = new JPanel(new PropertyLayout()); +// charu1.add("1.1.left.top.preferred.preferred", jl2); +// +// charu2 = new JPanel(new PropertyLayout()); +// charu2.add("1.1.left.top.preferred.preferred", new JLabel(" /̣")); +// +// setLov(box1, "/"); +// charu2.add("1.2.right.top.preferred.preferred", getjl()); +// charu2.add("1.3.left.top.preferred.preferred", box1); +// charu2.add("2.1.left.top.preferred.preferred", new JLabel(" Ʒͣ")); +// +// // Ʒ +// setLov(box2, "Ʒ"); +// charu2.add("2.2.left.top.preferred.preferred", box2); +// charu2.add("3.1.left.top.preferred.preferred", new JLabel(" ͣ")); +// // +// setLov(box3, ""); +// charu2.add("3.2.left.top.preferred.preferred", box3); +// +// secondJPanel = new JPanel(new PropertyLayout()); +// secondJPanel_1 = new JPanel(new PropertyLayout()); +// secondJPanel_1.add("1.1.left.top.preferred.preferred", new JLabel(" Ʒѷʽ ")); +// setLov(box4, "Ʒѷʽ"); +// secondJPanel_1.add("1.2.left.top.preferred.preferred", box4); +// secondJPanel_1.add("2.1.left.top.preferred.preferred", new JLabel(" г")); +// radioButton1 = new JRadioButton("ͨ");// ѡť +// radioButton2 = new JRadioButton("ר");// ѡť +// radioButton1.addActionListener(new ActionListener() { +// @Override +// public void actionPerformed(ActionEvent e) { +// // Auto-generated method stub +// if (radioButton1.isSelected()) { +// jt3.setText(""); +// jt3.setEnabled(false); +// } +// } +// }); +// radioButton2 = new JRadioButton("ר");// ѡť +// radioButton2.addActionListener(new ActionListener() { +// +// @Override +// public void actionPerformed(ActionEvent e) { +// // Auto-generated method stub +// if (radioButton2.isSelected()) { +// jt3.setEnabled(true); +// } +// } +// }); +// group = new ButtonGroup(); +// group.add(radioButton1); +// group.add(radioButton2); +// secondJPanel_1.add("2.2.left.top.preferred.preferred", radioButton1); +// secondJPanel_1.add("2.3.left.top.preferred.preferred", radioButton2); +// secondJPanel_1.add("2.4.left.top.preferred.preferred", jt3); +// secondJPanel_1.add("3.1.left.top.preferred.preferred", new JLabel(" ·ͺţ")); +// secondJPanel_1.add("3.2.left.top.preferred.preferred", jt5); +// secondJPanel_1.add("4.1.left.top.preferred.preferred", new JLabel(" ICͺţ")); +// secondJPanel_1.add("4.2.left.top.preferred.preferred", jt7); +// +// secondJPanel_1.add("5.1.left.top.preferred.preferred", new JLabel(" ţ")); +// secondJPanel_1.add("5.2.left.top.preferred.preferred", jt10); +// +// secondJPanel_1.add("6.1.left.top.preferred.preferred", new JLabel(" ")); +// secondJPanel_1.add("7.1.left.top.preferred.preferred", new JLabel(" ׳ң")); +// secondJPanel_1.add("7.2.left.top.preferred.preferred", jt12); +// +// +// JScrollPane jspane1=new JScrollPane(jt2); +// jt2.setLineWrap(true); +// secondJPanel_2 = new JPanel(new PropertyLayout()); +// secondJPanel_2.add("1.1.left.top.preferred.preferred", new JLabel(" ܸ ")); +// secondJPanel_2.add("1.2.left.top.preferred.preferred", jspane1);//2019.6.24 Ĺܸ Ҫ +// secondJPanel_2.add("2.1.left.top.preferred.preferred", new JLabel(" ͺţ ")); +// secondJPanel_2.add("2.2.left.top.preferred.preferred", jt4); +// +// secondJPanel_2.add("3.1.left.top.preferred.preferred", new JLabel(" ")); +// secondJPanel_2.add("3.2.left.top.preferred.preferred", jt6); +// +// secondJPanel_2.add("4.1.left.top.preferred.preferred", new JLabel(" ͻҪ")); +// secondJPanel_2.add("4.2.left.top.preferred.preferred", jt8); +// secondJPanel_2.add("5.1.left.top.preferred.preferred", new JLabel(" ͣ")); +// secondJPanel_2.add("5.2.left.top.preferred.preferred", jt11); +// secondJPanel.add("1.1.left.top.preferred.preferred", secondJPanel_1); +// secondJPanel.add("1.2.left.top.preferred.preferred", secondJPanel_2); +// + thirdJPanel = new JPanel(new PropertyLayout()); +// thirdJPanel.add("1.1.left.top.preferred.preferred", new JLabel(" Ʒͺţ ")); +// thirdJPanel.add("1.2.left.top.preferred.preferred", jt13); + thirdJPanel.add("1.1.left.top.preferred.preferred", new JLabel("ʶţ ")); + thirdJPanel.add("1.2.left.top.preferred.preferred", jt9); + + mainPanel.add("1.1.left.top.preferred.preferred", topJPanel); + mainPanel.add("2.1.left.top.preferred.preferred", firstJPanel); + mainPanel.add("3.1.left.top.preferred.preferred", firstJPanel_1); + mainPanel.add("4.1.left.top.preferred.preferred", secondJPanel); + mainPanel.add("5.1.left.top.preferred.preferred", secondJPanel_1); + mainPanel.add("6.1.left.top.preferred.preferred", secondJPanel_2); + mainPanel.add("7.1.left.top.preferred.preferred", secondJPanel_3); + mainPanel.add("8.1.left.top.preferred.preferred", secondJPanel_4); + mainPanel.add("9.1.left.top.preferred.preferred", secondJPanel_5); + mainPanel.add("10.1.left.top.preferred.preferred", secondJPanel_6); + mainPanel.add("11.1.left.top.preferred.preferred", thirdJPanel); + return mainPanel; + + } + + @Override + public void loadRendering() throws TCException { + // Auto-generated method stub + jt1.setText(form.getTCProperty("jk8BaseIdentifyNO").getStringValue());// ׼ʶ + jt07.setText(form.getTCProperty("jk8ProductModNO").getStringValue());// Ʒͺ + jt01.setText(form.getTCProperty("jk8ProjectName").getStringValue());// Ŀ + jt02.setText(form.getTCProperty("jk8ProjectNO").getStringValue());// Ŀ + + box1.setText(form.getTCProperty("jk8BMManufactor").getStringValue());// / + box2.setText(form.getTCProperty("jk8ContrlCompType").getStringValue());// + box3.setText(form.getTCProperty("jk8Customized").getStringValue());// Ƿ + + box5.setText(form.getTCProperty("jk8ProductName").getStringValue()); + box6.setText(form.getTCProperty("jk8Module").getStringValue()); + box7.setText(form.getTCProperty("jk8Chip").getStringValue()); + box8.setText(form.getTCProperty("jk8Agreement").getStringValue()); + box9.setText(form.getTCProperty("jk8BackstopValve").getStringValue()); + box10.setText(form.getTCProperty("jk8PressureTap").getStringValue()); + box11.setText(form.getTCProperty("jk8ImpSkin").getStringValue()); + box12.setText(form.getTCProperty("jk8MechTempC").getStringValue()); + box13.setText(form.getTCProperty("jk8WideRange").getStringValue()); + box14.setText(form.getTCProperty("jk8BMBuy").getStringValue()); + box15.setText(form.getTCProperty("jk8BMColor").getStringValue()); + box16.setText(form.getTCProperty("jk8GyratoryVolume").getStringValue()); + box17.setText(form.getTCProperty("jk8Valve").getStringValue()); + box18.setText(form.getTCProperty("jk8ForHK").getStringValue()); + box19.setText(form.getTCProperty("jk8PackageLogo").getStringValue()); + box20.setText(form.getTCProperty("jk8PerBoxUnits").getStringValue()); +// box21.setText(form.getTCProperty("jk8ProductLogo").getStringValue()); + box22.setText(form.getTCProperty("jk8ExAlarm").getStringValue()); + box23.setText(form.getTCProperty("jk8FaceAntiRemove").getStringValue()); + box24.setText(form.getTCProperty("jk8PipeAntiRemove").getStringValue()); + box25.setText(form.getTCProperty("jk8ClockLiBattey").getStringValue()); + box26.setText(form.getTCProperty("jk8UploadPowerFail").getStringValue()); + box27.setText(form.getTCProperty("jk8SupplyMode").getStringValue()); + box28.setText(form.getTCProperty("jk8UserPayMethod").getStringValue()); + box29.setText(form.getTCProperty("jk8ICCardType").getStringValue()); + box30.setText(form.getTCProperty("jk8EncryptType").getStringValue()); + + jt03.setText(form.getTCProperty("jk8FlameproofType").getStringValue()); + jt04.setText(form.getTCProperty("jk8TypeCerNo").getStringValue()); + jt05.setText(form.getTCProperty("jk8InitConfig").getStringValue()); + jt06.setText(form.getTCProperty("jk8Remarks").getStringValue()); + jt08.setText(form.getTCProperty("jk8Customer").getStringValue()); +// +// box4.setText(form.getTCProperty("jk8BillingMode").getStringValue());// Ʒѷʽ +// jt5.setText(form.getTCProperty("jk8CircBoardModNO").getStringValue());// ·ͺ +// jt2.setText(form.getTCProperty("jk8FunctionOverview").getStringValue());// ܸ +// jt4.setText(form.getTCProperty("jk8InsteadType").getStringValue());// ͺ +// jt6.setText(form.getTCProperty("jk8ProgramFeatures").getStringValue());// +// jt8.setText(form.getTCProperty("jk8CustSpecRequirements").getStringValue());// ͻҪ +// jt7.setText(form.getTCProperty("jk8ICCardType").getStringValue());// ICͺ +// jt10.setText(form.getTCProperty("jk8Valve").getStringValue());// +// jt11.setText(form.getTCProperty("jk8EncryptType").getStringValue());// +// jt12.setText(form.getTCProperty("jk8BMManfMatched").getStringValue());// + + jt9.setText(form.getTCProperty("jk8ProductIdentifyNO").getStringValue());// ʶ + +// sysc = form.getTCProperty("jk8ApplyMarket").getStringValue();// гѡֵ +// if (sysc.equals("ͨ")) { +// radioButton1.setSelected(true); +// } else if (sysc.contains("ר")) { +// radioButton2.setSelected(true); +// String[] strs=form.getTCProperty("jk8ApplyMarket").getStringValue().split(";"); +// if(strs!=null&&strs.length>1){ +// jt3.setText(strs[1]);// ר +// } +// +// } + + } + +/* @Override + public Map getRenderingModified() { + Map modifiedRendering = new HashMap (); + try { + System.out.println("getRenderingModifiedʼ"); + saveRendering(); + }catch(Exception ex){ + ex.toString(); + System.out.println(ex.toString()); + } + + + return modifiedRendering; + }*/ + + public boolean isRenderingModified() { + System.out.println("isRenderingModified"); + + try { + if(isrend(form.getTCProperty("jk8BaseIdentifyNO"),jt1.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ProjectName"),jt01.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ProjectNO"),jt02.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8BMManufactor"),box1.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ContrlCompType"),box2.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8Customized"),box3.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ProductName"),box5.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8Module"),box6.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8Chip"),box7.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8Agreement"),box8.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8BackstopValve"),box9.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8PressureTap"),box10.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ImpSkin"),box11.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8MechTempC"),box12.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8WideRange"),box13.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8BMBuy"),box14.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8BMColor"),box15.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8GyratoryVolume"),box16.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8Valve"),box17.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ForHK"),box18.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8PackageLogo"),box19.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8PerBoxUnits"),box20.getText())){ + return true; + } + // if(isrend(form.getTCProperty("jk8ProductLogo"),box21.getText())){ + // return true; + // } + if(isrend(form.getTCProperty("jk8ExAlarm"),box22.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8FaceAntiRemove"),box23.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8PipeAntiRemove"),box24.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ClockLiBattey"),box25.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8UploadPowerFail"),box26.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8SupplyMode"),box27.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8UserPayMethod"),box28.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8ICCardType"),box29.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8EncryptType"),box30.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8FlameproofType"),jt03.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8TypeCerNo"),jt04.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8InitConfig"),jt05.getText())){ + return true; + } + if(isrend(form.getTCProperty("jk8Remarks"),jt06.getText())){ + return true; + } + String jt = jt07.getText(); + if(!jt.isEmpty() && isrend(form.getTCProperty("jk8ProductModNO"), jt)){ + return true; + } + // if(isrend(form.getTCProperty("jk8ProductModNO"),jt13.getText())){ + // return true; + // } + // if(isrend(form.getTCProperty("jk8BMManufactor"),box1.getTextField().getText())){ + // return true; + // } + // if(isrend(form.getTCProperty("jk8ProductType_select"),box2.getTextField().getText())){ + // return true; + // } + // if(isrend(form.getTCProperty("jk8ContrlCompType"),box3.getTextField().getText())){ + // return true; + // } + // if(isrend(form.getTCProperty("jk8BillingMode"),box4.getTextField().getText())){ + // return true; + // } + // if(isrend(form.getTCProperty("jk8CircBoardModNO"),jt5.getText())){ + // return true; + // } + // if(isrend(form.getTCProperty("jk8FunctionOverview"),jt2.getText())){ + // return true; + // } + // if(isrend(form.getTCProperty("jk8InsteadType"),jt4.getText())){ + // return true; + // } + // if(isrend(form.getTCProperty("jk8ProgramFeatures"),jt6.getText())){ + // return true; + // } + // if(isrend(form.getTCProperty("jk8CustSpecRequirements"),jt8.getText())){ + // return true; + // } + // if(isrend(form.getTCProperty("jk8ICCardType"),jt7.getText())){ + // return true; + // } + jt = jt9.getText(); + if(!jt.isEmpty() && isrend(form.getTCProperty("jk8ProductIdentifyNO"),jt)){ + return true; + } + // if(isrend(form.getTCProperty("jk8Valve"),jt10.getText())){ + // return true; + // } + // if(isrend(form.getTCProperty("jk8EncryptType"),jt11.getText())){ + // return true; + // } + // if(isrend(form.getTCProperty("jk8BMManfMatched"),jt12.getText())){ + // return true; + // } + // if (radioButton1.isSelected()) { + // if(isrend(form.getTCProperty("jk8ApplyMarket"),radioButton1.getText())){ + // return true; + // } + // } + // if (radioButton2.isSelected()) { + // if(isrend(form.getTCProperty("jk8ApplyMarket"),radioButton2.getText() + ";" + jt3.getText())){ + // return true; + // } + // } + } catch (Exception e) { + // Auto-generated catch block + e.printStackTrace(); + }// гѡ + return false; + } + + + private boolean isrend(TCProperty tcProperty, String str) { + // Auto-generated method stub + if(tcProperty!=null&&str!=null&&(!str.equals(tcProperty.getStringValue()))){ + System.out.println(str); + return true; + } + return false; + } + + + @Override + public void saveRendering() { + // Auto-generated method stub + if ("".equals(jt01.getText()) + || "".equals(jt02.getText()) + || "".equals(jt07.getText()) + || "".equals(jt08.getText()) + || "".equals(jt1.getText()) + || "".equals(box1.getText()) + || "".equals(box2.getText()) + || "".equals(box3.getText()) + ) { + MessageBox.post("޷,ȷȫд!!", "", MessageBox.ERROR); + }else{ + if ("".equals(jt9.getText())) { + try { + form.getTCProperty("jk8BaseIdentifyNO").setStringValue(jt1.getText());// ׼ʶ + form.getTCProperty("jk8ProductModNO").setStringValue(jt07.getText());// Ʒͺ + form.getTCProperty("jk8ProjectName").setStringValue(jt01.getText());// Ŀ + form.getTCProperty("jk8ProjectNO").setStringValue(jt02.getText());// Ŀ + form.getTCProperty("jk8FlameproofType").setStringValue(jt03.getText()); + form.getTCProperty("jk8TypeCerNo").setStringValue(jt04.getText()); + form.getTCProperty("jk8InitConfig").setStringValue(jt05.getText()); + form.getTCProperty("jk8Remarks").setStringValue(jt06.getText()); + form.getTCProperty("jk8Customer").setStringValue(jt08.getText()); + form.getTCProperty("jk8BMManufactor").setStringValue(box1.getText());// / + form.getTCProperty("jk8ContrlCompType").setStringValue(box2.getText());// +// form.getTCProperty("jk8ProductType_select").setStringValue(box2.getText());// Ʒ + form.getTCProperty("jk8Customized").setStringValue(box3.getText());// Ƿ + form.getTCProperty("jk8ProductName").setStringValue(box5.getText()); + form.getTCProperty("jk8Module").setStringValue(box6.getText()); + form.getTCProperty("jk8Chip").setStringValue(box7.getText()); + form.getTCProperty("jk8Agreement").setStringValue(box8.getText()); + form.getTCProperty("jk8BackstopValve").setStringValue(box9.getText()); + form.getTCProperty("jk8PressureTap").setStringValue(box10.getText()); + form.getTCProperty("jk8ImpSkin").setStringValue(box11.getText()); + form.getTCProperty("jk8MechTempC").setStringValue(box12.getText()); + form.getTCProperty("jk8WideRange").setStringValue(box13.getText()); + form.getTCProperty("jk8BMBuy").setStringValue(box14.getText()); + form.getTCProperty("jk8BMColor").setStringValue(box15.getText()); + form.getTCProperty("jk8GyratoryVolume").setStringValue(box16.getText()); + form.getTCProperty("jk8Valve").setStringValue(box17.getText()); + form.getTCProperty("jk8ForHK").setStringValue(box18.getText()); + form.getTCProperty("jk8PackageLogo").setStringValue(box19.getText()); + form.getTCProperty("jk8PerBoxUnits").setStringValue(box20.getText()); +// form.getTCProperty("jk8ProductLogo").setStringValue(box21.getText()); + form.getTCProperty("jk8ExAlarm").setStringValue(box22.getText()); + form.getTCProperty("jk8FaceAntiRemove").setStringValue(box23.getText()); + form.getTCProperty("jk8PipeAntiRemove").setStringValue(box24.getText()); + form.getTCProperty("jk8ClockLiBattey").setStringValue(box25.getText()); + form.getTCProperty("jk8UploadPowerFail").setStringValue(box26.getText()); + form.getTCProperty("jk8SupplyMode").setStringValue(box27.getText()); + form.getTCProperty("jk8UserPayMethod").setStringValue(box28.getText()); + form.getTCProperty("jk8ICCardType").setStringValue(box29.getText()); + form.getTCProperty("jk8EncryptType").setStringValue(box30.getText()); + +// form.getTCProperty("jk8BillingMode").setStringValue(box4.getTextField().getText());// Ʒѷʽ +// form.getTCProperty("jk8CircBoardModNO").setStringValue(jt5.getText());// ·ͺ +// form.getTCProperty("jk8FunctionOverview").setStringValue(jt2.getText());// ܸ +// form.getTCProperty("jk8InsteadType").setStringValue(jt4.getText());// ͺ +// form.getTCProperty("jk8ProgramFeatures").setStringValue(jt6.getText());// +// form.getTCProperty("jk8CustSpecRequirements").setStringValue(jt8.getText());// ͻҪ +// form.getTCProperty("jk8ICCardType").setStringValue(jt7.getText());// ICͺ + form.getTCProperty("jk8ProductIdentifyNO").setStringValue(jt9.getText());// ʶ +// form.getTCProperty("jk8Valve").setStringValue(jt10.getText());// +// form.getTCProperty("jk8EncryptType").setStringValue(jt11.getText());// +// form.getTCProperty("jk8BMManfMatched").setStringValue(jt12.getText());// +// if (radioButton1.isSelected()) { +// form.getTCProperty("jk8ApplyMarket").setStringValue(radioButton1.getText());// г +// } +// if (radioButton2.isSelected()) { +// +// form.getTCProperty("jk8ApplyMarket").setStringValue(radioButton2.getText() + ";" + jt3.getText());// г +// } + + } catch (Exception e) { + // Auto-generated catch block + e.printStackTrace(); + } + } else { + MessageBox.post("ʶѴ,޷ٴα", "", MessageBox.ERROR); + } + } + } + + public void setOwnerHave() { + try { + + String user = session.getUserName(); + String owning_user = form.getProperty("owning_user"); + // System.out.println("owning_user.indexOf(user)="+owning_user.indexOf(user)); + if (owning_user.indexOf(user) < 0) { + jt1.setEnabled(false); + jt01.setEnabled(false); + jt02.setEnabled(false); + jt03.setEnabled(false); + jt04.setEnabled(false); + jt05.setEnabled(false); + jt06.setEnabled(false); + jt07.setEnabled(false); + jt08.setEnabled(false); + yanzhen.setEnabled(false); + box1.setEnabled(false); + box2.setEnabled(false); + box3.setEnabled(false); + box5.setEnabled(false); + box6.setEnabled(false); + box7.setEnabled(false); + box8.setEnabled(false); + box9.setEnabled(false); + box10.setEnabled(false); + box11.setEnabled(false); + box12.setEnabled(false); + box13.setEnabled(false); + box14.setEnabled(false); + box15.setEnabled(false); + box16.setEnabled(false); + box17.setEnabled(false); + box18.setEnabled(false); + box19.setEnabled(false); + box20.setEnabled(false); +// box21.setEnabled(false); + box22.setEnabled(false); + box23.setEnabled(false); + box24.setEnabled(false); + box25.setEnabled(false); + box26.setEnabled(false); + box27.setEnabled(false); + box28.setEnabled(false); + box29.setEnabled(false); + box30.setEnabled(false); +// box4.setEnabled(false); +// jt2.setEnabled(false); +// jt3.setEnabled(false); +// jt4.setEnabled(false); +// jt5.setEnabled(false); +// jt6.setEnabled(false); +// jt7.setEnabled(false); +// jt8.setEnabled(false); + jt9.setEnabled(false); +// jt10.setEnabled(false); +// jt11.setEnabled(false); +// jt12.setEnabled(false); +// jt13.setEnabled(false); +// radioButton1.setEnabled(false); +// radioButton2.setEnabled(false); + + } + } catch (TCException e) { + System.out.println("ӵǷʱļеòȷҲ"); + e.printStackTrace(); + } + } + + public void seten(boolean is) { + jt01.setEnabled(is); + jt02.setEnabled(is); + jt03.setEnabled(is); + jt04.setEnabled(is); + jt05.setEnabled(is); + jt06.setEnabled(is); + jt08.setEnabled(is); +// jt1.setEnabled(false); + jt07.setEnabled(false); + box1.setEnabled(is); + box2.setEnabled(is); + box3.setEnabled(is); + box5.setEnabled(is); + box6.setEnabled(is); + box7.setEnabled(is); + box8.setEnabled(is); + box9.setEnabled(is); + box10.setEnabled(is); + box11.setEnabled(is); + box12.setEnabled(is); + box13.setEnabled(is); + box14.setEnabled(is); + box15.setEnabled(is); + box16.setEnabled(is); + box17.setEnabled(is); + box18.setEnabled(is); + box19.setEnabled(is); + box20.setEnabled(is); +// box21.setEnabled(is); + box22.setEnabled(is); + box23.setEnabled(is); + box24.setEnabled(is); + box25.setEnabled(is); + box26.setEnabled(is); + box27.setEnabled(is); + box28.setEnabled(is); + box29.setEnabled(is); + box30.setEnabled(is); +// box4.setEnabled(is); +// jt2.setEnabled(is); +// // jt3.setEnabled(is); +// jt4.setEnabled(is); +// jt5.setEnabled(is); +// jt6.setEnabled(is); +// jt7.setEnabled(is); +// jt8.setEnabled(is); +// jt10.setEnabled(is); +// jt11.setEnabled(is); +// jt12.setEnabled(is); +// // jt13.setEnabled(is); +// radioButton1.setEnabled(is); +// radioButton2.setEnabled(is); + } + + private void yzbut() { + // Auto-generated method stub + + jt = jt1.getText(); + if (jt != null && !jt.equals("") && !jt.equals("")) { + if(jt.length()>6) { + MessageBox.post("дʶţʶΪ׼ţ", "", MessageBox.ERROR); + return; + } + TCPreferenceService pref = session.getPreferenceService(); + String puid = pref.getStringValue("JK_SQB_FORM_PUID");// ѡpuid + if (puid == null) { + MessageBox.post("ѡJK_SQB_FORM_PUIDδҵϵԱ", "", MessageBox.ERROR); + } + + TCComponentForm formAll; + try { + formAll = (TCComponentForm) session.stringToComponent(puid); + if (formAll == null) { + MessageBox.post("ܱδҵϵԱ", "", MessageBox.ERROR); + } + boolean ishave1 = ishave("jk8ProductIdentifyNO", formAll);// Դ + + if (ishave1) { + jt9.setText(""); + MessageBox.post("ҵʶţʶſ", "ɹ", MessageBox.INFORMATION); +// jt13.setEnabled(true);//2018.12.17ſ༭ + } else { + MessageBox.post("û׼ʶŲڣȷǷдȷ", "", MessageBox.ERROR); + } + } catch (Exception e) { + // Auto-generated catch block + e.printStackTrace(); + MessageBox.post(e.getMessage(), "", MessageBox.ERROR); + } + } else { + MessageBox.post("ƷͺŲΪգдٵť", "", MessageBox.ERROR); + } + + } + + private boolean ishave(String sbh_all, TCComponentForm formAll) {//TODO + // Auto-generated method stub + boolean bo = false; + try { + String[] sbhs = formAll.getTCProperty(sbh_all) + .getStringValueArray();// ʶ + String lx = ""; + String name = ""; + for (int i = 0; i < sbhs.length; i++) { + if (jt.equals(sbhs[i])) { + lx = formAll.getTCProperty("jk8ProductType").getStringValueArray()[i];// Ʒ + form.getTCProperty("jk8ProductType").setStringValue(lx);// Ʒ +// name = formAll.getTCProperty("jk8ProductName").getStringValueArray()[i];// Ʒ +// form.getTCProperty("jk8ProductName").setStringValue(name);// Ʒ + + xmbh = formAll.getTCProperty("jk8ProjectNO").getStringArrayValue()[i];// Ŀ + xmmc = formAll.getTCProperty("jk8ProjectName").getStringArrayValue()[i];// Ŀ + cpxh = formAll.getTCProperty("jk8ProductModNO").getStringArrayValue()[i];// Ʒͺ + sbh = formAll.getTCProperty("jk8ProductIdentifyNO").getStringArrayValue()[i];// ʶ + jbcj = formAll.getTCProperty("jk8BaseMeterManufactor").getStringArrayValue()[i];// +// ickxh = formAll.getTCProperty("jk8ICCardType").getStringArrayValue()[i];// ICͺ + + jt01.setText(xmmc);// Ŀ + jt02.setText(xmbh);// Ŀ + jt07.setText(cpxh);// Ʒͺ + jt9.setText(sbh); + box1.setText(jbcj); + box5.setText(formAll.getTCProperty("jk8ProductName").getStringArrayValue()[i]); + jt03.setText(formAll.getTCProperty("jk8FlameproofType").getStringArrayValue()[i]); + jt04.setText(formAll.getTCProperty("jk8TypeCerNo").getStringArrayValue()[i]); + box6.setText(formAll.getTCProperty("jk8Module").getStringArrayValue()[i]); + box7.setText(formAll.getTCProperty("jk8Chip").getStringArrayValue()[i]); + box8.setText(formAll.getTCProperty("jk8Agreement").getStringArrayValue()[i]); + box9.setText(formAll.getTCProperty("jk8BackstopValve").getStringArrayValue()[i]); + box10.setText(formAll.getTCProperty("jk8PressureTap").getStringArrayValue()[i]); + box11.setText(formAll.getTCProperty("jk8ImpSkin").getStringArrayValue()[i]); + box12.setText(formAll.getTCProperty("jk8MechTempC").getStringArrayValue()[i]); + box13.setText(formAll.getTCProperty("jk8WideRange").getStringArrayValue()[i]); + box14.setText(formAll.getTCProperty("jk8BMBuy").getStringArrayValue()[i]); + box15.setText(formAll.getTCProperty("jk8BMColor").getStringArrayValue()[i]); + box16.setText(formAll.getTCProperty("jk8GyratoryVolume").getStringArrayValue()[i]); + box17.setText(formAll.getTCProperty("jk8Valve").getStringArrayValue()[i]); + box18.setText(formAll.getTCProperty("jk8ForHK").getStringArrayValue()[i]); + box19.setText(formAll.getTCProperty("jk8PackageLogo").getStringArrayValue()[i]); + box20.setText(formAll.getTCProperty("jk8PerBoxUnits").getStringArrayValue()[i]); + box22.setText(formAll.getTCProperty("jk8ExAlarm").getStringArrayValue()[i]); + box23.setText(formAll.getTCProperty("jk8FaceAntiRemove").getStringArrayValue()[i]); + box24.setText(formAll.getTCProperty("jk8PipeAntiRemove").getStringArrayValue()[i]); + box25.setText(formAll.getTCProperty("jk8ClockLiBattey").getStringArrayValue()[i]); + box26.setText(formAll.getTCProperty("jk8UploadPowerFail").getStringArrayValue()[i]); + box27.setText(formAll.getTCProperty("jk8SupplyMode").getStringArrayValue()[i]); + box28.setText(formAll.getTCProperty("jk8UserPayMethod").getStringArrayValue()[i]); + box29.setText(formAll.getTCProperty("jk8ICCardType").getStringArrayValue()[i]); + box30.setText(formAll.getTCProperty("jk8EncryptType").getStringArrayValue()[i]); + jt06.setText(formAll.getTCProperty("jk8Remarks").getStringArrayValue()[i]); +// xlbxh = formAll.getTCProperty("jk8CircBoardModNO").getStringArrayValue()[i];// ·ͺ +// cxtz = formAll.getTCProperty("jk8ProgramFeatures").getStringArrayValue()[i];// +// tdxh = formAll.getTCProperty("jk8InsteadType").getStringArrayValue()[i];// ͺ +// gngs = formAll.getTCProperty("jk8FunctionOverview").getStringArrayValue()[i];// ܸ +// khtsyq = formAll.getTCProperty("jk8CustSpecRequirements").getStringArrayValue()[i];// ͻҪ +// // u8mmh = form.getTCProperty("jk8U8NO").getStringArrayValue();// +// // U8 +// fm = formAll.getTCProperty("jk8Valve").getStringArrayValue()[i];// +// jmlx = formAll.getTCProperty("jk8EncryptType").getStringArrayValue()[i];// +// sqr = formAll.getTCProperty("jk8Applicant").getStringArrayValue()[i];// +// djrq = formAll.getTCProperty("jk8RecordDate").getStringArrayValue()[i];// Ǽ +// sysc1 = formAll.getTCProperty("jk8ApplyMarket").getStringArrayValue()[i];// г +// ptjbcj = formAll.getTCProperty("jk8BMManfMatched").getStringArrayValue()[i];// + jt08.setText(formAll.getTCProperty("jk8Customer").getStringArrayValue()[i]); + box3.setText(formAll.getTCProperty("jk8Customized").getStringArrayValue()[i]); + + bo = true; + + // box1.setText(jbcj);// / + if (sbh.length() >= 4) { +// cplxgz = sbh.substring(1, 2); +// cplx = setVal(cplxgz, "Ʒ"); +// box2.setText(cplx);// Ʒ + + String gzqzjlxgz = sbh.substring(2, 4); + String gzqzjlx = setVal(gzqzjlxgz, ""); + box2.setText(gzqzjlx);// + } + + // if(cpxh.startsWith("JG")){ + // String jffsgz=cpxh.substring(2,3); + // String jffs=setVal(jffsgz, "Ʒѷʽ"); + // box4.setText(jffs);// Ʒѷʽ + // } + +// jt5.setText(xlbxh == null ? "" : xlbxh);// ·ͺ +// jt2.setText(gngs == null ? "" : gngs);// ܸ +// jt4.setText(tdxh == null ? "" : tdxh);// ͺ +// jt6.setText(cxtz == null ? "" : cxtz);// +// jt8.setText(khtsyq == null ? "" : khtsyq);// ͻҪ +// jt7.setText(ickxh == null ? "" : ickxh);// ICͺ +// jt10.setText(fm == null ? "" : fm);// +// jt11.setText(jmlx == null ? "" : jmlx);// +// jt12.setText(ptjbcj == null ? "" : ptjbcj);// + +// if (sysc1 != null) { +// if (sysc1.equals("ͨ")) { +// radioButton1.setSelected(true); +// } else if (sysc1.contains("ר;")) { +// radioButton2.setSelected(true); +// jt3.setText(sysc1.split(";")[1]);// ר +// } +// } +// if (jt1.getText().equals("")) { +// jt1.setEnabled(true); +// } else { + jt1.setEnabled(false); +// } + + break; + } + } + System.out.println("Ʒ:" + lx); + System.out.println("Ʒ:" + name); + + seten(bo); + is = bo; + } catch (Exception e) { + // Auto-generated catch block + e.printStackTrace(); + } + return bo; + } + + private String setVal(String key, String Allkey) { + // Auto-generated method stub + String[] all = realNameMap_gz.get(Allkey).split(","); + HashMap Map_all = new HashMap<>(); + for (int i = 0; i < all.length; i++) { + System.out.println("ss=" + all[i]); + Map_all.put(all[i].split("=")[1], all[i].split("=")[0]); + } + if (Map_all.containsKey(key)) { + System.out.println(Allkey + "=" + Map_all.get(key)); + return Map_all.get(key).trim(); + } else { + System.out.println(Allkey + "="); + return ""; + } + + } + + private JLabel getjl() { + JLabel bt = new JLabel("*"); + bt.setForeground(Color.red); + return bt; + } +} diff --git a/src/com/teamcenter/rac/form/JSPS_Dialog.java b/src/com/teamcenter/rac/form/JSPS_Dialog.java new file mode 100644 index 0000000..408e66b --- /dev/null +++ b/src/com/teamcenter/rac/form/JSPS_Dialog.java @@ -0,0 +1,110 @@ +package com.teamcenter.rac.form; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.Toolkit; +import java.util.List; + +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; + +import com.teamcenter.rac.aif.AbstractAIFDialog; +import com.teamcenter.rac.util.PropertyLayout; + +public class JSPS_Dialog extends AbstractAIFDialog { + List valueLists; + int row; + int col; + Object[] obj; + public JSPS_Dialog(List valueLists, int row, int col, Object[] obj) { + // TODO Auto-generated constructor stub + this.valueLists=valueLists; + this.row=row; + this.col=col; + this.obj=obj; + } + + @Override + public void run() { + this.setAlwaysOnTop(true); + initUI(); + } + JTextArea area; +// PropertyLayout pl; + JPanel midJPanel; + private void initUI() { + // TODO Auto-generated method stub + this.setTitle("DBOMתEBOM"); + Dimension screensize = Toolkit.getDefaultToolkit().getScreenSize(); + int x = 1200; + int y = 500; + this.setBounds((int) screensize.getWidth() / 2 - x / 2, + (int) screensize.getHeight() / 2 - y / 2, x, y); +// pl = new PropertyLayout(10, 1);// öԻм +// pl.setRightMargin(0); + + midJPanel = new JPanel(new BorderLayout()); + + + + + + System.out.println("bingo"); + System.out.println(valueLists.get(row).jk8_psr); + this.setLayout(new BorderLayout()); + this.setSize(new Dimension(800, 800)); + String title=(String) obj[col]; + String content=""; + int num=row+1; + this.setTitle(title); + area=new JTextArea(20,75); + switch (col) { + case 0: + content=num+""; + break; + case 1: + content=valueLists.get(row).jk8_psr; + break; + case 2: + content=valueLists.get(row).jk8_jd; + break; + case 3: + content=valueLists.get(row).jk8_tcrq; + break; + case 4: + content=valueLists.get(row).jk8_wtszwz; + break; + case 5: + content=valueLists.get(row).jk8_wtms; + break; + case 6: + content=valueLists.get(row).jk8_jy; + break; + case 7: + content=valueLists.get(row).jk8_zt; + break; + case 8: + content=valueLists.get(row).jk8_cljg;//˵ +// if(content.length()>50) { +// content=content.substring(0, 50)+"\n"+ +// content.substring(50, 100)+"\n"+ +// content.substring(100, 150)+"\n"+content.substring(150, 200); +// } + break; + + default: + break; + } + area.setLineWrap(true); //jtextareaеԶ + area.setWrapStyleWord(true);//ûв + + area.setText(content); + area.setEditable(false); + midJPanel.add(new JScrollPane(area),BorderLayout.CENTER);//jtextareaӹ + this.add(midJPanel,BorderLayout.CENTER); + this.setVisible(true); + this.centerToScreen(); + this.pack(); + } +} diff --git a/src/com/teamcenter/rac/form/TableCellTextAreaRenderer.java b/src/com/teamcenter/rac/form/TableCellTextAreaRenderer.java new file mode 100644 index 0000000..af36e4a --- /dev/null +++ b/src/com/teamcenter/rac/form/TableCellTextAreaRenderer.java @@ -0,0 +1,31 @@ +//package com.teamcenter.rac.form; +//import java.awt.Component; +// +//import javax.swing.JTable; +//import javax.swing.JTextArea; +//import javax.swing.table.TableCellRenderer; +// +//class TableCellTextAreaRenderer extends JTextArea implements TableCellRenderer { +// public TableCellTextAreaRenderer() { +// setLineWrap(true); +// setWrapStyleWord(true); +// } +// +// @Override +// public Component getTableCellRendererComponent(JTable table, Object value, +// boolean isSelected, boolean hasFocus, int row, int column) { +// // 㵱еѸ߶ +// int maxPreferredHeight = 0; +// for (int i = 0; i < table.getColumnCount(); i++) { +// setText("" + table.getValueAt(row, i)); +// setSize(table.getColumnModel().getColumn(column).getWidth(), 0); +// maxPreferredHeight = Math.max(maxPreferredHeight, getPreferredSize().height); +// } +// +// if (table.getRowHeight(row) != maxPreferredHeight) // Ϲæ +// table.setRowHeight(row, maxPreferredHeight); +// +// setText(value == null ? "" : value.toString()); +// return this; +// } +//} \ No newline at end of file diff --git a/src/com/teamcenter/rac/form/TableComboxRender.java b/src/com/teamcenter/rac/form/TableComboxRender.java new file mode 100644 index 0000000..42ff3b5 --- /dev/null +++ b/src/com/teamcenter/rac/form/TableComboxRender.java @@ -0,0 +1,92 @@ +package com.teamcenter.rac.form; + +import java.awt.Color; +import java.awt.Component; +import java.awt.Font; +//import java.awt.event.ItemListener; +//import java.awt.event.MouseAdapter; +//import java.awt.event.MouseEvent; +//import java.util.ArrayList; +//import java.util.HashMap; +//import java.util.Map; + +//import javax.swing.JComboBox; +import javax.swing.JComponent; +import javax.swing.JTable; +import javax.swing.JTextArea; +import javax.swing.table.TableCellRenderer; + +/** + * @author duchao + * + */ +class TableComboxRender extends JComponent implements TableCellRenderer { + /** + * + */ + private static final long serialVersionUID = 1L; +// private JComboBox combox = null; + private JTextArea text; + private JTextArea text1; +// private Map comboxMap = new HashMap<>(); + + public TableComboxRender() { + + } + + int index4 = 0; + + @Override + public Component getTableCellRendererComponent(final JTable jtable, + Object obj, boolean isSelected, boolean hasFocus, final int row, + final int column) { + JComponent component1 = null; +// JComponent component0 = null; + if (column == 0) { + text1 = new JTextArea(); + text1.setText(obj != null ? obj.toString() : ""); + text1.setEditable(false); + component1 = text1; + } + + text = new JTextArea(); + text.setText(obj != null ? obj.toString() : ""); + text.setEditable(false); + component1 = text; + // 趨 + Font fp = new Font("΢ź", Font.PLAIN, 12); + Font fb = new Font("΢ź", Font.BOLD, 13); + if (isSelected) { + // TODO ȡ +// ChangeDbomDialogInput.inputButton.setEnabled(true); +// ChangeDbomDialogInput.selectedId = text1.getText(); + component1.setFont(fb); + + } else { + component1.setFont(fp); + } + // 趨ɫ + if (isSelected) { + + // 2.õǰCellɫ + Color mycolor2 = new Color(10, 36, 106); + component1.setBackground(mycolor2);// ñɫ + // component1.setBackground(mycolor);// ñɫ + component1.setForeground(Color.WHITE);// ǰɫ + } else { + + // 3.õУżеɫ + Color mycolor = new Color(232, 242, 254); + if (row % 2 == 0) {// żʱɫ + component1.setBackground(mycolor); + component1.setForeground(Color.BLACK);// ǰɫ + } else if (row % 2 == 1) {// õеɫ + component1.setBackground(Color.WHITE); + component1.setForeground(Color.BLACK);// ǰɫ + } + } + + + return component1; + } +} \ No newline at end of file diff --git a/src/com/teamcenter/rac/form/TableWithRowHead.java b/src/com/teamcenter/rac/form/TableWithRowHead.java new file mode 100644 index 0000000..b2f09f0 --- /dev/null +++ b/src/com/teamcenter/rac/form/TableWithRowHead.java @@ -0,0 +1,311 @@ +package com.teamcenter.rac.form; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Point; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.util.Date; +import java.util.Enumeration; +import java.util.Vector; +import javax.swing.AbstractCellEditor; +import javax.swing.DefaultCellEditor; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JTable; +import javax.swing.ListSelectionModel; +import javax.swing.UIManager; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import javax.swing.table.DefaultTableModel; +import javax.swing.table.JTableHeader; +import javax.swing.table.TableCellEditor; +import javax.swing.table.TableCellRenderer; +import javax.swing.table.TableColumn; +import javax.swing.table.TableColumnModel; +import com.teamcenter.rac.common.organization.OrgObject; +import com.teamcenter.rac.kernel.TCSession; + +public class TableWithRowHead extends JTable { + private static final long serialVersionUID = 1L; + + private TableWithRowHead table = null; + + private ButtonColumn buttoncolumn; + + private TCSession session; + + + + public TableWithRowHead(Vector data, Vector columns) { + super(data, columns); + this.init(); + } + + public TableWithRowHead(int row, int col) { + super(row, col); + this.init(); + } + + /** + * + * 췽 + * + */ + // MaterialsDescChangeFormDefaultTableModelTCSession + public TableWithRowHead(DefaultTableModel model, TCSession session) { + super(model); + this.session = session; + System.out.println(""); + this.init(); + } + + // CalendarPanelʱؼTableWithRowHeadѡʱselecttime + public TableWithRowHead(TableWithRowHead table, Date selecttime,boolean bo) { + this.table = table; + try { + // ٽTableWithRowHeadѡʱ䴫MaterialsDescChangeForm + JK8_FXGL_Form mdcf = new JK8_FXGL_Form(table,selecttime,bo); + } catch (Exception e) { + e.printStackTrace(); + } + } + + + /** + * this method must be invoked in constructor + */ + private void init() { + this.table = this; + //table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); + // JtableΪѡ + //table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + //Jtableв໥ + // table.getTableHeader().setReorderingAllowed(false); + ButtonColumn buttoncolumn = new ButtonColumn(this, 6); + ButtonColumn buttoncolumn2 = new ButtonColumn(session, this, 11); + //fitTableColumns(this); + //Jtableù̶п + setFixColumnWidth(this); + + } + + private void addLov(Object[] str_registry, int column_index) { + // TODO Auto-generated method stub + JComboBox jComboBox01 = new JComboBox(str_registry); + TableCellEditor roleTableCellEditor01 = new DefaultCellEditor( + jComboBox01); + TableColumn tableColumn01=table.getColumnModel().getColumn(column_index); + tableColumn01.setCellEditor(roleTableCellEditor01); + System.out.println("lov====>"+column_index); + } + + /** + * set the table header height + */ + public void setTableHeadHeight(int height) { + this.table.getTableHeader().setPreferredSize(new Dimension(0, height)); + } + + /** + * һ࣬ʵJTableϵһťһʱؼͻѡ + */ + class ButtonColumn extends AbstractCellEditor implements TableCellRenderer, + TableCellEditor, ActionListener { + TableWithRowHead table; + + JButton renderButton; + + JButton editButton; + + String text; + + TCSession session; + + int column; + + public ButtonColumn(TableWithRowHead table, int column) { + super(); + this.table = table; + renderButton = new JButton(); + this.column = column; + editButton = new JButton(); + editButton.setFocusPainted(false); + editButton.addActionListener(this); + + TableColumnModel columnModel = table.getColumnModel(); + columnModel.getColumn(column).setCellRenderer(this); + columnModel.getColumn(column).setCellEditor(this); + } + + public ButtonColumn(TCSession session, TableWithRowHead table, + int column) { + super(); + this.table = table; + this.session = session; + this.column = column; + renderButton = new JButton(); + + editButton = new JButton(); + editButton.setFocusPainted(false); + editButton.addActionListener(this); + + TableColumnModel columnModel = table.getColumnModel(); + columnModel.getColumn(column).setCellRenderer(this); + columnModel.getColumn(column).setCellEditor(this); + } + + public Component getTableCellRendererComponent(JTable table, + Object value, boolean isSelected, boolean hasFocus, int row, + int column) { + + if (hasFocus) { + renderButton.setForeground(table.getForeground()); + renderButton.setBackground(UIManager + .getColor("Button.background")); + } else if (isSelected) { + renderButton.setForeground(table.getSelectionForeground()); + renderButton.setBackground(table.getSelectionBackground()); + } else { + renderButton.setForeground(table.getForeground()); + renderButton.setBackground(UIManager + .getColor("Button.background")); + } + + renderButton.setText((value == null) ? "" : value.toString()); + return renderButton; + } + + // Ȼֵ + public Component getTableCellEditorComponent(JTable table, + Object value, boolean isSelected, int row, int column) { + text = (value == null) ? "" : value.toString(); + editButton.setText(text); + return editButton; + } + + public Object getCellEditorValue() { + return text; + } + + + public void actionPerformed(ActionEvent e) { + fireEditingStopped(); + if (this.column == 6) { + CalendarPanel calendarPanel = new CalendarPanel(table,true);//ʱģ + } + if (this.column == 11) { + CalendarPanel calendarPanel = new CalendarPanel(table,false);//ʱģ + } + } + + } + + /** + * + */ + public void setSelected(int row) { + + } + + /** + * ѡ(this method is for TableWithRowHead) + * + * @param rows + */ + public void setSelected(int[] rows) { + for (int i = 0; i < rows.length; i++) { + this.setSelected(rows[i]); + } + } + + /** + * ѡе(this method is for TableWithRowHead) + */ + public int[] getRealRows() { + int[] selectedRows = this.getSelectedRows(); // õѡе + int[] realRows = new int[selectedRows.length]; + for (int i = 0; i < realRows.length; i++) { + // realRows[i] = this.convertRowIndexToModel(selectedRows[i]); + realRows[i] = this.convertColumnIndexToModel(selectedRows[i]); + } + return realRows; + } + + /** + * ij + * + * @param col + */ + public void hideColumn(int col) { + JTableHeader tableHeader = this.getTableHeader(); + tableHeader.getColumnModel().getColumn(col).setPreferredWidth(0); + tableHeader.getColumnModel().getColumn(col).setMaxWidth(0); + tableHeader.getColumnModel().getColumn(col).setMinWidth(0); + table.getColumnModel().getColumn(col).setPreferredWidth(0); + table.getColumnModel().getColumn(col).setMaxWidth(0); + table.getColumnModel().getColumn(col).setMinWidth(0); + } + + public void setTableRowHeight(int height) { + this.table.setRowHeight(height); + } + + public void setTableRowHeight(int row, int height) { + this.table.setRowHeight(row, height); + } + + + /** + * Զп resize column width automatically + */ + public void fitTableColumns(JTable myTable) { + myTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + JTableHeader header = myTable.getTableHeader(); + int rowCount = myTable.getRowCount(); + Enumeration columns = myTable.getColumnModel().getColumns(); + while (columns.hasMoreElements()) { + TableColumn column = (TableColumn) columns.nextElement(); + int col = header.getColumnModel().getColumnIndex( + column.getIdentifier()); + int width = (int) header.getDefaultRenderer() + .getTableCellRendererComponent(myTable, + column.getIdentifier(), false, false, -1, col) + .getPreferredSize().getWidth(); + for (int row = 0; row < rowCount; row++) { + int preferedWidth = (int) myTable.getCellRenderer(row, col) + .getTableCellRendererComponent(myTable, + myTable.getValueAt(row, col), false, false, + row, col).getPreferredSize().getWidth(); + width = Math.max(width, preferedWidth); + } + header.setResizingColumn(column); // кҪ + column.setWidth(width + myTable.getIntercellSpacing().width); + } + } + /** + * Ϊ̶ȡ//fix table column width + */ + public void setFixColumnWidth(JTable table) { + //this.setRowHeight(30); + TableColumnModel tcm = table.getTableHeader().getColumnModel(); + for (int i = 0; i < tcm.getColumnCount(); i++) { + TableColumn tc = tcm.getColumn(i); + if(i==0){ + tc.setMaxWidth(35); + tc.setMinWidth(35); + }else if(i==2 ||i==1||i==7||i==8||i==13){ + tc.setMaxWidth(200); + }else if( i == 6||i == 11||i == 5){ + tc.setMaxWidth(100); + }else if(i == 3||i == 4||i == 10||i == 2){ + tc.setMaxWidth(35); + tc.setMinWidth(35); + }else{ + tc.setMaxWidth(100); + } + } + } +} + diff --git a/src/com/teamcenter/rac/form/Test.java b/src/com/teamcenter/rac/form/Test.java new file mode 100644 index 0000000..225a16d --- /dev/null +++ b/src/com/teamcenter/rac/form/Test.java @@ -0,0 +1,29 @@ +package com.teamcenter.rac.form; + +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JPanel; + +public class Test { + + public static void main(String[] args) { + // TODO Auto-generated method stub + JFrame frame = new JFrame("Javaбʾ"); + JPanel jp = new JPanel(); // + JLabel label1 = new JLabel("֤ͣ"); // ǩ + JComboBox cmb = new JComboBox(); // JComboBox + cmb.setEnabled(false); + cmb.addItem("--ѡ--"); // бһ + cmb.addItem("֤"); + cmb.addItem("ʻ֤"); + cmb.addItem("֤"); + jp.add(label1); + jp.add(cmb); + frame.add(jp); + frame.setBounds(300, 200, 400, 100); + frame.setVisible(true); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + } + +} diff --git a/src/com/teamcenter/rac/form/TextAreaRenderer.java b/src/com/teamcenter/rac/form/TextAreaRenderer.java new file mode 100644 index 0000000..1742c19 --- /dev/null +++ b/src/com/teamcenter/rac/form/TextAreaRenderer.java @@ -0,0 +1,31 @@ +package com.teamcenter.rac.form; + +import javax.swing.*; +import javax.swing.table.*; +import java.awt.*; +import java.util.*; +//Զ +public class TextAreaRenderer extends JTextArea implements TableCellRenderer { + public TextAreaRenderer() { + setLineWrap(true); + setWrapStyleWord(true); + } + + public Component getTableCellRendererComponent(JTable table, Object value, + boolean isSelected, boolean hasFocus, int row, int column) { + // 㵱еѸ߶ + int maxPreferredHeight = 0; + for (int i = 0; i < table.getColumnCount(); i++) { + setText("" + table.getValueAt(row, i)); + setSize(table.getColumnModel().getColumn(column).getWidth(), 0); + maxPreferredHeight = Math.max(maxPreferredHeight, + getPreferredSize().height); + } + + if (table.getRowHeight(row) != maxPreferredHeight) // Ϲæ + table.setRowHeight(row, maxPreferredHeight); + + setText(value == null ? "" : value.toString()); + return this; + } +} diff --git a/src/com/teamcenter/rac/form/form_user.properties b/src/com/teamcenter/rac/form/form_user.properties new file mode 100644 index 0000000..ce322d9 --- /dev/null +++ b/src/com/teamcenter/rac/form/form_user.properties @@ -0,0 +1,63 @@ +JK8ALPModAppForm.FORMJAVARENDERING=com.teamcenter.rac.form.JK8_ALARM_PRODUCT_MODEL_Form + + +JK8WSpecPINOAppForm.FORMJAVARENDERING=com.teamcenter.rac.form.JK8_WATER_SPECIAL_SBH_Form +JK8NNWPModNORegForm.FORMJAVARENDERING=com.teamcenter.rac.form.JK8_WATER_SBH_SUMMARY_Form +JK8DWPIdenNOAppForm.FORMJAVARENDERING=com.teamcenter.rac.form.JK8_WATER_DERIVATIVES_SBH_Form +JK8NWPIdenNOAppForm.FORMJAVARENDERING=com.teamcenter.rac.form.JK8_WATER_SBH_Form +JK8WaterPModAppForm.FORMJAVARENDERING=com.teamcenter.rac.form.JK8_WATER_PRODUCT_MODEL_Form +#\u4EA7\u54C1\u578B\u53F7\u53CA\u8BC6\u522B\u53F7 +JK8NPModINOAppForm.FORMJAVARENDERING=com.teamcenter.rac.form.JK8_CPXH_Form +#\u65B0\u4EA7\u54C1\u8BC6\u522B\u53F7 +JK8NewPIdenNOAppForm.FORMJAVARENDERING=com.teamcenter.rac.form.JK8_SBH_Form +#\u7279\u6B8A\u8981\u6C42 +JK8SpecPINOAppForm.FORMJAVARENDERING=com.teamcenter.rac.form.JK8_TSSBH_Form +#\u884D\u751F\u4EA7\u54C1 +JK8DerPIdenNOAppForm.FORMJAVARENDERING=com.teamcenter.rac.form.JK8_YSSBH_Form + +JK8ExtPIdenNOAppForm.FORMJAVARENDERING=com.teamcenter.rac.form.JK8_YZCPXHSQB_Form + +#\u63A7\u5236\u5668\u4EA7\u54C1\u578B\u53F7 +JK8CotlerPModAppForm.FORMJAVARENDERING=com.teamcenter.rac.form.JK8_CotlerPModApp_Form +#\u63A7\u5236\u5668\u8BC6\u522B\u53F7 +JK8ColPIdenNOAppForm.FORMJAVARENDERING=com.teamcenter.rac.form.JK8_ColPIdenNOAppForm + +#\u4EA7\u54C1\u578B\u53F7\u8BC6\u522B\u53F7\u603B\u8868 +JK8NewPModNORegForm.FORMJAVARENDERING=com.teamcenter.rac.form.JK8_XCPXH_Form + +#\u98CE\u9669\u8868\u5355 +JK8ProjRiskRevisionMaster.FORMJAVARENDERING = com.teamcenter.rac.form.JK8_FXGL_Form + +#Item\ Master.FORMJAVARENDERING=com.teamcenter.rac.form.HX3_GYLXRevisionFormStyleSheet +#ItemMasterForm.FORMJAVARENDERING=com.teamcenter.rac.form.HX3_GYLXRevisionFormStyleSheet +JK8TecReviewRevisionMaster.FORMJAVARENDERING=com.teamcenter.rac.form.JK8_JSPS_Form + +JK8InitialReqRevisionMaster.FORMJAVARENDERING=com.connor.jk.plm.YSXQForm.JK8_YSXQ_Form + + +#JK8MaterialRevisionMaster.FORMJAVARENDERING=com.teamcenter.rac.form.JK8MaterialRevisionMasterForm + +JK8MaterialRevisionMaster.FORMJAVARENDERING=com.teamcenter.rac.form.ConnorForm +TX2FinalProductRevisionMaster.FORMJAVARENDERING=com.teamcenter.rac.form.ConnorForm +TX2ComponentRevisionMaster.FORMJAVARENDERING=com.teamcenter.rac.form.ConnorForm +TX2SemiProductRevisionMaster.FORMJAVARENDERING=com.teamcenter.rac.form.ConnorForm +TX2RawMaterialRevisionMaster.FORMJAVARENDERING=com.teamcenter.rac.form.ConnorForm + +#PCB\u7F16\u7801\u7533\u8BF7\u8868 +JK8PCBNOAppForm.FORMJAVARENDERING=com.teamcenter.rac.form.JK8PCBNOAppForm + +#\u884D\u751FPCB\u7F16\u7801\u7533\u8BF7\u8868 +JK8DerPCBNOAppForm.FORMJAVARENDERING=com.teamcenter.rac.form.JK8DerPCBNOAppForm + +#PCB\u7F16\u7801\u767B\u8BB0\u8868 +JK8PCBNORegForm.FORMJAVARENDERING=com.teamcenter.rac.form.JK8PCBNORegForm + + +#\u62A5\u8B66\u5668\u4EA7\u54C1\u578B\u53F7\u8BC6\u522B\u53F7\u7533\u8BF7\u8868 +JK8WarnrModINAppForm.FORMJAVARENDERING=com.teamcenter.rac.form.JK8_WarnrModINApp_Form +#\u62A5\u8B66\u5668\u4EA7\u54C1\u8BC6\u522B\u53F7\u7533\u8BF7\u8868 +JK8WarnrNPINOAppForm.FORMJAVARENDERING=com.teamcenter.rac.form.JK8_WarnrNPINOApp_Form + + +#\u91C7\u96C6\u5668\u8BC6\u522B\u53F7 +JK8CJQIdenNOAppForm.FORMJAVARENDERING=com.teamcenter.rac.form.JK8_CJQ_Form diff --git a/src/com/teamcenter/rac/project/views/ProjectDefinitionView.java b/src/com/teamcenter/rac/project/views/ProjectDefinitionView.java new file mode 100644 index 0000000..648a287 --- /dev/null +++ b/src/com/teamcenter/rac/project/views/ProjectDefinitionView.java @@ -0,0 +1,1820 @@ +package com.teamcenter.rac.project.views; + +import java.awt.Color; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.TreeSet; +import java.util.Vector; + +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextField; + +import org.apache.log4j.Logger; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtension; +import org.eclipse.core.runtime.IExtensionPoint; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.IJobChangeEvent; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.core.runtime.jobs.JobChangeAdapter; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.util.PropertyChangeEvent; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.custom.CTabItem; +import org.eclipse.swt.custom.SashForm; +import org.eclipse.swt.custom.ViewForm; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.KeyListener; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.events.MouseMoveListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.layout.RowLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.IWorkbenchPart; +import org.jfree.data.Values; + +import com.connor.jk.plm.createproject.GetLsmUtil; +//import com.connor.getlsms.GetLsmUtil; +import com.teamcenter.rac.common.lov.LOVComboBox; +import com.teamcenter.rac.common.lov.view.controls.LOVDisplayer; +import com.teamcenter.rac.kernel.ListOfValuesInfo; +import com.teamcenter.rac.kernel.ServiceData; +import com.teamcenter.rac.kernel.SessionChangedEvent; +import com.teamcenter.rac.kernel.SessionChangedListener; +import com.teamcenter.rac.kernel.SoaUtil; +import com.teamcenter.rac.kernel.TCAccessControlService; +import com.teamcenter.rac.kernel.TCComponent; +import com.teamcenter.rac.kernel.TCComponentGroup; +import com.teamcenter.rac.kernel.TCComponentGroupMember; +import com.teamcenter.rac.kernel.TCComponentListOfValues; +import com.teamcenter.rac.kernel.TCComponentListOfValuesType; +import com.teamcenter.rac.kernel.TCComponentProject; +import com.teamcenter.rac.kernel.TCComponentProjectType; +import com.teamcenter.rac.kernel.TCComponentRole; +import com.teamcenter.rac.kernel.TCComponentType; +import com.teamcenter.rac.kernel.TCComponentUser; +import com.teamcenter.rac.kernel.TCException; +import com.teamcenter.rac.kernel.TCExceptionPartial; +import com.teamcenter.rac.kernel.TCProperty; +import com.teamcenter.rac.kernel.TCPropertyDescriptor; +import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.kernel.TCUserService; +import com.teamcenter.rac.kernel.tcservices.TcServicesService; +import com.teamcenter.rac.project.Messages; +import com.teamcenter.rac.project.ProjectUIPostActions; +import com.teamcenter.rac.project.common.IC_UserProxy; +import com.teamcenter.rac.project.common.ProjectConstants; +import com.teamcenter.rac.project.common.ProjectManager; +import com.teamcenter.rac.project.common.ProjectTeamStatus; +import com.teamcenter.rac.project.common.ProjectTeamTreeManager; +import com.teamcenter.rac.project.nodes.ProjectRootNode; +import com.teamcenter.rac.project.nodes.ProjectTeamContentNode; +import com.teamcenter.rac.ui.common.RACUIUtil; +import com.teamcenter.rac.ui.views.AbstractContentViewPart; +import com.teamcenter.rac.ui.views.providers.GroupRole; +import com.teamcenter.rac.util.AdapterUtil; +import com.teamcenter.rac.util.ButtonLayout; +import com.teamcenter.rac.util.DateButton; +import com.teamcenter.rac.util.MessageBox; +import com.teamcenter.rac.util.PropertyLayout; +import com.teamcenter.rac.util.Registry; +import com.teamcenter.rac.util.Separator; +import com.teamcenter.rac.util.Utilities; +import com.teamcenter.rac.util.VerticalLayout; +import com.teamcenter.rac.util.iTextField; +import com.teamcenter.rac.util.combobox.iComboBox; +import com.teamcenter.rac.util.log.Debug; +import com.teamcenter.rac.vns.model.IContentView; +import com.teamcenter.services.rac.core.ProjectLevelSecurityService; +import com.teamcenter.services.rac.core._2007_01.DataManagement; +import com.teamcenter.services.rac.core._2012_09.ProjectLevelSecurity; +import com.teamcenter.services.rac.core._2012_09.ProjectLevelSecurity.TeamMemberInfo; + +public class ProjectDefinitionView extends AbstractContentViewPart implements SessionChangedListener, IContentView { + + + private iComboBox box; + private iComboBox boxType; + private HashMap typeValueToID=new HashMap(); + public LOVComboBox finishCodeField1 = null; + + private LOVComboBox finishCodeField2 = null; + private DateButton dateButton; + public JDialog dialog; + private LOVComboBox finishCodeField3 = null; + + private JButton ok_button = null; + + private JButton can_button = null; + + private Button jbutton = null; + + LOVComboBox JYprojecttype = null; + + LOVComboBox JYprojectstage = null; + + LOVComboBox JYunit = null; + + LOVComboBox JYproductline = null; + + LOVComboBox JYnowstage = null; + + LOVComboBox JYdevelopprocess = null; + + LOVComboBox JYproducttype = null; + + LOVComboBox JYproductseries = null; + + LOVComboBox JYsecretlevel = null; + + LOVComboBox JYpriority = null; + + LOVComboBox JY_isImportant_lov = null; + private iTextField JYNo; + private iTextField JYName; + private iTextField JYprojectmanager; + public iTextField JYcountry; + public iTextField JYprojectorigin; + private JButton JYok; + public TCComponentProject pro; + public JLabel label9; + public JLabel label10; + public JLabel label11; + private Composite m_headerComposite = null; + private Button m_createButton = null; + private Button m_modifyButton = null; + private Button m_copyButton = null; + private Button m_deleteButton = null; + private Button m_clearButton = null; + // + public Button jk_idButton = null; + public volatile Text m_idText = null; + private Text m_nameText = null; + private Text m_descriptionText = null; + private LOVDisplayer m_categoryCombo; + private Button m_activeStatusBtn = null; + private Button m_inactiveStatusBtn = null; + private Button m_inactiveandInviisibleStatusBtn = null; + private Button m_useProgramSecurityBtn = null; + private static ProjectTeamTreeManager m_projectTeamManager; + private TCComponentProject project = null; + private TCSession session = RACUIUtil.getTCSession(); + private final Registry reg = ProjectConstants.projectReg; + private String projectID; + private String projectName; + private String projectDesc; + private String projectCollaborationCategories; + private boolean useProgramSec = false; + private boolean projectStatus = false; + private boolean projectVisibility = false; + private ProjectLevelSecurity.ProjectTeamData[] projectTeamMembers = null; + private ProjectLevelSecurity.ProjectOpsResponse result = null; + private boolean isPA = false; + private boolean isPTA = false; + protected ArrayList infos = null; + private boolean isModified = false; + private boolean isNewlyCreated = false; + private boolean isDirty = false; + private ProjectUIPostActions m_contributer = null; + private JTextField timeFiled; + private JTextField priceFiled; + private static final Logger logger = Logger.getLogger(ProjectDefinitionView.class); + + public ProjectDefinitionView() { + setShowHeader(true); + setMultiSelectionSupported(false); + setProcessNullSelectionsEnabled(true); + setComponentEventListeningEnabled(true); + AbstractTCAdminApplicationViewHelper localAbstractTCAdminApplicationViewHelper = ProjectManager.getApp(); + try { + localAbstractTCAdminApplicationViewHelper.checkApplicationPriviledgeWithMessage(); + } catch (Exception localException) { + logger.error(localException.getClass().getName(), localException); + } + this.isPA = localAbstractTCAdminApplicationViewHelper.isPAPrivileged(); + this.isPTA = localAbstractTCAdminApplicationViewHelper.isPTAPrivileged(); + loadPostActionExtension(); + } + + protected void createContent(Composite paramComposite) { + paramComposite.setLayout(new FillLayout(512)); + SashForm localSashForm = new SashForm(paramComposite, 512); + localSashForm.setSashWidth(5); + localSashForm.setLayout(new FillLayout()); + getToolkit().adapt(localSashForm, true, true); + ViewForm localViewForm1 = new ViewForm(localSashForm, 16777216); + getToolkit().adapt(localViewForm1, true, true); + ViewForm localViewForm2 = new ViewForm(localSashForm, 16777216); + getToolkit().adapt(localViewForm2, true, true); + localViewForm1.setContent(createTopForm(localViewForm1)); + localViewForm2.setContent(createBottomForm(localViewForm2)); + localViewForm2.setBorderVisible(true); + localSashForm.setWeights(new int[] { 25, 75 }); + getTCSession().addSessionChangeListener(this); + } + + protected Control createHeadControl(Composite paramComposite) { + Composite localComposite = createHeaderComposite(paramComposite); + createButtons(localComposite); + getScrolledForm().getForm().setHeadClient(this.m_headerComposite); + getScrolledForm().getForm().getHead().update(); + return this.m_headerComposite; + } + + public boolean isDirtyStill() { + boolean bool = m_projectTeamManager.teamModified(); + return (this.isDirty) || (bool); + } + + protected synchronized Composite createTopForm(Composite paramComposite) { + Composite localComposite1 = getToolkit().createComposite(paramComposite, 0); + GridLayout localGridLayout = new GridLayout(3, false); + localComposite1.setLayout(localGridLayout); + Label localLabel1 = getToolkit().createLabel(localComposite1, Messages.getString("projectID.LABEL"), 64); + GridData localGridData1 = new GridData(16384, 4, false, false); + localLabel1.setLayoutData(localGridData1); + Label localLabel2 = getToolkit().createLabel(localComposite1, "*"); + GridData localGridData2 = new GridData(4, 4, false, false); + localLabel2.setLayoutData(localGridData2); + localLabel2.setForeground(localComposite1.getDisplay().getSystemColor(3)); + GridData localGridData3 = new GridData(4, 128, false, false); + this.m_idText = getToolkit().createText(localComposite1, "", 2048); + localGridData3 = new GridData(16384, 16777216, true, false); + localGridData3.widthHint = 152; + this.m_idText.setLayoutData(localGridData3); + this.m_idText.setTextLimit(128); + this.m_idText.addKeyListener(new KeyListener() { + public void keyReleased(KeyEvent paramKeyEvent) { + if ((ProjectDefinitionView.this.isPA) || (ProjectDefinitionView.this.isPTA) + || (ProjectDefinitionView.this.isPTA())) + ProjectDefinitionView.this.validateButtons(); + } + + public void keyPressed(KeyEvent paramKeyEvent) { + ProjectDefinitionView.this.isDirty = true; + } + }); + this.m_idText.addMouseMoveListener(new MouseMoveListener() { + public void mouseMove(MouseEvent paramMouseEvent) { + if (ProjectDefinitionView.this.m_idText.getCharCount() > 50) + ProjectDefinitionView.this.m_idText.setToolTipText(ProjectDefinitionView.this.m_idText.getText()); + else + ProjectDefinitionView.this.m_idText.setToolTipText(""); + } + }); + Label localLabel3 = getToolkit().createLabel(localComposite1, Messages.getString("projectName.LABEL"), 64); + localGridData3 = new GridData(4, 128, false, false, 1, 1); + localLabel3.setLayoutData(localGridData3); + Label localLabel4 = getToolkit().createLabel(localComposite1, "*"); + GridData localGridData4 = new GridData(4, 4, false, false); + localLabel4.setLayoutData(localGridData4); + localLabel4.setForeground(localComposite1.getDisplay().getSystemColor(3)); + this.m_nameText = getToolkit().createText(localComposite1, "", 2048); + getToolkit().adapt(this.m_nameText, true, true); + localGridData3 = new GridData(16384, 16777216, true, false); + localGridData3.widthHint = 160; + this.m_nameText.setLayoutData(localGridData3); + this.m_nameText.addKeyListener(new KeyListener() { + public void keyReleased(KeyEvent paramKeyEvent) { + if ((ProjectDefinitionView.this.isPA) || (ProjectDefinitionView.this.isPTA) + || (ProjectDefinitionView.this.isPTA())) + ProjectDefinitionView.this.validateButtons(); + } + + public void keyPressed(KeyEvent paramKeyEvent) { + ProjectDefinitionView.this.isDirty = true; + } + }); + this.m_nameText.addMouseMoveListener(new MouseMoveListener() { + public void mouseMove(MouseEvent paramMouseEvent) { + if (ProjectDefinitionView.this.m_nameText.getCharCount() > 50) + ProjectDefinitionView.this.m_nameText.setToolTipText(ProjectDefinitionView.this.m_idText.getText()); + else + ProjectDefinitionView.this.m_nameText.setToolTipText(""); + } + }); + Label localLabel5 = getToolkit().createLabel(localComposite1, Messages.getString("projectDesc.LABEL"), 64); + localGridData3 = new GridData(4, 128, false, false, 2, 1); + localLabel5.setLayoutData(localGridData3); + this.m_descriptionText = getToolkit().createText(localComposite1, "", 2626); + localGridData3 = new GridData(16384, 16777216, true, false); + localGridData3.widthHint = 250; + localGridData3.heightHint = 50; + this.m_descriptionText.setLayoutData(localGridData3); + this.m_descriptionText.setTextLimit(256); + this.m_descriptionText.addKeyListener(new KeyListener() { + public void keyReleased(KeyEvent paramKeyEvent) { + if ((ProjectDefinitionView.this.isPA) || (ProjectDefinitionView.this.isPTA) + || (ProjectDefinitionView.this.isPTA())) + ProjectDefinitionView.this.validateButtons(); + } + + public void keyPressed(KeyEvent paramKeyEvent) { + ProjectDefinitionView.this.isDirty = true; + } + }); + this.m_descriptionText.addMouseMoveListener(new MouseMoveListener() { + public void mouseMove(MouseEvent paramMouseEvent) { + if (ProjectDefinitionView.this.m_descriptionText.getCharCount() > 50) + ProjectDefinitionView.this.m_descriptionText + .setToolTipText(ProjectDefinitionView.this.m_idText.getText()); + else + ProjectDefinitionView.this.m_descriptionText.setToolTipText(""); + } + }); + Label localLabel6 = getToolkit().createLabel(localComposite1, + Messages.getString("projectCollaborationCategories.LABEL"), 64); + localGridData3 = new GridData(4, 128, false, false, 2, 1); + localLabel6.setLayoutData(localGridData3); + TCPropertyDescriptor localTCPropertyDescriptor = null; + try { + TCComponentType localTCComponentType = getTCSession().getTypeComponent("TC_Project"); + localTCPropertyDescriptor = localTCComponentType.getPropertyDescriptor("fnd0CollaborationCategories"); + } catch (TCException localTCException) { + logger.error(localTCException.getLocalizedMessage(), localTCException); + } + this.m_categoryCombo = new LOVDisplayer(localComposite1, 2); + this.m_categoryCombo.initialize(this.project, localTCPropertyDescriptor, null); + getToolkit().adapt(this.m_categoryCombo, true, true); + localGridData3 = new GridData(16384, 16777216, true, false); + localGridData3.widthHint = 250; + localGridData3.heightHint = 25; + this.m_categoryCombo.setLayoutData(localGridData3); + this.m_categoryCombo.addPropertyChangeListener(new IPropertyChangeListener() { + public void propertyChange(PropertyChangeEvent paramPropertyChangeEvent) { + if ((ProjectDefinitionView.this.isPA) || (ProjectDefinitionView.this.isPTA) + || (ProjectDefinitionView.this.isPTA())) { + ProjectDefinitionView.this.validateButtons(); + ProjectDefinitionView.this.isDirty = true; + } + } + }); + Label localLabel7 = getToolkit().createLabel(localComposite1, Messages.getString("projectStatus.LABEL"), 1); + localGridData3 = new GridData(4, 128, false, false, 2, 1); + localLabel7.setLayoutData(localGridData3); + Composite localComposite2 = new Composite(localComposite1, 0); + localComposite2.setLayout(new RowLayout()); + SelectionAdapter local8 = new SelectionAdapter() { + public void widgetSelected(SelectionEvent paramSelectionEvent) { + if ((ProjectDefinitionView.this.isPA) || (ProjectDefinitionView.this.isPTA) + || (ProjectDefinitionView.this.isPTA())) { + ProjectDefinitionView.this.validateButtons(); + ProjectDefinitionView.this.isDirty = true; + } + } + }; + this.m_activeStatusBtn = new Button(localComposite2, 16); + this.m_activeStatusBtn.setText(Messages.getString("activeStatusButton.TITLE")); + this.m_activeStatusBtn.addSelectionListener(local8); + this.m_activeStatusBtn.setSelection(true); + this.m_inactiveStatusBtn = new Button(localComposite2, 16); + this.m_inactiveStatusBtn.setText(Messages.getString("inactiveStatusButton.TITLE")); + this.m_inactiveStatusBtn.addSelectionListener(local8); + this.m_inactiveandInviisibleStatusBtn = new Button(localComposite2, 16); + this.m_inactiveandInviisibleStatusBtn.setText(Messages.getString("inactiveInvisibleStatusButton.TITLE")); + this.m_inactiveandInviisibleStatusBtn.addSelectionListener(local8); + Label localLabel8 = getToolkit().createLabel(localComposite1, "", 1); + localGridData3 = new GridData(4, 128, false, false, 2, 1); + localLabel8.setLayoutData(localGridData3); + Composite localComposite3 = new Composite(localComposite1, 0); + localComposite3.setLayout(new GridLayout()); + this.m_useProgramSecurityBtn = new Button(localComposite3, 32); + this.m_useProgramSecurityBtn.setText(Messages.getString("useProgramSecurityCheckBox.TITLE")); + this.m_useProgramSecurityBtn.setSelection(false); + this.m_useProgramSecurityBtn.addSelectionListener(local8); + return localComposite1; + } + + protected synchronized Composite createBottomForm(Composite paramComposite) { + CTabFolder localCTabFolder = new CTabFolder(paramComposite, 1); + getToolkit().adapt(localCTabFolder, true, true); + CTabItem localCTabItem = new CTabItem(localCTabFolder, 0); + localCTabItem.setText(Messages.USERS); + m_projectTeamManager = new ProjectTeamTreeManager(localCTabFolder, this); + localCTabItem.setControl(m_projectTeamManager); + localCTabFolder.setSelection(localCTabItem); + return localCTabFolder; + } + + protected Composite createHeaderComposite(Composite paramComposite) { + if ((this.m_headerComposite != null) && (!this.m_headerComposite.isDisposed())) { + this.m_headerComposite.dispose(); + this.m_headerComposite = null; + } + this.m_headerComposite = new Composite(paramComposite, 64); + this.m_headerComposite.setLayoutData(new GridData(4, 4, true, true)); + FillLayout localFillLayout = new FillLayout(); + this.m_headerComposite.setLayout(localFillLayout); + Group localGroup = new Group(this.m_headerComposite, 64); + localGroup.setText(ProjectConstants.OPTIONS_TEXT); + return localGroup; + } + + protected void createButtons(Composite paramComposite) { + RowLayout localRowLayout = new RowLayout(256); + localRowLayout.spacing = 6; + localRowLayout.marginLeft = 5; + localRowLayout.marginRight = 5; + paramComposite.setLayout(localRowLayout); + this.m_createButton = getToolkit().createButton(paramComposite, ProjectConstants.CREATE_TEXT, 8); + this.m_createButton.setEnabled(false); + this.m_createButton.setImage(ProjectConstants.CREATE_ICON); + this.m_createButton.setToolTipText(ProjectConstants.CREATE_TEXT); + this.m_createButton.addSelectionListener(new SelectionListener() { + public void widgetSelected(SelectionEvent paramSelectionEvent) { + ProjectManager.getInstance().doRefresh(); + ProjectDefinitionView.this.createProjectOperation(); + ProjectDefinitionView.this.isDirty = false; + } + + public void widgetDefaultSelected(SelectionEvent paramSelectionEvent) { + } + }); + this.m_modifyButton = getToolkit().createButton(paramComposite, ProjectConstants.MODIFY_TEXT, 8); + this.m_modifyButton.setEnabled(false); + this.m_modifyButton.setImage(ProjectConstants.MODIFY_ICON); + this.m_modifyButton.setToolTipText(ProjectConstants.MODIFY_TEXT); + this.m_modifyButton.addSelectionListener(new SelectionListener() { + public void widgetSelected(SelectionEvent paramSelectionEvent) { + ProjectDefinitionView.this.modifyProjectOperation(); + ProjectDefinitionView.this.isDirty = false; + } + + public void widgetDefaultSelected(SelectionEvent paramSelectionEvent) { + } + }); + this.m_copyButton = getToolkit().createButton(paramComposite, ProjectConstants.COPY_TEXT, 8); + this.m_copyButton.setEnabled(false); + this.m_copyButton.setImage(ProjectConstants.COPY_ICON); + this.m_copyButton.setToolTipText(ProjectConstants.COPY_TEXT); + this.m_copyButton.addSelectionListener(new SelectionListener() { + public void widgetSelected(SelectionEvent paramSelectionEvent) { + ProjectDefinitionView.this.copyProjectOperation(); + ProjectManager.getInstance().doRefresh(); + ProjectDefinitionView.this.isDirty = false; + } + + public void widgetDefaultSelected(SelectionEvent paramSelectionEvent) { + } + }); + this.m_deleteButton = getToolkit().createButton(paramComposite, ProjectConstants.DELETE_TEXT, 8); + this.m_deleteButton.setEnabled(false); + this.m_deleteButton.setImage(ProjectConstants.DELETE_ICON); + this.m_deleteButton.setToolTipText(ProjectConstants.DELETE_TEXT); + this.m_deleteButton.addSelectionListener(new SelectionListener() { + public void widgetSelected(SelectionEvent paramSelectionEvent) { + ProjectDefinitionView.this.deleteProjectOperation(); + ProjectManager.getInstance().doRefresh(); + ProjectDefinitionView.this.clearOperation(); + ProjectDefinitionView.this.isDirty = false; + } + + public void widgetDefaultSelected(SelectionEvent paramSelectionEvent) { + } + }); + this.m_clearButton = getToolkit().createButton(paramComposite, ProjectConstants.CLEAR_BUTTON_TEXT, 8); + this.m_clearButton.setEnabled(true); + this.m_clearButton.setImage(ProjectConstants.CLEAR_BUTTON_IMAGE); + this.m_clearButton.setToolTipText(ProjectConstants.CLEAR_BUTTON_TEXT); + this.m_clearButton.addSelectionListener(new SelectionListener() { + public void widgetSelected(SelectionEvent paramSelectionEvent) { + ProjectDefinitionView.this.isDirty = false; + ProjectDefinitionView.this.clearOperation(); + } + + public void widgetDefaultSelected(SelectionEvent paramSelectionEvent) { + } + }); + + // idָɰť + jk_idButton = getToolkit().createButton(paramComposite, "ָID", 8); + jk_idButton.setEnabled(true); + jk_idButton.setToolTipText("ָID"); + jk_idButton.addSelectionListener(new SelectionListener() { + + @Override + public void widgetSelected(SelectionEvent arg0) { + // TODO Auto-generated method stub + initDialog(); + + // new Thread(){ + // @Override + // public void run() { + // // TODO Auto-generated method stub + // JYProjectAutoCodeDialog project_dialog=new + // JYProjectAutoCodeDialog(getTCSession()); + // new Thread(project_dialog).run(); + // } + // }.start(); + // JYProjectAutoCodeDialog project_dialog=new + // JYProjectAutoCodeDialog(getTCSession()); + // new Thread(project_dialog).run(); + // new JyProjectAutoCodeSwtDialog(jy_idButton.getDisplay()); + } + + @Override + public void widgetDefaultSelected(SelectionEvent arg0) { + // TODO Auto-generated method stub + + } + }); + } + + private void createProjectOperation() { + this.m_createButton.setEnabled(false); + collectData(); + TCComponentProjectType localTCComponentProjectType = null; + try { + localTCComponentProjectType = (TCComponentProjectType) this.session.getTypeComponent("TC_Project"); + } catch (TCException localTCException1) { + logger.error(localTCException1.getClass().getName(), localTCException1); + } + Object[] arrayOfObject = { TCComponentProject.getDisplayName(this.session) }; + TCComponentProject localTCComponentProject = null; + if (localTCComponentProjectType != null) + try { + localTCComponentProject = localTCComponentProjectType.find(this.projectID); + if (localTCComponentProject != null) { + String str1 = MessageFormat + .format(this.reg.getString("duplicateProject.TITLE", "Duplicate Project"), arrayOfObject); +// String localObject2 = MessageFormat.format( +// this.reg.getString("duplicateProjectID.MESSAGE", "Duplicate Project ID"), arrayOfObject); +// MessageBox.post((String) localObject2, str1, 1); + MessageBox.post("Ŀѱʹã´Ŀ", str1, 1); + return; + } + } catch (TCException localObject1) { + logger.error(localObject1.getClass().getName(), localObject1); + TCComponent[] locobj = ProjectManager.getInstance().findProjectsByNameOrID(this.projectName, false); + if ((locobj != null) && (locobj.length > 0)) { + String localObject2 = this.reg.getString("duplicateProject.TITLE", "Duplicate Project "); + String str2 = MessageFormat.format( + this.reg.getString("duplicateProjectName.MESSAGE", "Duplicate Project Name"), + arrayOfObject); + MessageBox.post(str2, (String) localObject2, 1); + return; + } + } + if (!checkTeamAdminMembership()) + return; + this.infos = getSelectedMembersHelper(); + final String localObject1 = MessageFormat + .format(this.reg.getString("createProject.MESSAGE", "Creating Project"), arrayOfObject); + Object localObject2 = new Job((String) localObject1) { + protected IStatus run(IProgressMonitor paramIProgressMonitor) { + paramIProgressMonitor.beginTask(localObject1, -1); + try { + ProjectLevelSecurity.ProjectInformation[] arrayOfProjectInformation = new ProjectLevelSecurity.ProjectInformation[1]; + arrayOfProjectInformation[0] = new ProjectLevelSecurity.ProjectInformation(); + arrayOfProjectInformation[0].clientId = "PLS-RAC-SESSION"; + arrayOfProjectInformation[0].projectId = ProjectDefinitionView.this.projectID; + arrayOfProjectInformation[0].projectName = ProjectDefinitionView.this.projectName; + arrayOfProjectInformation[0].projectDescription = ProjectDefinitionView.this.projectDesc; + arrayOfProjectInformation[0].useProgramContext = ProjectDefinitionView.this.useProgramSec; + arrayOfProjectInformation[0].active = ProjectDefinitionView.this.projectStatus; + arrayOfProjectInformation[0].visible = ProjectDefinitionView.this.projectVisibility; + arrayOfProjectInformation[0].teamMembers = new ProjectLevelSecurity.TeamMemberInfo[ProjectDefinitionView.this.infos + .size()]; + arrayOfProjectInformation[0].teamMembers = ((ProjectLevelSecurity.TeamMemberInfo[]) ProjectDefinitionView.this.infos + .toArray(arrayOfProjectInformation[0].teamMembers)); + ProjectLevelSecurity.ProjectOpsResponse localProjectOpsResponse = ProjectManager.getInstance() + .createProjects(arrayOfProjectInformation); + if ((localProjectOpsResponse != null) && (localProjectOpsResponse.serviceData != null)) { + + if (localProjectOpsResponse.serviceData.sizeOfPartialErrors() > 0) { + final TCExceptionPartial localObject1 = SoaUtil + .checkPartialErrorsNoThrow(localProjectOpsResponse.serviceData); + Display.getDefault().asyncExec(new Runnable() { + public void run() { + MessageBox.post(localObject1); + } + }); + } + if (localProjectOpsResponse.serviceData.sizeOfCreatedObjects() > 0) { + TCComponentProject localObject1 = localProjectOpsResponse.projectOpsOutputs[0].project; + System.out.println("cProjectId:" + localObject1); +// if(dateButton.getDate()!=null) +// localObject1.setDateProperty("JYListedDate1", dateButton.getDate()); +// Map propertyMap = new HashMap(); +// propertyMap.put("JYcountry", JYcountry.getText()); +// if (JYnowstage.getSelectedObject() != null) +// propertyMap.put("JYIsimpproject", JYnowstage.getSelectedObject().toString()); +// propertyMap.put("JYPriceInfo", priceFiled.getText()); +// if (finishCodeField1.getSelectedObject() != null) +// propertyMap.put("JYproductline", finishCodeField1.getSelectedObject().toString()); +// if (JYprojectstage.getSelectedObject() != null) +// propertyMap.put("JYprojectstage", JYprojectstage.getSelectedObject().toString()); +// if (JYprojecttype.getSelectedObject() != null) +// propertyMap.put("JYprojecttype", JYprojecttype.getSelectedObject().toString()); +// if (JYsecretlevel.getSelectedObject() != null) +// propertyMap.put("JYsecretlevel", JYsecretlevel.getSelectedObject().toString()); +// if (JYunit.getSelectedObject() != null) +// propertyMap.put("JYunit", JYunit.getSelectedObject().toString()); +// propertyMap.put("JYprojectorigin", JYprojectorigin.getText()); +// localObject1.setProperties(propertyMap); + ProjectManager.getInstance().addCreatedProjects((TCComponentProject) localObject1); + ProjectDefinitionView.this.isNewlyCreated = true; + ProjectDefinitionView.m_projectTeamManager.setProject((TCComponentProject) localObject1); + if (ProjectDefinitionView.this.m_contributer != null) + ProjectDefinitionView.this.m_contributer + .projectCreated((TCComponentProject) localObject1); + if (!ProjectDefinitionView.this.projectCollaborationCategories.isEmpty()) { + HashMap localHashMap = new HashMap(); + DataManagement.VecStruct localVecStruct = new DataManagement.VecStruct(); + Vector localVector = new Vector(); + String str = ProjectDefinitionView.this.projectCollaborationCategories; + for (int i = str.indexOf(","); i != -1; i = str.indexOf(",")) { + String localObject2 = str.substring(0, i); + localVector.add(localObject2); + str = str.substring(i + 1); + } + localVector.add(str); + String[] localObject2 = new String[localVector.size()]; + for (int j = 0; j < localVector.size(); j++) + localObject2[j] = ((String) localVector.elementAt(j)); + localVecStruct.stringVec = ((String[]) localObject2); + localHashMap.put("fnd0CollaborationCategories", localVecStruct); + TCComponentProject[] arrayOfTCComponentProject = new TCComponentProject[1]; + arrayOfTCComponentProject[0] = localObject1; + ServiceData localServiceData = ProjectManager.getInstance() + .setProjectProperties(localHashMap, arrayOfTCComponentProject); + if (localServiceData.sizeOfPartialErrors() > 0) { + final TCExceptionPartial localTCExceptionPartial = SoaUtil + .checkPartialErrorsNoThrow(localServiceData); + Display.getDefault().asyncExec(new Runnable() { + public void run() { + MessageBox.post(localTCExceptionPartial); + } + }); + } + } + } + } + } catch (Exception localException) { + ProjectDefinitionView.logger.error(localException.getClass(), localException); + } finally { + paramIProgressMonitor.done(); + } + //2022/12/7 Ŀɹ޸ + GetLsmUtil ge=new GetLsmUtil(); + ge.setLsm("cjxmlsm", box.getTextField().getText().substring(2), "0000"); + return (IStatus) (IStatus) Status.OK_STATUS; + } + }; + ((Job) localObject2).setPriority(10); + ((Job) localObject2).setRule(getTCSession().getOperationJobRule()); + ((Job) localObject2).schedule(); + if ((this.isNewlyCreated) && (m_projectTeamManager != null)) { + this.isDirty = false; + m_projectTeamManager.reloadProjectTeam(); + this.isNewlyCreated = false; + } + } + + private synchronized void modifyProjectOperation() { + m_projectTeamManager.getProjectTeamMembersViewer().expandAll(); + if (!checkTeamAdminMembership()) + return; + collectData(); + this.result = null; + Object[] arrayOfObject = { TCComponentProject.getDisplayName(this.session) }; + final String str = MessageFormat.format(this.reg.getString("modifyProject.MESSAGE", "Modifying Project"), + arrayOfObject); + Job local15 = new Job(str) { + protected IStatus run(IProgressMonitor paramIProgressMonitor) { + paramIProgressMonitor.beginTask(str, -1); + ProjectDefinitionView.this.infos = ProjectDefinitionView.this.getSelectedMembersHelper(); + return Status.OK_STATUS; + } + }; + local15.addJobChangeListener(new JobChangeAdapter() { + public void done(IJobChangeEvent paramIJobChangeEvent) { + Job local1 = new Job(str) { + protected IStatus run(IProgressMonitor paramIProgressMonitor) { + paramIProgressMonitor.beginTask(str, -1); + try { + ProjectLevelSecurity.ModifyProjectsInfo[] arrayOfModifyProjectsInfo = new ProjectLevelSecurity.ModifyProjectsInfo[1]; + arrayOfModifyProjectsInfo[0] = new ProjectLevelSecurity.ModifyProjectsInfo(); + arrayOfModifyProjectsInfo[0].sourceProject = ProjectDefinitionView.this.project; + arrayOfModifyProjectsInfo[0].clientId = "PLS-RAC-SESSION"; + arrayOfModifyProjectsInfo[0].projectInfo = new ProjectLevelSecurity.ProjectInformation(); + arrayOfModifyProjectsInfo[0].projectInfo.projectId = ProjectDefinitionView.this.projectID; + arrayOfModifyProjectsInfo[0].projectInfo.projectName = ProjectDefinitionView.this.projectName; + arrayOfModifyProjectsInfo[0].projectInfo.projectDescription = ProjectDefinitionView.this.projectDesc; + arrayOfModifyProjectsInfo[0].projectInfo.useProgramContext = ProjectDefinitionView.this.useProgramSec; + arrayOfModifyProjectsInfo[0].projectInfo.active = ProjectDefinitionView.this.projectStatus; + arrayOfModifyProjectsInfo[0].projectInfo.visible = ProjectDefinitionView.this.projectVisibility; + arrayOfModifyProjectsInfo[0].projectInfo.teamMembers = new ProjectLevelSecurity.TeamMemberInfo[ProjectDefinitionView.this.infos + .size()]; + arrayOfModifyProjectsInfo[0].projectInfo.teamMembers = ((ProjectLevelSecurity.TeamMemberInfo[]) ProjectDefinitionView.this.infos + .toArray(arrayOfModifyProjectsInfo[0].projectInfo.teamMembers)); + ProjectDefinitionView.this.result = ProjectManager.getInstance() + .modifyProjects(arrayOfModifyProjectsInfo); + } catch (Exception localException) { + ProjectDefinitionView.logger.error(localException.getClass().getName(), localException); + } finally { + paramIProgressMonitor.done(); + } + return Status.OK_STATUS; + } + }; + local1.addJobChangeListener(new JobChangeAdapter() { + public void done(IJobChangeEvent paramIJobChangeEvent) { + try { + String str1 = ProjectDefinitionView.this.project.getProperty("project_id"); + if (ProjectDefinitionView.this.result != null) { + if (ProjectDefinitionView.this.result.serviceData.sizeOfPartialErrors() > 0) { + final TCExceptionPartial localTCExceptionPartial1 = SoaUtil + .checkPartialErrorsNoThrow(ProjectDefinitionView.this.result.serviceData); + Display.getDefault().asyncExec(new Runnable() { + public void run() { + MessageBox.post(localTCExceptionPartial1); + } + }); + } + boolean bool = ProjectDefinitionView.this + .doesUserHaveWriteAccessToThisObject(ProjectDefinitionView.this.project); + Object localObject1; + if ((ProjectDefinitionView.this.isPA) && (bool)) { + localObject1 = new HashMap(); + DataManagement.VecStruct localVecStruct = new DataManagement.VecStruct(); + Vector localVector = new Vector(); + String str2 = ProjectDefinitionView.this.projectCollaborationCategories; + for (int i = str2.indexOf(","); i != -1; i = str2.indexOf(",")) { + String localObject2 = str2.substring(0, i); + localVector.add(localObject2); + str2 = str2.substring(i + 1); + } + localVector.add(str2); + String[] localObject2 = new String[localVector.size()]; + for (int j = 0; j < localVector.size(); j++) + localObject2[j] = ((String) localVector.elementAt(j)); + localVecStruct.stringVec = ((String[]) localObject2); + ((HashMap) localObject1).put("fnd0CollaborationCategories", localVecStruct); + TCComponentProject[] arrayOfTCComponentProject = new TCComponentProject[1]; + arrayOfTCComponentProject[0] = project; + ServiceData localServiceData = ProjectManager.getInstance() + .setProjectProperties((HashMap) localObject1, arrayOfTCComponentProject); + if (localServiceData.sizeOfPartialErrors() > 0) { + final TCExceptionPartial localTCExceptionPartial2 = SoaUtil + .checkPartialErrorsNoThrow(localServiceData); + Display.getDefault().asyncExec(new Runnable() { + public void run() { + MessageBox.post(localTCExceptionPartial2); + } + }); + } + } + if ((ProjectDefinitionView.this.result.projectOpsOutputs != null) + && (ProjectDefinitionView.this.result.projectOpsOutputs.length > 0)) { + localObject1 = ProjectDefinitionView.this.result.projectOpsOutputs[0].project; + ProjectManager.getInstance().projectModified((TCComponentProject) localObject1); + if (ProjectDefinitionView.this.m_contributer != null) + ProjectDefinitionView.this.m_contributer.projectModified( + (TCComponentProject) localObject1, str1, + ProjectDefinitionView.this.projectID); + } + } + } catch (Exception localException) { + ProjectDefinitionView.logger.error(localException.getClass().getName(), localException); + } + } + }); + local1.setPriority(10); + local1.setRule(ProjectDefinitionView.this.getTCSession().getOperationJobRule()); + local1.schedule(); + ProjectDefinitionView.this.isModified = true; + Display.getDefault().asyncExec(new Runnable() { + public void run() { + ProjectDefinitionView.this.validateButtons(); + } + }); + } + }); + local15.setPriority(10); + local15.setRule(getTCSession().getOperationJobRule()); + local15.schedule(); + } + + private boolean doesUserHaveWriteAccessToThisObject(TCComponentProject paramTCComponentProject) { + boolean i = true; + TCSession localTCSession = getTCSession(); + TCAccessControlService localTCAccessControlService = localTCSession.getTCAccessControlService(); + try { + boolean[] arrayOfBoolean = localTCAccessControlService.checkPrivileges(paramTCComponentProject, + new String[] { "WRITE" }); + i = arrayOfBoolean[0]; + } catch (Exception localException) { + i = false; + logger.error(localException.getClass().getName(), localException); + } + return i; + } + + private void copyProjectOperation() { + if (!checkTeamAdminMembership()) + return; + collectData(); + TCComponentProjectType localTCComponentProjectType = null; + try { + localTCComponentProjectType = (TCComponentProjectType) this.session.getTypeComponent("TC_Project"); + } catch (TCException localTCException1) { + logger.error(localTCException1.getClass().getName(), localTCException1); + } + Object[] arrayOfObject = { TCComponentProject.getDisplayName(this.session) }; + TCComponentProject localTCComponentProject = null; + if (localTCComponentProjectType != null) + try { + localTCComponentProject = localTCComponentProjectType.find(this.projectID); + if (localTCComponentProject != null) { + String str1 = MessageFormat + .format(this.reg.getString("duplicateProject.TITLE", "Duplicate Project"), arrayOfObject); + String localObject2 = MessageFormat.format( + this.reg.getString("duplicateProjectID.MESSAGE", "Duplicate Project ID"), arrayOfObject); + MessageBox.post((String) localObject2, str1, 1); + return; + } + } catch (TCException localObject1) { + logger.error(localObject1.getClass().getName(), localObject1); + TCComponent[] loc = ProjectManager.getInstance().findProjectsByNameOrID(this.projectName, false); + if ((loc != null) && (loc.length > 0)) { + String localObject2 = this.reg.getString("duplicateProject.TITLE", "Duplicate Project "); + String str2 = MessageFormat.format( + this.reg.getString("duplicateProjectName.MESSAGE", "Duplicate Project Name"), + arrayOfObject); + MessageBox.post(str2, (String) localObject2, 1); + return; + } + } + this.infos = getSelectedMembersHelper(); + final String localObject1 = MessageFormat.format(this.reg.getString("copyProject.MESSAGE", "Copying Project"), + arrayOfObject); + Job localObject2 = new Job((String) localObject1) { + protected IStatus run(IProgressMonitor paramIProgressMonitor) { + paramIProgressMonitor.beginTask(localObject1, -1); + try { + if (ProjectDefinitionView.this.project != null) { + ProjectLevelSecurity.ProjectInformation localProjectInformation = new ProjectLevelSecurity.ProjectInformation(); + localProjectInformation.projectId = ProjectDefinitionView.this.projectID; + localProjectInformation.projectName = ProjectDefinitionView.this.projectName; + localProjectInformation.projectDescription = ProjectDefinitionView.this.projectDesc; + localProjectInformation.projectDescription = ProjectDefinitionView.this.projectDesc; + localProjectInformation.active = ProjectDefinitionView.this.projectStatus; + localProjectInformation.visible = ProjectDefinitionView.this.projectVisibility; + localProjectInformation.useProgramContext = ProjectDefinitionView.this.useProgramSec; + localProjectInformation.teamMembers = new ProjectLevelSecurity.TeamMemberInfo[ProjectDefinitionView.this.infos + .size()]; + localProjectInformation.teamMembers = ((ProjectLevelSecurity.TeamMemberInfo[]) ProjectDefinitionView.this.infos + .toArray(localProjectInformation.teamMembers)); + ProjectLevelSecurity.CopyProjectsInfo[] arrayOfCopyProjectsInfo = new ProjectLevelSecurity.CopyProjectsInfo[1]; + arrayOfCopyProjectsInfo[0] = new ProjectLevelSecurity.CopyProjectsInfo(); + arrayOfCopyProjectsInfo[0].projectInfo = localProjectInformation; + arrayOfCopyProjectsInfo[0].sourceProject = ProjectDefinitionView.this.project; + arrayOfCopyProjectsInfo[0].clientId = localProjectInformation.projectId; + ProjectLevelSecurityService localProjectLevelSecurityService = ProjectLevelSecurityService + .getService(ProjectDefinitionView.this.session); + ProjectLevelSecurity.ProjectOpsResponse localProjectOpsResponse = localProjectLevelSecurityService + .copyProjects(arrayOfCopyProjectsInfo); + Object localObject1; + if (localProjectOpsResponse.serviceData.sizeOfPartialErrors() > 0) { + final TCExceptionPartial localerr = SoaUtil + .checkPartialErrorsNoThrow(localProjectOpsResponse.serviceData); + Display.getDefault().asyncExec(new Runnable() { + public void run() { + MessageBox.post(localerr); + } + }); + } + if (localProjectOpsResponse.serviceData.sizeOfCreatedObjects() > 0) { + localObject1 = (TCComponentProject) localProjectOpsResponse.serviceData.getCreatedObject(0); + ProjectManager.getInstance().addCreatedProjects((TCComponentProject) localObject1); + } + } + } catch (Exception localException) { + ProjectDefinitionView.logger.error(localException.getClass().getName(), localException); + } finally { + paramIProgressMonitor.done(); + } + return (IStatus) Status.OK_STATUS; + } + }; + ((Job) localObject2).setPriority(10); + ((Job) localObject2).setRule(getTCSession().getOperationJobRule()); + ((Job) localObject2).schedule(); + ProjectManager.getInstance().projectModified(this.project); + validateButtons(); + } + + private synchronized void deleteProjectOperation() { + Object[] arrayOfObject = { TCComponentProject.getDisplayName(this.session) }; + boolean bool = MessageDialog.openConfirm(this.m_idText.getShell(), + this.reg.getString("confirmDelete.TITLE", "Confirm Delete"), + MessageFormat.format(this.reg.getString("confirmDeleteProject.MESSAGE"), arrayOfObject)); + if (!bool) + return; + final String str1 = getProjectID(); + String str2 = MessageFormat.format(this.reg.getString("deleteProject.MESSAGE", "Deleting Project"), + arrayOfObject); + this.session.setStatus(str2); + Display.getDefault().syncExec(new Runnable() { + public void run() { + if (ProjectDefinitionView.this.project == null) + return; + try { + if (Debug.isOn("project")) + Debug.println("deleteProjectOperation: deleting... " + str1); + ProjectDefinitionView.this.project.delete(); + } catch (Exception localException) { + MessageBox.post(localException); + } + ProjectDefinitionView.this.session.setReadyStatus(); + } + }); + } + + public void sessionChanged(SessionChangedEvent paramSessionChangedEvent) { + AbstractTCAdminApplicationViewHelper localAbstractTCAdminApplicationViewHelper = ProjectManager.getApp(); + try { + localAbstractTCAdminApplicationViewHelper.initializeApplicationPriviledge(); + } catch (Exception localException) { + logger.error(localException.getClass().getName(), localException); + } + this.isPA = localAbstractTCAdminApplicationViewHelper.isPAPrivileged(); + this.isPTA = localAbstractTCAdminApplicationViewHelper.isPTAPrivileged(); + } + + protected synchronized void processSetInput(IWorkbenchPart paramIWorkbenchPart, List paramList) { + Object localObject = paramList.isEmpty() ? null : paramList.get(0); + if (localObject == null) + return; + if ((localObject instanceof ProjectRootNode)) + clearOperation(); + TCComponentProject localTCComponentProject = (TCComponentProject) AdapterUtil.getAdapter(localObject, + TCComponentProject.class, true); + int i = (localTCComponentProject != null) && (this.project != null) + && (this.project.getUid().equals(localTCComponentProject.getUid())) ? 1 : 0; + int j = (i != 0) && (!this.isModified) ? 0 : 1; + setInputObject(paramIWorkbenchPart, localTCComponentProject); + if ((localTCComponentProject == null) && (i == 0)) { + this.project = localTCComponentProject; + if (!isDirtyStill()) + clearOperation(); + else + validateButtons(); + return; + } + if ((localTCComponentProject != null) && (j != 0)) { + this.project = localTCComponentProject; + String[] arrayOfString1 = new String[9]; + arrayOfString1[0] = "project_id"; + arrayOfString1[1] = "project_name"; + arrayOfString1[2] = "project_desc"; + arrayOfString1[3] = "is_active"; + arrayOfString1[4] = "use_program_security"; + arrayOfString1[5] = "is_visible"; + arrayOfString1[6] = "owning_user"; + arrayOfString1[7] = "object_string"; + arrayOfString1[8] = "fnd0CollaborationCategories"; + TCProperty[] arrayOfTCProperty = null; + try { + arrayOfTCProperty = localTCComponentProject.getTCProperties(arrayOfString1); + } catch (TCException localTCException1) { + logger.error(localTCException1.getClass().getName(), localTCException1); + } + try { + this.projectID = arrayOfTCProperty[0].getStringValue(); + this.projectName = arrayOfTCProperty[1].getStringValue(); + this.projectDesc = arrayOfTCProperty[2].getStringValue(); + this.projectStatus = arrayOfTCProperty[3].getLogicalValue(); + this.projectVisibility = arrayOfTCProperty[5].getLogicalValue(); + this.useProgramSec = arrayOfTCProperty[4].getLogicalValue(); + boolean bool = (!this.projectStatus) && (!this.projectVisibility); + this.m_idText.setText(this.projectID); + this.m_nameText.setText(this.projectName); + this.m_descriptionText.setText(this.projectDesc); + this.projectCollaborationCategories = Utilities + .getStringForArray(arrayOfTCProperty[8].getStringArrayValue(), ","); + this.m_categoryCombo.setSelectedValue(arrayOfTCProperty[8]); + this.m_activeStatusBtn.setSelection(this.projectStatus); + this.m_inactiveStatusBtn.setSelection((!this.projectStatus) && (!bool)); + this.m_useProgramSecurityBtn.setSelection(this.useProgramSec); + this.m_inactiveandInviisibleStatusBtn.setSelection(bool); + m_projectTeamManager.setProject(this.project); + } catch (TCException localTCException2) { + logger.error(localTCException2.getClass().getName(), localTCException2); + } + this.projectTeamMembers = null; + String[] arrayOfString2 = { + TCComponentProject.getDisplayName(ProjectManager.getInstance().getTCSession()) }; + final String str = ProjectConstants.projectReg.getStringWithSubstitution("loadingProjects.MESSAGE", + arrayOfString2); + Job local19 = new Job(str) { + protected IStatus run(IProgressMonitor paramIProgressMonitor) { + paramIProgressMonitor.beginTask(str, -1); + try { + ProjectLevelSecurity.ProjectClientId[] arrayOfProjectClientId = new ProjectLevelSecurity.ProjectClientId[1]; + arrayOfProjectClientId[0] = new ProjectLevelSecurity.ProjectClientId(); + arrayOfProjectClientId[0].clientId = "PLS-RAC-SESSION"; + arrayOfProjectClientId[0].tcProject = ProjectDefinitionView.this.project; + ProjectLevelSecurity.ProjectTeamsResponse localProjectTeamsResponse = ProjectManager + .getInstance().getProjectTeamMembers(arrayOfProjectClientId); + ProjectDefinitionView.this.projectTeamMembers = localProjectTeamsResponse.projectTeams; + } catch (Exception localException) { + ProjectDefinitionView.logger.error(localException.getClass().getName(), localException); + } finally { + paramIProgressMonitor.done(); + } + return Status.OK_STATUS; + } + }; + local19.addJobChangeListener(new JobChangeAdapter() { + public void done(IJobChangeEvent paramIJobChangeEvent) { + ProjectDefinitionView.this.getProjectTeamJobPost(); + } + }); + local19.setPriority(10); + local19.setRule(getTCSession().getOperationJobRule()); + local19.schedule(); + } + } + + private void getProjectTeamJobPost() { + if (Display.getCurrent() != null) { + Job local21 = new Job("Loading Project Team Data") { + protected IStatus run(IProgressMonitor paramIProgressMonitor) { + paramIProgressMonitor.beginTask("Loading Project Team Data", -1); + try { + ProjectDefinitionView.m_projectTeamManager.setProject(ProjectDefinitionView.this.project); + ProjectDefinitionView.m_projectTeamManager + .setProjectTeamMembers(ProjectDefinitionView.this.projectTeamMembers); + ProjectDefinitionView.m_projectTeamManager.loadProjectTeamData(); + } catch (Exception localException) { + ProjectDefinitionView.logger.error(localException.getClass().getName(), localException); + } finally { + paramIProgressMonitor.done(); + } + return Status.OK_STATUS; + } + }; + local21.addJobChangeListener(new JobChangeAdapter() { + public void done(IJobChangeEvent paramIJobChangeEvent) { + Display.getDefault().asyncExec(new Runnable() { + public void run() { + ProjectDefinitionView.this.validateButtons(); + ProjectDefinitionView.m_projectTeamManager.getProjectTeamViewer().refresh(); + } + }); + } + }); + } else { + m_projectTeamManager.setProject(this.project); + m_projectTeamManager.setProjectTeamMembers(this.projectTeamMembers); + m_projectTeamManager.loadProjectTeamData(); + Display.getDefault().asyncExec(new Runnable() { + public void run() { + ProjectDefinitionView.this.validateButtons(); + ProjectDefinitionView.m_projectTeamManager.getProjectTeamViewer().refresh(); + } + }); + } + } + + private synchronized void collectData() { + this.projectID = this.m_idText.getText(); + this.projectName = this.m_nameText.getText(); + this.projectDesc = this.m_descriptionText.getText(); + this.useProgramSec = this.m_useProgramSecurityBtn.getSelection(); + this.projectStatus = ((this.m_activeStatusBtn.getSelection()) + && (!this.m_inactiveandInviisibleStatusBtn.getSelection())); + this.projectVisibility = (!this.m_inactiveandInviisibleStatusBtn.getSelection()); + this.projectCollaborationCategories = Utilities + .getStringForArray(Utilities.getArray(this.m_categoryCombo.getSelectedValue()), ","); + } + + private void clearOperation() { + if (this.project != null) { + processSetOriginalInput(this, new ArrayList()); + this.project = null; + makeContentViewBlank(this, null, true); + } + if (m_projectTeamManager != null) + Display.getDefault().asyncExec(new Runnable() { + public void run() { + ProjectDefinitionView.m_projectTeamManager.clearSelectedMembers(); + if (ProjectDefinitionView.this.m_activeStatusBtn != null) + ProjectDefinitionView.this.m_activeStatusBtn.setSelection(true); + } + }); + this.projectID = ""; + this.projectName = ""; + this.projectDesc = ""; + this.useProgramSec = false; + this.projectStatus = true; + this.projectVisibility = true; + this.project = null; + if (this.m_idText != null) + this.m_idText.setText(""); + if (this.m_nameText != null) + this.m_nameText.setText(""); + if (this.m_descriptionText != null) + this.m_descriptionText.setText(""); + if (this.m_categoryCombo.getSelectedValue() != null) + this.m_categoryCombo.setSelectedValue(""); + if (this.m_activeStatusBtn != null) + this.m_activeStatusBtn.setSelection(true); + if (this.m_inactiveStatusBtn != null) + this.m_inactiveStatusBtn.setSelection(false); + if (this.m_useProgramSecurityBtn != null) + this.m_useProgramSecurityBtn.setSelection(false); + if (this.m_inactiveandInviisibleStatusBtn != null) + this.m_inactiveandInviisibleStatusBtn.setSelection(false); + if (m_projectTeamManager != null) + m_projectTeamManager.setRoot(null); + ProjectManager.getInstance().clearAll(); + validateButtons(); + } + + private boolean checkTeamAdminMembership() { + boolean i = true; + ProjectTeamStatus localProjectTeamStatus = ProjectTeamStatus.getInstance(); + if (((localProjectTeamStatus == null) && (m_projectTeamManager.getRoot() != null)) + || ((localProjectTeamStatus != null) && (localProjectTeamStatus.getProject() != this.project) + && (m_projectTeamManager.getRoot().getObject() != null) + && ((m_projectTeamManager.getRoot().getObject() instanceof ProjectTeamStatus)))) + localProjectTeamStatus = (ProjectTeamStatus) m_projectTeamManager.getRoot().getObject(); + TCComponentUser localTCComponentUser = this.session.getUser(); + TCComponentRole localTCComponentRole = this.session.getRole(); + TCComponentGroup localTCComponentGroup = this.session.getGroup(); + if ((m_projectTeamManager.getRoot() != null) && (m_projectTeamManager.getRoot().getObject() != null) + && (localProjectTeamStatus != null) && (localProjectTeamStatus.getProjectTeamAmins() != null) + && (!localProjectTeamStatus.getProjectTeamAmins().isEmpty())) + return i; + if ((localProjectTeamStatus == null) || (localProjectTeamStatus.getProjectTeamAmins().isEmpty())) { + Object[] arrayOfObject = { TCComponentProject.getDisplayName(this.session) }; + boolean bool = MessageDialog.openConfirm(this.m_idText.getShell(), + MessageFormat.format(this.reg.getString("confirmPTA.TITLE", "Add Project Team Admin"), + arrayOfObject), + MessageFormat.format(this.reg.getString("confirmPTA.MESSAGE"), arrayOfObject)); + if (!bool) + i = false; + else + try { + m_projectTeamManager.addAsAdmin(localTCComponentGroup, localTCComponentRole, localTCComponentUser); + } catch (Exception localException) { + logger.error(localException.getClass().getName(), localException); + } + } + return i; + } + + public boolean isValidSelectedObjectForViewPart(IWorkbenchPart paramIWorkbenchPart, Object paramObject) { + return (AdapterUtil.getAdapter(paramObject, ProjectRootNode.class) != null) + || (AdapterUtil.getAdapter(paramObject, TCComponentProject.class) != null); + } + + protected void makeViewBlank(IWorkbenchPart paramIWorkbenchPart, List paramList, boolean paramBoolean) { + super.makeViewBlank(paramIWorkbenchPart, paramList, paramBoolean); + validateButtons(); + } + + public String getProjectID() { + return this.m_idText.getText(); + } + + public String getProjectName() { + return this.m_nameText.getText(); + } + + public String getProjectDesc() { + return this.m_descriptionText.getText(); + } + + public String getProjectCollaborationCategories() { + String str = ""; + str = Utilities.getStringForArray(Utilities.getArray(this.m_categoryCombo.getSelectedValue()), ","); + return str; + } + + public boolean getProjectStatus() { + return this.m_activeStatusBtn.getSelection(); + } + + public boolean getProgramVisibility() { + return !this.m_inactiveandInviisibleStatusBtn.getSelection(); + } + + public synchronized boolean getProgramSecurity() { + return this.m_useProgramSecurityBtn.getSelection(); + } + + private boolean isTeamDefined() { + return (m_projectTeamManager != null) && (m_projectTeamManager.getRoot() != null); + } + + public synchronized void validateButtons() { + boolean bool1 = isTeamDefined(); + if ((bool1) && (this.project != null) && (m_projectTeamManager.getRoot() != null) + && (m_projectTeamManager.getRoot().getObject() != null)) { + Object localObject = (ProjectTeamStatus) m_projectTeamManager.getRoot().getObject(); + String str1 = getTCSession().getUser().toString(); + this.isPTA = ((ProjectTeamStatus) localObject).getProjectTeamAmins().contains(str1); + } + Object localObject = getProjectName(); + String str1 = getProjectID(); + String str2 = getProjectDesc(); + String str3 = getProjectCollaborationCategories(); + boolean bool2 = getProgramVisibility() ^ this.projectVisibility; + boolean bool3 = getProgramSecurity() ^ this.useProgramSec; + localObject = localObject != null ? ((String) localObject).trim() : null; + str1 = str1 != null ? str1.trim() : null; + str2 = str2 != null ? str2.trim() : null; + int i = 0; + if ((str1 != null) && (this.projectID != null) && (!str1.equals(this.projectID))) + i = 1; + int j = 0; + if ((localObject != null) && (this.projectName != null) && (!((String) localObject).equals(this.projectName))) + j = 1; + int k = 0; + if ((str2 != null) && (this.projectDesc != null) && (!str2.equals(this.projectDesc))) + k = 1; + int m = 0; + if (!str3.equalsIgnoreCase(this.projectCollaborationCategories)) + m = 1; + this.m_createButton.setEnabled( + (this.isPA) && (localObject != null) && (((String) localObject).length() > 0) && (str1 != null) + && (str1.length() > 0) && (bool1) && ((this.project == null) || ((i != 0) && (j != 0)))); + boolean bool4; + if (this.project != null) { + bool4 = this.m_activeStatusBtn.getSelection() ^ this.projectStatus; + boolean bool5 = m_projectTeamManager.teamModified(); + int n = (this.isPA) && (isPTA()) ? 1 : 0; + if ((isPTA()) && (!this.isPA)) { + if (bool5) + n = 1; + if ((j != 0) || (i != 0) || (bool4) || (k != 0) || (bool2) || (bool3) || (m != 0)) + n = 0; + } + if ((isPTA()) && (!this.isPA)) { + if (bool5) + n = 1; + if ((j != 0) || (i != 0) || (bool4) || (k != 0) || (bool2) || (bool3)) + n = 0; + } + this.m_modifyButton.setEnabled((n != 0) && (bool1) + && ((j != 0) || (i != 0) || (bool4) || (k != 0) || (bool5) || (bool2) || (bool3) || (m != 0))); + } else { + this.m_modifyButton.setEnabled(false); + } + if (this.project != null) + this.m_copyButton.setEnabled((this.isPA) && (localObject != null) && (((String) localObject).length() > 0) + && (str1 != null) && (str1.length() > 0) && (bool1) && (i != 0) && (j != 0)); + else + this.m_copyButton.setEnabled(false); + if (this.m_deleteButton != null) { + bool4 = false; + if (this.project != null) { + TCComponentUser localTCComponentUser = getTCSession().getUser(); + try { + String str4 = this.project.getProperty("owning_user"); + if ((str4 != null) && (localTCComponentUser != null) + && (localTCComponentUser.toString().contains(str4))) + bool4 = true; + } catch (TCException localTCException) { + logger.error(localTCException.getClass().getName(), localTCException); + } + } + this.m_deleteButton.setEnabled((this.isPA) && (this.project != null) && (bool4)); + } + } + + public boolean isPTA() { + if (this.isPTA) + return true; + TCComponentUser localTCComponentUser = getTCSession().getUser(); + if (this.project != null) + try { + String str = this.project.getProperty("owning_user"); + if ((str != null) && (localTCComponentUser != null) + && (localTCComponentUser.toString().equalsIgnoreCase(str))) + return true; + try { + if ((m_projectTeamManager.projectTeamMembers != null) + && (m_projectTeamManager.projectTeamMembers[0] != null)) + for (TCComponent localObject : m_projectTeamManager.projectTeamMembers[0].projectTeamAdmins) + if (localObject == localTCComponentUser) + return true; + } catch (Exception loce) { + logger.error(loce.getClass().getName(), loce); + } + } catch (TCException localException) { + logger.error(localException.getClass().getName(), localException); + + } + return false; + } + + private synchronized ArrayList getSelectedMembersHelper() { + ProjectTeamStatus localProjectTeamStatus = null; + localProjectTeamStatus = getPTM(localProjectTeamStatus); + this.infos = new ArrayList(); + TreeSet localTreeSet = getPTMChildren(); + Object localObject2; + Object localObject1; + Object localObject3; + Object localObject4; + Object localObject5; + if (localTreeSet != null) { + localObject2 = localTreeSet.iterator(); + while (((Iterator) localObject2).hasNext()) { + localObject1 = (ProjectTeamContentNode) ((Iterator) localObject2).next(); + if ((((ProjectTeamContentNode) localObject1).getObject() instanceof GroupRole)) { + localObject3 = (GroupRole) ((ProjectTeamContentNode) localObject1).getObject(); + localObject4 = ((ProjectTeamContentNode) localObject1).data.m_children; + if (localObject4 == null) + continue; + Iterator localIterator = ((TreeSet) localObject4).iterator(); + while (localIterator.hasNext()) { + localObject5 = (ProjectTeamContentNode) localIterator.next(); + IC_UserProxy localIC_UserProxy = null; + String str = ((ProjectTeamContentNode) localObject5).toString(); + if ((((ProjectTeamContentNode) localObject5).getObject() instanceof IC_UserProxy)) { + localIC_UserProxy = (IC_UserProxy) ((ProjectTeamContentNode) localObject5).getObject(); + } else if ((((ProjectTeamContentNode) localObject5) + .getObject() instanceof ProjectTeamContentNode)) { + Object localObject6 = (ProjectTeamContentNode) ((ProjectTeamContentNode) localObject5) + .getObject(); + if (localObject6 != null) + localIC_UserProxy = (IC_UserProxy) ((ProjectTeamContentNode) localObject6).getObject(); + } + if (localIC_UserProxy != null) + str = localIC_UserProxy.toString(); + Object localObject6 = ProjectManager.getInstance().getGroupMember( + ((GroupRole) localObject3).getGroup(), ((GroupRole) localObject3).getRole(), str); + if (localObject6 == null) + continue; + ProjectLevelSecurity.TeamMemberInfo localTeamMemberInfo = new ProjectLevelSecurity.TeamMemberInfo(); + localTeamMemberInfo.teamMember = ((TCComponent) localObject6); + localTeamMemberInfo.teamMemberType = ProjectConstants.UNPRIVILEGED; + this.infos.add(localTeamMemberInfo); + } + } else if ((((ProjectTeamContentNode) localObject1).getObject() instanceof TCComponentRole)) { + getProjectTeamForModifyOrCreate(localProjectTeamStatus, this.infos, + (ProjectTeamContentNode) localObject1); + } else { + TeamMemberInfo loc3 = new ProjectLevelSecurity.TeamMemberInfo(); + ((ProjectLevelSecurity.TeamMemberInfo) loc3).teamMember = ((TCComponent) ((ProjectTeamContentNode) localObject1) + .getObject()); + if (((ProjectTeamContentNode) localObject1).getPrivilege() == -1) + ((ProjectLevelSecurity.TeamMemberInfo) loc3).teamMemberType = ProjectConstants.UNPRIVILEGED; + else + ((ProjectLevelSecurity.TeamMemberInfo) loc3).teamMemberType = ((ProjectTeamContentNode) localObject1) + .getPrivilege(); + this.infos.add(loc3); + } + } + } + if (localProjectTeamStatus != null) { + localObject1 = localProjectTeamStatus.getPrivilegedMembers(); + if (!((ArrayList) localObject1).isEmpty()) { + localObject3 = ((ArrayList) localObject1).iterator(); + while (((Iterator) localObject3).hasNext()) { + localObject2 = (TCComponent) ((Iterator) localObject3).next(); + TeamMemberInfo loc4 = new ProjectLevelSecurity.TeamMemberInfo(); + ((ProjectLevelSecurity.TeamMemberInfo) loc4).teamMember = ((TCComponent) localObject2); + ((ProjectLevelSecurity.TeamMemberInfo) loc4).teamMemberType = ProjectConstants.PRIVILEGED; + this.infos.add(loc4); + } + } + localObject2 = localProjectTeamStatus.getProjectTeamAmins(); + if (!((ArrayList) localObject2).isEmpty()) { + localObject4 = ((ArrayList) localObject2).iterator(); + while (((Iterator) localObject4).hasNext()) { + localObject3 = (TCComponent) ((Iterator) localObject4).next(); + TeamMemberInfo loc5 = new ProjectLevelSecurity.TeamMemberInfo(); + ((ProjectLevelSecurity.TeamMemberInfo) loc5).teamMember = ((TCComponent) localObject3); + ((ProjectLevelSecurity.TeamMemberInfo) loc5).teamMemberType = ProjectConstants.TEAMADMIN; + this.infos.add(loc5); + } + } + } + this.infos.trimToSize(); + return (ArrayList) (ArrayList) (ArrayList) (ArrayList) (ArrayList) (ArrayList) this.infos; + } + + private ProjectTeamStatus getPTM(ProjectTeamStatus paramProjectTeamStatus) { + if ((m_projectTeamManager.getRoot() != null) && (m_projectTeamManager.getRoot().getObject() != null) + && ((m_projectTeamManager.getRoot().getObject() instanceof ProjectTeamStatus))) + paramProjectTeamStatus = (ProjectTeamStatus) m_projectTeamManager.getRoot().getObject(); + return paramProjectTeamStatus; + } + + private TreeSet getPTMChildren() { + TreeSet localTreeSet; + if ((m_projectTeamManager.getRoot() != null) && (m_projectTeamManager.getRoot().data != null) + && (m_projectTeamManager.getRoot().data.m_children != null)) + localTreeSet = m_projectTeamManager.getRoot().data.m_children; + else + localTreeSet = null; + return localTreeSet; + } + + public Text getIdText() { + return this.m_idText; + } + + public Text getNameText() { + return this.m_nameText; + } + + public Text getDescriptionText() { + return this.m_descriptionText; + } + + public Button getActiveStatusBtn() { + return this.m_activeStatusBtn; + } + + public ProjectTeamTreeManager getProjectTeamManager() { + return m_projectTeamManager; + } + + private void getProjectTeamForModifyOrCreate(ProjectTeamStatus paramProjectTeamStatus, + ArrayList paramArrayList, + ProjectTeamContentNode paramProjectTeamContentNode) { + if ((paramProjectTeamContentNode != null) + && ((paramProjectTeamContentNode.getObject() instanceof TCComponentRole))) { + TreeSet localTreeSet = paramProjectTeamContentNode.data.m_children; + Iterator localIterator = localTreeSet.iterator(); + while (localIterator.hasNext()) { + ProjectTeamContentNode localProjectTeamContentNode = (ProjectTeamContentNode) localIterator.next(); + TCComponentUser localTCComponentUser = (TCComponentUser) localProjectTeamContentNode.getObject(); + TCComponentGroupMember[] arrayOfTCComponentGroupMember = null; + try { + arrayOfTCComponentGroupMember = localTCComponentUser.getGroupMembers(); + } catch (TCException localTCException) { + logger.error(localTCException.getClass().getName(), localTCException); + } + if (arrayOfTCComponentGroupMember == null) + continue; + TCComponentGroupMember localTCComponentGroupMember = arrayOfTCComponentGroupMember[0]; + if (localTCComponentGroupMember == null) + continue; + ProjectLevelSecurity.TeamMemberInfo localTeamMemberInfo = new ProjectLevelSecurity.TeamMemberInfo(); + localTeamMemberInfo.teamMember = localTCComponentGroupMember; + localTeamMemberInfo.teamMemberType = ProjectConstants.UNPRIVILEGED; + paramArrayList.add(localTeamMemberInfo); + } + } + } + + public Button getCreateButton() { + return this.m_createButton; + } + + public TCComponentProject getProject() { + return this.project; + } + + private void loadPostActionExtension() { + IExtensionPoint localIExtensionPoint = Platform.getExtensionRegistry() + .getExtensionPoint("com.teamcenter.rac.project.ProjectUIPostActions"); + if (localIExtensionPoint != null) { + IExtension[] arrayOfIExtension = localIExtensionPoint.getExtensions(); + if ((arrayOfIExtension != null) && (arrayOfIExtension.length > 0)) { + IConfigurationElement[] arrayOfIConfigurationElement = arrayOfIExtension[0].getConfigurationElements(); + if (arrayOfIConfigurationElement != null) + try { + this.m_contributer = ((ProjectUIPostActions) arrayOfIConfigurationElement[0] + .createExecutableExtension("class")); + } catch (CoreException localCoreException) { + Logger.getLogger(ProjectDefinitionView.class).error(localCoreException.getLocalizedMessage(), + localCoreException); + } + } + } + } + + private class LoadTeamInfoTask implements Runnable { + private ProjectTeamStatus ptm; + private TreeSet children; + + private LoadTeamInfoTask() { + } + + public ProjectTeamStatus getPtm() { + return this.ptm; + } + + public void setPtm(ProjectTeamStatus paramProjectTeamStatus) { + this.ptm = paramProjectTeamStatus; + } + + public TreeSet getChildren() { + return this.children; + } + + public void setChildren(TreeSet paramTreeSet) { + this.children = paramTreeSet; + } + + public void run() { + ProjectDefinitionView.this.getPTM(this.ptm); + ProjectDefinitionView.this.getPTMChildren(); + } + } + + public void initDialog() { + dialog = new JDialog(); + JPanel jpanel = new JPanel(new VerticalLayout(2, 2, 2, 5, 2)); + dialog.getContentPane().add(jpanel); + + JPanel jp = new JPanel(new PropertyLayout()); + + + String[] years = session.getPreferenceService().getStringValues( + "JK_ProjectId_Year"); + String[] types = session.getPreferenceService().getStringValues( + "JK_ProjectId_Type"); + + if (years == null) { + MessageBox.post("ѡ JK_ProjectId_Year ڣϵԱ", "", + MessageBox.ERROR); + return; + } + + if (types == null) { + MessageBox.post("ѡ JK_ProjectId_Type ڣϵԱ", "", + MessageBox.ERROR); + return; + } + + JLabel label2 = new JLabel("ѡݣ"); + box = new iComboBox(); + box.setTextFieldLength(30); + box.setAutoCompleteSuggestive(false); + box.addItems(years); +// TCComponent[] k_comps = this.session.getClassService().findByClass("ListOfValues", "lov_name", "JkYearCode_Lov"); +// this.finishCodeField2 = new LOVComboBox((TCComponentListOfValues) k_comps[0], null); +// this.finishCodeField2.setTextFieldLength(30); + // label2.setIcon(this.registry.getImageIcon("Title3_16.ICON")); + + JLabel imLabel = new JLabel("*"); + imLabel.setForeground(Color.red); + jp.add("1.1.left.center", label2); + jp.add("1.2.left.center", imLabel); + jp.add("1.3.left.center", box); + box.setBounds(150, 80, 200, 24); + + + //ָͶӦǰ׺ID + String[] typeValue=new String[types.length]; + for(int i=0;i"); +// String lsh = ""; +// try { +// +// String JdbcDriverClass = "oracle.jdbc.driver.OracleDriver"; +// String strUrl ="jdbc:oracle:thin:@10.201.5.203:1521:ad15"; +// String strUserName ="adlibrary"; +// String strPassword = "adlibrary"; +// +// Class.forName(JdbcDriverClass); +// Connection conn = DriverManager.getConnection(strUrl, strUserName, +// strPassword);// ݿ +// String car="Create TABLE LSHTABLE( TYPE varchar2(80), ID varchar2(80))"; +// String query = "select type,id from LSHTABLE where TYPE='" + type +// + "' and ID='" + oldId + "'"; +// // ѯidݿе +// String upin = "insert into LSHTABLE(TYPE,ID) values('" + type + "','" +// + oldId + "')"; +// // ݿһidϢ +// Statement stmt = conn.createStatement(); +// //stmt.executeUpdate(car);//ʼ +// ResultSet rs_get = stmt.executeQuery(query);// ѯID +// int rowCount = 0; +// while (rs_get.next()) { +// rowCount++;// ݵ +// } +// stmt.executeUpdate(upin); +// if (rs_get != null) { +// rs_get.close(); +// } +// if (stmt != null) { +// stmt.close(); +// } +// if (conn != null) { +// conn.close(); +// } +// int ls = rowCount + 1;// µˮ +// +// DecimalFormat df=new DecimalFormat(col); +// lsh=df.format(ls); +// +// } catch (SQLException | ClassNotFoundException e) { +// e.printStackTrace(); +// } +// String newId=oldId+lsh; +// return newId; +// +// } +// + + +} \ No newline at end of file