diff --git a/.classpath b/.classpath
index fea78a7..61b731c 100644
--- a/.classpath
+++ b/.classpath
@@ -1,5 +1,7 @@
+
+
@@ -93,6 +95,5 @@
-
diff --git a/META-INF/MANIFEST.MF b/META-INF/MANIFEST.MF
index fb407a1..db7fe12 100644
--- a/META-INF/MANIFEST.MF
+++ b/META-INF/MANIFEST.MF
@@ -26,12 +26,10 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.15.100",
org.eclipse.ui.navigator;bundle-version="3.7.300",
com.teamcenter.rac.ui.views;bundle-version="12000.2.0",
com.teamcenter.rac.cm;bundle-version="12000.2.0",
- com.teamcenter.rac.workflow;bundle-version="12000.2.0",
- com.teamcenter.rac.workflow.processdesigner;bundle-version="12000.2.0",
- com.teamcenter.rac.workflow.processviewer;bundle-version="12000.2.0",
- org.eclipse.osgi.services;bundle-version="3.7.100",
- org.eclipse.osgi.util;bundle-version="3.5.100"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+ TcSoaCadRac,
+ TcSoaStructureManagementLoose;bundle-version="12000.2.0",
+ TcSoaStructureManagementRac;bundle-version="12000.2.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: lib/activation-1.1.jar,
lib/antlr-2.7.7.jar,
@@ -117,10 +115,8 @@ Bundle-ClassPath: lib/activation-1.1.jar,
.,
lib/cn.com.origin.autocodemanager_1.0.0.jar,
lib/jxl.jar,
- lib/org.eclipse.osgi.services_3.7.100.v20180827-1536.jar,
- lib/Spire.Xls.jar,
- lib/cn.com.origin.autocode_1.0.0.jar,
- lib/org.eclipse.osgi.services.nl_12000.2.0.jar
+ lib/commons-net-3.6.jar,
+ lib/cn.com.origin.autocode_1.0.0.jar
Export-Package: .,
antlr,
antlr.ASdebug,
@@ -209,10 +205,6 @@ Export-Package: .,
com.connor.dfl.plm.dfl033,
com.connor.dfl.plm.dfl034,
com.connor.dfl.plm.dfl035,
- com.connor.dfl.plm.dfl036,
- com.connor.dfl.plm.dfl037,
- com.connor.dfl.plm.dfl038,
- com.connor.dfl.plm.dfl039,
com.connor.dfl.plm.exportBOM,
com.connor.dfl.plm.forms,
com.connor.dfl.plm.table,
@@ -297,110 +289,6 @@ Export-Package: .,
com.lowagie.text.xml.simpleparser,
com.lowagie.text.xml.xmp,
com.lowagie.tools,
- com.spire.data.table,
- com.spire.data.table.common,
- com.spire.license,
- com.spire.ms.System,
- com.spire.ms.System.Collections,
- com.spire.ms.System.Collections.Generic,
- com.spire.ms.System.Collections.ObjectModel,
- com.spire.ms.System.Collections.Specialized,
- com.spire.ms.System.Diagnostics,
- com.spire.ms.System.Reflection,
- com.spire.ms.System.Security.Cryptography,
- com.spire.ms.System.Security.Cryptography.X509Certificates,
- com.spire.ms.System.Xml,
- com.spire.ms.charsets,
- com.spire.ms.charsets.euc_kr,
- com.spire.ms.charsets.iso_8859_1,
- com.spire.ms.charsets.iso_8859_8,
- com.spire.ms.charsets.ms_936,
- com.spire.ms.charsets.utf_7,
- com.spire.ms.core.System.Security.Cryptography.X509Certificates,
- com.spire.ms.imagecodecs.bmp.spi,
- com.spire.ms.imagecodecs.gif.spi,
- com.spire.ms.imagecodecs.ico.spi,
- com.spire.ms.imagecodecs.jpeg.spi,
- com.spire.ms.imagecodecs.png.spi,
- com.spire.ms.imagecodecs.tiff.spi,
- com.spire.ms.lang,
- com.spire.pdf,
- com.spire.pdf.actions,
- com.spire.pdf.annotations,
- com.spire.pdf.annotations.appearance,
- com.spire.pdf.attachments,
- com.spire.pdf.automaticfields,
- com.spire.pdf.barcode,
- com.spire.pdf.bookmarks,
- com.spire.pdf.collections,
- com.spire.pdf.colorspace,
- com.spire.pdf.exporting,
- com.spire.pdf.exporting.text,
- com.spire.pdf.exporting.xps.schema,
- com.spire.pdf.fields,
- com.spire.pdf.general,
- com.spire.pdf.general.find,
- com.spire.pdf.general.paper.drawing.ps,
- com.spire.pdf.general.paper.font.common,
- com.spire.pdf.general.paper.font.postscript.path,
- com.spire.pdf.general.paper.font.rendering.hinting,
- com.spire.pdf.general.paper.font.ttf.internals,
- com.spire.pdf.general.paper.font.type1.internals,
- com.spire.pdf.general.paper.font.type1.internals.parsing.objects,
- com.spire.pdf.graphics,
- com.spire.pdf.graphics.fonts,
- com.spire.pdf.graphics.layer,
- com.spire.pdf.grid,
- com.spire.pdf.htmlconverter,
- com.spire.pdf.htmlconverter.qt,
- com.spire.pdf.interfacess,
- com.spire.pdf.lists,
- com.spire.pdf.security,
- com.spire.pdf.tables,
- com.spire.pdf.tables.table,
- com.spire.pdf.tables.table.common,
- com.spire.pdf.widget,
- com.spire.pdf.xmp,
- com.spire.xls,
- com.spire.xls.charts,
- com.spire.xls.collections,
- com.spire.xls.core,
- com.spire.xls.core.converter,
- com.spire.xls.core.converter.exporting,
- com.spire.xls.core.converter.rendering.chart.charts.common,
- com.spire.xls.core.converter.rendering.chart.charts.xlscharts.general,
- com.spire.xls.core.converter.rendering.chart.charts.xlsxcharts.general,
- com.spire.xls.core.converter.rendering.chart.shapes.xlsshaps.general,
- com.spire.xls.core.converter.rendering.chart.shapes.xlsshaps.general.gradient,
- com.spire.xls.core.converter.rendering.chart.shapes.xlsxshaps.general,
- com.spire.xls.core.converter.rendering.chart.shapes.xlsxshaps.general.gradient,
- com.spire.xls.core.converter.spreadsheet,
- com.spire.xls.core.converter.spreadsheet.autofilter,
- com.spire.xls.core.converter.spreadsheet.charts,
- com.spire.xls.core.converter.spreadsheet.conditionalformatting,
- com.spire.xls.core.converter.spreadsheet.conditionalformatting.xlsx,
- com.spire.xls.core.converter.spreadsheet.excelstyle,
- com.spire.xls.core.converter.spreadsheet.extensions,
- com.spire.xls.core.converter.spreadsheet.formulaop,
- com.spire.xls.core.converter.spreadsheet.pagesetup,
- com.spire.xls.core.converter.spreadsheet.pivottable,
- com.spire.xls.core.converter.spreadsheet.query,
- com.spire.xls.core.converter.spreadsheet.shapes,
- com.spire.xls.core.converter.spreadsheet.shapes.msodrawing,
- com.spire.xls.core.converter.spreadsheet.sparkline,
- com.spire.xls.core.converter.spreadsheet.xmlmapping,
- com.spire.xls.core.converter.tables,
- com.spire.xls.core.interfaces,
- com.spire.xls.core.interfacess,
- com.spire.xls.core.spreadsheet,
- com.spire.xls.core.spreadsheet.autofilter,
- com.spire.xls.core.spreadsheet.charts,
- com.spire.xls.core.spreadsheet.collections,
- com.spire.xls.core.spreadsheet.conditionalformatting,
- com.spire.xls.core.spreadsheet.pivottables,
- com.spire.xls.core.spreadsheet.shapes,
- com.spire.xls.core.spreadsheet.sorting,
- com.spire.xls.packages,
com.sun.activation.registries,
com.sun.activation.viewers,
com.sun.codemodel,
@@ -1202,7 +1090,6 @@ Export-Package: .,
org.osgi.service.component.runtime,
org.osgi.service.component.runtime.dto,
org.osgi.service.device,
- org.osgi.service.event,
org.osgi.service.http,
org.osgi.service.http.context,
org.osgi.service.http.runtime,
diff --git a/build.properties b/build.properties
index bfe5663..a89cd16 100644
--- a/build.properties
+++ b/build.properties
@@ -89,5 +89,6 @@ bin.includes = plugin.xml,\
lib/org.eclipse.osgi.services_3.7.100.v20180827-1536.jar,\
lib/Spire.Xls.jar,\
lib/org.eclipse.osgi.services.nl_12000.2.0.jar,\
- lib/cn.com.origin.autocode_1.0.0.jar,\
- lib/cn.com.origin.autocodemanager_1.0.0.jar
+ lib/cn.com.origin.autocodemanager_1.0.0.jar,\
+ lib/commons-net-3.6.jar,\
+ lib/cn.com.origin.autocode_1.0.0.jar
diff --git a/lib/cn.com.origin.autocode_1.0.0.jar b/lib/cn.com.origin.autocode_1.0.0.jar
index 8d92202..f9fc3aa 100644
Binary files a/lib/cn.com.origin.autocode_1.0.0.jar and b/lib/cn.com.origin.autocode_1.0.0.jar differ
diff --git a/lib/cn.com.origin.autocodemanager_1.0.0.jar b/lib/cn.com.origin.autocodemanager_1.0.0.jar
index 393697f..39c29d4 100644
Binary files a/lib/cn.com.origin.autocodemanager_1.0.0.jar and b/lib/cn.com.origin.autocodemanager_1.0.0.jar differ
diff --git a/plugin.xml b/plugin.xml
index 5dbd8c6..db5c4b5 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -11,8 +11,7 @@
-->
-
-
+
@@ -35,7 +34,12 @@
+
+
+
+
+
@@ -194,9 +198,25 @@
-
-
-
+
+
+
+
+
+
+
@@ -206,7 +226,13 @@
-
+
+
+
+
+
@@ -229,12 +255,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -293,8 +340,8 @@
-
-
+
+
@@ -354,7 +401,9 @@
-
+
+
+
@@ -425,7 +474,25 @@
-
+
+
+
+
+
+
+
@@ -434,6 +501,13 @@
+
+
+
+
+
@@ -447,17 +521,39 @@
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
@@ -485,7 +581,47 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -499,7 +635,103 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -513,6 +745,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -526,7 +797,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -574,7 +899,7 @@
-
+
@@ -591,6 +916,7 @@
+
@@ -604,6 +930,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -698,8 +1053,85 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -713,7 +1145,21 @@
-
+
@@ -799,7 +1245,34 @@
-
+
@@ -878,6 +1351,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -2421,6 +2914,47 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -2506,6 +3040,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/com/connor/dfl/plm/dfl003/Dfl003AIFDialog.java b/src/com/connor/dfl/plm/dfl003/Dfl003AIFDialog.java
index 2ed607d..f810f76 100644
--- a/src/com/connor/dfl/plm/dfl003/Dfl003AIFDialog.java
+++ b/src/com/connor/dfl/plm/dfl003/Dfl003AIFDialog.java
@@ -4,6 +4,11 @@ import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -24,9 +29,12 @@ import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.TreeNode;
+import org.apache.commons.collections.set.MapBackedSet;
+
+//import org.jacorb.idl.runtime.int_token;
+
import com.connor.dfl.plm.util.CodeBean;
import com.connor.dfl.plm.util.CopyPropsBean;
-import com.connor.dfl.plm.util.DataBaseControl;
import com.connor.dfl.plm.util.GetCodeBean;
import com.connor.dfl.plm.util.MenuBean;
import com.teamcenter.rac.aif.AbstractAIFDialog;
@@ -91,11 +99,12 @@ public class Dfl003AIFDialog extends AbstractAIFDialog {
private Map ImportanceMap=new HashMap();
-
+ private JTextField jText;
private JComboBox groupCode_combobox;
private JComboBox sourceCode_combobox;
private JComboBox Importantce_combobox;
-
+ private List nameList =new ArrayList();
+ private Map idMap = new HashMap();
public Dfl003AIFDialog(TCSession session, InterfaceAIFComponent targetComp,
@@ -185,7 +194,7 @@ public class Dfl003AIFDialog extends AbstractAIFDialog {
// TODO Auto-generated method stub
this.setTitle("" + name);
this.setAlwaysOnTop(true);
- this.setPreferredSize(new Dimension(550, 630));
+ this.setPreferredSize(new Dimension(650, 630));
this.setLayout(new PropertyLayout());
jp1 = new JPanel(new BorderLayout());
jp2 = new JPanel(new PropertyLayout());
@@ -229,9 +238,9 @@ public class Dfl003AIFDialog extends AbstractAIFDialog {
JLabel sourceCode_lable = new JLabel("Դ:");
JLabel Important_lable = new JLabel("ؼ:");
- groupCode_combobox = new JComboBox();groupCode_combobox.addItem(name);
- sourceCode_combobox = new JComboBox();sourceCode_combobox.addItem("Ƽ");
- Importantce_combobox = new JComboBox();Importantce_combobox.addItem("A");
+ groupCode_combobox = new JComboBox();//groupCode_combobox.addItem(name);
+ sourceCode_combobox = new JComboBox();//sourceCode_combobox.addItem("Ƽ");
+ Importantce_combobox = new JComboBox();//Importantce_combobox.addItem("A");
jtext1 = new JTextField();
jtext2 = new JTextField();
@@ -244,7 +253,8 @@ public class Dfl003AIFDialog extends AbstractAIFDialog {
jtext8.setWrapStyleWord(true);
jtext8.setBorder(new LineBorder(new java.awt.Color(127,157,185), 1, false));
jtext10 = new JTextField();
- jcomproject.addItem(" ");
+ jcomproject.addItem("");
+// idList.add(" ");
TCComponentUser user = session.getUser();
try {
String user_id = user.getStringProperty("user_id");
@@ -258,8 +268,12 @@ public class Dfl003AIFDialog extends AbstractAIFDialog {
if(comp instanceof TCComponentProject) {
TCComponentProject project = (TCComponentProject) comp;
try {
- String id = project.getStringProperty("project_id");
- jcomproject.addItem(id);
+ String id = project.getStringProperty("project_id");
+ String name = project.getStringProperty("object_name");
+// idList.add(id);idMap
+ idMap.put(name, id);
+ nameList.add(name);
+ jcomproject.addItem(name);
} catch (TCException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
@@ -271,6 +285,72 @@ public class Dfl003AIFDialog extends AbstractAIFDialog {
// TODO Auto-generated catch block
e2.printStackTrace();
}
+
+
+ jcomproject.setEditable(true);
+ jText = (JTextField) jcomproject.getEditor().getEditorComponent();
+ jText.addKeyListener(new KeyListener() {
+
+ @Override
+ public void keyTyped(KeyEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void keyReleased(KeyEvent e) {
+ // TODO Auto-generated method stub
+ addSelect(e,jcomproject,jText,nameList);
+ }
+
+ @Override
+ public void keyPressed(KeyEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+ });
+ jText.addFocusListener(new FocusListener() {
+
+ @Override
+ public void focusLost(FocusEvent e) {
+ // TODO Auto-generated method stub
+
+ String text = jText.getText();
+ System.out.println("text===>"+text);
+ if(text !=null && !text.equals("") && !idMap.containsKey(text)) {
+ MessageBox.post(Dfl003AIFDialog.this,"ĿϢЧѡ!","ʾ",2);
+ }
+
+ }
+
+ @Override
+ public void focusGained(FocusEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+ });
+// jcomproject.addFocusListener(new FocusListener() {
+//
+// @Override
+// public void focusLost(FocusEvent e) {
+// // TODO Auto-generated method stub
+//
+// String text = jText.getText();
+// if(text !=null && !text.equals("") && !idMap.containsKey(text)) {
+// MessageBox.post("Ŀ","ʾ",2);
+// }
+//
+// }
+//
+// @Override
+// public void focusGained(FocusEvent e) {
+// // TODO Auto-generated method stub
+//
+// }
+// });
+
+
+
jtext1.setEnabled(false);
jtext2.setEnabled(true);
jcomname.setEnabled(false);
@@ -289,7 +369,7 @@ public class Dfl003AIFDialog extends AbstractAIFDialog {
jl8.setBounds(20, 260, 40, 30);
jtext8.setBounds(60, 260, 200, 100);
jl9.setBounds(20, 370, 40, 30);
- jcomproject.setBounds(60, 370, 120, 30);
+ jcomproject.setBounds(60, 370, 300, 30);
jl10.setBounds(20, 410, 40, 30);
jtext10.setBounds(60, 410, 120, 30);
@@ -396,14 +476,9 @@ public class Dfl003AIFDialog extends AbstractAIFDialog {
String disval = value.getDisplayableValue(sourcevalues[i]);
sourceCode_combobox.addItem(disval);
sourceMap.put(disval, sourcevalues[i]);
-
-
}
-
}
-
-
//
@@ -454,7 +529,15 @@ public class Dfl003AIFDialog extends AbstractAIFDialog {
if ( !(" ".equals(itemName)) && !( " ".equals(groupCode)) && !(" ".equals(souceCode))) {
- createItem();
+
+ String text = jText.getText();
+ System.out.println("text===>"+text);
+ if(text !=null && !text.equals("") && !idMap.containsKey(text)) {
+ MessageBox.post(Dfl003AIFDialog.this,"ĿϢЧѡ!","ʾ",2);
+ }else {
+ createItem();
+ }
+
} else {
MessageBox.post("ơԴ롢Ⱥ벻Ϊ!", "ʾ", MessageBox.INFORMATION);
}
@@ -492,18 +575,35 @@ public class Dfl003AIFDialog extends AbstractAIFDialog {
TCComponentItemType tctype = (TCComponentItemType) session
.getTypeComponent(type);
try {
- String newID = data.getNewCode("PLMCODE", selCodeBean);
+ String newID = data.getNewCode("PLMCODE", selCodeBean,session);
System.out.println("newID1==============="+newID);
+
+// if(true) {
+// return;
+// }
+
TCComponentItem find = tctype.find(newID);
- if (find != null) {
- newID = data.getMaxCode("PLMCODE", selCodeBean);
- System.out.println("newID2==============="+newID);
+// if (find != null) {
+// newID = data.getMaxCode("PLMCODE", selCodeBean);
+// System.out.println("newID2==============="+newID);
+// find = tctype.find(newID);
+// }
+// do{
+// newID = data.getNewCode("PLMCODE", selCodeBean);
+// find = tctype.find(newID);
+// }while(find != null);
+// if (find != null) {
+// MessageBox.post("ǰˮID:" + newID + "Ѵڶ,!", "",
+// MessageBox.ERROR);
+// return;
+// }
+
+ while (find!=null) {
+ newID = data.getNewCode("PLMCODE", selCodeBean,session);
find = tctype.find(newID);
}
- if (find != null) {
- MessageBox.post("ǰˮID:" + newID + "Ѵڶ,!", "",
- MessageBox.ERROR);
- } else {
+
+// else {
this.setVisible(false);
String itemName="";
if (islov) {
@@ -616,10 +716,11 @@ public class Dfl003AIFDialog extends AbstractAIFDialog {
MessageBox.INFORMATION);
}
}
- String proID = (String) jcomproject.getSelectedItem();
- if(proID != null & proID !=" ") {
+ String proName = (String) jcomproject.getSelectedItem();
+ if(proName != null & proName !=" ") {
+// int selectedIndex = jcomproject.getSelectedIndex();
String[] keys = new String[]{"Ŀ ID"};
- String[] values = new String[]{proID};
+ String[] values = new String[]{idMap.get(proName)};
List compList = queryObject("ĿIDĿ", keys, values);
if(compList != null && compList.size() > 0) {
TCComponent comp = compList.get(0);
@@ -714,7 +815,7 @@ public class Dfl003AIFDialog extends AbstractAIFDialog {
- }
+// }
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -831,6 +932,37 @@ public class Dfl003AIFDialog extends AbstractAIFDialog {
}
}
}
+
+ protected void addSelect(KeyEvent e, JComboBox combox, JTextField jtext, List cpxList) {
+ // TODO Auto-generated method stub
+ Object obj = e.getSource();
+ int keyCode = e.getKeyCode();
+ if (obj == jtext) {
+
+ if(keyCode==10) {
+ String key = jtext.getText();
+ combox.removeAllItems();
+ if(!key.equals("")) {
+ combox.addItem("");
+ for(String name:cpxList) {
+ if(name.contains(key)) {
+ combox.addItem(name);
+ }
+ }
+ }else {
+ combox.addItem("");
+ for(String name:cpxList) {
+// if(name.contains(key)) {
+ combox.addItem(name);
+// }
+ }
+ }
+ combox.showPopup();
+ jtext.setText("");
+ jtext.setText(key);
+ }
+ }
+ }
/**
* ͨѯѯĿ
diff --git a/src/com/connor/dfl/plm/dfl003/Dfl003Action.java b/src/com/connor/dfl/plm/dfl003/Dfl003Action.java
index 776cf1e..afa86ff 100644
--- a/src/com/connor/dfl/plm/dfl003/Dfl003Action.java
+++ b/src/com/connor/dfl/plm/dfl003/Dfl003Action.java
@@ -17,6 +17,11 @@ public class Dfl003Action extends AbstractAIFAction {
this.app = arg0;
this.tar = app.getTargetComponent();
this.session = (TCSession) app.getSession();
+// String ssoLoginURL = session.getSSOLoginURL();
+// System.out.println("ssoLoginURL==>"+ssoLoginURL);
+// String ip = session.getLoginInfo().getPreviousSessionLoginIP();
+// System.out.println("ip==>"+ip);
+// System.out.println("Url==>"+session.getUrl());
this.name = name;
}
diff --git a/src/com/connor/dfl/plm/dfl013/QuickChangeDialog.java b/src/com/connor/dfl/plm/dfl013/QuickChangeDialog.java
index f7d9f15..5d3f7ca 100644
--- a/src/com/connor/dfl/plm/dfl013/QuickChangeDialog.java
+++ b/src/com/connor/dfl/plm/dfl013/QuickChangeDialog.java
@@ -270,9 +270,9 @@ public class QuickChangeDialog extends AbstractAIFDialog {
String dutyMan = comp.getStringProperty("t2_duty");
String salseType = comp.getStringProperty("t2_type");
String projectState = comp.getStringProperty("t2_ProjectPhase");
-
-
-
+ String item_id = comp.getStringProperty("item_id");
+ System.out.println("1.4dutyDepartment====="+dutyDepartment);
+ System.out.println("1.4item_id====="+item_id);
String targetType = comp.getType();
if( "T2_problemRevision".equals(targetType) ) {
@@ -393,7 +393,6 @@ public class QuickChangeDialog extends AbstractAIFDialog {
// }
project.assignToProject(new TCComponent[] {item});
-
}
}
diff --git a/src/com/connor/dfl/plm/dfl019/Dfl019Handler.java b/src/com/connor/dfl/plm/dfl019/Dfl019Handler.java
index cc4e59b..0438e78 100644
--- a/src/com/connor/dfl/plm/dfl019/Dfl019Handler.java
+++ b/src/com/connor/dfl/plm/dfl019/Dfl019Handler.java
@@ -3,10 +3,12 @@ package com.connor.dfl.plm.dfl019;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.common.NotDefinedException;
import com.teamcenter.rac.aif.AbstractAIFApplication;
-import com.teamcenter.rac.aif.AbstractAIFUIApplication;
+import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
import com.teamcenter.rac.aifrcp.AIFUtility;
+import com.teamcenter.rac.kernel.TCComponentGroup;
import com.teamcenter.rac.kernel.TCSession;
@@ -17,8 +19,39 @@ public class Dfl019Handler extends AbstractHandler {
public Object execute(ExecutionEvent arg0) throws ExecutionException {
this.app = AIFUtility.getCurrentApplication();
this.session = (TCSession) app.getSession();
- Dfl019Operation operation = new Dfl019Operation(app, session);
- session.queueOperation(operation);
+ try {
+ InterfaceAIFComponent targetComponent = app.getTargetComponent();
+ if(targetComponent.getType().equals("T2_OutBuyPartRevision")) {
+ Dfl019Operation operation = new Dfl019Operation(app, session);
+ }else {
+ SelectDialog dialog = new SelectDialog(app);
+ new Thread(dialog).start();
+ }
+// TCComponentGroup group = session.getCurrentGroup();
+// String group_name = group.getStringProperty("display_name");
+// if(group_name.contains("װ")|| group_name.contains("JCBZ")) {
+
+// }else{
+// Dfl019Operation2 operation = new Dfl019Operation2(app, session);
+// //session.queueOperation(operation);
+// }
+// String name = arg0.getCommand().getName();
+// if("ϴERP-ƴӰ汾".equals(name)) {
+// Dfl019Operation2 operation = new Dfl019Operation2(app, session);
+// session.queueOperation(operation);
+// }else if("ϴERP-ƴӰ汾-".equals(name)){
+// Dfl019Operation3 operation = new Dfl019Operation3(app, session);
+// session.queueOperation(operation);
+// }else {
+// Dfl019Operation operation = new Dfl019Operation(app, session);
+// session.queueOperation(operation);
+// }
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+// session.queueOperation(operation);
// WuLiaoERP wl = new WuLiaoERP(app);
// new Thread(wl).start();
return null;
diff --git a/src/com/connor/dfl/plm/dfl019/Dfl019Operation.java b/src/com/connor/dfl/plm/dfl019/Dfl019Operation.java
index 63be2da..4c6a746 100644
--- a/src/com/connor/dfl/plm/dfl019/Dfl019Operation.java
+++ b/src/com/connor/dfl/plm/dfl019/Dfl019Operation.java
@@ -1,5 +1,12 @@
package com.connor.dfl.plm.dfl019;
+import java.awt.BorderLayout;
+import java.awt.Container;
+import java.awt.Font;
+import java.awt.GraphicsEnvironment;
+import java.awt.Rectangle;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
@@ -19,6 +26,13 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+
import com.connor.dfl.plm.util.AutoSign;
import com.connor.dfl.plm.util.ClassValueBean;
import com.connor.dfl.plm.util.ClassValueUtil;
@@ -30,6 +44,7 @@ import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
import com.teamcenter.rac.kernel.TCClassificationService;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentBOMLine;
+import com.teamcenter.rac.kernel.TCComponentGroup;
import com.teamcenter.rac.kernel.TCComponentICO;
import com.teamcenter.rac.kernel.TCComponentItemRevision;
import com.teamcenter.rac.kernel.TCComponentListOfValues;
@@ -43,6 +58,7 @@ import com.teamcenter.rac.kernel.ics.ICSAdminClass;
import com.teamcenter.rac.kernel.ics.ICSAdminClassAttribute;
import com.teamcenter.rac.kernel.ics.ICSProperty;
import com.teamcenter.rac.util.MessageBox;
+import com.teamcenter.soaictstubs.booleanSeq_tHolder;
import oracle.sql.BLOB;
@@ -67,7 +83,13 @@ public class Dfl019Operation extends AbstractAIFOperation{
private String zhangtao;
private AutoSign as = null;
private ProgressBarThread wait;
-
+
+ private JLabel exportTypeLabel;
+ private JComboBox exportTypeBox;
+ private DefaultComboBoxModel exportTypeModel;
+ private Map account_set;
+ private JFrame frame=null;
+ private boolean flag = false;
public Dfl019Operation(AbstractAIFApplication app, TCSession session ,String accountSet,String zhangtao) {
this.app = app;
this.session = session;
@@ -80,7 +102,7 @@ public class Dfl019Operation extends AbstractAIFOperation{
this.session = session;
this.as=new AutoSign();
String[] stringArrays = session.getPreferenceService().getStringValues("DFL_zhangtao");
- Map account_set = new HashMap();
+ account_set = new HashMap();
if (stringArrays == null || stringArrays.length <= 0 ) {
MessageBox.post("ѡDFL_zhangtaoδ,ϵԱ!!",
"", MessageBox.ERROR);
@@ -94,11 +116,102 @@ public class Dfl019Operation extends AbstractAIFOperation{
account_set.put(s1, s0);
}
}
-
- this.zhangtao = "DFL";
- this.accountSet = account_set.get(zhangtao);
+
+ String[] BOMZT = session.getPreferenceService().getStringValues("DFL_ERPBom_zhangtao");
+ if (BOMZT == null || BOMZT.length <= 0 ) {
+ MessageBox.post("ѡDFL_ERPBom_zhangtaoδ,ϵԱ!!",
+ "", MessageBox.ERROR);
+ return;
+ }
+ String temp = null;
+ try {
+ TCComponentGroup group = session.getCurrentGroup();
+ String group_name = group.getStringProperty("display_name");
+ System.out.println("group_name=============="+group_name);
+ if(group_name.contains(".")) {
+ String[] names = group_name.split("\\.");
+ if(names != null && names.length >=2) {
+ for (int i = 0; i < BOMZT.length; i++) {
+ if(BOMZT[i].contains("=")) {
+ String[] zts = BOMZT[i].split("=");
+ System.out.println("names[names.length-2]=============="+names[names.length-2]);
+ System.out.println("zts[0]=============="+zts[0]);
+ if(names[names.length-2].equals(zts[0])) {
+ if(names[names.length-2].contains("ҽð")) {
+ frame = new JFrame();
+ frame.setTitle("ѡݵ");
+ frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+ GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+ Rectangle rect = ge.getMaximumWindowBounds();
+ int sw = rect.width;
+ int sh = rect.height;
+ frame.setBounds((sw - 350) / 2, (sh - 300) / 2, 350, 300); // λüС
+ JPanel myJPanel = new JPanel();
+ myJPanel.setLayout(null);
+ JButton okbutton;
+ exportTypeLabel = new JLabel("");
+ exportTypeLabel.setFont(new Font("ź", Font.BOLD, 20));
+ exportTypeLabel.setSize(100, 30);
+ exportTypeModel = new DefaultComboBoxModel();
+ exportTypeBox = new JComboBox(exportTypeModel);
+ exportTypeBox.setBounds(200, 190, 170, 30);
+ exportTypeBox.setFont(new Font("ź", Font.BOLD, 20));
+ exportTypeModel.addElement("Ϻ");
+ exportTypeModel.addElement("Ϻϰ");
+ exportTypeLabel.setBounds(30, 50, 100, 30);
+ exportTypeBox.setBounds(150, 50, 150, 30);
+
+ okbutton = new JButton("ȷ");
+ okbutton.setFont(new Font("ź", Font.BOLD, 20));
+ okbutton.setBounds(100, 180, 120, 30);
+
+ okbutton.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ // TODO Auto-generated method stub
+ final String element = exportTypeModel.getElementAt(exportTypeBox.getSelectedIndex());
+ System.out.println(element);
+ if ("Ϻ".equals(element)) {
+ zhangtao = "DYC";
+ accountSet = account_set.get(zhangtao);
+ }else {
+ zhangtao = "HNC";
+ accountSet = account_set.get(zhangtao);
+ }
+ frame.setVisible(false);
+ startWork();
+ return;
+ }
+ });
+
+ myJPanel.add(exportTypeLabel);
+ myJPanel.add(exportTypeBox);
+ myJPanel.add(okbutton);
+ Container contentPane = frame.getContentPane();
+ contentPane.add(myJPanel, BorderLayout.CENTER);
+ frame.setVisible(true);
+ break;
+ }
+ this.zhangtao = "DFL";
+ this.accountSet = account_set.get(zhangtao);
+ startWork();
+
+ }
+ }
+ }
+ }
+ }
+ } catch (TCException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }finally {
+ }
}
+ private void startWork() {
+ // TODO Auto-generated method stub
+ session.queueOperation(this);
+ }
@Override
public void executeOperation() throws Exception {
InterfaceAIFComponent[] comp = app.getTargetComponents();
@@ -135,16 +248,16 @@ public class Dfl019Operation extends AbstractAIFOperation{
if(targets.length>0) {
// MessageBox.post("ѡеİ汾û","ʾ",MessageBox.INFORMATION);
// return;
- for(int i = 0;i beanList, TCComponent comp, List errList) throws TCException {
// TODO Auto-generated method stub
boolean flag2 = false;
@@ -324,6 +438,7 @@ public class Dfl019Operation extends AbstractAIFOperation{
TCComponentBOMLine get_bom_line = (TCComponentBOMLine) comp;
rev = get_bom_line.getItemRevision();
}
+ rev.refresh();
String statu = rev.getStringProperty("t2_ERPStatus");
// if("Ѵ".equals(statu)) {
// return flag2;
@@ -331,28 +446,33 @@ public class Dfl019Operation extends AbstractAIFOperation{
try {
String type = rev.getStringProperty("object_type");
id = rev.getStringProperty("item_id");
- if(id.contains("-Y")) {
- id = id.replace("-Y", "");
+ String idlast =id.substring(id.length()-2, id.length());
+ System.out.println("4.2:"+id);
+ System.out.println("idĺλ"+idlast);
+ if(idlast.contains("-Y")) {
+ System.out.println("ϴ-Y");
+ return false;
+ //id = id.replace("-Y", "");
//ж汾ǷΪ汾
- if("T2_VirtualRevision".equals(type)){
- String[] keys = new String[]{" ID"};
- String[] values = new String[]{id};
- //ѯ汾item_idΪid
- List compList = queryObject("汾...", keys, values);
- //жǷΪΪյ
- if(compList!=null) {
- for(int i = 0; i < compList.size(); i++){
- TCComponentItemRevision rev1 = null;
- rev1 = (TCComponentItemRevision) compList.get(i);
- String type1 = rev1.getStringProperty("object_type");
- System.out.println("9.10===type==="+type1);
- //ѯİ汾Ϊ豸汾erp
- if("T2_EquipmentRevision".equals(type1)) {
- return true;
- }
- }
- }
- }
+// if("T2_VirtualRevision".equals(type)){
+// String[] keys = new String[]{" ID"};
+// String[] values = new String[]{id};
+// //ѯ汾item_idΪid
+// List compList = queryObject("汾...", keys, values);
+// //жǷΪΪյ
+// if(compList!=null) {
+// for(int i = 0; i < compList.size(); i++){
+// TCComponentItemRevision rev1 = null;
+// rev1 = (TCComponentItemRevision) compList.get(i);
+// String type1 = rev1.getStringProperty("object_type");
+// System.out.println("9.10===type==="+type1);
+// //ѯİ汾Ϊ豸汾erp
+// if("T2_EquipmentRevision".equals(type1)) {
+// return true;
+// }
+// }
+// }
+// }
}
String groupCode = rev.getStringProperty("t2_groupCode");
System.out.println("t2_groupCode============"+groupCode);
@@ -361,20 +481,34 @@ public class Dfl019Operation extends AbstractAIFOperation{
if("T2_outsourceRevision".equals(type) || "T2_OutBuyPartRevision".equals(type)
||"T2_VirtualRevision".equals(type) ||"T2_EquipmentRevision".equals(type)
||"T2_SystemSchemeRevision".equals(type)) {
+
+ //жǷ״̬
+// if("T2_VirtualRevision".equals(type)) {
+// return false;
+// }
+
//жǷ״̬
if("T2_outsourceRevision".equals(type)||"T2_OutBuyPartRevision".equals(type)
+// ||"T2_VirtualRevision".equals(type)
) {
TCProperty tcProperty = rev.getTCProperty("release_status_list");
TCComponent[] targets = tcProperty.getReferenceValueArray();
String groupcode1 = rev.getStringProperty("t2_groupCode");
String sourceCode1 = rev.getStringProperty("t2_sourceCode");
- // String status = rev.getStringProperty("release_status_list");
+// String status = rev.getStringProperty("release_status_list");
+// System.out.println("״̬"+status);
if(targets==null || targets.length<=0) {
MessageBox.post(rev.getStringProperty("item_id")+"ûз״̬!!",
"ʾ", MessageBox.WARNING);
return true;
}
+// if(status.equals("")||status.equals(" ")) {
+// MessageBox.post(rev.getStringProperty("item_id")+"ûз״̬!!",
+// "ʾ", MessageBox.WARNING);
+// return true;
+// }
+
if("T2_outsourceRevision".equals(type)||"T2_OutBuyPartRevision".equals(type)
) {
if(groupcode1.equals("")){
@@ -398,7 +532,8 @@ public class Dfl019Operation extends AbstractAIFOperation{
boolean flag = false;
if("T2_outsourceRevision".equals(type)) {
StringBuilder sb = new StringBuilder(id);
- sb.append(rev.getStringProperty("item_revision_id"));
+ //2022/8/23 ȡƴӰ汾
+ //sb.append(rev.getStringProperty("item_revision_id"));
id = sb.toString();
String classID = id.substring(0, 2);
System.out.println("classID==============="+classID);
@@ -799,9 +934,10 @@ public class Dfl019Operation extends AbstractAIFOperation{
protected void createXMLFile(List beanList ,String zhangtao) throws TCException, IOException {
String weiyi_id = "";
Date date = new Date();
- SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmm");
+ SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
StringBuilder uidSB = new StringBuilder();
- String fileName = session.getUser().getUserName()+ "-" +df.format(date);
+ String fileName = "WL-"+ beanList.get(0).getItem_id() + "-" +df.format(date);
+ String uid_fileName ="WL-UID-"+ beanList.get(0).getItem_id() +"-"+df.format(date);
// String s1 = "";
// String s2 ="";
@@ -810,13 +946,13 @@ public class Dfl019Operation extends AbstractAIFOperation{
- String sss1 = "";
+ String sss1 = "";
String sss2 ="";
tops = sss1 + sss2;
String bottom ="";
int j = 1;
- int o = 1;
+
StringBuilder sss3SB = new StringBuilder();
StringBuilder xmlSB = new StringBuilder();
for (int i = 0; i < beanList.size(); i++) {
@@ -828,53 +964,12 @@ public class Dfl019Operation extends AbstractAIFOperation{
String n = n1 + n2 + n3;
xmlSB.append(n);
j++;
- if(i > 0 && i%60 == 0) {
- sss3SB.append(fileName);
- sss3SB.append("-"+o++);
- sss3SB.append(sss3);
- sss3SB.append(xmlSB.toString());
- String zong= tops + sss3SB.toString()+bottom;
- System.out.println(zong);
- String tempPath = System.getProperty("java.io.tmpdir");
- System.out.println("10.20temp·======="+tempPath);
- //String path = "D:\\SENDTOERPLOG\\" + fileName + ".txt";
- String path = tempPath + fileName + ".txt";
- File file = new File(path);
- if (!file.exists()) {
- //file.getParentFile().mkdirs();
- file.createNewFile();
- }
- try {
- FileOutputStream fos = new FileOutputStream(file);
- fos.write(zong.getBytes());
- fos.flush();
- fos.close();
-
- weiyi_id = getId();
-
- System.out.println("=======================Ψһʶ" +weiyi_id);
-
- as.insertNewTxtFile(fileName,file,weiyi_id,session.getUser().getUid(), url, user, password ,"CreateItemMasterDataRequest",beanList.get(0).getItem_id(),zhangtao,session.getUser().getUserId(),uidSB.toString());
- file.delete();
- weiyi_id = "";
- } catch (Exception e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
- j = 1;
- uidSB = new StringBuilder();
- xmlSB = new StringBuilder();
- sss3SB = new StringBuilder();
- continue;
- }
if(i < beanList.size()-1) {
uidSB.append(";");
}
-
}
if(!("".equals(uidSB.toString()))) {
sss3SB.append(fileName);
- sss3SB.append("-"+o++);
sss3SB.append(sss3);
sss3SB.append(xmlSB.toString());
String zong= tops + sss3SB.toString()+bottom;
@@ -883,11 +978,26 @@ public class Dfl019Operation extends AbstractAIFOperation{
System.out.println("10.20temp·======="+tempPath);
//String path = "D:\\SENDTOERPLOG\\" + fileName + ".txt";
String path = tempPath + fileName + ".txt";
+ String path1 = tempPath + uid_fileName + ".txt";
File file = new File(path);
if (!file.exists()) {
//file.getParentFile().mkdirs();
file.createNewFile();
}
+ File file1 = new File(path1);
+ if (!file1.exists()) {
+ //file.getParentFile().mkdirs();
+ file1.createNewFile();
+ }
+ try {
+ FileOutputStream fos2 = new FileOutputStream(file1);
+ fos2.write(uidSB.toString().getBytes());
+ fos2.flush();
+ fos2.close();
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
try {
FileOutputStream fos = new FileOutputStream(file);
fos.write(zong.getBytes());
@@ -898,8 +1008,7 @@ public class Dfl019Operation extends AbstractAIFOperation{
System.out.println("=======================Ψһʶ" +weiyi_id);
- as.insertNewTxtFile(fileName,file,weiyi_id,session.getUser().getUid(), url, user, password ,"CreateItemMasterDataRequest",beanList.get(0).getItem_id(),zhangtao,session.getUser().getUserId(),uidSB.toString());
- file.delete();
+ as.insertNewTxtFile(path,fileName,weiyi_id,session.getUser().getUid(), url, user, password ,"CreateItemMasterDataRequest",beanList.get(0).getItem_id(),zhangtao,session.getUser().getUserId(),path1,uid_fileName,session);
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
diff --git a/src/com/connor/dfl/plm/dfl020/Dfl020Handler.java b/src/com/connor/dfl/plm/dfl020/Dfl020Handler.java
index d24056b..8a24d42 100644
--- a/src/com/connor/dfl/plm/dfl020/Dfl020Handler.java
+++ b/src/com/connor/dfl/plm/dfl020/Dfl020Handler.java
@@ -1,13 +1,18 @@
package com.connor.dfl.plm.dfl020;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import com.teamcenter.rac.aif.AbstractAIFApplication;
-import com.teamcenter.rac.aif.AbstractAIFDialog;
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
import com.teamcenter.rac.aifrcp.AIFUtility;
+import com.teamcenter.rac.kernel.TCComponent;
+import com.teamcenter.rac.kernel.TCComponentGroup;
+import com.teamcenter.rac.kernel.TCComponentItemRevision;
import com.teamcenter.rac.kernel.TCSession;
public class Dfl020Handler extends AbstractHandler{
@@ -16,12 +21,85 @@ public class Dfl020Handler extends AbstractHandler{
AbstractAIFApplication app = AIFUtility.getCurrentApplication();
InterfaceAIFComponent targetComp =app.getTargetComponent();
TCSession session = (TCSession) app.getSession();
- Dfl020Operation operation = new Dfl020Operation(app, session);
- session.queueOperation(operation);
-// BOMERP createProblemSpotDialog = new BOMERP(app , targetComp);
-// new Thread(createProblemSpotDialog).start();
+ try {
+ TCComponentGroup group = session.getCurrentGroup();
+ String group_name = group.getStringProperty("display_name");
+ // if(group_name.contains("װ")|| group_name.contains("JCBZ")) {
+ // if(targetComp instanceof TCComponentItemRevision) {
+ // TCComponentItemRevision comp = (TCComponentItemRevision) targetComp;
+ // String type = comp.getType();
+ // if("T2_EquipmentRevision".equals(type) || "T2_Equipment".equals(type)) {
+ // Date createDate = comp.getItem().getDateProperty("creation_date");
+ // SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd" );
+ // Date d = sdf.parse("2022-11-01");
+ // if(createDate.after(d)) {
+ // Dfl020Operation operation = new Dfl020Operation(app, session);
+ // session.queueOperation(operation);
+ // }else {
+ // Dfl020Operation3 operation = new Dfl020Operation3(app, session);
+ // session.queueOperation(operation);
+ // }
+ // }else {
+ // SelectDialog dialog = new SelectDialog(app);
+ // new Thread(dialog).start();
+ // }
+ // }else {
+ // SelectDialog dialog = new SelectDialog(app);
+ // new Thread(dialog).start();
+ // }
+ // }else{
+ // Dfl020Operation2 operation = new Dfl020Operation2(app, session);
+ // session.queueOperation(operation);
+ // }
+
+ if(targetComp instanceof TCComponentItemRevision) {
+ TCComponentItemRevision comp = (TCComponentItemRevision) targetComp;
+ String type = comp.getType();
+ if("T2_EquipmentRevision".equals(type) || "T2_Equipment".equals(type)) {
+ Date createDate = comp.getItem().getDateProperty("creation_date");
+ SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd" );
+ Date d = null;
+ if(group_name.contains("װ")|| group_name.contains("JCBZ")) {
+ d = sdf.parse("2022-11-01");
+ }else {
+ d = sdf.parse("2023-03-10");
+ }
+ if(createDate.after(d)) {
+ Dfl020Operation operation = new Dfl020Operation(app, session);
+ session.queueOperation(operation);
+ }else {
+ Dfl020Operation3 operation = new Dfl020Operation3(app, session);
+ session.queueOperation(operation);
+ }
+ }else {
+ SelectDialog dialog = new SelectDialog(app);
+ new Thread(dialog).start();
+ }
+ }else {
+ SelectDialog dialog = new SelectDialog(app);
+ new Thread(dialog).start();
+ }
+
+ // String name = arg0.getCommand().getName();
+ // if("BOMERP-ƴӰ汾".equals(name)) {
+ // Dfl020Operation2 operation = new Dfl020Operation2(app, session);
+ // session.queueOperation(operation);
+ // }else if("BOMERP-ƴӰ汾-".equals(name)){
+ // Dfl020Operation3 operation = new Dfl020Operation3(app, session);
+ // }else {
+ // Dfl020Operation operation = new Dfl020Operation(app, session);
+ // session.queueOperation(operation);
+ // }
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+
+ // BOMERP createProblemSpotDialog = new BOMERP(app , targetComp);
+ // new Thread(createProblemSpotDialog).start();
return null;
}
-
+
}
diff --git a/src/com/connor/dfl/plm/dfl020/Dfl020Operation.java b/src/com/connor/dfl/plm/dfl020/Dfl020Operation.java
index c882cab..af81699 100644
--- a/src/com/connor/dfl/plm/dfl020/Dfl020Operation.java
+++ b/src/com/connor/dfl/plm/dfl020/Dfl020Operation.java
@@ -14,7 +14,7 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
-import org.jacorb.idl.runtime.int_token;
+//import org.jacorb.idl.runtime.int_token;
import com.connor.dfl.plm.util.AutoSign;
import com.teamcenter.rac.aif.AbstractAIFApplication;
@@ -69,13 +69,13 @@ public class Dfl020Operation extends AbstractAIFOperation{
private String tops;
private String ns ;
- private String weiyi_id;
+ //private String weiyi_id;
String accountSet;
private String zhangtao;
private AutoSign as = null;
private List list = new ArrayList();
String zong;
-
+ private boolean isEquipment = false;
String z_peizhi = "";
@@ -122,10 +122,13 @@ public class Dfl020Operation extends AbstractAIFOperation{
System.out.println("group_name=============="+group_name);
if(group_name.contains(".")) {
String[] names = group_name.split("\\.");
+ System.out.println("names=============="+names.length);
if(names != null && names.length >=2) {
for (int i = 0; i < BOMZT.length; i++) {
+ System.out.println("BOMZT[i]====="+BOMZT[i]);
if(BOMZT[i].contains("=")) {
String[] zts = BOMZT[i].split("=");
+ System.out.println("names[names.length-2]====="+names[names.length-2]);
if(names[names.length-2].equals(zts[0])) {
this.zhangtao = zts[1];
this.accountSet = account_set.get(zhangtao);
@@ -189,14 +192,16 @@ public class Dfl020Operation extends AbstractAIFOperation{
TCComponent[] targets1 = tcProperty1.getReferenceValueArray();
String item_type = rev.getType();
-
+ if("T2_EquipmentRevision".equals(item_type)) {
+ isEquipment = true;
+ }
//ûз״̬豸汾bomerp
-// if("T2_VirtualRevision".equals(item_type)||"T2_EquipmentRevision".equals(item_type)) {
-// if(targets1 == null || targets1.length <= 0) {
-// MessageBox.post("ѡеİ汾ûз״̬","ʾ",MessageBox.INFORMATION);
-// return;
-// }
-// }
+ if("T2_VirtualRevision".equals(item_type) || "T2_EquipmentRevision".equals(item_type)) {
+ if(targets1 == null || targets1.length <= 0) {
+ MessageBox.post("ѡеİ汾ûз״̬","ʾ",MessageBox.INFORMATION);
+ return;
+ }
+ }
//汾bomerp
if("T2_OutBuyPartRevision".equals(item_type)) {
MessageBox.post("ѡеİ汾汾ܽbomerp","ʾ",MessageBox.INFORMATION);
@@ -267,15 +272,10 @@ public class Dfl020Operation extends AbstractAIFOperation{
}
view.close();
if(!("".equals(uid))&& !(" ".equals(uid))) {
-
as.AutoSignServer(uid,session);
-
}
-
MessageBox.post("BOMݴ洢ɹERP",
"ʾ", MessageBox.WARNING);
-
-
} catch (Exception e) {
// TODO Auto-generated catch block
MessageBox.post("BOMݴ洢ʧܣ´ݣ",
@@ -287,13 +287,10 @@ public class Dfl020Operation extends AbstractAIFOperation{
//xmlļ
protected void createXMLFile(TCComponentBOMLine line ,String zhangtao) throws TCException, IOException {
-
- //List list = new ArrayList();
- StringBuilder uidSB = new StringBuilder();
-
-
+ String weiyi_id = "";
+// List list = new ArrayList();
try {
- getBOMValue(line,list);
+ getBOMValue(line,list,1);
if(list.size() <=0) {
MessageBox.post("BOM ʧܣBOMǷȷ", "ʾ",
MessageBox.INFORMATION);
@@ -302,36 +299,47 @@ public class Dfl020Operation extends AbstractAIFOperation{
} catch (Exception e) {
// TODO: handle exception
MessageBox.post("BOM ʧܣBOMǷȷ!" ,"ʾ",MessageBox.INFORMATION);
+ e.printStackTrace();
return;
}
//ȡ
- StringBuilder sb2 = new StringBuilder();
- Date date = new Date();
- SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmm");
- String plmls = df.format(date);
String userName = session.getUser().getUserName();
-
- String s1 ="";
- String s3 = "";
- String s4 = "";
- String s5 = "";
- String s6 = "";
-
- sb2.append(s1);
- sb2.append(s3);
- sb2.append(s4);
- sb2.append(s5);
- sb2.append(s6);
+ List toFus = new ArrayList();
for(int f_index = 0;f_index< list.size();f_index++) {
+ String fuUID = list.get(f_index).getItem_uid();
+ if(!toFus.contains(fuUID)) {
+ toFus.add(fuUID);
+ }else {
+ continue;
+ }
+ StringBuilder sb2 = new StringBuilder();
+ StringBuilder uidSB = new StringBuilder();
+ Date date = new Date();
+ SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
+ String plmls = df.format(date);
+ String s1 ="";
+ String s3 = "";
+ String s4 = "";
+ String s5 = "";
+ String s6 = "";
+
+ sb2.append(s1);
+ sb2.append(s3);
+ sb2.append(s4);
+ sb2.append(s5);
+ sb2.append(s6);
uidSB.append(list.get(f_index).getItem_uid());
if(f_index< list.size()-1) {
uidSB.append(";");
}
- int iii = f_index+1;
- System.out.println("==== "+ iii+"");
+
+
+// int iii = f_index+1;
+// System.out.println("==== "+ iii+"");
System.out.println("******Ʒ"+list.get(f_index).getPinhao()+"*****");
- String peizhi1 ="";
+ String peizhi1 ="";
+// String peizhi1 ="";
//String peizhi2 = ""+iii +" ";
String peizhi3 = "";
@@ -410,61 +418,73 @@ public class Dfl020Operation extends AbstractAIFOperation{
}
sb2.append("");
- }
+
+ String bottomS ="";
+ sb2.append(bottomS);
+ outPutInfo = sb2.toString();
+ System.out.println("================"+outPutInfo);
+
+ String fileName ="BOM-"+ list.get(f_index).getPinhao()+"-"+plmls;
+ String tempPath = System.getProperty("java.io.tmpdir");
+ String uid_fileName ="BOM-UID-"+list.get(f_index).getPinhao()+"-"+ plmls;
+ System.out.println("10.20temp·======="+tempPath);
+ //String path = "D:\\SENDTOERPLOG\\" + fileName + ".txt";
+ String path = tempPath + fileName + ".txt";
+ String path1 = tempPath + uid_fileName + ".txt";
+ File file = new File(path);
+ File file1 = new File(path1);
+ if (!file.exists()) {
+ //file.getParentFile().mkdirs();
+ file.createNewFile();
+ }
+ if (!file1.exists()) {
+ //file.getParentFile().mkdirs();
+ file1.createNewFile();
+ }
+ try {
+ FileOutputStream fos = new FileOutputStream(file);
+ fos.write(outPutInfo.getBytes());
+ fos.flush();
+ fos.close();
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ //
+ // InputStream in = new FileInputStream("c:/fugang.jpg");
+ //
+ // byte[] fileContent = new byte[in.available()];
+ //
+ // in.read(fileContent);
+ //
+ // in.close();
+ // //
- String bottomS ="";
- sb2.append(bottomS);
- outPutInfo = sb2.toString();
- System.out.println("================"+outPutInfo);
+ //txtļ 浽ݿ
- String fileName ="BOM"+ plmls;
- String tempPath = System.getProperty("java.io.tmpdir");
- System.out.println("10.20temp·======="+tempPath);
- //String path = "D:\\SENDTOERPLOG\\" + fileName + ".txt";
- String path = tempPath + fileName + ".txt";
- File file = new File(path);
+ weiyi_id = getId();
- if (!file.exists()) {
- //file.getParentFile().mkdirs();
- file.createNewFile();
- }
- try {
- FileOutputStream fos = new FileOutputStream(file);
- fos.write(outPutInfo.getBytes());
- fos.flush();
- fos.close();
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ System.out.println("=======================Ψһʶ" +weiyi_id);
+
+ //if(f_index > 0 && f_index%60 == 0) {
+ String uidString = uidSB.toString();
+ try {
+ FileOutputStream fos2 = new FileOutputStream(file1);
+ fos2.write(uidString.getBytes());
+ fos2.flush();
+ fos2.close();
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ as.insertNewTxtFile(path,fileName, weiyi_id,session.getUser().getUid() , url, user, password,"CreatePLMBOMDataRequest",list.get(f_index).getPinhao(),zhangtao,session.getUser().getUserId(),path1,uid_fileName,session);
+
}
- //
- // InputStream in = new FileInputStream("c:/fugang.jpg");
- //
- // byte[] fileContent = new byte[in.available()];
- //
- // in.read(fileContent);
- //
- // in.close();
- // //
-
- //txtļ 浽ݿ
-
- weiyi_id = getId();
-
- System.out.println("=======================Ψһʶ" +weiyi_id);
-
-
- as.insertNewTxtFile(fileName,file, weiyi_id,session.getUser().getUid() , url, user, password,"CreatePLMBOMDataRequest",list.get(0).getPinhao(),zhangtao,session.getUser().getUserId(),uidSB.toString());
-
-
- // as.insertNewTxtFile(fileName,file,weiyi_id,session.getUser().getUid(), url, user, password ,"CreateItemMasterData");
-
- file.delete();
}
- private void getBOMValue(TCComponentBOMLine line, List list)
+ private void getBOMValue(TCComponentBOMLine line, List list,int pQty)
{
FatherBomLineBean fatherBean = new FatherBomLineBean();
try
@@ -478,12 +498,16 @@ public class Dfl020Operation extends AbstractAIFOperation{
}
List z_list = new ArrayList();
String fuID = rev.getStringProperty("item_id");
- fuID = fuID.replace("-Y", "");
+ String idlast =fuID.substring(fuID.length()-2, fuID.length());
+ if(idlast.endsWith("-Y")) {
+ fuID = fuID.substring(0,fuID.length()-2);
+ }
+// fuID = fuID.replace("-Y", "");
String fuType = rev.getStringProperty("object_type");
if ("T2_outsourceRevision".equals(fuType))
{
String revId = rev.getStringProperty("item_revision_id");
- fuID = fuID + revId;
+ //fuID = fuID + revId;
}
fatherBean.setPinhao(fuID);
fatherBean.setItem_uid(rev.getUid());
@@ -495,6 +519,7 @@ public class Dfl020Operation extends AbstractAIFOperation{
if ((childComp instanceof TCComponentBOMLine))
{
TCComponentBOMLine childLine = (TCComponentBOMLine)childComp;
+ String occType = childLine.getStringProperty("TCAI_OCC_TYPE");
String num = childLine.getStringProperty( "T2_ActualConsumption");//ʵ
if(num==null||"".equals(num.trim())) {
num = childLine.getStringProperty( "T2_DesignQuantity");//
@@ -507,7 +532,7 @@ public class Dfl020Operation extends AbstractAIFOperation{
}
System.out.println("num=============="+num);
//ΪѴע͡
- if(childLine.isPacked() && "Ѵע".equals(num))
+ if(childLine.isPacked() || "Ѵע".equals(num) || "Ѵע".equals(occType))
{
childLine.unpack();
ispack = true;
@@ -529,7 +554,7 @@ public class Dfl020Operation extends AbstractAIFOperation{
String occType = childLine.getStringProperty("TCAI_OCC_TYPE");
if (!"Reference".equals(occType))
{
- getChildValue(childLine, z_list, childLineNum,idList);
+ getChildValue(childLine, z_list, childLineNum,idList,pQty);
childLineNum++;
}
}
@@ -555,7 +580,26 @@ public class Dfl020Operation extends AbstractAIFOperation{
{
AIFComponentContext[] childrenAifs = z_line.getChildren();
if (childrenAifs.length > 0) {
- getBOMValue(z_line, list);
+ String childType = z_line.getItemRevision().getType();
+ if(childType.equals("T2_VirtualRevision") && isEquipment) {
+ TCProperty tcProperty1 = z_line.getItemRevision().getTCProperty("release_status_list");
+ TCComponent[] targets1 = tcProperty1.getReferenceValueArray();
+ if(targets1==null || targets1.length<=0) {
+ continue;
+ }
+ }
+ String num = z_line.getStringProperty( "T2_ActualConsumption");//ʵ
+ if(num==null||"".equals(num.trim())) {
+ num = z_line.getStringProperty( "T2_DesignQuantity");//
+ if(num==null||"".equals(num.trim())) {
+ num = z_line.getStringProperty( "bl_quantity");//
+ if(num==null||"".equals(num.trim())) {
+ num = "1";
+ }
+ }
+ }
+// z_line.getStringProperty("bl_")
+ getBOMValue(z_line, list,Integer.valueOf(num)*pQty);
}
}
}
@@ -570,7 +614,7 @@ public class Dfl020Operation extends AbstractAIFOperation{
// TODO Auto-generated method stub
return null;
}
- public void getChildValue(TCComponentBOMLine childLine, List z_list,int childLineNum,List idList) {
+ public void getChildValue(TCComponentBOMLine childLine, List z_list,int childLineNum,List idList,int pQty) {
try {
String occType = childLine.getStringProperty("TCAI_OCC_TYPE");
if("Reference".equals(occType)) {
@@ -581,7 +625,8 @@ public class Dfl020Operation extends AbstractAIFOperation{
String childRevstring = childLine.getItemRevision().getStringProperty("item_revision_id");
if("T2_outsource".equals(childtypeString)) {
StringBuilder sb = new StringBuilder(childID);
- sb.append(childRevstring);
+ //2022/8/23 ȡƴӰ汾
+ //sb.append(childRevstring);
childID = sb.toString();
}
System.out.println("childID2============"+childID);
@@ -595,6 +640,8 @@ public class Dfl020Operation extends AbstractAIFOperation{
}
}
}
+// int num = Integer.valueOf(Quantity)*pQty;
+// Quantity = String.valueOf(num);
System.out.println("Quantity=============="+Quantity);
if(idList.contains(childID)) {
int index = idList.indexOf(childID);
@@ -613,6 +660,7 @@ public class Dfl020Operation extends AbstractAIFOperation{
d2 = 1;
}
double d3 = d1 + d2;
+ System.out.println("d3=============="+d3);
child.setYonglian(d3+"");
return;
}else {
@@ -627,7 +675,15 @@ public class Dfl020Operation extends AbstractAIFOperation{
childBean.setYonglian(Quantity);
String childRev = childLine.getItemRevision().getStringProperty("item_revision_id");
String childType = childLine.getItem().getStringProperty("object_type");
- childID = childID.replace("-Y", "");
+// childID = childID.replace("-Y", "");
+ String idlast =childID.substring(childID.length()-2, childID.length());
+ System.out.println("idĺλ"+idlast);
+// if(idlast.contains("-Y")) {
+// return;
+// }
+ if(childID.endsWith("-Y")) {
+ childID = childID.replace("-Y", "");
+ }
System.out.println("childID============"+childID);
System.out.println("childRev============"+childRev);
System.out.println("childType============"+childType);
diff --git a/src/com/connor/dfl/plm/dfl028/Dfl028AIFDialog.java b/src/com/connor/dfl/plm/dfl028/Dfl028AIFDialog.java
index 353989f..5b556ac 100644
--- a/src/com/connor/dfl/plm/dfl028/Dfl028AIFDialog.java
+++ b/src/com/connor/dfl/plm/dfl028/Dfl028AIFDialog.java
@@ -31,7 +31,7 @@ import javax.swing.JProgressBar;
import javax.swing.JTextField;
import javax.swing.filechooser.FileSystemView;
-import org.jacorb.idl.runtime.int_token;
+//import org.jacorb.idl.runtime.int_token;
import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aif.AbstractAIFDialog;
@@ -102,11 +102,13 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
// ȡļб
private void getload(TCComponentDataset dataset, String path, List list, String itemid) {
-
+ System.out.println("----------------------getload");
try {
TCComponentTcFile[] file = dataset.getTcFiles();
+ System.out.println("datasetNam="+dataset.getStringProperty("object_name"));
if (file == null || file.length == 0) {
if (itemid.equals("sjj")) {
+ System.out.println("itemid=sjj");
String noFileString = path + "_" + dataset.getStringProperty("object_name");
noFileList.add(noFileString);
} else {
@@ -130,6 +132,15 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
}
// ȡ
hzm = file[i].getTCProperty("file_ext").getStringValue();
+ String uid = file[i].getUid();
+ System.out.println("=======list========");
+ System.out.println("i="+i);
+ for(String s:list) {
+ System.out.println(s);
+ }
+ System.out.println("hzm="+hzm);
+ System.out.println("uid="+uid);
+ System.out.println("=======list========");
// ȡļ
if (list.contains(hzm)) {
String name = file[i].getTCProperty("original_file_name").getStringValue();
@@ -138,7 +149,8 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
if (context.getComponent() instanceof TCComponentItemRevision) {
TCComponentItemRevision revision = (TCComponentItemRevision) context.getComponent();
if ("T2_OutBuyPartRevision".equals(revision.getType())
- || "T2_outsourceRevision".equals(revision.getType()) || "T2_VirtualRevision".equals(revision.getType())) {
+ || "T2_outsourceRevision".equals(revision.getType()) || "T2_VirtualRevision".equals(revision.getType())
+ || "T2_EquipmentRevision".equals(revision.getType())) {
if(isCarryRev) {
name = revision.getStringProperty("item_id")
+ revision.getStringProperty("current_revision_id") + " "
@@ -147,8 +159,8 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
}
} else {
- name = revision.getStringProperty("item_id") + " "
- + revision.getStringProperty("object_name");
+// name = revision.getStringProperty("item_id") + " "
+// + revision.getStringProperty("object_name");
}
}
@@ -158,12 +170,15 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
// ȡļ
name = name.substring(0, name.lastIndexOf("."));
}
+ System.out.println("name="+name);
String replace = name.replace("/", "-").replace("<", "-").replace(">", "-").replace(":", "-")
.replace("|", "-").replace("\\", "-").replace("*", "-").replace("?", "-");
+ System.out.println("replace="+replace);
// ȡļû
File fmsFile = file[i].getFmsFile();
hzmlist.add(hzm);
namelist.add(path + File.separator + replace);
+ System.out.println("namelist.add="+path + File.separator + replace);
fmsFilelist.add(fmsFile);
fileSize = fileSize + fmsFile.length();
}
@@ -213,6 +228,8 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
for (int i = 0; i < hzmlist.size(); i++) {
// ƴļ
String filename = namelist.get(i) + "." + hzmlist.get(i);
+ System.out.println("fpath="+fpath);
+ System.out.println("namelist.get("+i+")="+namelist.get(i));
// ƴ·ȫļ
String path = fpath + File.separator + filename;
System.out.println("path=8.3" + path);
@@ -515,6 +532,7 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
}
try {
for (int i = 0; i < targets.length; i++) {
+
if (targets[i] instanceof TCComponentBOMLine) {
List itemlist = new ArrayList();
// ִлȡ͵ķ
@@ -539,6 +557,7 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
System.out.println("cs" + rev.toString() + list.get(0));
String dataName2 = "";
// ͼ ȥҷ ļѾ
+ System.out.println("getOutPart1,dataName="+dataName);
getOutPart(rev, dataName, list);
String dataDir3 = jtf.getText() + File.separator + rev.getStringProperty("item_id") + "_"
+ rev.getStringProperty("current_revision_id") + "_" + replace + File.separator
@@ -570,6 +589,7 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
// ȡݼ
TCComponentDataset dataset02 = (TCComponentDataset) datasets[j];
// ִgetload
+ System.out.println("getload1");
getload(dataset02, dataName, list, rev.getStringProperty("item_id"));
getload(dataset02, dataName2, list, rev.getStringProperty("item_id"));
}
@@ -590,6 +610,7 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
if (itemlist.contains(revtype) || allCheck) {
if (datasetList.contains(type)) {
TCComponentDataset dataset = (TCComponentDataset) datasets2[j];
+ System.out.println("getload2");
getload(dataset, dataName, list, rev.getStringProperty("item_id"));
getload(dataset, dataName2, list, rev.getStringProperty("item_id"));
}
@@ -600,6 +621,8 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
// ִлȡ͵ķ
itemlist = getitemType();
TCComponentItemRevision rev = (TCComponentItemRevision) targets[i];
+ String revType = rev.getStringProperty("object_type");
+ System.out.println("ѡĿ:"+revType);
String revtype = rev.getType();
String objName = rev.getStringProperty("object_name");
String replace = objName.replace("/", "-").replace("<", "-").replace(">", "-").replace(":", "-")
@@ -617,6 +640,7 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
csFile.mkdir();
}
// ͼ ȥҷ ļѾ
+ System.out.println("getOutPart2,dataName="+dataName);
getOutPart(rev, dataName, list);
String dataDir3 = jtf.getText() + File.separator + rev.getStringProperty("item_id") + "_"
+ rev.getStringProperty("current_revision_id") + "_" + replace + File.separator
@@ -628,10 +652,17 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
}
dataName2 = dataName + File.separator + rev.getStringProperty("item_id") + "_"
+ rev.getStringProperty("current_revision_id") + "_" + replace;// ļ
- TCComponent[] datasets = rev.getReferenceListProperty("IMAN_specification");
+ TCComponent[] datasets=null;
+ if(revType.equals("T2_ECNRevision")) {
+ datasets = rev.getReferenceListProperty("TC_Attaches");
+ }else {
+ datasets = rev.getReferenceListProperty("IMAN_specification");
+ }
+
TCComponent[] datasets2 = rev.getReferenceListProperty("IMAN_Rendering");
+
for (int j = 0; j < datasets.length; j++) {
-
+ System.out.println("-----------------");
// ȡݼ
TCComponentDataset dataset02 = null;
if (datasets[j] instanceof TCComponentDataset) {
@@ -645,6 +676,7 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
// ж
if (itemlist.contains(revtype) || allCheck) {
if (datasetList.contains(type)) {
+ System.out.println("!!!!!!!!!!!!!!!");
TCComponentDataset dataset = (TCComponentDataset) datasets[j];
System.out.println("ļ");
getload(dataset, dataName, list, rev.getStringProperty("item_id"));
@@ -667,6 +699,7 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
if (itemlist.contains(revtype) || allCheck) {
if (datasetList.contains(type)) {
TCComponentDataset dataset = (TCComponentDataset) datasets2[j];
+ System.out.println("getload3");
getload(dataset, dataName, list, rev.getStringProperty("item_id"));
getload(dataset, dataName2, list, rev.getStringProperty("item_id"));
}
@@ -717,6 +750,7 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
}
String dataName2 = "";
// ͼ ȥҷ ļѾ
+ System.out.println("getOutPart3,dataName="+dataName);
getOutPart(rev, dataName, list);
String dataDir3 = jtf.getText() + File.separator + rev.getStringProperty("item_id") + "_"
+ rev.getStringProperty("current_revision_id") + "_" + replace + File.separator
@@ -744,6 +778,7 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
if (itemlist.contains(revtype) || allCheck) {
if (datasetList.contains(type)) {
TCComponentDataset dataset = (TCComponentDataset) datasets[j];
+ System.out.println("getload4");
getload(dataset, dataName, list, rev.getStringProperty("item_id"));
getload(dataset, dataName2, list, rev.getStringProperty("item_id"));
}
@@ -763,6 +798,7 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
if (itemlist.contains(revtype) || allCheck) {
if (datasetList.contains(type)) {
TCComponentDataset dataset = (TCComponentDataset) datasets2[j];
+ System.out.println("getload5");
getload(dataset, dataName, list, rev.getStringProperty("item_id"));
getload(dataset, dataName2, list, rev.getStringProperty("item_id"));
}
@@ -797,6 +833,7 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
itemlist.add("T2_OutBuyPartRevision");
itemlist.add("T2_outsourceRevision");
itemlist.add("T2_EquipmentRevision");
+ itemlist.add("T2_ECNRevision");
} else if ("Э".equals(jcb.getText())) {
itemlist.add("T2_outsourceRevision");
} else if ("".equals(jcb.getText())) {
@@ -965,12 +1002,15 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
continue;
}
// ִgetload
+ System.out.println("getload6");
getload(dataset02, dir, list, rev.getStringProperty("item_id"));
// һݵ
if (!dir.equals(dirFs)) {
+ System.out.println("getload7");
getload(dataset02, dirFs, list, rev.getStringProperty("item_id"));
}
if (!dir.equals(pathMap.get("1")) && pathMap.get("1") != null) {
+ System.out.println("getload8");
getload(dataset02, pathMap.get("1"), list, rev.getStringProperty("item_id"));
}
}
@@ -989,11 +1029,14 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
String type = dataset02.getStringProperty("object_type");
if (datasetList.contains(type)) {
TCComponentDataset dataset = (TCComponentDataset) datasets2[j];
+ System.out.println("getload9");
getload(dataset, dir, list, rev.getStringProperty("item_id"));
if (!dir.equals(dirFs)) {
+ System.out.println("getload10");
getload(dataset, dirFs, list, rev.getStringProperty("item_id"));
}
- if (!dir.equals(pathMap.get("1"))) {
+ if (!dir.equals(pathMap.get("1"))&& pathMap.get("1") != null) {
+ System.out.println("getlaod11");
getload(dataset02, pathMap.get("1"), list, rev.getStringProperty("item_id"));
}
}
diff --git a/src/com/connor/dfl/plm/dfl036/SynchPassERPAttrOperation.java b/src/com/connor/dfl/plm/dfl036/SynchPassERPAttrOperation.java
index b040c92..b46a12d 100644
--- a/src/com/connor/dfl/plm/dfl036/SynchPassERPAttrOperation.java
+++ b/src/com/connor/dfl/plm/dfl036/SynchPassERPAttrOperation.java
@@ -14,7 +14,7 @@ import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
-import org.jacorb.idl.runtime.int_token;
+//import org.jacorb.idl.runtime.int_token;
import com.ctc.wstx.compat.Jdk12Impl;
import com.teamcenter.rac.aif.AbstractAIFOperation;
diff --git a/src/com/connor/dfl/plm/dfl036/Test.java b/src/com/connor/dfl/plm/dfl036/Test.java
index de89333..1fbd2ad 100644
--- a/src/com/connor/dfl/plm/dfl036/Test.java
+++ b/src/com/connor/dfl/plm/dfl036/Test.java
@@ -13,7 +13,7 @@ import java.util.List;
import java.util.ListIterator;
import java.util.Set;
-import org.jacorb.idl.runtime.int_token;
+//import org.jacorb.idl.runtime.int_token;
import com.connor.dev.imp.toolkit.SearchUtility;
import com.connor.dfl.plm.dfl037.GetLatestExcelOperation;
diff --git a/src/com/connor/dfl/plm/dfl038/ChangeBean.java b/src/com/connor/dfl/plm/dfl038/ChangeBean.java
index 8c698d5..c049770 100644
--- a/src/com/connor/dfl/plm/dfl038/ChangeBean.java
+++ b/src/com/connor/dfl/plm/dfl038/ChangeBean.java
@@ -35,6 +35,11 @@ public class ChangeBean {
private String projectCode;//Ŀ
private String changeReason;//ԭ
private String accountSet;//
+ private String reasonDetail;//ϸԭ
+ private String formMajor;//רҵ
+ private String pkeyword;//ؼ
+ private String manageclassify; //ƹ
+ private String kkcode; //kk
public String getProjectState() {
return projectState;
@@ -182,4 +187,36 @@ public class ChangeBean {
public void setDrawingTo(String drawingTo) {
this.drawingTo = drawingTo;
}
+ public String getReasonDetail() {
+ return reasonDetail;
+ }
+ public void setReasonDetail(String reasonDetail) {
+ this.reasonDetail = reasonDetail;
+ }
+ public String getFormMajor() {
+ return formMajor;
+ }
+ public void setFormMajor(String formMajor) {
+ this.formMajor = formMajor;
+ }
+ public String getPkeyword() {
+ return pkeyword;
+ }
+ public void setPkeyword(String pkeyword) {
+ this.pkeyword = pkeyword;
+ }
+ public String getManageclassify() {
+ return manageclassify;
+ }
+ public void setManageclassify(String manageclassify) {
+ this.manageclassify = manageclassify;
+ }
+ public String getKkcode() {
+ return kkcode;
+ }
+ public void setKkcode(String kkcode) {
+ this.kkcode = kkcode;
+ }
+
+
}
diff --git a/src/com/connor/dfl/plm/dfl038/Dfl038Operation.java b/src/com/connor/dfl/plm/dfl038/Dfl038Operation.java
index 7533104..eb9bba0 100644
--- a/src/com/connor/dfl/plm/dfl038/Dfl038Operation.java
+++ b/src/com/connor/dfl/plm/dfl038/Dfl038Operation.java
@@ -17,11 +17,6 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import com.connor.dfl.plm.util.DataBaseControl;
import com.connor.dfl.plm.util.ProgressBarThread;
-import com.spire.xls.ExcelVersion;
-import com.spire.xls.OrderBy;
-import com.spire.xls.SortComparsionType;
-import com.spire.xls.Workbook;
-import com.spire.xls.Worksheet;
import com.teamcenter.rac.aif.AbstractAIFOperation;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentDataset;
@@ -156,7 +151,7 @@ public class Dfl038Operation extends AbstractAIFOperation{
XSSFCellStyle cellStyle = targetCell.getCellStyle();
for (int i = 0; i < beanList.size(); i++) {
ChangeBean bean = beanList.get(i);
- String[] vals = new String[24];
+ String[] vals = new String[26];
vals[0] = bean.getApplyName();
vals[1] = bean.getChangeListCode();
vals[2] = bean.getApplyDate();
@@ -169,18 +164,20 @@ public class Dfl038Operation extends AbstractAIFOperation{
vals[9] = bean.getSUOSU_ProductDepartment();
vals[10] = bean.getDutyDepartment();
vals[11] = bean.getDutyMan();
- vals[12] = bean.getChangeType();
- vals[13] = bean.getProductType();
- vals[14] = bean.getErrorType();
- vals[15] = bean.getPriceBooking();
- vals[16] = bean.getSalseClassify();
- vals[17] = bean.getIsNotProductLoss();
- vals[18] = bean.getProjectState();
- vals[19] = bean.getReceiveClassify();
- vals[20] = bean.getDrawingTo();
- vals[21] = bean.getProjectCode();
- vals[22] = bean.getChangeReason();
- vals[23] = bean.getAccountSet();
+ vals[12] = bean.getFormMajor();
+ vals[13] = bean.getChangeType();
+ vals[14] = bean.getProductType();
+ vals[15] = bean.getErrorType();
+ vals[16] = bean.getPriceBooking();
+ vals[17] = bean.getSalseClassify();
+ vals[18] = bean.getIsNotProductLoss();
+ vals[19] = bean.getProjectState();
+ vals[20] = bean.getReceiveClassify();
+ vals[21] = bean.getDrawingTo();
+ vals[22] = bean.getProjectCode();
+ vals[23] = bean.getChangeReason();
+ vals[24] = bean.getAccountSet();
+ vals[25] = bean.getReasonDetail();
XSSFRow row = sheet.getRow(i+1);
if(row == null){
diff --git a/src/com/connor/dfl/plm/dfl040/ChangeFormBean.java b/src/com/connor/dfl/plm/dfl040/ChangeFormBean.java
index a3ba4a0..18b7b2c 100644
--- a/src/com/connor/dfl/plm/dfl040/ChangeFormBean.java
+++ b/src/com/connor/dfl/plm/dfl040/ChangeFormBean.java
@@ -40,7 +40,7 @@ public class ChangeFormBean {
public Map getMap(){
Map map = new HashedMap();
map.put("APPLYNAME",applyhMan==null || "".equals(applyhMan.trim())?null:" AND APPLYNAME LIKE '%"+applyhMan+"%' ");
- map.put("CHANGELISTCODE", applyId==null || "".equals(applyId.trim())?null:" AND CHANGELISTCODE LIKE '%"+applyId+"%' ");
+ map.put("OBJECTCODE", applyId==null || "".equals(applyId.trim())?null:" AND OBJECTCODE LIKE '%"+applyId+"%' ");
map.put("PROJECTCODE", projectId==null || "".equals(projectId.trim())?null:" AND PROJECTCODE LIKE '%"+projectId+"%' ");
map.put("PROJECTMODEL", procuctModNum==null || "".equals(procuctModNum.trim())?null:"AND PROJECTMODEL LIKE '%"+procuctModNum+"%' ");
map.put("CLIENTNAME", custName==null || "".equals(custName.trim())?null:"AND CLIENTNAME LIKE '%"+custName+"%' ");
diff --git a/src/com/connor/dfl/plm/dfl040/DFL038Jframe.java b/src/com/connor/dfl/plm/dfl040/DFL038Jframe.java
index 015cb3f..3c00948 100644
--- a/src/com/connor/dfl/plm/dfl040/DFL038Jframe.java
+++ b/src/com/connor/dfl/plm/dfl040/DFL038Jframe.java
@@ -26,6 +26,7 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.function.Consumer;
@@ -59,13 +60,14 @@ import org.apache.poi.xssf.usermodel.XSSFCellStyle;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
-import org.jacorb.idl.runtime.int_token;
+//import org.jacorb.idl.runtime.int_token;
//import com.connor.dfl.plm.dfl038.MyComparator;
import com.connor.dfl.plm.util.DataBaseControl;
import com.connor.dfl.plm.util.ProgressBar;
import com.connor.dfl.plm.util.ProgressBarThread;
import com.lowagie.text.Row;
+import com.sun.mail.handlers.image_gif;
//import com.sun.javafx.image.IntPixelAccessor;
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
import com.teamcenter.rac.kernel.TCComponent;
@@ -77,6 +79,7 @@ import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.util.MessageBox;
import jdk.internal.org.objectweb.asm.tree.IntInsnNode;
+import oracle.net.aso.s;
public class DFL038Jframe extends JFrame {
@@ -86,7 +89,7 @@ public class DFL038Jframe extends JFrame {
private String[] drawChangeType = new String[] { "ȫ", "" };
- private String[] changeType = new String[] { "ƴ", "Ż", "ڲ", "", "ɹ", "۸" };
+ private String[] changeType = new String[] { "ƴ", "ڲ", "Ż", "ϵͳ", "ɹ", "۸" };
private String[] productType = new String[] { "ɻ", "", "ϴ", "", "Զе", "Ƽ" };
@@ -94,6 +97,9 @@ public class DFL038Jframe extends JFrame {
private String[] errorType = new String[] { "P&IDͼ", "ͼ", "ͼ", "BOM", "Эͼ", "ƽ沼ͼ", "" };
+ private String[] exportType = new String[] { "ϸ", "ϲ" };
+
+
private JLabel startDateLabel = new JLabel("");
private JLabel endDateLabel = new JLabel("");
private JLabel depLabel = new JLabel("Ʒ");
@@ -144,32 +150,145 @@ public class DFL038Jframe extends JFrame {
private JButton cancelButton;
private JPanel centerPanel1;
- private String[] title = new String[] { "Ʒ", "Ʒ", "֪ͨ", "Ʒͺ", "ͻ", "","", "ԭ", "ͼֽ", "β",
- "", "Ʒ", "Ʒ", "ԭ汾", "ְ汾", "", "Ʒ", "", "۸Ԥ", "۷", "Ƿɱʧ", "Ŀ", "ϼ÷",
- "ͼֽ", "Ŀ", "̶֪ͨ", "ʱ", "", "̽" };
+ private JLabel exportTypeLabel;
+ private JComboBox exportTypeBox;
+ private DefaultComboBoxModel exportTypeModel;
+ private JFrame frame;
+ private Boolean flag = true;
+
+ private String[] title = new String[] { "Ʒ", "Ʒ", "֪ͨ", "Ʒͺ", "ͻ", "", "", "ԭ", "ͼֽ",
+ "β", "", "Ʒ", "Ʒ", "ԭ汾", "ְ汾", "", "Ʒ", "", "۸Ԥ", "۷", "Ƿɱʧ", "Ŀ",
+ "ϼ÷", "ͼֽ", "Ŀ", "̶֪ͨ", "ʱ", "", "̽" };
public DFL038Jframe(TCSession session) {
+
this.session = session;
- departs = session.getPreferenceService().getStringValues("T2_ECNReport");
- changeType = session.getPreferenceService().getStringValues("T2_changeType");
- drawChangeType = session.getPreferenceService().getStringValues("T2_drawChangeType");
- productType = session.getPreferenceService().getStringValues("DFL_Form_Product_Type");
- errorType = session.getPreferenceService().getStringValues("DFL_Form_Error_Type");
- if (departs == null || changeType == null || productType == null || errorType == null || departs.length == 0
- || changeType.length == 0 || errorType.length == 0) {
- MessageBox.post("ѡT2_ECNReportT2_changeType⣬ϵԱ", "", MessageBox.ERROR);
- return;
+ frame = new JFrame();
+ frame.setTitle("ѡ");
+ frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+ GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+ Rectangle rect = ge.getMaximumWindowBounds();
+ int sw = rect.width;
+ int sh = rect.height;
+ frame.setBounds((sw - 350) / 2, (sh - 300) / 2, 350, 300); // λüС
+ this.setLayout(new BorderLayout());
+ JPanel myJPanel = new JPanel();
+ myJPanel.setLayout(null);
+ JButton okbutton;
+ exportTypeLabel = new JLabel("");
+ exportTypeLabel.setFont(new Font("ź", Font.BOLD, 20));
+ exportTypeLabel.setSize(100, 30);
+ exportTypeModel = new DefaultComboBoxModel();
+ exportTypeBox = new JComboBox(exportTypeModel);
+ exportTypeBox.setBounds(200, 190, 170, 30);
+ exportTypeBox.setFont(new Font("ź", Font.BOLD, 20));
+ for (String string : exportType) {
+ exportTypeModel.addElement(string);
}
- InitUI();
+ exportTypeLabel.setBounds(30, 50, 100, 30);
+ exportTypeBox.setBounds(150, 50, 150, 30);
+
+ okbutton = new JButton("ȷ");
+ okbutton.setFont(new Font("ź", Font.BOLD, 20));
+ okbutton.setBounds(100, 180, 120, 30);
+
+ okbutton.addActionListener(new ActionListener() {
+
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ // TODO Auto-generated method stub
+ final String element = exportTypeModel.getElementAt(exportTypeBox.getSelectedIndex());
+ System.out.println(element);
+ if ("ϲ".equals(element)) {
+ flag = false;
+ }
+ frame.setVisible(false);
+ InitUI();
+ }
+ });
+
+ myJPanel.add(exportTypeLabel);
+ myJPanel.add(exportTypeBox);
+ myJPanel.add(okbutton);
+ Container contentPane = frame.getContentPane();
+ contentPane.add(myJPanel, BorderLayout.CENTER);
+ frame.setVisible(true);
+
+
}
public DFL038Jframe() {
- InitUI();
+ frame = new JFrame();
+ frame.setTitle("ѡ");
+ frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+ GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+ Rectangle rect = ge.getMaximumWindowBounds();
+ int sw = rect.width;
+ int sh = rect.height;
+ frame.setBounds((sw - 350) / 2, (sh - 300) / 2, 350, 300); // λüС
+ this.setLayout(new BorderLayout());
+ JPanel myJPanel = new JPanel();
+ myJPanel.setLayout(null);
+
+ exportTypeLabel = new JLabel("");
+ exportTypeLabel.setFont(new Font("ź", Font.BOLD, 20));
+ exportTypeLabel.setSize(100, 30);
+ exportTypeModel = new DefaultComboBoxModel();
+ exportTypeBox = new JComboBox(exportTypeModel);
+ exportTypeBox.setBounds(200, 190, 170, 30);
+ exportTypeBox.setFont(new Font("ź", Font.BOLD, 20));
+ for (String string : exportType) {
+ exportTypeModel.addElement(string);
+ }
+
+ exportTypeLabel.setBounds(30, 50, 100, 30);
+ exportTypeBox.setBounds(150, 50, 150, 30);
+
+ okbutton = new JButton("ȷ");
+ okbutton.setFont(new Font("ź", Font.BOLD, 20));
+ okbutton.setBounds(100, 180, 120, 30);
+
+ okbutton.addActionListener(new ActionListener() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ // TODO Auto-generated method stub
+ String element = exportTypeModel.getElementAt(exportTypeBox.getSelectedIndex());
+// System.out.println(element);
+ if ("ϲ".equals(element))
+ flag = false;
+ frame.setVisible(false);
+ InitUI();
+ }
+ });
+
+ myJPanel.add(exportTypeLabel);
+ myJPanel.add(exportTypeBox);
+ myJPanel.add(okbutton);
+ Container contentPane = frame.getContentPane();
+ contentPane.add(myJPanel, BorderLayout.CENTER);
+ frame.setVisible(true);
+
}
private void InitUI() {
// TODO Auto-generated method stub
+
+ departs = session.getPreferenceService().getStringValues("T2_ECNReport");
+ if(flag) {
+ changeType = session.getPreferenceService().getStringValues("T2_changeType");
+ }
+ drawChangeType = session.getPreferenceService().getStringValues("T2_drawChangeType");
+ productType = session.getPreferenceService().getStringValues("DFL_Form_Product_Type");
+ errorType = session.getPreferenceService().getStringValues("DFL_Form_Error_Type");
+ if (departs == null || changeType == null || productType == null || errorType == null
+ || departs.length == 0 || changeType.length == 0 || errorType.length == 0) {
+ MessageBox.post("ѡT2_ECNReportT2_changeType⣬ϵԱ", "", MessageBox.ERROR);
+ return;
+ }
+
// ʼ
// ñ
@@ -454,340 +573,866 @@ public class DFL038Jframe extends JFrame {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
+ new Thread(new Runnable() {
+
+ @Override
+ public void run() {
+ // TODO Auto-generated method stub
+
+ ProgressBarThread progressBarThread = new ProgressBarThread("ݵ", "ݵУԵ...");
+ progressBarThread.setBool(true);
+ progressBarThread.start();
+
+// System.out.println(startDateField.getText());
+// System.out.println(endDateField.getText());
+// System.out.println(model.getElementAt(comboBox.getSelectedIndex()));
+// System.out.println(sourcefile.getText());
+ String startTime = startDateField.getText();
+ String endTime = endDateField.getText();
+ String depart = model.getElementAt(comboBox.getSelectedIndex());
+ String selectPath = sourcefile.getText();
+
+ ChangeFormBean changeFormBean = new ChangeFormBean(applyNameField.getText(),
+ changeIdField.getText(), productIdField.getText(), productModNumField.getText(),
+ clientNameField.getText(), dutyModel.getElementAt(dutyDeptBox.getSelectedIndex()),
+ dutyManField.getText(), changeTypeModel.getElementAt(changeTypeBox.getSelectedIndex()),
+ productTypeModel.getElementAt(productTypeBox.getSelectedIndex()),
+ drawChangeTypeModel.getElementAt(drawChangeTypeBox.getSelectedIndex()),
+ (String) isCostLossModel.getElementAt(isCostLossBox.getSelectedIndex()),
+ errorTypeModel.getElementAt(errorTypeBox.getSelectedIndex()));
+ String conditions = changeFormBean.generateSql();
+ String leftConditions = "D.OBJECTCODE = F.OBJECTCODE where ";
+ DataBaseControl control = new DataBaseControl("oracle.jdbc.driver.OracleDriver",
+ "jdbc:oracle:thin:@192.168.1.152:1521/plmdb", "infodba", "infodba");
+ control.openDataBase();
+
+ String colString = " F.PRODUCTDEPARTMENT,F.PRODUCTNAME,F.OBJECTCODE,F.PROJECTMODEL,F.CLIENTNAME,F.APPLYNAME,F.CHANGETYPE,F.CHANGEREASON,F.TZGGLX,F.DUTYDEPARTMENT,F.DUTYMAN,D.PH,D.PM,D.YBB,D.XBB,D.BGSL,F.PRODUCTTYPE,F.ERRORTYPE,F.PRICEBOOKING,F.SALSECLASSIFY,F.ISNOTPRODUCTLOSS,F.XMJD,F.RECEIVECLASSIFY,F.DRAWINGTO,F.PROJECTCODE,F.NOTIFYEMERGENCYPROCEDURES,F.APPLYDATE,F.ACCOUNTSET ";
+
+ // ȡҪжϵ
+
+ // Ƚнж
+ String sql1 = "select " + colString
+ + " from DFL_CHANGEFORM F LEFT OUTER JOIN DFL_CHANGEDETAILS D ON " + leftConditions
+ + " (F.OBJECTCODE like'ECN%' or F.OBJECTCODE like'QECN%') "
+ + "AND F.PRODUCTDEPARTMENT = '" + depart + "' AND "
+ + " F.APPLYDATE IS NOT NULL AND to_date(F.applydate,'yyyy-MM-dd HH24:mi:ss') >= to_date('"
+ + startTime
+ + "','yyyy-MM-dd HH24:mi:ss') AND to_date(F.applydate,'yyyy-MM-dd HH24:mi:ss') <= to_date('"
+ + endTime + "','yyyy-MM-dd HH24:mi:ss') " + conditions
+ + " order by F.PRODUCTDEPARTMENT,F.APPLYDATE";
+ if (depart == null || depart.trim().equals("")) {
+ sql1 = "select " + colString
+ + " from DFL_CHANGEFORM F LEFT OUTER JOIN DFL_CHANGEDETAILS D ON " + leftConditions
+ + " (F.OBJECTCODE like'ECN%' or F.OBJECTCODE like'QECN%') " + " AND "
+ + " F.APPLYDATE IS NOT NULL AND to_date(F.applydate,'yyyy-MM-dd HH24:mi:ss') >= to_date('"
+ + startTime
+ + "','yyyy-MM-dd HH24:mi:ss') AND to_date(F.applydate,'yyyy-MM-dd HH24:mi:ss') <= to_date('"
+ + endTime + "','yyyy-MM-dd HH24:mi:ss') " + conditions
+ + " order by F.PRODUCTDEPARTMENT,F.APPLYDATE";
+ } else if (depart != null && "ȫ".equals(depart)) {
+ sql1 = "select " + colString
+ + " from DFL_CHANGEFORM F LEFT OUTER JOIN DFL_CHANGEDETAILS D ON " + leftConditions
+ + " (F.OBJECTCODE like'ECN%' or F.OBJECTCODE like'QECN%') " + " AND "
+ + " F.APPLYDATE IS NOT NULL AND to_date(F.applydate,'yyyy-MM-dd HH24:mi:ss') >= to_date('"
+ + startTime
+ + "','yyyy-MM-dd HH24:mi:ss') AND to_date(F.applydate,'yyyy-MM-dd HH24:mi:ss') <= to_date('"
+ + endTime + "','yyyy-MM-dd HH24:mi:ss') " + conditions
+ + " order by F.PRODUCTDEPARTMENT,F.APPLYDATE";
+ }
+ System.out.println(sql1);
+
+ ResultSet dbQuery = control.dbQuery3(sql1);
+
+ String sql2 = "select count(*),CHANGETYPE,substr(applydate,0,7) as date1 FROM DFL_CHANGEFORM WHERE productdepartment='"
+ + depart
+ + "' AND (OBJECTCODE like'ECN%' or OBJECTCODE like'QECN%') AND CHANGETYPE IS NOT NULL AND applydate IS NOT NULL AND to_date(applydate,'yyyy-MM-dd HH24:mi:ss') >= to_date('"
+ + startTime
+ + "','yyyy-MM-dd HH24:mi:ss') AND to_date(applydate,'yyyy-MM-dd HH24:mi:ss') <= to_date('"
+ + endTime + "','yyyy-MM-dd HH24:mi:ss') " + conditions
+ + " group by substr(applydate,0,7),CHANGETYPE order by date1 asc";
+ if (depart == null || depart.trim().equals("")) {
+ sql2 = "select count(*),CHANGETYPE,substr(applydate,0,7) as date1 FROM DFL_CHANGEFORM WHERE (OBJECTCODE like'ECN%' or OBJECTCODE like'QECN%') AND CHANGETYPE IS NOT NULL AND applydate IS NOT NULL AND to_date(applydate,'yyyy-MM-dd HH24:mi:ss') >= to_date('"
+ + startTime
+ + "','yyyy-MM-dd HH24:mi:ss') AND to_date(applydate,'yyyy-MM-dd HH24:mi:ss') <= to_date('"
+ + endTime + "','yyyy-MM-dd HH24:mi:ss') " + conditions
+ + " group by substr(applydate,0,7),CHANGETYPE order by date1 asc";
+ } else if (depart != null && "ȫ".equals(depart)) {
+ sql2 = "select count(*),CHANGETYPE,substr(applydate,0,7) as date1 FROM DFL_CHANGEFORM WHERE (OBJECTCODE like'ECN%' or OBJECTCODE like'QECN%') AND CHANGETYPE IS NOT NULL AND applydate IS NOT NULL AND to_date(applydate,'yyyy-MM-dd HH24:mi:ss') >= to_date('"
+ + startTime
+ + "','yyyy-MM-dd HH24:mi:ss') AND to_date(applydate,'yyyy-MM-dd HH24:mi:ss') <= to_date('"
+ + endTime + "','yyyy-MM-dd HH24:mi:ss') " + conditions
+ + " group by substr(applydate,0,7),CHANGETYPE order by date1 asc";
+ }
- ProgressBarThread progressBarThread = new ProgressBarThread("ݵ", "ݵУԵ...");
- progressBarThread.setBool(true);
- progressBarThread.start();
-
-// System.out.println(startDateField.getText());
-// System.out.println(endDateField.getText());
-// System.out.println(model.getElementAt(comboBox.getSelectedIndex()));
-// System.out.println(sourcefile.getText());
- String startTime = startDateField.getText();
- String endTime = endDateField.getText();
- String depart = model.getElementAt(comboBox.getSelectedIndex());
- String selectPath = sourcefile.getText();
-
- ChangeFormBean changeFormBean = new ChangeFormBean(applyNameField.getText(), changeIdField.getText(),
- productIdField.getText(), productModNumField.getText(), clientNameField.getText(),
- dutyModel.getElementAt(dutyDeptBox.getSelectedIndex()), dutyManField.getText(),
- changeTypeModel.getElementAt(changeTypeBox.getSelectedIndex()),
- productTypeModel.getElementAt(productTypeBox.getSelectedIndex()),
- drawChangeTypeModel.getElementAt(drawChangeTypeBox.getSelectedIndex()),
- (String) isCostLossModel.getElementAt(isCostLossBox.getSelectedIndex()),
- errorTypeModel.getElementAt(errorTypeBox.getSelectedIndex()));
- String conditions = changeFormBean.generateSql();
- String leftConditions = "D.OBJECTCODE = F.OBJECTCODE where ";
- DataBaseControl control = new DataBaseControl("oracle.jdbc.driver.OracleDriver",
- "jdbc:oracle:thin:@192.168.1.138:1521/tc12", "infodba", "infodba");
- control.openDataBase();
-
- String colString = " F.PRODUCTDEPARTMENT,F.PRODUCTNAME,F.CHANGELISTCODE,F.PROJECTMODEL,F.CLIENTNAME,F.APPLYNAME,F.CHANGETYPE,F.CHANGEREASON,F.TZGGLX,F.DUTYDEPARTMENT,F.DUTYMAN,D.PH,D.PM,D.YBB,D.XBB,D.BGSL,F.PRODUCTTYPE,F.ERRORTYPE,F.PRICEBOOKING,F.SALSECLASSIFY,F.ISNOTPRODUCTLOSS,F.XMJD,F.RECEIVECLASSIFY,F.DRAWINGTO,F.PROJECTCODE,F.NOTIFYEMERGENCYPROCEDURES,F.APPLYDATE,F.ACCOUNTSET ";
-
- // ȡҪжϵ
-
- // Ƚнж
- String sql1 = "select " + colString + " from DFL_CHANGEFORM F LEFT OUTER JOIN DFL_CHANGEDETAILS D ON "
- + leftConditions + " (F.OBJECTCODE like'ECN%' or F.OBJECTCODE like'QECN%') "
- + "AND F.PRODUCTDEPARTMENT = '" + depart + "' AND "
- + " F.APPLYDATE IS NOT NULL AND to_date(F.applydate,'yyyy-MM-dd HH24:mi:ss') >= to_date('"
- + startTime
- + "','yyyy-MM-dd HH24:mi:ss') AND to_date(F.applydate,'yyyy-MM-dd HH24:mi:ss') <= to_date('"
- + endTime + "','yyyy-MM-dd HH24:mi:ss') " + conditions
- + " order by F.PRODUCTDEPARTMENT,F.APPLYDATE";
- if (depart == null || depart.trim().equals("")) {
- sql1 = "select " + colString + " from DFL_CHANGEFORM F LEFT OUTER JOIN DFL_CHANGEDETAILS D ON "
- + leftConditions + " (F.OBJECTCODE like'ECN%' or F.OBJECTCODE like'QECN%') " + " AND "
- + " F.APPLYDATE IS NOT NULL AND to_date(F.applydate,'yyyy-MM-dd HH24:mi:ss') >= to_date('"
- + startTime
- + "','yyyy-MM-dd HH24:mi:ss') AND to_date(F.applydate,'yyyy-MM-dd HH24:mi:ss') <= to_date('"
- + endTime + "','yyyy-MM-dd HH24:mi:ss') " + conditions
- + " order by F.PRODUCTDEPARTMENT,F.APPLYDATE";
- } else if (depart != null && "ȫ".equals(depart)) {
- sql1 = "select " + colString + " from DFL_CHANGEFORM F LEFT OUTER JOIN DFL_CHANGEDETAILS D ON "
- + leftConditions + " (F.OBJECTCODE like'ECN%' or F.OBJECTCODE like'QECN%') " + " AND "
- + " F.APPLYDATE IS NOT NULL AND to_date(F.applydate,'yyyy-MM-dd HH24:mi:ss') >= to_date('"
- + startTime
- + "','yyyy-MM-dd HH24:mi:ss') AND to_date(F.applydate,'yyyy-MM-dd HH24:mi:ss') <= to_date('"
- + endTime + "','yyyy-MM-dd HH24:mi:ss') " + conditions
- + " order by F.PRODUCTDEPARTMENT,F.APPLYDATE";
- }
- System.out.println(sql1);
-
- ResultSet dbQuery = control.dbQuery3(sql1);
-
- String sql2 = "select count(*),CHANGETYPE,substr(applydate,0,7) as date1 FROM DFL_CHANGEFORM WHERE productdepartment='"
- + depart
- + "' AND (OBJECTCODE like'ECN%' or OBJECTCODE like'QECN%') AND CHANGETYPE IS NOT NULL AND applydate IS NOT NULL AND to_date(applydate,'yyyy-MM-dd HH24:mi:ss') >= to_date('"
- + startTime
- + "','yyyy-MM-dd HH24:mi:ss') AND to_date(applydate,'yyyy-MM-dd HH24:mi:ss') <= to_date('"
- + endTime + "','yyyy-MM-dd HH24:mi:ss') " + conditions
- + " group by substr(applydate,0,7),CHANGETYPE order by date1 asc";
- if (depart == null || depart.trim().equals("")) {
- sql2 = "select count(*),CHANGETYPE,substr(applydate,0,7) as date1 FROM DFL_CHANGEFORM WHERE (OBJECTCODE like'ECN%' or OBJECTCODE like'QECN%') AND CHANGETYPE IS NOT NULL AND applydate IS NOT NULL AND to_date(applydate,'yyyy-MM-dd HH24:mi:ss') >= to_date('"
- + startTime
- + "','yyyy-MM-dd HH24:mi:ss') AND to_date(applydate,'yyyy-MM-dd HH24:mi:ss') <= to_date('"
- + endTime + "','yyyy-MM-dd HH24:mi:ss') " + conditions
- + " group by substr(applydate,0,7),CHANGETYPE order by date1 asc";
- } else if (depart != null && "ȫ".equals(depart)) {
- sql2 = "select count(*),CHANGETYPE,substr(applydate,0,7) as date1 FROM DFL_CHANGEFORM WHERE (OBJECTCODE like'ECN%' or OBJECTCODE like'QECN%') AND CHANGETYPE IS NOT NULL AND applydate IS NOT NULL AND to_date(applydate,'yyyy-MM-dd HH24:mi:ss') >= to_date('"
- + startTime
- + "','yyyy-MM-dd HH24:mi:ss') AND to_date(applydate,'yyyy-MM-dd HH24:mi:ss') <= to_date('"
- + endTime + "','yyyy-MM-dd HH24:mi:ss') " + conditions
- + " group by substr(applydate,0,7),CHANGETYPE order by date1 asc";
- }
- ResultSet dbQuery2 = control.dbQuery3(sql2);
-
- System.out.println(sql1);
- System.out.println(sql2);
-
-// if(dbQuery==null) {
-// MessageBox.post("ݣ", "ʾ", MessageBox.INFORMATION);
-// return;
-// }
-
- Date date = new Date();
- SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd_HHmm");
- String currentTime = df.format(date);
- String absoluteFilePath = selectPath + "\\" + "֪ͨ-" + currentTime + ".xlsx";
-// System.out.println(absoluteFilePath);
- File file = new File(absoluteFilePath);
- if (!file.exists()) {
- try {
- file.createNewFile();
-// System.out.println("111:"+file.getAbsolutePath());
- } catch (IOException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
- }
+ if (depart == null || "ȫ".equals(depart) || depart.trim().length() == 0) {
+ System.out.println("ŵ·嵥");
+ Date date = new Date();
+ SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd_HHmm");
+ String currentTime = df.format(date);
+ String absoluteFilePath = selectPath + "\\" + "֪ͨ-" + currentTime + ".xlsx";
+// System.out.println(absoluteFilePath);
+ File file = new File(absoluteFilePath);
+ if (!file.exists()) {
+ try {
+ file.createNewFile();
+// System.out.println("111:"+file.getAbsolutePath());
+ } catch (IOException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+ }
- try {
- XSSFWorkbook workbook = new XSSFWorkbook();
- XSSFCellStyle cellStyle = workbook.createCellStyle();
- cellStyle.setBorderBottom(BorderStyle.THIN); // ±߿
- cellStyle.setBorderLeft(BorderStyle.THIN);// ߿
- cellStyle.setBorderTop(BorderStyle.THIN);// ϱ߿
- cellStyle.setBorderRight(BorderStyle.THIN);// ұ߿
- cellStyle.setVerticalAlignment(VerticalAlignment.CENTER); // ֱ
- cellStyle.setAlignment(HorizontalAlignment.CENTER); // ˮƽ
- cellStyle.setWrapText(true);
- // дһԪ
- XSSFSheet sheet2 = workbook.createSheet("ϸ嵥");
-
- int i = 0;
- XSSFRow titleRow = sheet2.createRow(i);
- for (int j = 0; j < title.length; j++) {
- XSSFCell createCell = titleRow.createCell(j);
- createCell.setCellStyle(cellStyle);
- createCell.setCellValue(title[j]);
- }
- Boolean flag = false;
- Boolean isRelease = true;
- String lastChangeFormId = null;
- while (dbQuery.next()) {
- i++;
- XSSFRow Row = sheet2.createRow(i);
- String changeFormId = dbQuery.getString(3);
- if (changeFormId != null && !changeFormId.equals(lastChangeFormId)) {
- List queryObject = queryObject(" ID", new String[] { " ID" },
- new String[] { changeFormId });
- System.out.println(changeFormId);
- if (queryObject != null && queryObject.size() > 0) {
- TCComponent component = queryObject.get(0);
- AIFComponentContext[] versions = component.getChildren("revision_list");
- TCComponent versionComponent = (TCComponent) versions[0].getComponent();
- TCProperty tcProperty = versionComponent.getTCProperty("release_status_list");
- TCComponent[] releases = tcProperty.getReferenceValueArray();
- if (releases == null || releases.length <= 0) {
- isRelease = false;
+ try {
+ XSSFWorkbook workbook = new XSSFWorkbook();
+ XSSFCellStyle cellStyle = workbook.createCellStyle();
+ cellStyle.setBorderBottom(BorderStyle.THIN); // ±߿
+ cellStyle.setBorderLeft(BorderStyle.THIN);// ߿
+ cellStyle.setBorderTop(BorderStyle.THIN);// ϱ߿
+ cellStyle.setBorderRight(BorderStyle.THIN);// ұ߿
+ cellStyle.setVerticalAlignment(VerticalAlignment.CENTER); // ֱ
+ cellStyle.setAlignment(HorizontalAlignment.CENTER); // ˮƽ
+ cellStyle.setWrapText(true);
+ // дһԪ
+ XSSFSheet sheet2 = workbook.createSheet("ϸ嵥");
+
+ int i = 0;
+ XSSFRow titleRow = sheet2.createRow(i);
+ for (int j = 0; j < title.length; j++) {
+ XSSFCell createCell = titleRow.createCell(j);
+ createCell.setCellStyle(cellStyle);
+ createCell.setCellValue(title[j]);
+ }
+
+
+ String lastChangeFormId = null;
+ Boolean isRelease = false;
+ while (dbQuery.next()) {
+
+ i++;
+ XSSFRow Row = sheet2.createRow(i);
+ String changeFormId = dbQuery.getString(3).substring(0,dbQuery.getString(3).indexOf("/"));
+ if (changeFormId != null && !changeFormId.equals(lastChangeFormId)) {
+ List queryObject = queryObject(" ID", new String[] { " ID" },
+ new String[] { changeFormId });
+ System.out.println(changeFormId);
+ if (queryObject != null && queryObject.size() > 0) {
+ TCComponent component = queryObject.get(0);
+ AIFComponentContext[] versions = component.getChildren("revision_list");
+ TCComponent versionComponent = (TCComponent) versions[0].getComponent();
+ TCProperty tcProperty = versionComponent
+ .getTCProperty("release_status_list");
+ TCComponent[] releases = tcProperty.getReferenceValueArray();
+ if (releases != null && releases.length > 0) {
+ isRelease = true;
+ }else {
+ isRelease = false;
+ }
+ }
+ }
+
+ for (int j = 0; j < title.length - 1; j++) {
+ XSSFCell createCell = Row.createCell(j);
+ createCell.setCellStyle(cellStyle);
+ createCell.setCellValue(dbQuery.getString(j + 1));
+ if (j == title.length - 2) {
+ createCell = Row.createCell(j + 1);
+ createCell.setCellStyle(cellStyle);
+ createCell.setCellValue(isRelease ? "ѷ" : "δ");
+ }
+ }
+ }
+
+ // дڶԪ
+ // ͷ
+// for (int ct = 0; ct <= departs.length; ct++) {
+// if (ct == departs.length) {
+// sql2 = "select count(*),CHANGETYPE,substr(applydate,0,7) as date1 FROM DFL_CHANGEFORM WHERE (OBJECTCODE like'ECN%' or OBJECTCODE like'QECN%') AND CHANGETYPE IS NOT NULL AND applydate IS NOT NULL AND to_date(applydate,'yyyy-MM-dd HH24:mi:ss') >= to_date('"
+// + startTime
+// + "','yyyy-MM-dd HH24:mi:ss') AND to_date(applydate,'yyyy-MM-dd HH24:mi:ss') <= to_date('"
+// + endTime + "','yyyy-MM-dd HH24:mi:ss') " + conditions
+// + " group by substr(applydate,0,7),CHANGETYPE order by date1 asc";
+// System.out.println("·ݻ嵥sql=>:" + sql2);
+// } else if ("ȫ".equals(departs[ct])) {
+// continue;
+// } else {
+// sql2 = "select count(*),CHANGETYPE,substr(applydate,0,7) as date1 FROM DFL_CHANGEFORM WHERE productdepartment='"
+// + departs[ct].trim()
+// + "' AND (OBJECTCODE like'ECN%' or OBJECTCODE like'QECN%') AND CHANGETYPE IS NOT NULL AND applydate IS NOT NULL AND to_date(applydate,'yyyy-MM-dd HH24:mi:ss') >= to_date('"
+// + startTime
+// + "','yyyy-MM-dd HH24:mi:ss') AND to_date(applydate,'yyyy-MM-dd HH24:mi:ss') <= to_date('"
+// + endTime + "','yyyy-MM-dd HH24:mi:ss') " + conditions
+// + " group by substr(applydate,0,7),CHANGETYPE order by date1 asc";
+// System.out.println(departs[ct] + "sql=>:" + sql2);
+// }
+//
+// ResultSet dbQuery2 = control.dbQuery3(sql2);
+// XSSFSheet sheet1 = null;
+// if (ct == departs.length) {
+// sheet1 = workbook.createSheet("·嵥");
+// } else {
+// System.out.println(departs[ct] + "·嵥");
+// sheet1 = workbook.createSheet(departs[ct] + "·嵥");
+// }
+// XSSFRow titleRow2 = sheet1.createRow(0);
+// for (int j = 0; j < changeType.length; j++) {
+// XSSFCell createCell = titleRow2.createCell(j + 1);
+// createCell.setCellStyle(cellStyle);
+// createCell.setCellValue(changeType[j]);
+// }
+// Set set = new HashSet();
+//
+// int db2 = 0;
+//
+// while (dbQuery2.next()) {
+// set.add(dbQuery2.getString(3));
+// db2++;
+// }
+// System.out.println(set.size());
+// if (set.size() == 0) {
+// continue;
+// }
+// dbQuery2.first();
+// dbQuery2.previous();
+//
+// ArrayList list = new ArrayList();
+// for (String string2 : set) {
+// list.add(string2);
+// }
+//
+//// Collections.sort(list,new MyComparator());
+// Collections.sort(list);
+//
+// // ͷ
+//
+// XSSFRow[] rows = new XSSFRow[list.size()];
+// for (int j = 0; j < list.size(); j++) {
+// rows[j] = sheet1.createRow(j + 1);
+// XSSFCell createCell = rows[j].createCell(0);
+// createCell.setCellStyle(cellStyle);
+// createCell.setCellValue(list.get(j).endsWith("-")
+// ? list.get(j).substring(0, list.get(j).length() - 1)
+// : list.get(j));
+// }
+//
+// // ʼÿеĺϼ
+//
+// int num[] = new int[changeType.length];
+// for (int j = 0; j < changeType.length; j++) {
+// num[j] = 0;
+// }
+//
+// for (int rowNum = 1; rowNum <= list.size(); rowNum++) {
+// for (int colNum = 1; colNum <= changeType.length; colNum++) {
+// XSSFCell createCell = rows[rowNum - 1].createCell(colNum);
+// createCell.setCellStyle(cellStyle);
+// createCell.setCellValue(0);
+// }
+// }
+//
+// System.out.println(dbQuery2.getRow() + "--1--" + changeType.length);
+// int[][] CTN = new int[list.size()][changeType.length];
+// int[] countNum = null;
+// int countYear = 0;
+// String year = list.get(0).substring(0, 4);
+// int rowY = 0;
+// int lastRN = list.size() + 1;
+// int current = 0;
+// if(flag) {
+// while (dbQuery2.next()) {
+// current++;
+// for (int j = 0; j < list.size(); j++) {
+//
+// if (dbQuery2.getString(3).equals(list.get(j))) {
+// System.out.println(dbQuery2.getString(3));
+// for (int n = 0; n < changeType.length; n++) {
+// System.out.println(dbQuery2.getString(2) + "===" + changeType[n]);
+// if (dbQuery2.getString(2) != null
+// && dbQuery2.getString(2).equals(changeType[n])) {
+// XSSFCell createCell = rows[j].createCell(n + 1);
+// createCell.setCellStyle(cellStyle);
+// createCell.setCellValue(dbQuery2.getString(1));
+// num[n] += Integer.parseInt(dbQuery2.getString(1));
+// if (!year.equals(rows[j].getCell(0).getStringCellValue()
+// .substring(0, 4))) {
+// System.out.println(list);
+// System.out.println(year);
+// XSSFRow row = sheet1.createRow(lastRN++);
+// XSSFCell cell = row.createCell(0);
+// cell.setCellStyle(cellStyle);
+// cell.setCellValue(year + "ϼ:");
+// year = rows[j].getCell(0).getStringCellValue().substring(0,
+// 4);
+// System.out.println("after" + year);
+// for (int o = 0; o < changeType.length; o++) {
+// cell = row.createCell(o + 1);
+// cell.setCellStyle(cellStyle);
+// cell.setCellValue(CTN[j - 1][o]);
+// }
+// cell = row.createCell(changeType.length + 1);
+// cell.setCellStyle(cellStyle);
+// cell.setCellValue(getArrayCount(CTN[j - 1]));
+// countNum = arrayAdd(CTN[j - 1], countNum);
+//
+// // sheet1.shiftRows(j, lastRN-1, 1, true, false);
+// }
+// }
+// }
+// for (int n = 0; n < changeType.length; n++) {
+// CTN[j][n] = num[n];
+// }
+// }
+//
+// }
+// if (current == db2) {
+// if (countNum != null) {
+// XSSFRow row = sheet1.createRow(lastRN++);
+// XSSFCell cell = row.createCell(0);
+// cell.setCellStyle(cellStyle);
+// cell.setCellValue(list.get(list.size() - 1).substring(0, 4) + "ϼ:");
+// for (int o = 0; o < changeType.length; o++) {
+// cell = row.createCell(o + 1);
+// cell.setCellStyle(cellStyle);
+// System.out.println("cell=>" + (null == cell));
+// System.out.println(
+// "CTN[CTN.length-1]=>" + (null == CTN[CTN.length - 1]));
+// System.out
+// .println("CTN[CTN.length-1][o]=>" + CTN[CTN.length - 1][o]);
+// System.out.println("countNum[o]=>" + countNum[o]);
+// cell.setCellValue(CTN[CTN.length - 1][o] - countNum[o]);
+// }
+// cell = row.createCell(changeType.length + 1);
+// cell.setCellStyle(cellStyle);
+// cell.setCellValue(
+// getArrayCount(CTN[CTN.length - 1]) - getArrayCount(countNum));
+// }
+//
+// XSSFRow row = sheet1.createRow(lastRN++);
+// XSSFCell cell = row.createCell(0);
+// cell.setCellStyle(cellStyle);
+// cell.setCellValue("ϼ:");
+// for (int o = 0; o < changeType.length; o++) {
+// cell = row.createCell(o + 1);
+// cell.setCellStyle(cellStyle);
+// cell.setCellValue(CTN[CTN.length - 1][o]);
+// }
+// cell = row.createCell(changeType.length + 1);
+// cell.setCellStyle(cellStyle);
+// cell.setCellValue(getArrayCount(CTN[CTN.length - 1]));
+// }
+// }
+// }else {
+// List countBeans = new ArrayList();
+// for (String changetype : changeType) {
+// for (String date1 : list) {
+// countBeans.add(new CountBean(changetype, 0, date1));
+// }
+// }
+//
+// while(dbQuery2.next()) {
+// for (CountBean countBean : countBeans) {
+// if(dbQuery2.getString(3).equals(countBean.getDate()) && dbQuery2.getString(2).contains(countBean.getType())) {
+// countBean.setCount(countBean.getCount()+Integer.parseInt(dbQuery2.getString(1)));
+// }
+// }
+// }
+//
+//
+// db2 = countBeans.size();
+// Iterator iterator = countBeans.iterator();
+//
+// while (iterator.hasNext()) {
+// CountBean bean = (CountBean)iterator.next();
+// current++;
+// for (int j = 0; j < list.size(); j++) {
+//
+// if (bean.getDate().equals(list.get(j))) {
+// System.out.println(bean.getDate());
+// for (int n = 0; n < changeType.length; n++) {
+// System.out.println(bean.getType() +"==="+bean.getCount()+"===" + changeType[n]);
+// if (bean.getType() != null
+// && bean.getType().equals(changeType[n])) {
+// XSSFCell createCell = rows[j].createCell(n + 1);
+// createCell.setCellStyle(cellStyle);
+// createCell.setCellValue(bean.getCount());
+// num[n] += bean.getCount();
+// if (!year.equals(rows[j].getCell(0).getStringCellValue()
+// .substring(0, 4))) {
+// System.out.println(list);
+// System.out.println(year);
+// XSSFRow row = sheet1.createRow(lastRN++);
+// XSSFCell cell = row.createCell(0);
+// cell.setCellStyle(cellStyle);
+// cell.setCellValue(year + "ϼ:");
+// year = rows[j].getCell(0).getStringCellValue().substring(0,
+// 4);
+// System.out.println("after" + year);
+// for (int o = 0; o < changeType.length; o++) {
+// cell = row.createCell(o + 1);
+// cell.setCellStyle(cellStyle);
+// cell.setCellValue(CTN[j - 1][o]);
+// }
+// cell = row.createCell(changeType.length + 1);
+// cell.setCellStyle(cellStyle);
+// cell.setCellValue(getArrayCount(CTN[j - 1]));
+// countNum = arrayAdd(CTN[j - 1], countNum);
+//
+// // sheet1.shiftRows(j, lastRN-1, 1, true, false);
+// }
+// }
+// }
+// for (int n = 0; n < changeType.length; n++) {
+// CTN[j][n] = num[n];
+// }
+// }
+//
+// }
+// if (current == db2) {
+// if (countNum != null) {
+// XSSFRow row = sheet1.createRow(lastRN++);
+// XSSFCell cell = row.createCell(0);
+// cell.setCellStyle(cellStyle);
+// cell.setCellValue(list.get(list.size() - 1).substring(0, 4) + "ϼ:");
+// for (int o = 0; o < changeType.length; o++) {
+// cell = row.createCell(o + 1);
+// cell.setCellStyle(cellStyle);
+// System.out.println("cell=>" + (null == cell));
+// System.out.println(
+// "CTN[CTN.length-1]=>" + (null == CTN[CTN.length - 1]));
+// System.out
+// .println("CTN[CTN.length-1][o]=>" + CTN[CTN.length - 1][o]);
+// System.out.println("countNum[o]=>" + countNum[o]);
+// cell.setCellValue(CTN[CTN.length - 1][o] - countNum[o]);
+// }
+// cell = row.createCell(changeType.length + 1);
+// cell.setCellStyle(cellStyle);
+// cell.setCellValue(
+// getArrayCount(CTN[CTN.length - 1]) - getArrayCount(countNum));
+// }
+//
+// XSSFRow row = sheet1.createRow(lastRN++);
+// XSSFCell cell = row.createCell(0);
+// cell.setCellStyle(cellStyle);
+// cell.setCellValue("ϼ:");
+// System.out.println("ϼ");
+// for (int o = 0; o < changeType.length; o++) {
+// cell = row.createCell(o + 1);
+// cell.setCellStyle(cellStyle);
+// cell.setCellValue(CTN[CTN.length - 1][o]);
+// }
+// cell = row.createCell(changeType.length + 1);
+// cell.setCellStyle(cellStyle);
+// cell.setCellValue(getArrayCount(CTN[CTN.length - 1]));
+// }
+// }
+// }
+//
+// for (int p = 0; p < list.size(); p++) {
+// System.out.println(Arrays.toString(CTN[p]));
+// }
+// }
+
+ FileOutputStream fos = FileUtils.openOutputStream(new File(absoluteFilePath));
+ workbook.write(fos);
+ if (fos != null) {
+ fos.close();
}
+
+ } catch (Exception e2) {
+ // TODO Auto-generated catch block
+ e2.printStackTrace();
+ }
+
+ control.closeDataBase();
+
+ try {
+ merge(absoluteFilePath);
+ } catch (Exception e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
}
+
+// try {
+//
+// File countFile = new File(absoluteFilePath);
+// FileInputStream fis = FileUtils.openInputStream(countFile);
+// XSSFWorkbook workbook = new XSSFWorkbook(fis);
+// XSSFCellStyle cellStyle = workbook.createCellStyle();
+// cellStyle.setBorderBottom(BorderStyle.THIN); // ±߿
+// cellStyle.setBorderLeft(BorderStyle.THIN);// ߿
+// cellStyle.setBorderTop(BorderStyle.THIN);// ϱ߿
+// cellStyle.setBorderRight(BorderStyle.THIN);// ұ߿
+// cellStyle.setVerticalAlignment(VerticalAlignment.CENTER); // ֱ
+// cellStyle.setAlignment(HorizontalAlignment.CENTER); // ˮƽ
+// cellStyle.setWrapText(true);
+//
+// ArrayList list = new ArrayList();
+//
+// for (int cn = 0; cn <= departs.length; cn++) {
+// XSSFSheet sheet = null;
+// int sheetLastRow = -1;
+// String departStr = null;
+// if (cn == departs.length) {
+// sheet = workbook.getSheet("·嵥");
+// System.out.println("·嵥=>l:" + sheet.getLastRowNum());
+// if (sheet.getLastRowNum() == 0) {
+// continue;
+// }
+// Bean bean = new Bean();
+// ArrayList list1 = new ArrayList();
+// bean.setDepartName("ȫ");
+//
+// for (int i = 1; i <= sheet.getLastRowNum(); i++) {
+// XSSFRow row = sheet.getRow(i);
+// String[] arr = new String[row.getLastCellNum()];
+// for (int j = 0; j < row.getLastCellNum(); j++) {
+// arr[j] = ExcelUtil.getFormatterValue(row.getCell(j));
+// }
+// list1.add(arr);
+// }
+// bean.setList(list1);
+// list.add(bean);
+//
+// } else if ("ȫ".equals(departs[cn])) {
+// System.out.println("ȫ");
+// continue;
+// } else {
+// sheet = workbook.getSheet(departs[cn] + "·嵥");
+// System.out.println(departs[cn] + "·嵥=>l:" + sheet.getLastRowNum());
+// if (sheet.getLastRowNum() == 0) {
+// continue;
+// }
+// Bean bean = new Bean();
+// ArrayList list1 = new ArrayList();
+// bean.setDepartName(departs[cn]);
+//
+// for (int i = 1; i <= sheet.getLastRowNum(); i++) {
+// XSSFRow row = sheet.getRow(i);
+// String[] arr = new String[row.getLastCellNum()];
+// for (int j = 0; j < row.getLastCellNum(); j++) {
+// arr[j] = ExcelUtil.getFormatterValue(row.getCell(j));
+// }
+// list1.add(arr);
+// }
+// bean.setList(list1);
+// list.add(bean);
+// }
+// }
+// for (int i = 0; i < list.size(); i++) {
+// System.out.println(list.get(i).getDepartName());
+// for (String[] str : list.get(i).getList()) {
+// System.out.println(Arrays.toString(str));
+// }
+// }
+//
+// XSSFSheet countSheet = workbook.createSheet("ϲ嵥");
+// //
+// XSSFRow titleRow = countSheet.createRow(0);
+// for (int i = 0; i < changeType.length; i++) {
+// XSSFCell cell = titleRow.createCell(i + 2);
+// cell.setCellStyle(cellStyle);
+// cell.setCellValue(changeType[i]);
+// }
+// //
+//
+// int lastDepartRowNum = 0;
+// for (int i = 0; i < list.size(); i++) {
+// Bean bean = list.get(i);
+// String departName = bean.getDepartName();
+// ArrayList departArrayList = bean.getList();
+// for (int j = 0; j < departArrayList.size(); j++) {
+// String[] rowStrs = departArrayList.get(j);
+// XSSFRow row = countSheet.createRow(j + 1 + lastDepartRowNum);
+// XSSFCell cell = row.createCell(0);
+// cell.setCellStyle(cellStyle);
+// cell.setCellValue(departName);
+// for (int n = 0; n < rowStrs.length; n++) {
+// XSSFCell cell2 = row.createCell(n + 1);
+// cell2.setCellStyle(cellStyle);
+// cell2.setCellValue(rowStrs[n]);
+// }
+// }
+// lastDepartRowNum += departArrayList.size();
+// }
+// FileOutputStream fos = FileUtils.openOutputStream(countFile);
+// workbook.write(fos);
+//
+// if (fis != null) {
+// fis.close();
+// }
+// if (fos != null) {
+// fos.close();
+// }
+//
+// } catch (IOException e) {
+// // TODO Auto-generated catch block
+// e.printStackTrace();
+// }
+
+ System.out.println("");
+
+ setVisible(false);
+ progressBarThread.setBool(false);
+ progressBarThread.interrupt();
+ MessageBox.post("ɣ", "ʾ", MessageBox.INFORMATION);
+ return;
}
- for (int j = 0; j < title.length - 1; j++) {
- XSSFCell createCell = Row.createCell(j);
- createCell.setCellStyle(cellStyle);
- createCell.setCellValue(dbQuery.getString(j + 1));
- if (j == title.length - 2) {
- createCell = Row.createCell(j + 1);
- createCell.setCellStyle(cellStyle);
- createCell.setCellValue(isRelease ? "ѷ" : "δ");
+ ResultSet dbQuery2 = control.dbQuery3(sql2);
+
+ System.out.println(sql1);
+ System.out.println(sql2);
+
+// if(dbQuery==null) {
+// MessageBox.post("ݣ", "ʾ", MessageBox.INFORMATION);
+// return;
+// }
+
+ Date date = new Date();
+ SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd_HHmm");
+ String currentTime = df.format(date);
+ String absoluteFilePath = selectPath + "\\" + "֪ͨ-" + currentTime + ".xlsx";
+// System.out.println(absoluteFilePath);
+ File file = new File(absoluteFilePath);
+ if (!file.exists()) {
+ try {
+ file.createNewFile();
+// System.out.println("111:"+file.getAbsolutePath());
+ } catch (IOException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
}
}
- }
- // дڶԪ
- // ͷ
- XSSFSheet sheet1 = workbook.createSheet("·嵥");
- XSSFRow titleRow2 = sheet1.createRow(0);
- for (int j = 0; j < changeType.length; j++) {
- XSSFCell createCell = titleRow2.createCell(j + 1);
- createCell.setCellStyle(cellStyle);
- createCell.setCellValue(changeType[j]);
- }
- Set set = new HashSet();
+ try {
+ XSSFWorkbook workbook = new XSSFWorkbook();
+ XSSFCellStyle cellStyle = workbook.createCellStyle();
+ cellStyle.setBorderBottom(BorderStyle.THIN); // ±߿
+ cellStyle.setBorderLeft(BorderStyle.THIN);// ߿
+ cellStyle.setBorderTop(BorderStyle.THIN);// ϱ߿
+ cellStyle.setBorderRight(BorderStyle.THIN);// ұ߿
+ cellStyle.setVerticalAlignment(VerticalAlignment.CENTER); // ֱ
+ cellStyle.setAlignment(HorizontalAlignment.CENTER); // ˮƽ
+ cellStyle.setWrapText(true);
+ // дһԪ
+ XSSFSheet sheet2 = workbook.createSheet("ϸ嵥");
+
+ int i = 0;
+ XSSFRow titleRow = sheet2.createRow(i);
+ for (int j = 0; j < title.length; j++) {
+ XSSFCell createCell = titleRow.createCell(j);
+ createCell.setCellStyle(cellStyle);
+ createCell.setCellValue(title[j]);
+ }
+
+ Boolean isRelease = true;
+ String lastChangeFormId = null;
+ while (dbQuery.next()) {
+ i++;
+ XSSFRow Row = sheet2.createRow(i);
+ String changeFormId = dbQuery.getString(3);
+ if (changeFormId != null && !changeFormId.equals(lastChangeFormId)) {
+ List queryObject = queryObject(" ID", new String[] { " ID" },
+ new String[] { changeFormId });
+ System.out.println(changeFormId);
+ if (queryObject != null && queryObject.size() > 0) {
+ TCComponent component = queryObject.get(0);
+ AIFComponentContext[] versions = component.getChildren("revision_list");
+ TCComponent versionComponent = (TCComponent) versions[0].getComponent();
+ TCProperty tcProperty = versionComponent.getTCProperty("release_status_list");
+ TCComponent[] releases = tcProperty.getReferenceValueArray();
+ if (releases == null || releases.length <= 0) {
+ isRelease = false;
+ }
+ }
+ }
- int db2 = 0;
-
- while (dbQuery2.next()) {
- set.add(dbQuery2.getString(3));
- db2++;
- }
- dbQuery2.first();
- dbQuery2.previous();
+ for (int j = 0; j < title.length - 1; j++) {
+ XSSFCell createCell = Row.createCell(j);
+ createCell.setCellStyle(cellStyle);
+ createCell.setCellValue(dbQuery.getString(j + 1));
+ if (j == title.length - 2) {
+ createCell = Row.createCell(j + 1);
+ createCell.setCellStyle(cellStyle);
+ createCell.setCellValue(isRelease ? "ѷ" : "δ");
+ }
+ }
+ }
- ArrayList list = new ArrayList();
- for (String string2 : set) {
- list.add(string2);
- }
+ // дڶԪ
+ // ͷ
+ XSSFSheet sheet1 = workbook.createSheet("·嵥");
+ XSSFRow titleRow2 = sheet1.createRow(0);
+ for (int j = 0; j < changeType.length; j++) {
+ XSSFCell createCell = titleRow2.createCell(j + 1);
+ createCell.setCellStyle(cellStyle);
+ createCell.setCellValue(changeType[j]);
+ }
+ Set set = new HashSet();
-// Collections.sort(list,new MyComparator());
- Collections.sort(list);
+ int db2 = 0;
- // ͷ
+ while (dbQuery2.next()) {
+ set.add(dbQuery2.getString(3));
+ db2++;
+ }
+ dbQuery2.first();
+ dbQuery2.previous();
- XSSFRow[] rows = new XSSFRow[list.size()];
- for (int j = 0; j < list.size(); j++) {
- rows[j] = sheet1.createRow(j + 1);
- XSSFCell createCell = rows[j].createCell(0);
- createCell.setCellStyle(cellStyle);
- createCell.setCellValue(
- list.get(j).endsWith("-") ? list.get(j).substring(0, list.get(j).length() - 1)
- : list.get(j));
- }
+ ArrayList list = new ArrayList();
+ for (String string2 : set) {
+ list.add(string2);
+ }
- // ʼÿеĺϼ
+// Collections.sort(list,new MyComparator());
+ Collections.sort(list);
- int num[] = new int[changeType.length];
- for (int j = 0; j < changeType.length; j++) {
- num[j] = 0;
- }
+ // ͷ
- for (int rowNum = 1; rowNum <= list.size(); rowNum++) {
- for (int colNum = 1; colNum <= changeType.length; colNum++) {
- XSSFCell createCell = rows[rowNum - 1].createCell(colNum);
- createCell.setCellStyle(cellStyle);
- createCell.setCellValue(0);
- }
- }
+ XSSFRow[] rows = new XSSFRow[list.size()];
+ for (int j = 0; j < list.size(); j++) {
+ rows[j] = sheet1.createRow(j + 1);
+ XSSFCell createCell = rows[j].createCell(0);
+ createCell.setCellStyle(cellStyle);
+ createCell.setCellValue(
+ list.get(j).endsWith("-") ? list.get(j).substring(0, list.get(j).length() - 1)
+ : list.get(j));
+ }
- System.out.println(dbQuery2.getRow() + "--1--" + changeType.length);
- int[][] CTN = new int[list.size()][changeType.length];
- int[] countNum = null;
- int countYear = 0;
- String year = list.get(0).substring(0, 4);
- int rowY = 0;
- int lastRN = list.size() + 1;
- int current = 0;
- while (dbQuery2.next()) {
- current++;
- for (int j = 0; j < list.size(); j++) {
-
- if (dbQuery2.getString(3).equals(list.get(j))) {
- System.out.println(dbQuery2.getString(3));
- for (int n = 0; n < changeType.length; n++) {
- System.out.println(dbQuery2.getString(2) + "===" + changeType[n]);
- if (dbQuery2.getString(2) != null && dbQuery2.getString(2).equals(changeType[n])) {
- XSSFCell createCell = rows[j].createCell(n + 1);
- createCell.setCellStyle(cellStyle);
- createCell.setCellValue(dbQuery2.getString(1));
- num[n] += Integer.parseInt(dbQuery2.getString(1));
- if (!year.equals(rows[j].getCell(0).getStringCellValue().substring(0, 4))) {
- System.out.println(list);
- System.out.println(year);
- XSSFRow row = sheet1.createRow(lastRN++);
- XSSFCell cell = row.createCell(0);
- cell.setCellStyle(cellStyle);
- cell.setCellValue(year + "ϼ:");
- year = rows[j].getCell(0).getStringCellValue().substring(0, 4);
- System.out.println("after" + year);
- for (int o = 0; o < changeType.length; o++) {
- cell = row.createCell(o + 1);
- cell.setCellStyle(cellStyle);
- cell.setCellValue(CTN[j - 1][o]);
+ // ʼÿеĺϼ
+
+ int num[] = new int[changeType.length];
+ for (int j = 0; j < changeType.length; j++) {
+ num[j] = 0;
+ }
+
+ for (int rowNum = 1; rowNum <= list.size(); rowNum++) {
+ for (int colNum = 1; colNum <= changeType.length; colNum++) {
+ XSSFCell createCell = rows[rowNum - 1].createCell(colNum);
+ createCell.setCellStyle(cellStyle);
+ createCell.setCellValue(0);
+ }
+ }
+
+ System.out.println(dbQuery2.getRow() + "--1--" + changeType.length);
+ int[][] CTN = new int[list.size()][changeType.length];
+ int[] countNum = null;
+ int countYear = 0;
+ String year = list.get(0).substring(0, 4);
+ int rowY = 0;
+ int lastRN = list.size() + 1;
+ int current = 0;
+ while (dbQuery2.next()) {
+ current++;
+ for (int j = 0; j < list.size(); j++) {
+
+ if (dbQuery2.getString(3).equals(list.get(j))) {
+ System.out.println(dbQuery2.getString(3));
+ for (int n = 0; n < changeType.length; n++) {
+ System.out.println(dbQuery2.getString(2) + "===" +dbQuery2.getString(1)+ "===" + changeType[n]);
+ if (dbQuery2.getString(2) != null
+ && flag?dbQuery2.getString(2).equals(changeType[n]):dbQuery2.getString(2).contains(changeType[n])) {
+ XSSFCell createCell = rows[j].createCell(n + 1);
+ createCell.setCellStyle(cellStyle);
+ createCell.setCellValue(dbQuery2.getString(1));
+ num[n] += Integer.parseInt(dbQuery2.getString(1));
+ if (!year.equals(
+ rows[j].getCell(0).getStringCellValue().substring(0, 4))) {
+ System.out.println(list);
+ System.out.println(year);
+ XSSFRow row = sheet1.createRow(lastRN++);
+ XSSFCell cell = row.createCell(0);
+ cell.setCellStyle(cellStyle);
+ cell.setCellValue(year + "ϼ:");
+ year = rows[j].getCell(0).getStringCellValue().substring(0, 4);
+ System.out.println("after" + year);
+ for (int o = 0; o < changeType.length; o++) {
+ cell = row.createCell(o + 1);
+ cell.setCellStyle(cellStyle);
+ cell.setCellValue(CTN[j - 1][o]);
+ }
+ cell = row.createCell(changeType.length + 1);
+ cell.setCellStyle(cellStyle);
+ cell.setCellValue(getArrayCount(CTN[j - 1]));
+ countNum = arrayAdd(CTN[j - 1], countNum);
+
+ // sheet1.shiftRows(j, lastRN-1, 1, true, false);
+ }
}
- cell = row.createCell(changeType.length + 1);
- cell.setCellStyle(cellStyle);
- cell.setCellValue(getArrayCount(CTN[j - 1]));
- countNum = arrayAdd(CTN[j - 1], countNum);
-
- // sheet1.shiftRows(j, lastRN-1, 1, true, false);
+ }
+ for (int n = 0; n < changeType.length; n++) {
+ CTN[j][n] = num[n];
}
}
+
}
- for (int n = 0; n < changeType.length; n++) {
- CTN[j][n] = num[n];
- }
- }
+ if (current == db2) {
+ if (countNum != null) {
+ XSSFRow row = sheet1.createRow(lastRN++);
+ XSSFCell cell = row.createCell(0);
+ cell.setCellStyle(cellStyle);
+ cell.setCellValue(list.get(list.size() - 1).substring(0, 4) + "ϼ:");
+ for (int o = 0; o < changeType.length; o++) {
+ cell = row.createCell(o + 1);
+ cell.setCellStyle(cellStyle);
+ System.out.println("cell=>" + (null == cell));
+ System.out.println("CTN[CTN.length-1]=>" + (null == CTN[CTN.length - 1]));
+ System.out.println("CTN[CTN.length-1][o]=>" + CTN[CTN.length - 1][o]);
+ System.out.println("countNum[o]=>" + countNum[o]);
+ cell.setCellValue(CTN[CTN.length - 1][o] - countNum[o]);
+ }
+ cell = row.createCell(changeType.length + 1);
+ cell.setCellStyle(cellStyle);
+ cell.setCellValue(getArrayCount(CTN[CTN.length - 1]) - getArrayCount(countNum));
+ }
- }
- if(current == db2) {
- if(countNum!=null) {
- XSSFRow row = sheet1.createRow(lastRN++);
- XSSFCell cell = row.createCell(0);
- cell.setCellStyle(cellStyle);
- cell.setCellValue(list.get(list.size()-1).substring(0,4)+"ϼ:");
- for (int o = 0; o < changeType.length; o++) {
- cell = row.createCell(o + 1);
+ XSSFRow row = sheet1.createRow(lastRN++);
+ XSSFCell cell = row.createCell(0);
+ cell.setCellStyle(cellStyle);
+ cell.setCellValue("ϼ:");
+ for (int o = 0; o < changeType.length; o++) {
+ cell = row.createCell(o + 1);
+ cell.setCellStyle(cellStyle);
+ cell.setCellValue(CTN[CTN.length - 1][o]);
+ }
+ cell = row.createCell(changeType.length + 1);
cell.setCellStyle(cellStyle);
- System.out.println("cell=>"+(null==cell));
- System.out.println("CTN[CTN.length-1]=>"+(null==CTN[CTN.length-1]));
- System.out.println("CTN[CTN.length-1][o]=>"+CTN[CTN.length-1][o]);
- System.out.println("countNum[o]=>"+countNum[o]);
- cell.setCellValue(CTN[CTN.length-1][o]-countNum[o]);
+ cell.setCellValue(getArrayCount(CTN[CTN.length - 1]));
}
- cell = row.createCell(changeType.length + 1);
- cell.setCellStyle(cellStyle);
- cell.setCellValue(getArrayCount(CTN[CTN.length-1])-getArrayCount(countNum));
}
-
- XSSFRow row = sheet1.createRow(lastRN++);
- XSSFCell cell = row.createCell(0);
- cell.setCellStyle(cellStyle);
- cell.setCellValue("ϼ:");
- for (int o = 0; o < changeType.length; o++) {
- cell = row.createCell(o + 1);
- cell.setCellStyle(cellStyle);
- cell.setCellValue(CTN[CTN.length-1][o]);
+
+ for (int p = 0; p < list.size(); p++) {
+ System.out.println(Arrays.toString(CTN[p]));
}
- cell = row.createCell(changeType.length + 1);
- cell.setCellStyle(cellStyle);
- cell.setCellValue(getArrayCount(CTN[CTN.length-1]));
- }
- }
- for (int p = 0; p < list.size(); p++) {
- System.out.println(Arrays.toString(CTN[p]));
- }
+ FileOutputStream fos = FileUtils.openOutputStream(new File(absoluteFilePath));
+ workbook.write(fos);
+ if (fos != null) {
+ fos.close();
+ }
- FileOutputStream fos = FileUtils.openOutputStream(new File(absoluteFilePath));
- workbook.write(fos);
- if (fos != null) {
- fos.close();
- }
+ } catch (Exception e2) {
+ // TODO Auto-generated catch block
+ e2.printStackTrace();
+ }
- } catch (Exception e2) {
- // TODO Auto-generated catch block
- e2.printStackTrace();
- }
+ control.closeDataBase();
- control.closeDataBase();
+ try {
+ merge(absoluteFilePath);
+ } catch (Exception e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
- try {
- merge(absoluteFilePath);
- } catch (Exception e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
+ System.out.println("");
- System.out.println("");
+ progressBarThread.setBool(false);
+ progressBarThread.interrupt();
+ MessageBox.post("ɣ", "ʾ", MessageBox.INFORMATION);
+ }
+ }).start();
setVisible(false);
- progressBarThread.setBool(false);
- progressBarThread.interrupt();
- MessageBox.post("ɣ", "ʾ", MessageBox.INFORMATION);
-
}
});
@@ -978,7 +1623,7 @@ public class DFL038Jframe extends JFrame {
CellRangeAddress region = new CellRangeAddress(startRow, i - 1, 0, 0);
sheet.addMergedRegion(region);
for (int j = 1; j < title.length; j++) {
- if (j == 10 || j == 11 || j == 12 || j == 13 || j == 14) {
+ if (j == 11 || j == 12 || j == 13 || j == 14 || j == 15) {
continue;
}
region = new CellRangeAddress(startRow, i - 1, j, j);
@@ -1012,19 +1657,18 @@ public class DFL038Jframe extends JFrame {
}
return count;
}
-
- public static int[] arrayAdd(int[] array,int [] val) {
+
+ public static int[] arrayAdd(int[] array, int[] val) {
int[] back = new int[array.length];
- for(int i=0;i list = new ArrayList();
-
- public BomToErp(AbstractAIFApplication app, TCSession session ,String accountSet,String zhangtao) {
+ public BomToErp(AbstractAIFApplication app, TCSession session ,String accountSet,String zhangtao,int flag) {
this.app = app;
this.session = session;
this.accountSet = accountSet;
this.as=new AutoSign();
this.zhangtao = zhangtao;
+ this.flag = flag;
}
- public BomToErp(AbstractAIFApplication app, TCSession session) {
+ public BomToErp(AbstractAIFApplication app, TCSession session,int flag) {
this.app = app;
this.session = session;
this.as=new AutoSign();
+ this.flag = flag;
String[] stringArrays = session.getPreferenceService().getStringValues("DFL_zhangtao");
String[] BOMZT = session.getPreferenceService().getStringValues("DFL_ERPBom_zhangtao");
if (BOMZT == null || BOMZT.length <= 0 ) {
@@ -147,7 +149,7 @@ public class BomToErp extends AbstractAIFOperation{
}
- public void sendBOMTOERP(AbstractAIFApplication app) {
+ public void sendBOMTOERP(TCComponentItem item) {
//InterfaceAIFComponent[] comp = app.getTargetComponents();
InterfaceAIFComponent[] comp = app.getTargetComponents();
String uid ="";
@@ -166,16 +168,8 @@ public class BomToErp extends AbstractAIFOperation{
pre = null;//
result = null;//
-
- TCComponentItemRevision rev = null;
- TCComponentItem item =null;
try {
- if(comp[0] instanceof TCComponentItem ) {
- item = (TCComponentItem) comp[0];
- }
-
- rev = item.getLatestItemRevision();
//ȡ
System.out.print(item.getProperty("object_string"));
@@ -207,44 +201,46 @@ public class BomToErp extends AbstractAIFOperation{
//xmlļ
protected void createXMLFile(TCComponentBOMLine line ,String zhangtao) throws TCException, IOException {
-
- List list = new ArrayList();
- StringBuilder uidSB = new StringBuilder();
+ String weiyi_id = "";
+ //List list = new ArrayList();
try {
getBOMValue(line,list);
if(list.size() <=0) {
- MessageBox.post("ݵBOMѾݵERP,飡", "ʾ",
+ MessageBox.post("BOM ʧܣBOMǷȷ", "ʾ",
MessageBox.INFORMATION);
return;
}
} catch (Exception e) {
// TODO: handle exception
- MessageBox.post("BOM ʧܣBOMǷȷ" ,"ʾ",MessageBox.INFORMATION);
+ MessageBox.post("BOM ʧܣBOMǷȷ!" ,"ʾ",MessageBox.INFORMATION);
+ e.printStackTrace();
return;
}
//ȡ
- StringBuilder sb2 = new StringBuilder();
- Date date = new Date();
- SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmm");
- String plmls = df.format(date);
String userName = session.getUser().getUserName();
-
- String s1 ="";
- String s3 = "";
- String s4 = "";
- String s5 = "";
- String s6 = "";
-
- sb2.append(s1);
- sb2.append(s3);
- sb2.append(s4);
- sb2.append(s5);
- sb2.append(s6);
for(int f_index = 0;f_index< list.size();f_index++) {
+ StringBuilder sb2 = new StringBuilder();
+ StringBuilder uidSB = new StringBuilder();
+ Date date = new Date();
+ SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
+ String plmls = df.format(date);
+ String s1 ="";
+ String s3 = "";
+ String s4 = "";
+ String s5 = "";
+ String s6 = "";
+
+ sb2.append(s1);
+ sb2.append(s3);
+ sb2.append(s4);
+ sb2.append(s5);
+ sb2.append(s6);
uidSB.append(list.get(f_index).getItem_uid());
if(f_index< list.size()-1) {
uidSB.append(";");
}
+
+
int iii = f_index+1;
System.out.println("==== "+ iii+"");
System.out.println("******Ʒ"+list.get(f_index).getPinhao()+"*****");
@@ -273,22 +269,41 @@ public class BomToErp extends AbstractAIFOperation{
String yongliang = null;
String work_id =null;
String cha_jian =null;
+ String beizhu = null;
if( bean.getYonglian()==null) {
- yongliang="";
+ yongliang = "";
}else {
yongliang = bean.getYonglian();
}
if( bean.getWork_id()==null) {
- work_id="";
+ work_id = "";
}else {
work_id = bean.getWork_id();
}
if( bean.getChajian_id()==null) {
- cha_jian="";
+ cha_jian = "";
}else {
- cha_jian = bean.getChajian_id();
+ cha_jian = bean.getChajian_id();
+ }
+
+ if (bean.getBeizhu()==null) {
+ beizhu = "";
+ } else {
+ beizhu = bean.getBeizhu();
+ if(beizhu.contains("&")) {
+ beizhu = beizhu.replace("&", "&");
+ }
+ if(beizhu.contains("<")) {
+ beizhu = beizhu.replace("<", "<");
+ }
+ if(beizhu.contains(">")) {
+ beizhu = beizhu.replace(">", ">");
+ }
+ if(beizhu.contains("\"")) {
+ beizhu = beizhu.replace("\"", """);
+ }
}
String xh = "";
String yj = "";
@@ -296,65 +311,83 @@ public class BomToErp extends AbstractAIFOperation{
String yl = "";
String zybh = "";
String xjwz = "";
+ String bz = "";
String plmkey ="";
- sb2.append(xh);
- sb2.append(yj);
- sb2.append(sxrq);
- sb2.append(yl);
- sb2.append(zybh);
- sb2.append(xjwz);
+ sb2.append(xh);//
+ sb2.append(yj);//id
+ sb2.append(sxrq);//Ч
+ sb2.append(yl);//
+ sb2.append(zybh);//ҵ
+ sb2.append(xjwz);//
+ sb2.append(bz);
sb2.append(plmkey);
+
}
sb2.append("");
- }
-
-
- String bottomS ="";
- sb2.append(bottomS);
- outPutInfo = sb2.toString();
- System.out.println("================"+outPutInfo);
-
- String fileName ="BOM"+ plmls;
- String tempPath = System.getProperty("java.io.tmpdir");
- String path = tempPath + fileName + ".txt";
- File file = new File(path);
-
- if (!file.exists()) {
- //file.getParentFile().mkdirs();
- file.createNewFile();
- }
- try {
- FileOutputStream fos = new FileOutputStream(file);
- fos.write(outPutInfo.getBytes());
- fos.flush();
- fos.close();
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- //
- // InputStream in = new FileInputStream("c:/fugang.jpg");
- //
- // byte[] fileContent = new byte[in.available()];
- //
- // in.read(fileContent);
- //
- // in.close();
- // //
-
- //txtļ 浽ݿ
-
- weiyi_id = getId();
-
- System.out.println("=======================Ψһʶ" +weiyi_id);
+
+ String bottomS ="";
+ sb2.append(bottomS);
+ outPutInfo = sb2.toString();
+ System.out.println("================"+outPutInfo);
+
+ String fileName ="BOM"+ list.get(f_index).getPinhao()+plmls;
+ String tempPath = System.getProperty("java.io.tmpdir");
+ String uid_fileName ="BOM-UID"+list.get(f_index).getPinhao()+ plmls;
+ System.out.println("10.20temp·======="+tempPath);
+ //String path = "D:\\SENDTOERPLOG\\" + fileName + ".txt";
+ String path = tempPath + fileName + ".txt";
+ String path1 = tempPath + uid_fileName + ".txt";
+ File file = new File(path);
+ File file1 = new File(path1);
+ if (!file.exists()) {
+ //file.getParentFile().mkdirs();
+ file.createNewFile();
+ }
+ if (!file1.exists()) {
+ //file.getParentFile().mkdirs();
+ file1.createNewFile();
+ }
+ try {
+ FileOutputStream fos = new FileOutputStream(file);
+ fos.write(outPutInfo.getBytes());
+ fos.flush();
+ fos.close();
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ //
+ // InputStream in = new FileInputStream("c:/fugang.jpg");
+ //
+ // byte[] fileContent = new byte[in.available()];
+ //
+ // in.read(fileContent);
+ //
+ // in.close();
+ // //
- as.insertNewTxtFile(fileName,file, weiyi_id,session.getUser().getUid() , url, user, password,"CreatePLMBOMDataRequest",list.get(0).getPinhao(),zhangtao,session.getUser().getUserId(),uidSB.toString());
+ //txtļ 浽ݿ
+ weiyi_id = getId();
- // as.insertNewTxtFile(fileName,file,weiyi_id,session.getUser().getUid(), url, user, password ,"CreateItemMasterData");
+ System.out.println("=======================Ψһʶ" +weiyi_id);
+
+ //if(f_index > 0 && f_index%60 == 0) {
+ String uidString = uidSB.toString();
+ try {
+ FileOutputStream fos2 = new FileOutputStream(file1);
+ fos2.write(uidString.getBytes());
+ fos2.flush();
+ fos2.close();
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
- file.delete();
+ as.insertNewTxtFile(path,fileName, weiyi_id,session.getUser().getUid() , url, user, password,"CreatePLMBOMDataRequest",list.get(f_index).getPinhao(),zhangtao,session.getUser().getUserId(),path1,uid_fileName,session);
+
+ }
}
@@ -374,10 +407,19 @@ public class BomToErp extends AbstractAIFOperation{
String fuID = rev.getStringProperty("item_id");
fuID = fuID.replace("-Y", "");
String fuType = rev.getStringProperty("object_type");
- if ("T2_outsourceRevision".equals(fuType))
+ String revId = rev.getStringProperty("item_revision_id");
+ System.out.println("flag====="+ flag);
+ if ("T2_outsourceRevision".equals(fuType) )
{
- String revId = rev.getStringProperty("item_revision_id");
- fuID = fuID + revId;
+ if(flag == 1 || flag == 2) {
+ fuID = fuID + revId;
+ }
+ }
+ if(flag == 2) {
+ if ("T2_VirtualRevision".equals(fuType))
+ {
+ fuID = fuID + revId;
+ }
}
fatherBean.setPinhao(fuID);
fatherBean.setItem_uid(rev.getUid());
@@ -389,19 +431,20 @@ public class BomToErp extends AbstractAIFOperation{
if ((childComp instanceof TCComponentBOMLine))
{
TCComponentBOMLine childLine = (TCComponentBOMLine)childComp;
+ String occType = childLine.getStringProperty("TCAI_OCC_TYPE");
String num = childLine.getStringProperty( "T2_ActualConsumption");//ʵ
if(num==null||"".equals(num.trim())) {
num = childLine.getStringProperty( "T2_DesignQuantity");//
if(num==null||"".equals(num.trim())) {
num = childLine.getStringProperty( "bl_quantity");//
-// if(num==null||"".equals(num.trim())) {
-// int num1=1;
-// num =String.valueOf(num1);//ĬΪ1
-// }
+ if(num==null||"".equals(num.trim())) {
+ num = "1";
+ }
}
}
System.out.println("num=============="+num);
- if(childLine.isPacked() && "Ѵע".equals(num))
+ //ΪѴע͡
+ if(childLine.isPacked() || "Ѵע".equals(num) || "Ѵע".equals(occType))
{
childLine.unpack();
ispack = true;
@@ -423,7 +466,7 @@ public class BomToErp extends AbstractAIFOperation{
String occType = childLine.getStringProperty("TCAI_OCC_TYPE");
if (!"Reference".equals(occType))
{
- getChildValue(childLine, z_list, childLineNum,idList);
+ getChildValue(childLine, z_list, childLineNum,idList,flag);
childLineNum++;
}
}
@@ -459,7 +502,7 @@ public class BomToErp extends AbstractAIFOperation{
// TODO Auto-generated method stub
return null;
}
- public void getChildValue(TCComponentBOMLine childLine, List z_list,int childLineNum,List idList) {
+ public void getChildValue(TCComponentBOMLine childLine, List z_list,int childLineNum,List idList,int flag) {
try {
String occType = childLine.getStringProperty("TCAI_OCC_TYPE");
if("Reference".equals(occType)) {
@@ -516,10 +559,23 @@ public class BomToErp extends AbstractAIFOperation{
System.out.println("childType============"+childType);
if("T2_outsource".equals(childType)) {
StringBuilder sb = new StringBuilder(childID);
- sb.append(childRev);
+ //sb.append(childRev);
childID = sb.toString();
}
System.out.println("childID2============"+childID);
+ System.out.println("flag====="+ flag);
+ if ("T2_outsource".equals(childType))
+ {
+ if(flag == 1 || flag == 2) {
+ childID = childID + childRev;
+ }
+ }
+ if(flag == 2) {
+ if ("T2_Virtual".equals(childType))
+ {
+ childID = childID + childRev;
+ }
+ }
childBean.setPinhao(childID);//ԪҲƷ
//ȡdateתΪString
java.text.SimpleDateFormat formatter = new SimpleDateFormat( "yyyy/MM/dd");
diff --git a/src/com/connor/dfl/plm/dfl041/CreateNoemBOMDialogs.java b/src/com/connor/dfl/plm/dfl041/CreateNoemBOMDialogs.java
index 16bdff3..9430340 100644
--- a/src/com/connor/dfl/plm/dfl041/CreateNoemBOMDialogs.java
+++ b/src/com/connor/dfl/plm/dfl041/CreateNoemBOMDialogs.java
@@ -20,7 +20,7 @@ import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
-import org.jacorb.idl.runtime.int_token;
+//import org.jacorb.idl.runtime.int_token;
import com.connor.dfl.plm.dfl019.Dfl019Operation;
import com.connor.dfl.plm.dfl020.Dfl020Operation;
@@ -98,14 +98,17 @@ public class CreateNoemBOMDialogs extends AbstractAIFDialog {
private String[] newArr;
private String bomCode;
private String xunigroup;
+ private int flag2 = 0;
+ private TCComponentItem item = null;
private List xunirevlist = new ArrayList();;
- public CreateNoemBOMDialogs(AbstractAIFApplication app,InterfaceAIFComponent targetComp) {
+ public CreateNoemBOMDialogs(AbstractAIFApplication app,InterfaceAIFComponent targetComp, int flag) {
super();
this.app = app;
this.session = session;
this.service = session.getPreferenceService();
this.targetComp = targetComp;
+ this.flag2 = flag;
}
@Override
@@ -155,7 +158,7 @@ public class CreateNoemBOMDialogs extends AbstractAIFDialog {
//this.setAlwaysOnTop(true);
this.setLayout(null);
- TCComponentItem item = null;
+
//newǩ
bomCode_lable = new JLabel(" 豸ͺ :");
//new
@@ -251,8 +254,8 @@ public class CreateNoemBOMDialogs extends AbstractAIFDialog {
//bom
createItem();
//bomerp
- BomToErp bomToErp =new BomToErp(app, session);
- bomToErp.sendBOMTOERP(app);
+ BomToErp bomToErp =new BomToErp(app, session,flag2);
+ bomToErp.sendBOMTOERP(item);
try {
ChangeDbomUtil.setByPass(false);
System.out.println("·");
@@ -389,6 +392,7 @@ public class CreateNoemBOMDialogs extends AbstractAIFDialog {
TCComponentItem newItem =null;
TCComponentItemRevision xunirev = null;
for (int j = 0; j < values.length; j++) {
+ System.out.println(" values-----------11.2=="+ values[j]);
String[] nameID = values[j].split("\\|");
String item_id = equipmentname + "" + nameID[0];
String sysandjob =nameID[1];//ϵͳ$ҵ
@@ -449,7 +453,7 @@ public class CreateNoemBOMDialogs extends AbstractAIFDialog {
}
//ϴerp
wuliaotoerp wuliaotoerp = new wuliaotoerp(app, session);
- wuliaotoerp.Wuliaotoerp(xunirevlist);
+ wuliaotoerp.Wuliaotoerp(xunirevlist,flag2);
view.save();
view.unlock();
diff --git a/src/com/connor/dfl/plm/dfl041/Dfl041Handler.java b/src/com/connor/dfl/plm/dfl041/Dfl041Handler.java
index 0d9efa2..244195c 100644
--- a/src/com/connor/dfl/plm/dfl041/Dfl041Handler.java
+++ b/src/com/connor/dfl/plm/dfl041/Dfl041Handler.java
@@ -1,19 +1,97 @@
package com.connor.dfl.plm.dfl041;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.common.NotDefinedException;
+import com.connor.dfl.plm.dfl020.Dfl020Operation;
+import com.connor.dfl.plm.dfl020.Dfl020Operation2;
+import com.connor.dfl.plm.dfl0201.Dfl0201Operation;
+import com.connor.dfl.plm.dfl0201.Dfl0201Operation2;
+import com.connor.dfl.plm.dfl0201.Dfl0201Operation3;
+import com.connor.dfl.plm.dfl0201.SelectDialog;
import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
import com.teamcenter.rac.aifrcp.AIFUtility;
+import com.teamcenter.rac.kernel.TCComponentGroup;
+import com.teamcenter.rac.kernel.TCComponentItem;
+import com.teamcenter.rac.kernel.TCComponentItemRevision;
+import com.teamcenter.rac.kernel.TCSession;
+import com.teamcenter.rac.util.MessageBox;
public class Dfl041Handler extends AbstractHandler {
public Object execute(ExecutionEvent arg0) throws ExecutionException {
AbstractAIFApplication app = AIFUtility.getCurrentApplication();
InterfaceAIFComponent com = app.getTargetComponent();
- CreateNoemBOMDialogs createEquipment = new CreateNoemBOMDialogs(app ,com);
+ TCSession session = (TCSession) app.getSession();
+ int flag = 0;
+ try {
+ TCComponentGroup group = session.getCurrentGroup();
+ String group_name = group.getStringProperty("display_name");
+// if(group_name.contains("װ")|| group_name.contains("JCBZ")) {
+// if(com instanceof TCComponentItem) {
+// TCComponentItem item = (TCComponentItem) com;
+// String type = item.getType();
+// if("T2_Equipment".equals(type)) {
+// Date createDate = item.getDateProperty("creation_date");
+// SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd" );
+// Date d = sdf.parse("2022-11-01");
+// if(createDate.after(d)) {
+// flag = 0;
+// }else {
+// flag = 2;
+// }
+// }else {
+// MessageBox.post("ѡ豸в!!",
+// "", MessageBox.ERROR);
+// return null;
+// }
+// }
+// }else{
+// flag = 1;
+// }
+ //2023/2/12
+ if(com instanceof TCComponentItem) {
+ TCComponentItem item = (TCComponentItem) com;
+ String type = item.getType();
+ if("T2_Equipment".equals(type)) {
+ Date createDate = item.getDateProperty("creation_date");
+ SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd" );
+ Date d = null;
+ if(group_name.contains("װ")|| group_name.contains("JCBZ")) {
+ d = sdf.parse("2022-11-01");
+ }else {
+ d = sdf.parse("2023-03-10");
+ }
+ if(createDate.after(d)) {
+ flag = 0;
+ }else {
+ flag = 2;
+ }
+ }else {
+ MessageBox.post("ѡ豸в!!",
+ "", MessageBox.ERROR);
+ return null;
+ }
+ }
+
+// String name = arg0.getCommand().getName();
+// if("Bom-ƴӰ汾".equals(name)) {
+// flag = 1;
+// }else if("Bom-ƴӰ汾-".equals(name)) {
+// flag = 2;
+// }
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ CreateNoemBOMDialogs createEquipment = new CreateNoemBOMDialogs(app ,com,flag);
new Thread(createEquipment).start();
return null;
}
diff --git a/src/com/connor/dfl/plm/dfl041/wuliaotoerp.java b/src/com/connor/dfl/plm/dfl041/wuliaotoerp.java
index 57955f6..86eab99 100644
--- a/src/com/connor/dfl/plm/dfl041/wuliaotoerp.java
+++ b/src/com/connor/dfl/plm/dfl041/wuliaotoerp.java
@@ -103,7 +103,7 @@ public class wuliaotoerp extends AbstractAIFOperation{
}
- public void Wuliaotoerp(List revlist) throws Exception {
+ public void Wuliaotoerp(List revlist,int flag2) throws Exception {
// InterfaceAIFComponent[] comp = app.getTargetComponents();
// if(comp == null || comp.length <= 0) {
// MessageBox.post("ѡеҪERPĶ!!!!","ʾ",MessageBox.INFORMATION);
@@ -136,7 +136,7 @@ public class wuliaotoerp extends AbstractAIFOperation{
List errList = new ArrayList();
- List beanList = getItemValue(revlist,errList);
+ List beanList = getItemValue(revlist,errList,flag2);
//ѭ
// for (int i = 0; i < revlist.size(); i++) {
// revs = new TCComponentItemRevision();
@@ -184,7 +184,7 @@ public class wuliaotoerp extends AbstractAIFOperation{
}
- public List getItemValue(List revslist,List errList) throws TCException {
+ public List getItemValue(List revslist,List errList,int index) throws TCException {
List beanList = new ArrayList();
boolean flag = false;
//ѭrevslist
@@ -192,13 +192,13 @@ public class wuliaotoerp extends AbstractAIFOperation{
//Եİ汾Ϊsetrev
TCComponentItemRevision setrev = (TCComponentItemRevision)revslist.get(i);
- flag = setvalues(beanList,setrev,errList);
+ flag = setvalues(beanList,setrev,errList,index);
}
return beanList;
}
//
- public boolean setvalues(List beanList, TCComponentItemRevision rev, List errList) throws TCException {
+ public boolean setvalues(List beanList, TCComponentItemRevision rev, List errList,int index) throws TCException {
// TODO Auto-generated method stub
boolean flag2 = false;
//if(comp instanceof TCComponentItemRevision || comp instanceof TCComponentBOMLine) {
@@ -210,11 +210,22 @@ public class wuliaotoerp extends AbstractAIFOperation{
String brand ="";
String id ="";
String oldMateriel ="";
+ String rev_id ="";
try {
//ȡ
String type = rev.getStringProperty("object_type");
id = rev.getStringProperty("item_id");
+ rev_id = rev.getStringProperty("item_revision_id");
+ if("T2_outsourceRevision".equals(type)) {
+ if(index == 1 || index == 2) {
+ id = id + rev_id;
+ }
+ }else if("T2_VirtualRevision".equals(type)) {
+ if(index == 2) {
+ id = id + rev_id;
+ }
+ }
//-YĴ
if(id.contains("-Y")) {
id = id.replace("-Y", "");
@@ -280,9 +291,10 @@ public class wuliaotoerp extends AbstractAIFOperation{
protected void createXMLFile(List beanList ,String zhangtao) throws TCException, IOException {
String weiyi_id = "";
Date date = new Date();
- SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmm");
+ SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
StringBuilder uidSB = new StringBuilder();
- String fileName = session.getUser().getUserName()+ "-" +df.format(date);
+ String fileName = "WL-"+ beanList.get(0).getItem_id() + "-" +df.format(date);
+ String uid_fileName ="WL-UID-"+ beanList.get(0).getItem_id() +"-"+df.format(date);
// String s1 = "";
// String s2 ="";
@@ -291,13 +303,13 @@ public class wuliaotoerp extends AbstractAIFOperation{
- String sss1 = "";
+ String sss1 = "";
String sss2 ="";
tops = sss1 + sss2;
String bottom ="";
int j = 1;
- int o = 1;
+
StringBuilder sss3SB = new StringBuilder();
StringBuilder xmlSB = new StringBuilder();
for (int i = 0; i < beanList.size(); i++) {
@@ -309,62 +321,40 @@ public class wuliaotoerp extends AbstractAIFOperation{
String n = n1 + n2 + n3;
xmlSB.append(n);
j++;
- if(i > 0 && i%60 == 0) {
- sss3SB.append(fileName);
- sss3SB.append("-"+o++);
- sss3SB.append(sss3);
- sss3SB.append(xmlSB.toString());
- String zong= tops + sss3SB.toString()+bottom;
- System.out.println(zong);
- String tempPath = System.getProperty("java.io.tmpdir");
- String path = tempPath + fileName + ".txt";
- File file = new File(path);
- if (!file.exists()) {
- //file.getParentFile().mkdirs();
- file.createNewFile();
- }
- try {
- FileOutputStream fos = new FileOutputStream(file);
- fos.write(zong.getBytes());
- fos.flush();
- fos.close();
-
- weiyi_id = getId();
-
- System.out.println("=======================Ψһʶ" +weiyi_id);
-
- as.insertNewTxtFile(fileName,file,weiyi_id,session.getUser().getUid(), url, user, password ,"CreateItemMasterDataRequest",beanList.get(0).getItem_id(),zhangtao,session.getUser().getUserId(),uidSB.toString());
- file.delete();
- weiyi_id = "";
- } catch (Exception e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
- j = 1;
- uidSB = new StringBuilder();
- xmlSB = new StringBuilder();
- sss3SB = new StringBuilder();
- continue;
- }
if(i < beanList.size()-1) {
uidSB.append(";");
}
-
}
if(!("".equals(uidSB.toString()))) {
sss3SB.append(fileName);
- sss3SB.append("-"+o++);
sss3SB.append(sss3);
sss3SB.append(xmlSB.toString());
String zong= tops + sss3SB.toString()+bottom;
System.out.println(zong);
String tempPath = System.getProperty("java.io.tmpdir");
+ System.out.println("10.20temp·======="+tempPath);
+ //String path = "D:\\SENDTOERPLOG\\" + fileName + ".txt";
String path = tempPath + fileName + ".txt";
+ String path1 = tempPath + uid_fileName + ".txt";
File file = new File(path);
if (!file.exists()) {
//file.getParentFile().mkdirs();
file.createNewFile();
}
+ File file1 = new File(path1);
+ if (!file1.exists()) {
+ //file.getParentFile().mkdirs();
+ file1.createNewFile();
+ }
+ try {
+ FileOutputStream fos2 = new FileOutputStream(file1);
+ fos2.write(uidSB.toString().getBytes());
+ fos2.flush();
+ fos2.close();
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
try {
FileOutputStream fos = new FileOutputStream(file);
fos.write(zong.getBytes());
@@ -375,8 +365,7 @@ public class wuliaotoerp extends AbstractAIFOperation{
System.out.println("=======================Ψһʶ" +weiyi_id);
- as.insertNewTxtFile(fileName,file,weiyi_id,session.getUser().getUid(), url, user, password ,"CreateItemMasterDataRequest",beanList.get(0).getItem_id(),zhangtao,session.getUser().getUserId(),uidSB.toString());
- file.delete();
+ as.insertNewTxtFile(path,fileName,weiyi_id,session.getUser().getUid(), url, user, password ,"CreateItemMasterDataRequest",beanList.get(0).getItem_id(),zhangtao,session.getUser().getUserId(),path1,uid_fileName,session);
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
diff --git a/src/com/connor/dfl/plm/dfl042/Dfl042Dialog.java b/src/com/connor/dfl/plm/dfl042/Dfl042Dialog.java
index a950705..7f6da84 100644
--- a/src/com/connor/dfl/plm/dfl042/Dfl042Dialog.java
+++ b/src/com/connor/dfl/plm/dfl042/Dfl042Dialog.java
@@ -28,7 +28,7 @@ import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableRowSorter;
-import org.jacorb.idl.runtime.int_token;
+//import org.jacorb.idl.runtime.int_token;
import com.connor.dfl.plm.dfl042.ERPTransferStatusbean;
import com.connor.dfl.plm.util.DataBaseControl;
@@ -43,7 +43,6 @@ import com.teamcenter.rac.util.MessageBox;
import com.teamcenter.rac.util.PropertyLayout;
import com.teamcenter.rac.util.Registry;
-import sun.awt.www.content.audio.x_aiff;
public class Dfl042Dialog extends AbstractAIFDialog {
@@ -63,8 +62,8 @@ public class Dfl042Dialog extends AbstractAIFDialog {
private JTextField useridField;
private JTextField specField;
private JTextField cangKField;
- private StringBuilder sb = new StringBuilder("select ID,FUN,TXT_PINHAO,ZHANGTAO,USERID from DFL_SEND_TXT_TO_ERP where STATUS = 0 ");
- private StringBuilder numsSb = new StringBuilder("select count(*) from DFL_SEND_TXT_TO_ERP where STATUS = 0 ");
+ private StringBuilder sb = new StringBuilder("select ID,FUN,TXT_PINHAO,ZHANGTAO,USERID from DFL_SEND_FILE_TO_ERP_NEW where STATUS = 0 ");
+ private StringBuilder numsSb = new StringBuilder("select count(*) from DFL_SEND_FILE_TO_ERP_NEW where STATUS = 0 ");
private String sql2 = "";
private JComboBox zhangTBox;
private String[] columnNames = {"","","Ʒ","","û"};
@@ -431,8 +430,8 @@ public class Dfl042Dialog extends AbstractAIFDialog {
public void queryResult() {
String userid = useridField.getText();
if(!("".equals(userid.trim()))) {
- sb.append("and userid" + "="+userid);
- numsSb.append("and userid" + "="+userid);
+ sb.append("and userid" + "='"+userid+"'");
+ numsSb.append("and userid" + "='"+userid+"'");
}
sql2 = sb.toString();
@@ -452,10 +451,8 @@ public class Dfl042Dialog extends AbstractAIFDialog {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
if(beans!=null) {
refreshTable();
}
}
-
}
diff --git a/src/com/connor/dfl/plm/dfl043/Dfl043Operation.java b/src/com/connor/dfl/plm/dfl043/Dfl043Operation.java
index 4e73e54..650904d 100644
--- a/src/com/connor/dfl/plm/dfl043/Dfl043Operation.java
+++ b/src/com/connor/dfl/plm/dfl043/Dfl043Operation.java
@@ -1,65 +1,32 @@
package com.connor.dfl.plm.dfl043;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.text.SimpleDateFormat;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
-import java.util.Map;
-import javax.swing.filechooser.FileSystemView;
-
-import org.apache.poi.xssf.usermodel.XSSFCell;
-import org.apache.poi.xssf.usermodel.XSSFCellStyle;
-import org.apache.poi.xssf.usermodel.XSSFRow;
-import org.apache.poi.xssf.usermodel.XSSFSheet;
-import org.apache.poi.xssf.usermodel.XSSFWorkbook;
-import org.jacorb.idl.runtime.int_token;
-
-import com.connor.dfl.plm.dfl019.ClassPropBean;
-import com.connor.dfl.plm.dfl019.ItemBean;
-import com.connor.dfl.plm.dfl019.ParseXMLUtil;
import com.connor.dfl.plm.exportBOM.ChangeDbomUtil;
-import com.connor.dfl.plm.util.ClassValueBean;
-import com.connor.dfl.plm.util.ClassValueUtil;
import com.connor.dfl.plm.util.ProgressBarThread;
+
import com.teamcenter.rac.aif.AbstractAIFOperation;
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
-import com.teamcenter.rac.kernel.TCClassificationService;
+
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentBOMLine;
import com.teamcenter.rac.kernel.TCComponentBOMWindow;
import com.teamcenter.rac.kernel.TCComponentBOMWindowType;
-import com.teamcenter.rac.kernel.TCComponentDataset;
-import com.teamcenter.rac.kernel.TCComponentForm;
-import com.teamcenter.rac.kernel.TCComponentICO;
import com.teamcenter.rac.kernel.TCComponentItem;
import com.teamcenter.rac.kernel.TCComponentItemRevision;
-import com.teamcenter.rac.kernel.TCComponentQuery;
-import com.teamcenter.rac.kernel.TCComponentQueryType;
-import com.teamcenter.rac.kernel.TCComponentUser;
import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCProperty;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.kernel.TCTypeService;
-import com.teamcenter.rac.kernel.TCUserService;
-import com.teamcenter.rac.kernel.ics.ICSAdminClass;
-import com.teamcenter.rac.kernel.ics.ICSAdminClassAttribute;
-import com.teamcenter.rac.kernel.ics.ICSProperty;
+
import com.teamcenter.rac.util.MessageBox;
public class Dfl043Operation extends AbstractAIFOperation{
private InterfaceAIFComponent[] comps;
private TCSession session;
- private List attrList;
- private List errList = new ArrayList();
private ProgressBarThread wait;
/**
*
@@ -79,7 +46,6 @@ public class Dfl043Operation extends AbstractAIFOperation{
try {
System.out.println("·");
ChangeDbomUtil.setByPass(true);
- //System.out.println("9.17Ϊ====="+comps.length);
for (int i = 0; i < comps.length; i++) {
InterfaceAIFComponent comp = comps[i];
wait = new ProgressBarThread("дҵ", "ִУԵ...");
@@ -125,29 +91,22 @@ public class Dfl043Operation extends AbstractAIFOperation{
}
//bomýҵŷŸṹе
private void setworknum(TCComponentBOMLine line) {
- //System.out.println("9.17.19.519.17.19.51");
if(line instanceof TCComponentBOMLine) {
- //System.out.println("9.17.19.479.17.19.47");
TCComponentItemRevision rev;
-
try {
- //System.out.println("9.17.19.479.17.19.47");
//ˢbomline
line.refresh();
rev = line.getItemRevision();
TCProperty tcProperty = rev.getTCProperty("release_status_list");
TCComponent[] targets = tcProperty.getReferenceValueArray();
String jobid = line.getStringProperty("T2_JobNumber"); //ȡҵ
- //System.out.println("9.17jobid====="+jobid);
String itemid = rev.getStringProperty("item_id"); //ȡitemid
- //System.out.println("9.17itemid====="+itemid);
//жǷ
if(targets.length>=0) {
//жǷҵ
if(jobid != null || !"".equals(jobid)) {
//жǷӼ
AIFComponentContext[] childs = line.getChildren();
- //System.out.println("9.17Ӽ====="+childs.length);
if(childs != null && childs.length > 0 ) {
//ѭӼ
for (int j = 0;j < childs.length;j++) {
@@ -159,24 +118,18 @@ public class Dfl043Operation extends AbstractAIFOperation{
TCComponentItemRevision childrev = ((TCComponentBOMLine) childline).getItemRevision();
//ȡӼid
String childid = childrev.getStringProperty("item_id");
- //System.out.println("9.17Ӽid====="+childid);
//ȡӼİ汾
String childtype = childrev.getStringProperty("object_type");
- //System.out.println("9.17Ӽ汾====="+childtype);
//ȡӼҵ
String childjobid = childline.getStringProperty("T2_JobNumber");
- //System.out.println("9.17Ӽҵ====="+childjobid);
if("T2_outsourceRevision".equals(childtype) || "T2_OutBuyPartRevision".equals(childtype) || "T2_VirtualRevision".equals(childtype)) {
-
- //System.out.println("9.17.19.21");
- //жûҵ
+
if(childjobid == null || "".equals(childjobid) || " ".equals(childjobid)) {
//ûҵ
childline.setStringProperty("T2_JobNumber", jobid);
if("T2_VirtualRevision".equals(childtype)) {
//汾ݹ
setworknum(childline);
- //System.out.println("ݹ鷽9.17(1)");
}else {
//ѭһѭ
continue;
@@ -187,7 +140,6 @@ public class Dfl043Operation extends AbstractAIFOperation{
if("T2_VirtualRevision".equals(childtype)) {
//汾ݹ
setworknum(childline);
- //System.out.println("ݹ鷽9.17(2)");
}else {
//ѭһѭ
continue;
@@ -208,7 +160,6 @@ public class Dfl043Operation extends AbstractAIFOperation{
TCComponentBOMLine childline2 = (TCComponentBOMLine) childcomp2;
//ݹ˷
setworknum(childline2);
- //System.out.println("ݹ鷽9.17(3)");
}
}
}
@@ -216,7 +167,7 @@ public class Dfl043Operation extends AbstractAIFOperation{
MessageBox.post(itemid+"ѷģ", "WARNING",
MessageBox.WARNING);
}
- } catch (TCException e) {
+ }catch (TCException e) {
MessageBox.post("setworknumʧܣ", "WARNING",
MessageBox.WARNING);
}
diff --git a/src/com/connor/dfl/plm/dfl044/Dfl044Dialog.java b/src/com/connor/dfl/plm/dfl044/Dfl044Dialog.java
index 6552949..0f612ed 100644
--- a/src/com/connor/dfl/plm/dfl044/Dfl044Dialog.java
+++ b/src/com/connor/dfl/plm/dfl044/Dfl044Dialog.java
@@ -29,7 +29,7 @@ import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableRowSorter;
-import org.jacorb.idl.runtime.int_token;
+//import org.jacorb.idl.runtime.int_token;
import com.connor.dfl.plm.dfl042.ERPTransferStatusbean;
import com.connor.dfl.plm.util.DataBaseControl;
@@ -47,7 +47,6 @@ import com.teamcenter.rac.util.PropertyLayout;
import com.teamcenter.rac.util.Registry;
import com.teamcenter.soaictstubs.stringSeq_tHolder;
-import sun.awt.www.content.audio.x_aiff;
public class Dfl044Dialog extends AbstractAIFDialog {
@@ -230,8 +229,7 @@ public class Dfl044Dialog extends AbstractAIFDialog {
//ص
public String PriceResult(String userid) {
String Price = null;
- String Select = null; //ѡֵ
-
+ String Select = null; //ѡֵ
//ŲΪգƴ
Select = (String) zt_combobox.getSelectedItem();
System.out.println("11.05ѡֵ======="+Select);
diff --git a/src/com/connor/dfl/plm/dfl045/Dfl045Dialog.java b/src/com/connor/dfl/plm/dfl045/Dfl045Dialog.java
index a321588..1ebbdca 100644
--- a/src/com/connor/dfl/plm/dfl045/Dfl045Dialog.java
+++ b/src/com/connor/dfl/plm/dfl045/Dfl045Dialog.java
@@ -34,7 +34,7 @@ import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableRowSorter;
-import org.jacorb.idl.runtime.int_token;
+//import org.jacorb.idl.runtime.int_token;
import com.connor.dfl.plm.dfl025.Dfl025Operation;
import com.connor.dfl.plm.dfl028.Dfl028AIFDialog;
@@ -56,7 +56,6 @@ import com.teamcenter.rac.util.PropertyLayout;
import com.teamcenter.rac.util.Registry;
import com.teamcenter.soaictstubs.stringSeq_tHolder;
-import sun.awt.www.content.audio.x_aiff;
public class Dfl045Dialog extends AbstractAIFDialog {
diff --git a/src/com/connor/dfl/plm/dfl045/Dfl045Handler.java b/src/com/connor/dfl/plm/dfl045/Dfl045Handler.java
index bdc8884..9347e71 100644
--- a/src/com/connor/dfl/plm/dfl045/Dfl045Handler.java
+++ b/src/com/connor/dfl/plm/dfl045/Dfl045Handler.java
@@ -4,6 +4,7 @@ import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
+import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
import com.teamcenter.rac.aifrcp.AIFUtility;
diff --git a/src/com/connor/dfl/plm/dfl045/Dfl045Operation.java b/src/com/connor/dfl/plm/dfl045/Dfl045Operation.java
index ed4c9ea..18ad218 100644
--- a/src/com/connor/dfl/plm/dfl045/Dfl045Operation.java
+++ b/src/com/connor/dfl/plm/dfl045/Dfl045Operation.java
@@ -4,6 +4,8 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
+import java.sql.ResultSet;
+import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
@@ -26,8 +28,6 @@ import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
-import org.jacorb.idl.runtime.int_token;
-
import com.connor.dfl.plm.util.ProgressBarThread;
import com.sun.org.apache.xerces.internal.impl.xpath.regex.ParseException;
import com.teamcenter.rac.aif.AbstractAIFOperation;
@@ -39,6 +39,7 @@ import com.teamcenter.rac.kernel.TCComponentDataset;
import com.teamcenter.rac.kernel.TCComponentFolder;
import com.teamcenter.rac.kernel.TCComponentForm;
import com.teamcenter.rac.kernel.TCComponentFormType;
+import com.teamcenter.rac.kernel.TCComponentGroup;
import com.teamcenter.rac.kernel.TCComponentItem;
import com.teamcenter.rac.kernel.TCComponentItemRevision;
import com.teamcenter.rac.kernel.TCComponentItemRevisionType;
@@ -46,6 +47,7 @@ import com.teamcenter.rac.kernel.TCComponentListOfValues;
import com.teamcenter.rac.kernel.TCComponentQuery;
import com.teamcenter.rac.kernel.TCComponentQueryType;
import com.teamcenter.rac.kernel.TCComponentTask;
+import com.teamcenter.rac.kernel.TCComponentUser;
import com.teamcenter.rac.kernel.TCComponentWorkContext;
import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCProperty;
@@ -81,7 +83,7 @@ public class Dfl045Operation extends AbstractAIFOperation{
this.session = session;
this.pathRoute = pathRoute;
}
-
+ SimpleDateFormat sqlDf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");// ڸʽ
@Override
public void executeOperation() throws Exception {
System.out.println("ʼȡϵͳģ");
@@ -95,25 +97,27 @@ public class Dfl045Operation extends AbstractAIFOperation{
TCComponentDataset excel = (TCComponentDataset) session.stringToComponent(puid);
File file = ((TCComponentDataset)excel).getTcFiles()[0].getFmsFile();
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");// ڸʽ
- SimpleDateFormat mmdf = new SimpleDateFormat("yyyyMMddHHmm");// ڸʽ
+// SimpleDateFormat mmdf = new SimpleDateFormat("yyyyMMddHHmm");// ڸʽ
+ SimpleDateFormat sqlDf2 = new SimpleDateFormat("yyyy-M-d HH:mm");// ڸʽ
Date startDate = df.parse(Starttime);
Date endDate = df.parse(Endtime);
String starttime = df.format(startDate);
- String mmstart = mmdf.format(mmdf.parse(Starttime)) ;
+ String mmstart = sqlDf.format(sqlDf2.parse(Starttime)) ;
String endtime = df.format(endDate);
- String mmend = mmdf.format(mmdf.parse(Endtime)) ;
+ String mmend = sqlDf.format(sqlDf2.parse(Endtime)) ;
System.out.println("11.12start====="+Starttime+"======end======"+Endtime);
- System.out.println("11.12start====="+starttime+"======end======"+endtime);
- String[] keys = new String[] {"","","״̬"};
- String[] values = new String[] {Starttime,Endtime,"32"};
- List compList = queryObject("-ѷ", keys, values);
+// System.out.println("11.12start====="+starttime+"======end======"+endtime);
+// String[] keys = new String[] {"","","״̬"};
+// String[] values = new String[] {Starttime,Endtime,"32"};
+// List compList = queryObject("-ѷ", keys, values);
+// System.out.println("compList === >"+compList.size());
pathRoute = pathRoute + File.separator + "̱"+starttime+"-"+endtime+".xlsx";
wait = new ProgressBarThread("ܱ", "ִУԵ...");
wait.start();//
//System.out.println("11.16-compList====="+compList.size());
try {
- writeToExcel(compList,file,pathRoute);
+ writeToExcel(file,pathRoute,mmstart,mmend);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -132,17 +136,31 @@ public class Dfl045Operation extends AbstractAIFOperation{
* @throws Exception
*/
- private void writeToExcel(List compList,File file,String path) throws Exception{
+ private void writeToExcel(File file,String path,String mmstart,String mmend) throws Exception{
FileInputStream fis = new FileInputStream(file); //ȡļ
XSSFWorkbook workbook = new XSSFWorkbook(fis); //ʵֶexcelĶд
System.out.println("workBook:"+workbook);
- getBomProcedure(compList,workbook); //014bom
- getOutSourceProcedure(compList,workbook); //030Э
- getOutBuyPartProcedure(compList,workbook);//
+ String selectSql = DbPool.getSelectSql();
+ String selectSql2 = DbPool.getSelectSql2();
+
+ selectSql = selectSql.replace("2022-12-28", mmstart);
+ selectSql = selectSql.replace("2022-12-29", mmend);
+
+ selectSql2 = selectSql2.replace("2022-12-28", mmstart);
+ selectSql2 = selectSql2.replace("2022-12-29", mmend);
+ DbPool.getConnection(session);
+ System.out.println(selectSql);
+ ResultSet executeSelectSql = DbPool.executeSelectSql(selectSql);
+
+ ResultSet executeSelectSql2 = DbPool.executeSelectSql(selectSql2);
+ getBomProcedure(executeSelectSql,workbook,executeSelectSql2);
+ System.out.println("start bom̻ȡ");
+// getBomProcedure(compList,workbook); //014bom
+ System.out.println("end bom̻ȡ");
getOverdueRate(workbook);//
// o++;
-
+ DbPool.freeAll();
FileOutputStream output = new FileOutputStream(new File(path));
workbook.write(output);
output.close();
@@ -208,382 +226,1204 @@ public class Dfl045Operation extends AbstractAIFOperation{
/*bom̻ȡ
*
*/
- public void getBomProcedure(List compList,XSSFWorkbook workbook) throws TCException, java.text.ParseException {
- List makeList = new ArrayList();//ڵļ
- List examineList = new ArrayList();//ڵļ
- List approvalList = new ArrayList();//ڵļ
+ int o = 1;
+ int o2 = 1;
+ int o3 = 1;
+ public void getBomProcedure(ResultSet executeSelectSql,XSSFWorkbook workbook,ResultSet executeSelectSql2) throws Exception {
+
XSSFSheet sheet = workbook.getSheetAt(0); //sheetҳĶд
XSSFRow targetRow = sheet.getRow(0); //еĶд
XSSFCell targetCell = targetRow.getCell(0); //еĶд
XSSFCellStyle cellStyle = targetCell.getCellStyle();//ʽ
- int o = 1;
- for(int c= 0 ;c"+root_task);
+ if(("014-BOM".equals(root_task))) {
+// continue;
+ getBomProcedure(executeSelectSql,sheet,cellStyle);
}
- List valueList = new ArrayList();
- //
- String object_name = job.getStringProperty("object_name");
+ else if(("030-Э".equals(root_task))) {
+ getOutSourceProcedure(executeSelectSql,sheet2,cellStyle2);
+ }
+
+ }
+ while (executeSelectSql2.next()) {
+ getOutBuyPartProcedure(executeSelectSql2,sheet3,cellStyle3);//
+ }
+ }
+ public void getOutBuyPartProcedure(ResultSet executeSelectSql , XSSFSheet sheet ,XSSFCellStyle cellStyle) throws TCException, java.text.ParseException, SQLException {
+ List makeList = new ArrayList();//ڵļ
+ List examineList = new ArrayList();//žڵļ
+ List approvalList = new ArrayList();//ίԱڵļ
+ List wukonglList = new ArrayList();//ڵļ
+ List valueList = new ArrayList();
+ //
+ String object_name = executeSelectSql.getString("pobject_name");
- valueList.add(object_name);
+ valueList.add(object_name);
+
+ //
+ String bzuid = executeSelectSql.getString("BZU");
+
+ TCComponentUser owning_user =(TCComponentUser)session.stringToComponent(bzuid);
+ String userId = owning_user.getStringProperty("object_string");
+ valueList.add(userId);
+
+ //ʱ
+ Date creation_date = executeSelectSql.getDate("starttime");
+ valueList.add(sqlDf.format(creation_date));
+ String bzGu = executeSelectSql.getString("ROWNING_GROUPU");
+
+ TCComponentGroup owning_group =(TCComponentGroup)session.stringToComponent(bzGu);
+ String groupName = owning_group.getStringProperty("display_name");
+ //
+// String owning_group = job.getProperty("owning_group");
+ valueList.add(groupName);
+
+ {
+ List taskList = new ArrayList();
+ //
+ taskList.add("");
+ //
+ taskList.add(userId);
+
+ taskList.add(groupName);
+ //ʼʱ
+ Date fnd0StartDate = executeSelectSql.getDate("BZSTART");
+ SimpleDateFormat start = new SimpleDateFormat("yyyy-MM-dd HH:mm");//ʼʱʽ
+ String format= "";
+ if(fnd0StartDate!=null) {
+ format = start.format(fnd0StartDate);
+ }
+ taskList.add(format);
+ //ִн
+ String task_state = executeSelectSql.getString("BZRES");
+ taskList.add(task_state.equals("Completed")?"":"ѿʼ");
+ //ʱ
+ Date fnd0EndDate = executeSelectSql.getDate("BZEND");
+// String format = start.format(fnd0EndDate);
+ String format2= "";
+ if(fnd0EndDate!=null) {
+ format2 = start.format(fnd0EndDate);
+ }
+ taskList.add(format2);
+ //忪ʼͽʱʱ
+ Date date1 = null;
+ date1 = fnd0StartDate;
+ Date date2 = new Date();
+ //ʱΪ
+ if("".equals(format) || " ".equals(format) || "null".equals(format)) {
+ String date = start.format(date2);
+ date2 = start.parse(date);
+ }else //Ϊ
+ {
+ date2 = fnd0EndDate;
+ }
+ //ת
+ long from1 = date1.getTime();
+ long to1 = date2.getTime();
+ int days = (int) ((to1 - from1) / (1000 * 60 * 60 * 24));
+ String day = days+"";
+ taskList.add(day);
+ String overdue =null;
+ if(days>=1) {
+ overdue = "";
+ }else {
+ overdue = "";
+ }
+ taskList.add(overdue);
+ makeList.add(taskList);
+ //sheetҳ
+ List OverdueRate = new ArrayList();
+ OverdueRate.add(userId);//ݼӵϢ
+ OverdueRate.add(groupName); //ݼӵϢ
+ OverdueRate.add(overdue); //ݼӵϢ
+ //oneList.add(OverdueRate); //Ϣϵڴ
+ }
+
+ {
+ List taskList = new ArrayList();
+
+ //
+ taskList.add("ž");
+ //
+ //βvalid_signoffs
+ String shuid = executeSelectSql.getString("SHU");
+
+ TCComponentUser shUser =(TCComponentUser)session.stringToComponent(shuid);
+ String shUserId = shUser.getStringProperty("object_string");
+ String group = shUser.getLoginGroup().getStringProperty("display_name");
+ taskList.add(shUserId);
+ taskList.add(group);
+ //ʼʱ
+ Date startDate = executeSelectSql.getDate("BSHSTART");
+ SimpleDateFormat start = new SimpleDateFormat("yyyy-MM-dd HH:mm");//ʼʱʽ
+// taskList.add(start.format(fnd0StartDate));
+// String fnd0StartDate = start.format(startDate);
+ String fnd0StartDate= "";
+ if(startDate!=null) {
+ fnd0StartDate = start.format(startDate);
+ }
+ taskList.add(fnd0StartDate);
+ //ִн
+ String task_state = executeSelectSql.getString("SHRES");
+ taskList.add(task_state.equals("Approved")?"":"ѿʼ");
+ //ʱ
+ Date endDate = executeSelectSql.getDate("SHEND");
+// String fnd0EndDate = start.format(endDate);
+ String fnd0EndDate= "";
+ if(endDate!=null) {
+ fnd0EndDate = start.format(endDate);
+ }
+ taskList.add(fnd0EndDate);
+ //忪ʼͽʱʱ
+// SimpleDateFormat start = new SimpleDateFormat("yyyy-MM-dd HH:mm");//ʼʱʽ
+ Date date1 = new Date();
+// SimpleDateFormat finish = new SimpleDateFormat("yyyy-MM-dd HH:mm");//ʱʽ
+ Date date2 = new Date();
+
+ String day = null;//
+ int days = 0;
+ //ʼʱޣʱ
+ if("".equals(fnd0StartDate) || " ".equals(fnd0StartDate) || "null".equals(fnd0StartDate)) {
+ taskList.add(day);
+ }else {
+ //ʼʱУ
+ date1 = start.parse(fnd0StartDate);
+ //ʱ
+ if("".equals(fnd0EndDate) || " ".equals(fnd0EndDate) || "null".equals(fnd0EndDate)) {
+ String date = start.format(date2);
+ date2 = start.parse(date);
+ //ת
+ long from1 = date1.getTime();
+ long to1 = date2.getTime();
+ days = (int) ((to1 - from1) / (1000 * 60 * 60 * 24));
+ day = days+"";
+ taskList.add(day);
+ }else //ʱ
+ {
+ date2 = start.parse(fnd0EndDate);
+ //ת
+ long from1 = date1.getTime();
+ long to1 = date2.getTime();
+ days = (int) ((to1 - from1) / (1000 * 60 * 60 * 24));
+ day = days+"";
+ taskList.add(day);
+ }
+ }
+ //Ƿ
+ String overdue =null;
+ if(days>1) {
+ overdue = "";
+ }else {
+ overdue = "";
+ }
+ taskList.add(overdue);
+ examineList.add(taskList);
+ //sheetҳ
+ List OverdueRate = new ArrayList();
+ OverdueRate.add(shUserId);//ݼӵϢ
+ OverdueRate.add(group); //ݼӵϢ
+ OverdueRate.add(overdue); //ݼӵϢ
+ oneList.add(OverdueRate); //Ϣϵڴ
+ }
+// else if("ڱίԱ".equals(task_name))
+ {
+ List taskList = new ArrayList();
+
+ //
+ taskList.add("ڱίԱ");
+ //
+ //βvalid_signoffs
+ String shuid = executeSelectSql.getString("PZU");
+
+ TCComponentUser shUser =(TCComponentUser)session.stringToComponent(shuid);
+ String shUserId = shUser.getStringProperty("object_string");
+ String group = shUser.getLoginGroup().getStringProperty("display_name");
+ taskList.add(shUserId);
+ taskList.add(group);
+ //ʼʱ
+ Date startDate = executeSelectSql.getDate("BSHSTART");
+ SimpleDateFormat start = new SimpleDateFormat("yyyy-MM-dd HH:mm");//ʼʱʽ
+// taskList.add(start.format(fnd0StartDate));
+// String fnd0StartDate = start.format(startDate);
+ String fnd0StartDate= "";
+ if(startDate!=null) {
+ fnd0StartDate = start.format(startDate);
+ }
+ taskList.add(fnd0StartDate);
+ //ִн
+ String task_state = executeSelectSql.getString("SHRES");
+ taskList.add(task_state.equals("Approved")?"":"ѿʼ");
+ //ʱ
+ Date endDate = executeSelectSql.getDate("SHEND");
+// String fnd0EndDate = start.format(endDate);
+ String fnd0EndDate= "";
+ if(endDate!=null) {
+ fnd0EndDate = start.format(endDate);
+ }
+ taskList.add(fnd0EndDate);
+
+ //忪ʼͽʱʱ
+// SimpleDateFormat start = new SimpleDateFormat("yyyy-MM-dd HH:mm");//ʼʱʽ
+ Date date1 = new Date();
+// SimpleDateFormat finish = new SimpleDateFormat("yyyy-MM-dd HH:mm");//ʱʽ
+ Date date2 = new Date();
- //
- String owning_user = job.getProperty("owning_user");
+ String day = null;//
+ int days = 0;
+ //ʼʱޣʱ
+ if("".equals(fnd0StartDate) || " ".equals(fnd0StartDate) || "null".equals(fnd0StartDate)) {
+ taskList.add(day);
+ }else {
+ //ʼʱУ
+ date1 = start.parse(fnd0StartDate);
+ //ʱ
+ if("".equals(fnd0EndDate) || " ".equals(fnd0EndDate) || "null".equals(fnd0EndDate)) {
+ String date = start.format(date2);
+ date2 = start.parse(date);
+ //ת
+ long from1 = date1.getTime();
+ long to1 = date2.getTime();
+ days = (int) ((to1 - from1) / (1000 * 60 * 60 * 24));
+ day = days+"";
+ taskList.add(day);
+ }else //ʱ
+ {
+ date2 = start.parse(fnd0EndDate);
+ //ת
+ long from1 = date1.getTime();
+ long to1 = date2.getTime();
+ days = (int) ((to1 - from1) / (1000 * 60 * 60 * 24));
+ day = days+"";
+ taskList.add(day);
+ }
+ }
+ //Ƿ
+ String overdue =null;
+ if(days>=1) {
+ overdue = "";
+ }else {
+ overdue = "";
+ }
+ taskList.add(overdue);
+ approvalList.add(taskList);
+ //sheetҳ
+ List OverdueRate = new ArrayList();
+ OverdueRate.add(shUserId);//ݼӵϢ
+ OverdueRate.add(group); //ݼӵϢ
+ OverdueRate.add(overdue); //ݼӵϢ
+ oneList.add(OverdueRate); //Ϣϵڴ
+ }
+ //if ("".equals(task_name))
+ {
+ List taskList = new ArrayList();
+
+ //
+ taskList.add("");
+ //
+ //βvalid_signoffs
+ String shuid = executeSelectSql.getString("WKU");
+
+ TCComponentUser shUser =(TCComponentUser)session.stringToComponent(shuid);
+ String shUserId = shUser.getStringProperty("object_string");
+ String group = shUser.getLoginGroup().getStringProperty("display_name");
+ taskList.add(shUserId);
+ taskList.add(group);
+ //ʼʱ
+ Date startDate = executeSelectSql.getDate("WKSTART");
+ SimpleDateFormat start = new SimpleDateFormat("yyyy-MM-dd HH:mm");//ʼʱʽ
+// taskList.add(start.format(fnd0StartDate));
+// String fnd0StartDate = start.format(startDate);
+ String fnd0StartDate= "";
+ if(startDate!=null) {
+ fnd0StartDate = start.format(startDate);
+ }
+ taskList.add(fnd0StartDate);
+ //ִн
+ String task_state = executeSelectSql.getString("WKRES");
+ taskList.add(task_state.equals("Approved")?"":"ѿʼ");
+ //ʱ
+ Date endDate = executeSelectSql.getDate("WKEND");
+// String fnd0EndDate = start.format(endDate);
+ String fnd0EndDate= "";
+ if(endDate!=null) {
+ fnd0EndDate = start.format(endDate);
+ }
+ taskList.add(fnd0EndDate);
+
+ //忪ʼͽʱʱ
- valueList.add(owning_user);
+// SimpleDateFormat start = new SimpleDateFormat("yyyy-MM-dd HH:mm");//ʼʱʽ
+ Date date1 = new Date();
+// SimpleDateFormat finish = new SimpleDateFormat("yyyy-MM-dd HH:mm");//ʱʽ
+ Date date2 = new Date();
+
+ String day = null;//
+ int days = 0;
+ //ʼʱޣʱ
+ if("".equals(fnd0StartDate) || " ".equals(fnd0StartDate) || "null".equals(fnd0StartDate)) {
+ taskList.add(day);
+ }else {
+ //ʼʱУ
+ date1 = start.parse(fnd0StartDate);
+ //ʱ
+ if("".equals(fnd0EndDate) || " ".equals(fnd0EndDate) || "null".equals(fnd0EndDate)) {
+ String date = start.format(date2);
+ date2 = start.parse(date);
+ //ת
+ long from1 = date1.getTime();
+ long to1 = date2.getTime();
+ days = (int) ((to1 - from1) / (1000 * 60 * 60 * 24));
+ day = days+"";
+ taskList.add(day);
+ }else //ʱ
+ {
+ date2 = start.parse(fnd0EndDate);
+ //ת
+ long from1 = date1.getTime();
+ long to1 = date2.getTime();
+ days = (int) ((to1 - from1) / (1000 * 60 * 60 * 24));
+ day = days+"";
+ taskList.add(day);
+ }
+ }
+ //Ƿ
+ String overdue =null;
+ if(days>=1) {
+ overdue = "";
+ }else {
+ overdue = "";
+ }
+ taskList.add(overdue);
+ wukonglList.add(taskList);
+ //sheetҳ
+ List OverdueRate = new ArrayList();
+ OverdueRate.add(shUserId);//ݼӵϢ
+ OverdueRate.add(group); //ݼӵϢ
+ OverdueRate.add(overdue); //ݼӵϢ
+ oneList.add(OverdueRate); //Ϣϵڴ
+ }
+ for (int j = 0; j < valueList.size(); j++) {
+ XSSFRow row1 = sheet.getRow(o3);
+ if(row1 == null){
+ row1 = sheet.createRow(o3);
+ }
+ //System.out.println("11.17-j-========"+j);
+ XSSFCell excelCell = row1.getCell(j);
+ if(excelCell == null){
+ excelCell = row1.createCell(j);
+ }
+ excelCell.setCellStyle(cellStyle);
+ //дֵ
+ excelCell.setCellValue(valueList.get(j));
+ //ٱڵļ
+ }
+ //Ƽдֵ
+ for (int k=0 ;k beanList1 = makeList.get(k);
+ for(int l = 4 , m = 0 ; l beanList1 = examineList.get(k);
+ for(int l = 4 , m = 0 ; l beanList1 = approvalList.get(k);
+ for(int l = 4 , m = 0 ; l beanList1 = wukonglList.get(k);
+ for(int l = 4 , m = 0 ; l makeList = new ArrayList();//ڵļ
+ List examineList = new ArrayList();//ڵļ
+ List approvalList = new ArrayList();//ڵļ
+ List valueList = new ArrayList();
+ //
+ String object_name = executeSelectSql.getString("pobject_name");
- AIFComponentContext[] refs = job.whereReferenced();
+ valueList.add(object_name);
+
+ //
+ String bzuid = executeSelectSql.getString("BZU");
+
+ TCComponentUser owning_user =(TCComponentUser)session.stringToComponent(bzuid);
+ String userId = owning_user.getStringProperty("object_string");
+ valueList.add(userId);
+
+ //ʱ
+ Date creation_date = executeSelectSql.getDate("starttime");
+
+ valueList.add(sqlDf.format(creation_date));
+ String bzGu = executeSelectSql.getString("ROWNING_GROUPU");
+
+ TCComponentGroup owning_group =(TCComponentGroup)session.stringToComponent(bzGu);
+ String groupName = owning_group.getStringProperty("display_name");
+ //
+// String owning_group = job.getProperty("owning_group");
+ valueList.add(groupName);
+
+ {
+ List taskList = new ArrayList();
+ //
+ //String task_type = comp.getStringProperty("task_type");
+ taskList.add("");
+
+ taskList.add(userId);
- for (int i = 0 ; i<=refs.length-1;i++) {
- TCComponent comp;
- AIFComponentContext parent= refs[i];
- comp = (TCComponent) parent.getComponent();
-
- String task_name = comp.getProperty("object_name");
- //System.out.println("ϵ"+task_name);//
- String task_type = comp.getProperty("task_type");
- //жDzEPMDoTask
- if("EPMReviewTask".equals(task_type)||"EPMDoTask".equals(task_type)) {
- //ж3ڵ
- if("".equals(task_name))
- {
- List taskList = new ArrayList();
-
- //
- //String task_type = comp.getStringProperty("task_type");
- taskList.add(task_name);
- //
- String resp_party = comp.getProperty("fnd0Performer");
- // System.out.println("11.12resp_party======"+resp_party);
- taskList.add(resp_party);
-
- //β
- String group = comp.getProperty("owning_group");
-
- taskList.add(group);
-
- //ʼʱ
- String fnd0StartDate = comp.getProperty("fnd0StartDate");
- taskList.add(fnd0StartDate);
- //ִн
- String task_state = comp.getProperty("task_state");
- taskList.add(task_state);
- //ʱ
- String fnd0EndDate = comp.getProperty("fnd0EndDate");
- taskList.add(fnd0EndDate);
- //忪ʼͽʱʱ
- SimpleDateFormat start = new SimpleDateFormat("yyyy-MM-dd hh:mm");//ʼʱʽ
- Date date1 = null;
- date1 = start.parse(fnd0StartDate);
-
- SimpleDateFormat finish = new SimpleDateFormat("yyyy-MM-dd hh:mm");//ʱʽ
- Date date2 = new Date();
- //ʱΪ
- if("".equals(fnd0EndDate) || " ".equals(fnd0EndDate) || "null".equals(fnd0EndDate)) {
- String date = finish.format(date2);
- date2 = finish.parse(date);
- }else //Ϊ
- {
- date2 = finish.parse(fnd0EndDate);
+ taskList.add(groupName);
+
+ //ʼʱ
+ Date fnd0StartDate = executeSelectSql.getDate("BZSTART");
+ SimpleDateFormat start = new SimpleDateFormat("yyyy-MM-dd HH:mm");//ʼʱʽ
+
+ String fomat= "";
+ if(fnd0StartDate!=null) {
+ fomat = start.format(fnd0StartDate);
+ }
+ taskList.add(fomat);
+ //ִн
+ String task_state = executeSelectSql.getString("BZRES");
+ taskList.add(task_state.equals("Completed")?"":"ѿʼ");
+ //ʱ
+ Date fnd0EndDate = executeSelectSql.getDate("BZEND");
+// String format = start.format(fnd0EndDate);
+ String format= "";
+ if(fnd0EndDate!=null) {
+ format = start.format(fnd0EndDate);
+ }
+ taskList.add(format);
+ //忪ʼͽʱʱ
+
+ Date date1 = null;
+ date1 = fnd0StartDate;
+ Date date2 = new Date();
+ //ʱΪ
+ if("".equals(format) || " ".equals(format) || "null".equals(format)) {
+ String date = start.format(date2);
+ date2 = start.parse(date);
+ }else //Ϊ
+ {
+ date2 = (fnd0EndDate);
+ }
+ //ת
+ long from1 = date1.getTime();
+ long to1 = date2.getTime();
+ int days = (int) ((to1 - from1) / (1000 * 60 * 60 * 24));
+ String day = days+"";
+ taskList.add(day);
+ String overdue =null;
+ if(days>=1) {
+ overdue = "";
+ }else {
+ overdue = "";
+ }
+ taskList.add(overdue);
+ makeList.add(taskList);
+ //sheetҳ
+ List OverdueRate = new ArrayList();
+ OverdueRate.add(userId);//ݼӵϢ
+ OverdueRate.add(groupName); //ݼӵϢ
+ OverdueRate.add(overdue); //ݼӵϢ
+ //oneList.add(OverdueRate); //Ϣϵڴ
+ }
+ {
+ List taskList = new ArrayList();
+
+ //
+ //String task_type = comp.getStringProperty("task_type");
+ taskList.add("");
+ //
+ //βvalid_signoffs
+ String shuid = executeSelectSql.getString("SHU");
+
+ TCComponentUser shUser =(TCComponentUser)session.stringToComponent(shuid);
+ String shUserId = shUser.getStringProperty("object_string");
+ String group = shUser.getLoginGroup().getStringProperty("display_name");
+ taskList.add(shUserId);
+ taskList.add(group);
+
+ //ʼʱ
+ Date startDate = executeSelectSql.getDate("BSHSTART");
+ SimpleDateFormat start = new SimpleDateFormat("yyyy-MM-dd HH:mm");//ʼʱʽ
+// taskList.add(start.format(fnd0StartDate));
+ String fnd0StartDate= "";
+ if(startDate!=null) {
+ fnd0StartDate = start.format(startDate);
+ }
+ taskList.add(fnd0StartDate);
+ //ִн
+ String task_state = executeSelectSql.getString("SHRES");
+ taskList.add(task_state.equals("Approved")?"":"ѿʼ");
+ //ʱ
+ Date endDate = executeSelectSql.getDate("SHEND");
+// String fnd0EndDate = start.format(endDate);
+ String fnd0EndDate= "";
+ if(endDate!=null) {
+ fnd0EndDate = start.format(endDate);
+ }
+ taskList.add(fnd0EndDate);
+ //忪ʼͽʱʱ
+// SimpleDateFormat start = new SimpleDateFormat("yyyy-MM-dd HH:mm");//ʼʱʽ
+ Date date1 = new Date();
+// SimpleDateFormat finish = new SimpleDateFormat("yyyy-MM-dd HH:mm");//ʱʽ
+ Date date2 = new Date();
+
+ String day = null;//
+ int days = 0;
+ //ʼʱޣʱ
+ if("".equals(fnd0StartDate) || " ".equals(fnd0StartDate) || "null".equals(fnd0StartDate)) {
+ taskList.add(day);
+ }else {
+ //ʼʱУ
+ date1 = start.parse(fnd0StartDate);
+ //ʱ
+ if("".equals(fnd0EndDate) || " ".equals(fnd0EndDate) || "null".equals(fnd0EndDate)) {
+ String date = start.format(date2);
+ date2 = start.parse(date);
+ //ת
+ long from1 = date1.getTime();
+ long to1 = date2.getTime();
+ days = (int) ((to1 - from1) / (1000 * 60 * 60 * 24));
+ day = days+"";
+ taskList.add(day);
+ }else //ʱ
+ {
+ date2 = start.parse(fnd0EndDate);
+ //ת
+ long from1 = date1.getTime();
+ long to1 = date2.getTime();
+ days = (int) ((to1 - from1) / (1000 * 60 * 60 * 24));
+ day = days+"";
+ taskList.add(day);
+ }
+ }
+ //Ƿ
+ String overdue =null;
+ if(days>=1) {
+ overdue = "";
+ }else {
+ overdue = "";
+ }
+ taskList.add(overdue);
+ examineList.add(taskList);
+ //sheetҳ
+ List OverdueRate = new ArrayList();
+ OverdueRate.add(shUserId);//ݼӵϢ
+ OverdueRate.add(group); //ݼӵϢ
+ OverdueRate.add(overdue); //ݼӵϢ
+ oneList.add(OverdueRate); //Ϣϵڴ
+ }
+ {
+ List taskList = new ArrayList();
+
+ //
+ taskList.add("");
+ //
+ //βvalid_signoffs
+ String shuid = executeSelectSql.getString("PZU");
+
+ TCComponentUser shUser =(TCComponentUser)session.stringToComponent(shuid);
+ String shUserId = shUser.getStringProperty("object_string");
+ String group = shUser.getLoginGroup().getStringProperty("display_name");
+ taskList.add(shUserId);
+ taskList.add(group);
+ //ʼʱ
+ Date startDate = executeSelectSql.getDate("BSHSTART");
+ SimpleDateFormat start = new SimpleDateFormat("yyyy-MM-dd HH:mm");//ʼʱʽ
+// taskList.add(start.format(fnd0StartDate));
+ String fnd0StartDate= "";
+ if(startDate!=null) {
+ fnd0StartDate = start.format(startDate);
+ }
+ taskList.add(fnd0StartDate);
+ //ִн
+ String task_state = executeSelectSql.getString("SHRES");
+ taskList.add(task_state.equals("Approved")?"":"ѿʼ");
+ //ʱ
+ Date endDate = executeSelectSql.getDate("SHEND");
+// String fnd0EndDate = start.format(endDate);
+ String fnd0EndDate= "";
+ if(endDate!=null) {
+ fnd0EndDate = start.format(endDate);
+ }
+ taskList.add(fnd0EndDate);
+ //忪ʼͽʱʱ
+// SimpleDateFormat start = new SimpleDateFormat("yyyy-MM-dd HH:mm");//ʼʱʽ
+ Date date1 = new Date();
+// SimpleDateFormat finish = new SimpleDateFormat("yyyy-MM-dd HH:mm");//ʱʽ
+ Date date2 = new Date();
+
+ String day = null;//
+ int days = 0;
+ //ʼʱޣʱ
+ if("".equals(fnd0StartDate) || " ".equals(fnd0StartDate) || "null".equals(fnd0StartDate)) {
+ taskList.add(day);
+ }else {
+ //ʼʱУ
+ date1 = start.parse(fnd0StartDate);
+ //ʱ
+ if("".equals(fnd0EndDate) || " ".equals(fnd0EndDate) || "null".equals(fnd0EndDate)) {
+ String date = start.format(date2);
+ date2 = start.parse(date);
+ //ת
+ long from1 = date1.getTime();
+ long to1 = date2.getTime();
+ days = (int) ((to1 - from1) / (1000 * 60 * 60 * 24));
+ day = days+"";
+ taskList.add(day);
+ }else //ʱ
+ {
+ date2 = start.parse(fnd0EndDate);
+ //ת
+ long from1 = date1.getTime();
+ long to1 = date2.getTime();
+ days = (int) ((to1 - from1) / (1000 * 60 * 60 * 24));
+ day = days+"";
+ taskList.add(day);
+ }
+ }
+ String overdue =null;
+ if(days>=1) {
+ overdue = "";
+ }else {
+ overdue = "";
+ }
+ taskList.add(overdue);
+ approvalList.add(taskList);
+ List OverdueRate = new ArrayList();
+ OverdueRate.add(shuid);//ݼӵϢ
+ OverdueRate.add(group); //ݼӵϢ
+ OverdueRate.add(overdue); //ݼӵϢ
+ oneList.add(OverdueRate); //Ϣϵڴ
+ }
+
+ for (int j = 0; j < valueList.size(); j++) {
+ XSSFRow row1 = sheet.getRow(o2);
+ if(row1 == null){
+ row1 = sheet.createRow(o2);
+ }
+ XSSFCell excelCell = row1.getCell(j);
+ if(excelCell == null){
+ excelCell = row1.createCell(j);
+ }
+ excelCell.setCellStyle(cellStyle);
+ excelCell.setCellValue(valueList.get(j));
+ }
+
+ for (int k=0 ;k beanList1 = makeList.get(k);
+ for(int l = 4 , m = 0 ; l=1) {
- overdue = "";
- }else {
- overdue = "";
- }
- taskList.add(overdue);
- makeList.add(taskList);
- List OverdueRate = new ArrayList();
- OverdueRate.add(resp_party);//ݼӵϢ
- OverdueRate.add(group); //ݼӵϢ
- OverdueRate.add(overdue); //ݼӵϢ
- //oneList.add(OverdueRate); //Ϣϵڴ
- }else if("".equals(task_name))
- {
- List taskList = new ArrayList();
-
- //
- //String task_type = comp.getStringProperty("task_type");
- taskList.add(task_name);
- //
- String resp_party = null;
- //βvalid_signoffs
- String group = comp.getProperty("awp0Reviewers");
- //System.out.println("11.19ǰ========="+group);
- if("".equals(group)) {
- taskList.add(resp_party);
- taskList.add(group);
- }else {
- String[] ss = group.split("/");
- group = ss[0];
- resp_party = ss[2];
- taskList.add(resp_party);
- taskList.add(group);
+ excelCell2 = row2.getCell(l);
+ if(excelCell2 == null){
+ excelCell2 = row2.createCell(l);
}
- //ʼʱ
- String fnd0StartDate = comp.getProperty("fnd0StartDate");
- taskList.add(fnd0StartDate);
- //ִн
- String task_state = comp.getProperty("task_state");
- taskList.add(task_state);
- //ʱ
- String fnd0EndDate = comp.getProperty("fnd0EndDate");
- taskList.add(fnd0EndDate);
- //忪ʼͽʱʱ
- SimpleDateFormat start = new SimpleDateFormat("yyyy-MM-dd hh:mm");//ʼʱʽ
- Date date1 = new Date();
- SimpleDateFormat finish = new SimpleDateFormat("yyyy-MM-dd hh:mm");//ʱʽ
- Date date2 = new Date();
-
- String day = null;//
- int days = 0;
- //ʼʱޣʱ
- if("".equals(fnd0StartDate) || " ".equals(fnd0StartDate) || "null".equals(fnd0StartDate)) {
- taskList.add(day);
- }else {
- //ʼʱУ
- date1 = start.parse(fnd0StartDate);
- //ʱ
- if("".equals(fnd0EndDate) || " ".equals(fnd0EndDate) || "null".equals(fnd0EndDate)) {
- String date = finish.format(date2);
- date2 = finish.parse(date);
- //ת
- long from1 = date1.getTime();
- long to1 = date2.getTime();
- days = (int) ((to1 - from1) / (1000 * 60 * 60 * 24));
- day = days+"";
- taskList.add(day);
- }else //ʱ
- {
- date2 = finish.parse(fnd0EndDate);
- //ת
- long from1 = date1.getTime();
- long to1 = date2.getTime();
- days = (int) ((to1 - from1) / (1000 * 60 * 60 * 24));
- day = days+"";
- taskList.add(day);
- }
+ excelCell2.setCellStyle(cellStyle);
+ excelCell2.setCellValue(beanList1.get(m));
+ }
+ o2++;
+ }
+ for (int k=0 ;k beanList1 = examineList.get(k);
+ for(int l = 4 , m = 0 ; l=1) {
- overdue = "";
- }else {
- overdue = "";
- }
- taskList.add(overdue);
- examineList.add(taskList);
- //sheetҳ
- List OverdueRate = new ArrayList();
- OverdueRate.add(resp_party);//ݼӵϢ
- OverdueRate.add(group); //ݼӵϢ
- OverdueRate.add(overdue); //ݼӵϢ
- oneList.add(OverdueRate); //Ϣϵڴ
- }else if("".equals(task_name))
- {
- List taskList = new ArrayList();
-
- //
- //String task_type = comp.getStringProperty("task_type");
- taskList.add(task_name);
-
- //
- String resp_party = null;
- //βvalid_signoffs
- String group = comp.getProperty("awp0Reviewers");
- //System.out.println("11.19ǰ========="+group);
- if("".equals(group)) {
- taskList.add(resp_party);
- taskList.add(group);
- }else {
- String[] ss = group.split("/");
- group = ss[0];
- resp_party = ss[2];
- taskList.add(resp_party);
- taskList.add(group);
+ excelCell2 = row2.getCell(l);
+ if(excelCell2 == null){
+ excelCell2 = row2.createCell(l);
}
- //ʼʱ
- String fnd0StartDate = comp.getProperty("fnd0StartDate");
- taskList.add(fnd0StartDate);
- //ִн
- String task_state = comp.getProperty("task_state");
- taskList.add(task_state);
- //ʱ
- String fnd0EndDate = comp.getProperty("fnd0EndDate");
- taskList.add(fnd0EndDate);
-
- //忪ʼͽʱʱ
- SimpleDateFormat start = new SimpleDateFormat("yyyy-MM-dd hh:mm");//ʼʱʽ
- Date date1 = new Date();
- SimpleDateFormat finish = new SimpleDateFormat("yyyy-MM-dd hh:mm");//ʱʽ
- Date date2 = new Date();
-
- String day = null;//
- int days = 0;
- //ʼʱޣʱ
- if("".equals(fnd0StartDate) || " ".equals(fnd0StartDate) || "null".equals(fnd0StartDate)) {
- taskList.add(day);
- }else {
- //ʼʱУ
- date1 = start.parse(fnd0StartDate);
- //ʱ
- if("".equals(fnd0EndDate) || " ".equals(fnd0EndDate) || "null".equals(fnd0EndDate)) {
- String date = finish.format(date2);
- date2 = finish.parse(date);
- //ת
- long from1 = date1.getTime();
- long to1 = date2.getTime();
- days = (int) ((to1 - from1) / (1000 * 60 * 60 * 24));
- day = days+"";
- taskList.add(day);
- }else //ʱ
- {
- date2 = finish.parse(fnd0EndDate);
- //ת
- long from1 = date1.getTime();
- long to1 = date2.getTime();
- days = (int) ((to1 - from1) / (1000 * 60 * 60 * 24));
- day = days+"";
- taskList.add(day);
- }
+
+ excelCell2.setCellStyle(cellStyle);
+
+ excelCell2.setCellValue(beanList1.get(m));
+ }
+ o2++;
+ }
+
+ for (int k=0 ;k beanList1 = approvalList.get(k);
+ for(int l = 4 , m = 0 ; l=1) {
- overdue = "";
- }else {
- overdue = "";
- }
- taskList.add(overdue);
- approvalList.add(taskList);
- //sheetҳ
- List OverdueRate = new ArrayList();
- OverdueRate.add(resp_party);//ݼӵϢ
- OverdueRate.add(group); //ݼӵϢ
- OverdueRate.add(overdue); //ݼӵϢ
- oneList.add(OverdueRate); //Ϣϵڴ
+ excelCell2 = row2.getCell(l);
+ if(excelCell2 == null){
+ excelCell2 = row2.createCell(l);
+ }
+ //ʽ
+ excelCell2.setCellStyle(cellStyle);
+ //дֵ
+ excelCell2.setCellValue(beanList1.get(m));
}
+ o2++;
+ }
+ makeList.clear();
+ examineList.clear();
+ approvalList.clear();
+ }
+
+ public void getBomProcedure(ResultSet executeSelectSql , XSSFSheet sheet ,XSSFCellStyle cellStyle) throws Exception, java.text.ParseException {
+ List makeList = new ArrayList();//ڵļ
+ List examineList = new ArrayList();//ڵļ
+ List approvalList = new ArrayList();//ڵļ
+ List valueList = new ArrayList();
+ //
+ String object_name = executeSelectSql.getString("pobject_name");
+
+ valueList.add(object_name);
+
+ //
+ String bzuid = executeSelectSql.getString("BZU");
+
+ TCComponentUser owning_user =(TCComponentUser)session.stringToComponent(bzuid);
+ String userId = owning_user.getStringProperty("object_string");
+ valueList.add(userId);
+
+ //ʱ
+ Date creation_date = executeSelectSql.getDate("starttime");
+
+ valueList.add(sqlDf.format(creation_date));
+ String bzGu = executeSelectSql.getString("ROWNING_GROUPU");
+
+ TCComponentGroup owning_group =(TCComponentGroup)session.stringToComponent(bzGu);
+ String groupName = owning_group.getStringProperty("display_name");
+ //
+// String owning_group = job.getProperty("owning_group");
+ valueList.add(groupName);
+ //System.out.println("11.16--valuelist====="+valueList);
+ {
+ List taskList = new ArrayList();
+ //
+ //String task_type = comp.getStringProperty("task_type");
+ taskList.add("");
+
+ taskList.add(userId);
+
+ taskList.add(groupName);
+
+ //ʼʱ
+ Date fnd0StartDate = executeSelectSql.getDate("BZSTART");
+ SimpleDateFormat start = new SimpleDateFormat("yyyy-MM-dd HH:mm");//ʼʱʽ
+ String format2 = "";
+ if(fnd0StartDate!=null) {
+ format2 = start.format(fnd0StartDate);
+ }
+ taskList.add(format2);
+ //ִн
+ String task_state = executeSelectSql.getString("BZRES");
+ taskList.add(task_state.equals("Completed")?"":"ѿʼ");
+ //ʱ
+ Date fnd0EndDate = executeSelectSql.getDate("BZEND");
+// String format = start.format(fnd0EndDate);
+ String format = "";
+ if(fnd0EndDate!=null) {
+ format = start.format(fnd0EndDate);
+ }
+
+ taskList.add(format);
+ //忪ʼͽʱʱ
+
+ Date date1 = null;
+ date1 = fnd0StartDate;
+ Date date2 = new Date();
+ //ʱΪ
+ if("".equals(format) || " ".equals(format) || "null".equals(format)) {
+ String date = start.format(date2);
+ date2 = start.parse(date);
+ }else //Ϊ
+ {
+ date2 = fnd0EndDate;
+ }
+ //ת
+ long from1 = date1.getTime();
+ long to1 = date2.getTime();
+ int days = (int) ((to1 - from1) / (1000 * 60 * 60 * 24));
+ String day = days+"";
+ taskList.add(day);
+ String overdue =null;
+ if(days>=1) {
+ overdue = "";
+ }else {
+ overdue = "";
+ }
+ taskList.add(overdue);
+ makeList.add(taskList);
+ List OverdueRate = new ArrayList();
+ OverdueRate.add(userId);//ݼӵϢ
+ OverdueRate.add(groupName); //ݼӵϢ
+ OverdueRate.add(overdue); //ݼӵϢ
+// oneList.add(OverdueRate); //Ϣϵڴ
+ }
+
+ {
+ List taskList = new ArrayList();
+
+ //
+ //String task_type = comp.getStringProperty("task_type");
+ taskList.add("");
+ //
+ //βvalid_signoffs
+ String shuid = executeSelectSql.getString("SHU");
+
+ TCComponentUser shUser =(TCComponentUser)session.stringToComponent(shuid);
+ String shUserId = shUser.getStringProperty("object_string");
+ String group = shUser.getLoginGroup().getStringProperty("display_name");
+ taskList.add(shUserId);
+ taskList.add(group);
+
+ //ʼʱ
+ Date startDate = executeSelectSql.getDate("BSHSTART");
+ SimpleDateFormat start = new SimpleDateFormat("yyyy-MM-dd HH:mm");//ʼʱʽ
+// taskList.add(start.format(fnd0StartDate));
+ String fnd0StartDate = "";
+ if(startDate!=null) {
+ fnd0StartDate = start.format(startDate);
+ }
+ taskList.add(fnd0StartDate);
+ //ִн
+ String task_state = executeSelectSql.getString("SHRES");
+ taskList.add(task_state.equals("Approved")?"":"ѿʼ");
+ //ʱ
+ Date endDate = executeSelectSql.getDate("SHEND");
+ String fnd0EndDate = "";
+ if(endDate!=null) {
+ fnd0EndDate = start.format(endDate);
+ }
+ taskList.add(fnd0EndDate);
+ //忪ʼͽʱʱ
+// SimpleDateFormat start = new SimpleDateFormat("yyyy-MM-dd HH:mm");//ʼʱʽ
+ Date date1 = new Date();
+// SimpleDateFormat finish = new SimpleDateFormat("yyyy-MM-dd HH:mm");//ʱʽ
+ Date date2 = new Date();
+
+ String day = null;//
+ int days = 0;
+ //ʼʱޣʱ
+ if("".equals(fnd0StartDate) || " ".equals(fnd0StartDate) || "null".equals(fnd0StartDate)) {
+ taskList.add(day);
+ }else {
+ //ʼʱУ
+ date1 = start.parse(fnd0StartDate);
+ //ʱ
+ if("".equals(fnd0EndDate) || " ".equals(fnd0EndDate) || "null".equals(fnd0EndDate)) {
+ String date = start.format(date2);
+ date2 = start.parse(date);
+ //ת
+ long from1 = date1.getTime();
+ long to1 = date2.getTime();
+ days = (int) ((to1 - from1) / (1000 * 60 * 60 * 24));
+ day = days+"";
+ taskList.add(day);
+ }else //ʱ
+ {
+ date2 = start.parse(fnd0EndDate);
+ //ת
+ long from1 = date1.getTime();
+ long to1 = date2.getTime();
+ days = (int) ((to1 - from1) / (1000 * 60 * 60 * 24));
+ day = days+"";
+ taskList.add(day);
}
}
+ //Ƿ
+ String overdue =null;
+ if(days>=1) {
+ overdue = "";
+ }else {
+ overdue = "";
+ }
+ taskList.add(overdue);
+ examineList.add(taskList);
+ //sheetҳ
+ List OverdueRate = new ArrayList();
+ OverdueRate.add(shUserId);//ݼӵϢ
+ OverdueRate.add(group); //ݼӵϢ
+ OverdueRate.add(overdue); //ݼӵϢ
+ oneList.add(OverdueRate); //Ϣϵڴ
+ }
+ {
+ List taskList = new ArrayList();
+ //
+ taskList.add("");
+ //
+ //βvalid_signoffs
+ String shuid = executeSelectSql.getString("PZU");
+
+ TCComponentUser shUser =(TCComponentUser)session.stringToComponent(shuid);
+ String shUserId = shUser.getStringProperty("object_string");
+ String group = shUser.getLoginGroup().getStringProperty("display_name");
+ taskList.add(shUserId);
+ taskList.add(group);
+ //ʼʱ
+ Date startDate = executeSelectSql.getDate("BSHSTART");
+ SimpleDateFormat start = new SimpleDateFormat("yyyy-MM-dd HH:mm");//ʼʱʽ
+// taskList.add(start.format(fnd0StartDate));
+// String fnd0StartDate = start.format(startDate);
+ String fnd0StartDate = "";
+ if(startDate!=null) {
+ fnd0StartDate = start.format(startDate);
+ }
+ taskList.add(fnd0StartDate);
+ //ִн
+ String task_state = executeSelectSql.getString("SHRES");
+ taskList.add(task_state.equals("Approved")?"":"ѿʼ");
+ //ʱ
+ Date endDate = executeSelectSql.getDate("SHEND");
+// String fnd0EndDate = start.format(endDate);
+ String fnd0EndDate = "";
+ if(endDate!=null) {
+ fnd0EndDate = start.format(endDate);
+ }
+
+ taskList.add(fnd0EndDate);
+ //忪ʼͽʱʱ
+// SimpleDateFormat start = new SimpleDateFormat("yyyy-MM-dd HH:mm");//ʼʱʽ
+ Date date1 = new Date();
+// SimpleDateFormat finish = new SimpleDateFormat("yyyy-MM-dd HH:mm");//ʱʽ
+ Date date2 = new Date();
+
+ String day = null;//
+ int days = 0;
+ //ʼʱޣʱ
+ if("".equals(fnd0StartDate) || " ".equals(fnd0StartDate) || "null".equals(fnd0StartDate)) {
+ taskList.add(day);
+ }else {
+ //ʼʱУ
+ date1 = start.parse(fnd0StartDate);
+ //ʱ
+ if("".equals(fnd0EndDate) || " ".equals(fnd0EndDate) || "null".equals(fnd0EndDate)) {
+ String date = start.format(date2);
+ date2 = start.parse(date);
+ //ת
+ long from1 = date1.getTime();
+ long to1 = date2.getTime();
+ days = (int) ((to1 - from1) / (1000 * 60 * 60 * 24));
+ day = days+"";
+ taskList.add(day);
+ }else //ʱ
+ {
+ date2 = start.parse(fnd0EndDate);
+ //ת
+ long from1 = date1.getTime();
+ long to1 = date2.getTime();
+ days = (int) ((to1 - from1) / (1000 * 60 * 60 * 24));
+ day = days+"";
+ taskList.add(day);
+ }
+ }
+ //Ƿ
+ String overdue =null;
+ if(days>=1) {
+ overdue = "";
+ }else {
+ overdue = "";
+ }
+ taskList.add(overdue);
+ approvalList.add(taskList);
+ //sheetҳ
+ List OverdueRate = new ArrayList();
+ OverdueRate.add(userId);//ݼӵϢ
+ OverdueRate.add(group); //ݼӵϢ
+ OverdueRate.add(overdue); //ݼӵϢ
+ oneList.add(OverdueRate); //Ϣϵڴ
+ }
- for (int j = 0; j < valueList.size(); j++) {
- XSSFRow row1 = sheet.getRow(o);
- if(row1 == null){
- row1 = sheet.createRow(o);
- }
- //System.out.println("11.17-j-========"+j);
- XSSFCell excelCell = row1.getCell(j);
- if(excelCell == null){
- excelCell = row1.createCell(j);
- }
- excelCell.setCellStyle(cellStyle);
- //дֵ
- excelCell.setCellValue(valueList.get(j));
- //ٱڵļ
+ for (int j = 0; j < valueList.size(); j++) {
+ XSSFRow row1 = sheet.getRow(o);
+ if(row1 == null){
+ row1 = sheet.createRow(o);
}
- //System.out.println("threeListϸ====="+threeList.size());
- //Ƽдֵ
- for (int k=0 ;k beanList1 = makeList.get(k);
- //System.out.println("11.16--beanList1.size====="+beanList1.size());
- for(int l = 4 , m = 0 ; l beanList1 = makeList.get(k);
+ for(int l = 4 , m = 0 ; l beanList1 = examineList.get(k);
- //System.out.println("11.16--beanList1.size====="+beanList1.size());
- for(int l = 4 , m = 0 ; l beanList1 = approvalList.get(k);
- //System.out.println("11.16--beanList1.size====="+beanList1.size());
- for(int l = 4 , m = 0 ; l beanList1 = examineList.get(k);
+ for(int l = 4 , m = 0 ; l beanList1 = approvalList.get(k);
+ //System.out.println("11.16--beanList1.size====="+beanList1.size());
+ for(int l = 4 , m = 0 ; l compList,XSSFWorkbook workbook) throws TCException, java.text.ParseException {
- List makeList = new ArrayList();//ڵļ
- List examineList = new ArrayList();//ڵļ
- List approvalList = new ArrayList();//ڵļ
+
// TODO Auto-generated method stub
XSSFSheet sheet = workbook.getSheetAt(1); //sheetҳĶд
XSSFRow targetRow = sheet.getRow(0); //еĶд
@@ -596,343 +1436,12 @@ public class Dfl045Operation extends AbstractAIFOperation{
if(!("030-Э".equals(root_task))) {
continue;
}
- List valueList = new ArrayList();
- //
- String object_name = job.getStringProperty("object_name");
- valueList.add(object_name);
- //
- String owning_user = job.getProperty("owning_user");
- valueList.add(owning_user);
- //ʱ
- String creation_date = job.getProperty("creation_date");
- valueList.add(creation_date);
- //
- String owning_group = job.getProperty("owning_group");
- valueList.add(owning_group);
- //System.out.println("11.16--valuelist====="+valueList);
-// oneList.add(valueList);
- AIFComponentContext[] refs = job.whereReferenced();
-
- for (int i = 0 ; i<=refs.length-1;i++) {
- TCComponent comp;
- AIFComponentContext parent= refs[i];
- comp = (TCComponent) parent.getComponent();
-
- String task_name = comp.getProperty("object_name");
- //System.out.println("ϵ"+task_name);//
- String task_type = comp.getProperty("task_type");
- //жDzEPMDoTask
- if("EPMReviewTask".equals(task_type)||"EPMDoTask".equals(task_type)) {
- //ж3ڵ
- if("".equals(task_name))
- {
- List taskList = new ArrayList();
- //
- //String task_type = comp.getStringProperty("task_type");
- taskList.add(task_name);
- //
- String resp_party = comp.getProperty("fnd0Performer");
- // System.out.println("11.12resp_party======"+resp_party);
- taskList.add(resp_party);
- //β
- String group = comp.getProperty("owning_group");
- taskList.add(group);
- //ʼʱ
- String fnd0StartDate = comp.getProperty("fnd0StartDate");
- taskList.add(fnd0StartDate);
- //ִн
- String task_state = comp.getProperty("task_state");
- taskList.add(task_state);
- //ʱ
- String fnd0EndDate = comp.getProperty("fnd0EndDate");
- taskList.add(fnd0EndDate);
- //忪ʼͽʱʱ
- SimpleDateFormat start = new SimpleDateFormat("yyyy-MM-dd hh:mm");//ʼʱʽ
- Date date1 = null;
- date1 = start.parse(fnd0StartDate);
-
- SimpleDateFormat finish = new SimpleDateFormat("yyyy-MM-dd hh:mm");//ʱʽ
- Date date2 = new Date();
- //ʱΪ
- if("".equals(fnd0EndDate) || " ".equals(fnd0EndDate) || "null".equals(fnd0EndDate)) {
- String date = finish.format(date2);
- date2 = finish.parse(date);
- }else //Ϊ
- {
- date2 = finish.parse(fnd0EndDate);
- }
- //ת
- long from1 = date1.getTime();
- long to1 = date2.getTime();
- int days = (int) ((to1 - from1) / (1000 * 60 * 60 * 24));
- String day = days+"";
- taskList.add(day);
- String overdue =null;
- if(days>=1) {
- overdue = "";
- }else {
- overdue = "";
- }
- taskList.add(overdue);
- makeList.add(taskList);
- //sheetҳ
- List OverdueRate = new ArrayList();
- OverdueRate.add(resp_party);//ݼӵϢ
- OverdueRate.add(group); //ݼӵϢ
- OverdueRate.add(overdue); //ݼӵϢ
- //oneList.add(OverdueRate); //Ϣϵڴ
- }else if("".equals(task_name))
- {
- List taskList = new ArrayList();
-
- //
- //String task_type = comp.getStringProperty("task_type");
- taskList.add(task_name);
- //
- String resp_party = null;
- //βvalid_signoffs
- String group = comp.getProperty("awp0Reviewers");
- //System.out.println("11.19ǰ========="+group);
- if("".equals(group)) {
- taskList.add(resp_party);
- taskList.add(group);
- }else {
- String[] ss = group.split("/");
- group = ss[0];
- resp_party = ss[2];
- taskList.add(resp_party);
- taskList.add(group);
- }
- //ʼʱ
- String fnd0StartDate = comp.getProperty("fnd0StartDate");
- taskList.add(fnd0StartDate);
- //ִн
- String task_state = comp.getProperty("task_state");
- taskList.add(task_state);
- //ʱ
- String fnd0EndDate = comp.getProperty("fnd0EndDate");
- taskList.add(fnd0EndDate);
- //忪ʼͽʱʱ
- SimpleDateFormat start = new SimpleDateFormat("yyyy-MM-dd hh:mm");//ʼʱʽ
- Date date1 = new Date();
- SimpleDateFormat finish = new SimpleDateFormat("yyyy-MM-dd hh:mm");//ʱʽ
- Date date2 = new Date();
-
- String day = null;//
- int days = 0;
- //ʼʱޣʱ
- if("".equals(fnd0StartDate) || " ".equals(fnd0StartDate) || "null".equals(fnd0StartDate)) {
- taskList.add(day);
- }else {
- //ʼʱУ
- date1 = start.parse(fnd0StartDate);
- //ʱ
- if("".equals(fnd0EndDate) || " ".equals(fnd0EndDate) || "null".equals(fnd0EndDate)) {
- String date = finish.format(date2);
- date2 = finish.parse(date);
- //ת
- long from1 = date1.getTime();
- long to1 = date2.getTime();
- days = (int) ((to1 - from1) / (1000 * 60 * 60 * 24));
- day = days+"";
- taskList.add(day);
- }else //ʱ
- {
- date2 = finish.parse(fnd0EndDate);
- //ת
- long from1 = date1.getTime();
- long to1 = date2.getTime();
- days = (int) ((to1 - from1) / (1000 * 60 * 60 * 24));
- day = days+"";
- taskList.add(day);
- }
- }
- //Ƿ
- String overdue =null;
- if(days>=1) {
- overdue = "";
- }else {
- overdue = "";
- }
- taskList.add(overdue);
- examineList.add(taskList);
- //sheetҳ
- List OverdueRate = new ArrayList();
- OverdueRate.add(resp_party);//ݼӵϢ
- OverdueRate.add(group); //ݼӵϢ
- OverdueRate.add(overdue); //ݼӵϢ
- oneList.add(OverdueRate); //Ϣϵڴ
- }else if("".equals(task_name))
- {
- List taskList = new ArrayList();
-
- //
- //String task_type = comp.getStringProperty("task_type");
- taskList.add(task_name);
- //
- String resp_party = null;
- //βvalid_signoffs
- String group = comp.getProperty("awp0Reviewers");
- //System.out.println("11.19ǰ========="+group);
- if("".equals(group)) {
- taskList.add(resp_party);
- taskList.add(group);
- }else {
- String[] ss = group.split("/");
- group = ss[0];
- resp_party = ss[2];
- taskList.add(resp_party);
- taskList.add(group);
- }
- //ʼʱ
- String fnd0StartDate = comp.getProperty("fnd0StartDate");
- taskList.add(fnd0StartDate);
- //ִн
- String task_state = comp.getProperty("task_state");
- taskList.add(task_state);
- //ʱ
- String fnd0EndDate = comp.getProperty("fnd0EndDate");
- taskList.add(fnd0EndDate);
-
- //忪ʼͽʱʱ
- SimpleDateFormat start = new SimpleDateFormat("yyyy-MM-dd hh:mm");//ʼʱʽ
- Date date1 = new Date();
- SimpleDateFormat finish = new SimpleDateFormat("yyyy-MM-dd hh:mm");//ʱʽ
- Date date2 = new Date();
-
- String day = null;//
- int days = 0;
- //ʼʱޣʱ
- if("".equals(fnd0StartDate) || " ".equals(fnd0StartDate) || "null".equals(fnd0StartDate)) {
- taskList.add(day);
- }else {
- //ʼʱУ
- date1 = start.parse(fnd0StartDate);
- //ʱ
- if("".equals(fnd0EndDate) || " ".equals(fnd0EndDate) || "null".equals(fnd0EndDate)) {
- String date = finish.format(date2);
- date2 = finish.parse(date);
- //ת
- long from1 = date1.getTime();
- long to1 = date2.getTime();
- days = (int) ((to1 - from1) / (1000 * 60 * 60 * 24));
- day = days+"";
- taskList.add(day);
- }else //ʱ
- {
- date2 = finish.parse(fnd0EndDate);
- //ת
- long from1 = date1.getTime();
- long to1 = date2.getTime();
- days = (int) ((to1 - from1) / (1000 * 60 * 60 * 24));
- day = days+"";
- taskList.add(day);
- }
- }
- String overdue =null;
- if(days>=1) {
- overdue = "";
- }else {
- overdue = "";
- }
- taskList.add(overdue);
- approvalList.add(taskList);
- List OverdueRate = new ArrayList();
- OverdueRate.add(resp_party);//ݼӵϢ
- OverdueRate.add(group); //ݼӵϢ
- OverdueRate.add(overdue); //ݼӵϢ
- oneList.add(OverdueRate); //Ϣϵڴ
- }
- }
- }
-
- for (int j = 0; j < valueList.size(); j++) {
- XSSFRow row1 = sheet.getRow(o);
- if(row1 == null){
- row1 = sheet.createRow(o);
- }
- XSSFCell excelCell = row1.getCell(j);
- if(excelCell == null){
- excelCell = row1.createCell(j);
- }
- excelCell.setCellStyle(cellStyle);
- excelCell.setCellValue(valueList.get(j));
- }
-
- for (int k=0 ;k