main
熊朝柱 4 weeks ago
commit e2000e883e

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="lib" path="libs/aspose-words-17.4.0-jdk16.jar"/>
<classpathentry exported="true" kind="lib" path="libs/poi-3.17.jar"/>
<classpathentry exported="true" kind="lib" path="libs/poi-examples-3.17.jar"/>
<classpathentry exported="true" kind="lib" path="libs/poi-excelant-3.17.jar"/>
<classpathentry exported="true" kind="lib" path="libs/poi-ooxml-3.17.jar"/>
<classpathentry exported="true" kind="lib" path="libs/poi-ooxml-schemas-3.17.jar"/>
<classpathentry exported="true" kind="lib" path="libs/poi-scratchpad-3.17.jar"/>
<classpathentry exported="true" kind="lib" path="libs/easyexcel-4.0.3.jar"/>
<classpathentry exported="true" kind="lib" path="libs/hutool-all-5.8.25.jar"/>
<classpathentry exported="true" kind="lib" path="libs/axiom-api-1.2.20.jar"/>
<classpathentry exported="true" kind="lib" path="libs/axiom-impl-1.2.20.jar"/>
<classpathentry exported="true" kind="lib" path="libs/axis2-adb-1.7.8.jar"/>
<classpathentry exported="true" kind="lib" path="libs/axis2-kernel-1.7.8.jar"/>
<classpathentry exported="true" kind="lib" path="libs/axis2-transport-base-1.7.8.jar"/>
<classpathentry exported="true" kind="lib" path="libs/axis2-transport-http-1.7.8.jar"/>
<classpathentry exported="true" kind="lib" path="libs/axis2-transport-local-1.7.8.jar"/>
<classpathentry exported="true" kind="lib" path="libs/classes12.jar"/>
<classpathentry exported="true" kind="lib" path="libs/com.kostech.DesignChickList_1.0.0.0.jar"/>
<classpathentry exported="true" kind="lib" path="libs/commons-beanutils-1.7.0.jar"/>
<classpathentry exported="true" kind="lib" path="libs/commons-codec-1.2.jar"/>
<classpathentry exported="true" kind="lib" path="libs/commons-collections-3.2.jar"/>
<classpathentry exported="true" kind="lib" path="libs/commons-httpclient-3.1.jar"/>
<classpathentry exported="true" kind="lib" path="libs/commons-io-2.1.jar"/>
<classpathentry exported="true" kind="lib" path="libs/commons-lang-2.4.jar"/>
<classpathentry exported="true" kind="lib" path="libs/commons-logging-1.1.1.jar"/>
<classpathentry exported="true" kind="lib" path="libs/commons-logging-1.1.jar"/>
<classpathentry exported="true" kind="lib" path="libs/dom4j-1.6.1.jar"/>
<classpathentry exported="true" kind="lib" path="libs/ezmorph-1.0.4.jar"/>
<classpathentry exported="true" kind="lib" path="libs/httpcore-4.4.6.jar"/>
<classpathentry exported="true" kind="lib" path="libs/jdom.jar"/>
<classpathentry exported="true" kind="lib" path="libs/json-lib-2.2.2-jdk15.jar"/>
<classpathentry exported="true" kind="lib" path="libs/json-lib-2.2.3-jdk13.jar"/>
<classpathentry exported="true" kind="lib" path="libs/log4j-1.2.15.jar"/>
<classpathentry exported="true" kind="lib" path="libs/neethi-3.0.3.jar"/>
<classpathentry exported="true" kind="lib" path="libs/ojdbc6.jar"/>
<classpathentry exported="true" kind="lib" path="libs/soap-2.1.jar"/>
<classpathentry exported="true" kind="lib" path="libs/woden-core-1.0M10.jar"/>
<classpathentry exported="true" kind="lib" path="libs/wsdl4j-1.6.2.jar"/>
<classpathentry exported="true" kind="lib" path="libs/xmlbeans-2.5.0.jar"/>
<classpathentry exported="true" kind="lib" path="libs/xmlschema-core-2.2.1.jar"/>
<classpathentry exported="true" kind="lib" path="ojdbc6.jar"/>
<classpathentry exported="true" kind="lib" path="jxl.jar"/>
<classpathentry exported="true" kind="lib" path="sqljdbc4.jar"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="lib" path="Z:/TC_install/YSR/eclipse-workspace/cn.com.ebewin.ysr/libs/jfxrt.jar"/>
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="bin"/>
</classpath>

1
.gitignore vendored

@ -0,0 +1 @@
/bin/

8
.idea/.gitignore vendored

@ -0,0 +1,8 @@
# 默认忽略的文件
/shelf/
/workspace.xml
# 基于编辑器的 HTTP 客户端请求
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/src/cn/com/ebewin/ysr/dialog/SysCatalogRevisionMasterBean.java" charset="GBK" />
<file url="file://$PROJECT_DIR$/src/cn/com/ebewin/ysr/dialog/systemdatadistribution/SystemDataDistributionDialog.java" charset="GBK" />
<file url="file://$PROJECT_DIR$/src/cn/com/ebewin/ysr/dialog/systemdatadistribution/SystemDataDistributionHandler.java" charset="GBK" />
<file url="file://$PROJECT_DIR$/src/cn/com/ebewin/ysr/dialog/systemdatadistribution/SystemDataEntity.java" charset="GBK" />
</component>
</project>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GitToolBoxBlameSettings">
<option name="version" value="2" />
</component>
</project>

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ASMSmaliIdeaPluginConfiguration">
<asm skipDebug="true" skipFrames="true" skipCode="false" expandFrames="false" />
<groovy codeStyle="LEGACY" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_22" default="true" project-jdk-name="openjdk-22" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/classes" />
</component>
</project>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>cn.com.ebewin.ysr</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<filteredResources>
<filter>
<id>1737218542352</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>

@ -0,0 +1,3 @@
eclipse.preferences.version=1
encoding//src/cn/com/ebewin/ysr/dialog/AssignProjectDialog.java=GBK
encoding/<project>=GBK

@ -0,0 +1,26 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
org.eclipse.jdt.core.builder.duplicateResourceTask=warning
org.eclipse.jdt.core.builder.invalidClasspath=abort
org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore
org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
org.eclipse.jdt.core.circularClasspath=error
org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
org.eclipse.jdt.core.classpath.mainOnlyProjectHasTestOnlyDependency=error
org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=error
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.incompatibleJDKLevel=ignore
org.eclipse.jdt.core.incompleteClasspath=error

@ -0,0 +1,3 @@
eclipse.preferences.version=1
org.eclipse.jdt.launching.PREF_COMPILER_COMPLIANCE_DOES_NOT_MATCH_JRE=warning
org.eclipse.jdt.launching.PREF_STRICTLY_COMPATIBLE_JRE_NOT_AVAILABLE=warning

@ -0,0 +1,2 @@
eclipse.preferences.version=1
org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

@ -0,0 +1,133 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: cn.com.ebewin.ysr
Bundle-SymbolicName: cn.com.ebewin.ysr;singleton:=true
Bundle-Version: 1.0.0
Bundle-Vendor: ebewin
Bundle-RequiredExecutionEnvironment: JavaSE-1.7,
JavaSE-1.8
Require-Bundle: org.eclipse.ui;bundle-version="3.8.0",
org.eclipse.core.runtime;bundle-version="3.8.0",
com.teamcenter.rac.aifrcp;bundle-version="11000.2.0",
com.teamcenter.rac.common;bundle-version="11000.2.0",
com.teamcenter.rac.kernel;bundle-version="11000.2.0",
com.teamcenter.rac.tcapps;bundle-version="11000.2.0",
com.teamcenter.rac.util;bundle-version="11000.2.0",
com.teamcenter.rac.external;bundle-version="11000.2.0",
com.teamcenter.rac.ui;bundle-version="11000.2.0",
com.teamcenter.rac.workflow;bundle-version="11000.2.0",
org.apache.poi.39;bundle-version="3.9.0",
com.teamcenter.rac.schedule;bundle-version="11000.2.0",
TcSoaCoreRac;bundle-version="11000.2.0",
TcSoaCoreTypes;bundle-version="11000.2.0",
TcSoaWorkflowRac;bundle-version="11000.2.0",
TcSoaWorkflowTypes;bundle-version="11000.2.0"
Bundle-ClassPath: .,
sqljdbc4.jar,
jxl.jar,
ojdbc6.jar,
libs/axiom-api-1.2.20.jar,
libs/axiom-impl-1.2.20.jar,
libs/axis2-adb-1.7.8.jar,
libs/axis2-kernel-1.7.8.jar,
libs/axis2-transport-base-1.7.8.jar,
libs/axis2-transport-http-1.7.8.jar,
libs/axis2-transport-local-1.7.8.jar,
libs/classes12.jar,
libs/com.kostech.DesignChickList_1.0.0.0.jar,
libs/commons-beanutils-1.7.0.jar,
libs/commons-codec-1.2.jar,
libs/commons-collections-3.2.jar,
libs/commons-httpclient-3.1.jar,
libs/commons-io-2.1.jar,
libs/commons-lang-2.4.jar,
libs/commons-logging-1.1.1.jar,
libs/commons-logging-1.1.jar,
libs/dom4j-1.6.1.jar,
libs/ezmorph-1.0.4.jar,
libs/httpcore-4.4.6.jar,
libs/jdom.jar,
libs/json-lib-2.2.2-jdk15.jar,
libs/json-lib-2.2.3-jdk13.jar,
libs/log4j-1.2.15.jar,
libs/neethi-3.0.3.jar,
libs/ojdbc6.jar,
libs/soap-2.1.jar,
libs/woden-core-1.0M10.jar,
libs/wsdl4j-1.6.2.jar,
libs/xmlbeans-2.5.0.jar,
libs/xmlschema-core-2.2.1.jar,
libs/hutool-all-5.8.25.jar,
libs/easyexcel-4.0.3.jar,
libs/aspose-words-17.4.0-jdk16.jar,
libs/poi-3.17.jar,
libs/poi-examples-3.17.jar,
libs/poi-excelant-3.17.jar,
libs/poi-ooxml-3.17.jar,
libs/poi-ooxml-schemas-3.17.jar,
libs/poi-scratchpad-3.17.jar
Bundle-ActivationPolicy: lazy
Export-Package: cn.com.ebewin.ysr.dialog,
cn.com.ebewin.ysr.dialog.systemdatadistribution,
cn.com.ebewin.ysr.form,
cn.com.ebewin.ysr.handlers,
cn.com.ebewin.ysr.util,
cn.com.ebewin.ysr.view,
com.microsoft.sqlserver.jdbc,
common,
common.log,
jxl,
jxl.biff,
jxl.biff.drawing,
jxl.biff.formula,
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.pooling,
oracle.jdbc.proxy,
oracle.jdbc.proxy.annotation,
oracle.jdbc.replay,
oracle.jdbc.replay.driver,
oracle.jdbc.replay.internal,
oracle.jdbc.rowset,
oracle.jdbc.util,
oracle.jdbc.xa,
oracle.jdbc.xa.client,
oracle.jpub.runtime,
oracle.net.ano,
oracle.net.aso,
oracle.net.jdbc.TNSAddress,
oracle.net.jdbc.nl,
oracle.net.jdbc.nl.mesg,
oracle.net.jndi,
oracle.net.ns,
oracle.net.nt,
oracle.net.resolver,
oracle.security.o3logon,
oracle.security.o5logon,
oracle.sql,
oracle.sql.converter
Import-Package: com.teamcenter.services.internal.rac.projectmanagement._2007_01,
com.teamcenter.services.internal.rac.projectmanagement._2011_06,
com.teamcenter.services.internal.rac.projectmanagement._2014_10,
com.teamcenter.services.rac.projectmanagement,
com.teamcenter.services.rac.projectmanagement._2011_06,
com.teamcenter.services.rac.projectmanagement._2012_02,
com.teamcenter.soa.exceptions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

@ -0,0 +1,51 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
Image/,\
Rendering.xml,\
plugin.xml,\
sqljdbc4.jar,\
jxl.jar,\
ojdbc6.jar,\
libs/axiom-api-1.2.20.jar,\
libs/axiom-impl-1.2.20.jar,\
libs/axis2-adb-1.7.8.jar,\
libs/axis2-kernel-1.7.8.jar,\
libs/axis2-transport-base-1.7.8.jar,\
libs/axis2-transport-http-1.7.8.jar,\
libs/axis2-transport-local-1.7.8.jar,\
libs/classes12.jar,\
libs/com.kostech.DesignChickList_1.0.0.0.jar,\
libs/commons-beanutils-1.7.0.jar,\
libs/commons-codec-1.2.jar,\
libs/commons-collections-3.2.jar,\
libs/commons-httpclient-3.1.jar,\
libs/commons-io-2.1.jar,\
libs/commons-lang-2.4.jar,\
libs/commons-logging-1.1.1.jar,\
libs/commons-logging-1.1.jar,\
libs/dom4j-1.6.1.jar,\
libs/ezmorph-1.0.4.jar,\
libs/httpcore-4.4.6.jar,\
libs/jdom.jar,\
libs/json-lib-2.2.2-jdk15.jar,\
libs/json-lib-2.2.3-jdk13.jar,\
libs/log4j-1.2.15.jar,\
libs/neethi-3.0.3.jar,\
libs/ojdbc6.jar,\
libs/soap-2.1.jar,\
libs/woden-core-1.0M10.jar,\
libs/wsdl4j-1.6.2.jar,\
libs/xmlbeans-2.5.0.jar,\
libs/xmlschema-core-2.2.1.jar,\
libs/hutool-all-5.8.25.jar,\
libs/easyexcel-4.0.3.jar,\
libs/aspose-words-17.4.0-jdk16.jar,\
libs/poi-3.17.jar,\
libs/poi-examples-3.17.jar,\
libs/poi-excelant-3.17.jar,\
libs/poi-ooxml-3.17.jar,\
libs/poi-ooxml-schemas-3.17.jar,\
libs/poi-scratchpad-3.17.jar
jars.compile.order = .

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -0,0 +1,411 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension point="org.eclipse.ui.commands">
<category id="cn.com.ebewin.ysr.ui.commands.category"
description="ebewinYSR命令"
name="cn.com.ebewin.ysr.ui.commands.category">
</category>
<command id="cn.com.ebewin.ysr.ui.commands.MachiningDynamicsManage"
categoryId="cn.com.ebewin.ysr.ui.commands.category"
description="加工动态管理"
name="加工动态管理">
</command>
<command id="cn.com.ebewin.ysr.ui.commands.PipingLinePlanningManagement"
categoryId="cn.com.ebewin.ysr.ui.commands.category"
description="配管线计划管理"
name="配管线计划管理">
</command>
<command id="cn.com.ebewin.ysr.handlers.CustomizationHandler"
categoryId="cn.com.ebewin.ysr.ui.commands.category"
description="定制件看板"
name="定制件看板">
</command>
<command id="cn.com.ebewin.ysr.ui.commands.MaterialPurchasingSearch"
categoryId="cn.com.ebewin.ysr.ui.commands.category"
description="货品采购查询"
name="货品采购查询">
</command>
<command id="cn.com.ebewin.ysr.ui.commands.RectificationPurchasingImport"
categoryId="cn.com.ebewin.ysr.ui.commands.category"
description="整改采购件到货导入"
name="整改采购件到货导入">
</command>
<command id="cn.com.ebewin.ysr.ui.commands.QualityManagementBoard"
categoryId="cn.com.ebewin.ysr.ui.commands.category"
description="质检管理看板"
name="质检管理看板">
</command>
<command id="cn.com.ebewin.ysr.ui.commands.ProblemBoard"
categoryId="cn.com.ebewin.ysr.ui.commands.category"
description="问题综合看板"
name="问题综合看板">
</command>
<command id="cn.com.ebewin.ysr.ui.commands.YSR8_WorkHoursCreate"
categoryId="cn.com.ebewin.ysr.ui.commands.category"
description="项目调试信息统计"
name="工作日报创建">
</command>
<command id="cn.com.ebewin.ysr.ui.commands.YSR8_DebugingInfoDlg"
categoryId="cn.com.ebewin.ysr.ui.commands.category"
description="项目调试信息统计"
name="项目调试信息统计">
</command>
<command id="cn.com.ebewin.ysr.ui.commands.YSR8_TravelORDENCreate"
categoryId="cn.com.ebewin.ysr.ui.commands.category"
description="项目调试信息统计"
name="出差委托单创建">
</command>
<command id="cn.com.ebewin.ysr.ui.commands.YSR8_QERevisionSearchDialog"
categoryId="cn.com.ebewin.ysr.ui.commands.category"
description="报价委托台账"
name="报价委托台账">
</command>
<command id="cn.com.ebewin.ysr.ui.commands.YSR8_TotalContentDialog"
categoryId="cn.com.ebewin.ysr.ui.commands.category"
description="系统总目录台账"
name="系统总目录台账">
</command>
<command id="cn.com.ebewin.ysr.ui.commands.YSR8_PMSBRevisionSearchDialog"
categoryId="cn.com.ebewin.ysr.ui.commands.category"
description="项目管理台账"
name="项目管理台账">
</command>
<command id="cn.com.ebewin.ysr.ui.commands.YSR8_ProjectFormExport"
categoryId="cn.com.ebewin.ysr.ui.commands.category"
description="验收项目台账"
name="验收项目台账">
</command>
<command id="cn.com.ebewin.ysr.ui.commands.KBatchImport"
categoryId="cn.com.ebewin.ysr.ui.commands.category"
description="啦啦啦"
name="啦啦啦">
</command>
<command id="cn.com.ebewin.ysr.ui.commands.ScheduleTaskEdit"
categoryId="cn.com.ebewin.ysr.ui.commands.category"
description="编辑时间表任务属性"
name="编辑属性">
</command>
<command id="cn.com.ebewin.ysr.ui.commands.YSR8_DrawingListCreateDialog" name="图样目录"/>
<command id="AssignProjectHandler" name="指派项目"/>
<command id="cn.com.ebewin.ysr.ui.commands.ktest" name="测试"/>
<command id="cn.com.ebewin.ysr.handlers.YSR8_wysjTimeHandler"
categoryId="cn.com.ebewin.ysr.ui.commands.category"
description="外委设计时间统计看板"
name="外委设计时间统计看板">
</command>
<command id="cn.com.ebewin.ysr.dialog.systemdatadistribution.SystemDataDistributionHandler"
categoryId="cn.com.ebewin.ysr.ui.commands.category"
description="系统资料下发统计看板"
name="系统资料下发统计看板">
</command>
</extension>
<extension
point="org.eclipse.ui.handlers">
<handler class="cn.com.ebewin.ysr.handlers.MachiningDynamicsManageHandler"
commandId="cn.com.ebewin.ysr.ui.commands.MachiningDynamicsManage">
</handler>
<handler class="cn.com.ebewin.ysr.handlers.PipingLinePlanningManagementHandler"
commandId="cn.com.ebewin.ysr.ui.commands.PipingLinePlanningManagement">
</handler>
<handler class="cn.com.ebewin.ysr.handlers.CustomizationHandler"
commandId="cn.com.ebewin.ysr.handlers.CustomizationHandler">
</handler>
<handler class="cn.com.ebewin.ysr.handlers.MaterialPurchasingSearchHandler"
commandId="cn.com.ebewin.ysr.ui.commands.MaterialPurchasingSearch">
</handler>
<handler class="cn.com.ebewin.ysr.handlers.RectificationPurchasingImportHandler"
commandId="cn.com.ebewin.ysr.ui.commands.RectificationPurchasingImport">
</handler>
<handler class="cn.com.ebewin.ysr.handlers.QualityManagementBoardHandler"
commandId="cn.com.ebewin.ysr.ui.commands.QualityManagementBoard">
</handler>
<handler class="cn.com.ebewin.ysr.handlers.ProblemBoardHandler"
commandId="cn.com.ebewin.ysr.ui.commands.ProblemBoard">
</handler>
<handler class="cn.com.ebewin.ysr.handlers.YSR8_WorkHoursCreateHandler"
commandId="cn.com.ebewin.ysr.ui.commands.YSR8_WorkHoursCreate">
</handler>
<handler class="cn.com.ebewin.ysr.handlers.DebugingInfoHandler"
commandId="cn.com.ebewin.ysr.ui.commands.YSR8_DebugingInfoDlg">
</handler>
<handler class="cn.com.ebewin.ysr.handlers.YSR8_TravelORDENCreateHandler"
commandId="cn.com.ebewin.ysr.ui.commands.YSR8_TravelORDENCreate">
</handler>
<handler class="cn.com.ebewin.ysr.handlers.YSR8_TotalContentHandler"
commandId="cn.com.ebewin.ysr.ui.commands.YSR8_TotalContentDialog">
</handler>
<handler class="cn.com.ebewin.ysr.handlers.YSR8_wysjTimeHandler"
commandId="cn.com.ebewin.ysr.handlers.YSR8_wysjTimeHandler">
</handler>
<handler class="cn.com.ebewin.ysr.handlers.PMSBRevisionSearchHandler"
commandId="cn.com.ebewin.ysr.ui.commands.YSR8_PMSBRevisionSearchDialog">
</handler>
<handler class="cn.com.ebewin.ysr.handlers.QERevisionSearchHandler"
commandId="cn.com.ebewin.ysr.ui.commands.YSR8_QERevisionSearchDialog">
</handler>
<handler class="cn.com.ebewin.ysr.handlers.YSR8_DrawingListCreateHandler"
commandId="cn.com.ebewin.ysr.ui.commands.YSR8_DrawingListCreateDialog">
</handler>
<handler class="cn.com.ebewin.ysr.handlers.YSR8_ProjectFormExportHandler"
commandId="cn.com.ebewin.ysr.ui.commands.YSR8_ProjectFormExport">
</handler>
<handler class="cn.com.ebewin.ysr.handlers.KTestHandler"
commandId="cn.com.ebewin.ysr.ui.commands.ktest">
</handler>
<handler class="cn.com.ebewin.ysr.handlers.KBatchImportHandler"
commandId="cn.com.ebewin.ysr.ui.commands.KBatchImport">
</handler>
<handler class="cn.com.ebewin.ysr.dialog.AssignProjectHandler"
commandId="AssignProjectHandler">
</handler>
<handler class="cn.com.ebewin.ysr.handlers.ScheduleTaskEditHandler"
commandId="cn.com.ebewin.ysr.ui.commands.ScheduleTaskEdit">
<activeWhen>
<reference
definitionId="com.teamcenter.rac.schedule.inMainView"/>
</activeWhen>
<enabledWhen>
<and>
<reference definitionId="com.teamcenter.rac.schedule.SelectedTask_ScheduleView"/>
<iterate ifEmpty="false" >
<not>
<or>
<test property="com.teamcenter.rac.kernel.TCComponentScheduleTask.SM_Schedule_Task_Type"
value="6">
</test>
<adapt type="com.teamcenter.rac.kernel.TCComponent">
<and>
<test property="com.teamcenter.rac.kernel.TCComponent.type" value="Fnd0ProxyTask"/>
</and>
</adapt>
</or>
</not>
</iterate>
</and>
</enabledWhen>
</handler>
<handler class="cn.com.ebewin.ysr.dialog.systemdatadistribution.SystemDataDistributionHandler"
commandId="cn.com.ebewin.ysr.dialog.systemdatadistribution.SystemDataDistributionHandler">
</handler>
</extension>
<extension point="org.eclipse.ui.bindings">
<!--<key commandId="cn.com.ebewin.ysr.ui.commands.KBatchImport"
sequence="M3+D"
schemeId="com.teamcenter.rac.scheme">
</key>-->
</extension>
<extension point="org.eclipse.ui.menus">
<menuContribution locationURI="menu:org.eclipse.ui.main.menu?after=additions">
<menu label="项目管理" id="cn.com.ebewin.ysr.ui.menus.ProjectManage">
<separator name="ProjectManageStart" visible="true"></separator>
<separator name="ProjectManageSep1" visible="true"></separator>
<separator name="ProjectManageSep2" visible="true"></separator>
<separator name="ProjectManageSep3" visible="true"></separator>
<!--
<menu label="采购管理" id="cn.com.ebewin.ysr.ui.menus.PurchManage"
<separator name="PurchManageStart" visible="true"></separator>
<separator name="PurchManageEnd" visible="true"></separator>
</menu>
-->
<separator name="ProjectManageSep4" visible="true"></separator>
<!--
<menu label="质量问题管理" id="cn.com.ebewin.ysr.ui.menus.QualityManage"
<separator name="QualityManageStart" visible="true"></separator>
<separator name="QualityManageEnd" visible="true"></separator>
</menu>
-->
<separator name="ProjectManageSep5" visible="true"></separator>
<separator name="ProjectManageEnd" visible="true"></separator>
</menu>
</menuContribution>
<menuContribution locationURI="menu:cn.com.ebewin.ysr.ui.menus.ProjectManage?after=ProjectManageStart">
<command label="加工动态管理" id="cn.com.ebewin.ysr.ui.menus.MachiningDynamicsManage"
commandId="cn.com.ebewin.ysr.ui.commands.MachiningDynamicsManage"
style="push">
</command>
<command label="配管线计划管理" id="cn.com.ebewin.ysr.ui.menus.PipingLinePlanningManagement"
commandId="cn.com.ebewin.ysr.ui.commands.PipingLinePlanningManagement"
style="push">
</command>
<command label="定制件看板" id="cn.com.ebewin.ysr.handlers.CustomizationHandler"
commandId="cn.com.ebewin.ysr.handlers.CustomizationHandler"
style="push">
</command>
<command label="货品采购查询" id="cn.com.ebewin.ysr.ui.menus.MaterialPurchasingSearch"
commandId="cn.com.ebewin.ysr.ui.commands.MaterialPurchasingSearch"
style="push">
</command>
<command label="整改采购件到货导入" id="cn.com.ebewin.ysr.ui.menus.RectificationPurchasingImport"
commandId="cn.com.ebewin.ysr.ui.commands.RectificationPurchasingImport"
style="push">
</command>
</menuContribution>
<menuContribution locationURI="menu:cn.com.ebewin.ysr.ui.menus.ProjectManage?after=ProjectManageSep1">
<command label="质检管理看板" id="cn.com.ebewin.ysr.ui.menus.QualityManagementBoard"
commandId="cn.com.ebewin.ysr.ui.commands.QualityManagementBoard"
style="push">
</command>
</menuContribution>
<menuContribution locationURI="menu:cn.com.ebewin.ysr.ui.menus.ProjectManage?after=ProjectManageSep2">
<command label="问题综合看板" id="cn.com.ebewin.ysr.ui.menus.ProblemBoard"
commandId="cn.com.ebewin.ysr.ui.commands.ProblemBoard"
style="push">
</command>
</menuContribution>
<menuContribution locationURI="menu:cn.com.ebewin.ysr.ui.menus.ProjectManage?after=ProjectManageSep3">
<command label="工作日报创建" id="cn.com.ebewin.ysr.ui.menus.YSR8_WorkHoursCreate"
commandId="cn.com.ebewin.ysr.ui.commands.YSR8_WorkHoursCreate"
style="push">
</command>
<command label="项目调试信息统计" id="cn.com.ebewin.ysr.ui.menus.YSR8_DebugingInfoDlg"
commandId="cn.com.ebewin.ysr.ui.commands.YSR8_DebugingInfoDlg"
style="push">
</command>
<command label="出差委托单创建" id="cn.com.ebewin.ysr.ui.menus.YSR8_TravelORDENCreate"
commandId="cn.com.ebewin.ysr.ui.commands.YSR8_TravelORDENCreate"
style="push">
</command>
</menuContribution>
<menuContribution locationURI="menu:cn.com.ebewin.ysr.ui.menus.ProjectManage?after=ProjectManageSep5">
<command label="系统总目录台账" id="cn.com.ebewin.ysr.ui.commands.YSR8_TotalContentDialog"
commandId="cn.com.ebewin.ysr.ui.commands.YSR8_TotalContentDialog"
style="push">
</command>
<command label="项目管理台账" id="cn.com.ebewin.ysr.ui.menus.YSR8_PMSBRevisionSearchDialog"
commandId="cn.com.ebewin.ysr.ui.commands.YSR8_PMSBRevisionSearchDialog"
style="push">
</command>
<command label="报价委托台账" id="cn.com.ebewin.ysr.ui.menus.YSR8_QERevisionSearchDialog"
commandId="cn.com.ebewin.ysr.ui.commands.YSR8_QERevisionSearchDialog"
style="push">
</command>
<command label="验收项目台账" id="cn.com.ebewin.ysr.ui.commands.YSR8_ProjectFormExportCommand"
commandId="cn.com.ebewin.ysr.ui.commands.YSR8_ProjectFormExport"
style="push">
</command>
<command label="外委设计时间统计看板" id="cn.com.ebewin.ysr.handlers.YSR8_wysjTimeHandler"
commandId="cn.com.ebewin.ysr.handlers.YSR8_wysjTimeHandler"
style="push">
</command>
<command label="系统资料下发统计看板" id="cn.com.ebewin.ysr.dialog.systemdatadistribution.SystemDataDistributionHandler"
commandId="cn.com.ebewin.ysr.dialog.systemdatadistribution.SystemDataDistributionHandler"
style="push">
</command>
</menuContribution>
<menuContribution locationURI="popup:org.eclipse.ui.popup.any?after=additions">
<command label="创建图样目录" id="cn.com.ebewin.ysr.ui.menus.YSR8_DrawingListCreateDialog" commandId="cn.com.ebewin.ysr.ui.commands.YSR8_DrawingListCreateDialog">
<visibleWhen>
<and>
<reference definitionId="com.teamcenter.rac.pse.inMainView"/>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals value="cn.com.ebewin.ysr.ui.menus.YSR8_DrawingListCreateDialog"/>
</iterate>
</not>
</with>
</and>
</visibleWhen>
</command>
<!-- 编辑时间表任务 -->
<command commandId="cn.com.ebewin.ysr.ui.commands.ScheduleTaskEdit" id="popups.ScheduleTaskEdit">
<visibleWhen>
<and>
<reference
definitionId="com.teamcenter.rac.schedule.inMainView">
</reference>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals
value="cn.com.ebewin.ysr.ui.commands.ScheduleTaskEdit"/>
</iterate>
</not>
</with>
</and>
</visibleWhen>
</command>
<command commandId="AssignProjectHandler" id="AssignProjectHandler">
<visibleWhen>
<with variable="rac_command_suppression">
<not>
<iterate operator="or">
<equals
value="AssignProjectHandler"/>
</iterate>
</not>
</with>
</visibleWhen>
</command>
</menuContribution>
</extension>
<extension point="org.eclipse.ui.views">
<view
allowMultiple="false"
class="cn.com.ebewin.ysr.view.ebewinPartView"
icon="icons/sample.gif"
id="ebewinPartView"
name="零部件浏览">
</view>
</extension>
<!--
<extension
point="com.teamcenter.rac.aifrcp.application">
<aif_app_item
id="cn.com.ebewin.ysr.aif_app_item1"
name="name"
perspective_id="com.teamcenter.rac.aifrcp.perspective">
</aif_app_item>
</extension>
<extension
point="org.eclipse.ui.perspectives">
</extension>
-->
</plugin>

Binary file not shown.

@ -0,0 +1,345 @@
/*
#=============================================================================
#
# opyright (c) 2009 Origin Enterprise Solution LTD.
#
#=============================================================================
# File name: CopyFolderAndAssginToProjectDialog.java
# File description:
#=============================================================================
# Date Name Action Description of Change
# 2017-5-10 Administrator Ini
#=============================================================================
*/
package cn.com.ebewin.ysr.dialog;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;
import javax.swing.BorderFactory;
import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTextField;
import javax.swing.ListSelectionModel;
import javax.swing.border.TitledBorder;
import com.teamcenter.rac.aif.AbstractAIFDialog;
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
import com.teamcenter.rac.aifrcp.AIFUtility;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentContextList;
import com.teamcenter.rac.kernel.TCComponentProject;
import com.teamcenter.rac.kernel.TCComponentProjectType;
import com.teamcenter.rac.kernel.TCComponentQuery;
import com.teamcenter.rac.kernel.TCComponentQueryType;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.kernel.TCTextService;
import com.teamcenter.rac.util.ButtonLayout;
import com.teamcenter.rac.util.HorizontalLayout;
import com.teamcenter.rac.util.MessageBox;
import com.teamcenter.rac.util.PropertyLayout;
import com.teamcenter.rac.util.VerticalLayout;
import cn.com.ebewin.ysr.util.TCUtil;
/**
* @author Administrator
*/
//@SuppressWarnings({"rawtypes","unchecked"})
public class AssignProjectDialog extends AbstractAIFDialog {
private static final long serialVersionUID = 1L;
TCSession session;
// AbstractAIFUIApplication app;
// private JList<String> projectList;
// private JList<String> targetList;
private DefaultListModel<String> projectM;
private DefaultListModel<String> targetM;
private JTextField jt2;
private InterfaceAIFComponent[] targets;
public AssignProjectDialog(TCSession pSession, InterfaceAIFComponent[] selectTarget) {
super(AIFUtility.getActiveDesktop(), true); // true
try {
this.session = pSession;
this.targets = selectTarget;
init();
}catch (Exception e) {
e.printStackTrace();
MessageBox.post(AIFUtility.getActiveDesktop(), "错误:"+TCUtil.getStackTrace(e), "错误", MessageBox.ERROR);
}
}
private void init() throws Exception {
setTitle("创建项目资料夹");
// final JPanel jptopleft = new JPanel(new PropertyLayout(2,2,2,2,2,2));
this.projectM = new DefaultListModel<>();
this.targetM = new DefaultListModel<>();
final JPanel jptopleft = new JPanel(new BorderLayout());
final JPanel jptopright = new JPanel(new VerticalLayout());
final TCComponentProjectType tccomponentprojecttype = (TCComponentProjectType) session.getTypeComponent("TC_Project");
final Vector<String> list = new Vector<>();//listPro("*");
if(targets.length==1) {
TCComponent[] projects = ((TCComponent)targets[0]).getReferenceListProperty("project_list");
for(TCComponent p : projects) {
String id = p.getProperty("project_id");
list.add(id);
targetM.addElement(id);
}
}
String user = session.getUser().getUserId();
final Vector<String> projs = new Vector<>();
// Vector<String> prov = new Vector<>();//listDCProjTemplFolder();
//TODO
// String options[] = session.getPreferenceService().getStringValues("Meling_SqlServer");
// Connection connection = SqlUtil.getSqlserverConnection(options[0], options[1], options[2], options[3]);
// List<HashMap<String, Object>> search = SqlUtil.getDBInfo(connection, "select a0.pproject_id as id "
Connection connection = TCUtil.getDBConn(session);
// String sql = "select a0.pproject_id as id "
// + "from PTC_PROJECT a0,PPROJECT_MEMBERS a,PPOM_MEMBER b,PPOM_USER c,PPOM_GROUP d "
// + "where a0.rproject_teamu=a.puid and a.pvalu_0=b.puid and b.ruseru=c.puid and b.rgroupu=d.puid "
// + "and d.pprivilege=1 and a0.pis_visible=1 and c.puser_id='"+user+"'";
String sql = "select distinct a.pproject_id as ID from PTC_PROJECT a,PPOM_MEMBER b,PPOM_USER c "
+ "where a.rproject_teamu=b.rgroupu and b.ruseru=c.puid and a.pis_visible=1 and c.puser_id='"+user+"'";
Vector<Hashtable<String, Object>> search = TCUtil.getDBInfo3Sub(connection, sql);
for(Hashtable<String, Object> t : search) {
String id = t.get("ID").toString();
projs.add(id);
if(!list.contains(id))
projectM.addElement(id);
}
final JList<String> projectList = new JList<String>(projectM);
projectList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
jptopleft.setBorder(BorderFactory.createTitledBorder(null, "供选择的项目", TitledBorder.DEFAULT_JUSTIFICATION,
TitledBorder.DEFAULT_POSITION, new Font("新宋体", 0, 12))); // NOI18N
JScrollPane folderscrollPane = new JScrollPane();
folderscrollPane.setPreferredSize(new Dimension(210,310));
folderscrollPane.getViewport().add(projectList);
jptopleft.add(BorderLayout.CENTER, folderscrollPane);
final JList<String> targetList = new JList<String>(targetM);
jptopright.setBorder(BorderFactory.createTitledBorder(null, "选定的项目", TitledBorder.DEFAULT_JUSTIFICATION,
TitledBorder.DEFAULT_POSITION, new Font("新宋体", 0, 12))); // NOI18N
targetList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
JScrollPane proscrollPane = new JScrollPane(targetList);
proscrollPane.setPreferredSize(new Dimension(210,310));
final JButton addbtn = new JButton(">");
JButton removebtn = new JButton("<");
addbtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent actionevent) {
String select = projectList.getSelectedValue();
if(select==null)
return;
targetM.addElement(select);
projectM.removeElement(select);
addbtn.setEnabled(false);
}
});
removebtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent actionevent) {
String select = targetList.getSelectedValue();
if(select==null)
return;
projectM.addElement(select);
targetM.removeElement(select);
if(targetM.isEmpty())
addbtn.setEnabled(true);
else
addbtn.setEnabled(false);
}
});
if(list.size()>0)
addbtn.setEnabled(false);
JPanel bpane = new JPanel(new PropertyLayout());
bpane.add("1.1.center.center", addbtn);
bpane.add("2.1.center.center", removebtn);
jptopleft.add(BorderLayout.EAST, bpane);
// final JTextField jt = new JTextField(30);
//
// jt.addKeyListener(new KeyAdapter() {
// public void keyReleased(KeyEvent ke) {
// char code = ke.getKeyChar();
// if (code == KeyEvent.VK_ENTER) {
// System.out.println("ceshi 回车" + code + "=====" + KeyEvent.VK_ENTER);
// Vector pronewVector = listPro(jt.getText());
// proList.setListData(pronewVector);
// }
// }
//
// });
// jptopright.add("top.bind.center.top", jt);
jptopright.add("top.bind.center.top", proscrollPane);
JSplitPane splitPane = new JSplitPane();
splitPane.setOneTouchExpandable(true);// 让分割线显示出箭头
splitPane.setContinuousLayout(true);// 操作箭头,重绘图形
splitPane.setLeftComponent(jptopleft);
splitPane.setRightComponent(jptopright);
JPanel jp1 = new JPanel(new HorizontalLayout());
jt2 = new JTextField(20);
JButton screenbtn = new JButton("筛选");
screenbtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent actionevent) {
String text = jt2.getText();
Enumeration<String> e = targetM.elements();
Vector<String> v = new Vector<>();
while(e.hasMoreElements()) {
v.add(e.nextElement());
}
projectM.removeAllElements();
for(String t : projs) {
if(t.contains(text) && !v.contains(t))
projectM.addElement(t);
}
}
});
jt2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent actionevent) {
String text = jt2.getText();
Enumeration<String> e = targetM.elements();
Vector<String> v = new Vector<>();
while(e.hasMoreElements()) {
v.add(e.nextElement());
}
projectM.removeAllElements();
for(String t : projs) {
if((text.isEmpty()||t.contains(text)) && !v.contains(t))
projectM.addElement(t);
}
}
});
jp1.add("left.bind.center.center", new JLabel("项目号筛选"));
jp1.add("unbound.bind.center.center", jt2);
jp1.add("right.bind.center.center", screenbtn);
JPanel butPanel = new JPanel(new ButtonLayout());
JButton okbtn = new JButton("确定");
JButton canceltn = new JButton("取消");
butPanel.add(okbtn);
butPanel.add(canceltn);
canceltn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent actionevent) {
dispose();
}
});
JPanel jpx = new JPanel(new VerticalLayout());
jpx.add("top.bind.center.top", jp1);
jpx.add("top.bind.center.top", splitPane);//jptop
jpx.add("top.bind.center.top", butPanel);
okbtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent actionevent) {
try {
Enumeration<String> e = targetM.elements();
Vector<String> v = new Vector<>();
while(e.hasMoreElements()) {
v.add(e.nextElement());
}
// for(String s : list) {
// if(!v.contains(s)) {
// TCComponentProject ps = listPro(s).get(0);
// tccomponentprojecttype.removeFromProject(ps, new TCComponent[] { targets });
// }
// }
if(v.size()==0) {
for(InterfaceAIFComponent c : targets) {
TCComponent[] projects = ((TCComponent)c).getReferenceListProperty("project_list");
for(TCComponent p : projects) {
tccomponentprojecttype.removeFromProject((TCComponentProject) p, new TCComponent[] { (TCComponent) c });
}
}
MessageBox.post(AIFUtility.getActiveDesktop(), "已从项目中移除!", "提示", MessageBox.INFORMATION);
dispose();
return;
}
TCComponentProject ps = listPro(v.get(0)).get(0);
for(InterfaceAIFComponent c : targets) {
TCComponent[] projects = ((TCComponent)c).getReferenceListProperty("project_list");
for(TCComponent p : projects) {
if(!v.contains(p.getProperty(""))) {
tccomponentprojecttype.removeFromProject((TCComponentProject) p, new TCComponent[] { (TCComponent) c });
}
}
tccomponentprojecttype.assignToProject(ps, (TCComponent) c);
}
MessageBox.post(AIFUtility.getActiveDesktop(), "指派项目完成!", "提示", MessageBox.INFORMATION);
dispose();
} catch (Exception e) {
e.printStackTrace();
MessageBox.post(AssignProjectDialog.this, "错误:"+TCUtil.getStackTrace(e), "错误", MessageBox.ERROR);
}
}
});
add(jpx);
// setResizable(false);
pack();
centerToScreen();
setVisible(true);
}
/**
* listPro:
*/
private Vector<TCComponentProject> listPro(String str_value) {
Vector<TCComponentProject> result = new Vector<TCComponentProject>();
try {
String str_key = "project_id";
TCTextService textService = session.getTextService();
TCComponentQueryType querytype = (TCComponentQueryType) session.getTypeComponent("ImanQuery");
TCComponentQuery query = (TCComponentQuery) querytype.find("项目...");
if (null == query) {
MessageBox.post(AIFUtility.getActiveDesktop(), "请先创建查询构建器 项目... ", "警告", MessageBox.ERROR);
return null;
}
querytype.clearCache();
String as[] = { textService.getTextValue(str_key), textService.getTextValue("is_active")};
// String as[] = { "project_name" };
System.out.println("getTextValue===========" + textService.getTextValue(str_key));
String as1[] = new String[2];
as1[0] = str_value;
as1[1] = "true";
query.clearCache();
TCComponentContextList list = query.getExecuteResultsList(as, as1); // as
// =查询key
// ;
// as1
// =查询value
TCComponentProject tcpro = null;
if (list != null) {
int count = list.getListCount();
System.out.println(" pro coutn " + count);
for (int i = 0; i < count; i++) {
tcpro = (TCComponentProject) list.get(i).getComponent();
result.add(tcpro);
}
}
} catch (Exception e) {
e.printStackTrace();
MessageBox.post(AssignProjectDialog.this, "错误:"+TCUtil.getStackTrace(e), "错误", MessageBox.ERROR);
}
return result;
}
}

@ -0,0 +1,38 @@
package cn.com.ebewin.ysr.dialog;
import javax.swing.SwingUtilities;
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.TCSession;
import com.teamcenter.rac.util.MessageBox;
public class AssignProjectHandler extends AbstractHandler
{
public Object execute(ExecutionEvent arg0) throws ExecutionException
{
AbstractAIFUIApplication app = AIFUtility.getCurrentApplication();
try {
final TCSession session = (TCSession) app.getSession();
final InterfaceAIFComponent[] pasteTargets = app.getTargetComponents();
SwingUtilities.invokeLater(new Runnable() {
public void run() {
new AssignProjectDialog(session, pasteTargets);
}
});
}
catch (Exception exception)
{
exception.printStackTrace();
MessageBox.post(exception, true);
}
return null;
}
}

@ -0,0 +1,25 @@
package cn.com.ebewin.ysr.dialog;
public class ConditionMapper {
private String name;
private String field;
private String type;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getField() {
return field;
}
public void setField(String field) {
this.field = field;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}

@ -0,0 +1,444 @@
package cn.com.ebewin.ysr.dialog;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.Vector;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableRowSorter;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentForm;
import com.teamcenter.rac.kernel.TCComponentItem;
import com.teamcenter.rac.kernel.TCComponentItemType;
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 cn.com.ebewin.ysr.util.DialogUtil;
import cn.com.ebewin.ysr.util.FormUtil;
import cn.com.ebewin.ysr.util.TCUtil;
import cn.com.ebewin.ysr.util.UIUtil.JTableInfo;
import jxl.Workbook;
import jxl.format.Alignment;
import jxl.format.Border;
import jxl.format.BorderLineStyle;
import jxl.format.VerticalAlignment;
import jxl.write.Label;
import jxl.write.WritableCellFormat;
import jxl.write.WritableFont;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import jxl.write.WriteException;
public class CustomizationDialog extends JFrame {
private static final long serialVersionUID = 1L;
DialogUtil fu = new DialogUtil(this, "定制件看板", "YSR8_CustomizationDialog");
TCSession session;
HashMap<String, String> mcslMap = new HashMap<String, String>();//名称 数量map
HashMap<String, ArrayList<String>> tymlMap = new HashMap<String, ArrayList<String>>();//图样目录 map
protected String xmhStr;
public CustomizationDialog(TCSession session) throws TCException {
fu.initializeUI(session);
Comparator<Object> comparator = new Comparator<Object>() {
public int compare(Object arg0, Object arg1) {
try {
int a = Integer.parseInt(arg0.toString());
int b = Integer.parseInt(arg1.toString());
return a - b;
} catch (NumberFormatException e) {
return 0;
}
}
};
// lidy20180824表格可排序且“序号”列按数值大小排序
JTable table = (JTable) fu.allComponentMap.get("a.21.11.11");
JTableInfo ci = (FormUtil.JTableInfo) fu.allComponentInfos.get("a.21.11.11");
final TableRowSorter<DefaultTableModel> sorter = new TableRowSorter<DefaultTableModel>(ci.dataTableModel);
sorter.setComparator(0, comparator);
table.setRowSorter(sorter);
this.setLocationRelativeTo(null);
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
this.session = session;
//loadRendering();
addActionListener();
setVisible(true);
}
// private void loadRendering() throws TCException {}
//
private void addActionListener() {
//查询子项目
JButton btn = (JButton)fu.allComponentMap.get("b.11.12");
btn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JTextField xmhText = (JTextField)fu.allComponentMap.get("XMH");
xmhStr = xmhText.getText();
if(xmhStr == null || xmhStr.isEmpty()) {
MessageBox.post("请填写项目号!","提示",2);
return;
}else {
//查询子项目号
String XTZML = xmhStr+"_XTZML";
TCComponentItem item = null;
try {
TCComponentItemType itemType = (TCComponentItemType) session
.getTypeComponent("Item");
item = itemType.find(XTZML);
TCComponentForm form = TCUtil.getItemRevisionMasterForm(item.getLatestItemRevision());
//获取代号
TCProperty ysr8_ID = form.getTCProperty("ysr8_ID");
String[] Ysr8_IDs = ysr8_ID.getStringArrayValue();
//获取数量
TCProperty ysr8_Quantity = form.getTCProperty("ysr8_Quantity");
double[] ysr8_Quantitys = ysr8_Quantity.getDoubleArrayValue();
JComboBox<String> zxmhCom = (JComboBox<String>)fu.allComponentMap.get("ZXMH");
//清空原来的id号
zxmhCom.removeAllItems();
zxmhCom.setSelectedItem("");
for (int i = 0; i < Ysr8_IDs.length; i++) {
zxmhCom.addItem(Ysr8_IDs[i]);
mcslMap.put(Ysr8_IDs[i], ysr8_Quantitys[i]+"");
}
} catch (Exception e2) {
e2.printStackTrace();
if(item == null) {
MessageBox.post("填写的项目号系统总目录未找到!","提示",2);
}
return;
}
}
}
});
btn = (JButton)fu.allComponentMap.get("b.11.15");
btn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JComboBox<String> zxmhCom = (JComboBox<String>)fu.allComponentMap.get("ZXMH");
String selectZXMH = (String)zxmhCom.getSelectedItem();
if(selectZXMH == null || selectZXMH.isEmpty()) {//查询所有
JTextField xmhText = (JTextField)fu.allComponentMap.get("XMH");
xmhStr = xmhText.getText();
String XTZML = xmhStr+"_XTZML";
TCComponentItem item = null;
String[] Ysr8_IDs= {};
try {
TCComponentItemType itemType = (TCComponentItemType) session
.getTypeComponent("Item");
item = itemType.find(XTZML);
TCComponentForm tymlForm = TCUtil.getItemRevisionMasterForm(item.getLatestItemRevision());
//获取代号
TCProperty ysr8_ID = tymlForm.getTCProperty("ysr8_ID");
Ysr8_IDs = ysr8_ID.getStringArrayValue();
//获取数量
TCProperty ysr8_Quantity = tymlForm.getTCProperty("ysr8_Quantity");
double[] ysr8_Quantitys = ysr8_Quantity.getDoubleArrayValue();
for (int i = 0; i < Ysr8_IDs.length; i++) {
mcslMap.put(Ysr8_IDs[i], ysr8_Quantitys[i]+"");
}
}catch (Exception e1) {
// TODO: handle exception
e1.printStackTrace();
}
//清table
FormUtil.JTableInfo ci = (FormUtil.JTableInfo)fu.allComponentInfos.get("a.21.11.11");
int rowCount = ci.dataTableModel.getRowCount();
for(int i = rowCount - 1; i >= 0; i--){
ci.dataTableModel.removeRow(i);
}
ci.dataTableModel.getDataVector().clear();
for (String key : Ysr8_IDs) {
//查询选择子项目号
//获取 table
System.out.println("111");
try {
//查询图样目录
TCComponentItem tyml= getTYML(key);
//获取表单查询数据
if(tyml != null) {
TCComponentForm form = TCUtil.getItemRevisionMasterForm(tyml.getLatestItemRevision());
//获取件号
TCProperty th = form.getTCProperty("ysr8_Code");
String[] ths = th.getStringArrayValue();
//获取数量
TCProperty sl = form.getTCProperty("ysr8_TotalCount");
String[] sls = sl.getStringArrayValue();
//获取备注
TCProperty bz = form.getTCProperty("ysr8_DrawingRemark");
String[] bzs = bz.getStringArrayValue();
//获取名称
TCProperty mc = form.getTCProperty("ysr8_Name");
String[] mcs = mc.getStringArrayValue();
//获取序号
TCProperty xh = form.getTCProperty("ysr8_SerialNo");
String[] xhs = mc.getStringArrayValue();
//通过备注过滤 不是定制件的
System.out.println("222");
for (int i = 0; i < ths.length; i++) {
if(sls[i] != null && !(sls[i].equals("")) && xhs[i] != null && !(xhs[i].equals("0")) && bzs[i] != null && bzs[i].equals("定制件")) {
Vector<String> vec = new Vector<>();
vec.add(xmhStr);//项目号
vec.add(key);//子项目号
vec.add(ths[i]);//图号
vec.add(mcs[i]);//名称
vec.add(transform(mcslMap.get(key)));//夹具数量
vec.add(transform(sls[i]));//单套数量
vec.add(getTotal(mcslMap.get(key),sls[i]));//总数量 = 单套 * 夹具
vec.add(getGc(ths[i]));//定制件工厂 通过图号查询属性ysr8_DZJCJ,最新版本表单
ci.dataTableModel.addRow(vec);
}
}
}
} catch (Exception e2) {
// TODO: handle exception
e2.printStackTrace();
}
}
}else {//查询选择子项目号
//获取 table
System.out.println("111");
FormUtil.JTableInfo ci = (FormUtil.JTableInfo)fu.allComponentInfos.get("a.21.11.11");
int rowCount = ci.dataTableModel.getRowCount();
for(int i = rowCount - 1; i >= 0; i--){
ci.dataTableModel.removeRow(i);
}
ci.dataTableModel.getDataVector().clear();
try {
//查询图样目录
TCComponentItem tyml= getTYML(selectZXMH);
//获取表单查询数据
if(tyml != null) {
TCComponentForm form = TCUtil.getItemRevisionMasterForm(tyml.getLatestItemRevision());
//获取件号
TCProperty th = form.getTCProperty("ysr8_Code");
String[] ths = th.getStringArrayValue();
//获取数量
TCProperty sl = form.getTCProperty("ysr8_TotalCount");
String[] sls = sl.getStringArrayValue();
//获取备注
TCProperty bz = form.getTCProperty("ysr8_DrawingRemark");
String[] bzs = bz.getStringArrayValue();
//获取名称
TCProperty mc = form.getTCProperty("ysr8_Name");
String[] mcs = mc.getStringArrayValue();
//获取序号
TCProperty xh = form.getTCProperty("ysr8_SerialNo");
String[] xhs = mc.getStringArrayValue();
//通过备注过滤 不是定制件的
System.out.println("222");
for (int i = 0; i < ths.length; i++) {
if(sls[i] != null && !(sls[i].equals("")) && xhs[i] != null && !(xhs[i].equals("0")) && bzs[i] != null && bzs[i].equals("定制件")) {
Vector<String> vec = new Vector<>();
vec.add(xmhStr);//项目号
vec.add(selectZXMH);//子项目号
vec.add(ths[i]);//图号
vec.add(mcs[i]);//名称
vec.add(transform(mcslMap.get(selectZXMH)));//夹具数量
vec.add(transform(sls[i]));//单套数量
vec.add(getTotal(mcslMap.get(selectZXMH),sls[i]));//总数量 = 单套 * 夹具
vec.add(getGc(ths[i]));//定制件工厂 通过图号查询属性ysr8_DZJCJ,最新版本表单
ci.dataTableModel.addRow(vec);
}
}
}
} catch (Exception e2) {
// TODO: handle exception
e2.printStackTrace();
}
}
}
});
btn = (JButton)fu.allComponentMap.get("b.11.16");
btn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
outputERPInfo();
}
});
}
protected String getGc(String string) {
// TODO Auto-generated method stub
String stringProperty="";
try{
TCComponentItemType itemType = (TCComponentItemType) session
.getTypeComponent("Item");
TCComponentItem item = itemType.find(string);
TCComponentForm form = TCUtil.getItemRevisionMasterForm(item.getLatestItemRevision());
stringProperty = form.getStringProperty("ysr8_DZJCJ");
}catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
return stringProperty;
}
//去掉小数点后面的数字
public String transform(String str) {
String intNumber=str;
if(str.contains(".")) {
intNumber = str.substring(0,str.indexOf("."));
}
return intNumber;
}
protected String getTotal(String mc, String jj) {
// TODO Auto-generated method stub
double dMc = Double.parseDouble(mc);
double dJj = Double.parseDouble(jj);
int total = (int)(dMc*dJj);
return total+"";
}
protected TCComponentItem getTYML(String selectZXMH) {
// TODO Auto-generated method stub
//拼接查询id
String id = selectZXMH+"_TM*";
TCComponent[] search;
try {
search = session.search("零组件 ID", new String[] { "零组件 ID" }, new String[] { id });
for (int i = 0; i < search.length; i++) {
TCComponentItem item = (TCComponentItem) search[i];
//TCComponent referenceProperty = item.getLatestItemRevision().getReferenceProperty("release_status_list");
TCComponent[] statuss = item.getLatestItemRevision().getReferenceListProperty("release_status_list");
for (int j = 0; j < statuss.length; j++) {
String status = statuss[j].getStringProperty("name");
//发布状态为 正式下发才行
System.out.println("status==="+status);
System.out.println("id==="+id);
if(status != null && status.equals("YSR8_customY")) {
return item;
}
}
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
private void outputERPInfo() {
final JTable table = (JTable)fu.allComponentMap.get("a.21.11.11");
final JButton btn = (JButton)fu.allComponentMap.get("b.11.16");
btn.setEnabled(false);
final ProgressReporterDialog reporter = new ProgressReporterDialog();
reporter.reportProgressMessage("正在导出,请稍候...");
new Thread(reporter).start();
new Thread() {
public void run() {
try {
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
String time = sdf.format(date);
String toPath = System.getProperty("java.io.tmpdir") + "定制件看板" + time + ".xls";
// 创建一个可写的Workbook
WritableWorkbook writeWorkBook = Workbook.createWorkbook(new File(toPath));
// 创建工作表
WritableSheet wsheet = writeWorkBook.createSheet("定制件看板", 0);
//填写表格
int columnCount = table.getColumnCount(); // 总列数
int rowCount = table.getRowCount(); // 总行数
String[] titles = new String[columnCount]; // 表头
// 获取表头
for (int i = 0; i < columnCount; i++) {
titles[i] = table.getColumnName(i);
}
int current_row = 0; // 初始化当前行作为开始行
try {
// 标题栏样式
WritableFont titleFont = new WritableFont(WritableFont.createFont("宋体"), 13,WritableFont.BOLD);
WritableCellFormat titleCellFormat = new WritableCellFormat(titleFont);
titleCellFormat.setBorder(Border.ALL, BorderLineStyle.MEDIUM);
titleCellFormat.setAlignment(Alignment.CENTRE);
titleCellFormat.setVerticalAlignment(VerticalAlignment.CENTRE);
titleCellFormat.setWrap(true);
// 内容样式
WritableFont contentFont = new WritableFont(WritableFont.createFont("宋体"), 12);
WritableCellFormat contentCellFormat = new WritableCellFormat(contentFont);
contentCellFormat.setBorder(Border.ALL, BorderLineStyle.THIN);
contentCellFormat.setAlignment(Alignment.CENTRE);
contentCellFormat.setVerticalAlignment(VerticalAlignment.CENTRE);
contentCellFormat.setWrap(true);
// 写首行标题
for (int i = 0; i < columnCount; i++) {
Label labelTitle = new Label(i, current_row, titles[i], titleCellFormat);
wsheet.addCell(labelTitle);
}
current_row = current_row + 1;
// 写行数据
for (int i = 0; i < rowCount; i++) {
for (int j = 0; j < columnCount; j++) {
Object objValue = table.getValueAt(i, j);
Label labelContent = new Label(j, i + current_row, String.valueOf(objValue), contentCellFormat);
wsheet.addCell(labelContent);
}
}
// 设置格式
wsheet.getSettings().setDefaultColumnWidth(20);
writeWorkBook.write();
writeWorkBook.close();
} catch (WriteException e) {
e.printStackTrace();
}
// 打开导出的报表文件
Runtime.getRuntime().exec("cmd /c \"" + toPath + "\"");
} catch (IOException e) {
e.printStackTrace();
}
reporter.requestCanceling();
btn.setEnabled(true);
}
}.start();
}
}

@ -0,0 +1,60 @@
package cn.com.ebewin.ysr.dialog;
import javax.swing.*;
import java.awt.event.*;
public class FuzzySearchComboBox extends JComboBox<String> {
private DefaultComboBoxModel<String> model;
private String currentText = "";
private String[] items;
public FuzzySearchComboBox(String[] items) {
super(items);
this.items = items;
model = (DefaultComboBoxModel<String>) getModel();
setEditable(true);
final JTextField textField = (JTextField) getEditor().getEditorComponent();
textField.addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent e) {
currentText = textField.getText();
filterItems(currentText);
}
});
}
private void filterItems(String text) {
String[] filteredItems = new String[items.length];
int count = 0;
for (String item : items) {
if (item.toLowerCase().contains(text.toLowerCase())) {
filteredItems[count++] = item;
}
}
String[] finalFilteredItems = new String[count];
System.arraycopy(filteredItems, 0, finalFilteredItems, 0, count);
model.removeAllElements();
for (String item : finalFilteredItems) {
model.addElement(item);
}
if (finalFilteredItems.length > 0) {
setSelectedItem(finalFilteredItems[0]);
}
}
// public static void main(String[] args) {
// String[] items = {"Apple", "Banana", "Cherry", "Date", "Elderberry", "Fig", "Grape"};
// JFrame frame = new JFrame("Fuzzy Search ComboBox Example");
// frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// frame.setSize(300, 200);
// frame.setLayout(new java.awt.FlowLayout());
//
// FuzzySearchComboBox comboBox = new FuzzySearchComboBox(items);
// frame.add(comboBox);
//
// frame.setVisible(true);
// }
}

@ -0,0 +1,152 @@
package cn.com.ebewin.ysr.dialog;
import java.io.File;
import com.teamcenter.rac.kernel.TCComponentDataset;
public class KBatchImportBean {
private TCComponentDataset dataset;
private boolean isSelected;
private boolean isDuplicate;
private String filePath;
private String fileName;
KBatchImportBean(File file) {
this.filePath = file.getAbsolutePath();
int index=filePath.lastIndexOf("\\");
if(index>0) {
this.fileName=filePath.substring(index+1);
}else {
this.fileName=filePath;
}
this.isSelected = true;
}
public void setSelected(boolean isSelected) {
this.isSelected = isSelected;
}
public boolean isSelected() {
return this.isSelected;
}
public boolean isDuplicated(String filePath) {
if(this.filePath.equals(filePath)) {
return true;
}
return false;
}
public void resetDuplicate() {
this.isDuplicate=false;
}
public TCComponentDataset getDataset() {
return this.dataset;
}
public boolean isDupicated() {
return this.isDuplicate;
}
public String getFileName() {
return this.fileName;
}
public String getPath() {
return this.filePath;
}
/*private File[] getFiles() throws Exception {
File[] files = dataset.getFiles("");
if (files == null || files.length == 0) {
throw new Exception("数据集 “" + dataset + "” 文件不存在");
}
return files;
}*/
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof KBatchImportBean) {
KBatchImportBean bean = (KBatchImportBean) obj;
return bean.fileName.equals(this.fileName);
}
return false;
}
@Override
public String toString() {
return this.fileName;
}
public void download(String path) throws Exception {
/*for (File file : this.files) {
download(file, path);
}*/
}
/**
*
*
* @param targetFile
*
* @param path
*
* @return truefalse
*/
@SuppressWarnings("unused")
private File download(File targetFile, String path) throws Exception {
return null;
/*String fileName=targetFile.getName();
int length = 2097152;
path = path + "\\";
if (!new File(path).isDirectory()) {
if (new File(path).mkdirs()) {
System.out.println("创建路径成功:" + path);
} else {
System.out.println("创建路径失败:" + path);
throw new TCException("创建路径失败:" + path);
}
}
String outPath = path + fileName;
int i = 1;
int indexOfDot = outPath.lastIndexOf(".");
if(isDuplicated(fileName)) {
outPath = outPath.substring(0, indexOfDot) + "-[" + this.uid + "]" + outPath.substring(indexOfDot);
}
String overridePath = outPath;
indexOfDot = overridePath.lastIndexOf(".");
while (new File(overridePath).exists()) {
overridePath = outPath.substring(0, indexOfDot) + "-(" + (i++) + ")" + outPath.substring(indexOfDot);
}
outPath=overridePath;
FileOutputStream out = new FileOutputStream(outPath);
FileInputStream in = new FileInputStream(targetFile);
byte[] buffer = new byte[length];
while (true) {
int ins = in.read(buffer);
if (ins == -1) {
in.close();
out.flush();
out.close();
return new File(outPath);
} else
out.write(buffer, 0, ins);
}*/
}
/*public static void main(String[] args) {
String outPath = "C:\\test\\1.txt";
String overridePath = outPath;
int i = 1;
int indexOfDot = outPath.lastIndexOf(".");
overridePath = outPath.substring(0, indexOfDot) + "(" + (i++) + ")" + outPath.substring(indexOfDot);
overridePath = outPath.substring(0, indexOfDot) + "(" + (i++) + ")" + outPath.substring(indexOfDot);
overridePath = outPath.substring(0, indexOfDot) + "(" + (i++) + ")" + outPath.substring(indexOfDot);
System.out.println(overridePath);
}*/
}

@ -0,0 +1,168 @@
package cn.com.ebewin.ysr.dialog;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import java.io.File;
import java.util.LinkedHashMap;
import java.util.Map;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFileChooser;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.ListCellRenderer;
import javax.swing.ListSelectionModel;
import javax.swing.filechooser.FileSystemView;
import com.teamcenter.rac.aif.AbstractAIFDialog;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.util.FileFilter;
import com.teamcenter.rac.util.MessageBox;
public class KBatchImportDialog extends AbstractAIFDialog {
private static final long serialVersionUID = 2009624329447981859L;
// private TCSession session;
public KBatchImportDialog(TCSession session) {
super(false);
// this.session=session;
}
@Override
public void run() {
FileSystemView fsv=FileSystemView.getFileSystemView();
String deskPath=fsv.getHomeDirectory().getPath();
JFileChooser fileChooser = new JFileChooser();
fileChooser.setCurrentDirectory(new File(deskPath));
fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
int state=fileChooser.showOpenDialog(this);
if(state==1) {
return;
}else {
File folder = fileChooser.getSelectedFile();
System.out.println("选择路径:"+folder.getAbsolutePath());
String[] filters=new String[] {"*.xlsx","*.txt"};
Map<String, File[]> fileMap=readFiles(folder,filters);
if(fileMap!=null&&fileMap.size()>0) {
initUI(fileMap);
}else {
MessageBox.post("该路径下没有找到xxx文件","提示",MessageBox.INFORMATION);
}
}
}
private void initUI(Map<String, File[]> fileMap) {
this.setTitle("导入文件");
this.setPreferredSize(new Dimension(500, 300));
this.setLayout(new BorderLayout());
JTabbedPane tabPane=new JTabbedPane(JTabbedPane.LEFT);
JPanel btnPanel=new JPanel(new FlowLayout(FlowLayout.CENTER,15,3));
GridBagConstraints s=new GridBagConstraints();
s.gridwidth=1;
s.gridheight=1;
s.gridx=0;
s.gridy=0;
s.weightx=1;
s.weighty=1;
s.insets=new Insets(5, 5, 0, 5);
//主界面
for (String filter : fileMap.keySet()) {
JPanel aPanel=new JPanel(new BorderLayout());
tabPane.add(filter, aPanel);
JList<KBatchImportBean> fileList = new JList<>();
fileList.setPreferredSize(new Dimension(200, 200));
//mainPanel.add(new JCheckBox(filter),s);
//s.gridy++;
File[] files = fileMap.get(filter);
int len=files.length;
KBatchImportBean[] listData=new KBatchImportBean[len];
for(int i=0;i<len;i++) {
listData[i]=new KBatchImportBean(files[i]);
}
fileList.setListData(listData);
fileList.setCellRenderer(new CheckBoxRenderer());
fileList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
JScrollPane scroll = new JScrollPane(fileList);
scroll.setBackground(Color.WHITE);
scroll.setBorder(BorderFactory.createEmptyBorder(5,10,5,0));
aPanel.add(BorderLayout.CENTER,scroll);
}
//按钮
JButton okBtn = new JButton("导入");
JButton celBtn = new JButton("取消");
btnPanel.add(okBtn);
btnPanel.add(celBtn);
this.add(BorderLayout.CENTER,tabPane);
this.add(BorderLayout.SOUTH,btnPanel);
this.showDialog();
}
/**
*
* @param folder
* @param filters *.xlsx
* @return
*/
private Map<String,File[]> readFiles(File folder,String[] filters) {
Map<String,File[]> result=new LinkedHashMap<>();
if(folder!=null&&folder.isDirectory()) {
for (String filter : filters) {
File[] files = folder.listFiles(new FileFilter(filter));
if(files.length>0) {
result.put(filter,files);
}
}
}
return result;
}
/* 在JList显示复选框 */
@SuppressWarnings("serial")
class CheckBoxRenderer extends JCheckBox implements ListCellRenderer<KBatchImportBean> {
CheckBoxRenderer() {
}
public Component getListCellRendererComponent(JList<? extends KBatchImportBean> listBox, KBatchImportBean obj, int currentindex, boolean isChecked, boolean hasFocus) {
setSelected(obj.isSelected());
if (isChecked) {
setForeground(Color.WHITE);
setBackground(new Color(51, 153, 255));
if (obj.isDupicated()) {
setText(obj.toString() + "---文件名重复:路径“" + obj.getPath() + "”");
} else {
setText(obj.toString());
}
} else {
setBackground(Color.WHITE);
if (obj.isDupicated()) {
setForeground(new Color(51, 103, 205));
setText(obj.toString() + "---文件名重复:路径“" + obj.getPath() + "”");
} else {
setForeground(Color.BLACK);
setText(obj.toString());
}
}
return this;
}
}
}

@ -0,0 +1,124 @@
package cn.com.ebewin.ysr.dialog;
import java.awt.Color;
import java.awt.Component;
import javax.swing.JTable;
import cn.com.ebewin.ysr.util.TableColorRender;
public class MachiningDynamicsColorRender extends TableColorRender {
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
Component renderer = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
if(isSelected)
renderer.setBackground(Color.BLUE);
else if(getTableVal(table, row, MachiningDynamicsManageDialog.BJ6).startsWith("×·¼ÓÌæ»»"))
return renderer;
else if(getTableVal(table, row, MachiningDynamicsManageDialog.BJ21).equals("ºÏ¸ñ"))
renderer.setBackground(Color.GREEN);
else if(getTableVal(table, row, MachiningDynamicsManageDialog.BJ22).equals("ºÏ¸ñ"))
renderer.setBackground(Color.GREEN);
/*if (column == 15) {
String ysr8_TechPlanDateVal = table.getValueAt(row, 15).toString();
String ysr8_TechFinishDateVal = table.getValueAt(row, 16).toString();
if (!ysr8_TechFinishDateVal.equals("-") && !ysr8_TechPlanDateVal.equals("-")) {
int nday = CommonUtil.getDaysBetween(ysr8_TechPlanDateVal, ysr8_TechFinishDateVal);
System.out.println("ysr8_TechFinishDateVal-ysr8_TechPlanDateVal====" + ysr8_TechFinishDateVal + "====" +
ysr8_TechPlanDateVal + "====" + nday);
if (nday > 0) {
renderer.setBackground(Color.RED);
}
} else {
if (ysr8_TechPlanDateVal.equals("-")) {
//renderer.setBackground(Color.RED);
} else {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String currDate = sdf.format(new Date());
int nday = CommonUtil.getDaysBetween(ysr8_TechPlanDateVal, currDate);
System.out.println("currDate-ysr8_TechPlanDateVal====" + currDate + "====" + ysr8_TechPlanDateVal + "====" + nday);
if (nday > 0) {
renderer.setBackground(Color.RED);
}
}
}
} else if (column == 18) {
String ysr8_PurchPlanDateVal = table.getValueAt(row, 18).toString();
String ysr8_PurchFinishDateVal = table.getValueAt(row, 19).toString();
if (!ysr8_PurchPlanDateVal.equals("-") && !ysr8_PurchFinishDateVal.equals("-")) {
int nday = CommonUtil.getDaysBetween(ysr8_PurchPlanDateVal, ysr8_PurchFinishDateVal);
System.out.println("ysr8_PurchFinishDateVal-ysr8_PurchPlanDateVal====" + ysr8_PurchFinishDateVal + "====" +
ysr8_PurchPlanDateVal + "====" + nday);
if (nday > 0) {
renderer.setBackground(Color.RED);
}
} else {
if (ysr8_PurchPlanDateVal.equals("-")) {
//renderer.setBackground(Color.RED);
} else {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String currDate = sdf.format(new Date());
int nday = CommonUtil.getDaysBetween(ysr8_PurchPlanDateVal, currDate);
System.out.println("currDate-ysr8_PurchPlanDateVal====" + currDate + "====" + ysr8_PurchPlanDateVal + "====" + nday);
if (nday > 0) {
renderer.setBackground(Color.RED);
}
}
}
} else if (column == 21) {
String ysr8_MachinPlanDateVal = table.getValueAt(row, 21).toString();
String ysr8_PurchFinishDate2Val = table.getValueAt(row, 22).toString();
if (!ysr8_MachinPlanDateVal.equals("-") && !ysr8_PurchFinishDate2Val.equals("-")) {
int nday = CommonUtil.getDaysBetween(ysr8_MachinPlanDateVal, ysr8_PurchFinishDate2Val);
System.out.println("ysr8_PurchFinishDateVal-ysr8_MachinPlanDateVal====" + ysr8_PurchFinishDate2Val + "====" +
ysr8_MachinPlanDateVal + "====" + nday);
if (nday > 0) {
renderer.setBackground(Color.RED);
}
} else {
if (ysr8_MachinPlanDateVal.equals("-")) {
//renderer.setBackground(Color.RED);
} else {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String currDate = sdf.format(new Date());
int nday = CommonUtil.getDaysBetween(ysr8_MachinPlanDateVal, currDate);
System.out.println("currDate-ysr8_PurchPlanDateVal====" + currDate + "====" + ysr8_MachinPlanDateVal + "====" + nday);
if (nday > 0) {
renderer.setBackground(Color.RED);
}
}
}
} else if (column == 25) {
String ysr8_EnginePlanDateVal = table.getValueAt(row, 25).toString();
String ysr8_FinishDateVal = table.getValueAt(row, 26).toString();
if (!ysr8_EnginePlanDateVal.equals("-") && !ysr8_FinishDateVal.equals("-")) {
int nday = CommonUtil.getDaysBetween(ysr8_EnginePlanDateVal, ysr8_FinishDateVal);
System.out.println("ysr8_PurchFinishDateVal-ysr8_EnginePlanDateVal====" + ysr8_FinishDateVal + "====" +
ysr8_EnginePlanDateVal + "====" + nday);
if (nday > 0) {
renderer.setBackground(Color.RED);
}
} else {
if (ysr8_EnginePlanDateVal.equals("-")) {
//renderer.setBackground(Color.RED);
} else {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String currDate = sdf.format(new Date());
int nday = CommonUtil.getDaysBetween(ysr8_EnginePlanDateVal, currDate);
System.out.println("currDate-ysr8_PurchPlanDateVal====" + currDate + "====" + ysr8_EnginePlanDateVal + "====" + nday);
if (nday > 0) {
renderer.setBackground(Color.RED);
}
}
}
}*/
return renderer;
}
private String getTableVal(JTable table, int row, int col) {
Object o = table.getValueAt(row, col);
if(o == null)
return "";
else
return o.toString();
}
}

@ -0,0 +1,135 @@
package cn.com.ebewin.ysr.dialog;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
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 javax.swing.JTextField;
import com.teamcenter.rac.aif.AbstractAIFDialog;
import com.teamcenter.rac.kernel.TCComponentForm;
import com.teamcenter.rac.kernel.TCComponentItem;
import com.teamcenter.rac.kernel.TCUserService;
import com.teamcenter.rac.util.DateButton;
import com.teamcenter.rac.util.MessageBox;
import com.teamcenter.rac.util.PropertyLayout;
import cn.com.ebewin.ysr.dialog.MachiningDynamicsManageDialog.EditObjectInfo;
import cn.com.ebewin.ysr.util.KUtil;
import cn.com.ebewin.ysr.util.TCUtil;
@SuppressWarnings("deprecation")
public class MachiningDynamicsExWarehouseDialog extends AbstractAIFDialog {
private static final long serialVersionUID = 1L;
private JButton okBtn;
private JButton cancelBtn;
private JTextField person;
private DateButton date;
public MachiningDynamicsExWarehouseDialog(MachiningDynamicsManageDialog mdm, EditObjectInfo editObjectInfo) throws Exception {
super(mdm);
setTitle("出库信息");
JPanel propPanel = new JPanel(new PropertyLayout(70, 20, 10, 5, 20, 5));
// TCComponentListOfValues[] lov = lovType.find("ML8_ProjectCategory_LOV");
// String[] vals = getDynamicLOV(lov[0]);
// System.out.println("ML8_ProjectCategory_LOV:"+lov[0].getType()+"=="+vals.length);
JLabel label1 = new JLabel(" 出库日期");
propPanel.add("1.1.left.center", label1);
date = new DateButton(null, "yyyy-MM-dd", false, false, false);
date.setPreferredSize(new Dimension(150, 23));
date.setDate(new Date());
propPanel.add("1.2.left.center", date);
JLabel label2 = new JLabel(" 领料人");
propPanel.add("2.1.left.center", label2);
person = new JTextField();
person.setPreferredSize(new Dimension(150, 23));
propPanel.add("2.2.left.center", person);
okBtn = new JButton("确定");
cancelBtn = new JButton("取消");
JPanel btnPanel = new JPanel(new FlowLayout());
btnPanel.add(okBtn);
btnPanel.add(cancelBtn);
setLayout(new BorderLayout());
add(BorderLayout.CENTER, propPanel);
add(BorderLayout.SOUTH, btnPanel);
// add(new JLabel(""));
addActionListener(mdm, editObjectInfo);
pack();
setSize(new Dimension(370, 180));
setDefaultLookAndFeelDecorated(true);
Dimension screen = getToolkit().getScreenSize();
setLocation((screen.width - getSize().width) / 2, (screen.height - getSize().height) / 2);
// setAlwaysOnTop(true);
setVisible(true);
}
private void addActionListener(final MachiningDynamicsManageDialog mdm, final EditObjectInfo editObjectInfo) {
okBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
try {
String ysr8_ExWarehousePerson = person.getText();
Date ysr8_ExWarehouseDate = date.getDate();
if(ysr8_ExWarehousePerson.isEmpty() || ysr8_ExWarehouseDate==null)
throw new Exception("有属性未填写,请检查");
String keys = "ysr8_ExWarehousePerson@@@@ysr8_ExWarehouseDate@@@@ysr8_ExWarehouseState@@@@ysr8_ExWarehouseQuantity",
date1 = getDateTimeString2(ysr8_ExWarehouseDate), date2 = String.format("%tF", ysr8_ExWarehouseDate);
for(int i=0; i<editObjectInfo.editObjects.size(); i++) {
TCComponentItem item = (TCComponentItem) editObjectInfo.editObjects.get(i);
TCComponentForm form = TCUtil.getItemRevisionMasterForm(item.getLatestItemRevision());
StringBuilder vals = new StringBuilder(""), params = new StringBuilder("");
int n = editObjectInfo.editObjectListIdxs.get(i);
vals.append(n).append("$$$$").append(ysr8_ExWarehousePerson).append("@@@@")
.append(n).append("$$$$").append(date1).append("@@@@").append(n).append("$$$$").append("2").append("@@@@")
.append(n).append("$$$$").append(editObjectInfo.editObjectQuantity.get(i));
KUtil.setNewArrayProperty(form);
params.append(item.getProperty("item_id")).append("^^^^").append(keys).append("^^^^").append(vals.toString());
TCUserService userService = mdm.fu.session.getUserService();
Object[] objParams = new Object[2];
String cmd = "Update_ItemRevForm_TCProperty";
objParams[0] = cmd;
objParams[1] = params.toString();
System.out.println(objParams[1]);
long startime = System.currentTimeMillis();
String result = (String) userService.call("YSR8UserService", objParams);
long endtime = System.currentTimeMillis();
System.out.println(item.getProperty("item_id") + " " + editObjectInfo.editObjectMaterialID.get(i)
+ " 调用C耗时" + (endtime - startime) + "毫秒 " + result);
Thread.sleep(1000);
form.refresh();
mdm.updateExWarehouseValue(ysr8_ExWarehousePerson, date2, editObjectInfo.rows.get(i), false);
}
dispose();
}catch(Exception e1) {
e1.printStackTrace();
MessageBox.post(MachiningDynamicsExWarehouseDialog.this, "错误:"+e1.getMessage(), "ERROR", MessageBox.ERROR);
}
}
});
cancelBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
dispose();
}
});
}
private String getDateTimeString2(Date date) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss");
if (date != null) {
return sdf.format(date);
}
return "";
}
}

@ -0,0 +1,306 @@
package cn.com.ebewin.ysr.dialog;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.HashMap;
import java.util.Map.Entry;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import com.teamcenter.rac.aif.AbstractAIFDialog;
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.TCProperty;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.kernel.TCUserService;
import com.teamcenter.rac.util.MessageBox;
import cn.com.ebewin.ysr.dialog.MachiningDynamicsManageDialog.EditObjectInfo;
import cn.com.ebewin.ysr.util.TCUtil;
@SuppressWarnings("deprecation")
public class MachiningDynamicsRemarkDialog extends AbstractAIFDialog {
private static final long serialVersionUID = 5789155622890673496L;
private JTextArea remarkArea;
private JButton okBtn;
private JButton celBtn;
private TCSession session;
private int currTable;
private EditObjectInfo editObjectInfo;
public boolean isChanged = false;
public String remark = "";
private MachiningDynamicsManageDialog mdm;
public MachiningDynamicsRemarkDialog(MachiningDynamicsManageDialog mdm, int currTable, EditObjectInfo editObjectInfo) {
super(true);
this.mdm = mdm;
this.session = mdm.fu.session;
this.currTable = currTable;
this.editObjectInfo = editObjectInfo;
}
public void editRemark() throws Exception {
initUI();
}
private void initUI() throws Exception {
this.remark = getRemark();
if(this.remark==null) {
this.remark="";
}
this.setTitle("编辑备注");
this.setLayout(new BorderLayout());
this.setPreferredSize(new Dimension(300, 250));
JPanel mainPanel = new JPanel(new GridBagLayout());
GridBagConstraints s = new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0);
mainPanel.add(new JLabel("备注:"), s);
s.gridy++;
remarkArea = new JTextArea();
remarkArea.setText(remark);
JScrollPane scroll = new JScrollPane(remarkArea);
s.weightx = 1;
s.weighty = 1;
s.insets = new Insets(0, 5, 0, 5);
mainPanel.add(scroll, s);
JPanel btnPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 15, 5));
okBtn = new JButton("确定");
celBtn = new JButton("取消");
okBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
try {
saveRemark();
} catch (Exception e) {
MessageBox.post(MachiningDynamicsRemarkDialog.this, e.toString(), "保存时出错", MessageBox.ERROR);
e.printStackTrace();
}
}
});
celBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
disposeDialog();
}
});
btnPanel.add(okBtn);
btnPanel.add(celBtn);
this.add(BorderLayout.CENTER, mainPanel);
this.add(BorderLayout.SOUTH, btnPanel);
this.showDialog();
}
protected void saveRemark() throws Exception {
String remark = remarkArea.getText();
HashMap<String, String> valMap = new HashMap<String, String>();
if (currTable == 1) {
for(int i=0; i<editObjectInfo.editObjects.size(); i++) {
if (editObjectInfo.editObjects.get(i) instanceof TCComponentScheduleTask) {
TCComponentScheduleTask scheduTask = (TCComponentScheduleTask) editObjectInfo.editObjects.get(i);
scheduTask.setStringProperty("ysr8_PurchRemark", remark);
} else if (editObjectInfo.editObjects.get(i) instanceof TCComponentItem) {
TCComponentItem item = (TCComponentItem) editObjectInfo.editObjects.get(i);
TCComponentItemRevision revision = item.getLatestItemRevision();
TCComponentForm form = TCUtil.getItemRevisionMasterForm(revision);
String object_typeVal = item.getProperty("object_type");
if (object_typeVal.equals("图样目录")) {
valMap.put("ysr8_PurchRemark", remark);
}
String params = "", proName = "", proVal = "";
if (object_typeVal.equals("图样目录")) {
for (Entry<String, String> entry : valMap.entrySet()) {
String key1 = entry.getKey();
if (proName.equals("")) {
proName = key1;
} else {
proName += "@@@@" + key1;
}
String key2 = entry.getValue();
if (proVal.equals("")) {
proVal = key2;
} else {
proVal += "@@@@" + key2;
}
}
}
params = item.getProperty("item_id") + "^^^^" + proName + "^^^^" + proVal;
TCUserService userService = this.session.getUserService();
Object[] objParams = new Object[2];
String cmd = "Update_ItemRevForm_TCProperty";
objParams[0] = cmd;
objParams[1] = params;
long startime = System.currentTimeMillis();
String result = (String) userService.call("YSR8UserService", objParams);
long endtime = System.currentTimeMillis();
System.out.println("调用C耗时" + (endtime - startime) + "毫秒");
System.out.println(result);
form.refresh();
}
}
} else if (currTable == 2) {
for (int i = 0; i < editObjectInfo.editObjects.size(); i++) {
Object editObject = editObjectInfo.editObjects.get(i);
if (editObject instanceof TCComponentItem) {
TCComponentItem item = (TCComponentItem) editObject;
TCComponentItemRevision revision = item.getLatestItemRevision();
TCComponentForm form = TCUtil.getItemRevisionMasterForm(revision);
String object_typeVal = item.getProperty("object_type");
if (object_typeVal.equals("图纸整改单")) {
valMap.put("ysr8_PurchRemark", remark);
} else if (object_typeVal.equals("调试整改加工单")) {
valMap.put("ysr8_PurchRemark", remark);
} else if (object_typeVal.equals("散部件检验记录")) {
valMap.put("ysr8_PurchRemark", remark);
}
String params = "", proName = "", proVal = "";
if (object_typeVal.equals("图纸整改单")) {
for (Entry<String, String> entry : valMap.entrySet()) {
String key1 = entry.getKey();
if (proName.equals("")) {
proName = key1;
} else {
proName += "@@@@" + key1;
}
String key2 = entry.getValue();
if (key1.equals("ysr8_SubManuFactory1") || key1.equals("ysr8_SubManuFactory2") || key1.equals("ysr8_SubPurchPlanDate") || key1.equals("ysr8_DrawingReleaseDate")
|| key1.equals("ysr8_SubPurchFinishDate") || key1.equals("ysr8_SubTaskManuState")||key1.equals("ysr8_PurchRemark")) {
key2 = Integer.toString(editObjectInfo.editObjectListIdxs.get(i)) + "$$$$" + key2;
}
if (proVal.equals("")) {
proVal = key2;
} else {
proVal += "@@@@" + key2;
}
}
} else if (object_typeVal.equals("调试整改加工单")) {
for (Entry<String, String> entry : valMap.entrySet()) {
String key1 = entry.getKey();
if (proName.equals("")) {
proName = key1;
} else {
proName += "@@@@" + key1;
}
String key2 = entry.getValue();
if (key1.equals("ysr8_SubManuFactory1") || key1.equals("ysr8_SubManuFactory2") || key1.equals("ysr8_SubPurchPlanDate") || key1.equals("ysr8_DrawingReleaseDate")
|| key1.equals("ysr8_SubPurchFinishDate") || key1.equals("ysr8_SubTaskManuState")||key1.equals("ysr8_PurchRemark")) {
key2 = Integer.toString(editObjectInfo.editObjectListIdxs.get(i)) + "$$$$" + key2;
}
if (proVal.equals("")) {
proVal = key2;
} else {
proVal += "@@@@" + key2;
}
}
} else if (object_typeVal.equals("散部件检验记录")) {
for (Entry<String, String> entry : valMap.entrySet()) {
String key1 = entry.getKey();
if (proName.equals("")) {
proName = key1;
} else {
proName += "@@@@" + key1;
}
String key2 = entry.getValue();
if (key1.equals("ysr8_PurchPlanDate1") || key1.equals("ysr8_DrawingReleaseDate") || key1.equals("ysr8_SubPurchFinishDate") || key1.equals("ysr8_SubTaskManuState")||key1.equals("ysr8_PurchRemark")) {
key2 = Integer.toString(editObjectInfo.editObjectListIdxs.get(i)) + "$$$$" + key2;
}
if (proVal.equals("")) {
proVal = key2;
} else {
proVal += "@@@@" + key2;
}
}
}
params = item.getProperty("item_id") + "^^^^" + proName + "^^^^" + proVal;
TCUserService userService = this.session.getUserService();
Object[] objParams = new Object[2];
String cmd = "Update_ItemRevForm_TCProperty";
objParams[0] = cmd;
objParams[1] = params;
System.out.println(params);
long startime = System.currentTimeMillis();
String result = (String) userService.call("YSR8UserService", objParams);
long endtime = System.currentTimeMillis();
System.out.println(item.getProperty("item_id") + " " + editObjectInfo.editObjectMaterialID.get(i) + " 调用C耗时" + (endtime - startime) + "毫秒 " + result);
Thread.sleep(1000);
form.refresh();
}
}
}
System.out.println(this.remark+"|"+remark);
if (!this.remark.equals(remark)) {
this.isChanged = true;
}
HashMap<String, String> tableMap = new HashMap<String, String>();
tableMap.put("remark", remark);
mdm.updateValues(tableMap);
disposeDialog();
}
private String getRemark() throws Exception {
if (editObjectInfo.editObjects.size() == 0) {
return "<没有数据>";
}
if (currTable == 1) {
if (editObjectInfo.editObjects.get(0) instanceof TCComponentScheduleTask) {
TCComponentScheduleTask scheduTask = (TCComponentScheduleTask) editObjectInfo.editObjects.get(0);
return scheduTask.getStringProperty("ysr8_PurchRemark");
} else if (editObjectInfo.editObjects.get(0) instanceof TCComponentItem) {
TCComponentItem item = (TCComponentItem) editObjectInfo.editObjects.get(0);
TCComponentItemRevision revision = item.getLatestItemRevision();
TCComponentForm form = TCUtil.getItemRevisionMasterForm(revision);
String object_typeVal = item.getProperty("object_type");
if (object_typeVal.equals("图样目录")) {
return form.getStringProperty("ysr8_PurchRemark");
}
}
} else if (currTable == 2) {
if (editObjectInfo.editObjects.get(0) instanceof TCComponentItem) {
TCComponentItem item = (TCComponentItem) editObjectInfo.editObjects.get(0);
TCComponentItemRevision revision = item.getLatestItemRevision();
TCComponentForm form = TCUtil.getItemRevisionMasterForm(revision);
String object_typeVal = item.getProperty("object_type");
if (object_typeVal.equals("图纸整改单")) {
TCProperty ysr8_PurchRemarkProp = form.getFormTCProperty("ysr8_PurchRemark");
String[] ysr8_PurchRemarkVal = ysr8_PurchRemarkProp.getStringArrayValue();
if (ysr8_PurchRemarkVal != null && ysr8_PurchRemarkVal.length > editObjectInfo.editObjectListIdxs.get(0)) {
return ysr8_PurchRemarkVal[editObjectInfo.editObjectListIdxs.get(0)];
}
} else if (object_typeVal.equals("调试整改加工单")) {
TCProperty ysr8_PurchRemarkProp = form.getFormTCProperty("ysr8_PurchRemark");
String[] ysr8_PurchRemarkVal = ysr8_PurchRemarkProp.getStringArrayValue();
if (ysr8_PurchRemarkVal != null && ysr8_PurchRemarkVal.length > editObjectInfo.editObjectListIdxs.get(0)) {
return ysr8_PurchRemarkVal[editObjectInfo.editObjectListIdxs.get(0)];
}
} else if (object_typeVal.equals("散部件检验记录")) {
TCProperty ysr8_PurchRemarkProp = form.getFormTCProperty("ysr8_PurchRemark");
String[] ysr8_PurchRemarkVal = ysr8_PurchRemarkProp.getStringArrayValue();
if (ysr8_PurchRemarkVal != null && ysr8_PurchRemarkVal.length > editObjectInfo.editObjectListIdxs.get(0)) {
return ysr8_PurchRemarkVal[editObjectInfo.editObjectListIdxs.get(0)];
}
}
}
}
return "<没有数据>";
}
}

@ -0,0 +1,114 @@
package cn.com.ebewin.ysr.dialog;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import com.teamcenter.rac.aif.AbstractAIFDialog;
import com.teamcenter.rac.kernel.TCComponentForm;
import com.teamcenter.rac.kernel.TCComponentItem;
import com.teamcenter.rac.kernel.TCUserService;
import com.teamcenter.rac.util.MessageBox;
import com.teamcenter.rac.util.PropertyLayout;
import cn.com.ebewin.ysr.dialog.MachiningDynamicsManageDialog.EditObjectInfo;
import cn.com.ebewin.ysr.util.KUtil;
import cn.com.ebewin.ysr.util.TCUtil;
@SuppressWarnings("deprecation")
public class MachiningExWarehouseRemarkDialog extends AbstractAIFDialog {
private static final long serialVersionUID = 1L;
private JButton okBtn;
private JButton cancelBtn;
private JTextArea remark;
public MachiningExWarehouseRemarkDialog(MachiningDynamicsManageDialog mdm, EditObjectInfo editObjectInfo) throws Exception {
super(mdm);
setTitle("出库信息");
JPanel propPanel = new JPanel(new PropertyLayout(40, 20, 10, 5, 10, 5));
// TCComponentListOfValues[] lov = lovType.find("ML8_ProjectCategory_LOV");
// String[] vals = getDynamicLOV(lov[0]);
// System.out.println("ML8_ProjectCategory_LOV:"+lov[0].getType()+"=="+vals.length);
JLabel label2 = new JLabel("出库备注");
propPanel.add("1.1.left.center", label2);
remark = new JTextArea();
remark.setText("");
JScrollPane scroll = new JScrollPane(remark);
remark.setPreferredSize(new Dimension(240, 100));
propPanel.add("1.2.left.center", scroll);
okBtn = new JButton("确定");
cancelBtn = new JButton("取消");
JPanel btnPanel = new JPanel(new FlowLayout());
btnPanel.add(okBtn);
btnPanel.add(cancelBtn);
setLayout(new BorderLayout());
add(BorderLayout.CENTER, propPanel);
add(BorderLayout.SOUTH, btnPanel);
// add(new JLabel(""));
addActionListener(mdm, editObjectInfo);
pack();
setSize(new Dimension(370, 200));
setDefaultLookAndFeelDecorated(true);
Dimension screen = getToolkit().getScreenSize();
setLocation((screen.width - getSize().width) / 2, (screen.height - getSize().height) / 2);
// setAlwaysOnTop(true);
setVisible(true);
}
private void addActionListener(final MachiningDynamicsManageDialog mdm, final EditObjectInfo editObjectInfo) {
okBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
try {
String ysr8_ExWarehouseRemark = remark.getText();
if(ysr8_ExWarehouseRemark.isEmpty())
throw new Exception("有属性未填写,请检查");
String keys = "ysr8_ExWarehouseRemark";
for(int i=0; i<editObjectInfo.editObjects.size(); i++) {
TCComponentItem item = (TCComponentItem) editObjectInfo.editObjects.get(i);
TCComponentForm form = TCUtil.getItemRevisionMasterForm(item.getLatestItemRevision());
StringBuilder vals = new StringBuilder(""), params = new StringBuilder("");
int n = editObjectInfo.editObjectListIdxs.get(i);
vals.append(n).append("$$$$").append(editObjectInfo.editObjectQuantity.get(i)).append(ysr8_ExWarehouseRemark);
KUtil.setNewArrayProperty(form);//TODO setNewArrayProperty
params.append(item.getProperty("item_id")).append("^^^^").append(keys).append("^^^^").append(vals.toString());
TCUserService userService = mdm.fu.session.getUserService();
Object[] objParams = new Object[2];
String cmd = "Update_ItemRevForm_TCProperty";
objParams[0] = cmd;
objParams[1] = params.toString();
System.out.println(objParams[1]);
long startime = System.currentTimeMillis();
String result = (String) userService.call("YSR8UserService", objParams);
long endtime = System.currentTimeMillis();
System.out.println(item.getProperty("item_id") + " " + editObjectInfo.editObjectMaterialID.get(i)
+ " 调用C耗时" + (endtime - startime) + "毫秒 " + result);
Thread.sleep(1000);
form.refresh();
mdm.updateExWarehouseValue(ysr8_ExWarehouseRemark, "", editObjectInfo.rows.get(i), true);
}
dispose();
}catch(Exception e1) {
e1.printStackTrace();
MessageBox.post(MachiningExWarehouseRemarkDialog.this, "错误:"+e1.getMessage(), "ERROR", MessageBox.ERROR);
}
}
});
cancelBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
dispose();
}
});
}
}

@ -0,0 +1,280 @@
package cn.com.ebewin.ysr.dialog;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Vector;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTable;
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.iTextField;
import cn.com.ebewin.ysr.util.CommonUtil;
import cn.com.ebewin.ysr.util.DialogUtil;
import cn.com.ebewin.ysr.util.FormUtil;
import cn.com.ebewin.ysr.util.TCUtil;
import jxl.Workbook;
import jxl.format.Alignment;
import jxl.format.Border;
import jxl.format.BorderLineStyle;
import jxl.format.VerticalAlignment;
import jxl.write.Label;
import jxl.write.WritableCellFormat;
import jxl.write.WritableFont;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import jxl.write.WriteException;
public class MaterialPurchasingSearchDialog extends JFrame {
private static final long serialVersionUID = 1L;
DialogUtil fu = new DialogUtil(this, "采购查询看板", "YSR8_ERPPurchSearchDialog");
String serverName, dbName, tableName, userName, password;
Vector<Vector<String>> searchInfos = new Vector<Vector<String>>();
Vector<Vector<String>> fieldInfos = new Vector<Vector<String>>();
public MaterialPurchasingSearchDialog(TCSession session) throws TCException {
//super(true);
// TCComponentItemRevision rev;
fu.initializeUI(session);
//centerToScreen();
this.setLocationRelativeTo(null);
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
loadRendering();
addActionListener();
setVisible(true);
}
private void loadRendering() throws TCException {
Vector<String> loginInfos;
String loginInfo = TCUtil.getPreference2(fu.session, TCPreferenceService.TC_preference_site, "YSR_ERPPurchSearchDialog_ERPServerInfo");
System.out.println("YSR_ERPPurchSearchDialog_ERPServerInfo----------" + loginInfo);
if (loginInfo.equals("")) {
MessageBox.post("无法获取ERP数据库连接信息,请查看首选项YSR_ERPPurchSearchDialog_ERPServerInfo配置!", "错误", MessageBox.ERROR);
return;
}
loginInfos = CommonUtil.split2Vector(loginInfo, "=");
if (loginInfos.size() != 5) {
MessageBox.post("ERP数据库连接信息配置格式不正确,请查看首选项YSR_ERPPurchSearchDialog_ERPServerInfo配置!", "错误", MessageBox.ERROR);
return;
}
serverName = loginInfos.get(0);
dbName = loginInfos.get(1);
tableName = loginInfos.get(2);
userName = loginInfos.get(3);
password = loginInfos.get(4);
String[] fieldMapInfos = TCUtil.getPreference(fu.session, TCPreferenceService.TC_preference_site, "YSR_ERPPurchSearchDialog_FieldMap");
for (int i = 0; i < fieldMapInfos.length; i++) {
String fieldMapInfo = fieldMapInfos[i];
Vector<String> fieldMapInfoParts = CommonUtil.split2Vector(fieldMapInfo, "@@");
if (fieldMapInfoParts.get(0).startsWith("Search")) {
searchInfos.add(fieldMapInfoParts);
} else if (fieldMapInfoParts.get(0).startsWith("Field")) {
System.out.println("结果列表===" + fieldMapInfoParts);
fieldInfos.add(fieldMapInfoParts);
}
}
}
private void addActionListener() {
JButton btn = (JButton)fu.allComponentMap.get("b.11.15");
btn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
searchERPInfo();
}
});
btn = (JButton)fu.allComponentMap.get("b.11.16");
btn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
outputERPInfo();
}
});
}
private void searchERPInfo() {
FormUtil.JTableInfo ci = (FormUtil.JTableInfo)fu.allComponentInfos.get("a.21.11.11");
int rowCount = ci.dataTableModel.getRowCount();
for(int i = rowCount - 1; i >= 0; i--){
ci.dataTableModel.removeRow(i);
}
ci.dataTableModel.getDataVector().clear();
iTextField textField = (iTextField)fu.allComponentMap.get("CGDID");
String CGDID = textField.getText().toString();//查询条件采购单ID
textField = (iTextField)fu.allComponentMap.get("XMH");
String XMH = textField.getText().toString();//查询条件:项目号
if (CGDID.equals("") && XMH.equals("")) {
MessageBox.post("请输入查询条件!", "提示", MessageBox.INFORMATION);
return;
}
String where = "";
if (!CGDID.equals("")) {
for (int j = 0; j < searchInfos.size(); j++) {
if (searchInfos.get(j).get(1).equals("CGDID")) {
where += "(" + searchInfos.get(j).get(3) + searchInfos.get(j).get(2) + "'" + CGDID + "'";
break;
}
}
}
if (!XMH.equals("")) {
for (int j = 0; j < searchInfos.size(); j++) {
if (searchInfos.get(j).get(1).equals("XMH")) {
if (where.equals("")) {
where += "(" + searchInfos.get(j).get(3) + searchInfos.get(j).get(2) + "'" + XMH + "')";
} else {
where += " AND " + searchInfos.get(j).get(3) + searchInfos.get(j).get(2) + "'" + XMH + "')";
}
break;
}
}
}
if (where.equals("")) {
for (int j = 0; j < searchInfos.size(); j++) {
if (searchInfos.get(j).get(1).equals("CGDID")) {
where += "(" + searchInfos.get(j).get(3) + " LIKE '%')";
break;
}
}
}
System.out.println("####"+where);
try {
Connection connection = null;
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
System.out.println("数据库驱动加载成功");
// connection = DriverManager.getConnection("jdbc:sqlserver://192.168.0.26:1433;DatabaseName=UFDATA_201_2013","user11","Aa123");
connection = DriverManager.getConnection("jdbc:sqlserver://"+serverName+":1433;DatabaseName="+dbName,userName,password);
if(connection == null){
System.out.println("数据库连接失败");
MessageBox.post("数据库连接失败!","错误",MessageBox.ERROR);
return;
}else {
System.out.println("数据库连接成功");
}
// PreparedStatement pstmt = connection.prepareStatement("{call dbo.zzz_综合查询表(?)}");
PreparedStatement pstmt = connection.prepareStatement("{call dbo."+tableName+"(?)}");
pstmt.setString(1, where);
System.out.println("执行存储过程begin====" + where);
ResultSet rs = pstmt.executeQuery();
System.out.println("执行存储过程end====" + rs.getRow());
Integer idx = 0;
while (rs.next()) {
System.out.println("数据行====" + (idx + 1));
Vector<String> vec = new Vector<>();
vec.add((++idx) + "");//序号
for (int j = 0; j < fieldInfos.size(); j++) {
System.out.println("结果列表===" + fieldInfos.get(j).get(2));
vec.add(rs.getString(fieldInfos.get(j).get(2)));
}
ci.dataTableModel.addRow(vec);
}
rs.close();
pstmt.close();
} catch (Exception e) {
e.printStackTrace();
MessageBox.post(e.getMessage(),"错误",MessageBox.ERROR);
}
}
private void outputERPInfo() {
final JTable table = (JTable)fu.allComponentMap.get("a.21.11.11");
final JButton btn = (JButton)fu.allComponentMap.get("b.11.16");
btn.setEnabled(false);
final ProgressReporterDialog reporter = new ProgressReporterDialog();
reporter.reportProgressMessage("正在导出,请稍候...");
new Thread(reporter).start();
new Thread() {
public void run() {
try {
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
String time = sdf.format(date);
String toPath = System.getProperty("java.io.tmpdir") + "采购查询看板" + time + ".xls";
// 创建一个可写的Workbook
WritableWorkbook writeWorkBook = Workbook.createWorkbook(new File(toPath));
// 创建工作表
WritableSheet wsheet = writeWorkBook.createSheet("采购查询看板", 0);
//填写表格
int columnCount = table.getColumnCount(); // 总列数
int rowCount = table.getRowCount(); // 总行数
String[] titles = new String[columnCount]; // 表头
// 获取表头
for (int i = 0; i < columnCount; i++) {
titles[i] = table.getColumnName(i);
}
int current_row = 0; // 初始化当前行作为开始行
try {
// 标题栏样式
WritableFont titleFont = new WritableFont(WritableFont.createFont("宋体"), 13,WritableFont.BOLD);
WritableCellFormat titleCellFormat = new WritableCellFormat(titleFont);
titleCellFormat.setBorder(Border.ALL, BorderLineStyle.MEDIUM);
titleCellFormat.setAlignment(Alignment.CENTRE);
titleCellFormat.setVerticalAlignment(VerticalAlignment.CENTRE);
titleCellFormat.setWrap(true);
// 内容样式
WritableFont contentFont = new WritableFont(WritableFont.createFont("宋体"), 12);
WritableCellFormat contentCellFormat = new WritableCellFormat(contentFont);
contentCellFormat.setBorder(Border.ALL, BorderLineStyle.THIN);
contentCellFormat.setAlignment(Alignment.CENTRE);
contentCellFormat.setVerticalAlignment(VerticalAlignment.CENTRE);
contentCellFormat.setWrap(true);
// 写首行标题
for (int i = 0; i < columnCount; i++) {
Label labelTitle = new Label(i, current_row, titles[i], titleCellFormat);
wsheet.addCell(labelTitle);
}
current_row = current_row + 1;
// 写行数据
for (int i = 0; i < rowCount; i++) {
for (int j = 0; j < columnCount; j++) {
Object objValue = table.getValueAt(i, j);
Label labelContent = new Label(j, i + current_row, String.valueOf(objValue), contentCellFormat);
wsheet.addCell(labelContent);
}
}
// 设置格式
wsheet.getSettings().setDefaultColumnWidth(20);
writeWorkBook.write();
writeWorkBook.close();
} catch (WriteException e) {
e.printStackTrace();
}
// 打开导出的报表文件
Runtime.getRuntime().exec("cmd /c \"" + toPath + "\"");
} catch (IOException e) {
e.printStackTrace();
}
reporter.requestCanceling();
btn.setEnabled(true);
}
}.start();
}
}

@ -0,0 +1,774 @@
package cn.com.ebewin.ysr.dialog;
import java.awt.Color;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Vector;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentForm;
import com.teamcenter.rac.kernel.TCComponentSchedule;
import com.teamcenter.rac.kernel.TCComponentScheduleTask;
import com.teamcenter.rac.kernel.TCComponentTask;
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.DateButton;
import com.teamcenter.rac.util.MessageBox;
import com.teamcenter.rac.util.iTextField;
import com.teamcenter.services.rac.core.DataManagementService;
import cn.com.ebewin.ysr.util.CommonUtil;
import cn.com.ebewin.ysr.util.DialogUtil;
import cn.com.ebewin.ysr.util.FormUtil;
import cn.com.ebewin.ysr.util.KUtil;
import cn.com.ebewin.ysr.util.TCUtil;
import cn.com.ebewin.ysr.util.UIUtil.JComboBoxInfo;
import cn.com.ebewin.ysr.util.UIUtil.JTableInfo;
import jxl.Workbook;
import jxl.format.Alignment;
import jxl.format.Border;
import jxl.format.BorderLineStyle;
import jxl.format.VerticalAlignment;
import jxl.write.Label;
import jxl.write.WritableCellFormat;
import jxl.write.WritableFont;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import jxl.write.WriteException;
@SuppressWarnings("deprecation")
public class PipingLinePlanningManagementDialog extends JFrame {
private static final long serialVersionUID = 1L;
DialogUtil fu = new DialogUtil(this, "配管线计划管理", "YSR8_PipingLinePlanningManagementDialog");
HashMap<Integer, Object> allObjectMap1 = new HashMap<Integer, Object>();
private static final int TASKSTATE_INDEX = 22;
// private static final int T1_PROJECTID_INDEX = 1;
private static final int WIRING_INDEX = 10; //本次配管线数量
private static final int WIRED_INDEX = 11; //已配管线数量
private static final int ARRIVED_INDEX = 8; // 已到货数量
private static final int TOTAL_INDEX = 7; // 数量
private static final int START_INDEX = 14; //配线开始时间
private Date Date1 = null;
private Date Date2 = null;
public PipingLinePlanningManagementDialog(TCSession session) throws TCException {
// super(true);
fu.initializeUI(session);
JTable table = (JTable) fu.allComponentMap.get("a.31.11.11");
table.setAutoCreateRowSorter(true);
// centerToScreen();
this.setLocationRelativeTo(null);
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
loadRendering();
addActionListener();
setVisible(true);
}
private void loadRendering() throws TCException {
JTable table = (JTable) fu.allComponentMap.get("a.31.11.11");
table.setDefaultRenderer(Object.class, new ColorTableRenderer());
@SuppressWarnings("unchecked")
JComboBox<String> cbx = (JComboBox<String>) fu.allComponentMap.get("ysr8_TaskManuState");//lidy20190322
// cbx.addItem("");
cbx.addItem("配管线中");
cbx.addItem("已完成配管线");
cbx.addItem("已到货待配线");
cbx.addItem("未到货");
cbx.addItem("已检验");
}
public class ColorTableRenderer extends DefaultTableCellRenderer {
/**
*
*/
private static final long serialVersionUID = 1L;
private Color DEFBLUE = new Color(51, 153, 255);
// private Color DEFGREEN = new Color(158, 234, 106);
// private Color DEFYELLOW = new Color(245, 245, 43);
private Color DEFORANGE = new Color(249, 116, 7);
@Override
public Component getTableCellRendererComponent(JTable t, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
if (hasFocus) {
setBackground(DEFBLUE);
} else {
setBackground(Color.WHITE);
String state = t.getValueAt(row, TASKSTATE_INDEX)==null?"":t.getValueAt(row, TASKSTATE_INDEX).toString();
String WiringStartDate = t.getValueAt(row, START_INDEX)==null?"":t.getValueAt(row, START_INDEX).toString();
String Quantity = t.getValueAt(row, TOTAL_INDEX)==null?"":t.getValueAt(row, TOTAL_INDEX).toString();
String ArrivedQuantity = t.getValueAt(row, ARRIVED_INDEX)==null?"":t.getValueAt(row, ARRIVED_INDEX).toString();
String WiredQuantity = t.getValueAt(row, WIRED_INDEX)==null?"":t.getValueAt(row, WIRED_INDEX).toString();
String PurchFinishDate = t.getValueAt(row, 17)==null?"":t.getValueAt(row, 17).toString();
if((state.equals("已报检") || state.equals("分批") || state.equals("已检验")) && Quantity.equals(WiredQuantity)) {//已完成配管线
setBackground(Color.GREEN);
} else if(!WiringStartDate.equals("") && PurchFinishDate.equals("")) {//配管线中
setBackground(Color.YELLOW);
} else if(!ArrivedQuantity.equals("") && !ArrivedQuantity.equals("0") && WiringStartDate.equals("")) {//已到货待配线
setBackground(DEFORANGE);
}
// if(state!=null) {
// String content=state.toString();
// if(content.equals("已检验")) {
// setBackground(DEFGREEN);
// }
// }
}
return super.getTableCellRendererComponent(t, value, isSelected, hasFocus, row, column);
}
}
private void addActionListener() {
JButton btn = (JButton) fu.allComponentMap.get("b.11.110");
btn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
searchMachiningInfo();
}
});
btn = (JButton) fu.allComponentMap.get("b.11.111");
btn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
editMachiningInfo();
}
});
btn = (JButton) fu.allComponentMap.get("b.21.18");
btn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
outputMachiningInfo();
}
});
btn = (JButton) fu.allComponentMap.get("b.21.19");
btn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
submitInspectionProcess2();
} catch (Exception e1) {
MessageBox.post(PipingLinePlanningManagementDialog.this,e.toString(),"出错了",MessageBox.ERROR);
e1.printStackTrace();
}
}
});
}
@SuppressWarnings("unchecked")
private void searchMachiningInfo() {
allObjectMap1.clear();
JTableInfo ci1 = (FormUtil.JTableInfo) fu.allComponentInfos.get("a.31.11.11");
int rowCount = ci1.dataTableModel.getRowCount();
for (int i = rowCount - 1; i >= 0; i--) {
ci1.dataTableModel.removeRow(i);
}
ci1.dataTableModel.getDataVector().clear();
iTextField textField = (iTextField) fu.allComponentMap.get("XMH");
String XMH = textField.getText().toString();
JComboBox<String> cbx = (JComboBox<String>) fu.allComponentMap.get("JGC");
JComboBoxInfo cii = (JComboBoxInfo) fu.allComponentInfos.get("JGC");
String JGC = cbx.getSelectedItem().toString();
if (cii.lovVal != null) {
Iterator<String> iter = cii.lovVal.keySet().iterator();
while (iter.hasNext()) {
String lovKey = iter.next();
String lovValue = cii.lovVal.get(lovKey);
if (lovValue.equalsIgnoreCase(JGC)) {
JGC = lovKey;
break;
}
}
}
Date1=null;
Date2=null;
DateButton db = (DateButton) fu.allComponentMap.get("ysr8_FixturePlanDate1");
Date1 = db.getDate();
String Date1s = "";
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-M-d");
if (Date1 != null) {
Date1s = sdf.format(Date1) + " 00:00";
}
db = (DateButton) fu.allComponentMap.get("ysr8_FixturePlanDate2");
Date2 = db.getDate();
String Date2s = "";
if (Date2 != null) {
Date2s = sdf.format(Date2) + " 23:59";
}
textField = (iTextField) fu.allComponentMap.get("FZR");
String FZR = textField.getText().toString();
textField = (iTextField) fu.allComponentMap.get("JJPXDD");
String JJPXDD = textField.getText().toString();
cbx = (JComboBox<String>) fu.allComponentMap.get("ysr8_TaskManuState");
// cii = (JComboBoxInfo) fu.allComponentInfos.get("ysr8_TaskManuState");
final String ysr8_TaskManuState = cbx.getSelectedItem().toString();
Vector<String> attrVec = new Vector<String>();
Vector<String> valVec = new Vector<String>();
attrVec.add("任务用途");
valVec.add("6");
if (!XMH.equals("")) {
attrVec.add("项目 ID");
valVec.add(XMH);
}
if (!JGC.equals("")) {
attrVec.add("加工厂1");
valVec.add(JGC);
}
if (!FZR.equals("")) {
attrVec.add("加工负责人");
valVec.add(FZR);
}
if (!JJPXDD.equals("")) {
attrVec.add("夹具配线担当");
valVec.add(JJPXDD);
}
String type = "";
if (!ysr8_TaskManuState.equals("")) {
if(ysr8_TaskManuState.equals("配管线中")) {
attrVec.add("任务加工状态");
valVec.add("2;5");
type = "配线开始";
}else if(ysr8_TaskManuState.equals("已完成配管线")) {
attrVec.add("任务加工状态");
valVec.add("3;4");
type = "配线完成";
}else if(ysr8_TaskManuState.equals("已到货待配线")) {
}else if(ysr8_TaskManuState.equals("未到货")) {
attrVec.add("任务加工状态");
valVec.add("1");
}else if(ysr8_TaskManuState.equals("已检验")) {
attrVec.add("任务加工状态");
valVec.add("4");
type = "配线完成";
}
}
if (!Date1s.equals("") && !type.equals("")) {
attrVec.add(type+"1");
valVec.add(Date1s);
}
if (!Date2s.equals("") && !type.equals("")) {
attrVec.add(type+"2");
valVec.add(Date2s);
}
final String[] attrs = (String[]) attrVec.toArray(new String[attrVec.size()]);
final String[] vals = (String[]) valVec.toArray(new String[attrVec.size()]);
new Thread(new Runnable() {
public void run() {
JButton btn = (JButton) fu.allComponentMap.get("b.11.110");
btn.setText("查询中...");
setEnableBtns(false);
searchMachiningInfo_SchedulTask(attrs, vals, ysr8_TaskManuState);
setEnableBtns(true);
btn.setText("查询");
}
}).start();
}
private void setEnableBtns(boolean b) {
JButton btn = (JButton) fu.allComponentMap.get("b.11.110");
btn.setEnabled(b);
btn = (JButton) fu.allComponentMap.get("b.11.111");
btn.setEnabled(b);
btn = (JButton) fu.allComponentMap.get("b.21.18");
btn.setEnabled(b);
btn = (JButton) fu.allComponentMap.get("b.21.19");
btn.setEnabled(b);
}
private void searchMachiningInfo_SchedulTask(String[] attrs, String[] vals, String ysr8_TaskManuState) {
JTableInfo ci = (FormUtil.JTableInfo) fu.allComponentInfos.get("a.31.11.11");
try {
TCComponent[] tcComponents = TCUtil.query(fu.session, "SearchSchedulTaskPLP", attrs, vals);
HashMap<TCComponent,Date> map = new HashMap<>();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
HashMap<TCComponentScheduleTask,String> ysr8_ArrivedQuantitys = new HashMap<>();
HashMap<TCComponentScheduleTask,String> ysr8_ArrivingQuantitys = new HashMap<>();
HashMap<TCComponentScheduleTask,String> ysr8_PurchPlanDates = new HashMap<>();
HashMap<TCComponentScheduleTask,String> ysr8_PurchFinishDates = new HashMap<>();
for (int i = 0; i < tcComponents.length; i++) {
TCComponentScheduleTask scheduTask = (TCComponentScheduleTask) tcComponents[i];
TCComponentScheduleTask searScheduleTask = searchScheduleTask(scheduTask.getProperty("ysr8_ProjectCode"), "2", scheduTask.getProperty("object_name"));
// System.out.println(Date1+"=="+Date2+"--"+ysr8_TaskManuState);
Date MachPlanDate = null, MachFinishDate = null;
String ArrivedQuantity = "";
if(searScheduleTask != null) {
MachPlanDate = searScheduleTask.getDateProperty("ysr8_PurchPlanDate");
MachFinishDate = searScheduleTask.getDateProperty("ysr8_PurchFinishDate");
ArrivedQuantity = searScheduleTask.getProperty("ysr8_ArrivedQuantity");
}
if(!ysr8_TaskManuState.equals("") && !ysr8_TaskManuState.equals("未到货") && !ysr8_TaskManuState.equals("已检验")) {
String TaskManuState = scheduTask.getProperty("ysr8_TaskManuState");
String Quantity = scheduTask.getProperty("ysr8_PartNumber");
String WiredQuantity = scheduTask.getProperty("ysr8_WiredQuantity");
String WiringStartDate = scheduTask.getProperty("ysr8_WiringStartDate");
String PurchFinishDate = scheduTask.getProperty("ysr8_PurchFinishDate");
if(ysr8_TaskManuState.equals("已完成配管线")) {
// System.out.println(scheduTask.getProperty("object_name")+"=="+TaskManuState+"=="+Quantity+"=="+WiredQuantity);
if((!TaskManuState.equals("已报检") && !TaskManuState.equals("已检验")) || !Quantity.equals(WiredQuantity))
continue;
} else if(ysr8_TaskManuState.equals("配管线中")) {
// System.out.println(scheduTask.getProperty("object_name")+"=="+WiringStartDate+"=="+Quantity+"=="+WiredQuantity);
if(WiringStartDate.equals("") || !PurchFinishDate.equals("") || (!WiringStartDate.equals("") && Quantity.equals(WiredQuantity))) {
// System.out.println("continue");
continue;
}
} else if(ysr8_TaskManuState.equals("已到货待配线")) {
System.out.println(scheduTask.getProperty("object_name")+"=="+WiringStartDate+"=="+Quantity+"=="+ArrivedQuantity);
if(ArrivedQuantity.equals("") || ArrivedQuantity.equals("0") || !WiringStartDate.equals("")) {
// System.out.println("continue");
continue;
}
}
// System.out.println("add");
}
if(Date1 != null) {
if(ysr8_TaskManuState.equals("已到货待配线") && (MachFinishDate==null || MachFinishDate.compareTo(Date1)<0))
continue;
else if(ysr8_TaskManuState.equals("未到货") && (MachPlanDate==null || MachPlanDate.compareTo(Date1)<0))
continue;
else if(ysr8_TaskManuState.equals("") && (MachPlanDate==null || MachPlanDate.compareTo(Date1)<0))
continue;
}
if(Date2 != null) {
if(ysr8_TaskManuState.equals("已到货待配线") && (MachFinishDate==null || MachFinishDate.compareTo(Date2)>0))
continue;
else if(ysr8_TaskManuState.equals("未到货") && (MachPlanDate==null || MachPlanDate.compareTo(Date2)>0))
continue;
else if(ysr8_TaskManuState.equals("") && (MachPlanDate==null || MachPlanDate.compareTo(Date2)>0)) {
// System.out.println(MachPlanDate+"=="+Date2+"--"+MachPlanDate.compareTo(Date2));
continue;
}
}
Date ysr8_PurchFinishDate = null;
if(searScheduleTask != null) {
ysr8_PurchFinishDate = searScheduleTask.getDateProperty("ysr8_PurchFinishDate");// 按夹具到达时间排序
ysr8_ArrivedQuantitys.put(scheduTask, ArrivedQuantity);
ysr8_ArrivingQuantitys.put(scheduTask, searScheduleTask.getProperty("ysr8_ArrivingQuantity"));
ysr8_PurchPlanDates.put(scheduTask, fu.getDateString(MachPlanDate));
ysr8_PurchFinishDates.put(scheduTask, fu.getDateString(MachFinishDate));
}else {
ysr8_ArrivedQuantitys.put(scheduTask, "");
ysr8_ArrivingQuantitys.put(scheduTask, "");
ysr8_PurchPlanDates.put(scheduTask, "");
ysr8_PurchFinishDates.put(scheduTask, "");
}
if(ysr8_PurchFinishDate==null)
ysr8_PurchFinishDate = dateFormat.parse("9900-01-01");
map.put(scheduTask, ysr8_PurchFinishDate);
}
TCComponent[] tcComponents2 = Pipingsort(map);
Integer idx = ci.dataTableModel.getRowCount();
for (int i = 0; i < tcComponents2.length; i++) {
TCComponentScheduleTask scheduTask = (TCComponentScheduleTask) tcComponents2[i];
scheduTask.refresh();
String ysr8_ProjectCodeVal = scheduTask.getProperty("ysr8_ProjectCode");
TCComponentSchedule schedule = TCUtil.findScheduleByID(fu.session, ysr8_ProjectCodeVal + "-00");
TCComponentForm projectForm = null;
if (schedule != null) {
projectForm = (TCComponentForm) schedule.getRelatedComponent("IMAN_reference");
}
Vector<String> vec = new Vector<>();
vec.add((++idx) + "");// 序号
vec.add(scheduTask.getProperty("ysr8_ProjectCode"));// 项目编号
vec.add(scheduTask.getProperty("object_name"));// 任务名称
if (projectForm != null) {// 加工负责人
vec.add(projectForm.getProperty("ysr8_Machiner"));
} else {
vec.add("");
}
if (projectForm != null) {// 采购负责人
vec.add(projectForm.getProperty("ysr8_Purcher"));
} else {
vec.add("");
}
vec.add(scheduTask.getProperty("ysr8_WiringPerson"));// 夹具配线担当
vec.add(scheduTask.getProperty("ysr8_ManuFactory1"));// 加工厂
vec.add(scheduTask.getProperty("ysr8_PartNumber"));// 数量
// kk 添加列 20180907
vec.add(ysr8_ArrivedQuantitys.get(scheduTask));// 已到货数量
vec.add(ysr8_ArrivingQuantitys.get(scheduTask));// 本次到货数量
vec.add(scheduTask.getProperty("ysr8_WiringQuantity"));// 本次配管线数量
vec.add(scheduTask.getProperty("ysr8_WiredQuantity"));// 已配管线数量
// vec.add(scheduTask.getProperty("ysr8_FixturePlanDate"));//夹具预计到达时间
vec.add(ysr8_PurchPlanDates.get(scheduTask));// 夹具预计到达时间//lidy20190429
vec.add(ysr8_PurchFinishDates.get(scheduTask));// 夹具到达时间
vec.add(fu.getDateString(scheduTask.getDateProperty("ysr8_WiringStartDate")));// 配线开始时间
vec.add(fu.getDateString(scheduTask.getDateProperty("finish_date")));// 计划完成日期
vec.add(fu.getDateString(scheduTask.getDateProperty("ysr8_PurchPlanDate")));// 采购计划完成日期
// kk 20180905 添加列
// vec.add(fu.getDateString(scheduTask.getDateProperty("ysr8_PurchPlanDate")));// 实际完成日期
vec.add(fu.getDateString(scheduTask.getDateProperty("ysr8_PurchFinishDate")));// 实际完成日期
vec.add(scheduTask.getProperty("ysr8_GasWiring"));// 气路配线情况
vec.add(scheduTask.getProperty("ysr8_CircuitWiring"));// 电路配线情况
vec.add(scheduTask.getProperty("ysr8_Remark"));// 备注
if (projectForm != null) {// 厂别
vec.add(projectForm.getProperty("ysr8_Factory"));
} else {
vec.add("");
}
vec.add(scheduTask.getProperty("ysr8_TaskManuState"));// 任务状态
vec.add(fu.getDateString(scheduTask.getDateProperty("ysr8_SubQualityFinishDate")));// 质检完成时间
vec.add(scheduTask.getProperty("ysr8_SubQualityResult"));// 质检结论
ci.dataTableModel.addRow(vec);
allObjectMap1.put(idx - 1, scheduTask);
}
} catch (Exception ex) {
ex.printStackTrace();
MessageBox.post(ex);
}
}
private TCComponentScheduleTask searchScheduleTask(String projectCode, String taskUse, String name) throws TCException {
Vector<String> attrVec = new Vector<String>();
Vector<String> valVec = new Vector<String>();
attrVec.add("项目编号");
valVec.add(projectCode);
attrVec.add("任务用途");
valVec.add(taskUse);
attrVec.add("名称");
valVec.add(name);
String[] attrs = (String[]) attrVec.toArray(new String[attrVec.size()]);
String[] vals = (String[]) valVec.toArray(new String[attrVec.size()]);
TCComponent[] tcComponents = TCUtil.query(fu.session, "SearchSchedulTaskPLP_02", attrs, vals);
if (tcComponents == null) {
return null;
}
// System.out.println(tcComponents.length);
if (tcComponents.length > 0) {
return (TCComponentScheduleTask) tcComponents[0];
}
return null;
}
private void editMachiningInfo() {
try {
JTable table = (JTable) fu.allComponentMap.get("a.31.11.11");
int[] rows = table.getSelectedRows();
if (rows == null || rows.length == 0) {
MessageBox.post("请选择要编辑的数据!", "提示", MessageBox.INFORMATION);
return;
}
Object taskState = table.getValueAt(rows[0], TASKSTATE_INDEX);
if (taskState != null && (taskState.toString().equals("已报检") || taskState.toString().equals("已检验"))) {
MessageBox.post("任务状态不为[已报检、已检验]的数据才能进行编辑!", "提示", MessageBox.INFORMATION);
return;
}
TCComponentUser user = fu.session.getUser();
String coordinationManager = TCUtil.getPreference2(fu.session, TCPreferenceService.TC_preference_site, "YSR8_MachiningDynamics_CoordinationManager");
Boolean iscoordinationManager = false;
if (coordinationManager.equals(user.getProperty("user_name"))) {
iscoordinationManager = true;
}
if (!iscoordinationManager) {
MessageBox.post("必须是外协施工管理人员才能进行编辑!", "提示", MessageBox.INFORMATION);
return;
}
int idx = Integer.parseInt(table.getValueAt(rows[0], 0).toString());
TCComponentScheduleTask scheduTask = (TCComponentScheduleTask) allObjectMap1.get(idx - 1);
new PipingLinePlanningManagementEditDialog(this, scheduTask);
} catch (TCException e) {
e.printStackTrace();
}
// searchMachiningInfo();
}
private void outputMachiningInfo() {
final JButton btn = (JButton) fu.allComponentMap.get("b.21.18");
btn.setEnabled(false);
final JTable table1 = (JTable) fu.allComponentMap.get("a.31.11.11");
final ProgressReporterDialog reporter = new ProgressReporterDialog();
reporter.reportProgressMessage("正在导出,请稍候...");
new Thread(reporter).start();
new Thread() {
public void run() {
try {
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
String time = sdf.format(date);
String toPath = System.getProperty("java.io.tmpdir") + "加工动态" + time + ".xls";
// 创建一个可写的Workbook
WritableWorkbook writeWorkBook = Workbook.createWorkbook(new File(toPath));
// 创建工作表
WritableSheet wsheet = writeWorkBook.createSheet("加工动态", 0);
// 填写表格
int columnCount = table1.getColumnCount(); // 总列数
int rowCount = table1.getRowCount(); // 总行数
String[] titles = new String[columnCount]; // 表头
// 获取表头
for (int i = 0; i < columnCount; i++) {
titles[i] = table1.getColumnName(i);
}
int current_row = 0; // 初始化当前行作为开始行
try {
// 标题栏样式
WritableFont titleFont = new WritableFont(WritableFont.createFont("宋体"), 13, WritableFont.BOLD);
WritableCellFormat titleCellFormat = new WritableCellFormat(titleFont);
titleCellFormat.setBorder(Border.ALL, BorderLineStyle.MEDIUM);
titleCellFormat.setAlignment(Alignment.CENTRE);
titleCellFormat.setVerticalAlignment(VerticalAlignment.CENTRE);
titleCellFormat.setWrap(true);
// 内容样式
WritableFont contentFont = new WritableFont(WritableFont.createFont("宋体"), 12);
WritableCellFormat contentCellFormat = new WritableCellFormat(contentFont);
contentCellFormat.setBorder(Border.ALL, BorderLineStyle.THIN);
contentCellFormat.setAlignment(Alignment.CENTRE);
contentCellFormat.setVerticalAlignment(VerticalAlignment.CENTRE);
contentCellFormat.setWrap(true);
// 写首行标题
for (int i = 0; i < columnCount; i++) {
Label labelTitle = new Label(i, current_row, titles[i], titleCellFormat);
wsheet.addCell(labelTitle);
}
current_row = current_row + 1;
// 写行数据
for (int i = 0; i < rowCount; i++) {
for (int j = 0; j < columnCount; j++) {
Object objValue = table1.getValueAt(i, j);
Label labelContent = new Label(j, i + current_row, String.valueOf(objValue), contentCellFormat);
wsheet.addCell(labelContent);
}
}
// 设置格式
wsheet.getSettings().setDefaultColumnWidth(20);
writeWorkBook.write();
writeWorkBook.close();
} catch (WriteException e) {
e.printStackTrace();
}
// 打开导出的报表文件
Runtime.getRuntime().exec("cmd /c \"" + toPath + "\"");
} catch (IOException e) {
e.printStackTrace();
}
reporter.requestCanceling();
btn.setEnabled(true);
}
}.start();
}
// kk 20180907 提交检验逻辑变更
private void submitInspectionProcess2() throws Exception {
JTable table = (JTable) fu.allComponentMap.get("a.31.11.11");
int[] rows = table.getSelectedRows();
if (rows == null || rows.length == 0) {
MessageBox.post(PipingLinePlanningManagementDialog.this,"请选择要编辑的数据!", "提示", MessageBox.INFORMATION);
return;
}
if (!table.getValueAt(rows[0], TASKSTATE_INDEX).toString().equals("已到货")&&!table.getValueAt(rows[0], TASKSTATE_INDEX).toString().equals("分批")) {
MessageBox.post(PipingLinePlanningManagementDialog.this,"任务状态为[已到货]或[分批]的数据才能提交报检流程!", "提示", MessageBox.INFORMATION);
return;
}
TCComponentUser user = fu.session.getUser();
String coordinationManager = TCUtil.getPreference2(fu.session, TCPreferenceService.TC_preference_site, "YSR8_MachiningDynamics_CoordinationManager");
Boolean iscoordinationManager = false;
if (coordinationManager.equals(user.getProperty("user_name"))) {
iscoordinationManager = true;
}
if (!iscoordinationManager) {
MessageBox.post(PipingLinePlanningManagementDialog.this,"必须是外协施工管理人员才能进行编辑!", "提示", MessageBox.INFORMATION);
return;
}
//已配管线数量<已到货数量
Object wiredNumStr=table.getValueAt(rows[0], WIRED_INDEX);
Object arrivedNumStr=table.getValueAt(rows[0], ARRIVED_INDEX);
Object totalNumStr=table.getValueAt(rows[0], TOTAL_INDEX);
double wiredNum=KUtil.getDoubleFromString(wiredNumStr, "已配管线数量");
double arrivedNum=KUtil.getDoubleFromString(arrivedNumStr, "已到货数量");
double totalNum=KUtil.getDoubleFromString(totalNumStr, "数量");
if(wiredNum>=arrivedNum) {
MessageBox.post(PipingLinePlanningManagementDialog.this,"无法提交,需满足条件:“已配管线数量”<“已到货数量”","提示",MessageBox.WARNING);
return;
}
//编辑本次配管线数量
Object wiringNumStr=table.getValueAt(rows[0], WIRING_INDEX);
double wiringNum=KUtil.getDoubleFromString(wiringNumStr, "本次配管线数量");
double newNum=new PipingLinePlanningWiringDialog(wiringNum,wiredNum,arrivedNum).getWiringNum();
if(newNum<=0) {
System.out.println("未进行修改");
return;
}
System.out.println("本次配管线数量:"+newNum);
//修改属性
int idx = Integer.parseInt(table.getValueAt(rows[0], 0).toString());
TCComponentScheduleTask scheduTask = (TCComponentScheduleTask) allObjectMap1.get(idx - 1);
wiredNum=wiredNum+newNum;
CommonUtil.setByPass(true);
scheduTask.setStringProperty("ysr8_WiringQuantity",fu.getDoubleString(newNum));// 本次配管线数量
table.setValueAt(fu.getDoubleString(newNum), rows[0], WIRING_INDEX);
scheduTask.setStringProperty("ysr8_WiredQuantity",fu.getDoubleString(wiredNum));// 已配管线数量
table.setValueAt(fu.getDoubleString(wiredNum), rows[0], WIRED_INDEX);
System.out.println("wiredNum:"+wiredNum+"&totalNum:"+totalNum);
if(wiredNum==totalNum) {
scheduTask.setStringProperty("ysr8_TaskManuState", "3");//已报检
table.setValueAt("已报检", rows[0], TASKSTATE_INDEX);
scheduTask.setDateProperty("ysr8_PurchFinishDate", new Date());//实际完成时间
table.setValueAt(fu.getDateString(new Date()), rows[0], 17);
completeTask(scheduTask);
}else if(wiredNum<totalNum) {
scheduTask.setStringProperty("ysr8_TaskManuState", "5");//分批
table.setValueAt("分批", rows[0], TASKSTATE_INDEX);
scheduTask.setDateProperty("ysr8_PurchFinishDate", new Date());//实际完成时间
table.setValueAt(fu.getDateString(new Date()), rows[0], 17);
}
CommonUtil.setByPass(false);
MessageBox.post(this, "报检成功!", "提示", MessageBox.INFORMATION);
}
private void completeTask(TCComponentScheduleTask scheduTask) throws Exception {
scheduTask.setStringProperty("ysr8_TaskManuState", "3");
TCComponent[] tasks = scheduTask.getRelatedComponents("fnd0ActuatedInteractiveTsks");
if (tasks != null && tasks.length > 0) {
TCComponent task1 = null;
TCComponent task2 = null;
for (int i = 0; i < tasks.length; i++) {
TCComponent task = tasks[i];
String object_type = task.getProperty("object_type");
System.out.println("object_type object_name1======" + task.getUid() + "======" + task.getProperty("object_type") + "======" + task.getProperty("object_name"));
if (object_type.equals("Signoff")) {
task1 = task;
} else if (object_type.equals("“认可”任务")) {
task2 = task;
}
}
if (task1 != null && task2 != null) {
TCComponent[] childTasks = task2.getRelatedComponents("child_tasks");
if (childTasks != null && childTasks.length > 0) {
for (int j = 0; j < childTasks.length; j++) {
TCComponent childTask = childTasks[j];
String childObject_type = childTask.getProperty("object_type");
System.out.println("object_type object_type2======" + childTask.getUid() + "======" + childTask.getProperty("object_type") + "======" + childTask.getProperty("object_name"));
if (childObject_type.equals("执行签发任务")) {
// kk 已完成任务直接将任务状态改为 已报检
TCComponentTask targetTask = (TCComponentTask) childTask;
String taskState = targetTask.getProperty("fnd0state");
System.out.println("任务状态: " + taskState);
if (!taskState.equals("完成")) {
System.out.println("代码自动完成");
TCComponentUser curUser = fu.session.getUser();
TCComponent userBox =curUser.getReferenceProperty("userinbox");
TCComponent taskBox = curUser.getReferenceProperty("taskinbox");
System.out.println(taskBox);
DataManagementService service=DataManagementService.getService(fu.session);
service.refreshObjects(new TCComponent[] {taskBox,userBox});
taskBox.refresh();
userBox.refresh();
System.out.println(childTask);
targetTask.performTaskAction(106, "代码自动完成", "", "认可", task1, null, null);
} else {
System.out.println("跳过自动完成");
}
}
}
}
}
}
}
protected void updateValues(HashMap<String, String> tableMap) {
JTable table = (JTable) fu.allComponentMap.get("a.31.11.11");
int rows[] = table.getSelectedRows();
for(int i : rows) {
for(Entry<String, String> e : tableMap.entrySet()) {
if(e.getKey().equals("ysr8_WiringPerson")) {
table.setValueAt(e.getValue(), i, 5);
} else if(e.getKey().equals("ysr8_ManuFactory1")) {
table.setValueAt(e.getValue(), i, 6);
} else if(e.getKey().equals("ysr8_WiringStartDate")) {
table.setValueAt(e.getValue(), i, START_INDEX);
} else if(e.getKey().equals("ysr8_PurchPlanDate")) {
table.setValueAt(e.getValue(), i, 16);
} else if(e.getKey().equals("ysr8_GasWiring")) {
table.setValueAt(e.getValue(), i, 18);
} else if(e.getKey().equals("ysr8_CircuitWiring")) {
table.setValueAt(e.getValue(), i, 19);
} else if(e.getKey().equals("ysr8_Remark")) {
table.setValueAt(e.getValue(), i, 20);
}
}
}
}
private TCComponent[] Pipingsort(HashMap<TCComponent,Date> map) {
int count = map.size();
// 通过ArrayList构造函数把map.entrySet()转换成list
List<Map.Entry<TCComponent, Date>> list = new ArrayList<Map.Entry<TCComponent, Date>>(map.entrySet());
// 通过比较器实现比较排序
Collections.sort(list, new Comparator<Map.Entry<TCComponent, Date>>() {
public int compare(Map.Entry<TCComponent, Date> mapping1, Map.Entry<TCComponent, Date> mapping2) {
// System.out.println(mapping1.getValue()+"=="+mapping2.getValue()+"--"+mapping1.getValue().compareTo(mapping2.getValue()));
return mapping1.getValue().compareTo(mapping2.getValue());
}
});
TCComponent[] TCComponent = new TCComponent[count];
int i=0;
for(Map.Entry<TCComponent, Date> mapping : list) {
TCComponent[i] = mapping.getKey();
i++;
}
return TCComponent;
}
}

@ -0,0 +1,184 @@
package cn.com.ebewin.ysr.dialog;
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.Entry;
import javax.swing.JButton;
import javax.swing.JComboBox;
import com.teamcenter.rac.aif.AbstractAIFDialog;
import com.teamcenter.rac.kernel.TCComponentScheduleTask;
import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCProperty;
import com.teamcenter.rac.util.DateButton;
import com.teamcenter.rac.util.MessageBox;
import com.teamcenter.rac.util.iTextField;
import cn.com.ebewin.ysr.util.DialogUtil;
@SuppressWarnings("deprecation")
public class PipingLinePlanningManagementEditDialog extends AbstractAIFDialog {
private static final long serialVersionUID = 1L;
private DialogUtil fu = new DialogUtil(this, "Åä¹ÜÏßÈÎÎñ±à¼­", "YSR8_PipingLinePlanningManagementEditDialog");
private TCComponentScheduleTask scheduTask = null;
private PipingLinePlanningManagementDialog ppmDialog;
//private Boolean setArrivalState = false;
public PipingLinePlanningManagementEditDialog(PipingLinePlanningManagementDialog ppmDialog, TCComponentScheduleTask scheduTask) throws TCException {
super(true);
this.ppmDialog = ppmDialog;
this.scheduTask = scheduTask;
fu.initializeUI(ppmDialog.fu.session);
centerToScreen();
loadRendering();
addActionListener();
getDefVal();
setVisible(true);
}
@SuppressWarnings("unchecked")
private void loadRendering() throws TCException {
iTextField ysr8_WiringPerson = (iTextField)fu.allComponentMap.get("ysr8_WiringPerson");
ysr8_WiringPerson.setText(scheduTask.getStringProperty("ysr8_WiringPerson"));
JComboBox<String> ysr8_ManuFactory1 = (JComboBox<String>)fu.allComponentMap.get("ysr8_ManuFactory1");
ysr8_ManuFactory1.setSelectedItem(scheduTask.getStringProperty("ysr8_ManuFactory1"));
/*DateButton ysr8_FixturePlanDate = (DateButton)fu.allComponentMap.get("ysr8_FixturePlanDate");
if (!scheduTask.getTCProperty("ysr8_FixturePlanDate").isPropValueNull()) {
System.out.println(ysr8_FixturePlanDate);
ysr8_FixturePlanDate.setDate(scheduTask.getTCProperty("ysr8_FixturePlanDate").getDateValue());
}
DateButton ysr8_PurchFinishDate = (DateButton)fu.allComponentMap.get("ysr8_PurchFinishDate");
if (!scheduTask.getTCProperty("ysr8_PurchFinishDate").isPropValueNull()) {
ysr8_PurchFinishDate.setDate(scheduTask.getTCProperty("ysr8_PurchFinishDate").getDateValue());
}*/
DateButton ysr8_WiringStartDate = (DateButton)fu.allComponentMap.get("ysr8_WiringStartDate");
if (!scheduTask.getTCProperty("ysr8_WiringStartDate").isPropValueNull()) {
ysr8_WiringStartDate.setDate(scheduTask.getTCProperty("ysr8_WiringStartDate").getDateValue());
}
DateButton ysr8_PurchPlanDate = (DateButton)fu.allComponentMap.get("ysr8_PurchPlanDate");
if (!scheduTask.getTCProperty("ysr8_PurchPlanDate").isPropValueNull()) {
ysr8_PurchPlanDate.setDate(scheduTask.getTCProperty("ysr8_PurchPlanDate").getDateValue());
}
iTextField ysr8_GasWiring = (iTextField)fu.allComponentMap.get("ysr8_GasWiring");
ysr8_GasWiring.setText(scheduTask.getStringProperty("ysr8_GasWiring"));
iTextField ysr8_CircuitWiring = (iTextField)fu.allComponentMap.get("ysr8_CircuitWiring");
ysr8_CircuitWiring.setText(scheduTask.getStringProperty("ysr8_CircuitWiring"));
iTextField ysr8_Remark = (iTextField)fu.allComponentMap.get("ysr8_Remark");
ysr8_Remark.setText(scheduTask.getStringProperty("ysr8_Remark"));
}
private void addActionListener() {
JButton btn = (JButton)fu.allComponentMap.get("b.81.12");
btn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
saveRendering();
}
});
btn = (JButton)fu.allComponentMap.get("b.81.14");
btn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
disposeDialog();
}
});
}
@SuppressWarnings("unchecked")
private void saveRendering() {
if (!checkCanSave()) {
return;
}
HashMap<String, String> valMap1 = new HashMap<String, String>();
// HashMap<String, String> tableMap = new HashMap<String, String>();
iTextField ysr8_WiringPerson = (iTextField)fu.allComponentMap.get("ysr8_WiringPerson");
valMap1.put("ysr8_WiringPerson", ysr8_WiringPerson.getText().toString());
JComboBox<String> ysr8_ManuFactory1 = (JComboBox<String>)fu.allComponentMap.get("ysr8_ManuFactory1");
valMap1.put("ysr8_ManuFactory1", ysr8_ManuFactory1.getSelectedItem().toString());
/*DateButton ysr8_FixturePlanDate = (DateButton)fu.allComponentMap.get("ysr8_FixturePlanDate");
valMap1.put("ysr8_FixturePlanDate", fu.getDateString(ysr8_FixturePlanDate.getDate()));
DateButton ysr8_PurchFinishDate = (DateButton)fu.allComponentMap.get("ysr8_PurchFinishDate");
valMap1.put("ysr8_PurchFinishDate", fu.getDateString(ysr8_PurchFinishDate.getDate()));
*/
DateButton ysr8_WiringStartDate = (DateButton)fu.allComponentMap.get("ysr8_WiringStartDate");
valMap1.put("ysr8_WiringStartDate", fu.getDateString(ysr8_WiringStartDate.getDate()));
DateButton ysr8_PurchPlanDate = (DateButton)fu.allComponentMap.get("ysr8_PurchPlanDate");
valMap1.put("ysr8_PurchPlanDate", fu.getDateString(ysr8_PurchPlanDate.getDate()));
iTextField ysr8_GasWiring = (iTextField)fu.allComponentMap.get("ysr8_GasWiring");
valMap1.put("ysr8_GasWiring", ysr8_GasWiring.getText().toString());
iTextField ysr8_CircuitWiring = (iTextField)fu.allComponentMap.get("ysr8_CircuitWiring");
valMap1.put("ysr8_CircuitWiring", ysr8_CircuitWiring.getText().toString());
iTextField ysr8_Remark = (iTextField)fu.allComponentMap.get("ysr8_Remark");
valMap1.put("ysr8_Remark", ysr8_Remark.getText().toString());
try {
for(Entry<String,String> entry: valMap1.entrySet()){
String key1 = entry.getKey();
String key2 = entry.getValue();
TCProperty property = (TCProperty)scheduTask.getTCProperty(key1);
switch (property.getPropertyType()) {
case TCProperty.PROP_string:
case TCProperty.PROP_long_string:
scheduTask.setStringProperty(key1, key2);
break;
case TCProperty.PROP_short:
case TCProperty.PROP_int:
scheduTask.setIntProperty(key1, Integer.parseInt(key2));
break;
case TCProperty.PROP_double:
case TCProperty.PROP_float:
scheduTask.setDoubleProperty(key1, Double.parseDouble(key2));
break;
case TCProperty.PROP_date:
if (!key2.equals("")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date date = sdf.parse(key2);
if (date != null) {
scheduTask.setDateProperty(key1, date);
}
}
break;
default:
scheduTask.setStringProperty(key1, key2);
break;
}
}
ppmDialog.updateValues(valMap1);
disposeDialog();
} catch (TCException ex) {
ex.printStackTrace();
MessageBox.post(ex);
return;
} catch (ParseException e) {
e.printStackTrace();
MessageBox.post(e);
return;
}
}
private void getDefVal() {
fu.getDefVal();
}
public boolean checkCanSave() {
return true;
}
}

@ -0,0 +1,108 @@
package cn.com.ebewin.ysr.dialog;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import com.teamcenter.rac.aif.AbstractAIFDialog;
import com.teamcenter.rac.util.MessageBox;
public class PipingLinePlanningWiringDialog extends AbstractAIFDialog {
private static final long serialVersionUID = -8956889736040215103L;
private JButton okBtn;
private JButton celBtn;
public boolean isChanged = false;
public String wiringNumStr = "";
private JTextField wiringNumField;
private double res=-1;
private double wiredNum;
private double arrivedNum;
public PipingLinePlanningWiringDialog(double wiringNum, double wiredNum, double arrivedNum) {
super(true);
this.res=wiringNum;
this.wiringNumStr = wiringNum+"";
this.wiredNum=wiredNum;
this.arrivedNum=arrivedNum;
}
public double getWiringNum() throws Exception {
initUI();
return res;
}
private void initUI() throws Exception {
this.setTitle("编辑");
this.setLayout(new BorderLayout());
this.setPreferredSize(new Dimension(300, 150));
JPanel mainPanel = new JPanel(new GridBagLayout());
GridBagConstraints s = new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0);
mainPanel.add(new JLabel("本次配管线数量:"), s);
s.gridx++;
this.wiringNumField = new JTextField();
//wiringNumField.setText(wiringNumStr);
s.weightx = 1;
s.insets = new Insets(5, 0, 5, 5);
mainPanel.add(wiringNumField, s);
JPanel btnPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 15, 5));
okBtn = new JButton("确定");
celBtn = new JButton("取消");
okBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
if(checkWiringNum()) {
disposeDialog();
}
}
});
celBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
disposeDialog();
}
});
btnPanel.add(okBtn);
btnPanel.add(celBtn);
this.add(BorderLayout.CENTER, mainPanel);
this.add(BorderLayout.SOUTH, btnPanel);
this.showDialog();
}
protected boolean checkWiringNum() {
wiringNumStr = wiringNumField.getText();
double wiringNum;
if(!"".equals(wiringNumStr)) {
try {
wiringNum=Double.parseDouble(wiringNumStr);
} catch (NumberFormatException e) {
MessageBox.post(PipingLinePlanningWiringDialog.this,"请填写正确的数字","提示",MessageBox.WARNING);
e.printStackTrace();
return false;
}
}else {
MessageBox.post(PipingLinePlanningWiringDialog.this,"请填写本次配管线数量","提示",MessageBox.WARNING);
return false;
}
if(wiringNum<=0) {
MessageBox.post(PipingLinePlanningWiringDialog.this,"请填写大于0的数量","提示",MessageBox.WARNING);
return false;
}
if(wiringNum>(arrivedNum-wiredNum)) {
MessageBox.post(PipingLinePlanningWiringDialog.this,"配管线数量不可大于(“已到货数量”-“已配管线数量”)","提示",MessageBox.WARNING);
return false;
}
this.res=wiringNum;
return true;
}
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,215 @@
package cn.com.ebewin.ysr.dialog;
import java.awt.Color;
import java.awt.Component;
import javax.swing.JTable;
import cn.com.ebewin.ysr.util.TableColorRender;
public class ProblemBoardDialogTableColorRender extends TableColorRender {
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
Component renderer = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
try {
if (column == 16) {
String result = table.getValueAt(row, 42).toString();
if(result.equals("NG"))
renderer.setBackground(Color.RED);
}else if (column == 19) {
String result = table.getValueAt(row, 45).toString();
if(result.equals("NG"))
renderer.setBackground(Color.RED);
}else if (column == 22) {
String result = table.getValueAt(row, 48).toString();
if(result.equals("NG"))
renderer.setBackground(Color.RED);
}else if (column == 32) {
String result = table.getValueAt(row, 52).toString();
if(result.equals("NG"))
renderer.setBackground(Color.RED);
}else if (column == 25) {
String result = table.getValueAt(row, 54).toString();
if(result.equals("NG"))
renderer.setBackground(Color.RED);
}else if (column == 28) {
String result = table.getValueAt(row, 57).toString();
if(result.equals("NG"))
renderer.setBackground(Color.RED);
}
/*if (column == 15) {
String ysr8_TechPlanDateVal = table.getValueAt(row, 15).toString();
if(ysr8_TechPlanDateVal.equals("-"))
return renderer;
String ysr8_TechFinishDateVal = table.getValueAt(row, 16).toString();
if (!ysr8_TechFinishDateVal.equals("-") && !ysr8_TechPlanDateVal.equals("-")) {
int nday = CommonUtil.getDaysBetween(ysr8_TechPlanDateVal, ysr8_TechFinishDateVal);
System.out.println("ysr8_TechFinishDateVal-ysr8_TechPlanDateVal====" + ysr8_TechFinishDateVal
+ "====" + ysr8_TechPlanDateVal + "====" + nday);
if (nday > 0) {
renderer.setBackground(Color.RED);
}
} else {
if (ysr8_TechPlanDateVal.equals("-")) {
//renderer.setBackground(Color.RED);
} else {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String currDate = sdf.format(new Date());
int nday = CommonUtil.getDaysBetween(ysr8_TechPlanDateVal, currDate);
System.out.println("currDate-ysr8_TechPlanDateVal====" + currDate + "====" + ysr8_TechPlanDateVal
+ "====" + nday);
if (nday > 0) {
renderer.setBackground(Color.RED);
}
}
}
} else if (column == 18) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String ysr8_TechPlanDateVal = table.getValueAt(row, 15).toString();
String ysr8_TechFinishDateVal = table.getValueAt(row, 16).toString();
String ysr8_PurchPlanDateVal = table.getValueAt(row, 18).toString();
if(ysr8_PurchPlanDateVal.equals("-"))
return renderer;
String ysr8_PurchFinishDateVal = table.getValueAt(row, 19).toString();
//TODO 采购计划时间顺延
Calendar c = Calendar.getInstance();
if(!ysr8_PurchPlanDateVal.equals("-") && !ysr8_TechPlanDateVal.equals("-") && !ysr8_TechFinishDateVal.equals("-")) {
int techDay = CommonUtil.getDaysBetween(ysr8_TechPlanDateVal, ysr8_TechFinishDateVal);
if (techDay > 0) {
c.setTime(sdf.parse(ysr8_PurchPlanDateVal));
c.add(Calendar.DAY_OF_MONTH, techDay);
ysr8_PurchPlanDateVal = sdf.format(c.getTime());
}
}
if (!ysr8_PurchPlanDateVal.equals("-") && !ysr8_PurchFinishDateVal.equals("-")) {
int nday = CommonUtil.getDaysBetween(ysr8_PurchPlanDateVal, ysr8_PurchFinishDateVal);
System.out.println("ysr8_PurchFinishDateVal-ysr8_PurchPlanDateVal====" + ysr8_PurchFinishDateVal
+ "====" + ysr8_PurchPlanDateVal + "====" + nday);
if (nday > 0) {
renderer.setBackground(Color.RED);
}
} else {
if (ysr8_PurchPlanDateVal.equals("-") || ysr8_TechFinishDateVal.equals("-")&&!ysr8_TechPlanDateVal.equals("-")) {
//renderer.setBackground(Color.RED);
} else {
String currDate = sdf.format(new Date());
int nday = CommonUtil.getDaysBetween(ysr8_PurchPlanDateVal, currDate);
System.out.println("currDate-ysr8_PurchPlanDateVal====" + currDate + "====" + ysr8_PurchPlanDateVal
+ "====" + nday);
if (nday > 0) {
renderer.setBackground(Color.RED);
}
}
}
} else if (column == 21) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String ysr8_TechPlanDateVal = table.getValueAt(row, 15).toString();
String ysr8_TechFinishDateVal = table.getValueAt(row, 16).toString();
String ysr8_MachinPlanDateVal = table.getValueAt(row, 21).toString();
if(ysr8_MachinPlanDateVal.equals("-"))
return renderer;
String ysr8_MachinFinishDateVal = table.getValueAt(row, 22).toString();
//TODO 加工计划时间顺延
Calendar c = Calendar.getInstance();
if(!ysr8_MachinPlanDateVal.equals("-") && !ysr8_TechPlanDateVal.equals("-") && !ysr8_TechFinishDateVal.equals("-")) {
int techDay = CommonUtil.getDaysBetween(ysr8_TechPlanDateVal, ysr8_TechFinishDateVal);
if (techDay > 0) {
c.setTime(sdf.parse(ysr8_MachinPlanDateVal));
c.add(Calendar.DAY_OF_MONTH, techDay);
ysr8_MachinPlanDateVal = sdf.format(c.getTime());
}
}
if (!ysr8_MachinPlanDateVal.equals("-") && !ysr8_MachinFinishDateVal.equals("-")) {
int nday = CommonUtil.getDaysBetween(ysr8_MachinPlanDateVal, ysr8_MachinFinishDateVal);
System.out.println("ysr8_PurchFinishDateVal-ysr8_MachinPlanDateVal====" + ysr8_MachinFinishDateVal
+ "====" + ysr8_MachinPlanDateVal + "====" + nday);
if (nday > 0) {
renderer.setBackground(Color.RED);
}
} else {
if (ysr8_MachinPlanDateVal.equals("-") || ysr8_TechFinishDateVal.equals("-")&&!ysr8_TechPlanDateVal.equals("-")) {
//renderer.setBackground(Color.RED);
} else {
String currDate = sdf.format(new Date());
int nday = CommonUtil.getDaysBetween(ysr8_MachinPlanDateVal, currDate);
System.out.println("currDate-ysr8_PurchPlanDateVal====" + currDate + "====" + ysr8_MachinPlanDateVal
+ "====" + nday);
if (nday > 0) {
renderer.setBackground(Color.RED);
}
}
}
} else if (column == 25) {
String ysr8_EnginePlanDateVal = table.getValueAt(row, 25).toString();
if(ysr8_EnginePlanDateVal.equals("-"))
return renderer;
String ysr8_FinishDateVal = table.getValueAt(row, 26).toString();
String ysr8_TechPlanDateVal = table.getValueAt(row, 15).toString();
String ysr8_PurchPlanDateVal = table.getValueAt(row, 18).toString();
String ysr8_MachinPlanDateVal = table.getValueAt(row, 21).toString();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//TODO
Calendar c = Calendar.getInstance();
if(!ysr8_MachinPlanDateVal.equals("-")) {
String ysr8_MachinFinishDateVal = table.getValueAt(row, 22).toString();
if(!ysr8_MachinFinishDateVal.equals("-")) {
int techDay = CommonUtil.getDaysBetween(ysr8_MachinPlanDateVal, ysr8_MachinFinishDateVal);
if (techDay > 0) {
c.setTime(sdf.parse(ysr8_EnginePlanDateVal));
c.add(Calendar.DAY_OF_MONTH, techDay);
ysr8_EnginePlanDateVal = sdf.format(c.getTime());
}
}
}else if(!ysr8_PurchPlanDateVal.equals("-")) {
String ysr8_PurchFinishDateVal = table.getValueAt(row, 19).toString();
if(!ysr8_PurchFinishDateVal.equals("-")) {
int techDay = CommonUtil.getDaysBetween(ysr8_PurchPlanDateVal, ysr8_PurchFinishDateVal);
if (techDay > 0) {
c.setTime(sdf.parse(ysr8_EnginePlanDateVal));
c.add(Calendar.DAY_OF_MONTH, techDay);
ysr8_EnginePlanDateVal = sdf.format(c.getTime());
}
}
}else if(!ysr8_TechPlanDateVal.equals("-")) {
String ysr8_TechFinishDateVal = table.getValueAt(row, 16).toString();
if(!ysr8_TechFinishDateVal.equals("-")) {
int techDay = CommonUtil.getDaysBetween(ysr8_TechPlanDateVal, ysr8_TechFinishDateVal);
if (techDay > 0) {
c.setTime(sdf.parse(ysr8_EnginePlanDateVal));
c.add(Calendar.DAY_OF_MONTH, techDay);
ysr8_EnginePlanDateVal = sdf.format(c.getTime());
}
}
}
if (!ysr8_EnginePlanDateVal.equals("-") && !ysr8_FinishDateVal.equals("-")) {
int nday = CommonUtil.getDaysBetween(ysr8_EnginePlanDateVal, ysr8_FinishDateVal);
System.out.println("ysr8_PurchFinishDateVal-ysr8_EnginePlanDateVal====" + ysr8_FinishDateVal
+ "====" + ysr8_EnginePlanDateVal + "====" + nday);
if (nday > 0) {
renderer.setBackground(Color.RED);
}
} else {
if (ysr8_EnginePlanDateVal.equals("-")) {
//renderer.setBackground(Color.RED);
} else {
String currDate = sdf.format(new Date());
int nday = CommonUtil.getDaysBetween(ysr8_EnginePlanDateVal, currDate);
System.out.println("currDate-ysr8_PurchPlanDateVal====" + currDate + "====" + ysr8_EnginePlanDateVal
+ "====" + nday);
if (nday > 0) {
renderer.setBackground(Color.RED);
}
}
}
}*/
}catch(Exception e) {
e.printStackTrace();
}
return renderer;
}
}

@ -0,0 +1,126 @@
package cn.com.ebewin.ysr.dialog;
import java.awt.BorderLayout;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Toolkit;
import javax.swing.JLabel;
import javax.swing.JProgressBar;
import com.teamcenter.rac.aif.AbstractAIFDialog;
@SuppressWarnings("serial")
public class ProgressReporterDialog extends AbstractAIFDialog
{
private JLabel messageLabel;
private JProgressBar progressBar;
private boolean requestCanceling;
private int percent;
public ProgressReporterDialog()
{
super(false);
setLayout(new BorderLayout());
setAlwaysOnTop(true);
initializeComponents();
setTextPropertyForComponents();
registerComponentsListeners();
addComponents();
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
}
private void initializeComponents()
{
messageLabel = new JLabel(" ", JLabel.LEFT);
progressBar = new JProgressBar();
}
private void setTextPropertyForComponents()
{
setTitle("½ø¶È");
}
private void registerComponentsListeners()
{
}
private void addComponents()
{
add(messageLabel, BorderLayout.NORTH);
add(progressBar, BorderLayout.SOUTH);
}
private void centerToClientScreen()
{
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
int x = screen.width - getWidth();
int y = screen.height - getHeight();
setLocation(x / 2, y / 2);
}
public void reportProgressMessage(String message)
{
messageLabel.setText(message);
}
public void setProgressPercent(int percent)
{
this.percent = percent;
}
public void requestCanceling()
{
requestCanceling = true;
}
public void run()
{
pack();
setSize(400, getHeight());
centerToClientScreen();
setVisible(true);
while (!requestCanceling)
{
if(percent > progressBar.getMaximum())
{
percent = 0;
}
progressBar.setValue(percent);
percent += 5;
try
{
Thread.sleep(100);
}
catch (InterruptedException e)
{
continue;
}
}
dispose();
}
public int getProgess()
{
return progressBar.getValue();
}
public boolean isRequestCanceling()
{
return requestCanceling;
}
}

@ -0,0 +1,710 @@
package cn.com.ebewin.ysr.dialog;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JTextField;
import com.teamcenter.rac.aif.AbstractAIFDialog;
import com.teamcenter.rac.kernel.ListOfValuesInfo;
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.TCComponentListOfValuesType;
import com.teamcenter.rac.kernel.TCComponentScheduleTask;
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;
import com.teamcenter.rac.util.iTextField;
import cn.com.ebewin.ysr.util.DialogUtil;
import cn.com.ebewin.ysr.util.KUtil;
import cn.com.ebewin.ysr.util.TCUtil;
@SuppressWarnings("deprecation")
public class QualityManagementBoardEditDialog extends AbstractAIFDialog {
private static final long serialVersionUID = 1L;
private DialogUtil fu = new DialogUtil(this, "质检更新", "YSR8_QualityManagementBoardEditDialog");
private TCSession session;
private int currTable = 0;
private ArrayList<Object> editObjectList = null;
private ArrayList<Integer> editObjectListIdx = null;
private ArrayList<Integer> editRows = null;
private boolean isSingleEdit = true;
private int examingNum;
private int arrivedNum;
private int examinedNum;
private QualityManagementBoardDialog qmb;
public QualityManagementBoardEditDialog(TCSession session, QualityManagementBoardDialog qmb, int currTable, ArrayList<Object> editObjectList, ArrayList<Integer> editObjectListIdx, ArrayList<Integer> editRows) throws TCException {
super(true);
this.session = session;
this.qmb = qmb;
this.currTable = currTable;
this.editObjectList = editObjectList;
this.editObjectListIdx = editObjectListIdx;
this.editRows = editRows;
if (editObjectList.size() > 1) {
this.isSingleEdit = false;
}
fu.initializeUI(qmb.fu.session);
centerToScreen();
loadRendering();
addActionListener();
getDefVal();
setVisible(true);
}
@SuppressWarnings("unchecked")
private void loadRendering() throws TCException {
JComboBox<String> ZJJL = (JComboBox<String>) fu.allComponentMap.get("ZJJL");//TODO lidy20190331合并LOV YSR8_INSPR3_LOV
TCComponentListOfValuesType lovType = (TCComponentListOfValuesType)session.getTypeComponent("ListOfValues");
TCComponentListOfValues[] lov = lovType.find("YSR8_INSPR3_LOV");
if(lov.length>0) {
ListOfValuesInfo lovInfo = lov[0].getListOfValues();
Map<Object, String> lovValue = lovInfo.getValueTable();
for(Map.Entry<Object, String> me : lovValue.entrySet()) {
ZJJL.addItem(me.getValue());
}
}
// if (currTable == 1) {
// ZJJL.addItem("合格");
// ZJJL.addItem("不合格");
// ZJJL.addItem("可调");
// } else if (currTable == 2) {
// ZJJL.addItem("合格");
// ZJJL.addItem("不合格");
// ZJJL.addItem("部分合格");
// }
if (!isSingleEdit) { // kk 0911 多行编辑时不可用
iTextField examingQuantityField = (iTextField) fu.allComponentMap.get("BCJYSL");
examingQuantityField.setEditable(false);
}
}
private void addActionListener() {
JButton btn = (JButton) fu.allComponentMap.get("b.41.12");
btn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
saveRendering();
}
});
btn = (JButton) fu.allComponentMap.get("b.41.14");
btn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
disposeDialog();
}
});
}
@SuppressWarnings("unchecked")
private void saveRendering() {
try {
if (!checkCanSave()) {
return;
}
} catch (Exception e1) {
MessageBox.post(this, "检查数据时出错:\n" + e1.toString(), "提示", MessageBox.ERROR);
e1.printStackTrace();
return;
}
HashMap<String, String> tableMap = new HashMap<String, String>();
// DateButton ZJWCRQ = (DateButton)fu.allComponentMap.get("ZJWCRQ");
JComboBox<String> ZJJL = (JComboBox<String>) fu.allComponentMap.get("ZJJL");
// JCheckBox TSWCRW = (JCheckBox)fu.allComponentMap.get("TSWCRW");
// Date ZJWCRQVal = ZJWCRQ.getDate();
// String ZJJLVal = ((JTextField) ZJJL.getEditor().getEditorComponent()).getText();
String ZJJLVal = ZJJL.getSelectedItem().toString();
tableMap.put("ZJJLVal", ZJJLVal);
tableMap.put("ysr8_SubQualityFinishDate", "");
double newExaminedNum = 0;
double newExamingNum = 0;
// String ysr8_TaskManuState = "3";
// Boolean TSWCRWVal = TSWCRW.isSelected();
try {
HashMap<String, String> valMap = new HashMap<String, String>();
if (currTable == 1) {
for (int i = 0; i < editObjectList.size(); i++) {
Object object = editObjectList.get(i);
if (object instanceof TCComponentScheduleTask) {
TCComponentScheduleTask scheduTask = (TCComponentScheduleTask) object;
valMap.put("ysr8_SubQualityResult", ZJJLVal);
/*
* if (TSWCRWVal) { valMap.put("ysr8_TaskManuState", "4"); }
*/
// kk 修改已检验数量和质检完成时间
//TODO lidy20190310特殊处理
valMap.put("ysr8_SubQualityFinishDate", "");
if (isSingleEdit) {
newExaminedNum=this.examinedNum + this.examingNum;
newExamingNum=this.examingNum;
}else {
getNums(object, i);
newExaminedNum=this.examinedNum;
newExamingNum=this.examingNum;
// ysr8_TaskManuState = "4";
}
valMap.put("ysr8_ExaminedQuantity", fu.getDoubleString(newExaminedNum));
valMap.put("ysr8_ExaminingQuantity", fu.getDoubleString(newExamingNum));
// valMap.put("ysr8_TaskManuState", ysr8_TaskManuState);
qmb.updateValue(fu.getDoubleString(newExamingNum), fu.getDoubleString(newExaminedNum), editRows.get(i));
for (Entry<String, String> entry : valMap.entrySet()) {
String key1 = entry.getKey();
String key2 = entry.getValue();
TCProperty property = (TCProperty) scheduTask.getTCProperty(key1);
switch (property.getPropertyType()) {
case TCProperty.PROP_string:
case TCProperty.PROP_long_string:
scheduTask.setStringProperty(key1, key2);
break;
case TCProperty.PROP_short:
case TCProperty.PROP_int:
scheduTask.setIntProperty(key1, Integer.parseInt(key2));
break;
case TCProperty.PROP_double:
case TCProperty.PROP_float:
scheduTask.setDoubleProperty(key1, Double.parseDouble(key2));
break;
case TCProperty.PROP_date:
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
if (!key2.equals("")) {
Date date = sdf.parse(key2);
if (date != null) {
scheduTask.setDateProperty(key1, date);
}
} else {
Date date = sdf.parse("0001-01-01");
scheduTask.setDateProperty(key1, date);
}
break;
default:
scheduTask.setStringProperty(key1, key2);
break;
}
}
} else if (object instanceof TCComponentItem) {
TCComponentItem item = (TCComponentItem) object;
TCComponentItemRevision revision = item.getLatestItemRevision();
TCComponentForm form = TCUtil.getItemRevisionMasterForm(revision);
String params = "", proName = "###", proVal = "###";
String object_typeVal = item.getProperty("object_type");
if (object_typeVal.equals("图样目录")) {
// kk 修改已检验数量和质检完成时间
{
//TODO lidy20190310特殊处理
String key1 = "ysr8_SubQualityFinishDate";
// String key2 = Integer.toString(editObjectListIdx.get(i)) + "$$$$" + "";
String key2 = "";
if (proName.equals("###")) {
proName = key1;
} else {
proName += "@@@@" + key1;
}
if (proVal.equals("###")) {
proVal = key2;
} else {
proVal += "@@@@" + key2;
}
}
if (isSingleEdit) {
newExaminedNum=this.examinedNum + this.examingNum;
newExamingNum=this.examingNum;
}else {
getNums(object, i);
newExamingNum=this.examinedNum;
newExaminedNum=this.examingNum;
qmb.updateValue(""+newExamingNum, ""+newExaminedNum, editRows.get(i));
// ysr8_TaskManuState = "4";
}
{
String key1 = "ysr8_ExaminedQuantity";
// String key2 = Integer.toString(editObjectListIdx.get(i)) + "$$$$" + fu.getDoubleString(newExaminedNum);
String key2 = fu.getDoubleString(newExaminedNum);
if (proName.equals("###")) {
proName = key1;
} else {
proName += "@@@@" + key1;
}
if (proVal.equals("###")) {
proVal = key2;
} else {
proVal += "@@@@" + key2;
}
}
{
String key1 = "ysr8_ExaminingQuantity";
// String key2 = Integer.toString(editObjectListIdx.get(i)) + "$$$$" + fu.getDoubleString(newExamingNum);
String key2 = fu.getDoubleString(newExamingNum);
if (proName.equals("###")) {
proName = key1;
} else {
proName += "@@@@" + key1;
}
if (proVal.equals("###")) {
proVal = key2;
} else {
proVal += "@@@@" + key2;
}
}
{
String key1 = "ysr8_SubQualityResult";
// String key2 = Integer.toString(editObjectListIdx.get(i)) + "$$$$" + ZJJLVal;
String key2 = ZJJLVal;
if (proName.equals("###")) {
proName = key1;
} else {
proName += "@@@@" + key1;
}
if (proVal.equals("###")) {
proVal = key2;
} else {
proVal += "@@@@" + key2;
}
}
}
params = item.getProperty("item_id") + "^^^^" + proName + "^^^^" + proVal;
TCUserService userService = fu.session.getUserService();
Object[] objParams = new Object[2];
String cmd = "Update_ItemRevForm_TCProperty";
objParams[0] = cmd;
objParams[1] = params;
long startime = System.currentTimeMillis();
String result = (String) userService.call("YSR8UserService", objParams);
long endtime = System.currentTimeMillis();
System.out.println("调用C耗时" + (endtime - startime) + "毫秒");
System.out.println(result);
form.refresh();
}
}
} else if (currTable == 2) {
for (int i = 0; i < editObjectList.size(); i++) {
Object object = editObjectList.get(i);
if (object instanceof TCComponentItem) {
TCComponentItem item = (TCComponentItem) object;
TCComponentItemRevision revision = item.getLatestItemRevision();
TCComponentForm form = TCUtil.getItemRevisionMasterForm(revision);
String params = "", proName = "", proVal = "";
String object_typeVal = item.getProperty("object_type");
if (object_typeVal.equals("图纸整改单")) {
// kk 修改已检验数量和质检完成时间
{
//TODO lidy20190310特殊处理
String key1 = "ysr8_SubQualityFinishDate";
String key2 = Integer.toString(editObjectListIdx.get(i)) + "$$$$" + "";
if (proName.equals("")) {
proName = key1;
} else {
proName += "@@@@" + key1;
}
if (proVal.equals("")) {
proVal = key2;
} else {
proVal += "@@@@" + key2;
}
}
if (isSingleEdit) {
newExaminedNum=this.examinedNum + this.examingNum;
newExamingNum=this.examingNum;
}else {
getNums(object, i);
newExamingNum=this.examingNum;
newExaminedNum=this.examinedNum;
System.out.println("ECN2:"+i+"editRow:"+editRows.get(i));
qmb.updateValue(""+newExamingNum, ""+newExaminedNum, editRows.get(i));
// ysr8_TaskManuState = "4";
}
{
String key1 = "ysr8_ExaminedQuantity";
String key2 = Integer.toString(editObjectListIdx.get(i)) + "$$$$" + fu.getDoubleString(newExaminedNum);
if (proName.equals("")) {
proName = key1;
} else {
proName += "@@@@" + key1;
}
if (proVal.equals("")) {
proVal = key2;
} else {
proVal += "@@@@" + key2;
}
}
{
String key1 = "ysr8_ExaminingQuantity";
String key2 = Integer.toString(editObjectListIdx.get(i)) + "$$$$" + fu.getDoubleString(newExamingNum);
if (proName.equals("")) {
proName = key1;
} else {
proName += "@@@@" + key1;
}
if (proVal.equals("")) {
proVal = key2;
} else {
proVal += "@@@@" + key2;
}
}
{
String key1 = "ysr8_SubQualityResult";
String key2 = Integer.toString(editObjectListIdx.get(i)) + "$$$$" + ZJJLVal;
if (proName.equals("")) {
proName = key1;
} else {
proName += "@@@@" + key1;
}
if (proVal.equals("")) {
proVal = key2;
} else {
proVal += "@@@@" + key2;
}
}
} else if (object_typeVal.equals("调试整改加工单")) {
// kk 修改已检验数量和质检完成时间
{
//TODO lidy20190310特殊处理
String key1 = "ysr8_SubQualityFinishDate";
String key2 = Integer.toString(editObjectListIdx.get(i)) + "$$$$" + "";
if (proName.equals("")) {
proName = key1;
} else {
proName += "@@@@" + key1;
}
if (proVal.equals("")) {
proVal = key2;
} else {
proVal += "@@@@" + key2;
}
}
if (isSingleEdit) {
newExaminedNum=this.examinedNum + this.examingNum;
newExamingNum=this.examingNum;
}else {
getNums(object, i);
newExamingNum=this.examingNum;
newExaminedNum=this.examinedNum;
System.out.println("ECN4:"+i+"editRow:"+editRows.get(i));
qmb.updateValue(""+newExamingNum, ""+newExaminedNum, editRows.get(i));
// ysr8_TaskManuState = "4";
}
{
String key1 = "ysr8_ExaminedQuantity";
String key2 = Integer.toString(editObjectListIdx.get(i)) + "$$$$" + fu.getDoubleString(newExaminedNum);
if (proName.equals("")) {
proName = key1;
} else {
proName += "@@@@" + key1;
}
if (proVal.equals("")) {
proVal = key2;
} else {
proVal += "@@@@" + key2;
}
}
{
String key1 = "ysr8_ExaminingQuantity";
String key2 = Integer.toString(editObjectListIdx.get(i)) + "$$$$" + fu.getDoubleString(newExamingNum);
if (proName.equals("")) {
proName = key1;
} else {
proName += "@@@@" + key1;
}
if (proVal.equals("")) {
proVal = key2;
} else {
proVal += "@@@@" + key2;
}
}
{
String key1 = "ysr8_SubQualityResult";
String key2 = Integer.toString(editObjectListIdx.get(i)) + "$$$$" + ZJJLVal;
if (proName.equals("")) {
proName = key1;
} else {
proName += "@@@@" + key1;
}
if (proVal.equals("")) {
proVal = key2;
} else {
proVal += "@@@@" + key2;
}
}
} else if (object_typeVal.equals("散部件检验记录")) {
// kk 修改已检验数量和质检完成时间
{
//TODO lidy20190310特殊处理
String key1 = "ysr8_SubQualityFinishDate";
String key2 = Integer.toString(editObjectListIdx.get(i)) + "$$$$" + "";
if (proName.equals("")) {
proName = key1;
} else {
proName += "@@@@" + key1;
}
if (proVal.equals("")) {
proVal = key2;
} else {
proVal += "@@@@" + key2;
}
}
if (isSingleEdit) {
newExaminedNum=this.examinedNum + this.examingNum;
newExamingNum=this.examingNum;
}else {
getNums(object, i);
newExamingNum=this.examingNum;
newExaminedNum=this.examinedNum;
System.out.println("INSP:"+i+"editRow:"+editRows.get(i));
qmb.updateValue(""+newExamingNum, ""+newExaminedNum, editRows.get(i));
// ysr8_TaskManuState = "4";
}
{
String key1 = "ysr8_ExaminedQuantity";
String key2 = Integer.toString(editObjectListIdx.get(i)) + "$$$$" + fu.getDoubleString(newExaminedNum);
if (proName.equals("")) {
proName = key1;
} else {
proName += "@@@@" + key1;
}
if (proVal.equals("")) {
proVal = key2;
} else {
proVal += "@@@@" + key2;
}
}
{
String key1 = "ysr8_ExaminingQuantity";
String key2 = Integer.toString(editObjectListIdx.get(i)) + "$$$$" + fu.getDoubleString(newExamingNum);
if (proName.equals("")) {
proName = key1;
} else {
proName += "@@@@" + key1;
}
if (proVal.equals("")) {
proVal = key2;
} else {
proVal += "@@@@" + key2;
}
}
{
String key1 = "ysr8_SubQualityResult";
String key2 = Integer.toString(editObjectListIdx.get(i)) + "$$$$" + ZJJLVal;
if (proName.equals("")) {
proName = key1;
} else {
proName += "@@@@" + key1;
}
if (proVal.equals("")) {
proVal = key2;
} else {
proVal += "@@@@" + key2;
}
}
}
params = item.getProperty("item_id") + "^^^^" + proName + "^^^^" + proVal;
TCUserService userService = fu.session.getUserService();
Object[] objParams = new Object[2];
String cmd = "Update_ItemRevForm_TCProperty";
objParams[0] = cmd;
objParams[1] = params;
long startime = System.currentTimeMillis();
String result = (String) userService.call("YSR8UserService", objParams);
long endtime = System.currentTimeMillis();
System.out.println("调用C耗时" + (endtime - startime) + "毫秒");
System.out.println(result);
form.refresh();
}
}
}
tableMap.put("ysr8_ExaminedQuantity", fu.getDoubleString(newExaminedNum));
tableMap.put("ysr8_ExaminingQuantity", fu.getDoubleString(newExamingNum));
// tableMap.put("ysr8_TaskManuState", ysr8_TaskManuState);
qmb.updateValues(tableMap);
disposeDialog();
} catch (TCException ex) {
ex.printStackTrace();
MessageBox.post(ex);
return;
} catch (ParseException e) {
e.printStackTrace();
MessageBox.post(e);
return;
}
}
private void getDefVal() {
fu.getDefVal();
}
public boolean checkCanSave() throws Exception {
@SuppressWarnings("unchecked")
JComboBox<String> ZJJL = (JComboBox<String>) fu.allComponentMap.get("ZJJL");
String ZJJLVal = ((JTextField) ZJJL.getEditor().getEditorComponent()).getText();
if (ZJJLVal == null || "".equals(ZJJLVal)) {
MessageBox.post(this, "质检结论不可为空", "提示", MessageBox.INFORMATION);
return false;
}
if (isSingleEdit) { // kk 0911 单行编辑时
iTextField examingQuantityField = (iTextField) fu.allComponentMap.get("BCJYSL");
String examingNumStr = examingQuantityField.getText();
if ("".equals(examingNumStr)) {
MessageBox.post(this, "本次检验数量不可为空", "提示", MessageBox.INFORMATION);
return false;
}
this.examingNum = KUtil.getIntFromString(examingNumStr, "本次检验数量");
if (examingNum <= 0) {
MessageBox.post(this, "本次检验数量必须大于零", "提示", MessageBox.INFORMATION);
return false;
}
String arrivedNumStr = "";
String examinedNumStr = "";
Object object = editObjectList.get(0);
if (currTable == 1) {
if (object instanceof TCComponentScheduleTask) {
TCComponentScheduleTask scheduTask = (TCComponentScheduleTask) object;
String ysr8_TaskUse = scheduTask.getProperty("ysr8_TaskUse");
if(ysr8_TaskUse.equals("配管线任务")) {
arrivedNumStr = scheduTask.getProperty("ysr8_WiredQuantity");
}else {
arrivedNumStr = scheduTask.getProperty("ysr8_ArrivedQuantity");
}
examinedNumStr = scheduTask.getProperty("ysr8_ExaminedQuantity");
} else if (object instanceof TCComponentItem) {
TCComponentItem item = (TCComponentItem) object;
TCComponentItemRevision revision = item.getLatestItemRevision();
TCComponentForm form = TCUtil.getItemRevisionMasterForm(revision);
arrivedNumStr = form.getProperty("ysr8_ArrivedQuantity");
examinedNumStr = form.getProperty("ysr8_ExaminedQuantity");
}
} else if (currTable == 2) {
if (object instanceof TCComponentItem) {
TCComponentItem item = (TCComponentItem) object;
TCComponentItemRevision revision = item.getLatestItemRevision();
TCComponentForm form = TCUtil.getItemRevisionMasterForm(revision);
TCProperty ysr8_ArrivedQuantity = form.getFormTCProperty("ysr8_ArrivedQuantity");
String[] ysr8_ArrivedQuantityVals = ysr8_ArrivedQuantity.getStringArrayValue();
if (ysr8_ArrivedQuantityVals != null && ysr8_ArrivedQuantityVals.length > editObjectListIdx.get(0)) {
arrivedNumStr = ysr8_ArrivedQuantityVals[editObjectListIdx.get(0)];
}
TCProperty ysr8_ExaminedQuantity = form.getFormTCProperty("ysr8_ExaminedQuantity");
String[] ysr8_ExaminedQuantityVals = ysr8_ExaminedQuantity.getStringArrayValue();
if (ysr8_ExaminedQuantityVals != null && ysr8_ExaminedQuantityVals.length > editObjectListIdx.get(0)) {
examinedNumStr = ysr8_ExaminedQuantityVals[editObjectListIdx.get(0)];
}
}
}
this.arrivedNum = KUtil.getIntFromString(arrivedNumStr, "已到货数量");
this.examinedNum = KUtil.getIntFromString(examinedNumStr, "已检验数量");
if (examingNum > (arrivedNum - examinedNum)) {
System.out.println("数量:"+examingNum+" : "+arrivedNum+" - "+examinedNum);
MessageBox.post(this, "需满足:“本次检验数量” <= “已到货数量”-“已检验数量”", "提示", MessageBox.INFORMATION);
return false;
}
} else {//lidy20181223
}
return true;
}
private void getNums(Object object, int i) throws TCException {//lidy20190107
String arrivedNumStr = "";
String examinedNumStr = "";
if (currTable == 1) {
if (object instanceof TCComponentScheduleTask) {
TCComponentScheduleTask scheduTask = (TCComponentScheduleTask) object;
String ysr8_TaskUse = scheduTask.getProperty("ysr8_TaskUse");
if(ysr8_TaskUse.equals("配管线任务")) {
arrivedNumStr = scheduTask.getProperty("ysr8_WiredQuantity");
}else {
arrivedNumStr = scheduTask.getProperty("ysr8_ArrivedQuantity");
}
examinedNumStr = scheduTask.getProperty("ysr8_ExaminedQuantity");
} else if (object instanceof TCComponentItem) {
TCComponentItem item = (TCComponentItem) object;
TCComponentItemRevision revision = item.getLatestItemRevision();
TCComponentForm form = TCUtil.getItemRevisionMasterForm(revision);
arrivedNumStr = form.getProperty("ysr8_ArrivedQuantity");
examinedNumStr = form.getProperty("ysr8_ExaminedQuantity");
}
} else if (currTable == 2) {
if (object instanceof TCComponentItem) {
TCComponentItem item = (TCComponentItem) object;
TCComponentItemRevision revision = item.getLatestItemRevision();
TCComponentForm form = TCUtil.getItemRevisionMasterForm(revision);
TCProperty ysr8_ArrivedQuantity = form.getFormTCProperty("ysr8_ArrivedQuantity");
String[] ysr8_ArrivedQuantityVals = ysr8_ArrivedQuantity.getStringArrayValue();
if (ysr8_ArrivedQuantityVals != null && ysr8_ArrivedQuantityVals.length > editObjectListIdx.get(i)) {
arrivedNumStr = ysr8_ArrivedQuantityVals[editObjectListIdx.get(i)];
}
TCProperty ysr8_ExaminedQuantity = form.getFormTCProperty("ysr8_ExaminedQuantity");
String[] ysr8_ExaminedQuantityVals = ysr8_ExaminedQuantity.getStringArrayValue();
if (ysr8_ExaminedQuantityVals != null && ysr8_ExaminedQuantityVals.length > editObjectListIdx.get(i)) {
examinedNumStr = ysr8_ExaminedQuantityVals[editObjectListIdx.get(i)];
}
}
}
int arrivedNum = 0;
int examinedNum = 0;
try {
if(arrivedNumStr!=null && !arrivedNumStr.isEmpty()) {
arrivedNum = Integer.parseInt(arrivedNumStr);
}
if(examinedNumStr!=null && !examinedNumStr.isEmpty()) {
examinedNum = Integer.parseInt(examinedNumStr);
}
} catch (NumberFormatException e) {
e.printStackTrace();
MessageBox.post(this, "解析已到货数量:" + arrivedNumStr + "与已检验数量:" + examinedNumStr + "出错", "提示", MessageBox.INFORMATION);
throw new TCException("解析已到货数量:" + arrivedNumStr + "与已检验数量:" + examinedNumStr + "出错");
}
examingNum = arrivedNum - examinedNum;
this.examinedNum = arrivedNum;
}
}

@ -0,0 +1,410 @@
package cn.com.ebewin.ysr.dialog;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Vector;
import javax.swing.JButton;
import javax.swing.JFrame;
import com.teamcenter.rac.kernel.TCComponentForm;
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;
import com.teamcenter.rac.util.iTextField;
import cn.com.ebewin.ysr.util.CommonUtil;
import cn.com.ebewin.ysr.util.DialogUtil;
import cn.com.ebewin.ysr.util.FileUtil;
import cn.com.ebewin.ysr.util.FormUtil;
import cn.com.ebewin.ysr.util.TCUtil;
import cn.com.ebewin.ysr.util.UIUtil;
public class RectificationPurchasingImportDialog extends JFrame {
private static final long serialVersionUID = 1L;
DialogUtil fu = new DialogUtil(this, "整改采购件到货数据导入", "YSR8_RectificationPurchasingImportDialog");
HashMap<String, TCComponentForm> allECN = new HashMap<String, TCComponentForm>();
HashMap<String, String> allECNType = new HashMap<String, String>();
private int c = 0;
public RectificationPurchasingImportDialog(TCSession session) throws TCException {
//super(true);
fu.initializeUI(session);
//centerToScreen();
this.setLocationRelativeTo(null);
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
loadRendering();
addActionListener();
setVisible(true);
}
private void loadRendering() throws TCException {
JButton btn = (JButton)fu.allComponentMap.get("b.11.16");
btn.setEnabled(false);
btn = (JButton)fu.allComponentMap.get("b.11.17");
btn.setEnabled(false);
}
private void addActionListener() {
JButton btn = (JButton)fu.allComponentMap.get("b.11.14");
btn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
loadExcel();
} catch (Exception e1) {
MessageBox.post(RectificationPurchasingImportDialog.this,"出错了:\n"+e1.getMessage(),"提示",MessageBox.ERROR);
e1.printStackTrace();
}
}
});
btn = (JButton)fu.allComponentMap.get("b.11.16");
btn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
checkData();
}
});
btn = (JButton)fu.allComponentMap.get("b.11.17");
btn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
importData();
}
});
}
private void loadExcel() throws Exception {
String[][] fileENames = { { ".xlsx", "MS-Excel文件(*.xlsx)" },{ ".xls", "MS-Excel文件(*.xls)" } };//lidy20190419支持xls格式
File file = FileUtil.openFileChooser(fileENames);
if (file == null) {
return;
}
iTextField textField = (iTextField)fu.allComponentMap.get("SJWJ");
textField.setText(file.getName());
UIUtil.JTableInfo ci = (FormUtil.JTableInfo)fu.allComponentInfos.get("a.21.11.11");
int rowCount = ci.dataTableModel.getRowCount();
for(int i = rowCount - 1; i >= 0; i--){
ci.dataTableModel.removeRow(i);
}
ci.dataTableModel.getDataVector().clear();
ci.dataTableModel.setRowCount(0);
//采购ID 货品ID 到货数量 到货日期
//序号 采购ID 货品ID 到货数量 到货日期 已到数量 要求数量 整改采购单号 采购序号 数据校验 提示信息
List<ArrayList<String>> listData = FileUtil.readExcel(file);
allECN.clear(); allECNType.clear();
//Integer idx = 0;
for (ArrayList<String> arrayList : listData) {
Vector<String> vec = new Vector<>();
String purchID = arrayList.get(1).toString();
Vector<String> purchIDPart = CommonUtil.split2Vector(purchID, "-");
if (purchIDPart.size() < 2) {
continue;
}
/*String ecnID = "";
for (int i = 0; i < purchIDPart.size() - 1; i++) {
ecnID += purchIDPart.get(i);
if (i + 1 == purchIDPart.size() - 1) {
} else {
ecnID += "-";
}
}*/
String ecnIdx = purchIDPart.get(purchIDPart.size() - 1);
//int ecnIdxint = Integer.parseInt(ecnIdx);
//kk TODO 0822
int ecnIdxint=getDigit(ecnIdx);
vec.add(arrayList.get(0));//序号
vec.add(purchID);//采购ID
vec.add(arrayList.get(3).toString());//货品ID
//vec.add(new DecimalFormat("#.00").format(arrayList.get(2)));//到货数量
vec.add(arrayList.get(4));//到货数量
vec.add(arrayList.get(5).toString());//到货日期
vec.add("");//已到数量
vec.add("");//要求数量
vec.add(arrayList.get(2));//整改采购单号
vec.add(Integer.toString(ecnIdxint));//采购序号
vec.add("");//数据校验
vec.add("");//提示信息
ci.dataTableModel.addRow(vec);
}
JButton btn = (JButton)fu.allComponentMap.get("b.11.16");
btn.setEnabled(ci.dataTableModel.getRowCount() > 0);
}
//kk TOOD 0822 提取字符串后面的数字
private int getDigit(String str) throws Exception {
int len=str.length();
String resStr="";
for(int i=len-1;i>=0;i--) {
char c=str.charAt(i);
if(Character.isDigit(c)) {
resStr=c+resStr;
}else {
break;
}
}
int res=0;
// if(!"".equals(resStr)) {
// throw new Exception("无法从字符串中提取末尾数字:"+str);
// }
if("".equals(resStr)) {
throw new Exception("无法从字符串中提取末尾数字:"+str);
}
res = new Integer(resStr);
return res;
}
private void checkData() {
UIUtil.JTableInfo ci = (FormUtil.JTableInfo)fu.allComponentInfos.get("a.21.11.11");
try {
//序号 采购ID 货品ID 到货数量 到货日期 已到数量 要求数量 整改采购单号 采购序号 数据校验 提示信息
for (int i = 0; i < ci.dataTableModel.getRowCount(); i++) {
String currFinishQuantity = ci.dataTableModel.getValueAt(i, 3).toString();
String ecnID = ci.dataTableModel.getValueAt(i, 7).toString();
String ecnIdx = ci.dataTableModel.getValueAt(i, 8).toString();
TCComponentForm ecnRevisionForm = allECN.get(ecnID);
System.out.println(ecnID);
if (ecnRevisionForm == null) {
TCComponentItem ecnItem = TCUtil.findItemByID(fu.session, ecnID);
if(ecnItem == null) {
ci.dataTableModel.setValueAt("×", i, 9);
ci.dataTableModel.setValueAt("找不到匹配的整改采购单!", i, 10);
continue;
}
String objectType;
objectType = ecnItem.getProperty("object_type");
if(!objectType.equalsIgnoreCase("整改采购单") && !objectType.equalsIgnoreCase("调试整改采购单")) {
ci.dataTableModel.setValueAt("×", i, 9);
ci.dataTableModel.setValueAt("找不到匹配的整改采购单!", i, 10);
continue;
}
allECNType.put(ecnID, objectType);
TCComponentItemRevision ecnRevision = ecnItem.getLatestItemRevision();
ecnRevisionForm = TCUtil.getItemRevisionMasterForm(ecnRevision);
allECN.put(ecnID, ecnRevisionForm);
}
if (ecnRevisionForm == null) {
ci.dataTableModel.setValueAt("×", i, 9);
ci.dataTableModel.setValueAt("找不到匹配的整改采购单!", i, 10);
continue;
}
String objectType = allECNType.get(ecnID);
TCProperty ysr8_SerialNo = null, ysr8_FinishQuantity = null, ysr8_Quantity = null;
if (objectType.equalsIgnoreCase("整改采购单")) {
ysr8_SerialNo = (TCProperty)ecnRevisionForm.getFormTCProperty("ysr8_SerialNo");
ysr8_FinishQuantity = (TCProperty)ecnRevisionForm.getFormTCProperty("ysr8_FinishQuantity");
ysr8_Quantity = (TCProperty)ecnRevisionForm.getFormTCProperty("ysr8_Quantity");
} else if (objectType.equalsIgnoreCase("调试整改采购单")) {
ysr8_SerialNo = (TCProperty)ecnRevisionForm.getFormTCProperty("ysr8_SerialNo");
ysr8_FinishQuantity = (TCProperty)ecnRevisionForm.getFormTCProperty("ysr8_FinishQuantity");
ysr8_Quantity = (TCProperty)ecnRevisionForm.getFormTCProperty("ysr8_Quantity");
}
int[] ysr8_SerialNoVals;
double[] ysr8_FinishQuantityVals, ysr8_QuantityVals;
ysr8_SerialNoVals = ysr8_SerialNo.getIntArrayValue();
ysr8_FinishQuantityVals = ysr8_FinishQuantity.getDoubleArrayValue();
ysr8_QuantityVals = ysr8_Quantity.getDoubleArrayValue();
double ysr8_FinishQuantityVal = 0.0, ysr8_QuantityVal = 0.0;
boolean find = false;
for(int m = 0; m < ysr8_SerialNoVals.length; m++){
if (ysr8_SerialNoVals[m] == Integer.parseInt(ecnIdx)) {
ysr8_FinishQuantityVal = ysr8_FinishQuantityVals[m];
ysr8_QuantityVal = ysr8_QuantityVals[m];
find = true;
break;
}
}
if (!find) {
ci.dataTableModel.setValueAt("×", i, 9);
ci.dataTableModel.setValueAt("找不到匹配采购ID的货品信息", i, 10);
continue;
}
ysr8_FinishQuantityVal += Double.parseDouble(currFinishQuantity);
ci.dataTableModel.setValueAt(fu.getDoubleString(ysr8_FinishQuantityVal), i, 5);//已到数量
ci.dataTableModel.setValueAt(fu.getDoubleString(ysr8_QuantityVal), i, 6);//要求数量
if (ysr8_FinishQuantityVal > ysr8_QuantityVal) {
ci.dataTableModel.setValueAt("×", i, 9);
ci.dataTableModel.setValueAt("到货数量之和超出要求数量,请确认!", i, 10);
continue;
} else if (ysr8_FinishQuantityVal < ysr8_QuantityVal) {
ci.dataTableModel.setValueAt("√", i, 9);
ci.dataTableModel.setValueAt("到货数量之和小于要求数量...", i, 10);
} else {
ci.dataTableModel.setValueAt("√", i, 9);
}
}
} catch (TCException e) {
e.printStackTrace();
return;
}
JButton btn = (JButton)fu.allComponentMap.get("b.11.17");
btn.setEnabled(true);
}
private void importData() {
final ProgressReporterDialog reporter = new ProgressReporterDialog();
reporter.reportProgressMessage("正在导入,请稍候...");
new Thread(reporter).start();
new Thread() {
public void run() {
fu.session.setStatus("正在导入...");
c = 0;
importData_Sub();
fu.session.setStatus("就绪");
reporter.requestCanceling();
MessageBox.post("导入完成,共导入"+c+"条数据", "导入结果", MessageBox.WARNING);
}
}.start();
// Display.getDefault().syncExec(new Runnable() {
// @Override
// public void run() {
// try {
// new ProgressMonitorDialog(null).run(true, false, new IRunnableWithProgress() {
// @Override
// public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
// fu.session.setStatus("正在导入...");
// importData_Sub();
// fu.session.setStatus("就绪");
// MessageBox.post("导入成功!", "导入结果", MessageBox.WARNING);
// }
// });
// } catch (InvocationTargetException | InterruptedException ex) {
// ex.printStackTrace();
// MessageBox.post("导入失败!\n" + ex.getMessage(), "导入结果", MessageBox.WARNING);
// }
// }
// });
//MessageBox.post(this, "导入成功!", "导入结果", MessageBox.INFORMATION);//TODO lidy20190408导入失败
}
private void importData_Sub() {
JButton btn = (JButton)fu.allComponentMap.get("b.11.17");
btn.setEnabled(false);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
UIUtil.JTableInfo ci = (FormUtil.JTableInfo)fu.allComponentInfos.get("a.21.11.11");
// monitor.beginTask("正在导入:", ci.dataTableModel.getRowCount());
//序号 采购ID 货品ID 到货数量 到货日期 已到数量 要求数量 整改采购单号 采购序号 数据校验 提示信息
for (int i = 0; i < ci.dataTableModel.getRowCount(); i++) {
String check = ci.dataTableModel.getValueAt(i, 9).toString();
String ecnID = ci.dataTableModel.getValueAt(i, 7).toString();
String ecnIdx = ci.dataTableModel.getValueAt(i, 8).toString();
if (!check.equals("√")) {
// monitor.worked(1);
System.out.println(ecnID + "----" + ecnIdx + " 未通过检查检查");
continue;
}
System.out.println("正在导入:" + ecnID + "----" + ecnIdx);
String finishDate = ci.dataTableModel.getValueAt(i, 4).toString();
String finishQuantity = ci.dataTableModel.getValueAt(i, 5).toString();
String quantity = ci.dataTableModel.getValueAt(i, 6).toString();
double finishQuantityDouble = Double.parseDouble(finishQuantity);
double quantityDouble = Double.parseDouble(quantity);
TCComponentForm ecnRevisionForm = allECN.get(ecnID);
String objectType = allECNType.get(ecnID);
TCProperty ysr8_SerialNo = null, ysr8_FinishQuantity = null, ysr8_SubPurchFinishDate = null;
if (objectType.equalsIgnoreCase("整改采购单")) {
ysr8_SerialNo = (TCProperty)ecnRevisionForm.getFormTCProperty("ysr8_SerialNo");
ysr8_FinishQuantity = (TCProperty)ecnRevisionForm.getFormTCProperty("ysr8_FinishQuantity");
ysr8_SubPurchFinishDate = (TCProperty)ecnRevisionForm.getFormTCProperty("ysr8_SubPurchFinishDate");
} else if (objectType.equalsIgnoreCase("调试整改采购单")) {
ysr8_SerialNo = (TCProperty)ecnRevisionForm.getFormTCProperty("ysr8_SerialNo");
ysr8_FinishQuantity = (TCProperty)ecnRevisionForm.getFormTCProperty("ysr8_FinishQuantity");
ysr8_SubPurchFinishDate = (TCProperty)ecnRevisionForm.getFormTCProperty("ysr8_SubPurchFinishDate");
}
int[] ysr8_SerialNoVals;
double[] ysr8_FinishQuantityVals;
Date[] ysr8_SubPurchFinishDateVals;
ysr8_SerialNoVals = ysr8_SerialNo.getIntArrayValue();
ysr8_FinishQuantityVals = ysr8_FinishQuantity.getDoubleArrayValue();
ysr8_SubPurchFinishDateVals = ysr8_SubPurchFinishDate.getDateValueArray();
CommonUtil.setByPass(true);
for(int m = 0; m < ysr8_SerialNoVals.length; m++){
if (ysr8_SerialNoVals[m] == Integer.parseInt(ecnIdx)) {
if (finishQuantityDouble == quantityDouble) {
ysr8_FinishQuantityVals[m] = finishQuantityDouble;
ysr8_FinishQuantity.setDoubleValueArray(ysr8_FinishQuantityVals);
ysr8_SubPurchFinishDateVals[m] = sdf.parse(finishDate);
ysr8_SubPurchFinishDate.setDateValueArray(ysr8_SubPurchFinishDateVals);
TCProperty[] formPropertyArray = new TCProperty[2];
formPropertyArray[0] = ysr8_FinishQuantity;
formPropertyArray[1] = ysr8_SubPurchFinishDate;
ecnRevisionForm.setTCProperties(formPropertyArray);
//TODO
String oldEnd = "0000-01-01";
int count = 0;
for(Date date : ysr8_SubPurchFinishDateVals) {
if(date!=null) {
count++;
}
if(date==null)
continue;
String dateTime = sdf.format(date);
if (oldEnd.compareTo(dateTime) < 0) {
oldEnd = dateTime;
}
}
Date ysr8_PurchFinishDate = ecnRevisionForm.getDateProperty("ysr8_PurchFinishDate");
if(ysr8_PurchFinishDate==null || !sdf.format(ysr8_PurchFinishDate).equals(oldEnd)) {
//修改
if(count == ysr8_SubPurchFinishDateVals.length) {
ecnRevisionForm.setDateProperty("ysr8_PurchFinishDate", sdf.parse(oldEnd));
}
}
} else {
ysr8_FinishQuantityVals[m] = finishQuantityDouble;
ysr8_FinishQuantity.setDoubleValueArray(ysr8_FinishQuantityVals);
TCProperty[] formPropertyArray = new TCProperty[1];
formPropertyArray[0] = ysr8_FinishQuantity;
ecnRevisionForm.setTCProperties(formPropertyArray);
}
break;
}
}
CommonUtil.setByPass(false);
c++;
// monitor.worked(1);
}
// monitor.done();
} catch (Exception ex) {
ex.printStackTrace();
}
}
}

@ -0,0 +1,319 @@
package cn.com.ebewin.ysr.dialog;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Date;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import com.teamcenter.rac.aif.AbstractAIFDialog;
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
import com.teamcenter.rac.kernel.ListOfValuesInfo;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentScheduleTask;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.schedule.commands.properties.WorkflowTemplateComboBox;
import com.teamcenter.rac.schedule.scheduler.componentutils.TaskHelper;
import com.teamcenter.rac.util.DateButton;
import com.teamcenter.rac.util.MessageBox;
import cn.com.ebewin.ysr.util.CommonUtil;
@SuppressWarnings({ "serial", "deprecation" })
public class ScheduleTaskEditDialog extends AbstractAIFDialog{
private TCSession session;
private AbstractAIFUIApplication app;
private ListOfValuesInfo taskUseLov;
private ListOfValuesInfo statusLov;
private JTextField countField;
private JComboBox<String> taskUseComboBox;
private WorkflowTemplateComboBox workflowBox;
private DateButton planDate;
private JComboBox<String> taskStatusBox;
private JTextField taskName;
private JButton okBtn;
private InterfaceAIFComponent[] targets;
private static final String PROP_COUNT="ysr8_PartNumber";
private static final String PROP_TASKUSE="ysr8_TaskUse";
private static final String PROP_PLANDATE="finish_date";
private static final String PROP_TASKSTATUS="fnd0status";
private static final String PROP_TASKNAME="object_name";
private static final String PROP_WORKFLOW="workflow_template";
public ScheduleTaskEditDialog(AbstractAIFUIApplication app, TCSession session) {
super(true);
this.app=app;
this.session=session;
}
@Override
public void run() {
//获取目标任务
this.targets = app.getTargetComponents();
if(targets==null||targets.length==0) {
return;
}
//获取LOV
this.taskUseLov = CommonUtil.getLov("YSR8_ScheduleTask01_LOV", session);
if(this.taskUseLov==null) {
MessageBox.post("没有找到LOVYSR8_ScheduleTask01_LOV","提示",MessageBox.WARNING);
return;
}
this.statusLov = CommonUtil.getLov("Fnd0state_status", session);
if(this.statusLov==null) {
MessageBox.post("没有找到LOVYSR8_SFnd0state_status","提示",MessageBox.WARNING);
return;
}
//初始化界面
initUI();
}
private void initUI() {
if(this.targets.length==1) {
this.setTitle("时间表属性编辑--"+this.targets[0]);
}else {
this.setTitle("时间表属性编辑(选中"+this.targets.length+"个对象)");
}
this.setLayout(new BorderLayout());
this.setPreferredSize(new Dimension(500, 200));
this.setMinimumSize(new Dimension(300, 150));
JPanel mainPanel=new JPanel(new GridBagLayout());
GridBagConstraints s = new GridBagConstraints();
s.fill = GridBagConstraints.BOTH;
s.gridwidth = 1;
s.gridheight=1;
s.weightx = 0;
s.weighty = 0;
s.gridx=0;
s.gridy=0;
s.insets=new Insets(3, 10, 3, 10);
mainPanel.add(new JLabel("数量"),s);
this.countField=new JTextField();
s.gridx++;
s.weightx=1;
mainPanel.add(this.countField,s);
s.weightx=0;
s.gridx++;
mainPanel.add(new JLabel("任务用途"),s);
this.taskUseComboBox=new JComboBox<>();
s.gridx++;
s.weightx=0.6;
mainPanel.add(this.taskUseComboBox,s);
s.gridx=0;
s.gridy++;
mainPanel.add(new JLabel("计划完成时间"),s);
this.planDate=new DateButton(null, "yyyy-MM-dd", false, false, false);
s.gridx++;
s.weightx=1;
mainPanel.add(this.planDate,s);
s.weightx=0;
s.gridx++;
mainPanel.add(new JLabel("任务状态"),s);
this.taskStatusBox=new JComboBox<String>();
// taskStatus.addItem("未开始");
// taskStatus.addItem("进行中");
// taskStatus.addItem("需要注意");
// taskStatus.addItem("迟的");
// taskStatus.addItem("完成");
// taskStatus.addItem("已放弃");
// taskStatus.addItem("已终止");
s.gridx++;
s.weightx=0.6;
mainPanel.add(this.taskStatusBox,s);
s.gridx=0;
s.gridy++;
mainPanel.add(new JLabel("任务名称"),s);
this.taskName=new JTextField();
s.gridx++;
s.weightx=1;
s.gridwidth = 4;
mainPanel.add(this.taskName,s);
s.gridwidth = 1;
s.weightx=0;
s.gridx=0;
s.gridy++;
mainPanel.add(new JLabel("工作流程模板"),s);
// this.workflowBox=new JComboBox<>();
this.workflowBox = new WorkflowTemplateComboBox();
s.gridx++;
s.weightx=0.6;
s.gridwidth = 4;
mainPanel.add(this.workflowBox,s);
s.weightx=0;
JPanel btnPanel=new JPanel(new FlowLayout(FlowLayout.CENTER,15,5));
this.okBtn=new JButton("确认保存");
btnPanel.add(okBtn);
//初始化数据
try {
initData();
} catch (Exception e) {
MessageBox.post("初始化数据失败:"+e.getMessage(),"提示",MessageBox.WARNING);
e.printStackTrace();
return;
}
//设置监听
addListeners();
this.add(BorderLayout.CENTER,mainPanel);
this.add(BorderLayout.SOUTH,btnPanel);
this.showDialog();
}
private void initData() throws Exception {
String[] lovVals = this.taskUseLov.getLOVDisplayValues();
this.taskUseComboBox.addItem(null);
for (String v : lovVals) {
this.taskUseComboBox.addItem(v);
}
lovVals = this.statusLov.getLOVDisplayValues();
this.taskStatusBox.addItem(null);
for (String v : lovVals) {
this.taskStatusBox.addItem(v);
}
// Object[] lovValues = TaskHelper.getWFTemplatesList(session);
// this.workflowBox.addItem(null);
// for (Object v : lovValues) {
// this.workflowBox.addItem(v);
// }
TCComponentScheduleTask targetTask = (TCComponentScheduleTask)this.targets[0];
// workflowBox.load(targetTask);
workflowBox.addItems(TaskHelper.getWFTemplatesList(session));
// addItems(TaskHelper.getWFTemplatesList(session));
if(this.targets.length==1) {
String taskUseReal=targetTask.getTCProperty(PROP_TASKUSE).getStringValue();
String taskStatusReal=targetTask.getTCProperty(PROP_TASKSTATUS).getStringValue();
String count=targetTask.getProperty(PROP_COUNT);
String taskUse=this.taskUseLov.getDisplayableValue(taskUseReal);
String taskStatus=this.statusLov.getDisplayableValue(taskStatusReal);
Object workflow=targetTask.getReferenceProperty(PROP_WORKFLOW);//.getProperty(PROP_WORKFLOW);
System.out.println("workflow:"+workflow);
this.taskUseComboBox.setSelectedItem(taskUse);
this.workflowBox.setSelectedItem(workflow);
this.countField.setText(count);
Date date=targetTask.getDateProperty(PROP_PLANDATE);
// String state=targetTask.getProperty(PROP_TASKSTATUS);
String name=targetTask.getProperty(PROP_TASKNAME);
this.planDate.setDate(date);
this.taskStatusBox.setSelectedItem(taskStatus);
this.taskName.setText(name);
}
}
private void addListeners() {
this.okBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
try {
okEvent();
} catch (Exception e) {
e.printStackTrace();
MessageBox.post("保存属性时发生错误:"+e.getMessage(),"提示",MessageBox.ERROR);
}
}
});
}
private boolean checkInput() {
String count=this.countField.getText();
try {
if(!"".equals(count)) {
Integer.parseInt(count);
}
return true;
} catch (NumberFormatException e) {
MessageBox.post("数量请输入整数","提示",MessageBox.INFORMATION);
} catch (Exception e) {
MessageBox.post("检查用户输入数据时发生异常:"+e.getMessage(),"提示",MessageBox.WARNING);
}
return false;
}
private void okEvent() throws Exception {
if(checkInput()) {
String countStr=this.countField.getText();
Object taskUse=this.taskUseComboBox.getSelectedItem();
Date date=this.planDate.getDate();
Object status=this.taskStatusBox.getSelectedItem();
Object workflow=this.workflowBox.getSelectedItem();
String name=this.taskName.getText();
//任务状态
if(status!=null) {
String taskStatusReal=(String) this.statusLov.getRealValue(status.toString());
System.out.println("statusReal:"+taskStatusReal);
if(taskStatusReal!=null) {
for (InterfaceAIFComponent comp : targets) {
String statused = ((TCComponentScheduleTask)comp).getStringProperty(PROP_TASKSTATUS);
if(!statused.equals(taskStatusReal))
((TCComponentScheduleTask)comp).setProperty(PROP_TASKSTATUS, taskStatusReal);
}
}
}
// else {
// for (InterfaceAIFComponent comp : targets) {
// ((TCComponentScheduleTask)comp).getTCProperty(PROP_TASKSTATUS).setValueFromString("");
// }
// }
//工作流程模板
if(workflow!=null) {
// String taskStatusReal=(String) this.statusLov.getRealValue(status.toString());
System.out.println("workflow:"+workflow);
for (InterfaceAIFComponent comp : targets) {
TCComponentScheduleTask task = (TCComponentScheduleTask)comp;
System.out.println("PROP_TASKSTATUS:"+task.getStringProperty(PROP_TASKSTATUS));
if(task.getStringProperty(PROP_TASKSTATUS).equals("not_started")) {
if(workflow instanceof TCComponent)
task.setReferenceProperty(PROP_WORKFLOW, (TCComponent) workflow);
else if("没有工作流程模板".equals(workflow) || "".equals(workflow)) {
task.getTCProperty(PROP_WORKFLOW).setReferenceValue(null);
}
}
}
}
//数量
int count=0;
if(!"".equals(countStr)) {
count = Integer.parseInt(countStr);
}
for (InterfaceAIFComponent comp : targets) {
((TCComponentScheduleTask)comp).setIntProperty(PROP_COUNT,count);
((TCComponentScheduleTask)comp).setDateProperty(PROP_PLANDATE,date);
// ((TCComponentScheduleTask)comp).setProperty(PROP_TASKSTATUS,state);
((TCComponentScheduleTask)comp).setProperty(PROP_TASKNAME,name);
}
//用途
if(taskUse!=null) {
String taskUseReal=(String) this.taskUseLov.getRealValue(taskUse.toString());
if(taskUseReal!=null) {
for (InterfaceAIFComponent comp : targets) {
((TCComponentScheduleTask)comp).setStringProperty(PROP_TASKUSE, taskUseReal);
}
}
}else {
for (InterfaceAIFComponent comp : targets) {
((TCComponentScheduleTask)comp).getTCProperty(PROP_TASKUSE).setValueFromString("");
}
}
disposeDialog();
MessageBox.post("数据保存完成!","提示",MessageBox.INFORMATION);
}
}
}

@ -0,0 +1,305 @@
package cn.com.ebewin.ysr.dialog;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Vector;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.border.TitledBorder;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableColumn;
import com.teamcenter.rac.aif.AbstractAIFDialog;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.util.MessageBox;
import com.teamcenter.rac.util.PropertyLayout;
import com.teamcenter.rac.util.iTextField;
import cn.com.ebewin.ysr.util.TCUtil;
public class SelectMotomanModleDialog extends AbstractAIFDialog {
private static final long serialVersionUID = 1L;
private TCSession session;
public String retJQRXH = "";
public String retBTXH = "";
public String retBZ = "";
public String retKZGXH = "";
private iTextField txtJQRXH;
private iTextField txtBTXH;
private iTextField txtYT;
private iTextField txtKDBJC;
private iTextField txtKDBJZ;
private iTextField txtFZC;
private iTextField txtFZZ;
private iTextField txtCFDWJDC;
private iTextField txtCFDWJDZ;
private JButton btnSearch;
private JButton btnOK;
private JButton btnCancel;
private JTable table;
String names[] = ("控制柜,机器人型号,本体型号,用途,备注,负载(kg),P点水平可达(mm),重复定位精度(±mm),颜色,IP等级:本体/腕部").split(",");
private SearchResultTableModel dtm;
public class SearchResultTableModel extends DefaultTableModel {
private static final long serialVersionUID = 1L;
public SearchResultTableModel(String[] names, int index) {
super(new Object[0][], names);
}
@Override
public boolean isCellEditable(int row, int column) {
return false;
}
public Class<?> getColumnClass(int column) {
return getValueAt(0, column).getClass();
}
// 设置列宽:
public void FitTableColumns(JTable myTable) {
JTableHeader header = myTable.getTableHeader();
int rowCount = myTable.getRowCount();
Enumeration<TableColumn> columns = myTable.getColumnModel().getColumns();
while (columns.hasMoreElements()) {
TableColumn column = (TableColumn) columns.nextElement();
int col = header.getColumnModel().getColumnIndex(column.getIdentifier());
int width = (int) myTable.getTableHeader().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 + 10);
}
}
}
public SelectMotomanModleDialog(TCSession session) {
super(true);
this.session = session;
setTitle("机器人型号查询");
initializeUI();
addActionListener();
setVisible(true);
}
private void initializeUI() {
txtJQRXH = new iTextField("*", 25);
txtBTXH = new iTextField(25);
txtYT = new iTextField(25);
txtKDBJC = new iTextField(25);
txtKDBJZ = new iTextField(25);
txtFZC = new iTextField(25);
txtFZZ = new iTextField(25);
txtCFDWJDC = new iTextField(25);
txtCFDWJDZ = new iTextField(25);
btnSearch = new JButton("查 询");
btnOK = new JButton("确定");
btnCancel = new JButton("取消");
JPanel paneTop = new JPanel(new PropertyLayout());
paneTop.add("1.1.left.center", new JLabel("机器人型号:    "));
paneTop.add("1.2.left.center", txtJQRXH);
paneTop.add("1.3.left.center", new JLabel("          "));
paneTop.add("1.4.right.center", btnSearch);
paneTop.add("2.1.left.center", new JLabel("本体型号:     "));
paneTop.add("2.2.left.center", txtBTXH);
paneTop.add("2.3.left.center", new JLabel(" 用途: "));
paneTop.add("2.4.left.center", txtYT);
paneTop.add("3.1.left.center", new JLabel("P点水平可达     "));
paneTop.add("3.2.left.center", txtKDBJC);
paneTop.add("3.3.left.center", new JLabel(" 至:  "));
paneTop.add("3.4.left.center", txtKDBJZ);
paneTop.add("4.1.left.center", new JLabel("负载:       "));
paneTop.add("4.2.left.center", txtFZC);
paneTop.add("4.3.left.center", new JLabel(" 至:  "));
paneTop.add("4.4.left.center", txtFZZ);
paneTop.add("5.1.left.center", new JLabel("重复定位精度:"));
paneTop.add("5.2.left.center", txtCFDWJDC);
paneTop.add("5.3.left.center", new JLabel(" 至:  "));
paneTop.add("5.4.left.center", txtCFDWJDZ);
JPanel paneMid = new JPanel(new BorderLayout());
paneMid.setBorder(new TitledBorder(""));
dtm = new SearchResultTableModel(names, 0);
table = new JTable(dtm);
table.getTableHeader().setReorderingAllowed(false);
table.setRowHeight(22);
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
table.setAutoscrolls(true);
table.setShowGrid(true);
JScrollPane scrollPane = new JScrollPane(table);;
scrollPane.setPreferredSize(new Dimension(800, 450));
paneMid.add(scrollPane);
JPanel paneBotton = new JPanel(new PropertyLayout());
paneBotton.add("1.1.left.center", new JLabel("              "));
paneBotton.add("1.2.left.center", btnOK);
paneBotton.add("1.3.left.center", new JLabel("   "));
paneBotton.add("1.4.left.center", btnCancel);
JPanel paneMain = new JPanel(new PropertyLayout());
paneMain.add("1.1.left.center", new JLabel(" "));
paneMain.add("2.1.left.center", new JLabel(" "));
paneMain.add("2.2.center.center", paneTop);
paneMain.add("3.1.left.center", new JLabel(" "));
paneMain.add("3.2.center.center", paneMid);
paneMain.add("4.1.left.center", new JLabel(" "));
paneMain.add("4.2.center.center", paneBotton);
getContentPane().add(paneMain);
pack();
centerToScreen();
setResizable(false);
}
private void addActionListener() {
btnSearch.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
loadPane();
}
});
btnOK.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
int[] rows = table.getSelectedRows();
if (rows == null || rows.length == 0) {
MessageBox.post("请先选择一条数据!", "提示", MessageBox.INFORMATION);
return;
}
retJQRXH = dtm.getValueAt(rows[0], 1).toString();
retBTXH = dtm.getValueAt(rows[0], 2).toString();
retBZ = dtm.getValueAt(rows[0], 4).toString();
retKZGXH = dtm.getValueAt(rows[0], 0).toString();
dialogResultId = ID_OK;
disposeDialog();
}
});
btnCancel.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dialogResultId = ID_CANCEL;
disposeDialog();
}
});
}
public String getSearchCondition() {
HashMap<String, String> hmkey = new HashMap<String, String>();
String JQRXH = txtJQRXH.getText();
String BTXH = txtBTXH.getText();
String YT = txtYT.getText();
String KDBJC = txtKDBJC.getText();
String KDBJZ = txtKDBJZ.getText();
String FZC = txtFZC.getText();
String FZZ = txtFZZ.getText();
String CFDWJDC = txtCFDWJDC.getText();
String CFDWJDZ = txtCFDWJDZ.getText();
if (!JQRXH.equals("") && !JQRXH.equals("*")) {
hmkey.put("JQRXH", JQRXH);
}
if (!BTXH.equals("") && !BTXH.equals("*")) {
hmkey.put("BTXH", BTXH);
}
if (!YT.equals("") && !YT.equals("*")) {
hmkey.put("YT", YT);
}
if (!KDBJC.equals("") && !KDBJC.equals("*")) {
hmkey.put("KDBJC", KDBJC);
}
if (!KDBJZ.equals("") && !KDBJZ.equals("*")) {
hmkey.put("KDBJZ", KDBJZ);
}
if (!FZC.equals("") && !FZC.equals("*")) {
hmkey.put("FZC", FZC);
}
if (!FZZ.equals("") && !FZZ.equals("*")) {
hmkey.put("FZZ", FZZ);
}
if (!CFDWJDC.equals("") && !CFDWJDC.equals("*")) {
hmkey.put("CFDWJDC", CFDWJDC);
}
if (!CFDWJDZ.equals("") && !CFDWJDZ.equals("*")) {
hmkey.put("CFDWJDZ", CFDWJDZ);
}
String sql = "SELECT PSM01, PSM02, PSM03, PSM04, PSM08, PSM05, PSM06, PSM07, PSM12, PSM13 FROM PICM0 WHERE PCID = 'Motoman'";
if (hmkey.get("JQRXH") != null) {
sql += " AND PSM02 Like '%" + hmkey.get("JQRXH") + "%'";
}
if (hmkey.get("BTXH") != null) {
sql += " AND PSM03 Like '%" + hmkey.get("BTXH") + "%'";
}
if (hmkey.get("YT") != null) {
sql += " AND PSM04 Like '%" + hmkey.get("YT") + "%'";
}
if (hmkey.get("KDBJC") != null) {
sql += " AND PSM06 >= " + hmkey.get("KDBJC") + "";
}
if (hmkey.get("KDBJZ") != null) {
sql += " AND PSM06 <= " + hmkey.get("KDBJZ") + "";
}
if (hmkey.get("FZC") != null) {
sql += " AND PSM05 >= " + hmkey.get("FZC") + "";
}
if (hmkey.get("FZZ") != null) {
sql += " AND PSM05 <= " + hmkey.get("FZZ") + "";
}
if (hmkey.get("CFDWJDC") != null) {
sql += " AND PSM07 >= " + hmkey.get("CFDWJDC") + "";
}
if (hmkey.get("CFDWJDZ") != null) {
sql += " AND PSM07 <= " + hmkey.get("CFDWJDZ") + "";
}
sql += " ORDER BY PSM02, PSM03";
System.out.println(sql);
return sql;
}
private void loadPane(){
String sql = getSearchCondition();
Vector<Hashtable<String, Object>> vecData = TCUtil.GetCls_InstanceInfo(session, sql);
dtm.getDataVector().clear();
if (vecData != null) {
for (Iterator<Hashtable<String, Object>> iterator = vecData.iterator(); iterator.hasNext();) {
Hashtable<String, Object> hashtable = (Hashtable<String, Object>) iterator.next();
String[] rowData = new String[10];
rowData[0] = hashtable.get("PSM01").toString();
rowData[1] = hashtable.get("PSM02").toString();
rowData[2] = hashtable.get("PSM03").toString();
rowData[3] = hashtable.get("PSM04").toString();
rowData[4] = hashtable.get("PSM08").toString();
rowData[5] = hashtable.get("PSM05").toString();
rowData[6] = hashtable.get("PSM06").toString();
rowData[7] = hashtable.get("PSM07").toString();
rowData[8] = hashtable.get("PSM12").toString();
rowData[9] = hashtable.get("PSM13").toString();
dtm.addRow(rowData);
}
}
dtm.FitTableColumns(table);
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save