diff --git a/com.connor.chint.wuhan/.classpath b/com.connor.chint.wuhan/.classpath
index 2416ab4..c48a75e 100644
--- a/com.connor.chint.wuhan/.classpath
+++ b/com.connor.chint.wuhan/.classpath
@@ -76,11 +76,11 @@
-
+
diff --git a/com.connor.chint.wuhan/META-INF/MANIFEST.MF b/com.connor.chint.wuhan/META-INF/MANIFEST.MF
index e1c8ceb..aa47879 100644
--- a/com.connor.chint.wuhan/META-INF/MANIFEST.MF
+++ b/com.connor.chint.wuhan/META-INF/MANIFEST.MF
@@ -30,7 +30,6 @@ Require-Bundle: org.eclipse.ui,
com.teamcenter.rac.commonclient;bundle-version="11000.2.0",
TcSoaWorkflowRac;bundle-version="11000.2.0",
cn.net.connor.socket;bundle-version="1.0.0",
- org.apache.poi.39;bundle-version="3.9.0",
TcSoaProjectManagementLoose;bundle-version="11000.2.0",
TcSoaProjectManagementRac;bundle-version="11000.2.0",
TcSoaProjectManagementTypes;bundle-version="11000.2.0",
@@ -49,7 +48,8 @@ Require-Bundle: org.eclipse.ui,
com.teamcenter.rac.util;bundle-version="11000.2.0",
org.eclipse.osgi.services;bundle-version="3.3.100",
TcSoaCaeRac;bundle-version="11000.2.0",
- com.teamcenter.rac.project;bundle-version="11000.2.0"
+ com.teamcenter.rac.project;bundle-version="11000.2.0",
+ org.apache.poi.39;bundle-version="3.9.0"
Automatic-Module-Name: com.connor.chint.yunpi
Bundle-RequiredExecutionEnvironment: JavaSE-1.8,
JavaSE-1.7
@@ -104,7 +104,6 @@ Bundle-ClassPath: .,
poi/axis2-xmlbeans-1.4.1.jar,
poi/backport-util-concurrent-3.1.jar,
poi/XmlSchema-1.4.7.jar,
- poi/xmlbeans-5.0.3.jar,
poi/xml-resolver-1.2.jar,
poi/mail-1.4.jar,
poi/neethi-3.0.2.jar,
@@ -115,4 +114,5 @@ Bundle-ClassPath: .,
poi/wstx-asl-3.2.9.jar,
json_lib/JavaFx-DateTimePicker-0.0.1.jar,
poi/okhttp-2.7.4.jar,
- json_lib/jfxrt.jar
+ json_lib/jfxrt.jar,
+ poi/Spire.Xls.jar
diff --git a/com.connor.chint.wuhan/bin/com/chint/plm/applyMatnr/ApplyMatnrOp.class b/com.connor.chint.wuhan/bin/com/chint/plm/applyMatnr/ApplyMatnrOp.class
index 1719e66..6922784 100644
Binary files a/com.connor.chint.wuhan/bin/com/chint/plm/applyMatnr/ApplyMatnrOp.class and b/com.connor.chint.wuhan/bin/com/chint/plm/applyMatnr/ApplyMatnrOp.class differ
diff --git a/com.connor.chint.wuhan/bin/com/chint/plm/applyMatnr/ApplyMatnrOp2.class b/com.connor.chint.wuhan/bin/com/chint/plm/applyMatnr/ApplyMatnrOp2.class
index 8ef900d..1a2d934 100644
Binary files a/com.connor.chint.wuhan/bin/com/chint/plm/applyMatnr/ApplyMatnrOp2.class and b/com.connor.chint.wuhan/bin/com/chint/plm/applyMatnr/ApplyMatnrOp2.class differ
diff --git a/com.connor.chint.wuhan/bin/com/chint/plm/createEcn/CreateEcnController$1.class b/com.connor.chint.wuhan/bin/com/chint/plm/createEcn/CreateEcnController$1.class
index a0b85df..0536c25 100644
Binary files a/com.connor.chint.wuhan/bin/com/chint/plm/createEcn/CreateEcnController$1.class and b/com.connor.chint.wuhan/bin/com/chint/plm/createEcn/CreateEcnController$1.class differ
diff --git a/com.connor.chint.wuhan/bin/com/chint/plm/createEcn/CreateEcnController.class b/com.connor.chint.wuhan/bin/com/chint/plm/createEcn/CreateEcnController.class
index 0547b54..17cf289 100644
Binary files a/com.connor.chint.wuhan/bin/com/chint/plm/createEcn/CreateEcnController.class and b/com.connor.chint.wuhan/bin/com/chint/plm/createEcn/CreateEcnController.class differ
diff --git a/com.connor.chint.wuhan/bin/com/chint/plm/createEcn/Util.class b/com.connor.chint.wuhan/bin/com/chint/plm/createEcn/Util.class
index e114908..34266c9 100644
Binary files a/com.connor.chint.wuhan/bin/com/chint/plm/createEcn/Util.class and b/com.connor.chint.wuhan/bin/com/chint/plm/createEcn/Util.class differ
diff --git a/com.connor.chint.wuhan/bin/com/chint/plm/createKjBom/KjController.class b/com.connor.chint.wuhan/bin/com/chint/plm/createKjBom/KjController.class
index 91245c4..c9f6a17 100644
Binary files a/com.connor.chint.wuhan/bin/com/chint/plm/createKjBom/KjController.class and b/com.connor.chint.wuhan/bin/com/chint/plm/createKjBom/KjController.class differ
diff --git a/com.connor.chint.wuhan/bin/com/chint/plm/createbomdifference/CreateBOMDifference_DYController.class b/com.connor.chint.wuhan/bin/com/chint/plm/createbomdifference/CreateBOMDifference_DYController.class
index 5fde73f..792f178 100644
Binary files a/com.connor.chint.wuhan/bin/com/chint/plm/createbomdifference/CreateBOMDifference_DYController.class and b/com.connor.chint.wuhan/bin/com/chint/plm/createbomdifference/CreateBOMDifference_DYController.class differ
diff --git a/com.connor.chint.wuhan/bin/com/chint/plm/createbomdifference/ExtractDiffComd.class b/com.connor.chint.wuhan/bin/com/chint/plm/createbomdifference/ExtractDiffComd.class
index 38a94da..fc8de26 100644
Binary files a/com.connor.chint.wuhan/bin/com/chint/plm/createbomdifference/ExtractDiffComd.class and b/com.connor.chint.wuhan/bin/com/chint/plm/createbomdifference/ExtractDiffComd.class differ
diff --git a/com.connor.chint.wuhan/bin/com/chint/plm/updateWorkTime/UpdateWorkCommand$1.class b/com.connor.chint.wuhan/bin/com/chint/plm/updateWorkTime/UpdateWorkCommand$1.class
index c1a257f..105e96f 100644
Binary files a/com.connor.chint.wuhan/bin/com/chint/plm/updateWorkTime/UpdateWorkCommand$1.class and b/com.connor.chint.wuhan/bin/com/chint/plm/updateWorkTime/UpdateWorkCommand$1.class differ
diff --git a/com.connor.chint.wuhan/bin/com/chint/plm/updateWorkTime/UpdateWorkCommand.class b/com.connor.chint.wuhan/bin/com/chint/plm/updateWorkTime/UpdateWorkCommand.class
index 100e23f..da204f5 100644
Binary files a/com.connor.chint.wuhan/bin/com/chint/plm/updateWorkTime/UpdateWorkCommand.class and b/com.connor.chint.wuhan/bin/com/chint/plm/updateWorkTime/UpdateWorkCommand.class differ
diff --git a/com.connor.chint.wuhan/bin/com/connor/chint/sap2/util/BomToSapUtil.class b/com.connor.chint.wuhan/bin/com/connor/chint/sap2/util/BomToSapUtil.class
index e5709e9..f9c706a 100644
Binary files a/com.connor.chint.wuhan/bin/com/connor/chint/sap2/util/BomToSapUtil.class and b/com.connor.chint.wuhan/bin/com/connor/chint/sap2/util/BomToSapUtil.class differ
diff --git a/com.connor.chint.wuhan/bin/com/connor/chint/sap2/util/BomUtilWh$1.class b/com.connor.chint.wuhan/bin/com/connor/chint/sap2/util/BomUtilWh$1.class
index d06ae72..a58ab48 100644
Binary files a/com.connor.chint.wuhan/bin/com/connor/chint/sap2/util/BomUtilWh$1.class and b/com.connor.chint.wuhan/bin/com/connor/chint/sap2/util/BomUtilWh$1.class differ
diff --git a/com.connor.chint.wuhan/bin/com/connor/chint/sap2/util/BomUtilWh$2.class b/com.connor.chint.wuhan/bin/com/connor/chint/sap2/util/BomUtilWh$2.class
index ce2c986..5de8db0 100644
Binary files a/com.connor.chint.wuhan/bin/com/connor/chint/sap2/util/BomUtilWh$2.class and b/com.connor.chint.wuhan/bin/com/connor/chint/sap2/util/BomUtilWh$2.class differ
diff --git a/com.connor.chint.wuhan/bin/com/connor/chint/sap2/util/BomUtilWh.class b/com.connor.chint.wuhan/bin/com/connor/chint/sap2/util/BomUtilWh.class
index ec52199..73eed7c 100644
Binary files a/com.connor.chint.wuhan/bin/com/connor/chint/sap2/util/BomUtilWh.class and b/com.connor.chint.wuhan/bin/com/connor/chint/sap2/util/BomUtilWh.class differ
diff --git a/com.connor.chint.wuhan/bin/com/connor/chint/sap2/util/POIUtil.class b/com.connor.chint.wuhan/bin/com/connor/chint/sap2/util/POIUtil.class
index 05ef19d..11c2aca 100644
Binary files a/com.connor.chint.wuhan/bin/com/connor/chint/sap2/util/POIUtil.class and b/com.connor.chint.wuhan/bin/com/connor/chint/sap2/util/POIUtil.class differ
diff --git a/com.connor.chint.wuhan/bin/com/connor/chint/sap2/util/SAPMessageUtilFram$1.class b/com.connor.chint.wuhan/bin/com/connor/chint/sap2/util/SAPMessageUtilFram$1.class
index d51e373..273f4c2 100644
Binary files a/com.connor.chint.wuhan/bin/com/connor/chint/sap2/util/SAPMessageUtilFram$1.class and b/com.connor.chint.wuhan/bin/com/connor/chint/sap2/util/SAPMessageUtilFram$1.class differ
diff --git a/com.connor.chint.wuhan/bin/com/connor/chint/sap2/util/SAPMessageUtilFram$2.class b/com.connor.chint.wuhan/bin/com/connor/chint/sap2/util/SAPMessageUtilFram$2.class
index 605758f..35447ba 100644
Binary files a/com.connor.chint.wuhan/bin/com/connor/chint/sap2/util/SAPMessageUtilFram$2.class and b/com.connor.chint.wuhan/bin/com/connor/chint/sap2/util/SAPMessageUtilFram$2.class differ
diff --git a/com.connor.chint.wuhan/bin/com/connor/chint/sap2/util/SAPMessageUtilFram.class b/com.connor.chint.wuhan/bin/com/connor/chint/sap2/util/SAPMessageUtilFram.class
index 40d8912..30ad525 100644
Binary files a/com.connor.chint.wuhan/bin/com/connor/chint/sap2/util/SAPMessageUtilFram.class and b/com.connor.chint.wuhan/bin/com/connor/chint/sap2/util/SAPMessageUtilFram.class differ
diff --git a/com.connor.chint.wuhan/bin/com/connor/chint/sap2/util/SAPUtil.class b/com.connor.chint.wuhan/bin/com/connor/chint/sap2/util/SAPUtil.class
index 7803ca8..2b33a2b 100644
Binary files a/com.connor.chint.wuhan/bin/com/connor/chint/sap2/util/SAPUtil.class and b/com.connor.chint.wuhan/bin/com/connor/chint/sap2/util/SAPUtil.class differ
diff --git a/com.connor.chint.wuhan/bin/com/connor/chint/sap2/util/SqlUtil.class b/com.connor.chint.wuhan/bin/com/connor/chint/sap2/util/SqlUtil.class
index 69a89c4..32dd120 100644
Binary files a/com.connor.chint.wuhan/bin/com/connor/chint/sap2/util/SqlUtil.class and b/com.connor.chint.wuhan/bin/com/connor/chint/sap2/util/SqlUtil.class differ
diff --git a/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/AssignProcess$1.class b/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/AssignProcess$1.class
index a289046..9bf736e 100644
Binary files a/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/AssignProcess$1.class and b/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/AssignProcess$1.class differ
diff --git a/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/AssignProcess.class b/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/AssignProcess.class
index b767dad..408e84d 100644
Binary files a/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/AssignProcess.class and b/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/AssignProcess.class differ
diff --git a/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/BomDcSapOp.class b/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/BomDcSapOp.class
index 0f7c6f4..369c771 100644
Binary files a/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/BomDcSapOp.class and b/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/BomDcSapOp.class differ
diff --git a/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/BomSapWhBjOp.class b/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/BomSapWhBjOp.class
index 4547ec9..32cf3f2 100644
Binary files a/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/BomSapWhBjOp.class and b/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/BomSapWhBjOp.class differ
diff --git a/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/BomSapWhCommand.class b/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/BomSapWhCommand.class
index 1d02dc0..b3071d0 100644
Binary files a/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/BomSapWhCommand.class and b/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/BomSapWhCommand.class differ
diff --git a/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/BomSendSapController.class b/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/BomSendSapController.class
index 5aa2b87..175bd5e 100644
Binary files a/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/BomSendSapController.class and b/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/BomSendSapController.class differ
diff --git a/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/BomSendSapKjController.class b/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/BomSendSapKjController.class
index 8f0cc0f..d4a6e0d 100644
Binary files a/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/BomSendSapKjController.class and b/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/BomSendSapKjController.class differ
diff --git a/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/BomSendSapWhFram$1$1.class b/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/BomSendSapWhFram$1$1.class
index 5216167..5403451 100644
Binary files a/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/BomSendSapWhFram$1$1.class and b/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/BomSendSapWhFram$1$1.class differ
diff --git a/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/BomSendSapWhFram$1.class b/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/BomSendSapWhFram$1.class
index afde614..1eef574 100644
Binary files a/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/BomSendSapWhFram$1.class and b/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/BomSendSapWhFram$1.class differ
diff --git a/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/BomSendSapWhFram$2.class b/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/BomSendSapWhFram$2.class
index 092643b..4050e92 100644
Binary files a/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/BomSendSapWhFram$2.class and b/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/BomSendSapWhFram$2.class differ
diff --git a/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/BomSendSapWhFram$3.class b/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/BomSendSapWhFram$3.class
index d967ef3..100757a 100644
Binary files a/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/BomSendSapWhFram$3.class and b/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/BomSendSapWhFram$3.class differ
diff --git a/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/BomSendSapWhFram.class b/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/BomSendSapWhFram.class
index c57756b..f0fc579 100644
Binary files a/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/BomSendSapWhFram.class and b/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/BomSendSapWhFram.class differ
diff --git a/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/DbomToECommand$1$1.class b/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/DbomToECommand$1$1.class
index 0f87124..bb20681 100644
Binary files a/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/DbomToECommand$1$1.class and b/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/DbomToECommand$1$1.class differ
diff --git a/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/DbomToECommand$1.class b/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/DbomToECommand$1.class
index 2bcbcea..bc8579f 100644
Binary files a/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/DbomToECommand$1.class and b/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/DbomToECommand$1.class differ
diff --git a/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/DbomToECommand.class b/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/DbomToECommand.class
index adf5c9e..59056d7 100644
Binary files a/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/DbomToECommand.class and b/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/DbomToECommand.class differ
diff --git a/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/EbomToPCommand$1.class b/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/EbomToPCommand$1.class
index 1f80669..e8e9f11 100644
Binary files a/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/EbomToPCommand$1.class and b/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/EbomToPCommand$1.class differ
diff --git a/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/EbomToPCommand.class b/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/EbomToPCommand.class
index b13479b..9bb777d 100644
Binary files a/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/EbomToPCommand.class and b/com.connor.chint.wuhan/bin/com/connor/chint/yunpi/command/EbomToPCommand.class differ
diff --git a/com.connor.chint.wuhan/build.properties b/com.connor.chint.wuhan/build.properties
index 460f138..303f316 100644
--- a/com.connor.chint.wuhan/build.properties
+++ b/com.connor.chint.wuhan/build.properties
@@ -42,7 +42,6 @@ bin.includes = plugin.xml,\
poi/woden-impl-dom-1.0M9.jar,\
poi/wsdl4j-1.6.2.jar,\
poi/wstx-asl-3.2.9.jar,\
- poi/xmlbeans-5.0.3.jar,\
poi/xml-resolver-1.2.jar,\
poi/XmlSchema-1.4.7.jar,\
lib/axis.jar,\
@@ -83,4 +82,5 @@ bin.includes = plugin.xml,\
json_lib/xom-1.2.5.jar,\
json_lib/JavaFx-DateTimePicker-0.0.1.jar,\
poi/okhttp-2.7.4.jar,\
- json_lib/jfxrt.jar
+ json_lib/jfxrt.jar,\
+ poi/Spire.Xls.jar
diff --git a/com.connor.chint.wuhan/poi/Spire.Xls.jar b/com.connor.chint.wuhan/poi/Spire.Xls.jar
new file mode 100644
index 0000000..7f53b0a
Binary files /dev/null and b/com.connor.chint.wuhan/poi/Spire.Xls.jar differ
diff --git a/com.connor.chint.wuhan/src/com/chint/plm/createEcn/CreateEcnController.java b/com.connor.chint.wuhan/src/com/chint/plm/createEcn/CreateEcnController.java
index bf3b0fd..aaa0b2b 100644
--- a/com.connor.chint.wuhan/src/com/chint/plm/createEcn/CreateEcnController.java
+++ b/com.connor.chint.wuhan/src/com/chint/plm/createEcn/CreateEcnController.java
@@ -6,52 +6,47 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
-import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
-import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Set;
-
import org.apache.commons.httpclient.util.URIUtil;
-import org.apache.poi.hssf.usermodel.HSSFCell;
-import org.apache.poi.hssf.usermodel.HSSFRow;
-import org.apache.poi.hssf.usermodel.HSSFSheet;
-import org.apache.poi.hssf.usermodel.HSSFWorkbook;
-import org.apache.poi.ss.usermodel.Sheet;
-import org.apache.poi.ss.util.CellRangeAddress;
-import org.casic.javafx.control.DateTimePicker;
+import org.apache.poi.xssf.usermodel.XSSFCell;
+import org.apache.poi.xssf.usermodel.XSSFRow;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
-import com.chint.plm.SearchSapResult.SumTableBean;
import com.chint.plm.fxUtil.KFXPanel;
import com.chint.plm.fxUtil.KFXPanelController;
-import com.connor.chint.JDBPackage.JDBFrame;
-import com.connor.chint.sap2.util.BomToSapUtil;
import com.connor.chint.sap2.util.KUtil;
import com.connor.chint.sap2.util.POIUtil;
import com.connor.chint.sap2.util.SAPUtil;
import com.connor.chint.sap2.util.SqlUtil;
+import com.spire.xls.CheckState;
+import com.spire.xls.Workbook;
+import com.spire.xls.Worksheet;
+import com.spire.xls.core.ICheckBox;
+import com.spire.xls.core.ICheckBoxes;
+import com.spire.xls.core.IShape;
+import com.spire.xls.core.IShapes;
import com.squareup.okhttp.MediaType;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.RequestBody;
import com.squareup.okhttp.Response;
import com.teamcenter.rac.aif.AbstractAIFApplication;
-import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
import com.teamcenter.rac.aifrcp.AIFUtility;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentDataset;
import com.teamcenter.rac.kernel.TCComponentItem;
import com.teamcenter.rac.kernel.TCComponentItemType;
-import com.teamcenter.rac.kernel.TCComponentTcFile;
import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCProperty;
import com.teamcenter.rac.kernel.TCSession;
@@ -61,7 +56,6 @@ import edu.emory.mathcs.backport.java.util.Arrays;
import javafx.application.Platform;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;
-import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
@@ -122,7 +116,7 @@ public class CreateEcnController extends KFXPanelController {
private List wips = new ArrayList();
private List products = new ArrayList();
private List ecnBeans = new ArrayList();
- protected AbstractAIFApplication app;
+ private AbstractAIFApplication app;
private TCSession session;
private TCComponent target;
@FXML
@@ -148,11 +142,17 @@ public class CreateEcnController extends KFXPanelController {
private CreateEcnController controller;
private CreateEcnFrame frame;
private String[] database;
- public final String UPDATE_OA = "update CHINT_ECR_FROM_OA set STATUS = '已引用' where APPLYNO = ? ";
- public final String SELECT_OA_APPLYNO = "select * from CHINT_ECR_FROM_OA where APPLYNO = ? ";
+ protected final String UPDATE_OA = "update CHINT_ECR_FROM_OA set STATUS = '已引用' where APPLYNO = ? ";
+ protected final String SELECT_OA_APPLYNO = "select * from CHINT_ECR_FROM_OA where APPLYNO = ? ";
+ private final int PAGE_ITEM_CNT = 6;//每页对象数量
+ private final int FIRST_PAGE = 28;//第二页起始行
+ private final int PAGE_ROW_CNT = 16;//每页行数
+ private final int ITEM_ROW_CNT = 1;//每个对象行数
+ private final int TITLE_ROW_CNT = 7;//表头行数
+
@Override
public void initData(KFXPanel paramKFXPanel) throws Exception {
- // TODO Auto-generated method stub
+ // Auto-generated method stub
this.app = AIFUtility.getCurrentApplication();
this.session = (TCSession) app.getSession();
target = (TCComponent) app.getTargetComponent();
@@ -192,7 +192,7 @@ public class CreateEcnController extends KFXPanelController {
* @function 创建按钮
*/
@FXML
- void createClick(ActionEvent event) throws Exception {
+ private void createClick(ActionEvent event) throws Exception {
if (ecnId.getText().isEmpty()) {
MessageBox.post("请先指派变更单ID", "提示", 2);
return;
@@ -211,11 +211,13 @@ public class CreateEcnController extends KFXPanelController {
if (item.getRelatedComponents("IMAN_reference").length > 0) {
TCComponent[] comps = item.getRelatedComponents("IMAN_reference");
for (int i = 0, len = comps.length; i < len; i++) {
- if (comps[i] instanceof TCComponentDataset) {
+ if (comps[i].isTypeOf("MSExcelX")) {// instanceof TCComponentDataset
dataset = (TCComponentDataset) comps[i];
break;
}
}
+ }
+ if(dataset != null) {
// dataset=(TCComponentDataset) item.getRelatedComponents("IMAN_reference")[0];
TCComponentDataset datasetM = getDataset(type, 0);
file = Util.getExcel(datasetM);
@@ -270,7 +272,7 @@ public class CreateEcnController extends KFXPanelController {
createOrReplace(dataset, file, changeName);
item.setRelated("IMAN_reference", new TCComponent[] { dataset });
- item.unlock();
+// item.unlock();
MessageBox.post("创建完成", "", MessageBox.INFORMATION);
}
@@ -345,94 +347,203 @@ public class CreateEcnController extends KFXPanelController {
}
/**
- * @param 数据集
- * @param 文件路径
- * @param 更改类型 创建或者替换excel文件
+ * @param dataset 数据集
+ * @param file 文件路径
+ * @param changeName 更改类型 创建或者替换excel文件
*/
- protected void createOrReplace(TCComponentDataset dataset, File file, String changeName) {
- // 20200407新增删除多余的
+ private void createOrReplace(TCComponentDataset dataset, File file, String changeName) {
+ //TODO 20240227大幅修改excel
+ FileInputStream fis = null;
+ FileOutputStream fos = null;
try {
- FileInputStream fis = new FileInputStream(file);
- HSSFWorkbook workBook = new HSSFWorkbook(fis);
- HSSFSheet sheet = workBook.getSheetAt(0);
- sheet.getRow(1).getCell(6).setCellValue(changeName);
- sheet.getRow(1).getCell(13).setCellValue(ecnId.getText());
-// int page = 0;
- List mergeRegions = null;
-
- for (int i = 0; i < pages; i++) {
- int pace = 0;
- if (sheet.getRow(2 + i * 23) == null) {
- if (mergeRegions == null) {
- mergeRegions = Util.getMergeRegions(sheet, 2, 24);
- }
- Util.addExcelPage(i, mergeRegions, sheet, workBook);
- int index = 0;
- for (int k = i * 5; k < (i + 1) * 5; k++) {
- sheet.getRow(5 + 3 * index + i * 23).getCell(1).setCellValue("");
- sheet.getRow(5 + 3 * index + i * 23).getCell(6).setCellValue("");
- sheet.getRow(5 + 3 * index + i * 23).getCell(9).setCellValue("");
- sheet.getRow(5 + 3 * index + i * 23).getCell(12).setCellValue("");
- sheet.getRow(5 + 3 * index + i * 23).getCell(14).setCellValue("");
- index++;
- }
- }
- sheet.getRow(2 + i * 23).getCell(15).setCellValue("共 " + pages + " 页");
- sheet.getRow(3 + i * 23).getCell(1).setCellValue(changeType);
-// sheet.getRow(3 + i * 23).getCell(9).setCellValue(jobNames);//工作号 去掉了
- sheet.getRow(3 + i * 23).getCell(11).setCellValue(contractNo);
- sheet.getRow(3 + i * 23).getCell(14).setCellValue(changeTime);
- sheet.getRow(23 + i * 23).getCell(2).setCellValue(contractName);
-
- String[] unitCount = changeUnit1.split(";");
- for (int j = 0; j < unitCount.length; j++) {
- sheet.getRow(5 + j + i * 23).getCell(15).setCellValue(unitCount[j]);
- }
- HSSFCell cell;
-
- for (int k = i * 5; k < (i + 1) * 5; k++) {
- if (k > changeDrawingNo.length - 1) {
- break;
- }
- sheet.getRow(5 + 3 * pace + i * 23).getCell(1).setCellValue(changeDrawingNo[k]);
- sheet.getRow(5 + 3 * pace + i * 23).getCell(3).setCellValue(sign[k]);
-// sheet.getRow(5 + 3 * pace + i * 23).getCell(4).setCellValue(placesNo[k]);
- sheet.getRow(5 + 3 * pace + i * 23).getCell(5).setCellValue(partition[k]);
- sheet.getRow(5 + 3 * pace + i * 23).getCell(6).setCellValue(changeBefore1[k]);
- sheet.getRow(5 + 3 * pace + i * 23).getCell(9).setCellValue(changeAfter1[k]);
- sheet.getRow(5 + 3 * pace + i * 23).getCell(12).setCellValue(changeReason[k]);
- sheet.getRow(5 + 3 * pace + i * 23).getCell(14).setCellValue(processType1[k]);
-
- pace++;
- }
-
+ fis = new FileInputStream(file);
+ XSSFWorkbook workbook = new XSSFWorkbook(fis);
+ XSSFSheet sheet = workbook.getSheetAt(0);
+ XSSFRow row;
+ XSSFCell cell;
+// setTitle(sheet, 1);
+ //表头
+ row = POIUtil.getRow(sheet, 0);
+ cell = POIUtil.getCell(row, 0);
+ cell.setCellValue(factoryText.getText());//单位
+ cell = POIUtil.getCell(row, 5);
+ cell.setCellValue((rb_formalChange.isSelected() ? "正式" : "临时") + cell.getStringCellValue());//正式更改 临时更改
+ cell = POIUtil.getCell(row, 17);
+ cell.setCellValue(ecnId.getText());//通知单编号
+ row = POIUtil.getRow(sheet, 1);
+ cell = POIUtil.getCell(row, 17);
+ cell.setCellValue(relateEcnText.getText());//关联申请单编号
+ row = POIUtil.getRow(sheet, 3);
+ cell = POIUtil.getCell(row, 18);
+ cell.setCellValue("共 " + pages + " 页");//页数
+ row = POIUtil.getRow(sheet, 4);
+ cell = POIUtil.getCell(row, 0);
+ cell.setCellValue(productModel);//产品型号
+ cell = POIUtil.getCell(row, 3);
+ cell.setCellValue(prodNameComb.getSelectionModel().getSelectedItem());//产品名称
+ cell = POIUtil.getCell(row, 6);
+ cell.setCellValue(markText.getText());//文件名称
+ cell = POIUtil.getCell(row, 10);
+ cell.setCellValue(contractNo);//合同代号
+ cell = POIUtil.getCell(row, 12);
+ cell.setCellValue(contractName);//合同名称
+ cell = POIUtil.getCell(row, 16);
+ cell.setCellValue(changeTime);//更改实施日期
+ cell = POIUtil.getCell(row, 18);
+ cell.setCellValue("第 1 页");//页号
+ row = POIUtil.getRow(sheet, 5);
+ cell = POIUtil.getCell(row, 3);
+ cell.setCellValue(changeUnit1);//发放部门
+
+ //复制表头与页
+ if(pages > 1) {
+// for(int i = 0; i < 6; i++)
+// POIUtil.copyRow(workbook, POIUtil.getRow(sheet, i), POIUtil.getRow(sheet, i + 35), true);
+ POIUtil.copyRows(sheet, 0, TITLE_ROW_CNT - 1, FIRST_PAGE, 19, 1);
+ row = POIUtil.getRow(sheet, FIRST_PAGE + 4);
+ cell = POIUtil.getCell(row, 18);
+ cell.setCellValue("第 2 页");//页号
+ }else {
+ POIUtil.deleteRows(sheet, FIRST_PAGE, FIRST_PAGE + PAGE_ROW_CNT - 1);
}
- if (pages == 0) {
- sheet.getRow(2).getCell(15).setCellValue("共 1 页");
- sheet.getRow(3).getCell(1).setCellValue(productModel);
-// sheet.getRow(3).getCell(9).setCellValue(jobNames);
- sheet.getRow(3).getCell(11).setCellValue(contractNo);
- sheet.getRow(3).getCell(14).setCellValue(changeTime);
- sheet.getRow(23).getCell(2).setCellValue(contractName);
- String[] unitCount = changeUnit1.split(";");
- for (int j = 0; j < unitCount.length; j++) {
- sheet.getRow(5 + j).getCell(15).setCellValue(unitCount[j]);
- }
+ if(pages > 2) {
+ POIUtil.copyRows(sheet, FIRST_PAGE, FIRST_PAGE + PAGE_ROW_CNT - 1, FIRST_PAGE + PAGE_ROW_CNT, 19, pages - 2);
+ for(int i = 2; i < pages; i++) {
+ int cnt = (i - 1) * PAGE_ROW_CNT;
+ row = POIUtil.getRow(sheet, FIRST_PAGE + 4 + cnt);
+ cell = POIUtil.getCell(row, 18);
+ cell.setCellValue("第 " + (i + 1) + " 页");//页号
+ }
+ }
+
+ //内容表格
+ ObservableList items = tableView.getItems();
+ for (int i = 0; i < items.size(); i++) {
+ if(i < 2) {
+ row = POIUtil.getRow(sheet, i + TITLE_ROW_CNT);
+ }else {
+ int r = (i - 1) % PAGE_ITEM_CNT, page = (i - 1) / PAGE_ITEM_CNT;
+ if(r == 0) {
+ r = PAGE_ITEM_CNT;
+ page --;
+ }
+ row = POIUtil.getRow(sheet, FIRST_PAGE + TITLE_ROW_CNT + (r - 1) * ITEM_ROW_CNT + page * PAGE_ROW_CNT);
+ }
+// EcnBean ecnBean = items.get(i);
+ cell = POIUtil.getCell(row, 0);
+ cell.setCellValue(i + 1);//序号
+ cell = POIUtil.getCell(row, 1);
+ cell.setCellValue(changeDrawingNo[i]);//图样代号(文件编号)
+ cell = POIUtil.getCell(row, 3);
+ cell.setCellValue(sign[i]);//标记
+ cell = POIUtil.getCell(row, 4);
+ cell.setCellValue(partition[i]);//处数
+ cell = POIUtil.getCell(row, 5);
+ cell.setCellValue(changeBefore1[i]);//更改前
+ cell = POIUtil.getCell(row, 8);
+ cell.setCellValue(szVersionBefs[i]);//更改前版本
+ cell = POIUtil.getCell(row, 9);
+ cell.setCellValue(changeAfter1[i]);//更改后
+ cell = POIUtil.getCell(row, 12);
+ cell.setCellValue(szVersionAfts[i]);//更改后版本
+ cell = POIUtil.getCell(row, 13);
+ cell.setCellValue(productSzs[i]);//特性等级
+ cell = POIUtil.getCell(row, 14);
+ cell.setCellValue(changeReason[i]);//更改原因
+ cell = POIUtil.getCell(row, 17);
+ cell.setCellValue(processType1[i]);//产品处理意见
+ }
+
+ //影响分析表格
+ ObservableList refs = refTable.getItems();
+ for (int i = 0; i < refs.size(); i++) {
+ RefTableBean refTableBean = refs.get(i);
+ row = POIUtil.getRow(sheet, i % 15 + TITLE_ROW_CNT + 3);
+
+ int j = i / 15;
+ j = (j == 0) ? 4 : 14;
+ cell = POIUtil.getCell(row, j + (refTableBean.getShYes().isSelected() ? 0 : 1));
+ cell.setCellValue("√");//是 否
+ j += 2;
+ cell = POIUtil.getCell(row, j++);
+ cell.setCellValue(refTableBean.getUserVal());//责任人
+ cell = POIUtil.getCell(row, j++);
+ cell.setCellValue(refTableBean.getCompDate().getText());//计划完成时间
+ cell = POIUtil.getCell(row, j++);
+ cell.setCellValue(refTableBean.getMark().getText());//备注
}
File file2 = null;
String timeNow = Util.GetNowDate();
- String filePath = System.getProperty("java.io.tmpdir") + timeNow + ".xls";
+ String filePath = System.getProperty("java.io.tmpdir") + timeNow + ".xlsx";
file2 = new File(filePath);
- FileOutputStream fos = new FileOutputStream(file2);
- workBook.write(fos);
-
- Util.deMerge(filePath, filePath, pages);
- Util.delete(filePath, filePath, pages);
+ fos = new FileOutputStream(file2);
+ workbook.write(fos);
+ fos.close();
+ fis.close();
+
+ Workbook spireBook = new Workbook();
+ spireBook.loadFromFile(filePath);
+ Worksheet spireSheet = spireBook.getWorksheets().get(0);
+ ICheckBoxes boxes = spireSheet.getCheckBoxes();
+// System.out.println("boxes:" + boxes.getCount());
+ ICheckBox box1 = boxes.get(0);
+ CheckState check1 = rb_product.isSelected() ? CheckState.Checked : CheckState.Unchecked;
+ box1.setCheckState(check1);
+ ICheckBox box2 = boxes.get(1);
+ CheckState check2 = rb_Process.isSelected() ? CheckState.Checked : CheckState.Unchecked;
+ box2.setCheckState(check2);
+ if(boxes.getCount() > 2) {
+ ICheckBox box3 = boxes.get(2);
+ box3.setCheckState(check1);
+ ICheckBox box4 = boxes.get(3);
+ box4.setCheckState(check2);
+ }
+ if(pages > 2) {
+ String t1 = box1.getText();
+ String t2 = box2.getText();
+ for(int i = 2; i < pages; i++) {
+ int r = FIRST_PAGE + (i - 1) * PAGE_ROW_CNT + 3;
+ ICheckBox checkbox1 = boxes.addCheckBox(r, 4, 18, 80);
+ checkbox1.setCheckState(check1);
+ checkbox1.setText(t1);
+ ICheckBox checkbox2 = boxes.addCheckBox(r, 6, 18, 80);
+ checkbox2.setCheckState(check2);
+ checkbox2.setText(t2);
+ }
+ }else if(pages < 2) {
+ IShapes shapes = spireSheet.getShapes();
+ IShape box = shapes.get(2);
+ System.out.println("boxes:" + box.getName());
+ box.setVisible(false);
+ box.remove();
+ box = shapes.get(3);
+ System.out.println("boxes:" + box.getHtmlString());
+ box.setVisible(false);
+ box.remove();
+ }
+ spireBook.save();
+
+// Util.deMerge(filePath, filePath, pages);
+// Util.delete(filePath, filePath, pages);
dataset.setFiles(new String[] { filePath }, new String[] { "excel" });
} catch (Exception e) {
e.printStackTrace();
+ } finally {
+ if(fis != null) {
+ try {
+ fis.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ if(fos != null) {
+ try {
+ fos.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
}
-
}
private String contractNo; // 合同代号
@@ -448,7 +559,7 @@ public class CreateEcnController extends KFXPanelController {
* @throws Exception
* @function 修改变更对象的属性
*/
- protected void setItemProperty(TCComponentItem item, String changeName) throws Exception {
+ private void setItemProperty(TCComponentItem item, String changeName) throws Exception {
contractNo = contractText.getText(); // 合同代号
contractName = htNameText.getText();// 合同名称
@@ -474,7 +585,7 @@ public class CreateEcnController extends KFXPanelController {
CheckBox radioButton = partBtns.get(j);
if (radioButton.isSelected()) {
if (unit.length() > 0) {
- unit.append(";").append(radioButton.getText());
+ unit.append(" ").append(radioButton.getText());
} else {
unit.append(radioButton.getText());
}
@@ -485,7 +596,7 @@ public class CreateEcnController extends KFXPanelController {
ObservableList items = tableView.getItems();
int rowCount = items.size();
- System.out.println(rowCount);
+ System.out.println("rowCount:" + rowCount);
changeDrawingNo = new String[rowCount];
sign = new String[rowCount];
// placesNo = new String[rowCount];
@@ -500,14 +611,18 @@ public class CreateEcnController extends KFXPanelController {
productSzs = new String[rowCount];
processSzs = new String[rowCount];
- int modulus = changeDrawingNo.length % 5;
- int dlivery = changeDrawingNo.length / 5;
- if (modulus == 0) {
- pages = dlivery;
- } else {
- pages = dlivery + 1;
- System.out.println("页数pages:" + pages);
+ if(rowCount < 3) {
+ pages = 1;
+ }else {
+ int modulus = (rowCount - 2) % 6;
+ int dlivery = (rowCount - 2) / 6 + 1;
+ if (modulus == 0) {
+ pages = dlivery;
+ } else {
+ pages = dlivery + 1;
+ }
}
+ System.out.println("页数pages:" + pages);//TODO
for (int i = 0; i < rowCount; i++) {
EcnBean ecnBean = items.get(i);
changeDrawingNo[i] = ecnBean.getDrawNo().getText();
@@ -524,6 +639,23 @@ public class CreateEcnController extends KFXPanelController {
szVersionAfts[i] = ecnBean.getAfterVersion().getText();
productSzs[i] = ecnBean.getProductSz().getSelectionModel().getSelectedItem();
processSzs[i] = rb_product.isSelected() ? "Y" : "N";
+
+ if(changeDrawingNo[i] == null)
+ changeDrawingNo[i] = "";
+ if(sign[i] == null)
+ sign[i] = "";
+ if(partition[i] == null)
+ partition[i] = "";
+ if(changeBefore1[i] == null)
+ changeBefore1[i] = "";
+ if(changeAfter1[i] == null)
+ changeAfter1[i] = "";
+ if(szVersionBefs[i] == null)
+ szVersionBefs[i] = "";
+ if(szVersionAfts[i] == null)
+ szVersionAfts[i] = "";
+ if(productSzs[i] == null)
+ productSzs[i] = "";
}
item.getTCProperty("zt2_ChangeDrawingNo").setStringValueArray(changeDrawingNo);
item.getTCProperty("zt2_Sign").setStringValueArray(sign);
@@ -774,8 +906,9 @@ public class CreateEcnController extends KFXPanelController {
*
* @function 初始化影响分析的表格 绑定bean
*/
- private void createDetailTable() {
- // TODO Auto-generated method stub
+ @SuppressWarnings("unchecked")
+ private void createDetailTable() {
+ // Auto-generated method stub
TableColumn tc_beforChange = new TableColumn("更改前");
TableColumn tc_afterChange = new TableColumn("更改后");
@@ -836,8 +969,9 @@ public class CreateEcnController extends KFXPanelController {
*
* @function 影响分析数据表格
*/
- private void createRefTable() {
- // TODO Auto-generated method stub
+ @SuppressWarnings("unchecked")
+ private void createRefTable() {
+ // Auto-generated method stub
// 影响分析表格
TableColumn deapart = new TableColumn("部门");
@@ -940,7 +1074,7 @@ public class CreateEcnController extends KFXPanelController {
* @function 添加监听
*/
private void addAssignAction(List refTableBeans) {
- // TODO Auto-generated method stub
+ // Auto-generated method stub
Button userBtn = refTableBeans.get(0).getUserBtn();
assignBtnAction(userBtn, 0, 7, refTableBeans);
assignBtnAction(refTableBeans.get(7).getUserBtn(), 7, 11, refTableBeans);
@@ -960,7 +1094,7 @@ public class CreateEcnController extends KFXPanelController {
* @function
*/
private void assignBtnAction(Button userBtn, int start, int end, List refTableBeans) {
- // TODO Auto-generated method stub
+ // Auto-generated method stub
userBtn.setOnAction(e -> {
try {
String userVal = refTableBeans.get(start).getUserVal();
@@ -978,7 +1112,7 @@ public class CreateEcnController extends KFXPanelController {
});
} catch (Exception e1) {
- // TODO Auto-generated catch block
+ // Auto-generated catch block
e1.printStackTrace();
}
});
@@ -990,14 +1124,22 @@ public class CreateEcnController extends KFXPanelController {
* @throws Exception
* @function 调用OA接口获取用户的9位ID
*/
- Map getUserItemOA(String name) throws Exception {
+ private Map getUserItemOA(String name) throws Exception {//TODO 调用OA接口
OkHttpClient client = new OkHttpClient();
Map emailMap = new HashMap<>();
+ String url = session.getPreferenceService().getStringValues("CHINT_OAUserID_RUL")[0];
+ System.out.println("url==>" + url);
+
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
- RequestBody body = RequestBody.create(mediaType, "Email=&Name=" + name);
+ RequestBody body = RequestBody.create(mediaType, "Email=&Name=" + name + "&UserUUID=");
Request request = new Request.Builder()
- .url("http://10.207.0.245:8012/Portal/Webservices/EH/EH_Q_BPM_Two_Service.asmx/GetUserItems")
- .method("POST", body).addHeader("Content-Type", "application/x-www-form-urlencoded").build();
+// .url("http://10.207.0.245:8012/Portal/Webservices/EH/EH_Q_BPM_Two_Service.asmx/GetUserItems")
+ .url(url)
+ .method("POST", body)
+ .addHeader("item", "2100004876")
+ .addHeader("wbs", "")
+ .addHeader("factoryNo", "")
+ .addHeader("Content-Type", "application/x-www-form-urlencoded").build();
Response response = client.newCall(request).execute();
String string = response.body().string();
System.out.println("xml==>" + string);
@@ -1006,7 +1148,8 @@ public class CreateEcnController extends KFXPanelController {
String type = rootElement.elementText("TYPE");
String message = rootElement.elementText("MESSAGE");
if (type.equals("S")) {
- List elements = rootElement.elements("items");
+ @SuppressWarnings("unchecked")
+ List elements = rootElement.elements("items");
for (Element element : elements) {
Element userItemCs = element.element("EH_HR_UserItems_CS");
@@ -1033,20 +1176,21 @@ public class CreateEcnController extends KFXPanelController {
* @param frame
* @function 添加页面的监听
*/
- private void addWindListener(CreateEcnFrame frame) {
- // TODO Auto-generated method stub
+ @SuppressWarnings("unchecked")
+ private void addWindListener(CreateEcnFrame frame) {
+ // Auto-generated method stub
frame.addComponentListener(new ComponentListener() {
@Override
public void componentShown(ComponentEvent e) {
- // TODO Auto-generated method stub
+ // Auto-generated method stub
}
@Override
public void componentResized(ComponentEvent e) {
- // TODO Auto-generated method stub
+ // Auto-generated method stub
// System.out.println("==============");
double width = e.getComponent().getSize().getWidth();
// // double width = primaryStage.getWidth();
@@ -1059,13 +1203,13 @@ public class CreateEcnController extends KFXPanelController {
@Override
public void componentMoved(ComponentEvent e) {
- // TODO Auto-generated method stub
+ // Auto-generated method stub
}
@Override
public void componentHidden(ComponentEvent e) {
- // TODO Auto-generated method stub
+ // Auto-generated method stub
}
});
@@ -1079,7 +1223,7 @@ public class CreateEcnController extends KFXPanelController {
String part = read.getString(1);
String reason = read.getString(2);
String manage = read.getString(3);
- String dataset = read.getString(4);
+// String dataset = read.getString(4);
String factory = read.getString(5);
String grade = read.getString(6);
factoryText.setText(factory);
@@ -1157,7 +1301,7 @@ public class CreateEcnController extends KFXPanelController {
rb_tempChange.isSelected(), assignBtn);
dialog.start(new Stage());
} catch (Exception e) {
- // TODO Auto-generated catch block
+ // Auto-generated catch block
e.printStackTrace();
}
}
@@ -1175,7 +1319,7 @@ public class CreateEcnController extends KFXPanelController {
try {
dialog.start(new Stage());
} catch (IOException e) {
- // TODO Auto-generated catch block
+ // Auto-generated catch block
e.printStackTrace();
}
diff --git a/com.connor.chint.wuhan/src/com/chint/plm/createEcn/Util.java b/com.connor.chint.wuhan/src/com/chint/plm/createEcn/Util.java
index 1e85e0b..eb3e985 100644
--- a/com.connor.chint.wuhan/src/com/chint/plm/createEcn/Util.java
+++ b/com.connor.chint.wuhan/src/com/chint/plm/createEcn/Util.java
@@ -28,7 +28,6 @@ import com.teamcenter.rac.aif.kernel.AIFComponentContext;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentDataset;
import com.teamcenter.rac.kernel.TCComponentTcFile;
-import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCPreferenceService;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.util.MessageBox;
@@ -42,6 +41,7 @@ public class Util {
public static final String ITEM_REVIISON_ID = "item_revision_id";
public static final String REVISION_RULE_ANY = "Any Status; Working";
public static final String BL_QTY = "bl_quantity";
+
public Connection connect(Connection conn, TCSession session) {
String[] database = session.getPreferenceService().getStringValues("database_tc");
String JdbcDriverClass = "oracle.jdbc.driver.OracleDriver";
@@ -53,12 +53,12 @@ public class Util {
strPassword = database[4];
try {
Class.forName(JdbcDriverClass);
- } catch (ClassNotFoundException e1) {
+ } catch (Exception e1) {
e1.printStackTrace();
}
try {
conn = DriverManager.getConnection(strUrl, strUserName, strPassword);
- } catch (SQLException e) {
+ } catch (Exception e) {
e.printStackTrace();
}
return conn;
@@ -105,8 +105,8 @@ public class Util {
} else {
return tcFile[0].getFmsFile();
}
- } catch (TCException e) {
- // TODO Auto-generated catch block
+ } catch (Exception e) {
+ // Auto-generated catch block
e.printStackTrace();
}
return null;
@@ -120,7 +120,7 @@ public class Util {
* @function 设置单元格内容
*/
public static void setCellValue(XSSFCell cell2, int index, XSSFRow row0, String cellValue) {
- // TODO Auto-generated method stub
+ // Auto-generated method stub
if (cell2 == null) {
cell2 = row0.createCell(index);
@@ -137,7 +137,7 @@ public class Util {
* @function
*/
public static XSSFRow getRow(XSSFSheet sheetAt, int rowNum) {
- // TODO Auto-generated method stub
+ // Auto-generated method stub
XSSFRow row = sheetAt.getRow(rowNum);
if (row == null) {
@@ -244,7 +244,7 @@ public class Util {
AIFComponentContext[] a3 = ((TCComponent) a2[0].getComponent()).whereReferenced();// 项目零组件
target = (TCComponent) a3[0].getComponent();
}
- } catch (TCException e1) {
+ } catch (Exception e1) {
e1.printStackTrace();
}
try {
@@ -265,7 +265,7 @@ public class Util {
}
}
}
- } catch (TCException e) {
+ } catch (Exception e) {
e.printStackTrace();
}
@@ -303,7 +303,7 @@ public class Util {
AIFComponentContext[] a3 = ((TCComponent) a2[0].getComponent()).whereReferenced();// 项目零组件
target = (TCComponent) a3[0].getComponent();
}
- } catch (TCException e1) {
+ } catch (Exception e1) {
e1.printStackTrace();
}
try {
@@ -324,7 +324,7 @@ public class Util {
}
}
}
- } catch (TCException e) {
+ } catch (Exception e) {
e.printStackTrace();
}
diff --git a/com.connor.chint.wuhan/src/com/chint/plm/createbomdifference/CreateBOMDifference_DYController.java b/com.connor.chint.wuhan/src/com/chint/plm/createbomdifference/CreateBOMDifference_DYController.java
index f12c3be..1b1e014 100644
--- a/com.connor.chint.wuhan/src/com/chint/plm/createbomdifference/CreateBOMDifference_DYController.java
+++ b/com.connor.chint.wuhan/src/com/chint/plm/createbomdifference/CreateBOMDifference_DYController.java
@@ -42,6 +42,7 @@ public class CreateBOMDifference_DYController {
TCComponentItem item = null;
TCComponentItemRevision rev = null;
BOMDifferenceBean bean;
+ boolean child = !groupID.equals("M060");
/**
* 对象 -
*/
@@ -205,9 +206,9 @@ public class CreateBOMDifference_DYController {
// BOMDifferenceBean parentBean;
bomWinType = (TCComponentBOMWindowType) session.getTypeComponent("BOMWindow");
TCComponentBOMWindow win = bomWinType.create(null);
- win.lock();
+// win.lock();
TCComponentBOMWindow win2 = bomWinType.create(null);
- win2.lock();
+// win2.lock();
TCComponentItemRevision parentRev;
try {
for (int i = 0, len = list_ccps.size(); i < len; i++) {
@@ -268,7 +269,7 @@ public class CreateBOMDifference_DYController {
childBean.setObject_desc_Parent(object_desc);
childBean.setParentPartRev(newRev);
- bomCompare_M030(childBean, session, 1, 1, beans, list_items);
+ bomCompare_M030(childBean, session, 1, 1, beans, list_items, child);
}
}
@@ -297,7 +298,7 @@ public class CreateBOMDifference_DYController {
bean.setObject_desc_Parent(object_desc);
bean.setParentPartRev(newRev);
- bomCompare_M030(bean, session, 1, 1, beans, list_items);
+ bomCompare_M030(bean, session, 1, 1, beans, list_items, child);
}
}
} catch (Exception e) {
@@ -325,8 +326,8 @@ public class CreateBOMDifference_DYController {
return false;
}
- public static void bomCompare_M030(BOMDifferenceBean parentBean, TCSession session, double parent_quantity_old,
- double parent_quantity_new, List beans, List item_compares)
+ private static void bomCompare_M030(BOMDifferenceBean parentBean, TCSession session, double parent_quantity_old,
+ double parent_quantity_new, List beans, List item_compares, boolean child)
throws TCException, SQLException {
if (item_compares.indexOf(parentBean.getItem()) != -1) {
System.out.println("已添加过" + parentBean.getItem());
@@ -448,7 +449,8 @@ public class CreateBOMDifference_DYController {
object_desc_Old, num_Old, "", "", "");
beans.add(compareBean);
// 物料删除遍历
- bomCompare_M030(bean, session, 1, 1, beans, item_compares);
+ if(child)
+ bomCompare_M030(bean, session, 1, 1, beans, item_compares, child);
}
if (newPartRev != null && oldPartRev == null) {
// 物料新增 若变更项不为虚拟项则记录
@@ -462,7 +464,8 @@ public class CreateBOMDifference_DYController {
zt2_MaterialNo_New, object_desc_New, num_New);
beans.add(compareBean);
// 物料新增遍历
- bomCompare_M030(bean, session, 1, 1, beans, item_compares);
+ if(child)
+ bomCompare_M030(bean, session, 1, 1, beans, item_compares, child);
}
if (newPartRev != null && oldPartRev != null) {
@@ -479,7 +482,8 @@ public class CreateBOMDifference_DYController {
zt2_MaterialNo_Old, object_desc_Old, num_Old, zt2_MaterialNo_New, object_desc_New, num_New);
beans.add(compareBean);
// 物料新增遍历
- bomCompare_M030(bean, session, 1, 1, beans, item_compares);
+ if(child)
+ bomCompare_M030(bean, session, 1, 1, beans, item_compares, child);
} else {
if (bean.getOldQuantity() > bean.getNewQuantity()) {
System.out.println("物料数量变更-删除-" + bean.getItem());
@@ -501,7 +505,8 @@ public class CreateBOMDifference_DYController {
num_New);
beans.add(compareBean);
}
- bomCompare_M030(bean, session, 1, 1, beans, item_compares);
+ if(child)
+ bomCompare_M030(bean, session, 1, 1, beans, item_compares, child);
}
}
diff --git a/com.connor.chint.wuhan/src/com/chint/plm/createbomdifference/ExtractDiffComd.java b/com.connor.chint.wuhan/src/com/chint/plm/createbomdifference/ExtractDiffComd.java
index e2f178c..3b6d523 100644
--- a/com.connor.chint.wuhan/src/com/chint/plm/createbomdifference/ExtractDiffComd.java
+++ b/com.connor.chint.wuhan/src/com/chint/plm/createbomdifference/ExtractDiffComd.java
@@ -7,9 +7,9 @@
*/
package com.chint.plm.createbomdifference;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.Locale;
-import java.util.Map;
import java.util.ResourceBundle;
import com.chint.plm.createEcn.Util;
@@ -24,7 +24,6 @@ import com.teamcenter.rac.kernel.TCComponentBOMWindowType;
import com.teamcenter.rac.kernel.TCComponentItem;
import com.teamcenter.rac.kernel.TCComponentItemRevision;
import com.teamcenter.rac.kernel.TCComponentRevisionRule;
-import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.util.MessageBox;
import com.teamcenter.services.rac.cad._2007_01.StructureManagement.ExpandPSData;
@@ -46,10 +45,10 @@ public class ExtractDiffComd extends KCommand {
private TCSession session;
/**
+ * 构造方法
* @param app
* @param commandId
* @param actionInfo
- * @function 构造方法
*/
public ExtractDiffComd(AbstractAIFApplication app, String commandId, String actionInfo) {
super(app, commandId, actionInfo);
@@ -84,13 +83,12 @@ public class ExtractDiffComd extends KCommand {
* @param oldComponents 变更前图纸
* @param newComponents 变更后图纸
* @param tar 变更单版本
- * @throws TCException
- * @function
+ * @throws Exception
*/
private void readChangeDesign(TCComponent[] oldComponents, TCComponent[] newComponents, TCComponent tar)
- throws TCException {
+ throws Exception {
// Auto-generated method stub
- Map itemChangeMap = new HashMap<>();
+ HashMap itemChangeMap = new HashMap<>();
for (TCComponent oldComponent : oldComponents) {
if (oldComponent.getType().equals(ZT_DESIGN3D)) {
TCComponentItemRevision rev = (TCComponentItemRevision) oldComponent;
@@ -146,18 +144,29 @@ public class ExtractDiffComd extends KCommand {
for (TCComponentItem keyItem : itemChangeMap.keySet()) {
ChangeDesignBean changeDesignBean = itemChangeMap.get(keyItem);
TCComponentItemRevision oldDesgin = changeDesignBean.getOldDesgin();
- Map materialOld = getMaterialByDesign(oldDesgin);
- System.out.println("materialOld===>" + materialOld.toString());
- TCComponentItemRevision newDesgin = changeDesignBean.getNewDesgin();
- Map materialNew = getMaterialByDesign(newDesgin);
+ HashMap materialMap = getMaterialByDesign(oldDesgin);
+ System.out.println("material===>" + materialMap.toString());
+// TCComponentItemRevision newDesgin = changeDesignBean.getNewDesgin();
+// Map materialNew = getMaterialByDesign(newDesgin);
- System.out.println("materialNew===>" + materialNew.toString());
+// System.out.println("materialNew===>" + materialNew.toString());
+ ArrayList list = new ArrayList<>();
// 比较变更前后物料BOM
- for (String materialNo : materialOld.keySet()) {
- if (!materialNew.containsKey(materialNo))
- continue;
- PBomBean pBomBeanOld = materialOld.get(materialNo);
- PBomBean pBomBeanNew = materialNew.get(materialNo);
+ for (String materialNo : materialMap.keySet()) {
+// if (!materialNew.containsKey(materialNo))
+// continue;
+ String mno = materialNo.substring(2);
+ if(list.contains(mno))
+ continue;
+ list.add(mno);
+ PBomBean pBomBeanOld, pBomBeanNew;
+ if(materialNo.startsWith("o@")) {
+ pBomBeanOld = materialMap.get(materialNo);
+ pBomBeanNew = materialMap.get("n@" + mno);
+ }else {
+ pBomBeanOld = materialMap.get("o@" + mno);
+ pBomBeanNew = materialMap.get(materialNo);
+ }
// 有P物料获取P没有遍历EBOM
/*
TCComponent oldMaterial = pBomBeanOld.getpMaterial() == null ? pBomBeanOld.geteMaterial()
@@ -174,8 +183,8 @@ public class ExtractDiffComd extends KCommand {
TCComponentBOMLine oldBomLine = sendToStructureManager((TCComponentItemRevision) oldMaterial, Util.REVISION_RULE_ANY);
TCComponentBOMLine newBomLine = sendToStructureManager((TCComponentItemRevision) newMaterial, null);
// BOM全展开
- Map oldBomMap = BomToSapUtil.getBomLineTreeNodeSOA(oldBomLine);
- Map newBomMap = BomToSapUtil.getBomLineTreeNodeSOA(newBomLine);
+ HashMap oldBomMap = BomToSapUtil.getBomLineTreeNodeSOA(oldBomLine);
+ HashMap newBomMap = BomToSapUtil.getBomLineTreeNodeSOA(newBomLine);
addChangeBom(oldBomMap, oldBomLine, newBomMap, newBomLine, tar);
System.out.println("oldBomMap===>" + oldBomMap.toString());
System.out.println("newBomMap===>" + newBomMap.toString());
@@ -188,8 +197,8 @@ public class ExtractDiffComd extends KCommand {
TCComponentBOMLine oldBomLine = sendToStructureManager((TCComponentItemRevision) oldMaterial, Util.REVISION_RULE_ANY);
TCComponentBOMLine newBomLine = sendToStructureManager((TCComponentItemRevision) newMaterial, null);
// BOM全展开
- Map oldBomMap = BomToSapUtil.getBomLineTreeNodeSOA(oldBomLine);
- Map newBomMap = BomToSapUtil.getBomLineTreeNodeSOA(newBomLine);
+ HashMap oldBomMap = BomToSapUtil.getBomLineTreeNodeSOA(oldBomLine);
+ HashMap newBomMap = BomToSapUtil.getBomLineTreeNodeSOA(newBomLine);
addChangeBom(oldBomMap, oldBomLine, newBomMap, newBomLine, tar);
System.out.println("oldBomMap===>" + oldBomMap.toString());
System.out.println("newBomMap===>" + newBomMap.toString());
@@ -207,12 +216,11 @@ public class ExtractDiffComd extends KCommand {
* @param newBomMap
* @param newBomLine 新的BOM行
* @param changeTag 变更单
- * @throws TCException
- * @function
+ * @throws Exception
*/
- private void addChangeBom(Map oldBomMap, TCComponentBOMLine oldBomLine,
- Map newBomMap, TCComponentBOMLine newBomLine, TCComponent changeTag)
- throws TCException {
+ private void addChangeBom(HashMap oldBomMap, TCComponentBOMLine oldBomLine,
+ HashMap newBomMap, TCComponentBOMLine newBomLine, TCComponent changeTag)
+ throws Exception {
// Auto-generated method stub
String oldUid = oldBomLine.getUid();
ExpandPSData[] expandPSDatasOld = oldBomMap.get(oldUid);
@@ -220,10 +228,10 @@ public class ExtractDiffComd extends KCommand {
if (expandPSDatasNew.length == 0 && expandPSDatasOld.length == 0) {
return;
}
- Map oldMaterialMap = new HashMap<>();
- Map newMaterialMap = new HashMap<>();
+ HashMap oldMaterialMap = new HashMap<>();
+ HashMap newMaterialMap = new HashMap<>();
// 记录变更前的物料编码和对应的BOM
- Map oldBomLineMap = new HashMap<>();
+ HashMap oldBomLineMap = new HashMap<>();
for (ExpandPSData expandPSData : expandPSDatasOld) {
TCComponentBOMLine bomLine = expandPSData.bomLine;
TCComponentItemRevision itemRevOfBOMLine = expandPSData.itemRevOfBOMLine;
@@ -269,6 +277,8 @@ public class ExtractDiffComd extends KCommand {
changeTag.add(ZT_CHANGE_BEF, oldBomLine.getItemRevision());
changeTag.add(ZT_CHANGE_AFT, newBomLine.getItemRevision());
} catch (Exception e) {
+
+ e.printStackTrace();
}
} else {
for (String materNo : oldMaterialMap.keySet()) {
@@ -281,6 +291,7 @@ public class ExtractDiffComd extends KCommand {
changeTag.add(ZT_CHANGE_BEF, oldBomLine.getItemRevision());
changeTag.add(ZT_CHANGE_AFT, newBomLine.getItemRevision());
} catch (Exception e) {
+ e.printStackTrace();
}
}
}
@@ -290,9 +301,9 @@ public class ExtractDiffComd extends KCommand {
/**
* 发送到结构管理器
*
- * @param tcComponentItem
+ * @param tcComponentItemRev 顶层版本
* @param revisionRuleName 版本规则
- * @return
+ * @return BOM行
*/
public TCComponentBOMLine sendToStructureManager(TCComponentItemRevision tcComponentItemRev,
String revisionRuleName) {
@@ -319,40 +330,71 @@ public class ExtractDiffComd extends KCommand {
* 从图纸获取物料,取最新的版本 有P物料的情况下获取P物料
*
* @param designRev 图纸版本
- * @throws TCException
- * @function
+ * @return 变更物料
+ * @throws Exception
*/
- private Map getMaterialByDesign(TCComponentItemRevision designRev) throws TCException {
+ private HashMap getMaterialByDesign(TCComponentItemRevision designRev) throws Exception {
// Auto-generated method stub
- Map pbomMap = new HashMap<>();
+ HashMap pbomMap = new HashMap<>();
// 图纸下物料
TCComponent[] represents = designRev.getReferenceListProperty(REPRESENTATION_FOR);
for (TCComponent represent : represents) {
- String[] matnrProps = represent.getProperties(new String[] { Util.ZT_MATERIAL_NO, Util.ZT_PROP_PBOM, Util.ITEM_REVIISON_ID });
- String materialNo = matnrProps[0];// material.getProperty(Util.ZT_MATERIAL_NO);
- if (pbomMap.containsKey(materialNo)) {
- PBomBean pBomBean = pbomMap.get(materialNo);
- // 是否PBOM
- System.out.println("matnrProps[1]===>" + matnrProps[1]);
- System.out.println("matnrProps[2]===>" + matnrProps[2] + "pBomBean.getpRevision()"+pBomBean.getpRevision());
- if (matnrProps[1].equals(Util.ZT_VAL_PBOM) && matnrProps[2].compareTo(pBomBean.getpRevision()) > 0) {
- pBomBean.setpMaterial(represent);
- pBomBean.setpRevision(matnrProps[2]);
- } else if (!matnrProps[1].equals(Util.ZT_VAL_PBOM) && matnrProps[2].compareTo(pBomBean.geteRevision()) > 0) {
- pBomBean.seteMaterial(represent);
- pBomBean.seteRevision(matnrProps[2]);
+ //TODO 20240226修改为通过BOMView是否发布来判断变更前后
+ TCComponent[] bom = represent.getReferenceListProperty("structure_revisions");
+ System.out.println("structure_revisions===>" + represent + " = " + bom.length);
+ TCComponent[] revs = represent.getReferenceProperty("items_tag").getReferenceListProperty("revision_list");
+ if(bom.length > 0 && bom[0].getDateProperty("date_released") == null && revs.length > 1) {
+ int size = revs.length;
+ //取最新版本作为变更后版本,用n@表示
+ TCComponent rev = revs[size - 1];
+ String[] matnrProps = rev.getProperties(new String[] { Util.ZT_MATERIAL_NO, Util.ZT_PROP_PBOM, Util.ITEM_REVIISON_ID });
+ String materialNo = matnrProps[0];// material.getProperty(Util.ZT_MATERIAL_NO);
+ if(pbomMap.containsKey("n@" + materialNo)) {
+ PBomBean pBomBean = pbomMap.get("n@" + materialNo);
+ if(matnrProps[1].equals(Util.ZT_VAL_PBOM)) {
+ pBomBean.setpMaterial(rev);
+ pBomBean.setpRevision(matnrProps[2]);
+ }else {
+ pBomBean.seteMaterial(rev);
+ pBomBean.seteRevision(matnrProps[2]);
+ }
+ }else {
+ PBomBean pBomBean = new PBomBean();
+ if (matnrProps[1].equals(Util.ZT_VAL_PBOM)) {
+ pBomBean.setpMaterial(rev);
+ pBomBean.setpRevision(matnrProps[2]);
+ } else {
+ pBomBean.seteMaterial(rev);
+ pBomBean.seteRevision(matnrProps[2]);
+ }
+ pbomMap.put("n@" + materialNo, pBomBean);
}
- } else {
- PBomBean pBomBean = new PBomBean();
- if (matnrProps[1].equals(Util.ZT_VAL_PBOM)) {
- pBomBean.setpMaterial(represent);
- pBomBean.setpRevision(matnrProps[2]);
- } else {
- pBomBean.seteMaterial(represent);
- pBomBean.seteRevision(matnrProps[2]);
+
+ //取第二新版本作为变更前版本,用o@表示
+ rev = revs[size - 2];
+ matnrProps = rev.getProperties(new String[] { Util.ZT_MATERIAL_NO, Util.ZT_PROP_PBOM, Util.ITEM_REVIISON_ID });
+ materialNo = matnrProps[0];// material.getProperty(Util.ZT_MATERIAL_NO);
+ if(pbomMap.containsKey("o@" + materialNo)) {
+ PBomBean pBomBean = pbomMap.get("o@" + materialNo);
+ if(matnrProps[1].equals(Util.ZT_VAL_PBOM)) {
+ pBomBean.setpMaterial(rev);
+ pBomBean.setpRevision(matnrProps[2]);
+ }else {
+ pBomBean.seteMaterial(rev);
+ pBomBean.seteRevision(matnrProps[2]);
+ }
+ }else {
+ PBomBean pBomBean = new PBomBean();
+ if (matnrProps[1].equals(Util.ZT_VAL_PBOM)) {
+ pBomBean.setpMaterial(rev);
+ pBomBean.setpRevision(matnrProps[2]);
+ } else {
+ pBomBean.seteMaterial(rev);
+ pBomBean.seteRevision(matnrProps[2]);
+ }
+ pbomMap.put("o@" + materialNo, pBomBean);
}
- pbomMap.put(materialNo, pBomBean);
- }
+ }
}
return pbomMap;
}
diff --git a/com.connor.chint.wuhan/src/com/chint/plm/updateWorkTime/UpdateWorkCommand.java b/com.connor.chint.wuhan/src/com/chint/plm/updateWorkTime/UpdateWorkCommand.java
index a0b5fd1..5dff877 100644
--- a/com.connor.chint.wuhan/src/com/chint/plm/updateWorkTime/UpdateWorkCommand.java
+++ b/com.connor.chint.wuhan/src/com/chint/plm/updateWorkTime/UpdateWorkCommand.java
@@ -1,14 +1,8 @@
package com.chint.plm.updateWorkTime;
-import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
-import javax.swing.JOptionPane;
-
-import com.chint.plm.applyMatnr.ApplyMatnrOp;
-import com.chint.plm.applyMatnr.ApplyMatnrOp2;
import com.connor.chint.sap2.util.MyProgressBarCompent;
import com.connor.chint.sap2.util.SAPMessageUtilFram;
import com.connor.chint.sap2.util.SAPUtil;
@@ -24,10 +18,11 @@ import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.kernel.TCUserService;
import com.teamcenter.rac.util.MessageBox;
+@SuppressWarnings("deprecation")
public class UpdateWorkCommand extends KCommand {
- private boolean top = true;
- private TCComponentBOMLine line;
+// private boolean top = true;
+// private TCComponentBOMLine line;
public TCComponentItemRevision getPRevision(TCComponentItemRevision rev2) throws TCException {
String zt2_MaterialNo = rev2.getStringProperty("zt2_MaterialNo");
@@ -60,41 +55,33 @@ public class UpdateWorkCommand extends KCommand {
return rev2;
}
- private TCComponentItemRevision getTopZzItem(TCComponentItemRevision rev) {
- // TODO Auto-generated method stub
-// item = null;
- try {
- TCComponent[] whereUsed = rev.whereUsed((short)0);
- if(whereUsed.length==0) {
-// String property = rev.getProperty("item_id");
- return rev;
- }else {
- List revPs = new ArrayList();
- for(int i=0;i revPs = new ArrayList();
+ for(int i = 0; i < whereUsed.length; i++) {
+ TCComponentItemRevision revP = (TCComponentItemRevision)whereUsed[i];
+ if(revP.getType().contains("Part")) {
+ revPs.add(revP);
}
-
- for(TCComponentItemRevision revP:revPs) {
- if(whereUsed.length>1) {
-// TCComponentItemRevision revP = (TCComponentItemRevision)whereUsed[i];
- String property = revP.getProperty("zt2_ifpbom");
- if(property==null||!property.equals("P")) {
- continue;
- }
- }
- TCComponentItemRevision item = getTopZzItem(revP);
- if(item!=null) {
- return item;
+ }
+
+ for(TCComponentItemRevision revP : revPs) {
+ if(revPs.size() > 1) {//whereUsed.length
+// TCComponentItemRevision revP = (TCComponentItemRevision)whereUsed[i];
+ String property = revP.getProperty("zt2_ifpbom");
+ if(property == null || !property.equals("P")) {
+ continue;
}
}
-
+ TCComponentItemRevision item = getTopZzItem(revP);
+ if(item != null) {
+ return item;
+ }
}
- } catch (TCException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
}
return null;
}
@@ -143,9 +130,9 @@ public class UpdateWorkCommand extends KCommand {
try {
// TCComponentItemRevision pRevision = getPRevision(rev);
TCComponentItemRevision topZzItem = getTopZzItem(rev);
- String property = topZzItem.getProperty("zt2_ifpbom");
- if(!property.equals("P") && topZzItem.getStringProperty("object_desc").contains("1ZDB300000P")) {
- MessageBox.post("请选择PBOM对象", "", MessageBox.ERROR);
+ String property = topZzItem==null ? "" : topZzItem.getProperty("zt2_ifpbom");
+ if(!property.equals("P")) {// && topZzItem.getStringProperty("object_desc").contains("1ZDB300000P")
+ MessageBox.post("未进行E转P操作", "", MessageBox.ERROR);
return;
}
// TCComponentItemRevision desginRev = (TCComponentItemRevision) topZzItem.getRelatedComponent("TC_Is_Represented_By");
@@ -217,7 +204,7 @@ public class UpdateWorkCommand extends KCommand {
MessageBox.post("更新工序工时完成。","提示",MessageBox.INFORMATION);
}
} catch (Exception e1) {
- // TODO Auto-generated catch block
+ // Auto-generated catch block
e1.printStackTrace();
}finally {
SqlUtil.freeAll();
diff --git a/com.connor.chint.wuhan/src/com/connor/chint/sap2/util/BomToSapUtil.java b/com.connor.chint.wuhan/src/com/connor/chint/sap2/util/BomToSapUtil.java
index 0fc96f4..7cc7c30 100644
--- a/com.connor.chint.wuhan/src/com/connor/chint/sap2/util/BomToSapUtil.java
+++ b/com.connor.chint.wuhan/src/com/connor/chint/sap2/util/BomToSapUtil.java
@@ -1,17 +1,11 @@
package com.connor.chint.sap2.util;
import java.awt.Desktop;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
import java.net.URI;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
-import java.util.Map;
-import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentBOMLine;
import com.teamcenter.rac.kernel.TCComponentItemRevision;
import com.teamcenter.rac.ui.common.RACUIUtil;
@@ -24,14 +18,14 @@ import com.teamcenter.services.rac.cad._2007_01.StructureManagement.ExpandPSData
public class BomToSapUtil {
// BOM全展开, Map返回的内容是 BOM行的UID和对应的子行
- public static Map getBomLineTreeNodeSOA(TCComponentBOMLine bomLine) {
+ public static HashMap getBomLineTreeNodeSOA(TCComponentBOMLine bomLine) {
// List bomLineNodes = list;
// 预定义BOM父子对map及ItemRev map
- Map bomLineMap = new HashMap();
+ HashMap bomLineMap = new HashMap<>();
try {
- TCComponentItemRevision object = bomLine.getItemRevision();
- String object_type = object.getType();
+// TCComponentItemRevision object = bomLine.getItemRevision();
+// String object_type = object.getType();
// if (!sparePartRevision.equals(object_type)) {
// 调用SOA方法,批量展开BOM
com.teamcenter.services.rac.cad._2007_01.StructureManagement structureService = com.teamcenter.services.rac.cad.StructureManagementService
@@ -65,7 +59,7 @@ public class BomToSapUtil {
// 预定义BOM父子对map及ItemRev map
List listBoms = new ArrayList<>();
try {
- TCComponentItemRevision object = bomLine.getItemRevision();
+// TCComponentItemRevision object = bomLine.getItemRevision();
// String object_type = object.getType();
com.teamcenter.services.rac.cad._2007_01.StructureManagement structureService = com.teamcenter.services.rac.cad.StructureManagementService
.getService(RACUIUtil.getTCSession());
@@ -101,10 +95,10 @@ public class BomToSapUtil {
// 预定义BOM父子对map及ItemRev map
List bomLineMap = new ArrayList();
- Map bomLineItemRevMap = new HashMap();
+// Map bomLineItemRevMap = new HashMap();
try {
- TCComponentItemRevision object = bomLine.getItemRevision();
- String object_type = object.getType();
+// TCComponentItemRevision object = bomLine.getItemRevision();
+// String object_type = object.getType();
// if (!sparePartRevision.equals(object_type)) {
// 调用SOA方法,批量展开BOM
com.teamcenter.services.rac.cad._2007_01.StructureManagement structureService = com.teamcenter.services.rac.cad.StructureManagementService
@@ -187,7 +181,7 @@ public class BomToSapUtil {
// fos.close();
// System.out.println("下载完成");
// } catch (IOException e) {
-// // TODO Auto-generated catch block
+// // Auto-generated catch block
// e.printStackTrace();
// }
// return file.getPath();
diff --git a/com.connor.chint.wuhan/src/com/connor/chint/sap2/util/BomUtilWh.java b/com.connor.chint.wuhan/src/com/connor/chint/sap2/util/BomUtilWh.java
index 8c44d6b..7955291 100644
--- a/com.connor.chint.wuhan/src/com/connor/chint/sap2/util/BomUtilWh.java
+++ b/com.connor.chint.wuhan/src/com/connor/chint/sap2/util/BomUtilWh.java
@@ -3,15 +3,12 @@ package com.connor.chint.sap2.util;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
-//import org.apache.commons.lang.builder.StandardToStringStyle;
-import org.dom4j.Document;
-import org.dom4j.DocumentException;
-import org.dom4j.DocumentHelper;
import org.dom4j.Element;
//import com.connor.chint.sap2.sap_zy.FlowBean;
@@ -53,7 +50,7 @@ public class BomUtilWh {
public static Integer getCode() throws SQLException {
String sql = "select Tab_SendBom_Sequence.nextval as sid from dual";
ResultSet rs = SqlUtil.read(sql);
- Object objs[] = new Object[1];
+// Object objs[] = new Object[1];
int code = 0;
if (rs.next()) {
code = rs.getInt(1);
@@ -78,7 +75,8 @@ public class BomUtilWh {
try {
// 物料信息
Element element = interGrationList.element(WLLIST);
- List elements = element.elements(WLCONTENTS);
+ @SuppressWarnings("unchecked")
+ List elements = element.elements(WLCONTENTS);
for (Element content : elements) {
// 记录TCid UID 物料编码
Element bomContents = content.element("BOMCONTENTS");
@@ -86,8 +84,9 @@ public class BomUtilWh {
String[] split = tcId.split(SPLIT_MSG);
String parentMantrNo = bomContents.elementText(PARENTWLBM);
String uid = bomContents.elementText(UID);
- SqlUtil.write(logSql,
- new String[] { code, batchNo, WH_FACOTRY, productNos, split[0], uid, parentMantrNo, wbsNo });
+ String[] args = new String[] { code, batchNo, WH_FACOTRY, productNos, split[0], uid, parentMantrNo, wbsNo };
+ int i = SqlUtil.write(logSql, args);
+ System.out.println("logSql:" + i);
}
} catch (Exception e) {
e.printStackTrace();
@@ -96,7 +95,12 @@ public class BomUtilWh {
}
}
- private static ArrayList lists2=new ArrayList(){{add("PDF");add("MS WordX");add("MS ExcelX");add("MS Excel");add("MS Word");}};
+ private static ArrayList lists2 = new ArrayList(){/**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ {add("PDF");add("MS WordX");add("MS ExcelX");add("MS Excel");add("MS Word");}};
// public static String getXML(String parameters){
// String soapXML = " "
@@ -123,7 +127,7 @@ public class BomUtilWh {
// System.out.println(document.toString());
//// rootElement.si
// } catch (DocumentException e) {
-// // TODO Auto-generated catch block
+// // Auto-generated catch block
// e.printStackTrace();
// }
// }
@@ -157,7 +161,7 @@ public class BomUtilWh {
// }
// }
// } catch (TCException e) {
-// // TODO Auto-generated catch block
+// // Auto-generated catch block
// e.printStackTrace();
// }
ls.add(dsList);
@@ -350,17 +354,17 @@ public class BomUtilWh {
// DT_PROCESSROUTE_S4_REQLISTITEMSITEM item = new DT_PROCESSROUTE_S4_REQLISTITEMSITEM();
String plnal = "1";
String plnfl = String.format("%06d", index);
- String datuv = now;
+// String datuv = now;
String vornr1 = "";
String vornr2 = "";
- boolean bx = false;
+// boolean bx = false;
String flagt = "";
String bezfl = "";// 参考顺序
// item.setLTXA1("");//顺序描述
if (!bean.isMain) {// 并行
// item.setBEZFL("000000");//参考顺序
bezfl = (bean.BEZFL);
- bx = true;
+// bx = true;
flagt = ("1");// 顺序类别
// System.out.println("前驱:"+bean.flow_split);
if (bean.flow_split != null) {
@@ -509,7 +513,7 @@ public class BomUtilWh {
// dsList2.add((TCComponentDataset)dataset);
Element FILECONTENTS = OPGYSZFILELIST.addElement("FILECONTENTS");
String fileId = processRuleRevision.getProperty("item_id");
- String name = processRuleRevision.getProperty("object_name");
+// String name = processRuleRevision.getProperty("object_name");
String fileRevId = processRuleRevision.getProperty("item_revision_id");
String fileName = dataset.getProperty("object_name");
String fileType = "文件";
@@ -643,7 +647,7 @@ public class BomUtilWh {
// DT_PROCESSROUTE_S4_REQLISTITEMSITEM item = new DT_PROCESSROUTE_S4_REQLISTITEMSITEM();
String plnal = "1";
String plnfl = String.format("%06d", index);
- String datuv = now;
+// String datuv = now;
String vornr1 = "";
String vornr2 = "";
boolean bx = false;
@@ -802,7 +806,7 @@ public class BomUtilWh {
// dsList2.add((TCComponentDataset)dataset);
Element FILECONTENTS = OPGYSZFILELIST.addElement("FILECONTENTS");
String fileId = processRuleRevision.getProperty("item_id");
- String name = processRuleRevision.getProperty("object_name");
+// String name = processRuleRevision.getProperty("object_name");
String fileRevId = processRuleRevision.getProperty("item_revision_id");
String fileName = dataset.getProperty("object_name");
String fileType = "文件";
@@ -885,17 +889,17 @@ public class BomUtilWh {
// DT_PROCESSROUTE_S4_REQLISTITEMSITEM item = new DT_PROCESSROUTE_S4_REQLISTITEMSITEM();
String plnal = "1";
String plnfl = String.format("%06d", index);
- String datuv = now;
+// String datuv = now;
String vornr1 = "";
String vornr2 = "";
- boolean bx = false;
+// boolean bx = false;
String flagt = "";
String bezfl = "";// 参考顺序
// item.setLTXA1("");//顺序描述
if (!bean.isMain) {// 并行
// item.setBEZFL("000000");//参考顺序
bezfl = (bean.BEZFL);
- bx = true;
+// bx = true;
flagt = ("1");// 顺序类别
// System.out.println("前驱:"+bean.flow_split);
if (bean.flow_split != null) {
@@ -918,9 +922,9 @@ public class BomUtilWh {
KJJDHEAD.addElement("BEZFL").setText(bezfl);
KJJDHEAD.addElement("VORNR1").setText(vornr1);
KJJDHEAD.addElement("VORNR2").setText(vornr2);
- int cnt = bean.flowList.size();
+// int cnt = bean.flowList.size();
// List subItems = new ArrayList<>();
- boolean inBx = bean.flow_split == null;
+// boolean inBx = bean.flow_split == null;
TCComponentItemRevision gxRev = gxLine.getItemRevision();
String[] properties2 = gxLine.getProperties(new String[] { "zt2_ControlCode",
@@ -993,7 +997,7 @@ public class BomUtilWh {
// DT_PROCESSROUTE_S4_REQLISTITEMSITEM item = new DT_PROCESSROUTE_S4_REQLISTITEMSITEM();
String plnal = "1";
String plnfl = String.format("%06d", index);
- String datuv = now;
+// String datuv = now;
String vornr1 = "";
String vornr2 = "";
boolean bx = false;
@@ -1157,8 +1161,8 @@ public class BomUtilWh {
MATERIALNO.setText(zt2_MaterialNo);
PLANT.setText(groupId);
wbsList.add(wbsNo);
- } catch (TCException e) {
- // TODO Auto-generated catch block
+ } catch (Exception e) {
+ // Auto-generated catch block
e.printStackTrace();
}
@@ -1184,8 +1188,8 @@ public class BomUtilWh {
MATERIALNO.setText(zt2_MaterialNo);
PLANT.setText(groupId);
wbsList.add(wbsNo);
- } catch (TCException e) {
- // TODO Auto-generated catch block
+ } catch (Exception e) {
+ // Auto-generated catch block
e.printStackTrace();
}
@@ -1345,7 +1349,7 @@ public class BomUtilWh {
}
} catch (Exception e) {
- // TODO: handle exception
+ // : handle exception
e.printStackTrace();
}
}
@@ -1498,7 +1502,7 @@ public class BomUtilWh {
}
} catch (Exception e) {
- // TODO: handle exception
+ // : handle exception
e.printStackTrace();
}
}
@@ -1702,7 +1706,7 @@ public class BomUtilWh {
}
} catch (Exception e) {
- // TODO: handle exception
+ // : handle exception
e.printStackTrace();
}
}
@@ -1763,7 +1767,7 @@ public class BomUtilWh {
//
}
} catch (Exception e) {
- // TODO: handle exception
+ // : handle exception
e.printStackTrace();
}
}
@@ -1807,7 +1811,7 @@ public class BomUtilWh {
Element BOMCONTENTS = WLCONTENTS.addElement("BOMCONTENTS"); // BOM信息
Element WLFILELIST = WLCONTENTS.addElement("WLFILELIST"); // 文件信息
- Element BOPLIST = WLCONTENTS.addElement("BOPLIST"); // 工艺信息
+ WLCONTENTS.addElement("BOPLIST"); // 工艺信息
for (TCComponentDataset ds : list1) {
Element FILECONTENTS = WLFILELIST.addElement("FILECONTENTS");
@@ -1929,7 +1933,7 @@ public class BomUtilWh {
}
} catch (Exception e) {
- // TODO: handle exception
+ // : handle exception
e.printStackTrace();
}
}
diff --git a/com.connor.chint.wuhan/src/com/connor/chint/sap2/util/POIUtil.java b/com.connor.chint.wuhan/src/com/connor/chint/sap2/util/POIUtil.java
index e004ea4..4f0ca6e 100644
--- a/com.connor.chint.wuhan/src/com/connor/chint/sap2/util/POIUtil.java
+++ b/com.connor.chint.wuhan/src/com/connor/chint/sap2/util/POIUtil.java
@@ -1,5 +1,7 @@
package com.connor.chint.sap2.util;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
import java.text.SimpleDateFormat;
import java.util.Iterator;
import java.util.List;
@@ -13,7 +15,7 @@ import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.ClientAnchor;
import org.apache.poi.ss.usermodel.DateUtil;
import org.apache.poi.ss.usermodel.Sheet;
-import org.apache.poi.ss.usermodel.Workbook;
+//import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
@@ -25,21 +27,26 @@ import org.apache.poi.xssf.usermodel.XSSFShape;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import com.spire.xls.Workbook;
+import com.spire.xls.Worksheet;
+import com.spire.xls.core.ICheckBox;
+import com.spire.xls.core.ICheckBoxes;
+
public class POIUtil {
- public static void main(String[] args) {
- String name = "<>'sssshsw*s\\w/?<>|s:";
- System.out.println("name:" + name);
- for (int i = 0; i < strs.length; i++) {
- System.out.println(i + "--[" + strs[i] + "]");
- int index = name.indexOf(strs[i]);
- System.out.println("index:" + index);
- if (index != -1) {
- name = name.replaceAll(strs2[i], "");
- }
- }
- System.out.println("name:" + checkName("shsw\\wsw|sjw/|:<>?"));
- }
+// public static void main(String[] args) {
+// String name = "<>'sssshsw*s\\w/?<>|s:";
+// System.out.println("name:" + name);
+// for (int i = 0; i < strs.length; i++) {
+// System.out.println(i + "--[" + strs[i] + "]");
+// int index = name.indexOf(strs[i]);
+// System.out.println("index:" + index);
+// if (index != -1) {
+// name = name.replaceAll(strs2[i], "");
+// }
+// }
+// System.out.println("name:" + checkName("shsw\\wsw|sjw/|:<>?"));
+// }
private static String strs[] = { "\\", "/", "*", "?", "<", ">", "|", ":" };
private static String strs2[] = { "\\\\", "/", "\\*", "\\?", "<", ">", "\\|", ":" };
@@ -351,7 +358,7 @@ public class POIUtil {
for (XSSFShape shape : shapes) {
XSSFPicture pic = (XSSFPicture) shape;
patriarchTo.createPicture((ClientAnchor) pic.getAnchor(),
- workbook.addPicture(pic.getPictureData().getData(), Workbook.PICTURE_TYPE_PNG));
+ workbook.addPicture(pic.getPictureData().getData(), org.apache.poi.ss.usermodel.Workbook.PICTURE_TYPE_PNG));
}
}
}
@@ -421,4 +428,179 @@ public class POIUtil {
cell.setCellStyle(style);
}
}
+
+ /**
+ * 获取Excel行
+ * @param sheet sheet页
+ * @param i 行号
+ * @return Excel行对象
+ */
+ public static XSSFRow getRow(XSSFSheet sheet, int i) {
+ XSSFRow row = sheet.getRow(i);
+ if (row == null) {
+ row = sheet.createRow(i);
+ }
+ return row;
+ }
+
+ /**
+ * 获取Excel单元格
+ * @param row 单元格所在行
+ * @param col 单元格列号
+ * @return Excel单元格对象
+ */
+ public static XSSFCell getCell(XSSFRow row, int col) {
+ XSSFCell cell = row.getCell(col);
+ if(cell==null)
+ cell = row.createCell(col);
+ return cell;
+ }
+
+ /**
+ * 复制Excel行
+ * @param sheet sheet页
+ * @param startRow 源起始行
+ * @param endRow 源终止行(含)
+ * @param margin 目标行
+ * @param endCol 最大列号
+ * @param copyCount 数量
+ */
+ public static void copyRows(XSSFSheet sheet, int startRow, int endRow, int margin, int endCol, int copyCount) {
+ int regionCnt = sheet.getNumMergedRegions();
+ CellRangeAddress region;
+ for (int i = startRow; i <= endRow; i++) {
+ XSSFRow sourceRow = null;
+ XSSFRow targetRow = null;
+ XSSFCell sourceCell = null;
+ XSSFCell targetCell = null;
+ short m;
+ sourceRow = getRow(sheet, i);
+ for (int j = 0; j < copyCount; j++) {
+ int space = (endRow - startRow + 1) * j + margin;
+ targetRow = getRow(sheet, i - startRow + space);
+ targetRow.setHeight(sourceRow.getHeight());
+ for (m = sourceRow.getFirstCellNum(); m <= endCol; m++) {
+ if(m < 0)
+ continue;
+ sourceCell = getCell(sourceRow, m);
+ targetCell = getCell(targetRow, m);
+ if (sourceCell != null) {
+ targetCell.setCellStyle(sourceCell.getCellStyle());
+ int cType = sourceCell.getCellType();
+ switch (cType) {
+ case XSSFCell.CELL_TYPE_STRING:
+ targetCell.setCellType(cType);
+ targetCell.setCellValue(sourceCell.getRichStringCellValue());
+ break;
+ case XSSFCell.CELL_TYPE_NUMERIC:
+ targetCell.setCellType(cType);
+ targetCell.setCellValue(sourceCell.getNumericCellValue());
+ break;
+ case XSSFCell.CELL_TYPE_FORMULA:
+ targetCell.setCellFormula(sourceCell.getCellFormula());
+ break;
+ case XSSFCell.CELL_TYPE_BOOLEAN:
+ targetCell.setCellType(cType);
+ targetCell.setCellValue(sourceCell.getBooleanCellValue());
+ break;
+ case XSSFCell.CELL_TYPE_ERROR:
+ targetCell.setCellType(cType);
+ targetCell.setCellValue(sourceCell.getErrorCellValue());
+ break;
+ default:
+ targetCell.setCellType(cType);
+ targetCell.setCellValue(sourceCell.getRichStringCellValue());
+ break;
+ }
+ }
+ }
+
+ }
+ }
+ for (int j = 0; j < copyCount; j++) {
+ int space = margin + (endRow - startRow + 1) * j - startRow;
+ for (int n = 0; n < regionCnt; n++) {
+ region = sheet.getMergedRegion(n);
+ if ((region.getFirstRow() >= startRow) && (region.getLastRow() <= endRow) && (region.getLastColumn() <= endCol)) {
+ CellRangeAddress newRegion = new CellRangeAddress(region.getFirstRow() + space, region.getLastRow() + space, region.getFirstColumn(), region.getLastColumn());
+ sheet.addMergedRegion(newRegion);
+ }
+ }
+ }
+ }
+
+ /**
+ * 删除Excel行
+ * @param sheet sheet页
+ * @param startRow 起始行
+ * @param endRow 终止行(含)
+ */
+ public static void deleteRows(XSSFSheet sheet, int startRow, int endRow) {
+ int regionCnt = sheet.getNumMergedRegions();
+ CellRangeAddress region;
+ for (int i = regionCnt - 1; i >= 0; i--) {
+ region = sheet.getMergedRegion(i);
+ if (region.getFirstRow() >= startRow && region.getLastRow() <= endRow) {
+ sheet.removeMergedRegion(i);
+ }
+ }
+ for (int i = startRow; i <= endRow; i++) {
+ sheet.removeRow(POIUtil.getRow(sheet, i));
+ }
+ }
+
+ /**
+ * Excel测试用
+ */
+ public static void main(String[] args) {
+ System.out.println("BoxReport main");
+ FileInputStream input = null;
+ FileOutputStream fos = null;
+ try {
+// File file = new File("Z:\\TC_install\\ZhengTai\\正式更改通知单模板 - 副本.xlsx");
+// input = new FileInputStream(file);
+// XSSFWorkbook workbook = new XSSFWorkbook(input);
+// XSSFSheet sheet = workbook.getSheetAt(0);
+// int PAGE_ITEM_CNT = 6;//每页对象数量
+// int FIRST_PAGE = 28;//第二页起始行
+// int PAGE_ROW_CNT = 16;//每页行数
+// int ITEM_ROW_CNT = 1;//每个对象行数
+// int TITLE_ROW_CNT = 6;//表头行数
+// POIUtil.copyRows(sheet, 0, TITLE_ROW_CNT - 1, FIRST_PAGE, 19, 1);
+// POIUtil.copyRows(sheet, FIRST_PAGE, FIRST_PAGE + PAGE_ROW_CNT - 1, FIRST_PAGE + PAGE_ROW_CNT, 19, 2);
+ Workbook workbook = new Workbook();
+ workbook.loadFromFile("Z:\\TC_install\\ZhengTai\\正式更改通知单模板 - 副本.xlsx");
+ Worksheet sheet = workbook.getWorksheets().get(0);
+
+ ICheckBoxes boxes = sheet.getCheckBoxes();
+ System.out.println("boxes:" + boxes.getCount());
+ ICheckBox box1 = boxes.get(0);
+ ICheckBox checkbox1 = boxes.addCheckBox(47, 4, 18, 80);
+ checkbox1.setCheckState(box1.getCheckState());
+ checkbox1.setText(box1.getText());
+ ICheckBox box2 = boxes.get(1);
+ ICheckBox checkbox2 = boxes.addCheckBox(47, 6, 18, 90);
+ checkbox2.setCheckState(box2.getCheckState());
+ checkbox2.setText(box2.getText());
+
+// fos = new FileOutputStream(file);
+ workbook.save();//.write(fos);
+ System.out.println("end");
+ } catch (Exception e1) {
+ e1.printStackTrace();
+ }finally {
+ try {
+ if(fos != null)
+ fos.close();
+ } catch (Exception e1) {
+ e1.printStackTrace();
+ }
+ try {
+ if(input != null)
+ input.close();
+ } catch (Exception e1) {
+ e1.printStackTrace();
+ }
+ }
+ }
}
diff --git a/com.connor.chint.wuhan/src/com/connor/chint/sap2/util/SAPMessageUtilFram.java b/com.connor.chint.wuhan/src/com/connor/chint/sap2/util/SAPMessageUtilFram.java
index dc09220..7b051ac 100644
--- a/com.connor.chint.wuhan/src/com/connor/chint/sap2/util/SAPMessageUtilFram.java
+++ b/com.connor.chint.wuhan/src/com/connor/chint/sap2/util/SAPMessageUtilFram.java
@@ -15,27 +15,29 @@ import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
-import com.teamcenter.rac.aif.AbstractAIFDialog;
-
public class SAPMessageUtilFram extends JFrame {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
boolean flag = true;
private JButton b_ok;
private JButton b_ch;
private String label_b_ok = "确定";
private String label_b_cel = "取消";
private String text;
- private String title;
+// private String title;
private JTextArea jtf;
- private int MaxX = 0;
- private int MaxY = 0;
+// private int MaxX = 0;
+// private int MaxY = 0;
private boolean isNeedCel = false;
public SAPMessageUtilFram(String title, String text) {
// super(false);
this.text = text;
- this.title = title;
+// this.title = title;
initUI2();
this.setAlwaysOnTop(true);
this.pack();
@@ -45,13 +47,16 @@ public class SAPMessageUtilFram extends JFrame {
// showDialog();
}
-
-
+ @SuppressWarnings("deprecation")
+ public void show() {
+ super.show();
+ }
+
private void initUI2() {
jtf = new JTextArea();
JPanel panel = new JPanel(new BorderLayout());
panel.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
- int dialog_X = 1, dialog_Y = 1, js_X = 1, js_Y = 1;
+ int dialog_X = 1, dialog_Y = 1;//, js_X = 1, js_Y = 1
String strs[] = text.split("\\n");
int length = strs.length;
int maxX = 1;
diff --git a/com.connor.chint.wuhan/src/com/connor/chint/sap2/util/SqlUtil.java b/com.connor.chint.wuhan/src/com/connor/chint/sap2/util/SqlUtil.java
index 299065c..9b871fe 100644
--- a/com.connor.chint.wuhan/src/com/connor/chint/sap2/util/SqlUtil.java
+++ b/com.connor.chint.wuhan/src/com/connor/chint/sap2/util/SqlUtil.java
@@ -6,6 +6,7 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
+import java.util.Arrays;
import com.teamcenter.rac.util.Registry;
@@ -714,7 +715,9 @@ public class SqlUtil {
public final static int update(String sql, Object[] argments) {
int i = -1;
try {
- i = SqlUtil.getPs(argments, sql).executeUpdate();
+ PreparedStatement ps = SqlUtil.getPs(argments, sql);
+ System.out.println("update:" + sql + "==" + Arrays.toString(argments));
+ i = ps.executeUpdate();
SqlUtil.connection.commit();
} catch (SQLException e) {
e.printStackTrace();
diff --git a/com.connor.chint.wuhan/src/com/connor/chint/yunpi/command/AssignProcess.java b/com.connor.chint.wuhan/src/com/connor/chint/yunpi/command/AssignProcess.java
index 1e7b39e..0c39ff7 100644
--- a/com.connor.chint.wuhan/src/com/connor/chint/yunpi/command/AssignProcess.java
+++ b/com.connor.chint.wuhan/src/com/connor/chint/yunpi/command/AssignProcess.java
@@ -144,6 +144,7 @@ public class AssignProcess extends KCommand {
continue;
String[] backs = split[1].split(";");
for(String back : backs) {
+ System.out.println(name + "==" + back + ">>" + name.contains(back));
if(name.contains(back)) {
isback = true;
break;
diff --git a/com.connor.chint.wuhan/src/com/connor/chint/yunpi/command/BomDcSapOp.java b/com.connor.chint.wuhan/src/com/connor/chint/yunpi/command/BomDcSapOp.java
index 42082f6..2c1e02d 100644
--- a/com.connor.chint.wuhan/src/com/connor/chint/yunpi/command/BomDcSapOp.java
+++ b/com.connor.chint.wuhan/src/com/connor/chint/yunpi/command/BomDcSapOp.java
@@ -21,6 +21,7 @@ import com.connor.chint.sap2.util.TXTUtil;
import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aif.AbstractAIFOperation;
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
+import com.teamcenter.rac.aifrcp.AIFUtility;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentBOMLine;
import com.teamcenter.rac.kernel.TCComponentBOMWindow;
@@ -45,14 +46,14 @@ public class BomDcSapOp extends AbstractAIFOperation {
private String groupName = "";
private TCComponentItemType ccomponentitemtype;
public BomDcSapOp(AbstractAIFApplication app) {
- // TODO Auto-generated constructor stub
+ // Auto-generated constructor stub
this.app = app;
this.session = (TCSession) app.getSession();
now = format.format(new Date());
try {
ccomponentitemtype = (TCComponentItemType)session.getTypeComponent("ZT2_Design3D");
} catch (TCException e) {
- // TODO Auto-generated catch block
+ // Auto-generated catch block
e.printStackTrace();
}
@@ -84,7 +85,7 @@ public class BomDcSapOp extends AbstractAIFOperation {
}
}
System.out.print("id===>"+id);
- TCComponentItem find = ccomponentitemtype.find(id);
+ TCComponentItem find = ccomponentitemtype.findItems(id)[0];
TCComponentItemRevision zztRev = find.getLatestItemRevision();
TCComponent[] matnrs = zztRev.getRelatedComponents("representation_for");
for(TCComponent matnr:matnrs) {
@@ -147,7 +148,7 @@ public class BomDcSapOp extends AbstractAIFOperation {
}
@Override
public void executeOperation() throws Exception {
- // TODO Auto-generated method stub
+ // Auto-generated method stub
MyProgressBarCompent comp = null;
try {
groupName = SAPUtil.getGroupID(session);
@@ -173,6 +174,22 @@ public class BomDcSapOp extends AbstractAIFOperation {
MessageBox.post("请选择图纸/物料版本", "", MessageBox.INFORMATION);
return;
}
+ TCComponent bomRev = degignRev.getRelatedComponent("structure_revisions");
+ if(bomRev == null) {
+ MessageBox.post(AIFUtility.getActiveDesktop(), "所选对象没有BOM视图,无法传递!", "", MessageBox.INFORMATION);
+ return;
+ }
+ TCComponent[] release_status_list = degignRev.getReferenceListProperty("release_status_list");
+ if(release_status_list.length == 0) {
+ MessageBox.post(AIFUtility.getActiveDesktop(), "所选对象未发布,无法传递!", "", MessageBox.INFORMATION);
+ return;
+ }else {
+ release_status_list = bomRev.getReferenceListProperty("release_status_list");
+ if(release_status_list.length == 0) {
+ MessageBox.post(AIFUtility.getActiveDesktop(), "所选对象BOM视图未发布,无法传递!", "", MessageBox.INFORMATION);
+ return;
+ }
+ }
comp = new MyProgressBarCompent("", "正在进行单层BOM传递SAP....");
TCComponentItemRevision pRevision = getPRevision(degignRev); //获取PBOM
diff --git a/com.connor.chint.wuhan/src/com/connor/chint/yunpi/command/BomSapWhBjOp.java b/com.connor.chint.wuhan/src/com/connor/chint/yunpi/command/BomSapWhBjOp.java
index 6b2deed..f258bf8 100644
--- a/com.connor.chint.wuhan/src/com/connor/chint/yunpi/command/BomSapWhBjOp.java
+++ b/com.connor.chint.wuhan/src/com/connor/chint/yunpi/command/BomSapWhBjOp.java
@@ -15,7 +15,6 @@ import com.connor.chint.sap2.util.BomToSapUtil;
import com.connor.chint.sap2.util.BomUtilWh;
import com.connor.chint.sap2.util.KUtil;
import com.connor.chint.sap2.util.MyProgressBarCompent;
-import com.connor.chint.sap2.util.SAPMessageUtil;
import com.connor.chint.sap2.util.SAPMessageUtilFram;
import com.connor.chint.sap2.util.SAPUtil;
import com.connor.chint.sap2.util.SqlUtil;
@@ -23,7 +22,7 @@ import com.connor.chint.sap2.util.TXTUtil;
import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aif.AbstractAIFOperation;
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
-import com.teamcenter.rac.kernel.ListOfValuesInfo;
+import com.teamcenter.rac.aifrcp.AIFUtility;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentBOMLine;
import com.teamcenter.rac.kernel.TCComponentBOMWindow;
@@ -32,7 +31,6 @@ import com.teamcenter.rac.kernel.TCComponentDataset;
import com.teamcenter.rac.kernel.TCComponentItem;
import com.teamcenter.rac.kernel.TCComponentItemRevision;
import com.teamcenter.rac.kernel.TCComponentItemType;
-import com.teamcenter.rac.kernel.TCComponentListOfValues;
import com.teamcenter.rac.kernel.TCComponentMEProcessRevision;
import com.teamcenter.rac.kernel.TCComponentUser;
import com.teamcenter.rac.kernel.TCException;
@@ -50,14 +48,14 @@ public class BomSapWhBjOp extends AbstractAIFOperation {
private TCComponentItemType ccomponentitemtype;
public BomSapWhBjOp(AbstractAIFApplication app) {
- // TODO Auto-generated constructor stub
+ // Auto-generated constructor stub
this.app = app;
this.session = (TCSession) app.getSession();
now = format.format(new Date());
try {
ccomponentitemtype = (TCComponentItemType) session.getTypeComponent("ZT2_Design3D");
- } catch (TCException e) {
- // TODO Auto-generated catch block
+ } catch (Exception e) {
+ // Auto-generated catch block
e.printStackTrace();
}
@@ -89,7 +87,7 @@ public class BomSapWhBjOp extends AbstractAIFOperation {
}
}
System.out.print("id===>" + id);
- TCComponentItem find = ccomponentitemtype.find(id);
+ TCComponentItem find = ccomponentitemtype.findItems(id)[0];
TCComponentItemRevision zztRev = find.getLatestItemRevision();
TCComponent[] matnrs = zztRev.getRelatedComponents("representation_for");
for (TCComponent matnr : matnrs) {
@@ -151,7 +149,7 @@ public class BomSapWhBjOp extends AbstractAIFOperation {
@Override
public void executeOperation() throws Exception {
- // TODO Auto-generated method stub
+ // Auto-generated method stub
MyProgressBarCompent comp = null;
try {
@@ -188,6 +186,22 @@ public class BomSapWhBjOp extends AbstractAIFOperation {
MessageBox.post("请选择图纸/物料版本", "", MessageBox.INFORMATION);
return;
}
+ TCComponent bomRev = degignRev.getRelatedComponent("structure_revisions");
+ if(bomRev == null) {
+ MessageBox.post(AIFUtility.getActiveDesktop(), "所选对象没有BOM视图,无法传递!", "", MessageBox.INFORMATION);
+ return;
+ }
+ TCComponent[] release_status_list = degignRev.getReferenceListProperty("release_status_list");
+ if(release_status_list.length == 0) {
+ MessageBox.post(AIFUtility.getActiveDesktop(), "所选对象未发布,无法传递!", "", MessageBox.INFORMATION);
+ return;
+ }else {
+ release_status_list = bomRev.getReferenceListProperty("release_status_list");
+ if(release_status_list.length == 0) {
+ MessageBox.post(AIFUtility.getActiveDesktop(), "所选对象BOM视图未发布,无法传递!", "", MessageBox.INFORMATION);
+ return;
+ }
+ }
comp = new MyProgressBarCompent("", "正在进行部件BOM传递SAP....");
TCComponentItemRevision pRevision = getPRevision(degignRev); // 获取PBOM
diff --git a/com.connor.chint.wuhan/src/com/connor/chint/yunpi/command/BomSapWhCommand.java b/com.connor.chint.wuhan/src/com/connor/chint/yunpi/command/BomSapWhCommand.java
index a567a39..28fd6be 100644
--- a/com.connor.chint.wuhan/src/com/connor/chint/yunpi/command/BomSapWhCommand.java
+++ b/com.connor.chint.wuhan/src/com/connor/chint/yunpi/command/BomSapWhCommand.java
@@ -1,19 +1,7 @@
package com.connor.chint.yunpi.command;
-import java.util.ArrayList;
-import java.util.List;
-
-import com.chint.plm.createKjBom.CBean;
-import com.chint.plm.createKjBom.KjBean;
-import com.chint.plm.createKjBom.KjBomDialog;
-//import com.connor.chint.sap2.KCommand;
-import com.connor.chint.sap2.util.ChintPreferenceUtil;
-import com.connor.chint.sap2.util.SAPUtil;
import com.connor.chint.yunpi.KCommand;
import com.teamcenter.rac.aif.AbstractAIFApplication;
-import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
-import com.teamcenter.rac.kernel.TCComponentBOMLine;
-import com.teamcenter.rac.kernel.TCSession;
public class BomSapWhCommand extends KCommand {
diff --git a/com.connor.chint.wuhan/src/com/connor/chint/yunpi/command/BomSendSapController.java b/com.connor.chint.wuhan/src/com/connor/chint/yunpi/command/BomSendSapController.java
index 7d6690a..051e708 100644
--- a/com.connor.chint.wuhan/src/com/connor/chint/yunpi/command/BomSendSapController.java
+++ b/com.connor.chint.wuhan/src/com/connor/chint/yunpi/command/BomSendSapController.java
@@ -18,7 +18,6 @@ import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.dom4j.Document;
-import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
@@ -31,7 +30,6 @@ import com.connor.chint.sap2.util.BomUtilWh;
import com.connor.chint.sap2.util.KUtil;
import com.connor.chint.sap2.util.MyProgressBarCompent;
import com.connor.chint.sap2.util.SAPMessageUtil;
-import com.connor.chint.sap2.util.SAPUtil;
import com.connor.chint.sap2.util.SqlUtil;
import com.connor.chint.sap2.util.TXTUtil;
import com.squareup.okhttp.Credentials;
@@ -41,7 +39,6 @@ import com.squareup.okhttp.Request;
import com.squareup.okhttp.RequestBody;
import com.squareup.okhttp.Response;
import com.teamcenter.rac.aif.AbstractAIFApplication;
-import com.teamcenter.rac.aif.kernel.AIFComponentContext;
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
import com.teamcenter.rac.kernel.ListOfValuesInfo;
import com.teamcenter.rac.kernel.TCComponent;
@@ -49,10 +46,7 @@ import com.teamcenter.rac.kernel.TCComponentBOMLine;
import com.teamcenter.rac.kernel.TCComponentBOMWindow;
import com.teamcenter.rac.kernel.TCComponentBOMWindowType;
import com.teamcenter.rac.kernel.TCComponentDataset;
-import com.teamcenter.rac.kernel.TCComponentFolder;
-import com.teamcenter.rac.kernel.TCComponentItem;
import com.teamcenter.rac.kernel.TCComponentItemRevision;
-import com.teamcenter.rac.kernel.TCComponentItemType;
import com.teamcenter.rac.kernel.TCComponentListOfValues;
import com.teamcenter.rac.kernel.TCComponentMEProcessRevision;
import com.teamcenter.rac.kernel.TCComponentReleaseStatusType;
@@ -114,7 +108,8 @@ public class BomSendSapController {
private TCComponent released_Yellow;
private TCComponent released_Green;
- public void getSapState() throws TCException {
+ @SuppressWarnings("deprecation")
+ public void getSapState() throws TCException {
TCComponentListOfValues unitLov = KUtil.getLov(session, "zt2_SapState");
if (unitLov != null) {
ListOfValuesInfo listOfValues = unitLov.getListOfValues();
@@ -209,7 +204,7 @@ public class BomSendSapController {
"产成品", substring, project.getUid(), serverHostname, userId });
SqlUtil.freeAll();
// 存在多个产成品时 下面的PBOM是一样的,只需要记录一次日志新的
- boolean flag = true;
+// boolean flag = true;
String batchNum = code + "-00001";
String now = format.format(new Date());
@@ -281,7 +276,7 @@ public class BomSendSapController {
}
System.out.println("productNosBuild MSG====>" + productNosBuild);
if (interLogElem != null) {
- flag = false;
+// flag = false;
BomUtilWh.logXmlMsg(interLogElem, code, productNosBuild.toString(), batchNum, wbs, session);
}
if (comp != null) {
@@ -295,7 +290,7 @@ public class BomSendSapController {
MessageBox.post("BOM数据推送完成..", "提示", 2);
}
} catch (Exception e) {
- // TODO Auto-generated catch block
+ // Auto-generated catch block
e.printStackTrace();
} finally {
SqlUtil.freeAll();
@@ -380,7 +375,7 @@ public class BomSendSapController {
Request request = new Request.Builder().url(url).method("POST", body).header("Authorization", credential)
.addHeader("Content-Type", "application/xml").build();
Response response = client.newCall(request).execute();
- Document document = null;
+// Document document = null;
try {
String string = response.body().string();
@@ -408,7 +403,7 @@ public class BomSendSapController {
// }
// }
} catch (Exception e) {
- // TODO Auto-generated catch block
+ // Auto-generated catch block
e.printStackTrace();
}
@@ -466,7 +461,7 @@ public class BomSendSapController {
if (!url.contains("http")) {
return errBuffer;
}
- String string = sendJsonHttpPost(url, wsdlString, txtPath); // "http://10.128.11.12:7788/gateway/chint/bop-sync"
+ sendJsonHttpPost(url, wsdlString, txtPath); // "http://10.128.11.12:7788/gateway/chint/bop-sync"
return errBuffer;
diff --git a/com.connor.chint.wuhan/src/com/connor/chint/yunpi/command/BomSendSapWhFram.java b/com.connor.chint.wuhan/src/com/connor/chint/yunpi/command/BomSendSapWhFram.java
index c0ae38f..b1d287e 100644
--- a/com.connor.chint.wuhan/src/com/connor/chint/yunpi/command/BomSendSapWhFram.java
+++ b/com.connor.chint.wuhan/src/com/connor/chint/yunpi/command/BomSendSapWhFram.java
@@ -6,11 +6,8 @@ import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
-import java.util.List;
-
import javax.swing.BorderFactory;
import javax.swing.JButton;
-import javax.swing.JComboBox;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
@@ -20,23 +17,27 @@ import javax.swing.table.TableColumnModel;
//import com.connor.chint.sap2.sap_zy.SAPZYDialog;
import com.connor.chint.sap2.util.CheckBoxTableHeaderRenderer;
import com.connor.chint.sap2.util.KUtil;
-import com.connor.chint.sap2.util.MyProgressBarCompent;
import com.connor.chint.sap2.util.SAPUtil;
import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aif.AbstractAIFDialog;
-import com.teamcenter.rac.kernel.TCException;
+import com.teamcenter.rac.kernel.TCComponent;
+import com.teamcenter.rac.kernel.TCComponentItemRevision;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.util.MessageBox;
public class BomSendSapWhFram extends AbstractAIFDialog {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
private BomSendSapController controller;
- private AbstractAIFApplication app;
+// private AbstractAIFApplication app;
private TCSession session;
public BomSendSapWhFram(AbstractAIFApplication app) {
super(false);
this.controller = new BomSendSapController(this, app);
- this.app = app;
+// this.app = app;
this.session = (TCSession) app.getSession();
}
private JButton b_cel;
@@ -73,6 +74,34 @@ public class BomSendSapWhFram extends AbstractAIFDialog {
MessageBox.post(this, "没有找到产成品信息", "", MessageBox.INFORMATION);
return;
}
+ //判断选择的部件,存在未发布的需要提示出来,值传递发布的BOM,若当前选择的BOM未发布,则提示出来并且不处理
+// TCComponentBOMWindowType bomWinType = (TCComponentBOMWindowType) session.getTypeComponent("BOMWindow");
+// TCComponentBOMWindow win = bomWinType.create(null);
+ StringBuilder msg = new StringBuilder("");
+ for(PartBean bean : controller.partList) {
+ TCComponentItemRevision rev = bean.part;
+// win.setWindowTopLine(rev.getItem(), rev, null, null);
+// TCComponentBOMLine topLine = win.getTopBOMLine();
+// checkStatus(topLine, msg);
+ TCComponent bomRev = rev.getRelatedComponent("structure_revisions");
+ TCComponent[] release_status_list = rev.getReferenceListProperty("release_status_list");
+ if(bomRev == null) {
+ msg.append(",").append(rev);
+ }else if(release_status_list.length == 0) {
+ msg.append(",").append(rev);
+ }else {
+ release_status_list = bomRev.getReferenceListProperty("release_status_list");
+ if(release_status_list.length == 0) {
+ msg.append(",").append(rev);
+ }
+ }
+ }
+ if (msg.length() > 0) {
+ MessageBox.post(this, "以下产成品未发布或未找到BOM视图:\n" + msg.substring(1), "", MessageBox.INFORMATION);
+ return;
+ }
+// win.refresh();
+// win.close();
controller.getSapState();
} catch (Exception e) {
KUtil.setByPass(false);
@@ -95,6 +124,16 @@ public class BomSendSapWhFram extends AbstractAIFDialog {
}
showDialog();
}
+
+// private void checkStatus(TCComponentBOMLine parent, StringBuilder msg) throws Exception {
+//
+// for(AIFComponentContext c : parent.getChildren()) {
+// TCComponentBOMLine bom = (TCComponentBOMLine) c.getComponent();
+// TCComponentItemRevision rev = bom.getItemRevision();
+//
+// }
+// }
+
private void initUI() {
this.setTitle("产成品信息");
this.setPreferredSize(new Dimension(800, 400));
@@ -125,7 +164,8 @@ public class BomSendSapWhFram extends AbstractAIFDialog {
}
});
}
- private void setCompEnabled(boolean b) {
+
+ /*private void setCompEnabled(boolean b) {
b_cel.setEnabled(b);
t_part.setEnabled(b);
// o_btn.setEnabled(b);
@@ -133,7 +173,8 @@ public class BomSendSapWhFram extends AbstractAIFDialog {
// s_btn.setEnabled(b);
// kt_btn.setEnabled(b);
// pushBOM_btn.setEnabled(b);
- }
+ }*/
+
private JPanel getBtnPanel() {
JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT, 30, 5));
// o_btn = new JButton("一次方案传递");
@@ -154,11 +195,16 @@ public class BomSendSapWhFram extends AbstractAIFDialog {
return panel;
}
- private CheckBoxTableHeaderRenderer tableHeaderRenderer;
+// private CheckBoxTableHeaderRenderer tableHeaderRenderer;
private JPanel getTablePanel() {
JPanel panel = new JPanel(new BorderLayout());
tm_part = new DefaultTableModel();
t_part = new JTable(tm_part) {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
@Override
public boolean isCellEditable(int row, int column) { // 选择列(第三列)设置可编辑
if (column == 0)
@@ -185,7 +231,7 @@ public class BomSendSapWhFram extends AbstractAIFDialog {
colModel.getColumn(i).setPreferredWidth(HEADERWIDTH[i]);
}
this.t_part.getTableHeader()
- .setDefaultRenderer(this.tableHeaderRenderer = new CheckBoxTableHeaderRenderer(t_part, 0, false));
+ .setDefaultRenderer(new CheckBoxTableHeaderRenderer(t_part, 0, false));
this.t_part.getTableHeader().setBackground(Color.blue);
JScrollPane scroll = new JScrollPane(t_part);
panel.add(BorderLayout.CENTER, scroll);
diff --git a/com.connor.chint.wuhan/src/com/connor/chint/yunpi/command/DbomToECommand.java b/com.connor.chint.wuhan/src/com/connor/chint/yunpi/command/DbomToECommand.java
index 837826c..7aff065 100644
--- a/com.connor.chint.wuhan/src/com/connor/chint/yunpi/command/DbomToECommand.java
+++ b/com.connor.chint.wuhan/src/com/connor/chint/yunpi/command/DbomToECommand.java
@@ -1,9 +1,6 @@
package com.connor.chint.yunpi.command;
-import javax.swing.JOptionPane;
-
import com.connor.chint.sap2.util.ChintPreferenceUtil;
-import com.connor.chint.sap2.util.KUtil;
import com.connor.chint.sap2.util.MyProgressBarCompent;
import com.connor.chint.sap2.util.SAPMessageUtilFram;
import com.connor.chint.sap2.util.SAPUtil;
@@ -79,6 +76,7 @@ public class DbomToECommand extends KCommand {
}
}
// SAPUtil.
+ /* 20240314 DBOM转EBOM弹框移除,按照最新的逻辑直接进行数据转换就行
if(KUtil.isTCM(rev)) {
Object[] options = {"否","是"};
int response = JOptionPane.showOptionDialog(null, "图纸已经发布,是否要继续更新EBOM.", "选择",JOptionPane.YES_OPTION,
@@ -87,7 +85,7 @@ public class DbomToECommand extends KCommand {
{
return;
}
- }
+ }*/
new Thread() {
@Override
public void run() {
diff --git a/com.connor.chint.wuhan/src/com/connor/chint/yunpi/command/EbomToPCommand.java b/com.connor.chint.wuhan/src/com/connor/chint/yunpi/command/EbomToPCommand.java
index 7fd274a..d03a30e 100644
--- a/com.connor.chint.wuhan/src/com/connor/chint/yunpi/command/EbomToPCommand.java
+++ b/com.connor.chint.wuhan/src/com/connor/chint/yunpi/command/EbomToPCommand.java
@@ -1,7 +1,6 @@
package com.connor.chint.yunpi.command;
import com.connor.chint.sap2.util.MyProgressBarCompent;
-import com.connor.chint.sap2.util.SAPMessageUtil;
import com.connor.chint.sap2.util.SAPMessageUtilFram;
import com.connor.chint.sap2.util.SAPUtil;
import com.connor.chint.yunpi.KCommand;
@@ -10,14 +9,14 @@ import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentBOMLine;
import com.teamcenter.rac.kernel.TCComponentItemRevision;
-import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.kernel.TCUserService;
import com.teamcenter.rac.util.MessageBox;
+@SuppressWarnings("deprecation")
public class EbomToPCommand extends KCommand {
- private boolean top = true;
+// private boolean top = true;
private TCComponentItemRevision rev;
public EbomToPCommand(AbstractAIFApplication app, String commandId, String actionInfo) {
super(app, commandId, actionInfo);
@@ -62,8 +61,11 @@ public class EbomToPCommand extends KCommand {
}
}
if(!flag) {
- MessageBox.post("请检查物料版本下的BOMView状态是否已发布,只能转换已发布的EBOM.", "", MessageBox.ERROR);
- return;
+ TCComponent[] flows = bomRevs.getReferenceListProperty("fnd0AllWorkflows");
+ if(flows == null || flows.length == 0) {
+ MessageBox.post("请检查物料版本下的BOMView状态是否已发布,只能转换已发布的EBOM.", "", MessageBox.ERROR);
+ return;
+ }
}
TCUserService userService = (TCUserService) session.getUserService();
@@ -76,8 +78,8 @@ public class EbomToPCommand extends KCommand {
}else {
MessageBox.post("EBOM转PBOM完成","提示",2);
}
- } catch (TCException e) {
- // TODO Auto-generated catch block
+ } catch (Exception e) {
+ // Auto-generated catch block
e.printStackTrace();
}
if(comp!=null) {