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 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); - //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();//׼ίԱڵļ - List wukonglList = new ArrayList();//ڵļ + // TODO Auto-generated method stub XSSFSheet sheet = workbook.getSheetAt(2); //sheetҳĶд XSSFRow targetRow = sheet.getRow(0); //еĶд @@ -945,468 +1454,18 @@ public class Dfl045Operation extends AbstractAIFOperation{ if(!("038-⹺".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); - //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); - wukonglList.add(taskList); - //sheetҳ - 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); - } - //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)); - //ٱڵļ - } - //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 = 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 = wukonglList.get(k); - //System.out.println("11.16--beanList1.size====="+beanList1.size()); - for(int l = 4 , m = 0 ; l userList = new ArrayList(); List newList = new ArrayList(); - for(int i=0;i Overdue1 = new ArrayList(); Overdue1 = list.get(k); + //ʱ for (int j = 0; j < Overdue1.size(); j++) { XSSFRow row1 = sheet.getRow(o); if(row1 == null){ row1 = sheet.createRow(o); } - //System.out.println("11.19-j-========"+j); XSSFCell excelCell = row1.getCell(j); if(excelCell == null){ excelCell = row1.createCell(j); diff --git a/src/com/connor/dfl/plm/dfl046/BOMExportHandler.java b/src/com/connor/dfl/plm/dfl046/BOMExportHandler.java index 82b964b..9a1d814 100644 --- a/src/com/connor/dfl/plm/dfl046/BOMExportHandler.java +++ b/src/com/connor/dfl/plm/dfl046/BOMExportHandler.java @@ -3,20 +3,12 @@ package com.connor.dfl.plm.dfl046; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.handlers.HandlerUtil; import com.teamcenter.rac.aif.AbstractAIFApplication; import com.teamcenter.rac.aifrcp.AIFUtility; import com.teamcenter.rac.kernel.TCComponentBOMLine; +import com.teamcenter.rac.kernel.TCComponentGroup; import com.teamcenter.rac.kernel.TCSession; -import com.teamcenter.rac.pse.common.BOMLineNode; -import com.teamcenter.rac.pse.common.BOMTreeTableModel; -import com.teamcenter.rac.pse.operations.ExpandBelowOperation; -import com.teamcenter.rac.psebase.AbstractBOMLineViewerApplication; -import com.teamcenter.rac.psebase.common.AbstractViewableTreeTable; -import com.teamcenter.rac.util.AdapterUtil; import com.teamcenter.rac.util.MessageBox; /** @@ -42,8 +34,33 @@ public class BOMExportHandler extends AbstractHandler { //DL2_VehicleRevision DL2_EBOM if(app.getTargetComponent() instanceof TCComponentBOMLine){ TCSession session=(TCSession) app.getSession(); - test operation=new test(app, session); - session.queueOperation(operation); + try { + TCComponentGroup group = session.getCurrentGroup(); + String group_name = group.getStringProperty("display_name"); +// if(group_name.contains("װ")|| group_name.contains("JCBZ")) { +// SelectDialog dialog = new SelectDialog(app); +// new Thread(dialog).start(); +// }else{ +// test2 operation = new test2(app, session); +// session.queueOperation(operation); +// } + + SelectDialog dialog = new SelectDialog(app); + new Thread(dialog).start(); + +// String name = event.getCommand().getName(); +// if("۸bom-ƴӰ汾".equals(name)) { +// test2 operation=new test2(app, session); +// session.queueOperation(operation); +// }else { +// test operation=new test(app, session); +// session.queueOperation(operation); +// } + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + }else{ MessageBox.post("ѡBOMLine","",2); } diff --git a/src/com/connor/dfl/plm/dfl046/ChangeDbomUtil.java b/src/com/connor/dfl/plm/dfl046/ChangeDbomUtil.java index 25dfa1a..40b816b 100644 --- a/src/com/connor/dfl/plm/dfl046/ChangeDbomUtil.java +++ b/src/com/connor/dfl/plm/dfl046/ChangeDbomUtil.java @@ -1,26 +1,26 @@ package com.connor.dfl.plm.dfl046; -import java.util.List; +//import java.util.List; -import com.teamcenter.rac.aif.kernel.AIFComponentContext; -import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +//import com.teamcenter.rac.aif.kernel.AIFComponentContext; +//import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; import com.teamcenter.rac.aifrcp.AIFUtility; -import com.teamcenter.rac.kernel.TCComponent; -import com.teamcenter.rac.kernel.TCComponentBOMLine; -import com.teamcenter.rac.kernel.TCComponentBOMViewRevision; -import com.teamcenter.rac.kernel.TCComponentBOMWindow; -import com.teamcenter.rac.kernel.TCComponentBOMWindowType; -import com.teamcenter.rac.kernel.TCComponentContextList; -import com.teamcenter.rac.kernel.TCComponentItemRevision; -import com.teamcenter.rac.kernel.TCComponentQuery; -import com.teamcenter.rac.kernel.TCComponentQueryType; +//import com.teamcenter.rac.kernel.TCComponent; +//import com.teamcenter.rac.kernel.TCComponentBOMLine; +//import com.teamcenter.rac.kernel.TCComponentBOMViewRevision; +//import com.teamcenter.rac.kernel.TCComponentBOMWindow; +//import com.teamcenter.rac.kernel.TCComponentBOMWindowType; +//import com.teamcenter.rac.kernel.TCComponentContextList; +//import com.teamcenter.rac.kernel.TCComponentItemRevision; +//import com.teamcenter.rac.kernel.TCComponentQuery; +//import com.teamcenter.rac.kernel.TCComponentQueryType; import com.teamcenter.rac.kernel.TCException; import com.teamcenter.rac.kernel.TCPreferenceService; -import com.teamcenter.rac.kernel.TCQueryClause; +//import com.teamcenter.rac.kernel.TCQueryClause; import com.teamcenter.rac.kernel.TCSession; -import com.teamcenter.rac.kernel.TCTextService; -import com.teamcenter.rac.kernel.TCTypeService; +//import com.teamcenter.rac.kernel.TCTextService; +//import com.teamcenter.rac.kernel.TCTypeService; import com.teamcenter.rac.kernel.TCUserService; -import com.teamcenter.rac.util.MessageBox; +//import com.teamcenter.rac.util.MessageBox; public class ChangeDbomUtil { public static TCPreferenceService service; diff --git a/src/com/connor/dfl/plm/dfl046/test.java b/src/com/connor/dfl/plm/dfl046/test.java index f87677a..48b0d8d 100644 --- a/src/com/connor/dfl/plm/dfl046/test.java +++ b/src/com/connor/dfl/plm/dfl046/test.java @@ -19,7 +19,7 @@ import org.apache.poi.xssf.usermodel.XSSFCellStyle; import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; -import org.jacorb.idl.runtime.int_token; +//import org.jacorb.idl.runtime.int_token; import com.connor.dfl.plm.dfl019.ClassPropBean; import com.connor.dfl.plm.dfl019.ItemBean; @@ -769,7 +769,7 @@ public class test extends AbstractAIFOperation { if("T2_outsourceRevision".equals(type)) { xuhao1 = num ; String classID = item_id1.substring(0, 2); - item_id1 = item_id1+rev_id1; + //item_id1 = item_id1+rev_id1; oldid1 = rev.getStringProperty("t2_OldId"); System.out.println("classID==============="+classID); if("51".equals(classID) || "72".equals(classID) || "76".equals(classID)) { diff --git a/src/com/connor/dfl/plm/exportBOM/AutoCreateBean.java b/src/com/connor/dfl/plm/exportBOM/AutoCreateBean.java index 469458c..5d32fda 100644 --- a/src/com/connor/dfl/plm/exportBOM/AutoCreateBean.java +++ b/src/com/connor/dfl/plm/exportBOM/AutoCreateBean.java @@ -12,6 +12,7 @@ public class AutoCreateBean { private String importance;//Ҫ private String num;// private int level;//ȼ + public String getItem_id() { return item_id; } diff --git a/src/com/connor/dfl/plm/exportBOM/BOMExportHandler.java b/src/com/connor/dfl/plm/exportBOM/BOMExportHandler.java index 8b457d3..d00f81b 100644 --- a/src/com/connor/dfl/plm/exportBOM/BOMExportHandler.java +++ b/src/com/connor/dfl/plm/exportBOM/BOMExportHandler.java @@ -3,24 +3,15 @@ package com.connor.dfl.plm.exportBOM; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.handlers.HandlerUtil; import com.teamcenter.rac.aif.AbstractAIFApplication; import com.teamcenter.rac.aifrcp.AIFUtility; -import com.teamcenter.rac.kernel.TCComponentBOMLine; +import com.teamcenter.rac.kernel.TCComponentGroup; import com.teamcenter.rac.kernel.TCSession; -import com.teamcenter.rac.pse.common.BOMLineNode; -import com.teamcenter.rac.pse.common.BOMTreeTableModel; -import com.teamcenter.rac.pse.operations.ExpandBelowOperation; -import com.teamcenter.rac.psebase.AbstractBOMLineViewerApplication; -import com.teamcenter.rac.psebase.common.AbstractViewableTreeTable; -import com.teamcenter.rac.util.AdapterUtil; -import com.teamcenter.rac.util.MessageBox; /** * Our sample handler extends AbstractHandler, an IHandler base class. + * * @see org.eclipse.core.commands.IHandler * @see org.eclipse.core.commands.AbstractHandler */ @@ -32,21 +23,45 @@ public class BOMExportHandler extends AbstractHandler { } /** - * the command has been executed, so extract extract the needed information - * from the application context. + * the command has been executed, so extract extract the needed information from + * the application context. */ - + public Object execute(ExecutionEvent event) throws ExecutionException { - - AbstractAIFApplication app=AIFUtility.getCurrentApplication(); - //DL2_VehicleRevision DL2_EBOM - if(app.getTargetComponent() instanceof TCComponentBOMLine){ - TCSession session=(TCSession) app.getSession(); - test operation=new test(app, session); - session.queueOperation(operation); - }else{ - MessageBox.post("ѡBOMLine","",2); + + AbstractAIFApplication app = AIFUtility.getCurrentApplication(); + // DL2_VehicleRevision DL2_EBOM +// if(app.getTargetComponent() instanceof TCComponentItemRevision){ + TCSession session = (TCSession) app.getSession(); + try { + TCComponentGroup group = session.getCurrentGroup(); + String group_name = group.getStringProperty("display_name"); +// if(group_name.contains("װ")|| group_name.contains("JCBZ")) { +// SelectDialog dialog = new SelectDialog(app); +// new Thread(dialog).start(); +// }else{ +// test2 operation = new test2(app, session); +// session.queueOperation(operation); +// } + //2023/2/12޸ + SelectDialog dialog = new SelectDialog(app); + new Thread(dialog).start(); +// String name = event.getCommand().getName(); +// if("BOM-ƴӰ汾".equals(name)) { +// test2 operation = new test2(app, session); +// session.queueOperation(operation); +// }else { +// test operation = new test(app, session); +// session.queueOperation(operation); +// } + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); } + +// }else{ +// MessageBox.post("ѡ汾","",2); +// } return null; } } diff --git a/src/com/connor/dfl/plm/exportBOM/test.java b/src/com/connor/dfl/plm/exportBOM/test.java index 4ee84af..6881fe4 100644 --- a/src/com/connor/dfl/plm/exportBOM/test.java +++ b/src/com/connor/dfl/plm/exportBOM/test.java @@ -19,7 +19,7 @@ import org.apache.poi.xssf.usermodel.XSSFCellStyle; import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; -import org.jacorb.idl.runtime.int_token; +//import org.jacorb.idl.runtime.int_token; import com.connor.dfl.plm.dfl019.ClassPropBean; import com.connor.dfl.plm.dfl019.ItemBean; @@ -53,51 +53,51 @@ public class test extends AbstractAIFOperation { private List list = new ArrayList(); private List idlist = new ArrayList(); private List errList = new ArrayList(); - + private String xuninum = "1"; private String xuanzhongid = null; private DataBaseControl2 data; - private String item_id1 = "";//Ʒ item_id - private String rev_id1 = ""; //汾 item_revision_id - private String name1 = "";// object_name - private String oldid1 = "";//Ʒ - private String spec1 = "";// - private String unit1 = "";//λ t2_unit - private String design_num1;// bl_quantity - private String brand1 = "";//Ʒ - private String group1 = "";//Ⱥ - private String source1 = "";//Դ - private String weihao1 = "";// T2_weihao - private String importance1 = "";//Ҫ t2_BOMImportance - private String price1 = "";// - private String total1 = "";//ܼ - private int xuhao1 ; + private String item_id1 = "";// Ʒ item_id + private String rev_id1 = ""; // 汾 item_revision_id + private String name1 = "";// object_name + private String oldid1 = "";// Ʒ + private String spec1 = "";// + private String unit1 = "";// λ t2_unit + private String design_num1;// bl_quantity + private String brand1 = "";// Ʒ + private String group1 = "";// Ⱥ + private String source1 = "";// Դ + private String weihao1 = "";// T2_weihao + private String importance1 = "";// Ҫ t2_BOMImportance + private String price1 = "";// + private String total1 = "";// ܼ + private int xuhao1; private String zhangtao = ""; + public test(AbstractAIFApplication app, TCSession session) { this.app = app; this.session = session; - this.data = new DataBaseControl2(session,"DFL2_ERP_SQL_Connect"); + this.data = new DataBaseControl2(session, "DFL2_ERP_SQL_Connect"); String[] BOMZT = session.getPreferenceService().getStringValues("DFL2_ZHANGTAO_WAREHOUSE"); - - if (BOMZT == null || BOMZT.length <= 0 ) { - MessageBox.post("ѡDFL2_ZHANGTAO_WAREHOUSEδ,ϵԱ!!", - "", MessageBox.ERROR); + + if (BOMZT == null || BOMZT.length <= 0) { + MessageBox.post("ѡDFL2_ZHANGTAO_WAREHOUSEδ,ϵԱ!!", "", MessageBox.ERROR); return; } TCComponentGroup group = session.getCurrentGroup(); try { String group_name = group.getStringProperty("display_name"); - System.out.println("11.04group_name=============="+group_name); - if(group_name.contains(".")) { + System.out.println("11.04group_name==============" + group_name); + if (group_name.contains(".")) { String[] names = group_name.split("\\."); - if(names != null && names.length >=2) { + if (names != null && names.length >= 2) { for (int i = 0; i < BOMZT.length; i++) { - if(BOMZT[i].contains(";")) { - String[] zts = BOMZT[i].split(";"); - if(names[names.length-2].equals(zts[0])) { + if (BOMZT[i].contains(";")) { + String[] zts = BOMZT[i].split(";"); + if (names[names.length - 2].equals(zts[0])) { this.zhangtao = zts[1]; - System.out.println("11.04======"+zhangtao); - + System.out.println("11.04======" + zhangtao); + break; } } @@ -109,66 +109,114 @@ public class test extends AbstractAIFOperation { e.printStackTrace(); } } + @Override public void executeOperation() throws Exception { - // TCUserService service = session.getUserService(); + // TCUserService service = session.getUserService(); // ParseXMLUtil xml=new ParseXMLUtil(); // File classfile=xml.getSXX("DFL_CLASS_Xml", session); // attrList =xml.parseXMLCode(classfile); +// try { +// +// } catch (TCException e2) { +// e2.printStackTrace(); +// } + TCComponentItemRevision rev = null; + TCComponentItem item = null; try { + System.out.println("·"); ChangeDbomUtil.setByPass(true); - } catch (TCException e2) { - e2.printStackTrace(); - } - try { + System.out.println("ʼȡBOMģ"); String puid = session.getPreferenceService().getStringValue("DFL3_BOM_UID"); - System.out.println("puid======================"+puid); - if (puid == null||"".equals(puid)) { - MessageBox.post("ѡDFL3_BOM_UIDδ,ϵԱ!!", - "", MessageBox.ERROR); + System.out.println("puid======================" + puid); + if (puid == null || "".equals(puid)) { + MessageBox.post("ѡDFL3_BOM_UIDδ,ϵԱ!!", "", MessageBox.ERROR); return; } + TCComponentDataset excel = (TCComponentDataset) session.stringToComponent(puid); - File file = ((TCComponentDataset)excel).getTcFiles()[0].getFmsFile(); - SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");// ڸʽ - String time = df.format(new Date()); - FileSystemView fsv = FileSystemView.getFileSystemView(); - String pathRoute = fsv.getHomeDirectory().getPath() + File.separator + "BOMܱ" + time + ".xlsx"; - String pathRoute1 = fsv.getHomeDirectory().getPath() + File.separator + "BOMձ" + time + ".xlsx"; - wait = new ProgressBarThread("ձ", "ִУԵ..."); - wait.start();// - TCComponentBOMLine line = (TCComponentBOMLine) app.getTargetComponent(); - xuanzhongid = line.getStringProperty("awb0BomLineItemId"); - try { - int level = 0; - int num = 0; - //getAndSetValue(line,level,num); - //writeToExcel(file,pathRoute); - //System.out.println("8.10(1)====="+list); - list.clear(); - //System.out.println("8.10(2)====="+list); - getAndSetValue1(line,level,num); + File file = ((TCComponentDataset) excel).getTcFiles()[0].getFmsFile(); + + InterfaceAIFComponent[] comp = app.getTargetComponents(); + + for (int i = 0; i < comp.length; i++) { + TCComponentBOMLine line = null; + String item_id = null; + if (comp[0] instanceof TCComponentItemRevision) { + rev = (TCComponentItemRevision) comp[i]; + + item = rev.getItem(); + item_id = item.getStringProperty("item_id"); + TCTypeService service = session.getTypeService(); + // ȡBOMWindowType + TCComponentBOMWindowType winType = (TCComponentBOMWindowType) service.getTypeComponent("BOMWindow"); + // һµwindow + TCComponentBOMWindow view = winType.create(null); + line = view.setWindowTopLine(item, rev, null, null); + } else if (comp[0] instanceof TCComponentBOMLine) { + TCComponentBOMLine get_bom_line = (TCComponentBOMLine) comp[0]; + rev = get_bom_line.getItemRevision(); + item = rev.getItem(); + item_id = item.getStringProperty("item_id"); + TCTypeService service = session.getTypeService(); + // ȡBOMWindowType + TCComponentBOMWindowType winType = (TCComponentBOMWindowType) service.getTypeComponent("BOMWindow"); + // һµwindow + TCComponentBOMWindow view = winType.create(null); + line = view.setWindowTopLine(item, rev, null, null); + }else { + MessageBox.post("ϵͳϵԱ","",MessageBox.ERROR); + } - writeToExcel(file,pathRoute1); - //System.out.println("9.15(3)====="+list); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); + SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");// ڸʽ + String time = df.format(new Date()); + FileSystemView fsv = FileSystemView.getFileSystemView(); + String pathRoute = fsv.getHomeDirectory().getPath() + File.separator + "BOMܱ" + time + ".xlsx"; + String pathRoute1 = fsv.getHomeDirectory().getPath() + File.separator + item_id + "BOMձ" + time + + ".xlsx"; + wait = new ProgressBarThread("ձ", "ִУԵ..."); + wait.start();// + + // TCComponentBOMLine line = (TCComponentBOMLine) comp[i]; + + // TCComponentBOMLine line = (TCComponentBOMLine) app.getTargetComponent(); + xuanzhongid = line.getStringProperty("awb0BomLineItemId"); + try { + int level = 0; + int num = 0; + // getAndSetValue(line,level,num); + // writeToExcel(file,pathRoute); + // System.out.println("8.10(1)====="+list); + list.clear(); + // System.out.println("8.10(2)====="+list); + getAndSetValue1(line, level, num); + + writeToExcel(file, pathRoute1); + // System.out.println("9.15(3)====="+list); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + wait.setBool(true);// رս + wait.interrupt(); + MessageBox.post("ɱʧ" + e.getMessage(), "", MessageBox.ERROR); + return; + } + wait.setBool(true);// رս wait.interrupt(); - MessageBox.post("ɱʧ"+e.getMessage(),"",MessageBox.ERROR); - return; + MessageBox.post("ɱ,鿴", "", MessageBox.INFORMATION); + Runtime.getRuntime().exec("cmd /c \"" + pathRoute + "\""); + Runtime.getRuntime().exec("cmd /c \"" + pathRoute1 + "\""); } - wait.setBool(true);// رս - wait.interrupt(); - MessageBox.post("ɱ,鿴","",MessageBox.INFORMATION); - Runtime.getRuntime().exec("cmd /c \"" + pathRoute + "\""); - Runtime.getRuntime().exec("cmd /c \"" + pathRoute1 + "\""); + + + } catch (Exception e) { e.printStackTrace(); } + try { ChangeDbomUtil.setByPass(false); } catch (TCException e2) { @@ -176,97 +224,123 @@ public class test extends AbstractAIFOperation { } } - - - //ձĻȡ - private void getAndSetValue1(TCComponentBOMLine bomLine,int level,int num) { - - //һϣ⹺Эһ + + // ձĻȡ + private void getAndSetValue1(TCComponentBOMLine bomLine, int level, int num) { + + // һϣ⹺Эһ List wai = new ArrayList(); - //һϣһ + // һϣһ List xu = new ArrayList(); // TODO Auto-generated method stub try { - //ͨ + // ͨ Unpack(bomLine); - //System.out.println("level================"+level); + // System.out.println("level================"+level); String firstnum = ""; - //TCComponentItemRevision eqrev = bomLine.getItemRevision(); + // TCComponentItemRevision eqrev = bomLine.getItemRevision(); String firstid = bomLine.getStringProperty("awb0BomLineItemId"); - - //жDzǵһ㼶 - if(xuanzhongid.equals(firstid)) { + + // жDzǵһ㼶 + if (xuanzhongid.equals(firstid)) { firstnum = "1"; - }else { - getItemValue1(bomLine,level,num); - firstnum =design_num1; - System.out.println("9.22.19.32һ㼶====="+firstnum); + } else { + getItemValue1(bomLine, level, num); + firstnum = design_num1; + System.out.println("9.22.19.32һ㼶=====" + firstnum); } - //Ӽ + // Ӽ AIFComponentContext[] childs = bomLine.getChildren(); - //жǷӼ - if(childs != null && childs.length > 0 ) { - //㼶+1 - //level++; - //Ӽ - for (int i = 0; i < childs.length; i++) { - //ѡеĶ - InterfaceAIFComponent comp = childs[i].getComponent(); - //ѡеĶİ汾 - TCComponentItemRevision rev = ((TCComponentBOMLine) comp).getItemRevision(); - String type = rev.getStringProperty("object_type"); - String occType = bomLine.getStringProperty("TCAI_OCC_TYPE"); - //жǷΪ0 - if("0".equals(firstnum)) { - break; - } - //жǷbomline - if(comp instanceof TCComponentBOMLine) { - //жǷΪ贫ݵ - if (!"Reference".equals(occType)) - { - //汾⹺汾Э汾ȡ - if("T2_outsourceRevision".equals(type) || "T2_OutBuyPartRevision".equals(type)) { - //ĶǿתΪbomline + // жǷӼ + if (childs != null && childs.length > 0) { + // 㼶+1 + // level++; + // Ӽ + for (int i = 0; i < childs.length; i++) { + // ѡеĶ + InterfaceAIFComponent comp = childs[i].getComponent(); + // ѡеĶİ汾 + TCComponentItemRevision rev = ((TCComponentBOMLine) comp).getItemRevision(); + String type = rev.getStringProperty("object_type"); + String occType = bomLine.getStringProperty("TCAI_OCC_TYPE"); + // жǷΪ0 + if ("0".equals(firstnum)) { + break; + } + // жǷbomline + if (comp instanceof TCComponentBOMLine) { + // жǷΪ贫ݵ + if ("Reference".compareToIgnoreCase(((TCComponentBOMLine) comp).getStringProperty("TCAI_OCC_TYPE"))!=0) { + // 汾⹺汾Э汾ȡ + if ("T2_outsourceRevision".equals(type) || "T2_OutBuyPartRevision".equals(type)) { + System.out.println("reference=====>"+((TCComponentBOMLine) comp).getStringProperty("TCAI_OCC_TYPE")); + // ĶǿתΪbomline TCComponentBOMLine ziLine = (TCComponentBOMLine) comp; wai.add(ziLine); - } - //⹺Э - else { + } + // ⹺Э + else { TCComponentBOMLine ziLine = (TCComponentBOMLine) comp; xu.add(ziLine); - } } - } + } } - //⹺Э - if(wai.size()>0) { - - - for (int i = 0;i 0) { + + for (int i = 0; i < wai.size(); i++) { num++; - TCComponentBOMLine waiLine = wai.get(i); - getItemValue1(waiLine,level,num); - + TCComponentBOMLine waiLine = wai.get(i); + getItemValue1(waiLine, level, num); + List beanList1 = new ArrayList(); + + //и + // System.out.println("9.22id === ==="+xuniid); + String id = ""; + double count = Double.valueOf(design_num1).doubleValue(); + int z = 0; - double a = Double.valueOf(xuninum).doubleValue(); - System.out.println("a--915======"+a); - double b = Double.valueOf(design_num1).doubleValue(); - System.out.println("b--915======"+b); -// double c = Double.valueOf(firstnum).doubleValue(); -// System.out.println("c--915======"+c); - double d = a*b; - design_num1 = ""+d; - System.out.println("design_num9.15======"+design_num1); - String xuhao2 = xuhao1+""; - //Եַ + System.out.println("iddddd="+item_id1); + TCComponentBOMLine parent = waiLine.parent(); + // String tempId = waiLine.getStringProperty("awb0BomLineItemId"); + // while(!xuanzhongid.equals(id)) { + while(z < 4) { + + + if(parent != null) { + id = parent.getStringProperty("awb0BomLineItemId"); + System.out.println("ID-----"+id); + String quantity = parent.getStringProperty("bl_quantity"); + if(quantity != null && quantity.length() > 0 ) { + count = count * Double.valueOf(quantity).doubleValue(); + parent = parent.parent(); + } + }else { + System.out.println("111111111"); + break; + } + z++; + } +// double a = Double.valueOf(xuninum).doubleValue(); +// System.out.println("a--915======" + a); +// double b = Double.valueOf(design_num1).doubleValue(); +// System.out.println("b--915======" + b); +//// double c = Double.valueOf(firstnum).doubleValue(); +//// System.out.println("c--915======"+c); +// +// double d = a * b; + design_num1 = "" + count; + System.out.println("design_num9.15======" + design_num1); + String xuhao2 = xuhao1 + ""; + // Եַ beanList1.add(xuhao2); beanList1.add(item_id1); beanList1.add(rev_id1); beanList1.add(name1); beanList1.add(oldid1); - //beanList1.add(lev1); //Ҫ㼶 + // beanList1.add(lev1); //Ҫ㼶 beanList1.add(spec1); beanList1.add(unit1); beanList1.add(design_num1); @@ -277,122 +351,120 @@ public class test extends AbstractAIFOperation { beanList1.add(importance1); // beanList1.add(price1); // beanList1.add(total1); - System.out.println("beanList19.15====="+beanList1); - //߼ж - boolean include=idlist.contains(item_id1);//true - //System.out.println("Ƿ9.18====="+include); + System.out.println("beanList19.15=====" + beanList1); + // ߼ж + boolean include = idlist.contains(item_id1);// true + // System.out.println("Ƿ9.18====="+include); boolean panduan = true; - //ٽididlist + // ٽididlist idlist.add(item_id1); - //System.out.println("idlist9.18====="+idlist); - //ַϵ + // System.out.println("idlist9.18====="+idlist); + // ַϵ if (include == panduan) { - //list - + // list + for (int j = 0; j < list.size(); j++) { int m = list.size(); - //System.out.println("9.18listij"+m); + // System.out.println("9.18listij"+m); List beanList2 = new ArrayList(); beanList2 = list.get(j); - //System.out.println("9.18beanList2====="+beanList2); - boolean include1=beanList2.contains(item_id1);//true - //Ϊ棬޸ - if(include1 == panduan) { + // System.out.println("9.18beanList2====="+beanList2); + boolean include1 = beanList2.contains(item_id1);// true + // Ϊ棬޸ + if (include1 == panduan) { String numString = null; - for(int k = 0 ; k<=beanList2.size() ; k++) { - numString = beanList2.get(7); - System.out.println("9.18====="+numString); + for (int k = 0; k <= beanList2.size(); k++) { + numString = beanList2.get(7); + System.out.println("9.18=====" + numString); } - double before = Double.valueOf(numString).doubleValue(); - double add = Double.valueOf(design_num1).doubleValue(); - double sum = before+add; - //String sum = ""+before+add; - System.out.println("9.18sum====="+sum); - beanList2.set(7, ""+sum); - list.set(j, beanList2); + double before = Double.valueOf(numString).doubleValue(); + double add = Double.valueOf(design_num1).doubleValue(); + double sum = before + add; + // String sum = ""+before+add; + System.out.println("9.18sum=====" + sum); + beanList2.set(7, "" + sum); + list.set(j, beanList2); } } - }else if(include!=panduan){ - list.add(beanList1); - System.out.println("list9.15====="+list); - } - } + } else if (include != panduan) { + list.add(beanList1); + System.out.println("list9.15=====" + list); + } } - // - if(xu.size()>0) { - - - for (int i = 0;i 0) { + + for (int i = 0; i < xu.size(); i++) { + TCComponentBOMLine xuLine = xu.get(i); + String xuniid = xuLine.getStringProperty("awb0BomLineItemId"); + + // жûиûϣѭ AIFComponentContext[] childs23 = xuLine.getChildren(); - int geshu = childs23.length; - System.out.println("Ϊ9.22====="+geshu+"====="+xuniid); - if (childs23.length <= 0 ) { + int geshu = childs23.length; + System.out.println("Ϊ9.22=====" + geshu + "=====" + xuniid); + if (childs23.length <= 0) { System.out.println("9.22ִ"); continue; } - //System.out.println("9.22id === ==="+xuniid); design_num1 = "1"; - //Ƚ(xuninum)ֵΪȡֵ + // Ƚ(xuninum)ֵΪȡֵ xuninum = design_num1; - System.out.println("8.12"+xuninum+"===9.22id==="+xuniid); - //Ϊdoublea + System.out.println("8.12" + xuninum + "===9.22id===" + xuniid); + // Ϊdoublea double a = Double.valueOf(xuninum).doubleValue(); - System.out.println("8.12doublea"+a+"===9.22id==="+xuniid); - getItemValue1(xuLine,level,xuhao1); - //ûȡΪdoubleb - System.out.println("9.22зdesign_num1ֵ====="+design_num1); + System.out.println("8.12doublea" + a + "===9.22id===" + xuniid); + getItemValue1(xuLine, level, xuhao1); + // ûȡΪdoubleb + System.out.println("9.22зdesign_num1ֵ=====" + design_num1); double b = Double.valueOf(design_num1).doubleValue(); - System.out.println("8.12doubleb"+b+"===9.22id==="+xuniid); - - //double c = a*b; + System.out.println("8.12doubleb" + b + "===9.22id===" + xuniid); + + // double c = a*b; double c = Double.valueOf(firstnum).doubleValue(); - System.out.println("c--915======"+c); - //õ˵ - double d = a*b*c; - System.out.println("8.12doublec"+d+"===9.22id==="+xuniid); - design_num1 = ""+d; - //һ˻ֵxuninum + System.out.println("c--915======" + c); + // õ˵ + double d = a * b * c; + System.out.println("8.12doublec" + d + "===9.22id===" + xuniid); + design_num1 = "" + d; + // һ˻ֵxuninum xuninum = design_num1; - System.out.println("8.12һ"+xuninum+"===9.22id==="+xuniid); - - //ݹ - getAndSetValue1(xuLine,level,xuhao1); - } + System.out.println("8.12һ" + xuninum + "===9.22id===" + xuniid); + + // ݹ + getAndSetValue1(xuLine, level, xuhao1); } - //level--; + } + // level--; } } catch (TCException e) { // TODO Auto-generated catch block e.printStackTrace(); } } - private void getAndSetValue(TCComponentBOMLine bomLine,int level,int num) { + + private void getAndSetValue(TCComponentBOMLine bomLine, int level, int num) { // TODO Auto-generated method stub try { - System.out.println("level================"+level); - getItemValue(bomLine,level,num); + System.out.println("level================" + level); + getItemValue(bomLine, level, num); AIFComponentContext[] childs = bomLine.getChildren(); - if(childs != null && childs.length > 0 ) { - level++; - for (int i = 0; i < childs.length; i++) { - num++; - InterfaceAIFComponent comp = childs[i].getComponent(); - TCComponentItemRevision rev = ((TCComponentBOMLine) comp).getItemRevision(); - String type = rev.getStringProperty("object_type"); - - if(comp instanceof TCComponentBOMLine) { - TCComponentBOMLine ziLine = (TCComponentBOMLine) comp; - getAndSetValue(ziLine,level,num); - - - } + if (childs != null && childs.length > 0) { + level++; + for (int i = 0; i < childs.length; i++) { + num++; + InterfaceAIFComponent comp = childs[i].getComponent(); + TCComponentItemRevision rev = ((TCComponentBOMLine) comp).getItemRevision(); + String type = rev.getStringProperty("object_type"); + + if (comp instanceof TCComponentBOMLine) { + TCComponentBOMLine ziLine = (TCComponentBOMLine) comp; + getAndSetValue(ziLine, level, num); + } - level--; + } + level--; } } catch (TCException e) { // TODO Auto-generated catch block @@ -402,34 +474,35 @@ public class test extends AbstractAIFOperation { /** * д뵽excel - * @throws Exception + * + * @throws Exception */ - private void writeToExcel(File file,String path) throws Exception{ + private void writeToExcel(File file, String path) throws Exception { FileInputStream fis = new FileInputStream(file); XSSFWorkbook workbook = new XSSFWorkbook(fis); - System.out.println("workBook:"+workbook); + System.out.println("workBook:" + workbook); XSSFSheet sheet = workbook.getSheetAt(0); XSSFRow targetRow = sheet.getRow(0); XSSFCell targetCell = targetRow.getCell(0); XSSFCellStyle cellStyle = targetCell.getCellStyle(); int startRow = 1; - - if(list != null && list.size() > 0) { + + if (list != null && list.size() > 0) { for (int i = 0; i < list.size(); i++) { XSSFRow row = sheet.getRow(startRow); - if(row == null) { + if (row == null) { row = sheet.createRow(startRow); } List beanList = list.get(i); for (int j = 0; j < beanList.size(); j++) { XSSFCell cell = row.getCell(j); - if(cell == null) { + if (cell == null) { cell = row.createCell(j); } cell.setCellStyle(cellStyle); cell.setCellValue(beanList.get(j)); - } + } startRow++; } } @@ -442,23 +515,23 @@ public class test extends AbstractAIFOperation { public List getOutBuyPartValue(TCComponentItemRevision rev) { // TODO Auto-generated method stub List vals = new ArrayList(); - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new StringBuilder(); List classPropList = new ArrayList(); - TCClassificationService classificationService = session.getClassificationService(); + TCClassificationService classificationService = session.getClassificationService(); try { String className = rev.getClassificationClass(); TCComponentICO[] icos = rev.getClassificationObjects(); ICSAdminClass c = classificationService.newICSAdminClass(); c.load(className); - //String icoPUID = icos[0].getUid(); + // String icoPUID = icos[0].getUid(); Map claMap = new HashMap(); - if(icos != null && icos.length>0){ + if (icos != null && icos.length > 0) { ICSProperty[] icss = icos[0].getICSProperties(true); for (ICSProperty ics : icss) { claMap.put(ics.getId(), ics.getValue()); } } - for(Map.Entry entry : claMap.entrySet()){ + for (Map.Entry entry : claMap.entrySet()) { System.out.println("key = " + entry.getKey() + ", value = " + entry.getValue()); } ICSAdminClassAttribute[] icsAttrS = c.getAttributes(); @@ -476,67 +549,67 @@ public class test extends AbstractAIFOperation { } for (int j = 0; j < attrList.size(); j++) { String classValue = attrList.get(j); - System.out.println("classValue=================="+classValue); - if(classValue.contains(";")) { + System.out.println("classValue==================" + classValue); + if (classValue.contains(";")) { String[] classValues = classValue.split(";"); - if(className.equals(classValues[0])) { + if (className.equals(classValues[0])) { for (int k = 1; k < classValues.length; k++) { String attrName = classValues[k]; - System.out.println("attrName=================="+attrName); + System.out.println("attrName==================" + attrName); for (int i = 0; i < classPropList.size(); i++) { ClassPropBean bean = classPropList.get(i); - System.out.println("bean.propDisName=================="+bean.propDisName); - if(attrName.equals(bean.propDisName)) { + System.out.println("bean.propDisName==================" + bean.propDisName); + if (attrName.equals(bean.propDisName)) { String value = claMap.get(bean.propID); - System.out.println("bean.propID=================="+bean.propID); - if(bean.isLov) { + System.out.println("bean.propID==================" + bean.propID); + if (bean.isLov) { String lovValue = bean.lovMapping.get(value); - System.out.println("lovValue===================="+lovValue); - if("Ʒ".equals(attrName) || "λ".equals(attrName)) { - StringBuilder sb1 = new StringBuilder(attrName); + System.out.println("lovValue====================" + lovValue); + if ("Ʒ".equals(attrName) || "λ".equals(attrName)) { + StringBuilder sb1 = new StringBuilder(attrName); sb1.append("="); sb1.append(lovValue); vals.add(sb1.toString()); - if("/".equals(lovValue)) { + if ("/".equals(lovValue)) { System.out.println("ƴ"); break; } sb.append(lovValue); - if(k < classValues.length-1) { + if (k < classValues.length - 1) { sb.append(";"); } - }else { - if("/".equals(lovValue)) { + } else { + if ("/".equals(lovValue)) { System.out.println("ƴ"); break; } sb.append(lovValue); - if(k < classValues.length-1) { + if (k < classValues.length - 1) { sb.append(";"); } - } - }else { - if("Ʒ".equals(attrName) || "λ".equals(attrName)) { - StringBuilder sb1 = new StringBuilder(attrName); + } + } else { + if ("Ʒ".equals(attrName) || "λ".equals(attrName)) { + StringBuilder sb1 = new StringBuilder(attrName); sb1.append("="); sb1.append(value); vals.add(sb1.toString()); - if("/".equals(value)) { + if ("/".equals(value)) { System.out.println("ƴ"); break; } sb.append(value); - if(k < classValues.length-1) { + if (k < classValues.length - 1) { sb.append(";"); } - }else { - System.out.println("value===================="+value); - if("/".equals(value)) { + } else { + System.out.println("value====================" + value); + if ("/".equals(value)) { System.out.println("ƴ"); break; } sb.append(value); - if(k < classValues.length-1) { + if (k < classValues.length - 1) { sb.append(";"); } } @@ -547,7 +620,7 @@ public class test extends AbstractAIFOperation { } break; } - } + } } } catch (TCException e) { // TODO Auto-generated catch block @@ -557,60 +630,61 @@ public class test extends AbstractAIFOperation { vals.add(spec); return vals; } + private String getOutsourceValue(TCComponentItemRevision rev) { // TODO Auto-generated method stub StringBuilder sb = new StringBuilder(); try { String importance = rev.getStringProperty("t2_Importance"); - if(!("".equals(importance.trim()))) { + if (!("".equals(importance.trim()))) { sb.append(importance); sb.append(";"); } String material = rev.getStringProperty("t2_material"); - if(!("".equals(material.trim()))) { + if (!("".equals(material.trim()))) { sb.append(material); sb.append(";"); } String mass = rev.getStringProperty("t2_MASS"); - if(!("".equals(mass.trim()))) { + if (!("".equals(mass.trim()))) { sb.append(mass); sb.append(";"); } String specifications = rev.getStringProperty("t2_Specifications"); - if(!("".equals(specifications.trim()))) { + if (!("".equals(specifications.trim()))) { sb.append(specifications); } } catch (TCException e) { // TODO Auto-generated catch block e.printStackTrace(); - } - String spec = sb.toString(); + } + String spec = sb.toString(); return spec; } - public void getItemValue(TCComponentBOMLine comp,int level,int num) throws TCException { - + public void getItemValue(TCComponentBOMLine comp, int level, int num) throws TCException { + List beanList = new ArrayList(); - String item_id = "";//Ʒ item_id - String name = "";// object_name - String spec = "";// - String unit = "";//λ t2_unit - String design_num = "";// bl_quantity - String brand = "";//Ʒ - String group = "";//Ⱥ - String source = "";//Դ - String weihao = "";// T2_weihao - String importance = "";//Ҫ t2_BOMImportance + String item_id = "";// Ʒ item_id + String name = "";// object_name + String spec = "";// + String unit = "";// λ t2_unit + String design_num = "";// bl_quantity + String brand = "";// Ʒ + String group = "";// Ⱥ + String source = "";// Դ + String weihao = "";// T2_weihao + String importance = "";// Ҫ t2_BOMImportance String xuhao = num + ""; String lev = level + ""; - TCComponentItemRevision rev = comp.getItemRevision(); + TCComponentItemRevision rev = comp.getItemRevision(); try { design_num = comp.getStringProperty("T2_ActualConsumption"); - if(design_num == null || "".equals(design_num) || " ".equals(design_num)) { + if (design_num == null || "".equals(design_num) || " ".equals(design_num)) { design_num = comp.getStringProperty("T2_DesignQuantity"); - if(design_num == null || "".equals(design_num) || " ".equals(design_num)) { + if (design_num == null || "".equals(design_num) || " ".equals(design_num)) { design_num = comp.getStringProperty("bl_quantity"); - if(design_num == null || "".equals(design_num) || " ".equals(design_num)) { + if (design_num == null || "".equals(design_num) || " ".equals(design_num)) { design_num = "1"; } } @@ -622,11 +696,11 @@ public class test extends AbstractAIFOperation { importance = comp.getStringProperty("t2_BOMImportance"); item_id = rev.getStringProperty("item_id"); name = rev.getStringProperty("object_name"); - if("T2_outsourceRevision".equals(type)) { - + if ("T2_outsourceRevision".equals(type)) { + String classID = item_id.substring(0, 2); - System.out.println("classID==============="+classID); - if("51".equals(classID) || "72".equals(classID) || "76".equals(classID)) { + System.out.println("classID===============" + classID); + if ("51".equals(classID) || "72".equals(classID) || "76".equals(classID)) { // List vals= getOutBuyPartValue(rev); // if(vals == null) { // return ; @@ -651,18 +725,18 @@ public class test extends AbstractAIFOperation { // spec = value; // } // } - ClassValueBean valueBean = ClassValueUtil.getOutBuyPartValue(rev,errList); - if(valueBean != null) { + ClassValueBean valueBean = ClassValueUtil.getOutBuyPartValue(rev, errList); + if (valueBean != null) { spec = valueBean.getSpecs(); - }else { + } else { return; } - }else { + } else { spec = getOutsourceValue(rev); } unit = rev.getStringProperty("t2_unit"); - }else if("T2_OutBuyPartRevision".equals(type)) { + } else if ("T2_OutBuyPartRevision".equals(type)) { // List vals= getOutBuyPartValue(rev); // for (int j = 0; j < vals.size(); j++) { // String value = vals.get(j); @@ -684,21 +758,21 @@ public class test extends AbstractAIFOperation { // spec = value; // } // } - ClassValueBean valueBean = ClassValueUtil.getOutBuyPartValue(rev,errList); - if(valueBean != null) { + ClassValueBean valueBean = ClassValueUtil.getOutBuyPartValue(rev, errList); + if (valueBean != null) { spec = valueBean.getSpecs(); unit = valueBean.getUnit(); brand = valueBean.getBrand(); - if(spec == null) { + if (spec == null) { spec = ""; } - if(unit == null) { + if (unit == null) { unit = ""; } - if(brand == null) { + if (brand == null) { brand = ""; } - }else { + } else { return; } } @@ -706,12 +780,12 @@ public class test extends AbstractAIFOperation { // TODO Auto-generated catch block e.printStackTrace(); } - System.out.println(item_id+"spec=================="+spec); - + System.out.println(item_id + "spec==================" + spec); + beanList.add(xuhao); beanList.add(item_id); beanList.add(name); - //beanList.add(lev); + // beanList.add(lev); beanList.add(spec); beanList.add(unit); beanList.add(design_num); @@ -720,41 +794,40 @@ public class test extends AbstractAIFOperation { beanList.add(source); beanList.add(weihao); beanList.add(importance); - list.add(beanList); + list.add(beanList); } - public void getItemValue1(TCComponentBOMLine comp,int level,int num) throws TCException { - - - - //lev1 = level + ""; - TCComponentItemRevision rev = comp.getItemRevision(); - + + public void getItemValue1(TCComponentBOMLine comp, int level, int num) throws TCException { + + // lev1 = level + ""; + TCComponentItemRevision rev = comp.getItemRevision(); + try { design_num1 = comp.getStringProperty("T2_ActualConsumption"); - //ʵǴģж - if("Ѵע".equals(design_num1)) { + // ʵǴģж + if ("Ѵע".equals(design_num1)) { + comp.unpack(); + comp.refresh(); + design_num1 = comp.getStringProperty("T2_ActualConsumption"); + } + // жǷΪ + else if (design_num1 == null || "".equals(design_num1) || " ".equals(design_num1)) { + design_num1 = comp.getStringProperty("T2_DesignQuantity"); + // Ǵģж + if ("Ѵע".equals(design_num1)) { comp.unpack(); comp.refresh(); - design_num1 = comp.getStringProperty("T2_ActualConsumption"); - } - //жǷΪ - else if(design_num1 == null || "".equals(design_num1) || " ".equals(design_num1)) { design_num1 = comp.getStringProperty("T2_DesignQuantity"); - //Ǵģж - if("Ѵע".equals(design_num1)) { - comp.unpack(); - comp.refresh(); - design_num1 = comp.getStringProperty("T2_DesignQuantity"); - } - //жǷΪ - else if(design_num1 == null || "".equals(design_num1) || " ".equals(design_num1)) { - design_num1 = comp.getStringProperty("bl_quantity"); - if(design_num1 == null || "".equals(design_num1) || " ".equals(design_num1)) { - design_num1 = "1"; - } + } + // жǷΪ + else if (design_num1 == null || "".equals(design_num1) || " ".equals(design_num1)) { + design_num1 = comp.getStringProperty("bl_quantity"); + if (design_num1 == null || "".equals(design_num1) || " ".equals(design_num1)) { + design_num1 = "1"; } } - + } + String type = rev.getStringProperty("object_type"); group1 = rev.getStringProperty("t2_groupCode"); getgroup(); @@ -767,45 +840,44 @@ public class test extends AbstractAIFOperation { name1 = rev.getStringProperty("object_name"); // price1 = getPrice(); // total1 = getTotal(design_num1,price1); - if("T2_outsourceRevision".equals(type)) { - xuhao1 = num ; + if ("T2_outsourceRevision".equals(type)) { + xuhao1 = num; String classID = item_id1.substring(0, 2); - item_id1 = item_id1+rev_id1; + //item_id1 = item_id1 + rev_id1; oldid1 = rev.getStringProperty("t2_OldId"); - System.out.println("classID==============="+classID); - if("51".equals(classID) || "72".equals(classID) || "76".equals(classID)) { + System.out.println("classID===============" + classID); + if ("51".equals(classID) || "72".equals(classID) || "76".equals(classID)) { - ClassValueBean valueBean = ClassValueUtil.getOutBuyPartValue(rev,errList); - if(valueBean != null) { + ClassValueBean valueBean = ClassValueUtil.getOutBuyPartValue(rev, errList); + if (valueBean != null) { spec1 = valueBean.getSpecs(); - }else { + } else { return; } - }else { + } else { spec1 = getOutsourceValue(rev); } unit1 = rev.getStringProperty("t2_unit"); brand1 = ""; - - - }else if("T2_OutBuyPartRevision".equals(type)) { + + } else if ("T2_OutBuyPartRevision".equals(type)) { xuhao1 = num; - ClassValueBean valueBean = ClassValueUtil.getOutBuyPartValue(rev,errList); + ClassValueBean valueBean = ClassValueUtil.getOutBuyPartValue(rev, errList); oldid1 = rev.getStringProperty("t2_OldID"); - if(valueBean != null) { + if (valueBean != null) { spec1 = valueBean.getSpecs(); unit1 = valueBean.getUnit(); brand1 = valueBean.getBrand(); - if(spec1 == null) { + if (spec1 == null) { spec1 = ""; } - if(unit1 == null) { + if (unit1 == null) { unit1 = ""; } - if(brand1 == null) { + if (brand1 == null) { brand1 = ""; } - }else { + } else { return; } } @@ -813,57 +885,58 @@ public class test extends AbstractAIFOperation { // TODO Auto-generated catch block e.printStackTrace(); } - System.out.println(item_id1+"spec=================="+spec1); + System.out.println(item_id1 + "spec==================" + spec1); } - - //bomѴע + + // bomѴע private void Unpack(TCComponentBOMLine unpackLine) { try { - //Ӽ + // Ӽ AIFComponentContext[] childs = unpackLine.getChildren(); - if(childs != null && childs.length > 0 ) { - //Ӽ - for (int i = 0; i < childs.length; i++) { - //ѡеĶ - InterfaceAIFComponent comp = childs[i].getComponent(); - //ѡеĶİ汾 - TCComponentItemRevision rev = ((TCComponentBOMLine) comp).getItemRevision(); - String type = rev.getStringProperty("object_type"); - - String occType = unpackLine.getStringProperty("TCAI_OCC_TYPE"); - //жǷbomline - if(comp instanceof TCComponentBOMLine) { - if("T2_outsourceRevision".equals(type) || "T2_OutBuyPartRevision".equals(type)) { - if (!"Reference".equals(occType)) - { - List beanList1 = new ArrayList(); - //ĶǿתΪbomline - TCComponentBOMLine ziLine = (TCComponentBOMLine) comp; - //жǷѴעͣȻ - String Judgmentnote = null; - Judgmentnote=ziLine.getStringProperty("T2_ActualConsumption"); - if("Ѵע".equals(Judgmentnote)) { - ziLine.unpack(); - ziLine.refresh(); - unpackLine.refresh(); - }else if (Judgmentnote == null || "".equals(Judgmentnote) || " ".equals(Judgmentnote)) { - Judgmentnote=ziLine.getStringProperty("T2_DesignQuantity"); - }if("Ѵע".equals(Judgmentnote)) { - ziLine.unpack(); - ziLine.refresh(); - unpackLine.refresh(); - } + if (childs != null && childs.length > 0) { + // Ӽ + for (int i = 0; i < childs.length; i++) { + // ѡеĶ + InterfaceAIFComponent comp = childs[i].getComponent(); + // ѡеĶİ汾 + TCComponentItemRevision rev = ((TCComponentBOMLine) comp).getItemRevision(); + String type = rev.getStringProperty("object_type"); + + String occType = unpackLine.getStringProperty("TCAI_OCC_TYPE"); + // жǷbomline + if (comp instanceof TCComponentBOMLine) { + if ("T2_outsourceRevision".equals(type) || "T2_OutBuyPartRevision".equals(type)) { + if ("Reference".compareToIgnoreCase(((TCComponentBOMLine) comp).getStringProperty("TCAI_OCC_TYPE"))!=0) { +// List beanList1 = new ArrayList(); + // ĶǿתΪbomline + TCComponentBOMLine ziLine = (TCComponentBOMLine) comp; + // жǷѴעͣȻ + String Judgmentnote = null; + Judgmentnote = ziLine.getStringProperty("T2_ActualConsumption"); + if ("Ѵע".equals(Judgmentnote)) { + ziLine.unpack(); + ziLine.refresh(); + unpackLine.refresh(); + } else if (Judgmentnote == null || "".equals(Judgmentnote) + || " ".equals(Judgmentnote)) { + Judgmentnote = ziLine.getStringProperty("T2_DesignQuantity"); + } + if ("Ѵע".equals(Judgmentnote)) { + ziLine.unpack(); + ziLine.refresh(); + unpackLine.refresh(); } } } } } - }catch (TCException e) { + } + } catch (TCException e) { // TODO Auto-generated catch block e.printStackTrace(); - } } - + } + // private String getPrice () { // String price = null; // String sql = null; @@ -896,150 +969,151 @@ public class test extends AbstractAIFOperation { // System.out.println("11.08==ܼ====="+total); // return total; // } - //ƥȺ + // ƥȺ private void getgroup() { - if("F10".equals(group1)) { + if ("F10".equals(group1)) { group1 = "豸"; } - if("F11".equals(group1)) { + if ("F11".equals(group1)) { group1 = "ȷ豸"; } - if("F12".equals(group1)) { + if ("F12".equals(group1)) { group1 = ""; } - if("F13".equals(group1)) { + if ("F13".equals(group1)) { group1 = ""; } - if("F14".equals(group1)) { + if ("F14".equals(group1)) { group1 = "ܷ"; } - if("F15".equals(group1)) { + if ("F15".equals(group1)) { group1 = ""; } - if("F16".equals(group1)) { + if ("F16".equals(group1)) { group1 = "Ӿ"; } - if("F17".equals(group1)) { + if ("F17".equals(group1)) { group1 = ""; } - if("F18".equals(group1)) { + if ("F18".equals(group1)) { group1 = "DZ"; } - if("F19".equals(group1)) { + if ("F19".equals(group1)) { group1 = "ԭ"; } - if("F20".equals(group1)) { + if ("F20".equals(group1)) { group1 = "ѧƷ/Ʒ"; } - if("F21".equals(group1)) { + if ("F21".equals(group1)) { group1 = ""; } - if("F22".equals(group1)) { + if ("F22".equals(group1)) { group1 = ""; } - if("F23".equals(group1)) { + if ("F23".equals(group1)) { group1 = "ҩð"; } - if("F24".equals(group1)) { + if ("F24".equals(group1)) { group1 = "ҽúIJ"; } - if("F99".equals(group1)) { + if ("F99".equals(group1)) { group1 = ""; } - if("F50".equals(group1)) { + if ("F50".equals(group1)) { group1 = ""; } - if("F51".equals(group1)) { + if ("F51".equals(group1)) { group1 = "ɻ"; } - if("F52".equals(group1)) { + if ("F52".equals(group1)) { group1 = ""; } - if("F53".equals(group1)) { + if ("F53".equals(group1)) { group1 = ""; } - if("F54".equals(group1)) { + if ("F54".equals(group1)) { group1 = "Һ"; } - if("F55".equals(group1)) { + if ("F55".equals(group1)) { group1 = "ϴƿ"; } - if("F56".equals(group1)) { + if ("F56".equals(group1)) { group1 = ""; } - if("F57".equals(group1)) { + if ("F57".equals(group1)) { group1 = "װ"; } - if("F58".equals(group1)) { + if ("F58".equals(group1)) { group1 = "ǻ"; } - if("F60".equals(group1)) { + if ("F60".equals(group1)) { group1 = ""; } - if("F61".equals(group1)) { + if ("F61".equals(group1)) { group1 = "Ƽ"; } - if("F62".equals(group1)) { + if ("F62".equals(group1)) { group1 = "װ"; } - if("F63".equals(group1)) { + if ("F63".equals(group1)) { group1 = "ҽװ"; } - if("F64".equals(group1)) { + if ("F64".equals(group1)) { group1 = "ˮ"; } - if("F65".equals(group1)) { + if ("F65".equals(group1)) { group1 = "BFS"; } - if("F66".equals(group1)) { + if ("F66".equals(group1)) { group1 = "ԭҩ ɰĿ"; } - if("F67".equals(group1)) { + if ("F67".equals(group1)) { group1 = "ԭҩ Ŀ"; } - if("F68".equals(group1)) { + if ("F68".equals(group1)) { group1 = "Ƽ"; } - if("F69".equals(group1)) { + if ("F69".equals(group1)) { group1 = ""; } - if("F70".equals(group1)) { + if ("F70".equals(group1)) { group1 = "﹤"; } - if("F71".equals(group1)) { + if ("F71".equals(group1)) { group1 = "Ԥ"; } - if("F72".equals(group1)) { + if ("F72".equals(group1)) { group1 = "ϴ"; } - if("F73".equals(group1)) { + if ("F73".equals(group1)) { group1 = "ʳƷװ"; } - if("F74".equals(group1)) { + if ("F74".equals(group1)) { group1 = "ҽð"; } - if("F75".equals(group1)) { + if ("F75".equals(group1)) { group1 = "ܿЭ"; } - if("F76".equals(group1)) { + if ("F76".equals(group1)) { group1 = "ڻ"; } } + //ƥԴ private void getsource() { - //M Ƽ - - if("M".equals(source1)){ + // M Ƽ + + if ("M".equals(source1)) { source1 = "Ƽ"; } - //P ɹ - if("P".equals(source1)){ + // P ɹ + if ("P".equals(source1)) { source1 = "ɹ"; } - //X - if("X".equals(source1)) { + // X + if ("X".equals(source1)) { source1 = ""; } - System.out.println("÷source1==9.22====="+source1); + System.out.println("÷source1==9.22=====" + source1); } } diff --git a/src/com/connor/dfl/plm/forms/AcountSet_AddDialog_ChangeApply.java b/src/com/connor/dfl/plm/forms/AcountSet_AddDialog_ChangeApply.java index 7873318..786091a 100644 --- a/src/com/connor/dfl/plm/forms/AcountSet_AddDialog_ChangeApply.java +++ b/src/com/connor/dfl/plm/forms/AcountSet_AddDialog_ChangeApply.java @@ -270,13 +270,13 @@ public class AcountSet_AddDialog_ChangeApply extends AbstractAIFDialog { // } - String s = (cf.table1.getValueAt(10, 1) == null ? "" :cf.table1.getValueAt(10, 1).toString()); + String s = (cf.table1.getValueAt(2, 5) == null ? "" :cf.table1.getValueAt(2, 5).toString()); proid = s + proid ; //changeform.model1.setValueAt(proid, 8, 1); - cf.table1.setValueAt( proid, 10, 1); + cf.table1.setValueAt( proid, 2, 5); disposeDialog(); MessageBox.post("!", "ʾ", MessageBox.INFORMATION); } diff --git a/src/com/connor/dfl/plm/forms/AcountSet_AddDialog_ChangeNotify.java b/src/com/connor/dfl/plm/forms/AcountSet_AddDialog_ChangeNotify.java index c0651e5..647f8a3 100644 --- a/src/com/connor/dfl/plm/forms/AcountSet_AddDialog_ChangeNotify.java +++ b/src/com/connor/dfl/plm/forms/AcountSet_AddDialog_ChangeNotify.java @@ -266,13 +266,13 @@ public class AcountSet_AddDialog_ChangeNotify extends AbstractAIFDialog { // } - String s = (cn.table1.getValueAt(10, 1) == null ? "" :cn.table1.getValueAt(10, 1).toString()); + String s = (cn.table1.getValueAt(2, 5) == null ? "" :cn.table1.getValueAt(2, 5).toString()); proid = s + proid ; //changeform.model1.setValueAt(proid, 8, 1); - cn.table1.setValueAt( proid, 10, 1); + cn.table1.setValueAt( proid, 2, 5); disposeDialog(); MessageBox.post("!", "ʾ", MessageBox.INFORMATION); } diff --git a/src/com/connor/dfl/plm/forms/AcountSet_AddDialog_PresserQECN.java b/src/com/connor/dfl/plm/forms/AcountSet_AddDialog_PresserQECN.java index 1383379..36a4fe6 100644 --- a/src/com/connor/dfl/plm/forms/AcountSet_AddDialog_PresserQECN.java +++ b/src/com/connor/dfl/plm/forms/AcountSet_AddDialog_PresserQECN.java @@ -265,13 +265,13 @@ public class AcountSet_AddDialog_PresserQECN extends AbstractAIFDialog { // } - String s = (qf.table1.getValueAt(10, 1) == null ? "" :qf.table1.getValueAt(10, 1).toString()); + String s = (qf.table1.getValueAt(2, 5) == null ? "" :qf.table1.getValueAt(2, 5).toString()); proid = s + proid ; //changeform.model1.setValueAt(proid, 8, 1); - qf.table1.setValueAt( proid, 10, 1); + qf.table1.setValueAt( proid, 2, 5); disposeDialog(); MessageBox.post("!", "ʾ", MessageBox.INFORMATION); } diff --git a/src/com/connor/dfl/plm/forms/AddDialogApply_TZ.java b/src/com/connor/dfl/plm/forms/AddDialogApply_TZ.java index 1d56848..fdd3fdc 100644 --- a/src/com/connor/dfl/plm/forms/AddDialogApply_TZ.java +++ b/src/com/connor/dfl/plm/forms/AddDialogApply_TZ.java @@ -129,7 +129,7 @@ public class AddDialogApply_TZ extends AbstractAIFDialog { } } - String s = (cf.table1.getValueAt(7, 5) == null ? "" :cf.table1.getValueAt(7, 5).toString()); + String s = (cf.table1.getValueAt(9, 1) == null ? "" :cf.table1.getValueAt(9, 1).toString()); StringBuilder sb = new StringBuilder(s); @@ -150,7 +150,7 @@ public class AddDialogApply_TZ extends AbstractAIFDialog { } //changeform.model1.setValueAt(proid, 8, 1); - cf.table1.setValueAt( sb.toString(), 7, 5); + cf.table1.setValueAt( sb.toString(), 9, 1); disposeDialog(); MessageBox.post("ͼֽ!", "ʾ", MessageBox.INFORMATION); } diff --git a/src/com/connor/dfl/plm/forms/AddDialogNotify_TZ.java b/src/com/connor/dfl/plm/forms/AddDialogNotify_TZ.java index a1ef7fd..b957073 100644 --- a/src/com/connor/dfl/plm/forms/AddDialogNotify_TZ.java +++ b/src/com/connor/dfl/plm/forms/AddDialogNotify_TZ.java @@ -90,7 +90,7 @@ public class AddDialogNotify_TZ extends AbstractAIFDialog { } } - String s = (nf.table1.getValueAt(7, 5) == null ? "" :nf.table1.getValueAt(7, 5).toString()); + String s = (nf.table1.getValueAt(9, 1) == null ? "" :nf.table1.getValueAt(9, 1).toString()); StringBuilder sb = new StringBuilder(s); for (int i = 0; i < list.size(); i++) { @@ -110,7 +110,7 @@ public class AddDialogNotify_TZ extends AbstractAIFDialog { } //changeform.model1.setValueAt(proid, 8, 1); - nf.table1.setValueAt( sb.toString(), 7, 5); + nf.table1.setValueAt( sb.toString(), 9, 1); disposeDialog(); MessageBox.post("ͼֽ!", "ʾ", MessageBox.INFORMATION); } diff --git a/src/com/connor/dfl/plm/forms/AddDialogQuick.java b/src/com/connor/dfl/plm/forms/AddDialogQuick.java index 5223eeb..84ae895 100644 --- a/src/com/connor/dfl/plm/forms/AddDialogQuick.java +++ b/src/com/connor/dfl/plm/forms/AddDialogQuick.java @@ -261,13 +261,13 @@ public class AddDialogQuick extends AbstractAIFDialog { // } - String s = (quickform.table1.getValueAt(8, 1) == null ? "" :quickform.table1.getValueAt(8, 1).toString()); + String s = (quickform.table1.getValueAt(4, 5) == null ? "" :quickform.table1.getValueAt(4, 5).toString()); proid = s + proid ; //changeform.model1.setValueAt(proid, 8, 1); - quickform.table1.setValueAt( proid, 8, 1); + quickform.table1.setValueAt( proid, 4, 5); disposeDialog(); MessageBox.post("Ŀ!", "ʾ", MessageBox.INFORMATION); } diff --git a/src/com/connor/dfl/plm/forms/AddDialogQuickChange_TZ.java b/src/com/connor/dfl/plm/forms/AddDialogQuickChange_TZ.java index d6f7974..5627c9d 100644 --- a/src/com/connor/dfl/plm/forms/AddDialogQuickChange_TZ.java +++ b/src/com/connor/dfl/plm/forms/AddDialogQuickChange_TZ.java @@ -432,7 +432,7 @@ public class AddDialogQuickChange_TZ extends AbstractAIFDialog { } } - String s = (qf.table1.getValueAt(7, 5) == null ? "" :qf.table1.getValueAt(7, 5).toString()); + String s = (qf.table1.getValueAt(9, 1) == null ? "" :qf.table1.getValueAt(9, 1).toString()); StringBuilder sb = new StringBuilder(s); for (int i = 0; i < list.size(); i++) { @@ -452,7 +452,7 @@ public class AddDialogQuickChange_TZ extends AbstractAIFDialog { } //changeform.model1.setValueAt(proid, 8, 1); - qf.table1.setValueAt( sb.toString(), 7, 5); + qf.table1.setValueAt( sb.toString(), 9, 1); disposeDialog(); MessageBox.post("ͼֽ!", "ʾ", MessageBox.INFORMATION); } diff --git a/src/com/connor/dfl/plm/forms/ChangeApplyForm.java b/src/com/connor/dfl/plm/forms/ChangeApplyForm.java index 91ca784..60bb42e 100644 --- a/src/com/connor/dfl/plm/forms/ChangeApplyForm.java +++ b/src/com/connor/dfl/plm/forms/ChangeApplyForm.java @@ -11,11 +11,14 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; +import java.math.BigDecimal; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; @@ -44,6 +47,8 @@ import javax.swing.JTextField; import javax.swing.ScrollPaneConstants; import javax.swing.SwingConstants; import javax.swing.border.LineBorder; +import javax.swing.event.TableModelEvent; +import javax.swing.event.TableModelListener; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.DefaultTableModel; import javax.swing.table.JTableHeader; @@ -58,6 +63,7 @@ import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import com.connor.dfl.plm.dfl044.DataBaseControl2; +import com.connor.dfl.plm.forms.ChangeNotifyForm.MyTable; import com.connor.dfl.plm.table.CTMap; import com.connor.dfl.plm.table.CTable; import com.connor.dfl.plm.util.DateChooser; @@ -105,61 +111,96 @@ public class ChangeApplyForm extends AbstractRendering { // private CTMap model1, model2; private CTMap model1; DefaultTableModel model2; + + private String name; private String objname; + private String masterName; private String zhangtao; private String cangku; private JButton addButton; private JButton delButton; - private DataBaseControl2 data; - private JButton addProjectBtn; + private JComboBox changeOfMajorBox;// רҵ + private JComboBox manageclassifyBox;//ƹ private JComboBox ChangeTypeBox;// + private JComboBox changeTagBox;//ǩ private JComboBox ProductTypecBox;// Ʒ - private JComboBox ErrorTypeBox;// - private JComboBox DutyDepartmentBox;// β + private JComboBox ErrorTypeBox; + private JComboBox DutyDepartmentBox; private JComboBox SalesClassifyBox;// ۷ private JComboBox EmergencyNotifyBox;// ̶֪ͨ private JComboBox ProductDepartmentBox;// Ʒ + private JComboBox dutyDepartBox; // β private JComboBox DrawingChangeTypeBox;// ͼֽ private JComboBox IsNotProductLossBox;// Ƿɱʧ + private JComboBox isNotBuyBox; // ǷҪɹ + private JComboBox isNotLayoutInterfaceBox; //ǷӰ첼ֽӿ + private JComboBox isNotChangeInputTypeBox; // private JComboBox ReceiveClassifyBox;// ϼ÷ private JComboBox WAPYJBox;// δƷ + private JComboBox itemStateBox; //Ͻ׶ private JComboBox ZZYJBox;// private JComboBox SSYJBox;// private JComboBox CLYJBox;// - + private JComboBox changeReasonBox; //ԭ + private DataBaseControl2 data; + // ʱ + public DefaultComboBoxModel jsrBoxModel; - String projectid; // private JComboBox projectCode;//Ŀ static String time; int rows1 = 1; - String applyname; - - private String clientname; - private String pd; - private String productname; - private String productmodel; - private String producttype; - private String department; - private String duty; - private String type; - private String projectState; - private Project_Code code; + private String applyname; private String my_item_id; - private String applyDate; - private String projectCode; - private String affectedPart; // table2еݣ浽ݿʹ - List changedeList = new ArrayList(); - - public ChangeApplyForm() throws Exception { - - } + List changedeList = new ArrayList(); + + private String applyName;// + private String applyDate;// ʱ + private String needDate; + private String projectCode;// Ŀ + private String clientNae;// ͻ + private String productDepartment;// Ʒ + // private String productCode;//Ʒ + private String productName;// Ʒ + private String projectModel;// Ʒͺ + private String affectedPart;// Ӱ豸/㲿 + private String changeType;// + private String productType;// Ʒ + private String errorType;// + private String dutyDepartment;// β + private String dutyMan;// + private String changeOfMajor;// רҵ + private String pkeyword;//ؼ + private String manageclassify; //ƹ + private String kkcode; //kk + //private JComboBox changeOfMajor;// רҵ + private String changeReason;// ԭ + private String salseClassify;// ۷ + private String priceBooking;// ۸Ԥ + // private String change;//ϸ + private String isNotProductLoss;// ǷƷʧ + private String isNotLayoutInterface; // ǷӰӿڲ + private String isNotChangeInputType; // + private String receiveClassify;// ϼ÷ + private String isNotBuy; //ǷҪɹ + private String warehouseCode;// + private String accountSet;// + private String NotifyEmergencyProcedures;// ̶֪ͨ + private String drawingTo;// ͼֽ + private String ChangeListCode;// + private String TZChangeType; + private String changeTag; // ǩ + private String SUOSU_productdepartment; + private String projectState; + private String pricePri; //۸Ԥ + private String closeMan; //۸Ԥ + private String reasonDetail; //ԭ public ChangeApplyForm(TCComponent arg0) throws Exception { super(arg0); @@ -251,19 +292,115 @@ public class ChangeApplyForm extends AbstractRendering { private void initUI() throws TCException, SQLException { - this.hadList = new ArrayList(); + // private JComboBox ChangeTypeBox; + // private JComboBox ProductTypecBox; + // private JComboBox ErrorTypeBox; + // private JComboBox DutyDepartmentBox; + // private JComboBox SalesClassifyBox; + // private JCheckBox EmergencyNotifyBox; + // public DefaultComboBoxModel jsrBoxModel; + // String[] change_type_stringArrays = session.getPreferenceService().getStringValues("DFL_Form_ChangeType"); if (change_type_stringArrays == null || change_type_stringArrays.length <= 0) { MessageBox.post("ѡDFL_Form_ChangeTypeδ,ϵԱ!!", "", MessageBox.ERROR); return; } + + // + changeOfMajorBox = new JComboBox(); + changeOfMajorBox.addItem("е"); + changeOfMajorBox.addItem(""); + changeOfMajorBox.setSelectedItem("е"); + + //ƹ + String[] manageclassify_stringArrays = session.getPreferenceService().getStringValues("DFL_manageclassify"); + if (manageclassify_stringArrays == null || manageclassify_stringArrays.length <= 0) { + MessageBox.post("ѡDFL_manageclassifyδ,ϵԱ!!", "", MessageBox.ERROR); + return; + } + manageclassifyBox = new JComboBox(); + for(String manageclassifyString : manageclassify_stringArrays) { + manageclassifyBox.addItem(manageclassifyString); + } + // ChangeTypeBox = new JComboBox(); for (int change_type_number = 0; change_type_number < change_type_stringArrays.length; change_type_number++) { ChangeTypeBox.addItem(change_type_stringArrays[change_type_number]); } + +ChangeTypeBox.addItemListener(new ItemListener() { + + @Override + public void itemStateChanged(ItemEvent e) { + // TODO Auto-generated method stub + if(e.getStateChange() == ItemEvent.SELECTED) { + System.out.println(e.getItem()); + if(e.getItem().toString().contains("ƴ")) { + changeReasonBox.removeAllItems(); + changeReasonBox.addItem("(ҪBA)"); + changeReasonBox.addItem("©"); + changeReasonBox.addItem("˿"); + changeReasonBox.addItem("Ʋ棩"); + }else if(e.getItem().toString().contains("ڲ")) { + changeReasonBox.removeAllItems(); + changeReasonBox.addItem(""); + changeReasonBox.addItem("Ż"); + changeReasonBox.addItem("λ"); + changeReasonBox.addItem("ӿ"); + changeReasonBox.addItem("С-500Ԫ"); + }else if(e.getItem().toString().contains("Ż")) { + changeReasonBox.removeAllItems(); + changeReasonBox.addItem("ʹ"); + changeReasonBox.addItem("ת"); + changeReasonBox.addItem("׼"); + }else if(e.getItem().toString().contains("ϵͳ")) { + changeReasonBox.removeAllItems(); + changeReasonBox.addItem(""); + changeReasonBox.addItem("Ż"); + changeReasonBox.addItem("С-500Ԫ"); + changeReasonBox.addItem("AӰB"); + }else if(e.getItem().toString().contains("ɹ")) { + changeReasonBox.removeAllItems(); + changeReasonBox.addItem("ڽ"); + changeReasonBox.addItem("Ʒ"); + changeReasonBox.addItem("ERPϢ"); + changeReasonBox.addItem(""); + }else if(e.getItem().toString().contains("۱")) { + changeReasonBox.removeAllItems(); + changeReasonBox.addItem(""); + changeReasonBox.addItem("ͻԭ"); + changeReasonBox.addItem("ԭ򣨱Ŀ"); + changeReasonBox.addItem("ԭ򣨷DZĿ"); + changeReasonBox.addItem("ӳֲ"); + changeReasonBox.addItem("ǩЭ"); + } + } + } + }); + + //ǩ + changeTagBox = new JComboBox(); + changeTagBox.addItem("ͼ"); + changeTagBox.addItem("ظ"); + changeTagBox.addItem("ż"); + changeTagBox.addItem(""); + + //ǩ + changeTagBox = new JComboBox(); + changeTagBox.addItem("ͼ"); + changeTagBox.addItem("ظ"); + changeTagBox.addItem("ż"); + changeTagBox.addItem(""); + + // ChangeTypeBox.addItem("ƴ"); + // ChangeTypeBox.addItem("Ż"); + // ChangeTypeBox.addItem("ڲ"); + // ChangeTypeBox.addItem(""); + // ChangeTypeBox.addItem("ɹ"); + // ChangeTypeBox.addItem("۸"); // Ʒ @@ -278,6 +415,39 @@ public class ChangeApplyForm extends AbstractRendering { ProductTypecBox.addItem(product_type_stringArrays[product_type_number]); } + // + // ProductTypecBox = new JComboBox(); + // ProductTypecBox.addItem("ɻ"); + // ProductTypecBox.addItem(""); + // ProductTypecBox.addItem("ϴ"); + // ProductTypecBox.addItem(""); + // ProductTypecBox.addItem("Զе"); + // ProductTypecBox.addItem("Ƽ"); + // ProductTypecBox.addItem("ORABS"); + // ProductTypecBox.addItem("VHP"); + // ProductTypecBox.addItem(""); + // ProductTypecBox.addItem("С"); + // ProductTypecBox.addItem("ϵͳ"); + // ProductTypecBox.addItem("ྻܵ"); + // ProductTypecBox.addItem("ϵͳ"); + // ProductTypecBox.addItem("ԭҩ"); + // ProductTypecBox.addItem("ѹƬ"); + // ProductTypecBox.addItem("Һ"); + // ProductTypecBox.addItem("Ʒ"); + // ProductTypecBox.addItem("ҽе"); + // ProductTypecBox.addItem("Ԥ"); + // ProductTypecBox.addItem("׼©"); + // ProductTypecBox.addItem("BFSƷ"); + // ProductTypecBox.addItem("ˮ"); + // ProductTypecBox.addItem("˰װ"); + // ProductTypecBox.addItem(""); + // ProductTypecBox.addItem("CRABS"); + // ProductTypecBox.addItem("תϵͳ"); + // ProductTypecBox.addItem("ϵͳ"); + // + + // + String[] Error_type_stringArrays = session.getPreferenceService().getStringValues("DFL_Form_Error_Type"); if (Error_type_stringArrays == null || Error_type_stringArrays.length <= 0) { MessageBox.post("ѡDFL_Form_Error_Typeδ,ϵԱ!!", "", MessageBox.ERROR); @@ -289,13 +459,22 @@ public class ChangeApplyForm extends AbstractRendering { ErrorTypeBox.addItem(Error_type_stringArrays[error_type_number]); } - // β - DutyDepartmentBox = new JComboBox(); + // ErrorTypeBox = new JComboBox(); + // + // ErrorTypeBox.addItem("P&IDͼ"); + // ErrorTypeBox.addItem("ͼ"); + // ErrorTypeBox.addItem("ͼ"); + // ErrorTypeBox.addItem("BOM"); + // ErrorTypeBox.addItem("Эͼ"); + // ErrorTypeBox.addItem("ƽ沼ͼ"); + // ErrorTypeBox.addItem(""); + + // ۷ // ۷ String[] Sale_type_stringArrays = session.getPreferenceService().getStringValues("DFL_Form_SalesClassify"); if (Sale_type_stringArrays == null || Sale_type_stringArrays.length <= 0) { - MessageBox.post("ѡDFL_Form_sale_Typeδ,ϵԱ!!", "", MessageBox.ERROR); + MessageBox.post("ѡDFL_Form_SalesClassifyδ,ϵԱ!!", "", MessageBox.ERROR); return; } @@ -304,8 +483,11 @@ public class ChangeApplyForm extends AbstractRendering { for (int sale_type_number = 0; sale_type_number < Sale_type_stringArrays.length; sale_type_number++) { SalesClassifyBox.addItem(Sale_type_stringArrays[sale_type_number]); } + // SalesClassifyBox.addItem(""); + // SalesClassifyBox.addItem(""); // ̶֪ͨ + String[] Emergency_type_stringArrays = session.getPreferenceService() .getStringValues("DFL_Form_Emergency_Type"); if (Emergency_type_stringArrays == null || Emergency_type_stringArrays.length <= 0) { @@ -331,6 +513,12 @@ public class ChangeApplyForm extends AbstractRendering { for (int ProductDepartment_type_number = 0; ProductDepartment_type_number < ProductDepartment_type_stringArrays.length; ProductDepartment_type_number++) { ProductDepartmentBox.addItem(ProductDepartment_type_stringArrays[ProductDepartment_type_number]); } + + DutyDepartmentBox = new JComboBox(); + for (int ProductDepartment_type_number = 0; ProductDepartment_type_number < ProductDepartment_type_stringArrays.length; ProductDepartment_type_number++) { + DutyDepartmentBox.addItem(ProductDepartment_type_stringArrays[ProductDepartment_type_number]); + } + // ͼֽ String[] DrawingChangeType_type_stringArrays = session.getPreferenceService() .getStringValues("DFL_Form_DrawingChangeType"); @@ -358,6 +546,32 @@ public class ChangeApplyForm extends AbstractRendering { for (int IsNotProductLoss_type_number = 0; IsNotProductLoss_type_number < IsNotProductLoss_type_stringArrays.length; IsNotProductLoss_type_number++) { IsNotProductLossBox.addItem(IsNotProductLoss_type_stringArrays[IsNotProductLoss_type_number]); } + + isNotBuyBox = new JComboBox(); + isNotBuyBox.addItem(""); + isNotBuyBox.addItem(""); + + isNotLayoutInterfaceBox = new JComboBox(); + + isNotLayoutInterfaceBox.addItem(""); + isNotLayoutInterfaceBox.addItem(""); + + isNotChangeInputTypeBox = new JComboBox(); + isNotChangeInputTypeBox.addItem("BOM"); + isNotChangeInputTypeBox.addItem("PID"); + isNotChangeInputTypeBox.addItem("ͼ"); + isNotChangeInputTypeBox.addItem("ͼ"); + isNotChangeInputTypeBox.addItem("ͼ"); + isNotChangeInputTypeBox.addItem("ͼ"); + isNotChangeInputTypeBox.addItem("ͼ"); + isNotChangeInputTypeBox.addItem("Эͼ"); + isNotChangeInputTypeBox.addItem("ͼֽ"); + + changeReasonBox = new JComboBox(); + changeReasonBox.addItem(""); + changeReasonBox.addItem("Ż"); + changeReasonBox.addItem("ͻҪ"); + changeReasonBox.addItem("AӰB"); // ϼ÷ String[] ReceiveClassify_type_stringArrays = session.getPreferenceService() @@ -385,6 +599,12 @@ public class ChangeApplyForm extends AbstractRendering { WAPYJBox.addItem(WAPYJ_type_stringArrays[WAPYJ_type_number]); } + + itemStateBox = new JComboBox(); + itemStateBox.addItem("δƷ"); + itemStateBox.addItem("Ʒ"); + itemStateBox.addItem("ڿƷ"); + itemStateBox.addItem(""); // String[] ZZYJ_type_stringArrays = session.getPreferenceService() @@ -424,10 +644,20 @@ public class ChangeApplyForm extends AbstractRendering { } + // datetime = new JComboBox(); + // datetime.addItem(time); + TCComponent comp = (TCComponent) targetComp; - String applyname = comp.getTCProperty("owning_user").getReferenceValueInString(); - System.out.println("========" + name); + // TCComponentItemRevision comprev = (TCComponentItemRevision) comp ; + + // applyname = comp.getStringProperty("owning_user"); + + String applyname = comp.getTCProperty("owning_user").getReferenceValueInString(); + // owingname.getStringProperty("user_name"); + // .getReferenceValueArray()[0]; + System.out.println("========" + masterName); + // System.out.println("========"+applyname); comp.whereReferenced(); AIFComponentContext contex[] = comp.whereReferenced(); @@ -436,7 +666,6 @@ public class ChangeApplyForm extends AbstractRendering { if (contex[c].getComponent() instanceof TCComponentItemRevision) { TCComponentItemRevision rev = (TCComponentItemRevision) contex[c].getComponent(); - // rev TCComponentItem item = rev.getItem(); AIFComponentContext contex1[] = item.whereReferenced(); @@ -444,43 +673,90 @@ public class ChangeApplyForm extends AbstractRendering { InterfaceAIFComponent comp2 = contex1[i].getComponent(); if (comp2 instanceof TCComponentItemRevision) { TCComponentItemRevision rev2 = (TCComponentItemRevision) comp2; - if ("T2_problemRevision".equals(rev2.getType())) { - affectedPart = rev2.getStringProperty("t2_AffectEquipment"); - System.out.println("affectedPart=============" + affectedPart); + if ("T2_ECRRevision".equals(rev2.getType())) { + TCComponent form1 = rev2.getReferenceListProperty("IMAN_master_form_rev")[0]; + name = form1.getStringProperty("object_name"); } } } + objname = rev.getStringProperty("object_name"); + masterName = comp.getStringProperty("object_name"); my_item_id = item.getStringProperty("item_id"); Date date = rev.getDateProperty("creation_date"); SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm"); applyDate = df.format(date); - projectCode = rev.getStringProperty("t2_ProjectID"); - objname = rev.getStringProperty("object_name"); - name = comp.getStringProperty("object_name"); - clientname = rev.getStringProperty("t2_CustomerName"); - pd = rev.getStringProperty("t2_PD"); - productname = rev.getStringProperty("t2_ProductName"); - productmodel = rev.getStringProperty("t2_ProductModel"); - producttype = rev.getStringProperty("t2_ProductType"); - department = rev.getStringProperty("t2_Department"); - duty = rev.getStringProperty("t2_duty"); - type = rev.getStringProperty("t2_type"); - - projectState = rev.getStringProperty("t2_ProjectPhase"); + String apply_name = rev.getStringProperty("t2_CustomerName"); + System.out.println("===================" + apply_name); + + // ȡ뵥ţͨŽԴݿȡʾڱ֪ͨ + List applyformlist = getChangeMesg(apply_name); + System.out.println("objectlength" + applyformlist); + + if (applyformlist.size() > 0) { + ChangeOrderBean2 cb = (ChangeOrderBean2) applyformlist.get(applyformlist.size() - 1); + + applyName = cb.getApplyman();// + + applyDate = cb.getApplyDate();//ʱ + ChangeListCode = cb.getChangeCode();// + productType = cb.getProductTypeXh(); //Ʒͺ + clientNae = cb.getClientName();// ͻ + productDepartment = cb.getProductDepart();// Ʒ + warehouseCode = cb.getStorageNum();// + accountSet = cb.getWareHourse();// + dutyDepartment = cb.getDutyDepartment();// β + dutyMan = cb.getDutyMan();// + //changeOfMajor.setSelectedItem(cb.getChangeOfMajor());//רҵ + changeOfMajor = cb.getChangeOfMajor();//רҵ + pkeyword = cb.getPkeyword();//ؼ + manageclassify = cb.getManageclassify();//ƹ + kkcode = cb.getKkcode(); + isNotLayoutInterface = cb.getLayoutInterface(); + changeType = cb.getChangeType(); + isNotChangeInputType = cb.getChangeInputType(); + projectCode = cb.getSystemCode();// Ŀ + changeReason = cb.getChangeReason();// ԭ + productType = cb.getProductType();// Ʒ + changeTag = cb.getChangeTag(); // ǩ + receiveClassify = cb.getItemLYLX();// ϼ÷ + isNotBuy = cb.getNeedBuy(); // ǷҪɹ + // String productCode;//Ʒ + priceBooking = cb.getPricePri();// ۸Ԥ + salseClassify = cb.getSaleClass();// ۷ + closeMan = cb.getCloseMan(); //رȷ + reasonDetail = cb.getReasonDetail(); // رȷ + drawingTo = cb.getHandleOpinion();// ͼֽ + needDate = cb.getItemNeedDate();// Ʒ + NotifyEmergencyProcedures = cb.getDegreeOfurgency();// ֪ͨ +// projectModel = cb.getProjectModel();// Ʒͺ +// affectedPart = cb.getAffectedPart();// Ӱ豸/㲿 +// changeType = cb.getChangeType();// +// +// errorType = cb.getErrorType();// + // change;//ϸ +// isNotProductLoss = cb.getIsNotProductLoss();// ǷƷʧ +// TZChangeType = cb.getTZChangeType(); +// SUOSU_productdepartment = cb.getSUOSU_ProductDepartment(); +// projectState = cb.getProjectState(); + } } } - String titleName = name + "뵥"; + // lcomp + + String titleName = masterName + "֪ͨ"; JLabel titleLable = new JLabel(titleName); titleLable.setFont(new Font("", 1, 16)); model1 = new CTMap(11, 6) { + public void setValueAt(Object value, int row, int column) { if (row == 0 && column == 1) { if (value == null) { return; } + } Vector rowVector = (Vector) dataVector.elementAt(row); rowVector.setElementAt(value, column); @@ -490,10 +766,82 @@ public class ChangeApplyForm extends AbstractRendering { }; - model1.combine(new int[] { 6 }, new int[] { 1, 2, 3, 4, 5 }); model1.combine(new int[] { 8 }, new int[] { 1, 2, 3, 4, 5 }); - model1.combine(new int[] { 9 }, new int[] { 1, 2, 3, 4, 5 }); - model1.combine(new int[] { 10 }, new int[] { 1, 2, 3, 4, 5 }); +// model1.combine(new int[] { 9 }, new int[] { 1, 2, 3, 4, 5 }); +// model1.combine(new int[] { 10 }, new int[] { 1, 2, 3, 4, 5 }); +// model1.combine(new int[] { 6 }, new int[] { 1, 2, 3, 4, 5 }); + model1.addTableModelListener(new TableModelListener() { + + @Override + public void tableChanged(TableModelEvent e) { + // TODO Auto-generated method stub + int column = e.getColumn(); + int firstRow = e.getFirstRow(); + System.out.println("("+firstRow+","+column+")"); + + if(table1.getValueAt(2, 1) != null ){ + System.out.println("wwww"); + String[] stringArray_warehouse = ((TCSession) app.getSession()).getPreferenceService() + .getStringValues("DFL_Form_WarehouseCode"); + String warehouse = ""; + String hourseNum = "01"; + String valueAt = (String)model1.getValueAt(firstRow, column); + if(null == valueAt) { + return; + } + for (int z = 0; z < stringArray_warehouse.length; z++) { + String value = stringArray_warehouse[z]; + String groupn = value.split(":")[0]; + + if (valueAt.contains(groupn)) { + warehouse = value.split(":")[1]; + table1.setValueAt(warehouse, 2, 3); +// table1.setValueAt(hourseNum, 2, 5); + } + } + } + + if(table1.getValueAt(1, 1) != null) { + + String deviceNumber = (String) table1.getValueAt(1, 1); + System.out.println("=>deviceNumber"+deviceNumber); + if(!deviceNumber.startsWith("0") && !deviceNumber.startsWith("C")) { + MessageBox.post("豸ű0Cͷ","ʾ",MessageBox.INFORMATION); + table1.setValueAt(null, 1, 1); + return; + } + DataBaseControl2 control2 = new DataBaseControl2("oracle.jdbc.driver.OracleDriver", + "jdbc:oracle:thin:@192.168.1.105:1521:ekp", "ekp", "ekp"); + ResultSet dbQuery = control2.dbQuery("select rownum,a.fd_359a8ba984efb6 as 豸,fd_359782e5fc5f3c as 豸ͺ,b.fd_34A888D23094E4 AS ϵͳĿ,b.FD_35EC81852B443A AS ͻ from ekp_17161e29395832d6d388 a left outer join ekp_17161e29394b49a9e97c b on a.fd_parent_id = b.fd_id where a.fd_359a8ba984efb6 = '"+deviceNumber+"' and rownum = 1 union select rownum,a.fd_359a8ba984efb6 as 豸,fd_359782e5fc5f3c as 豸ͺ,b.fd_34A888D23094E4 AS ϵͳĿ,b.FD_35EC81852B443A AS ͻ from ekp_17161e29395832d6d388 a left outer join ekp_17161e29394b49a9e97c b on a.fd_parent_id = b.fd_id where a.fd_359a8ba984efb6 = '"+deviceNumber+"' and rownum = 1"); + try { + while (dbQuery.next()) { + System.out.println(dbQuery.getString(3)); + table1.setValueAt(dbQuery.getString(3), 1, 3); + System.out.println(dbQuery.getString(4)); + table1.setValueAt(dbQuery.getString(4), 4, 5); + System.out.println(dbQuery.getString(5)); + table1.setValueAt(dbQuery.getString(5), 1, 5); + } + } catch (SQLException e1) { + // TODO Auto-generated catch block + control2.closeDataBase(); + e1.printStackTrace(); + } + control2.closeDataBase(); + } + + // System.out.println("ʮһеڶݱ仯"); + if(table1.getValueAt(10, 1) != null) { + String value = table1.getValueAt(10, 1).toString(); + if(value.length()>10) { + MessageBox.post("ȱС10","ʾ",MessageBox.INFORMATION); + table1.setValueAt("", 10, 1); + return; + } + } + + } + }); table1 = new CTable(model1) { @Override @@ -517,7 +865,9 @@ public class ChangeApplyForm extends AbstractRendering { if (column == 0 && row == 10) { return false; + } + // if (column == 5 && row == 7) { // return false; // @@ -527,11 +877,14 @@ public class ChangeApplyForm extends AbstractRendering { // // } + return true; + } }; // table1.setCombo(2, 1, new DefaultCellEditor(cBox3)); + String groupnames = session.getGroup().getStringProperty("display_name"); String[] buisnisDivisions = groupnames.split("\\."); String groupname = ""; @@ -544,97 +897,125 @@ public class ChangeApplyForm extends AbstractRendering { table1.setValueAt("", 0, 0); table1.setValueAt(applyname, 0, 1); - table1.setValueAt("", 0, 2); - System.out.println(" " + my_item_id); + table1.setValueAt("֪ͨ", 0, 2); table1.setValueAt(my_item_id, 0, 3); table1.setValueAt("ʱ", 0, 4); table1.setValueAt(applyDate, 0, 5); - table1.setValueAt("Ʒ", 1, 0); - table1.setValueAt(productname, 1, 1); + + table1.setValueAt("", 9, 2); + table1.setValueAt(needDate, 9, 3); - table1.setValueAt("Ʒͺ", 1, 2); - table1.setValueAt(productmodel, 1, 3); + table1.setValueAt("豸*", 1, 0); + table1.setValueAt(productName, 1, 1); - table1.setValueAt("ͻ", 1, 4); + table1.setValueAt("Ʒͺ", 1, 2); + table1.setValueAt(projectModel, 1, 3); - table1.setValueAt(clientname, 1, 5); + table1.setValueAt("ͻ*", 1, 4); + table1.setValueAt(clientNae, 1, 5); - table1.setValueAt("ֿ", 2, 0);// + table1.setValueAt("ֿ", 2, 2);// String[] stringArray_warehouse = ((TCSession) app.getSession()).getPreferenceService() .getStringValues("DFL_Form_WarehouseCode"); - - if (stringArray_warehouse == null || stringArray_warehouse.length <= 0) { - MessageBox.post("ѡDFL_Form_WarehouseCodeδ,ϵԱ!!", "", MessageBox.ERROR); - return; - } - String warehouse = ""; - for (int z = 0; z < stringArray_warehouse.length; z++) { String value = stringArray_warehouse[z]; String groupn = value.split(":")[0]; - System.out.println("===============groupn" + groupn); - System.out.println("===============1111111"); - System.out.println("===============groupname" + groupname + "==================="); if (groupname.contains(groupn)) { warehouse = value.split(":")[1]; - System.out.println("===============warehouse" + warehouse); - break; } } - table1.setValueAt(warehouse, 2, 1); - table1.setValueAt("̶֪ͨ", 2, 2); - table1.setValueAt("ͼֽ", 2, 4); - table1.setValueAt("Ʒ", 3, 0); - table1.setValueAt(pd, 3, 1); - table1.setValueAt("β", 3, 2); - table1.setValueAt(department, 3, 3); - table1.setValueAt("", 3, 4); - table1.setValueAt(duty, 3, 5); - table1.setValueAt("", 4, 0); - table1.setValueAt("Ʒ", 4, 2); - table1.setValueAt(producttype, 4, 3); - table1.setValueAt("", 4, 4); - table1.setValueAt("۸Ԥ", 5, 0);// - table1.setValueAt("۷", 5, 2); - table1.setValueAt(type, 5, 3); - table1.setValueAt("Ƿɱʧ", 5, 4); - // table1.setValueAt("Ʒ", 6, 0);// - // table1.setValueAt(pd, 6, 1);// - table1.setValueAt("Ӱ豸㲿", 6, 0); - table1.setValueAt(affectedPart, 6, 1); - table1.setValueAt("Ŀ׶", 7, 0); - table1.setValueAt(projectState, 7, 1); - table1.setValueAt("ϼ÷", 7, 2); - table1.setValueAt("ͼֽ", 7, 4); - table1.setValueAt("Ŀ", 8, 0); - table1.setValueAt(projectCode, 8, 1); - table1.setValueAt("ԭ", 9, 0); - table1.setValueAt("", 9, 1); - - // - table1.setValueAt("", 10, 0);// - String[] accountSet_stringArrays = ((TCSession) app.getSession()).getPreferenceService() - .getStringValues("DFL_Form_AccountSet"); + table1.setValueAt(warehouse, 2, 3); - if (accountSet_stringArrays == null || accountSet_stringArrays.length <= 0) { - MessageBox.post("ѡDFL_Form_AccountSetδ,ϵԱ!!", "", MessageBox.ERROR); - return; - } + table1.setValueAt("̶֪ͨ", 9, 4); + table1.setValueAt(NotifyEmergencyProcedures, 9, 5); + + table1.setValueAt("ؼ(ʮ)", 10, 0); + table1.setValueAt(pkeyword, 10, 1); + + table1.setValueAt("ƹ", 10, 2); + table1.setValueAt(manageclassify, 10, 3); + + table1.setValueAt("kk", 10, 4); + table1.setValueAt(kkcode, 10, 5); + + table1.setValueAt("ǩ", 6, 0); + table1.setValueAt(changeTag, 6, 1); + + table1.setValueAt("۸Ԥ(λ:Ԫ)*", 7, 0); + table1.setValueAt(pricePri, 7, 1); + + table1.setValueAt("رȷ", 7, 4); + table1.setValueAt(closeMan, 7, 5); + + table1.setValueAt("ԭ*", 8, 0); + table1.setValueAt(reasonDetail, 8, 1); + + table1.setValueAt("Ʒ*", 2, 0); + + table1.setValueAt(groupname, 3, 1); + table1.setValueAt("β", 3, 0); + table1.setValueAt(dutyDepartment, 3, 1); + + table1.setValueAt("*", 3, 2); + table1.setValueAt(dutyMan, 3, 3); +// Vector vector = new Vector(); +// +// vector.add("е"); +// vector.add(""); +// changeOfMajor = new JComboBox(vector); + table1.setValueAt("רҵ*", 3, 4); + table1.setValueAt(changeOfMajor, 3, 5); + + table1.setValueAt("ǷӰ첼ֽӿ*", 4,0); + table1.setValueAt(isNotLayoutInterface, 4,1); + + table1.setValueAt("*", 4, 2); + table1.setValueAt(changeType, 4, 3); + + table1.setValueAt("*", 4, 4); + table1.setValueAt(isNotChangeInputType, 4, 5); + + table1.setValueAt("Ʒ*", 5, 4); + table1.setValueAt(productType, 5, 5); + + table1.setValueAt("۷", 7, 2); + table1.setValueAt(salseClassify, 7, 3); + + table1.setValueAt("ϼ÷", 6, 2); + table1.setValueAt(receiveClassify, 6, 3) ; + + table1.setValueAt("ǷҪɹ*", 6, 4); + table1.setValueAt(isNotBuy, 6, 5); + + table1.setValueAt("ͼֽ", 9, 0); + table1.setValueAt(drawingTo, 9, 1); + + + + table1.setValueAt("Ŀ", 5, 0); + table1.setValueAt(projectCode, 5, 1); + + table1.setValueAt("ԭ*", 5, 2); + table1.setValueAt(changeReason, 5, 3); + + table1.setValueAt("", 2, 4);// + String[] stringArray = ((TCSession) app.getSession()).getPreferenceService() + .getStringValues("DFL_Form_AccountSet"); String accountSetValue = ""; - for (int z = 0; z < accountSet_stringArrays.length; z++) { - String value = accountSet_stringArrays[z]; + for (int z = 0; z < stringArray.length; z++) { + String value = stringArray[z]; String groupn = value.split(":")[0]; if (groupname.contains(groupn)) { accountSetValue = value.split(":")[1]; } } - table1.setValueAt(accountSetValue, 10, 1);// + table1.setValueAt(accountSetValue, 2, 5);// // ʾ JTextField showCalenderButten; @@ -642,45 +1023,66 @@ public class ChangeApplyForm extends AbstractRendering { setValue(); DateChooser dateChooser2 = DateChooser.getInstance("yyyy-MM-dd HH:mm"); + DateChooser dateChooser3 = DateChooser.getInstance("yyyy-MM-dd"); JTextField showDate1 = new JTextField(applyDate); showDate1.setEditable(false); + JTextField showDate2 = new JTextField(needDate); + showDate2.setEditable(false); dateChooser2.register(showDate1); + dateChooser3.register(showDate2); table1.setCombo(0, 5, new DefaultCellEditor(showDate1)); - // projectCode = new JComboBox(); - - // DateChooser dateChooser1 = DateChooser.getInstance("yyyy-M-d HH:mm"); - // - // DateChooser dateChooser2 = DateChooser.getInstance("yyyy-M-d HH:mm"); - // Date date = new Date(); - // SimpleDateFormat df = new SimpleDateFormat("yyyy-M-d HH:mm"); - // - // String time = df.format(date); + table1.setCombo(9, 3, new DefaultCellEditor(showDate2)); + JButton btn = new JButton("ѡĿ"); + JButton btn_tzfz = new JButton("ͼֽ"); + AddTaskListenerChange_TZ ant = new AddTaskListenerChange_TZ(selfform); + btn_tzfz.addActionListener(ant); + AddTaskListenerChange an = new AddTaskListenerChange(this); + btn.addActionListener(an); - // JComboBox timebox = new JComboBox(); - // timebox.addItem(time); - // JTextField showDate1 = new JTextField(time); - // dateChooser2.register(showDate1); + JButton zt_btn = new JButton("ѡ"); + AccountSetTaskListenerChangeApplyy an1 = new AccountSetTaskListenerChangeApplyy(this); + zt_btn.addActionListener(an1); + //רҵ + table1.setCombo(3, 5, new DefaultCellEditor(changeOfMajorBox)); + //ƹ + table1.setCombo(10, 3, new DefaultCellEditor(manageclassifyBox)); + // - table1.setCombo(4, 1, new DefaultCellEditor(ChangeTypeBox)); + table1.setCombo(4, 3, new DefaultCellEditor(ChangeTypeBox)); + // ǩ + table1.setCombo(6, 1, new DefaultCellEditor(changeTagBox)); // Ʒ - table1.setCombo(4, 3, new DefaultCellEditor(ProductTypecBox)); + table1.setCombo(5, 5, new DefaultCellEditor(ProductTypecBox)); // - table1.setCombo(4, 5, new DefaultCellEditor(ErrorTypeBox)); +// table1.setCombo(4, 5, new DefaultCellEditor(ErrorTypeBox)); // ۷ - table1.setCombo(5, 3, new DefaultCellEditor(SalesClassifyBox)); + table1.setCombo(7, 3, new DefaultCellEditor(SalesClassifyBox)); // β - // table1.setCombo(3,3,new DefaultCellEditor(DutyDepartmentBox)); + table1.setCombo(3,1,new DefaultCellEditor(DutyDepartmentBox)); // ̶֪ͨ - table1.setCombo(2, 3, new DefaultCellEditor(EmergencyNotifyBox)); + table1.setCombo(9, 5, new DefaultCellEditor(EmergencyNotifyBox)); + // ʱ + + // table1.setCombo(0,5,new DefaultCellEditor(datetime)); // Ʒ - table1.setCombo(3, 1, new DefaultCellEditor(ProductDepartmentBox)); + table1.setCombo(2, 1, new DefaultCellEditor(ProductDepartmentBox)); // ͼֽ - table1.setCombo(2, 5, new DefaultCellEditor(DrawingChangeTypeBox)); +// table1.setCombo(2, 5, new DefaultCellEditor(DrawingChangeTypeBox)); // Ƿɱʧ - table1.setCombo(5, 5, new DefaultCellEditor(IsNotProductLossBox)); +// table1.setCombo(5, 5, new DefaultCellEditor(IsNotProductLossBox)); + //ǷҪɹ + table1.setCombo(6, 5, new DefaultCellEditor(isNotBuyBox)); + //ǷӰ첼ֽӿ + table1.setCombo(4, 1, new DefaultCellEditor(isNotLayoutInterfaceBox)); + // + table1.setCombo(4, 5, new DefaultCellEditor(isNotChangeInputTypeBox)); + //ԭ + table1.setCombo(5, 3, new DefaultCellEditor(changeReasonBox)); // ϼ÷ - table1.setCombo(7, 3, new DefaultCellEditor(ReceiveClassifyBox)); + table1.setCombo(6, 3, new DefaultCellEditor(ReceiveClassifyBox)); + + // table1.setCombo(8, 1, new DefaultCellEditor(projectCode)); table1.getColumnModel().getColumn(0).setPreferredWidth(130); table1.getColumnModel().getColumn(1).setPreferredWidth(400); @@ -692,23 +1094,10 @@ public class ChangeApplyForm extends AbstractRendering { table1.setRowHeight(50); table1.setRowHeight(9, 100); table1.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); - - JButton btn = new JButton("ѡĿ"); - JButton btn_tzfz = new JButton("ͼֽ"); - - JButton zt_btn = new JButton("ѡ"); - - AddTaskListenerChange_TZ atz = new AddTaskListenerChange_TZ(this); - btn_tzfz.addActionListener(atz); - - AddTaskListenerChange atl = new AddTaskListenerChange(this); - btn.addActionListener(atl); - - AccountSetTaskListenerChangeApplyy at2 = new AccountSetTaskListenerChangeApplyy(this); - zt_btn.addActionListener(at2); - - model2 = new DefaultTableModel(null, new String[] { "", "Ʒ", "Ʒ", "ԭ汾", "ְ汾", "ԭ", "", "", - "˵", "δƷ", "δƷ", "", "", "", "", "ֿ", "" }) { +// { "", "Ʒ", "Ʒ", "ԭ汾", "ְ汾", "ԭ", "", "", +// "˵", "δƷ", "δƷ", "", "", "", "", "ֿ", "" } + model2 = new DefaultTableModel(null, new String[] { "", "Ʒ", "Ʒ", "汾", "ԭ", "", "", + "˵", "Ͻ׶", "", "", "", "ֿ" }) { public void setValueAt(Object value, int row, int col) { try { @@ -717,7 +1106,7 @@ public class ChangeApplyForm extends AbstractRendering { itemType = (TCComponentItemType) session.getTypeComponent("Item"); TCComponentItem item = itemType.find(val); String objectname = item.getStringProperty("object_name"); - String itemid = item.getStringProperty("item_id"); + String itemid = item.getStringProperty("item_id"); String kucun = StockResult (itemid); System.out.println("11.09id====="+itemid+"====11.09====="+kucun); TCComponent[] allRev = item.getRelatedComponents("revision_list"); @@ -741,17 +1130,17 @@ public class ChangeApplyForm extends AbstractRendering { rev[i] = list.get(i); System.out.println("汾===" + rev[i]); } - table2.setValueAt(objectname, table2.getSelectedRow(), 2); table2.setComboCell(table2.getSelectedRow(), 3, new com.connor.dfl.plm.table.MyComboBoxEditor2(rev)); - table2.setComboCell(table2.getSelectedRow(), 4, - new com.connor.dfl.plm.table.MyComboBoxEditor2(rev)); - table2.setComboCell(table2.getSelectedRow(), 10, new DefaultCellEditor(WAPYJBox)); - table2.setComboCell(table2.getSelectedRow(), 12, new DefaultCellEditor(ZZYJBox)); - table2.setComboCell(table2.getSelectedRow(), 14, new DefaultCellEditor(SSYJBox)); - table2.setValueAt(kucun, table2.getSelectedRow(), 15); - table2.setComboCell(table2.getSelectedRow(), 16, new DefaultCellEditor(CLYJBox)); +// table2.setComboCell(table2.getSelectedRow(), 4, +// new com.connor.dfl.plm.table.MyComboBoxEditor2(rev)); + table2.setComboCell(table2.getSelectedRow(), 8, new DefaultCellEditor(itemStateBox)); +// table2.setComboCell(table2.getSelectedRow(), 10, new DefaultCellEditor(WAPYJBox)); +// table2.setComboCell(table2.getSelectedRow(), 12, new DefaultCellEditor(ZZYJBox)); +// table2.setComboCell(table2.getSelectedRow(), 14, new DefaultCellEditor(SSYJBox)); +// table2.setValueAt(kucun, table2.getSelectedRow(), 15); + table2.setComboCell(table2.getSelectedRow(), 9, new DefaultCellEditor(CLYJBox)); } else { javax.swing.JOptionPane.showMessageDialog(null, "ƷƷдûа汾", "ϵͳʾ", @@ -775,7 +1164,7 @@ public class ChangeApplyForm extends AbstractRendering { table2 = new MyTable() { @Override public boolean isCellEditable(int row, int column) { - if (column == 0) { + if (column == 0 || column == 6) { return false; } return true; @@ -783,17 +1172,67 @@ public class ChangeApplyForm extends AbstractRendering { }; + model2.addTableModelListener(new TableModelListener() { + + @Override + public void tableChanged(TableModelEvent e) { + // TODO Auto-generated method stub + int column = e.getColumn(); + int firstRow = e.getFirstRow(); + System.out.println("("+firstRow+","+column+")"); + + if( column == 4) { + if(table2.getValueAt(firstRow, column)!=null && table2.getValueAt(firstRow, column+1)!=null) { + try { + Float ysl = Float.parseFloat(((String) table2.getValueAt(firstRow, column))); + Float xsl = Float.parseFloat(((String) table2.getValueAt(firstRow, column+1))); +// int ysl = Integer.parseInt(((String) table2.getValueAt(firstRow, column))); +// int xsl = Integer.parseInt(((String) table2.getValueAt(firstRow, column+1))); + BigDecimal b1 = new BigDecimal(ysl.toString()); + + BigDecimal b2 = new BigDecimal(xsl.toString()); + + float ss = b2.subtract(b1).floatValue(); + + table2.setValueAt(ss, firstRow, column+2); + } catch (Exception e2) { + // TODO: handle exception + e2.printStackTrace(); + MessageBox.post("!","",MessageBox.ERROR); + } + } + }else if(column == 5) { + if(table2.getValueAt(firstRow, column)!=null && table2.getValueAt(firstRow, column-1)!=null) { + try { +// int ysl = Integer.parseInt(((String) table2.getValueAt(firstRow, column-1))); +// int xsl = Integer.parseInt(((String) table2.getValueAt(firstRow, column))); + Float ysl = Float.parseFloat(((String) table2.getValueAt(firstRow, column-1))); + Float xsl = Float.parseFloat(((String) table2.getValueAt(firstRow, column))); + BigDecimal b1 = new BigDecimal(ysl.toString()); + + + BigDecimal b2 = new BigDecimal(xsl.toString()); + + float ss = b2.subtract(b1).floatValue(); + table2.setValueAt(ss, firstRow, column+1); + } catch (Exception e2) { + // TODO: handle exception + e2.printStackTrace(); + MessageBox.post("!","",MessageBox.ERROR); + } + } + } + + } + }); table2.setModel(model2); -// table2.setColumnModel(getColumn(table2, new int[] { 40, 90, 60, 50,50,50,50, 70, 75,75,70,70, 60, 70,60,70 })); - table2.setColumnModel(getColumn(table2, new int[] { 60, 150, 260, 70,70,70,70, 70,260, 90,90,70,70, 70, 70,70,150 })); -// table2.setColumnModel(getColumn(table2, new int[] { 90, 90, 90, 90,90,90,90, 90, 90,90,90,90, 90, 90,90,90 })); + table2.setColumnModel(getColumn(table2, new int[] { 60, 150, 260,70,70,70, 70,260, 90,90,70,70})); table2.setRowHeight(50); tcr = new DefaultTableCellRenderer(); tcr.setHorizontalAlignment(SwingConstants.CENTER); table1.setBorder(new LineBorder(Color.BLACK)); table1.setDefaultRenderer(Object.class, tcr); - table2.setBorder(new LineBorder(Color.BLACK)); table2.setDefaultRenderer(Object.class, tcr); table2.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); @@ -801,54 +1240,53 @@ public class ChangeApplyForm extends AbstractRendering { addButton = new JButton(" "); delButton = new JButton(" ɾ "); - List listdetils = getChangeDetail(name); + List listdetils = getChangeDetail(masterName); if (listdetils.size() > 0) { for (int j = 0; j < listdetils.size(); j++) { model2.addRow(new String[] { Integer.toString(rows1++) }); - ChangeDetils cd = (ChangeDetils) listdetils.get(j); - System.out.println("%%%%%%%%%%%%%" + cd.getPH()); + // int i =1; + // for(int j =0 ;j 6) { int count = rows1 - 6; count = 300 + count * 50; @@ -882,7 +1320,47 @@ public class ChangeApplyForm extends AbstractRendering { for (int j = sRows.length - 1; j >= 0; j--) { String PH = (String) model2.getValueAt(sRows[j], 1); System.out.println("=============Ʒ" + PH); - delChangedetil(name, PH); + delChangedetil(masterName, PH); + // Connection con = null; + // + // String sql = "delete from DFL_CHANGEDETAILS where PH=?"; + // System.out.println(sql); + // try { + // con = ConnectionFun(); + // PreparedStatement prepStmt = conn.prepareStatement(sql); + // prepStmt.setString(1,PH); + // prepStmt.executeUpdate(); + // // + // int result =prepStmt.executeUpdate();// ֵյӰ + // if(result>0) { + // System.out.println("ɾɹ"); + // }else { + // System.out.println("ɾʧ"); + // } + // // + // + // //p=prepStmt.executeUpdate(); + // + // + // + // // Statement stmt=conn.createStatement();//Statement + // // stmt.executeUpdate(sql);//ִsql + // System.out.println("ݿɾɹ"); + // } catch (Exception ex) { + // ex.printStackTrace(); + // } finally { + // try { + // con.close(); + // } catch (Exception ex) { + // ex.printStackTrace(); + // } + // } + + // for(int k=0 ;k 6) { - int count = rows1 - 6; - count = 300 + count * 50; - tablePanel2.setPreferredSize(new Dimension(1600, count)); - } else { - tablePanel2.setPreferredSize(new Dimension(1600, 300)); - } - - JPanel buttonPanel = new JPanel(new PropertyLayout()); - buttonPanel.add("1.1.left.top", addButton); - buttonPanel.add("2.1.left.top", delButton); JPanel buttonPanel0 = new JPanel(new PropertyLayout()); buttonPanel0.add("1.1.left.top", new JLabel(" ")); buttonPanel0.add("2.1.left.top", new JLabel(" ")); @@ -952,6 +1414,29 @@ public class ChangeApplyForm extends AbstractRendering { buttonPanel0.add("24.1.left.top", new JLabel(" ")); buttonPanel0.add("25.1.left.top", new JLabel(" ")); + JPanel tablePanel1 = new JPanel(); + tablePanel1.add(table1); + tablePanel1.setPreferredSize(new Dimension(1600, 700)); + + // JPanel showCalendarPanel = new JPanel(); + // showCalendarPanel.add("1.1.left.top",showCalenderButten); + +// JPanel tablePanel2 = new JPanel(); +// tablePanel2.add(table2); + tablePanel2 = new JScrollPane(table2); + tablePanel2.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); + if (rows1 > 6) { + int count = rows1 - 6; + count = 300 + count * 50; + tablePanel2.setPreferredSize(new Dimension(1600, count)); + } else { + tablePanel2.setPreferredSize(new Dimension(1600, 300)); + } + + JPanel buttonPanel = new JPanel(new PropertyLayout()); + buttonPanel.add("1.1.left.top", addButton); + buttonPanel.add("2.1.left.top", delButton); + JPanel rootPanel = new JPanel(new PropertyLayout()); JLabel detailsLable = new JLabel("ϸ"); @@ -960,27 +1445,33 @@ public class ChangeApplyForm extends AbstractRendering { rootPanel.add("1.1.center.top", titleLable); rootPanel.add("2.1.left.top", tablePanel1); rootPanel.add("2.2.left.top", buttonPanel0); - // rootPanel.add("2.2.left.top",showCalendarPanel); rootPanel.add("3.1.left.top", detailsLable); - JPanel test = new JPanel(new PropertyLayout()); test.add("1.1.left.top", tablePanel2); test.add("1.2.left.top", buttonPanel); JPanel mainPanel = new JPanel(new BorderLayout()); mainPanel.add(rootPanel, BorderLayout.NORTH); - mainPanel.add(test, BorderLayout.WEST); + mainPanel.add(test, BorderLayout.CENTER); + + this.setSize(1600, 800); +// this.setPreferredSize(new Dimension(1600,1000)); - // this.setPreferredSize(new Dimension(1820, 1000)); - this.setSize(1600, 1300); this.setLayout(new BorderLayout()); scrollPane = new JScrollPane(mainPanel); scrollPane.getVerticalScrollBar().setUnitIncrement(20); + scrollPane.setPreferredSize(new Dimension((int) mainPanel.getPreferredSize().getWidth(), + (int) mainPanel.getPreferredSize().getHeight())); +// System.out.println("scWid:"+scrollPane.getPreferredSize().getWidth()); +// System.out.println("scHei:"+scrollPane.getPreferredSize().getHeight()); this.add(scrollPane, BorderLayout.CENTER); this.setBackground(Color.WHITE); +// this.setPreferredSize(new Dimension((int) scrollPane.getPreferredSize().getWidth(), +// (int) scrollPane.getPreferredSize().getHeight())); + this.addComponentListener(new ComponentListener() { @Override @@ -1023,86 +1514,140 @@ public class ChangeApplyForm extends AbstractRendering { } }); - this.setVisible(true); - } @Override public void saveRendering() { - if(model1.getValueAt(0, 5)==null||model1.getValueAt(4, 1)==null) { - MessageBox.post("ʱΪ","",MessageBox.ERROR); - } - delChangeForm(name); - ChangeOrderBean bn = new ChangeOrderBean(); - bn.setObjectCode(name); - bn.setApplyName(model1.getValueAt(0, 1) == null ? "" : model1.getValueAt(0, 1).toString()); + if("ⲿ-SAT".equals(receiveClassify) || "-".equals(receiveClassify) || "-".equals(receiveClassify)) { + Object valueAt = model1.getValueAt(10, 5); + if(valueAt == null || "".equals(valueAt)) { + MessageBox.post("kkű","",MessageBox.ERROR); + return; + } + } + + + + if(model1.getValueAt(0, 5)==null || model1.getValueAt(1, 1)==null || model1.getValueAt(1, 3)==null || model1.getValueAt(1, 5)==null + || model1.getValueAt(5, 3)==null || model1.getValueAt(7, 1)==null || model1.getValueAt(7, 3)==null || model1.getValueAt(8, 1)==null) { + MessageBox.post("ʱ䡢ƷšƷͺšͻơƷ͡۸Ԥ۷ࡢԭΪ","",MessageBox.ERROR); + } + delChangeForm(masterName); + ChangeOrderBean2 bn = new ChangeOrderBean2(); + bn.setApplyman(applyname); + bn.setChangeCode(masterName); bn.setApplyDate(model1.getValueAt(0, 5) == null ? "" : model1.getValueAt(0, 5).toString()); - bn.setProjectCode(model1.getValueAt(8, 1) == null ? "" : model1.getValueAt(8, 1).toString()); - bn.setClientNae(model1.getValueAt(1, 5) == null ? "" : model1.getValueAt(1, 5).toString()); - bn.setProductDepartment(model1.getValueAt(3, 1) == null ? "" : model1.getValueAt(3, 1).toString()); - bn.setProductName(model1.getValueAt(1, 1) == null ? "" : model1.getValueAt(1, 1).toString()); - bn.setProjectModel(model1.getValueAt(1, 3) == null ? "" : model1.getValueAt(1, 3).toString()); - // Ӱ豸 - bn.setAffectedPart(model1.getValueAt(6, 1) == null ? "" : model1.getValueAt(6, 1).toString()); - - bn.setChangeType(model1.getValueAt(4, 1) == null ? "" : model1.getValueAt(4, 1).toString()); - bn.setProductType(model1.getValueAt(4, 3) == null ? "" : model1.getValueAt(4, 3).toString()); - bn.setErrorType(model1.getValueAt(4, 5) == null ? "" : model1.getValueAt(4, 5).toString()); - bn.setDutyDepartment(model1.getValueAt(3, 3) == null ? "" : model1.getValueAt(3, 3).toString()); - bn.setDutyMan(model1.getValueAt(3, 5) == null ? "" : model1.getValueAt(3, 5).toString()); - // ԭ - bn.setChangeReason(model1.getValueAt(9, 1) == null ? "" : model1.getValueAt(9, 1).toString()); - - bn.setSalseClassify(model1.getValueAt(5, 3) == null ? "" : model1.getValueAt(5, 3).toString()); - - bn.setPriceBooking(model1.getValueAt(5, 1) == null ? "" : model1.getValueAt(5, 1).toString()); - - bn.setIsNotProductLoss(model1.getValueAt(5, 5) == null ? "" : model1.getValueAt(5, 5).toString()); - bn.setReceiveClassify(model1.getValueAt(7, 3) == null ? "" : model1.getValueAt(7, 3).toString()); - bn.setWarehouseCode(model1.getValueAt(2, 1) == null ? "" : model1.getValueAt(2, 1).toString()); - // ̶֪ͨ - bn.setNotifyEmergencyProcedures(model1.getValueAt(2, 3) == null ? "" : model1.getValueAt(2, 3).toString()); - - bn.setDrawingTo(model1.getValueAt(7, 5) == null ? "" : model1.getValueAt(7, 5).toString()); - - bn.setChangeListCode(model1.getValueAt(0, 3) == null ? "" : model1.getValueAt(0, 3).toString()); - bn.setTZChangeType(model1.getValueAt(2, 5) == null ? "" : model1.getValueAt(2, 5).toString()); - bn.setSUOSU_ProductDepartment(" "); - // model1.getValueAt(6, 1) == null ? "" :model1.getValueAt(6, 1).toString() - // ˾ - bn.setAccountSet(model1.getValueAt(10, 1) == null ? "" : model1.getValueAt(10, 1).toString()); - - bn.setProjectState(model1.getValueAt(7, 1) == null ? "" : model1.getValueAt(7, 1).toString()); - insertMes(bn); + bn.setProductCode(model1.getValueAt(1, 1) == null ? "" : model1.getValueAt(1, 1).toString()); + bn.setProductTypeXh(model1.getValueAt(1, 3) == null ? "" : model1.getValueAt(1, 3).toString()); + bn.setClientName(model1.getValueAt(1, 5) == null ? "" : model1.getValueAt(1, 5).toString()); + bn.setProductDepart(model1.getValueAt(2, 1) == null ? "" : model1.getValueAt(2, 1).toString()); + bn.setStorageNum(model1.getValueAt(2, 3) == null ? "" : model1.getValueAt(2, 3).toString()); + bn.setWareHourse(model1.getValueAt(2, 5) == null ? "" : model1.getValueAt(2, 5).toString()); + bn.setDutyDepartment(model1.getValueAt(3, 1) == null ? "" : model1.getValueAt(3, 1).toString()); + bn.setDutyMan(model1.getValueAt(3, 3) == null ? "" : model1.getValueAt(3, 3).toString()); + bn.setChangeOfMajor(model1.getValueAt(3, 5) == null ? "" : model1.getValueAt(3, 5).toString()); + bn.setLayoutInterface(model1.getValueAt(4, 1) == null ? "" : model1.getValueAt(4, 1).toString()); + bn.setChangeType(model1.getValueAt(4, 3) == null ? "" : model1.getValueAt(4, 3).toString()); + bn.setChangeInputType(model1.getValueAt(4, 5) == null ? "" : model1.getValueAt(4, 5).toString()); + bn.setSystemCode(model1.getValueAt(5, 1) == null ? "" : model1.getValueAt(5, 1).toString()); + bn.setChangeReason(model1.getValueAt(5, 3) == null ? "" : model1.getValueAt(5, 3).toString()); + bn.setProductType(model1.getValueAt(5, 5) == null ? "" : model1.getValueAt(5, 5).toString()); + bn.setChangeTag(model1.getValueAt(6, 1) == null ? "" : model1.getValueAt(6, 1).toString()); + bn.setItemLYLX(model1.getValueAt(6, 3) == null ? "" : model1.getValueAt(6, 3).toString()); + bn.setNeedBuy(model1.getValueAt(6, 5) == null ? "" : model1.getValueAt(6, 5).toString()); + bn.setPricePri(model1.getValueAt(7, 1) == null ? "" : model1.getValueAt(7, 1).toString()); + bn.setSaleClass(model1.getValueAt(7, 3) == null ? "" : model1.getValueAt(7, 3).toString()); + bn.setCloseMan(model1.getValueAt(7, 5) == null ? "" : model1.getValueAt(7, 5).toString()); + bn.setReasonDetail(model1.getValueAt(8, 1) == null ? "" : model1.getValueAt(8, 1).toString()); + bn.setHandleOpinion(model1.getValueAt(9, 1) == null ? "" : model1.getValueAt(9, 1).toString()); + bn.setItemNeedDate(model1.getValueAt(9, 3) == null ? "" : model1.getValueAt(9, 3).toString()); + bn.setDegreeOfurgency(model1.getValueAt(9, 5) == null ? "" : model1.getValueAt(9, 5).toString()); + bn.setPkeyword(model1.getValueAt(10, 1) == null ? "" : model1.getValueAt(10, 1).toString()); + bn.setManageclassify(model1.getValueAt(10, 3) == null ? "" : model1.getValueAt(10, 3).toString()); + bn.setKkcode(model1.getValueAt(10, 5) == null ? "" : model1.getValueAt(10, 5).toString()); +// bn.setApplyName(model1.getValueAt(0, 1) == null ? "" : model1.getValueAt(0, 1).toString()); +// bn.setApplyDate(model1.getValueAt(0, 5) == null ? "" : model1.getValueAt(0, 5).toString()); +// bn.setProjectCode(model1.getValueAt(4, 5) == null ? "" : model1.getValueAt(4, 5).toString()); +// bn.setClientNae(model1.getValueAt(1, 5) == null ? "" : model1.getValueAt(1, 5).toString()); +// bn.setProductDepartment(model1.getValueAt(2, 1) == null ? "" : model1.getValueAt(2, 1).toString()); +//// bn.setProductName(model1.getValueAt(1, 1) == null ? "" : model1.getValueAt(1, 1).toString()); +// bn.setProjectModel(model1.getValueAt(1, 3) == null ? "" : model1.getValueAt(1, 3).toString()); +// // Ӱ豸 +// bn.setAffectedPart(model1.getValueAt(6, 1) == null ? "" : model1.getValueAt(6, 1).toString()); +// +// bn.setChangeType(model1.getValueAt(4, 1) == null ? "" : model1.getValueAt(4, 1).toString()); +// bn.setProductType(model1.getValueAt(4, 3) == null ? "" : model1.getValueAt(4, 3).toString()); +// bn.setErrorType(model1.getValueAt(4, 5) == null ? "" : model1.getValueAt(4, 5).toString()); +// bn.setDutyDepartment(model1.getValueAt(3, 3) == null ? "" : model1.getValueAt(3, 3).toString()); +// bn.setDutyMan(model1.getValueAt(3, 5) == null ? "" : model1.getValueAt(3, 5).toString()); +// // ԭ +// bn.setChangeReason(model1.getValueAt(9, 1) == null ? "" : model1.getValueAt(9, 1).toString()); +// +// bn.setSalseClassify(model1.getValueAt(5, 3) == null ? "" : model1.getValueAt(5, 3).toString()); +// bn.setPriceBooking(model1.getValueAt(5, 1) == null ? "" : model1.getValueAt(5, 1).toString()); +// bn.setIsNotProductLoss(model1.getValueAt(5, 5) == null ? "" : model1.getValueAt(5, 5).toString()); +// bn.setReceiveClassify(model1.getValueAt(7, 3) == null ? "" : model1.getValueAt(7, 3).toString()); +// bn.setWarehouseCode(model1.getValueAt(2, 1) == null ? "" : model1.getValueAt(2, 1).toString()); +// // ̶֪ͨ +// bn.setNotifyEmergencyProcedures(model1.getValueAt(2, 3) == null ? "" : model1.getValueAt(2, 3).toString()); +// +// bn.setDrawingTo(model1.getValueAt(7, 5) == null ? "" : model1.getValueAt(7, 5).toString()); +// +// bn.setChangeListCode(model1.getValueAt(0, 3) == null ? "" : model1.getValueAt(0, 3).toString()); +// bn.setTZChangeType(model1.getValueAt(2, 5) == null ? "" : model1.getValueAt(2, 5).toString()); +// +// bn.setSUOSU_ProductDepartment(""); +// // model1.getValueAt(6, 1) == null ? "" :model1.getValueAt(6, 1).toString() +// +// // ˾ +// bn.setAccountSet(model1.getValueAt(10, 1) == null ? "" : model1.getValueAt(10, 1).toString()); +// +// bn.setProjectState(model1.getValueAt(7, 1) == null ? "" : model1.getValueAt(7, 1).toString()); + insertMes2(bn); // =================================================================== - delAllChangedetil(name); + delAllChangedetil(masterName); for (int cdss = 0; cdss < table2.getRowCount(); cdss++) { - changedeList.add(new ChangeDetils()); + changedeList.add(new ChangeDetails2()); } List changedetials = new ArrayList(); // for (int k = 0; k < table2.getRowCount(); k++) { ChangeDetils cds = new ChangeDetils(); - changedeList.get(k).setObjectCode(name); - changedeList.get(k).setPH(model2.getValueAt(k, 1) == null ? "" : model2.getValueAt(k, 1).toString()); - changedeList.get(k).setPM(model2.getValueAt(k, 2) == null ? "" : model2.getValueAt(k, 2).toString()); - changedeList.get(k).setYBB(model2.getValueAt(k, 3) == null ? "" : model2.getValueAt(k, 3).toString()); - changedeList.get(k).setXBB(model2.getValueAt(k, 4) == null ? "" : model2.getValueAt(k, 4).toString()); - changedeList.get(k).setYSL(model2.getValueAt(k, 5) == null ? "" : model2.getValueAt(k, 5).toString()); - changedeList.get(k).setXSL(model2.getValueAt(k, 6) == null ? "" : model2.getValueAt(k, 6).toString()); - changedeList.get(k).setBGSL(model2.getValueAt(k, 7) == null ? "" : model2.getValueAt(k, 7).toString()); - changedeList.get(k).setGGSM(model2.getValueAt(k, 8) == null ? "" : model2.getValueAt(k, 8).toString()); - changedeList.get(k).setWZPSL(model2.getValueAt(k, 9) == null ? "" : model2.getValueAt(k, 9).toString()); - changedeList.get(k).setWZPUJ(model2.getValueAt(k, 10) == null ? "" : model2.getValueAt(k, 10).toString()); - changedeList.get(k).setZZSL(model2.getValueAt(k, 11) == null ? "" : model2.getValueAt(k, 11).toString()); - changedeList.get(k).setZZYJ(model2.getValueAt(k, 12) == null ? "" : model2.getValueAt(k, 12).toString()); - changedeList.get(k).setSCSL(model2.getValueAt(k, 13) == null ? "" : model2.getValueAt(k, 13).toString()); - changedeList.get(k).setSSYJ(model2.getValueAt(k, 14) == null ? "" : model2.getValueAt(k, 14).toString()); - changedeList.get(k).setCKSL(model2.getValueAt(k, 15) == null ? "" : model2.getValueAt(k, 15).toString()); - changedeList.get(k).setCLYJ(model2.getValueAt(k, 16) == null ? "" : model2.getValueAt(k, 16).toString()); + changedeList.get(k).setObjectCode(masterName); + changedeList.get(k).setOrder(model2.getValueAt(k, 0) == null ? "" : model2.getValueAt(k, 0).toString()); + changedeList.get(k).setItemCode(model2.getValueAt(k, 1) == null ? "" : model2.getValueAt(k, 1).toString()); + changedeList.get(k).setItemName(model2.getValueAt(k, 2) == null ? "" : model2.getValueAt(k, 2).toString()); + changedeList.get(k).setRevNum(model2.getValueAt(k, 3) == null ? "" : model2.getValueAt(k, 3).toString()); +// changedeList.get(k).setRevNow(model2.getValueAt(k, 4) == null ? "" : model2.getValueAt(k, 4).toString()); + changedeList.get(k).setProtolNum(model2.getValueAt(k, 4) == null ? "" : model2.getValueAt(k, 4).toString()); + changedeList.get(k).setNowNum(model2.getValueAt(k, 5) == null ? "" : model2.getValueAt(k, 5).toString()); + changedeList.get(k).setChangeNum(model2.getValueAt(k, 6) == null ? "" : model2.getValueAt(k, 6).toString()); + changedeList.get(k).setChangeInroduct(model2.getValueAt(k, 7) == null ? "" : model2.getValueAt(k, 7).toString()); + changedeList.get(k).setItemState(model2.getValueAt(k, 8) == null ? "" : model2.getValueAt(k, 8).toString()); + changedeList.get(k).setHandleOpinion(model2.getValueAt(k, 9) == null ? "" : model2.getValueAt(k, 9).toString()); + changedeList.get(k).setProductingNum(model2.getValueAt(k, 10) == null ? "" : model2.getValueAt(k, 10).toString()); + changedeList.get(k).setProductNum(model2.getValueAt(k, 11) == null ? "" : model2.getValueAt(k, 11).toString()); + changedeList.get(k).setStorageNum(model2.getValueAt(k, 12) == null ? "" : model2.getValueAt(k, 12).toString()); + +// changedeList.get(k).setPH(model2.getValueAt(k, 1) == null ? "" : model2.getValueAt(k, 1).toString()); +// changedeList.get(k).setPM(model2.getValueAt(k, 2) == null ? "" : model2.getValueAt(k, 2).toString()); +// changedeList.get(k).setYBB(model2.getValueAt(k, 3) == null ? "" : model2.getValueAt(k, 3).toString()); +// changedeList.get(k).setXBB(model2.getValueAt(k, 4) == null ? "" : model2.getValueAt(k, 4).toString()); +// changedeList.get(k).setYSL(model2.getValueAt(k, 5) == null ? "" : model2.getValueAt(k, 5).toString()); +// changedeList.get(k).setXSL(model2.getValueAt(k, 6) == null ? "" : model2.getValueAt(k, 6).toString()); +// changedeList.get(k).setBGSL(model2.getValueAt(k, 7) == null ? "" : model2.getValueAt(k, 7).toString()); +// changedeList.get(k).setGGSM(model2.getValueAt(k, 8) == null ? "" : model2.getValueAt(k, 8).toString()); +// changedeList.get(k).setWZPSL(model2.getValueAt(k, 9) == null ? "" : model2.getValueAt(k, 9).toString()); +// changedeList.get(k).setWZPUJ(model2.getValueAt(k, 10) == null ? "" : model2.getValueAt(k, 10).toString()); +// changedeList.get(k).setZZSL(model2.getValueAt(k, 11) == null ? "" : model2.getValueAt(k, 11).toString()); +// changedeList.get(k).setZZYJ(model2.getValueAt(k, 12) == null ? "" : model2.getValueAt(k, 12).toString()); +// changedeList.get(k).setSCSL(model2.getValueAt(k, 13) == null ? "" : model2.getValueAt(k, 13).toString()); +// changedeList.get(k).setSSYJ(model2.getValueAt(k, 14) == null ? "" : model2.getValueAt(k, 14).toString()); +// changedeList.get(k).setCKSL(model2.getValueAt(k, 15) == null ? "" : model2.getValueAt(k, 15).toString()); +// changedeList.get(k).setCLYJ(model2.getValueAt(k, 16) == null ? "" : model2.getValueAt(k, 16).toString()); changedetials.add(changedeList.get(k)); } @@ -1111,14 +1656,13 @@ public class ChangeApplyForm extends AbstractRendering { insertChangeDetailsMes(changedeList.get(l)); } + changeRevProperty(bn); updateExcelAtRev(); - } private void updateExcelAtRev() { - System.out.println("λ1"); - List changeDetail = getChangeDetail(name); - List changeMesg = getChangeMesg(name); + List changeDetail = getChangeDetail(masterName); + List changeMesg = getChangeMesg(masterName); // ݼ 1: 2: 3: try { @@ -1132,25 +1676,26 @@ public class ChangeApplyForm extends AbstractRendering { rev = (TCComponentItemRevision) component2; } } - + System.out.println("Ƿݼ"+rev != null); if (rev != null) { String as1[] = { "C:\\test\\"+my_item_id+"-"+objname+".xlsx" }; String as2[] = { "excel" }; TCComponentDatasetType tccomponentDatasetType = (TCComponentDatasetType) session .getTypeComponent("MSExcelX"); - TCComponentDataset tccomponentDataset = tccomponentDatasetType.create(name + "-"+objname, "", "MSExcelX"); + TCComponentDataset tccomponentDataset = tccomponentDatasetType.create(masterName + "-"+objname, "", + "MSExcelX"); tccomponentDataset.setFiles(as1, as2); // ϴݼļ TCComponent[] referenceListProperty = rev.getReferenceListProperty("IMAN_specification"); - if (referenceListProperty != null && referenceListProperty.length != 0) { - for (TCComponent comp2 : referenceListProperty) { - if (comp2 instanceof TCComponentDataset) { - TCComponentDataset ds = (TCComponentDataset) comp2; - if (ds.getStringProperty("object_name").equals(name + "-"+objname)) { + if(referenceListProperty!=null&&referenceListProperty.length!=0) { + for(TCComponent comp2:referenceListProperty) { + if(comp2 instanceof TCComponentDataset) { + TCComponentDataset ds = (TCComponentDataset)comp2; +// if(ds.getStringProperty("object_name").equals(masterName+"-"+objname)) { ds.setFiles(as1, as2); - } +// } } } - } else { + }else { rev.add("IMAN_specification", tccomponentDataset); } } @@ -1206,8 +1751,8 @@ public class ChangeApplyForm extends AbstractRendering { } } return flag; - } - + } + /** * excel * @@ -1221,8 +1766,8 @@ public class ChangeApplyForm extends AbstractRendering { * @throws FileNotFoundException * @author xinhy */ - private void create(String filepath, String filename, List changeMesg, - List changeDetils, String model) throws IOException, FileNotFoundException { + private void create(String filepath, String filename, List changeMesg, + List changeDetils, String model) throws IOException, FileNotFoundException { // ļģ InputStream modeFile = ChangeNotifyForm.class.getResourceAsStream(model); // XSSFWorkbook(excelĵ) @@ -1233,159 +1778,186 @@ public class ChangeApplyForm extends AbstractRendering { // XSSFCell cell1 = row1.getCell(0); // XSSFCellStyle style = cell1.getCellStyle(); if (changeMesg != null && changeMesg.size() > 0) { - ChangeOrderBean cob = changeMesg.get(0); - String sqr = cob.getApplyName(); + ChangeOrderBean2 cob = changeMesg.get(0); + System.out.println("cob=>"+cob); + String sqr = cob.getApplyman(); String sqsj = cob.getApplyDate(); - String xmbh = cob.getProjectCode(); - String khmc = cob.getClientNae(); - String cpbm = cob.getProductDepartment(); - String cpmc = cob.getProductName(); - String cpxh = cob.getProjectModel(); + String xmbh = cob.getSystemCode(); + String khmc = cob.getClientName(); + String cpbm = cob.getProductDepart(); + String cpbh = cob.getProductCode(); + String cpxh = cob.getProductTypeXh(); String gglx = cob.getChangeType(); - String cplx = cob.getProductType(); - String tzgglx = cob.getTZChangeType(); - String cwlx = cob.getErrorType(); + String bgsclx = cob.getChangeInputType(); String zrbm = cob.getDutyDepartment(); String zrr = cob.getDutyMan(); + String bgzy = cob.getChangeOfMajor(); + String pkeyword2 = cob.getPkeyword(); + String manageclassify2 = cob.getManageclassify(); + String kkcode2 = cob.getKkcode(); String ggyy = cob.getChangeReason(); - String ssfl = cob.getSalseClassify(); - String jgyg = cob.getPriceBooking(); - String sfcscbss = cob.getIsNotProductLoss(); - String ljlyfl = cob.getReceiveClassify(); - String ckbh = cob.getWarehouseCode(); - String zt = cob.getAccountSet(); - String tzjjcd = cob.getNotifyEmergencyProcedures(); - String tzfz = cob.getDrawingTo(); - String syxdsbhlbj = cob.getAffectedPart(); - String xmjd = cob.getProjectState(); - String bgtzdh = cob.getChangeListCode(); + String ckbh = cob.getStorageNum(); + String zt = cob.getWareHourse(); + String bgtzdh = cob.getChangeCode(); + String sfyxbjjk = cob.getLayoutInterface(); + String bgyy = cob.getChangeReason(); + String cplx = cob.getProductType(); + String bgbq = cob.getChangeTag(); + String wlfl = cob.getItemLYLX(); + String sfxycg = cob.getNeedBuy(); + String jtyy = cob.getReasonDetail(); + String wlxqrq = cob.getItemNeedDate(); + String tzjjcd = cob.getDegreeOfurgency(); + String jgyg = cob.getPricePri(); + String xsfl = cob.getSaleClass(); + String gbqrr = cob.getCloseMan(); + String tzfsz = cob.getHandleOpinion(); + + XSSFRow row = sheet.getRow(0); XSSFCell cell = row.getCell(0); - XSSFRichTextString richTextString = new XSSFRichTextString(name +"-"+ objname); + XSSFRichTextString richTextString = new XSSFRichTextString(masterName + "-"+objname); cell.setCellValue(richTextString); row = sheet.getRow(1); cell = row.getCell(2); richTextString = new XSSFRichTextString(sqr); cell.setCellValue(richTextString); - cell = row.getCell(6); + cell = row.getCell(5); richTextString = new XSSFRichTextString(bgtzdh); cell.setCellValue(richTextString); - cell = row.getCell(12); + cell = row.getCell(10); richTextString = new XSSFRichTextString(sqsj); cell.setCellValue(richTextString); row = sheet.getRow(2); cell = row.getCell(2); - richTextString = new XSSFRichTextString(cpmc); + richTextString = new XSSFRichTextString(cpbh); cell.setCellValue(richTextString); - cell = row.getCell(6); + cell = row.getCell(5); richTextString = new XSSFRichTextString(cpxh); cell.setCellValue(richTextString); - cell = row.getCell(12); + cell = row.getCell(10); richTextString = new XSSFRichTextString(khmc); cell.setCellValue(richTextString); row = sheet.getRow(3); cell = row.getCell(2); - richTextString = new XSSFRichTextString(ckbh); + richTextString = new XSSFRichTextString(cpbm); cell.setCellValue(richTextString); - cell = row.getCell(6); - richTextString = new XSSFRichTextString(tzjjcd); + cell = row.getCell(5); + richTextString = new XSSFRichTextString(ckbh); cell.setCellValue(richTextString); - cell = row.getCell(12); - richTextString = new XSSFRichTextString(tzgglx); + cell = row.getCell(10); + richTextString = new XSSFRichTextString(zt); cell.setCellValue(richTextString); row = sheet.getRow(4); cell = row.getCell(2); - richTextString = new XSSFRichTextString(cpbm); - cell.setCellValue(richTextString); - cell = row.getCell(6); richTextString = new XSSFRichTextString(zrbm); cell.setCellValue(richTextString); - cell = row.getCell(12); + cell = row.getCell(5); richTextString = new XSSFRichTextString(zrr); cell.setCellValue(richTextString); + cell = row.getCell(10); + richTextString = new XSSFRichTextString(bgzy); + cell.setCellValue(richTextString); row = sheet.getRow(5); cell = row.getCell(2); - richTextString = new XSSFRichTextString(gglx); + richTextString = new XSSFRichTextString(sfyxbjjk); cell.setCellValue(richTextString); - cell = row.getCell(6); - richTextString = new XSSFRichTextString(cplx); + cell = row.getCell(5); + richTextString = new XSSFRichTextString(gglx); cell.setCellValue(richTextString); - cell = row.getCell(12); - richTextString = new XSSFRichTextString(cwlx); + cell = row.getCell(10); + richTextString = new XSSFRichTextString(bgsclx); cell.setCellValue(richTextString); row = sheet.getRow(6); cell = row.getCell(2); - richTextString = new XSSFRichTextString(jgyg); + richTextString = new XSSFRichTextString(xmbh); cell.setCellValue(richTextString); - cell = row.getCell(6); - richTextString = new XSSFRichTextString(ssfl); + cell = row.getCell(5); + richTextString = new XSSFRichTextString(bgyy); cell.setCellValue(richTextString); - cell = row.getCell(12); - richTextString = new XSSFRichTextString(sfcscbss); + cell = row.getCell(10); + richTextString = new XSSFRichTextString(cplx); cell.setCellValue(richTextString); row = sheet.getRow(7); cell = row.getCell(2); - richTextString = new XSSFRichTextString(syxdsbhlbj); + richTextString = new XSSFRichTextString(bgbq); + cell.setCellValue(richTextString); + cell = row.getCell(5); + richTextString = new XSSFRichTextString(wlfl); + cell.setCellValue(richTextString); + cell = row.getCell(10); + richTextString = new XSSFRichTextString(sfxycg); cell.setCellValue(richTextString); row = sheet.getRow(8); cell = row.getCell(2); - richTextString = new XSSFRichTextString(xmjd); + richTextString = new XSSFRichTextString(jgyg); cell.setCellValue(richTextString); - cell = row.getCell(6); - richTextString = new XSSFRichTextString(ljlyfl); + cell = row.getCell(5); + richTextString = new XSSFRichTextString(xsfl); cell.setCellValue(richTextString); - cell = row.getCell(12); - richTextString = new XSSFRichTextString(tzfz); + cell = row.getCell(10); + richTextString = new XSSFRichTextString(gbqrr); cell.setCellValue(richTextString); row = sheet.getRow(9); cell = row.getCell(2); - richTextString = new XSSFRichTextString(xmbh); + richTextString = new XSSFRichTextString(jtyy); cell.setCellValue(richTextString); row = sheet.getRow(10); cell = row.getCell(2); - richTextString = new XSSFRichTextString(ggyy); + richTextString = new XSSFRichTextString(tzfsz); cell.setCellValue(richTextString); - - row = sheet.getRow(11); - cell = row.getCell(2); - richTextString = new XSSFRichTextString(zt); + cell = row.getCell(5); + richTextString = new XSSFRichTextString(wlxqrq); cell.setCellValue(richTextString); + cell = row.getCell(10); + richTextString = new XSSFRichTextString(tzfsz); + cell.setCellValue(tzjjcd); + + row = sheet.getRow(11); + cell = row.getCell(2); + richTextString = new XSSFRichTextString(pkeyword2); + cell.setCellValue(richTextString); + cell = row.getCell(5); + richTextString = new XSSFRichTextString(manageclassify2); + cell.setCellValue(richTextString); + cell = row.getCell(10); + richTextString = new XSSFRichTextString(kkcode2); + cell.setCellValue(richTextString); + } if (changeDetils != null && changeDetils.size() > 0) { for (int i = 0; i < changeDetils.size(); i++) { - XSSFRow row = sheet.getRow(i + 16); + XSSFRow row = sheet.getRow(i + 14); if (row == null) { - row = sheet.createRow(i + 16); + row = sheet.createRow(i + 14); } - ChangeDetils changeDetil = changeDetils.get(i); - String ph = changeDetil.getPH(); - String pm = changeDetil.getPM(); - String ybb = changeDetil.getYBB(); - String xbb = changeDetil.getXBB(); - String ysl = changeDetil.getYSL(); - String xsl = changeDetil.getXSL(); - String bgsl = changeDetil.getBGSL(); - String ggsm = changeDetil.getGGSM(); - String wzpsl = changeDetil.getWZPSL(); - String wzpuj = changeDetil.getWZPUJ(); - String zzsl = changeDetil.getZZSL(); - String zzyj = changeDetil.getZZYJ(); - String scsl = changeDetil.getSCSL(); - String ssyj = changeDetil.getSSYJ(); - String cksl = changeDetil.getCKSL(); - String clyj = changeDetil.getCLYJ(); + ChangeDetails2 changeDetil = changeDetils.get(i); + System.out.println(changeDetil); + String ph = changeDetil.getItemCode(); + String pm = changeDetil.getItemName(); + String ybb = changeDetil.getRevNum(); + String xbb = changeDetil.getRevNow(); + String ysl = changeDetil.getProtolNum(); + String xsl = changeDetil.getNowNum(); + String bgsl = changeDetil.getChangeNum(); + String ggsm = changeDetil.getChangeInroduct(); + String wljd = changeDetil.getItemState(); + String clyj = changeDetil.getHandleOpinion(); + String zzsl = changeDetil.getProductingNum(); + String scsl = changeDetil.getProductNum(); + String cksl = changeDetil.getStorageNum(); XSSFCell cell = row.getCell(0); if (cell == null) { @@ -1411,6 +1983,14 @@ public class ChangeApplyForm extends AbstractRendering { richTextString = new XSSFRichTextString(pm); cell.setCellValue(richTextString); +// cell = row.getCell(3); +// if (cell == null) { +// cell = row.createCell(3); +// +// } +// richTextString = new XSSFRichTextString(ybb); +// cell.setCellValue(richTextString); +// cell = row.getCell(3); if (cell == null) { cell = row.createCell(3); @@ -1424,7 +2004,7 @@ public class ChangeApplyForm extends AbstractRendering { cell = row.createCell(4); } - richTextString = new XSSFRichTextString(xbb); + richTextString = new XSSFRichTextString(ysl); cell.setCellValue(richTextString); cell = row.getCell(5); @@ -1432,7 +2012,7 @@ public class ChangeApplyForm extends AbstractRendering { cell = row.createCell(5); } - richTextString = new XSSFRichTextString(ysl); + richTextString = new XSSFRichTextString(xsl); cell.setCellValue(richTextString); cell = row.getCell(6); @@ -1440,7 +2020,7 @@ public class ChangeApplyForm extends AbstractRendering { cell = row.createCell(6); } - richTextString = new XSSFRichTextString(xsl); + richTextString = new XSSFRichTextString(bgsl); cell.setCellValue(richTextString); cell = row.getCell(7); @@ -1448,7 +2028,7 @@ public class ChangeApplyForm extends AbstractRendering { cell = row.createCell(7); } - richTextString = new XSSFRichTextString(bgsl); + richTextString = new XSSFRichTextString(ggsm); cell.setCellValue(richTextString); cell = row.getCell(8); @@ -1456,7 +2036,7 @@ public class ChangeApplyForm extends AbstractRendering { cell = row.createCell(8); } - richTextString = new XSSFRichTextString(ggsm); + richTextString = new XSSFRichTextString(wljd); cell.setCellValue(richTextString); cell = row.getCell(9); @@ -1464,7 +2044,7 @@ public class ChangeApplyForm extends AbstractRendering { cell = row.createCell(9); } - richTextString = new XSSFRichTextString(wzpsl); + richTextString = new XSSFRichTextString(clyj); cell.setCellValue(richTextString); cell = row.getCell(10); @@ -1472,7 +2052,7 @@ public class ChangeApplyForm extends AbstractRendering { cell = row.createCell(10); } - richTextString = new XSSFRichTextString(wzpuj); + richTextString = new XSSFRichTextString(zzsl); cell.setCellValue(richTextString); cell = row.getCell(11); @@ -1480,48 +2060,17 @@ public class ChangeApplyForm extends AbstractRendering { cell = row.createCell(11); } - richTextString = new XSSFRichTextString(zzsl); + richTextString = new XSSFRichTextString(scsl); cell.setCellValue(richTextString); cell = row.getCell(12); if (cell == null) { cell = row.createCell(12); - } - richTextString = new XSSFRichTextString(zzyj); - cell.setCellValue(richTextString); - - cell = row.getCell(13); - if (cell == null) { - cell = row.createCell(13); - - } - richTextString = new XSSFRichTextString(scsl); - cell.setCellValue(richTextString); - - cell = row.getCell(14); - if (cell == null) { - cell = row.createCell(14); - - } - richTextString = new XSSFRichTextString(ssyj); - cell.setCellValue(richTextString); - - cell = row.getCell(15); - if (cell == null) { - cell = row.createCell(15); - } richTextString = new XSSFRichTextString(cksl); cell.setCellValue(richTextString); - cell = row.getCell(16); - if (cell == null) { - cell = row.createCell(16); - - } - richTextString = new XSSFRichTextString(clyj); - cell.setCellValue(richTextString); } } @@ -1541,64 +2090,236 @@ public class ChangeApplyForm extends AbstractRendering { if (!file.exists()) { file.mkdirs(); } + } + + private void changeRevProperty(ChangeOrderBean2 bn) { + String changeType = bn.getChangeType(); + String receiveClassify = bn.getItemLYLX(); + String drawingTo = bn.getHandleOpinion(); + String[] split = drawingTo.split(";"); + List list = null; + if(split!=null&&split.length>0) { + list = Arrays.asList(split); + + } + + if("ƴ-".equals(changeType)) { + changeType = "SJCW"; + }else if("ƴ-©".equals(changeType)) { + changeType = "SJCWLX"; + }else if("ƴ-".equals(changeType)) { + changeType = "SJCWXZ"; + }else if("Ż-ʹ".equals(changeType)){ + changeType = "SJYH"; + }else if("Ż-ת".equals(changeType)){ + changeType = "SJYHBH"; + }else if("Ż-׼".equals(changeType)){ + changeType = "SJYHSJ"; + }else if("ڲ-".equals(changeType)){ + changeType = "NBFAGG"; + }else if("ڲ-©".equals(changeType)){ + changeType = "NBFAGGYL"; + }else if("ڲ-Ż".equals(changeType)){ + changeType = "NBFAGGYH"; + }else if("ڲ-С".equals(changeType)){ + changeType = "NBFAGGBW"; + }else if("ڲ-".equals(changeType)){ + changeType = "NBFAGGXZ"; + }else if("-".equals(changeType)){ + changeType = "FAGG"; + }else if("-©".equals(changeType)){ + changeType = "FAGGYL"; + }else if("-Ż".equals(changeType)){ + changeType = "FAGGYH"; + }else if("-".equals(changeType)){ + changeType = "FAGGXZ"; + }else if("ɹ-ƷƱ".equals(changeType)){ + changeType = "CGGG"; + }else if("ɹ-Ʒű".equals(changeType)){ + changeType = "CGGGPH"; + }else if("ɹ-油".equals(changeType)){ + changeType = "CGGGKC"; + }else if("۸".equals(changeType)){ + changeType = "XSGG"; + }else if("۸-".equals(changeType)){ + changeType = "XSGGBG"; + } + + if("ڲ-".equals(receiveClassify)) { + receiveClassify = "CNZZ"; + }else if("ڲ-FAT".equals(receiveClassify)){ + receiveClassify = "CNFAT"; + }else if("ⲿ-SAT".equals(receiveClassify)){ + receiveClassify = "CWSAT"; + }else if("-".equals(receiveClassify)){ + receiveClassify = "FWBN"; + }else if("-".equals(receiveClassify)){ + receiveClassify = "FWBW"; + } + + String wk = null; + String cg = null; + if(list!=null) { + if(list.contains("")) { + wk = "Yes"; + }else { + wk = "No"; + } + + if(list.contains("ɹ")) { + cg = "Yes"; + }else { + cg = "No"; + } + + }else { + if("".equals(drawingTo)) { + wk = "Yes"; + }else { + wk = "No"; + } + + if("ɹ".equals(drawingTo)) { + cg = "Yes"; + }else { + cg = "No"; + } + } + + TCComponent component = (TCComponent)targetComp; + AIFComponentContext[] whereReferenced; + try { + whereReferenced = component.whereReferenced(); + if(whereReferenced!=null&&whereReferenced.length>0) { + for(AIFComponentContext acc: whereReferenced) { + TCComponent comp =(TCComponent)acc.getComponent(); + if(comp instanceof TCComponentItemRevision) { + TCComponentItemRevision rev = (TCComponentItemRevision)comp; + rev.setStringProperty("t2_ecnchangetype", changeType); + rev.setStringProperty("t2_pickingclassification", receiveClassify); + rev.setStringProperty("t2_wukong", wk); + rev.setStringProperty("t2_caigou", cg); + } + } + } + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } + + + + + // public List getselectTime() { + // List list = new ArrayList(); + // DateBean db = new DateBean(); + // ResultSet r = null; + // Connection con = null; + // PreparedStatement stmt=null; + // String sql = "select * from dfl_changetime"; + // try { + // con = ConnectionFun(); + // stmt=con.prepareStatement(sql); + // + // r=stmt.executeQuery(); + // while(r.next()){ + // db.setDate(r.getString(1)); + // + // list.add(db); + // } + // }catch (SQLException e) { + // e.printStackTrace(); + // }finally{ + // try { + // r.close(); + // stmt.close(); + // con.close(); + // } catch (SQLException e) { + // e.printStackTrace(); + // } + // } + // + // + // return list; + // } + // + // + // + // + // ȡϢ private List getChangeMesg(String id) { List list = new ArrayList(); - ChangeOrderBean bn = new ChangeOrderBean(); + ChangeOrderBean2 bn = new ChangeOrderBean2(); ResultSet r = null; Connection con = null; PreparedStatement stmt = null; - String sql = "select * from DFL_CHANGEFORM where objectCode=?";// + String sql = "select OBJECTCODE,APPLYNAME,APPLYDATE,PROODUCTCODE,PRODUCTTYPE,CLIENTNAME,PRODUCTDEPARTMENT,WAREHOUSECODE,ACCOUNTSET,DUTYDEPARTMENT,DUTYMAN,FORM_MAJOR,LAYOUTINTERFACE," + + "CHANGETYPE,CHANGEINPUTTYPE,PROJECTCODE,CHANGEREASON,PROJECTMODEL,CHANGETAG,RECEIVECLASSIFY,NEEDBUY,PRICEBOOKING,SALSECLASSIFY,CLOSEMAN,REASONDETAIL,HANDLEOPINION,ITEMNEEDDATE,NOTIFYEMERGENCYPROCEDURES,PKEYWORD,MANAGECLASSIFY,KKCODE from DFL_CHANGEFORM where objectCode=?";// try { con = ConnectionFun(); stmt = con.prepareStatement(sql); stmt.setString(1, id); r = stmt.executeQuery(); + String sql1 = "insert into DFL_CHANGEFORM(OBJECTCODE,APPLYNAME,APPLYDATE,PROODUCTCODE,PRODUCTTYPE," + + "CLIENTNAME,PRODUCTDEPARTMENT,WAREHOUSECODE,ACCOUNTSET,DUTYDEPARTMENT,DUTYMAN,FORM_MAJOR,LAYOUTINTERFACE," + + "CHANGETYPE,CHANGEINPUTTYPE,PROJECTCODE,CHANGEREASON,PROJECTMODEL,CHANGETAG,RECEIVECLASSIFY,NEEDBUY," + + "PRICEBOOKING,SALSECLASSIFY,CLOSEMAN,REASONDETAIL,HANDLEOPINION,ITEMNEEDDATE,NOTIFYEMERGENCYPROCEDURES,PKEYWORD,MANAGECLASSIFY,KKCODE)"; while (r.next()) { - bn.setObjectCode(r.getString(1)); - bn.setApplyName(r.getString(2)); + bn.setChangeCode(r.getString(1)); + bn.setApplyman(table1.getValueAt(0, 1).toString()); bn.setApplyDate(r.getString(3)); - bn.setProjectCode(r.getString(4)); - bn.setClientNae(r.getString(5)); - bn.setProductDepartment(r.getString(6)); - bn.setProductName(r.getString(7)); - bn.setProjectModel(r.getString(8)); - bn.setAffectedPart(r.getString(9)); - bn.setChangeType(r.getString(10)); - bn.setProductType(r.getString(11)); - bn.setErrorType(r.getString(12)); - bn.setDutyDepartment(r.getString(13)); - bn.setDutyMan(r.getString(14)); - bn.setChangeReason(r.getString(15)); - bn.setSalseClassify(r.getString(16)); - bn.setPriceBooking(r.getString(17)); - bn.setIsNotProductLoss(r.getString(18)); - bn.setReceiveClassify(r.getString(19)); - bn.setWarehouseCode(r.getString(20)); - bn.setAccountSet(r.getString(21)); - bn.setNotifyEmergencyProcedures(r.getString(22)); - bn.setDrawingTo(r.getString(23)); - bn.setChangeListCode(r.getString(24)); - bn.setTZChangeType(r.getString(25)); - - bn.setSUOSU_ProductDepartment(r.getString(26)); - - bn.setProjectState(r.getString(27)); - + bn.setProductCode(r.getString(4)); + bn.setProductType(r.getString(5)); + bn.setClientName(r.getString(6)); + bn.setProductDepart(r.getString(7)); + bn.setWareHourse(r.getString(9)); + bn.setStorageNum(r.getString(8)); + bn.setDutyMan(r.getString(11)); + bn.setDutyDepartment(r.getString(10)); + bn.setChangeOfMajor(r.getString(12)); + bn.setLayoutInterface(r.getString(13)); + bn.setChangeType(r.getString(14)); + bn.setChangeInputType(r.getString(15)); + bn.setSystemCode(r.getString(16)); + bn.setChangeReason(r.getString(17)); + bn.setProductTypeXh(r.getString(18)); + bn.setChangeTag(r.getString(19)); + bn.setItemLYLX(r.getString(20)); + bn.setNeedBuy(r.getString(21)); + bn.setPricePri(r.getString(22)); + bn.setSaleClass(r.getString(23)); + bn.setCloseMan(r.getString(24)); + bn.setReasonDetail(r.getString(25)); + bn.setHandleOpinion(r.getString(26)); + bn.setItemNeedDate(r.getString(27)); + bn.setDegreeOfurgency(r.getString(28)); + bn.setPkeyword(r.getString(29)); + bn.setManageclassify(r.getString(30)); + bn.setKkcode(r.getString(31)); + list.add(bn); } } catch (SQLException e) { e.printStackTrace(); } finally { try { - r.close(); - stmt.close(); - con.close(); + if(r!=null) { + r.close(); + + + } + if(stmt!=null) { + stmt.close(); + } + if(con!=null) { + con.close(); + } } catch (SQLException e) { e.printStackTrace(); } @@ -1613,41 +2334,45 @@ public class ChangeApplyForm extends AbstractRendering { ResultSet r = null; Connection con = null; PreparedStatement stmt = null; - String sql = "select * from DFL_CHANGEDETAILS where objectCode=?";// + String sql = "select OBJECTCODE,ORDERNUM,PH,PM,YBB,XBB,YSL,XSL,BGSL,GGSM,ITEMSTATE,CLYJ,ZZSL,SCSL,CKSL from DFL_CHANGEDETAILS where objectCode=? order by ORDERNUM asc";// try { con = ConnectionFun(); stmt = con.prepareStatement(sql); stmt.setString(1, id); r = stmt.executeQuery(); while (r.next()) { - ChangeDetils cd = new ChangeDetils(); + ChangeDetails2 cd = new ChangeDetails2(); System.out.println(r.getString(1)); cd.setObjectCode(r.getString(1)); - cd.setPH(r.getString(2)); - cd.setPM(r.getString(3)); - cd.setYBB(r.getString(4)); - cd.setXBB(r.getString(5)); - cd.setYSL(r.getString(6)); - cd.setXSL(r.getString(7)); - cd.setBGSL(r.getString(8)); - cd.setWZPSL(r.getString(9)); - cd.setWZPUJ(r.getString(10)); - cd.setZZSL(r.getString(11)); - cd.setZZYJ(r.getString(12)); - cd.setSCSL(r.getString(13)); - cd.setSSYJ(r.getString(14)); - cd.setCKSL(r.getString(15)); - cd.setCLYJ(r.getString(16)); - cd.setGGSM(r.getString(17)); + cd.setOrder(r.getString(2)); + cd.setItemCode(r.getString(3)); + cd.setItemName(r.getString(4)); + cd.setRevNum(r.getString(5)); + cd.setRevNow(r.getString(6)); + cd.setProtolNum(r.getString(7)); + cd.setNowNum(r.getString(8)); + cd.setChangeNum(r.getString(9)); + cd.setChangeInroduct(r.getString(10)); + cd.setItemState(r.getString(11)); + cd.setHandleOpinion(r.getString(12)); + cd.setProductingNum(r.getString(13)); + cd.setProductNum(r.getString(14)); + cd.setStorageNum(r.getString(15)); list.add(cd); } } catch (SQLException e) { e.printStackTrace(); } finally { try { - r.close(); - stmt.close(); - con.close(); + if(r!=null) { + r.close(); + } + if(stmt!=null) { + stmt.close(); + } + if(con!=null) { + con.close(); + } } catch (SQLException e) { e.printStackTrace(); } @@ -1658,63 +2383,54 @@ public class ChangeApplyForm extends AbstractRendering { public void setValue() { System.out.println(""); - List list = getChangeMesg(name); - System.out.println("list.size==================" + list.size()); + List list = getChangeMesg(masterName); + System.out.println("masterName==============" + masterName); if (list.size() > 0) { - ChangeOrderBean bn = (ChangeOrderBean) list.get(list.size() - 1); + ChangeOrderBean2 bn = (ChangeOrderBean2) list.get(list.size() - 1); - System.out.println(bn.getApplyName()); - table1.setValueAt(bn.getApplyName(), 0, 1); + System.out.println(bn.getChangeCode()); + table1.setValueAt(bn.getApplyman()==null || bn.getApplyman().length()==0?applyname:bn.getApplyman(), 0, 1); + table1.setValueAt(bn.getChangeCode(), 0, 3); table1.setValueAt(bn.getApplyDate(), 0, 5); - table1.setValueAt(bn.getProjectCode(), 8, 1); - table1.setValueAt(bn.getClientNae(), 1, 5); - table1.setValueAt(bn.getProductDepartment(), 3, 1); - table1.setValueAt(bn.getProductName(), 1, 1); - table1.setValueAt(bn.getProjectModel(), 1, 3); - // Ӱ㲿 - table1.setValueAt(bn.getAffectedPart(), 6, 1); - - table1.setValueAt(bn.getChangeType(), 4, 1); - table1.setValueAt(bn.getProductType(), 4, 3); - table1.setValueAt(bn.getErrorType(), 4, 5); - table1.setValueAt(bn.getDutyDepartment(), 3, 3); - table1.setValueAt(bn.getDutyMan(), 3, 5); - table1.setValueAt(bn.getChangeReason(), 9, 1); - table1.setValueAt(bn.getSalseClassify(), 5, 3); - table1.setValueAt(bn.getPriceBooking(), 5, 1); - table1.setValueAt(bn.getIsNotProductLoss(), 5, 5); - table1.setValueAt(bn.getReceiveClassify(), 7, 3); - table1.setValueAt(bn.getWarehouseCode(), 2, 1); - - // - table1.setValueAt(bn.getAccountSet(), 10, 1); - // ̶֪ͨ - table1.setValueAt(bn.getNotifyEmergencyProcedures(), 2, 3); - - table1.setValueAt(bn.getDrawingTo(), 7, 5); - - table1.setValueAt(bn.getChangeListCode(), 0, 3); - table1.setValueAt(bn.getTZChangeType(), 2, 5); - // table1.setValueAt(bn.getSUOSU_ProductDepartment(),6, 1); - table1.setValueAt(bn.getProjectState(), 7, 1); - + table1.setValueAt(bn.getProductCode(), 1, 1); + table1.setValueAt(bn.getProductTypeXh(), 1, 3); + table1.setValueAt(bn.getClientName(), 1, 5); + table1.setValueAt(bn.getProductDepart(), 2, 1); + table1.setValueAt(bn.getStorageNum(), 2, 3); + table1.setValueAt(bn.getWareHourse(), 2, 5); + table1.setValueAt(bn.getDutyDepartment(), 3, 1); + table1.setValueAt(bn.getDutyMan(), 3, 3); + table1.setValueAt(bn.getChangeOfMajor(), 3, 5); + table1.setValueAt(bn.getLayoutInterface(), 4, 1); + table1.setValueAt(bn.getChangeType(), 4, 3); + table1.setValueAt(bn.getChangeInputType(),4, 5); + table1.setValueAt(bn.getSystemCode(), 5, 1); + table1.setValueAt(bn.getChangeReason(), 5, 3); + table1.setValueAt(bn.getProductType(), 5, 5); + table1.setValueAt(bn.getChangeTag(), 6, 1); + table1.setValueAt(bn.getItemLYLX(), 6, 3); + table1.setValueAt(bn.getNeedBuy(), 6, 5); + table1.setValueAt(bn.getPricePri(), 7, 1); + table1.setValueAt(bn.getSaleClass(), 7, 3); + table1.setValueAt(bn.getCloseMan(), 7, 5); + table1.setValueAt(bn.getReasonDetail(), 8, 1); + table1.setValueAt(bn.getHandleOpinion(), 9, 1); + table1.setValueAt(bn.getItemNeedDate(), 9, 3); + table1.setValueAt(bn.getDegreeOfurgency(), 9, 5); + table1.setValueAt(bn.getPkeyword(), 10, 1); + table1.setValueAt(bn.getManageclassify(), 10, 3); + table1.setValueAt(bn.getKkcode(), 10, 5); + // table2 м } - // List listsss = getChangeDetail(name); - // System.out.println(listsss.size()); - // if(listsss.size()>0) { - // // - // } - // } - } // ʱύݿ public void insertMes(ChangeOrderBean bn) { Connection con = null; PreparedStatement stmt = null; - String sql = "insert into DFL_CHANGEFORM values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + String sql = "insert into DFL_CHANGEFORM values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; try { con = ConnectionFun(); stmt = con.prepareStatement(sql); @@ -1754,6 +2470,11 @@ public class ChangeApplyForm extends AbstractRendering { stmt.setString(25, bn.getTZChangeType()); stmt.setString(26, bn.getSUOSU_ProductDepartment()); stmt.setString(27, bn.getProjectState()); + stmt.setString(28, bn.getFormMajor()); + stmt.setString(29, bn.getPkeyword()); + stmt.setString(30, bn.getManageclassify()); + stmt.setString(31, bn.getKkcode()); + stmt.executeUpdate(); System.out.println("ݲݿ"); @@ -1769,37 +2490,52 @@ public class ChangeApplyForm extends AbstractRendering { } } - - /** - * ϸ - */ - - public void insertChangeDetailsMes(ChangeDetils cd) { + + public void insertMes2(ChangeOrderBean2 bn) { Connection con = null; PreparedStatement stmt = null; - String sql = "insert into DFL_CHANGEDETAILS values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + String sql = "insert into DFL_CHANGEFORM(OBJECTCODE,APPLYNAME,APPLYDATE,PROODUCTCODE,PRODUCTTYPE," + + "CLIENTNAME,PRODUCTDEPARTMENT,WAREHOUSECODE,ACCOUNTSET,DUTYDEPARTMENT,DUTYMAN,FORM_MAJOR,LAYOUTINTERFACE," + + "CHANGETYPE,CHANGEINPUTTYPE,PROJECTCODE,CHANGEREASON,PROJECTMODEL,CHANGETAG,RECEIVECLASSIFY,NEEDBUY," + + "PRICEBOOKING,SALSECLASSIFY,CLOSEMAN,REASONDETAIL,HANDLEOPINION,ITEMNEEDDATE,NOTIFYEMERGENCYPROCEDURES,PKEYWORD,MANAGECLASSIFY,KKCODE) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; try { con = ConnectionFun(); stmt = con.prepareStatement(sql); - stmt.setString(1, cd.getObjectCode()); - stmt.setString(2, cd.getPH()); - stmt.setString(3, cd.getPM()); - stmt.setString(4, cd.getYBB()); - stmt.setString(5, cd.getXBB()); - stmt.setString(6, cd.getYSL()); - stmt.setString(7, cd.getXSL()); - stmt.setString(8, cd.getBGSL()); - stmt.setString(9, cd.getWZPSL()); - stmt.setString(10, cd.getWZPUJ()); - stmt.setString(11, cd.getZZSL()); - stmt.setString(12, cd.getZZYJ()); - stmt.setString(13, cd.getSCSL()); - stmt.setString(14, cd.getSSYJ()); - stmt.setString(15, cd.getCKSL()); - stmt.setString(16, cd.getCLYJ()); - stmt.setString(17, cd.getGGSM()); + + stmt.setString(1, bn.getChangeCode()); + stmt.setString(2, bn.getApplyman()); + stmt.setString(3, bn.getApplyDate()); + stmt.setString(4, bn.getProductCode()); + stmt.setString(5, bn.getProductType()); + stmt.setString(6, bn.getClientName()); + stmt.setString(7, bn.getProductDepart()); + stmt.setString(9, bn.getWareHourse()); + stmt.setString(8, bn.getStorageNum()); + stmt.setString(10, bn.getDutyDepartment()); + stmt.setString(11, bn.getDutyMan()); + stmt.setString(12, bn.getChangeOfMajor()); + stmt.setString(13, bn.getLayoutInterface()); + stmt.setString(14, bn.getChangeType()); + stmt.setString(15, bn.getChangeInputType()); + stmt.setString(16, bn.getSystemCode()); + stmt.setString(17, bn.getChangeReason()); + stmt.setString(18, bn.getProductTypeXh()); + stmt.setString(19, bn.getChangeTag()); + stmt.setString(20, bn.getItemLYLX()); + stmt.setString(21, bn.getNeedBuy()); + stmt.setString(22, bn.getPricePri()); + stmt.setString(23, bn.getSaleClass()); + stmt.setString(24, bn.getCloseMan()); + stmt.setString(25, bn.getReasonDetail()); + stmt.setString(26, bn.getHandleOpinion()); + stmt.setString(27, bn.getItemNeedDate()); + stmt.setString(28, bn.getDegreeOfurgency()); + stmt.setString(29, bn.getPkeyword()); + stmt.setString(30, bn.getManageclassify()); + stmt.setString(31, bn.getKkcode()); stmt.executeUpdate(); System.out.println("ݲݿ"); + } catch (Exception ex) { ex.printStackTrace(); } finally { @@ -1813,25 +2549,46 @@ public class ChangeApplyForm extends AbstractRendering { } - // ɾʱ - public void del_date() { + /** + * ϸ + */ + + public void insertChangeDetailsMes(ChangeDetails2 cd) { Connection con = null; - String sql = "delete from dfl_changetime"; - System.out.println(sql); + PreparedStatement stmt = null; + String sql = "insert into DFL_CHANGEDETAILS(OBJECTCODE,ORDERNUM,PH,PM,YBB,XBB,YSL,XSL,BGSL,GGSM,ITEMSTATE,CLYJ,ZZSL,SCSL,CKSL) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; try { con = ConnectionFun(); - PreparedStatement prepStmt = conn.prepareStatement(sql); - prepStmt.executeUpdate(); - System.out.println("ݿɾɹ"); + stmt = con.prepareStatement(sql); + stmt.setString(1, cd.getObjectCode()); + stmt.setString(2, cd.getOrder()); + stmt.setString(3, cd.getItemCode()); + stmt.setString(4, cd.getItemName()); + stmt.setString(5, cd.getRevNum()); + stmt.setString(6, cd.getRevNow()); + stmt.setString(7, cd.getProtolNum()); + stmt.setString(8, cd.getNowNum()); + stmt.setString(9, cd.getChangeNum()); + stmt.setString(10, cd.getChangeInroduct()); + stmt.setString(11, cd.getItemState()); + stmt.setString(12, cd.getHandleOpinion()); + stmt.setString(13, cd.getProductingNum()); + stmt.setString(14, cd.getProductNum()); + stmt.setString(15, cd.getStorageNum()); + System.out.println(sql); + stmt.executeUpdate(); + System.out.println("ݲݿ"); } catch (Exception ex) { ex.printStackTrace(); } finally { try { + stmt.close(); con.close(); } catch (Exception ex) { ex.printStackTrace(); } } + } public void delChangeForm(String id) { @@ -1880,7 +2637,6 @@ public class ChangeApplyForm extends AbstractRendering { } } - } public void delAllChangedetil(String id) { @@ -1908,7 +2664,6 @@ public class ChangeApplyForm extends AbstractRendering { } } - } // ݿǶиö @@ -1956,7 +2711,6 @@ public class ChangeApplyForm extends AbstractRendering { rs = stmt.executeQuery(); while (rs.next()) { i = i + 1; - } } catch (Exception ex) { @@ -2030,18 +2784,18 @@ public class ChangeApplyForm extends AbstractRendering { } } //ݿѯ - private String StockResult (String itemid) { - String Stock = null; - String sql = null; - sql = "select sum(img10) from " +zhangtao + ".img_file where img01='"+itemid+"' and img02='"+cangku+"' and img02<>'Z1' "; - try { - Stock = data.getRecord(sql); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return Stock; + private String StockResult (String itemid) { + String Stock = null; + String sql = null; + sql = "select sum(img10) from " +zhangtao + ".img_file where img01='"+itemid+"' and img02='"+cangku+"' and img02<>'Z1' "; + try { + Stock = data.getRecord(sql); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); } + return Stock; + } /** * ͨѯѯĿ * @@ -2071,4 +2825,5 @@ public class ChangeApplyForm extends AbstractRendering { } } + } diff --git a/src/com/connor/dfl/plm/forms/ChangeDetils.java b/src/com/connor/dfl/plm/forms/ChangeDetils.java index bd9abfe..c3a16ff 100644 --- a/src/com/connor/dfl/plm/forms/ChangeDetils.java +++ b/src/com/connor/dfl/plm/forms/ChangeDetils.java @@ -1,6 +1,6 @@ package com.connor.dfl.plm.forms; -import org.jacorb.idl.runtime.int_token; +//import org.jacorb.idl.runtime.int_token; /** * diff --git a/src/com/connor/dfl/plm/forms/ChangeNotifyForm.java b/src/com/connor/dfl/plm/forms/ChangeNotifyForm.java index c5a7e0a..0ad98e9 100644 --- a/src/com/connor/dfl/plm/forms/ChangeNotifyForm.java +++ b/src/com/connor/dfl/plm/forms/ChangeNotifyForm.java @@ -3,6 +3,7 @@ package com.connor.dfl.plm.forms; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; +import java.awt.Container; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Font; @@ -14,11 +15,18 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.awt.event.WindowEvent; +import java.awt.event.WindowListener; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; +import java.math.BigDecimal; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; @@ -52,6 +60,8 @@ import javax.swing.ScrollPaneConstants; import javax.swing.SwingConstants; import javax.swing.border.LineBorder; import javax.swing.event.CellEditorListener; +import javax.swing.event.TableModelEvent; +import javax.swing.event.TableModelListener; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.DefaultTableModel; import javax.swing.table.JTableHeader; @@ -66,7 +76,7 @@ import org.apache.poi.xssf.usermodel.XSSFRichTextString; 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.dfl044.DataBaseControl2; import com.connor.dfl.plm.table.CTMap; @@ -95,6 +105,7 @@ import com.teamcenter.rac.kernel.TCException; import com.teamcenter.rac.kernel.TCProperty; import com.teamcenter.rac.kernel.TCSession; import com.teamcenter.rac.stylesheet.AbstractRendering; +import com.teamcenter.rac.ui.views.VNSSupport; import com.teamcenter.rac.util.DateButton; import com.teamcenter.rac.util.MessageBox; import com.teamcenter.rac.util.PropertyLayout; @@ -108,10 +119,10 @@ public class ChangeNotifyForm extends AbstractRendering { private InterfaceAIFComponent targetComp = app.getTargetComponent(); private TCComponentItemType itemType; private ChangeNotifyForm selfform; - private DefaultTableCellRenderer tcr; + private TableCellTextAreaRenderer tcr; CTable table1; private MyTable table2; - + private int TEXT_MAX_LENGTH = 500; private JScrollPane scrollPane; private JScrollPane tablePanel2; @@ -132,20 +143,30 @@ public class ChangeNotifyForm extends AbstractRendering { private JButton delButton; private JComboBox ChangeTypeBox;// + private JComboBox changeOfMajorBox;// + private JComboBox manageclassifyBox;// + private JComboBox changeTagBox;//ǩ private JComboBox ProductTypecBox;// Ʒ private JComboBox ErrorTypeBox; private JComboBox DutyDepartmentBox; private JComboBox SalesClassifyBox;// ۷ private JComboBox EmergencyNotifyBox;// ̶֪ͨ private JComboBox ProductDepartmentBox;// Ʒ + private JComboBox dutyDepartBox; // β private JComboBox DrawingChangeTypeBox;// ͼֽ private JComboBox IsNotProductLossBox;// Ƿɱʧ + private JComboBox isNotBuyBox; // ǷҪɹ + private JComboBox isNotLayoutInterfaceBox; //ǷӰ첼ֽӿ + private JComboBox isNotChangeInputTypeBox; // private JComboBox ReceiveClassifyBox;// ϼ÷ private JComboBox WAPYJBox;// δƷ + private JComboBox itemStateBox; //Ͻ׶ private JComboBox ZZYJBox;// private JComboBox SSYJBox;// private JComboBox CLYJBox;// + private JComboBox changeReasonBox; //ԭ private DataBaseControl2 data; + // ʱ public DefaultComboBoxModel jsrBoxModel; @@ -158,10 +179,11 @@ public class ChangeNotifyForm extends AbstractRendering { private String my_item_id; // table2еݣ浽ݿʹ - List changedeList = new ArrayList(); + List changedeList = new ArrayList(); private String applyName;// private String applyDate;// ʱ + private String needDate; private String projectCode;// Ŀ private String clientNae;// ͻ private String productDepartment;// Ʒ @@ -169,25 +191,40 @@ public class ChangeNotifyForm extends AbstractRendering { private String productName;// Ʒ private String projectModel;// Ʒͺ private String affectedPart;// Ӱ豸/㲿 + private String changeOfMajor;// רҵ + //private JComboBox changeOfMajor;// רҵ private String changeType;// private String productType;// Ʒ private String errorType;// private String dutyDepartment;// β private String dutyMan;// + //private String changeOfMajor;// רҵ private String changeReason;// ԭ private String salseClassify;// ۷ private String priceBooking;// ۸Ԥ // private String change;//ϸ private String isNotProductLoss;// ǷƷʧ + private String isNotLayoutInterface; // ǷӰӿڲ + private String isNotChangeInputType; // private String receiveClassify;// ϼ÷ + private String isNotBuy; //ǷҪɹ private String warehouseCode;// private String accountSet;// - private String NotifyEmergencyProcedures;// ֪ͨ + private String NotifyEmergencyProcedures;// ̶֪ͨ + private String pkeyword;//ؼ + private String manageclassify; //ƹ + private String kkcode; //kk private String drawingTo;// ͼֽ private String ChangeListCode;// private String TZChangeType; + private String changeTag; // ǩ private String SUOSU_productdepartment; private String projectState; + private String pricePri; //۸Ԥ + private String closeMan; //۸Ԥ + private String reasonDetail; //ԭ + + private OpenFormDialog lastDialog; public ChangeNotifyForm(TCComponent arg0) throws Exception { super(arg0); @@ -293,12 +330,95 @@ public class ChangeNotifyForm extends AbstractRendering { MessageBox.post("ѡDFL_Form_ChangeTypeδ,ϵԱ!!", "", MessageBox.ERROR); return; } + // + changeOfMajorBox = new JComboBox(); + changeOfMajorBox.addItem("е"); + changeOfMajorBox.addItem(""); + changeOfMajorBox.setSelectedItem("е"); + + + //ƹ + String[] manageclassify_stringArrays = session.getPreferenceService().getStringValues("DFL_manageclassify"); + if (manageclassify_stringArrays == null || manageclassify_stringArrays.length <= 0) { + MessageBox.post("ѡDFL_manageclassifyδ,ϵԱ!!", "", MessageBox.ERROR); + return; + } + manageclassifyBox = new JComboBox(); + for(String manageclassifyString : manageclassify_stringArrays) { + manageclassifyBox.addItem(manageclassifyString); + } + + // ChangeTypeBox = new JComboBox(); for (int change_type_number = 0; change_type_number < change_type_stringArrays.length; change_type_number++) { ChangeTypeBox.addItem(change_type_stringArrays[change_type_number]); } + +ChangeTypeBox.addItemListener(new ItemListener() { + + @Override + public void itemStateChanged(ItemEvent e) { + // TODO Auto-generated method stub + if(e.getStateChange() == ItemEvent.SELECTED) { + System.out.println(e.getItem()); + if(e.getItem().toString().contains("ƴ")) { + changeReasonBox.removeAllItems(); + changeReasonBox.addItem("(ҪBA)"); + changeReasonBox.addItem("©"); + changeReasonBox.addItem("˿"); + changeReasonBox.addItem("Ʋ棩"); + }else if(e.getItem().toString().contains("ڲ")) { + changeReasonBox.removeAllItems(); + changeReasonBox.addItem(""); + changeReasonBox.addItem("Ż"); + changeReasonBox.addItem("λ"); + changeReasonBox.addItem("ӿ"); + changeReasonBox.addItem("С-500Ԫ"); + }else if(e.getItem().toString().contains("Ż")) { + changeReasonBox.removeAllItems(); + changeReasonBox.addItem("ʹ"); + changeReasonBox.addItem("ת"); + changeReasonBox.addItem("׼"); + }else if(e.getItem().toString().contains("ϵͳ")) { + changeReasonBox.removeAllItems(); + changeReasonBox.addItem(""); + changeReasonBox.addItem("Ż"); + changeReasonBox.addItem("С-500Ԫ"); + changeReasonBox.addItem("AӰB"); + }else if(e.getItem().toString().contains("ɹ")) { + changeReasonBox.removeAllItems(); + changeReasonBox.addItem("ڽ"); + changeReasonBox.addItem("Ʒ"); + changeReasonBox.addItem("ERPϢ"); + changeReasonBox.addItem(""); + }else if(e.getItem().toString().contains("۱")) { + changeReasonBox.removeAllItems(); + changeReasonBox.addItem(""); + changeReasonBox.addItem("ͻԭ"); + changeReasonBox.addItem("ԭ򣨱Ŀ"); + changeReasonBox.addItem("ԭ򣨷DZĿ"); + changeReasonBox.addItem("ӳֲ"); + changeReasonBox.addItem("ǩЭ"); + } + } + } + }); + + //ǩ + changeTagBox = new JComboBox(); + changeTagBox.addItem("ͼ"); + changeTagBox.addItem("ظ"); + changeTagBox.addItem("ż"); + changeTagBox.addItem(""); + + //ǩ + changeTagBox = new JComboBox(); + changeTagBox.addItem("ͼ"); + changeTagBox.addItem("ظ"); + changeTagBox.addItem("ż"); + changeTagBox.addItem(""); // ChangeTypeBox.addItem("ƴ"); // ChangeTypeBox.addItem("Ż"); @@ -374,9 +494,6 @@ public class ChangeNotifyForm extends AbstractRendering { // ErrorTypeBox.addItem("ƽ沼ͼ"); // ErrorTypeBox.addItem(""); - // β - DutyDepartmentBox = new JComboBox(); - // ۷ // ۷ @@ -421,6 +538,12 @@ public class ChangeNotifyForm extends AbstractRendering { for (int ProductDepartment_type_number = 0; ProductDepartment_type_number < ProductDepartment_type_stringArrays.length; ProductDepartment_type_number++) { ProductDepartmentBox.addItem(ProductDepartment_type_stringArrays[ProductDepartment_type_number]); } + + DutyDepartmentBox = new JComboBox(); + for (int ProductDepartment_type_number = 0; ProductDepartment_type_number < ProductDepartment_type_stringArrays.length; ProductDepartment_type_number++) { + DutyDepartmentBox.addItem(ProductDepartment_type_stringArrays[ProductDepartment_type_number]); + } + // ͼֽ String[] DrawingChangeType_type_stringArrays = session.getPreferenceService() .getStringValues("DFL_Form_DrawingChangeType"); @@ -448,6 +571,32 @@ public class ChangeNotifyForm extends AbstractRendering { for (int IsNotProductLoss_type_number = 0; IsNotProductLoss_type_number < IsNotProductLoss_type_stringArrays.length; IsNotProductLoss_type_number++) { IsNotProductLossBox.addItem(IsNotProductLoss_type_stringArrays[IsNotProductLoss_type_number]); } + + isNotBuyBox = new JComboBox(); + isNotBuyBox.addItem(""); + isNotBuyBox.addItem(""); + + isNotLayoutInterfaceBox = new JComboBox(); + + isNotLayoutInterfaceBox.addItem(""); + isNotLayoutInterfaceBox.addItem(""); + + isNotChangeInputTypeBox = new JComboBox(); + isNotChangeInputTypeBox.addItem("BOM"); + isNotChangeInputTypeBox.addItem("PID"); + isNotChangeInputTypeBox.addItem("ͼ"); + isNotChangeInputTypeBox.addItem("ͼ"); + isNotChangeInputTypeBox.addItem("ͼ"); + isNotChangeInputTypeBox.addItem("ͼ"); + isNotChangeInputTypeBox.addItem("ͼ"); + isNotChangeInputTypeBox.addItem("Эͼ"); + isNotChangeInputTypeBox.addItem("ͼֽ"); + + changeReasonBox = new JComboBox(); + changeReasonBox.addItem(""); + changeReasonBox.addItem("Ż"); + changeReasonBox.addItem("ͻҪ"); + changeReasonBox.addItem("AӰB"); // ϼ÷ String[] ReceiveClassify_type_stringArrays = session.getPreferenceService() @@ -475,6 +624,12 @@ public class ChangeNotifyForm extends AbstractRendering { WAPYJBox.addItem(WAPYJ_type_stringArrays[WAPYJ_type_number]); } + + itemStateBox = new JComboBox(); + itemStateBox.addItem("δƷ"); + itemStateBox.addItem("Ʒ"); + itemStateBox.addItem("ڿƷ"); + itemStateBox.addItem(""); // String[] ZZYJ_type_stringArrays = session.getPreferenceService() @@ -564,37 +719,52 @@ public class ChangeNotifyForm extends AbstractRendering { System.out.println("objectlength" + applyformlist); if (applyformlist.size() > 0) { - ChangeOrderBean cb = (ChangeOrderBean) applyformlist.get(applyformlist.size() - 1); + ChangeOrderBean2 cb = (ChangeOrderBean2) applyformlist.get(applyformlist.size() - 1); - applyName = cb.getApplyName();// - // applyDate = cb.getApplyDate();//ʱ - projectCode = cb.getProjectCode();// Ŀ - clientNae = cb.getClientNae();// ͻ - productDepartment = cb.getProductDepartment();// Ʒ - // String productCode;//Ʒ - productName = cb.getProductName();// Ʒ - projectModel = cb.getProjectModel();// Ʒͺ - affectedPart = cb.getAffectedPart();// Ӱ豸/㲿 - changeType = cb.getChangeType();// - productType = cb.getProductType();// Ʒ - errorType = cb.getErrorType();// + applyName = cb.getApplyman();// + + applyDate = cb.getApplyDate();//ʱ + ChangeListCode = cb.getChangeCode();// + productType = cb.getProductTypeXh(); //Ʒͺ + clientNae = cb.getClientName();// ͻ + productDepartment = cb.getProductDepart();// Ʒ + warehouseCode = cb.getStorageNum();// + accountSet = cb.getWareHourse();// dutyDepartment = cb.getDutyDepartment();// β dutyMan = cb.getDutyMan();// + changeOfMajor = cb.getChangeOfMajor();//רҵ + pkeyword = cb.getPkeyword(); + manageclassify = cb.getManageclassify(); + kkcode = cb.getKkcode(); + //changeOfMajor.setSelectedItem(cb.getChangeOfMajor()); + + isNotLayoutInterface = cb.getLayoutInterface(); + changeType = cb.getChangeType(); + isNotChangeInputType = cb.getChangeInputType(); + projectCode = cb.getSystemCode();// Ŀ changeReason = cb.getChangeReason();// ԭ - salseClassify = cb.getSalseClassify();// ۷ - priceBooking = cb.getPriceBooking();// ۸Ԥ - // change;//ϸ - isNotProductLoss = cb.getIsNotProductLoss();// ǷƷʧ - receiveClassify = cb.getReceiveClassify();// ϼ÷ - warehouseCode = cb.getWarehouseCode();// - accountSet = cb.getAccountSet();// - NotifyEmergencyProcedures = cb.getNotifyEmergencyProcedures();// ֪ͨ - drawingTo = cb.getDrawingTo();// ͼֽ - ChangeListCode = cb.getChangeListCode();// - TZChangeType = cb.getTZChangeType(); - SUOSU_productdepartment = cb.getSUOSU_ProductDepartment(); - projectState = cb.getProjectState(); - + productType = cb.getProductType();// Ʒ + changeTag = cb.getChangeTag(); // ǩ + receiveClassify = cb.getItemLYLX();// ϼ÷ + isNotBuy = cb.getNeedBuy(); // ǷҪɹ + // String productCode;//Ʒ + priceBooking = cb.getPricePri();// ۸Ԥ + salseClassify = cb.getSaleClass();// ۷ + closeMan = cb.getCloseMan(); //رȷ + reasonDetail = cb.getReasonDetail(); // رȷ + drawingTo = cb.getHandleOpinion();// ͼֽ + needDate = cb.getItemNeedDate();// Ʒ + NotifyEmergencyProcedures = cb.getDegreeOfurgency();// ֪ͨ +// projectModel = cb.getProjectModel();// Ʒͺ +// affectedPart = cb.getAffectedPart();// Ӱ豸/㲿 +// changeType = cb.getChangeType();// +// +// errorType = cb.getErrorType();// + // change;//ϸ +// isNotProductLoss = cb.getIsNotProductLoss();// ǷƷʧ +// TZChangeType = cb.getTZChangeType(); +// SUOSU_productdepartment = cb.getSUOSU_ProductDepartment(); +// projectState = cb.getProjectState(); } } } @@ -623,9 +793,92 @@ public class ChangeNotifyForm extends AbstractRendering { }; model1.combine(new int[] { 8 }, new int[] { 1, 2, 3, 4, 5 }); - model1.combine(new int[] { 9 }, new int[] { 1, 2, 3, 4, 5 }); - model1.combine(new int[] { 10 }, new int[] { 1, 2, 3, 4, 5 }); - model1.combine(new int[] { 6 }, new int[] { 1, 2, 3, 4, 5 }); +// model1.combine(new int[] { 9 }, new int[] { 1, 2, 3, 4, 5 }); +// model1.combine(new int[] { 10 }, new int[] { 1, 2, 3, 4, 5 }); +// model1.combine(new int[] { 6 }, new int[] { 1, 2, 3, 4, 5 }); + model1.addTableModelListener(new TableModelListener() { + + @Override + public void tableChanged(TableModelEvent e) { + e.getFirstRow(); + // TODO Auto-generated method stub + int column = e.getColumn(); + int firstRow = e.getFirstRow(); + System.out.println("("+firstRow+","+column+")"); + + + + // System.out.println("ʮһеڶݱ仯"); + if(table1.getValueAt(10, 1) != null) { + String value = table1.getValueAt(10, 1).toString(); + if(value.length()>10) { + MessageBox.post("ȱС10","ʾ",MessageBox.INFORMATION); + table1.setValueAt("", 10, 1); + return; + } + } + + if(e.getType() == TableModelEvent.UPDATE && column == 1 && firstRow == 2 ){ + System.out.println("wwww"); + String[] stringArray_warehouse = ((TCSession) app.getSession()).getPreferenceService() + .getStringValues("DFL_Form_WarehouseCode"); + String warehouse = ""; + String hourseNum = "01"; + String valueAt = (String)model1.getValueAt(firstRow, column); + if(null == valueAt) { + return; + } + for (int z = 0; z < stringArray_warehouse.length; z++) { + String value = stringArray_warehouse[z]; + String groupn = value.split(":")[0]; + + if (valueAt.contains(groupn)) { + warehouse = value.split(":")[1]; + table1.setValueAt(warehouse, 2, 3); +// table1.setValueAt(hourseNum, 2, 5); + } + } + } + + + + if(column == 1 && firstRow == 1 ) { + + String deviceNumber = (String) table1.getValueAt(column, firstRow); + System.out.println("=>deviceNumber"+deviceNumber); + if(deviceNumber == null || deviceNumber.equals(""))return;//2022/10/27 ECN޷ʾ + if(!deviceNumber.startsWith("0") && !deviceNumber.startsWith("C")) { + MessageBox.post("豸ű0Cͷ","ʾ",MessageBox.INFORMATION); + table1.setValueAt(null, 1, 1); + return; + } + DataBaseControl2 control2 = new DataBaseControl2("oracle.jdbc.driver.OracleDriver", + "jdbc:oracle:thin:@192.168.1.105:1521:ekp", "ekp", "ekp"); + ResultSet dbQuery = control2.dbQuery("select rownum,a.fd_359a8ba984efb6 as 豸,fd_359782e5fc5f3c as 豸ͺ,b.fd_34A888D23094E4 AS ϵͳĿ,b.FD_35EC81852B443A AS ͻ from ekp_17161e29395832d6d388 a left outer join ekp_17161e29394b49a9e97c b on a.fd_parent_id = b.fd_id where a.fd_359a8ba984efb6 = '"+deviceNumber+"' and rownum = 1 union select rownum,a.fd_359a8ba984efb6 as 豸,fd_359782e5fc5f3c as 豸ͺ,b.fd_34A888D23094E4 AS ϵͳĿ,b.FD_35EC81852B443A AS ͻ from ekp_17161e29395832d6d388 a left outer join ekp_17161e29394b49a9e97c b on a.fd_parent_id = b.fd_id where a.fd_359a8ba984efb6 = '"+deviceNumber+"' and rownum = 1"); + try { + while (dbQuery.next()) { + System.out.println(dbQuery.getString(3)); + table1.setValueAt(dbQuery.getString(3), 1, 3); + System.out.println(dbQuery.getString(4)); + table1.setValueAt(dbQuery.getString(4), 5, 1); + System.out.println(dbQuery.getString(5)); + table1.setValueAt(dbQuery.getString(5), 1, 5); + } + } catch (SQLException e1) { + // TODO Auto-generated catch block + control2.closeDataBase(); + e1.printStackTrace(); + } + control2.closeDataBase(); + } + + //޸ĺ󣬱ԭ + if(firstRow == 4 && column == 1) { + table1.setValueAt("", 5, 1); + } + + } + }); table1 = new CTable(model1) { @Override @@ -678,6 +931,9 @@ public class ChangeNotifyForm extends AbstractRendering { } + + + table1.setValueAt("", 0, 0); table1.setValueAt(applyname, 0, 1); @@ -686,17 +942,20 @@ public class ChangeNotifyForm extends AbstractRendering { table1.setValueAt("ʱ", 0, 4); table1.setValueAt(applyDate, 0, 5); + + table1.setValueAt("", 9, 2); + table1.setValueAt(needDate, 9, 3); - table1.setValueAt("Ʒ", 1, 0); - table1.setValueAt(productName, 1, 1); + table1.setValueAt("豸*", 1, 0); +// table1.setValueAt(productName, 1, 1); table1.setValueAt("Ʒͺ", 1, 2); table1.setValueAt(projectModel, 1, 3); - table1.setValueAt("ͻ", 1, 4); + table1.setValueAt("ͻ*", 1, 4); table1.setValueAt(clientNae, 1, 5); - table1.setValueAt("ֿ", 2, 0);// + table1.setValueAt("ֿ", 2, 2);// String[] stringArray_warehouse = ((TCSession) app.getSession()).getPreferenceService() .getStringValues("DFL_Form_WarehouseCode"); @@ -709,67 +968,84 @@ public class ChangeNotifyForm extends AbstractRendering { warehouse = value.split(":")[1]; } } - table1.setValueAt(warehouse, 2, 1); - - // table1.setValueAt(warehouseCode, 2, 1);// + table1.setValueAt(warehouse, 2, 3); - table1.setValueAt("̶֪ͨ", 2, 2); - table1.setValueAt(NotifyEmergencyProcedures, 2, 3); - - table1.setValueAt("ͼֽ", 2, 4); - table1.setValueAt(TZChangeType, 2, 5); + table1.setValueAt("̶֪ͨ", 9, 4); + table1.setValueAt(NotifyEmergencyProcedures, 9, 5); + + table1.setValueAt("ؼ(ʮ)", 10, 0); + table1.setValueAt(pkeyword, 10, 1); + + table1.setValueAt("ƹ", 10, 2); + table1.setValueAt(manageclassify, 10, 3); + + table1.setValueAt("kk", 10, 4); + table1.setValueAt(manageclassify, 10, 5); + + table1.setValueAt("ǩ", 6, 0); + table1.setValueAt(changeTag, 6, 1); + + table1.setValueAt("۸Ԥ(λ:Ԫ)*", 7, 0); + table1.setValueAt(pricePri, 7, 1); + + table1.setValueAt("رȷ", 7, 4); + table1.setValueAt(closeMan, 7, 5); + + table1.setValueAt("ԭ*", 8, 0); + table1.setValueAt(reasonDetail, 8, 1); - table1.setValueAt("Ʒ", 3, 0); + table1.setValueAt("Ʒ*", 2, 0); table1.setValueAt(groupname, 3, 1); - table1.setValueAt("β", 3, 2); - table1.setValueAt(dutyDepartment, 3, 3); - - table1.setValueAt("", 3, 4); - table1.setValueAt(dutyMan, 3, 5); - - table1.setValueAt("", 4, 0); - table1.setValueAt(changeType, 4, 1); - - table1.setValueAt("Ʒ", 4, 2); - table1.setValueAt(productType, 4, 3); - - table1.setValueAt("", 4, 4); - table1.setValueAt(errorType, 4, 5); + table1.setValueAt("β", 3, 0); + table1.setValueAt(dutyDepartment, 3, 1); - table1.setValueAt("۸Ԥ", 5, 0);// - table1.setValueAt(priceBooking, 5, 1);// - - table1.setValueAt("۷", 5, 2); - table1.setValueAt(salseClassify, 5, 3); - - table1.setValueAt("Ƿɱʧ", 5, 4); - table1.setValueAt(isNotProductLoss, 5, 5); + table1.setValueAt("*", 3, 2); + table1.setValueAt(dutyMan, 3, 3); + +// Vector vector = new Vector(); +// vector.add("е"); +// vector.add(""); +// changeOfMajor = new JComboBox(vector); +// + table1.setValueAt("רҵ*", 3, 4); + table1.setValueAt(changeOfMajor, 3, 5); + + table1.setValueAt("ǷӰ첼ֽӿ*", 4, 0); + table1.setValueAt(isNotLayoutInterface, 4, 1); + - // table1.setValueAt("Ʒ", 6, 0);// - // table1.setValueAt(SUOSU_productdepartment, 6, 1);// - // + table1.setValueAt("*", 4, 2); + table1.setValueAt(changeType, 4, 3); - table1.setValueAt("Ӱ豸㲿", 6, 0); - table1.setValueAt(affectedPart, 6, 1); + table1.setValueAt("*", 4, 4); + table1.setValueAt(isNotChangeInputType, 4, 5); + + table1.setValueAt("Ʒ*", 5, 4); + table1.setValueAt(productType, 5, 5); - table1.setValueAt("Ŀ׶", 7, 0); - table1.setValueAt(projectState, 7, 1); + table1.setValueAt("۷", 7, 2); + table1.setValueAt(salseClassify, 7, 3); - table1.setValueAt("ϼ÷", 7, 2); - table1.setValueAt(receiveClassify, 7, 3); + table1.setValueAt("ϼ÷", 6, 2); + table1.setValueAt(receiveClassify, 6, 3) ; + + table1.setValueAt("ǷҪɹ*", 6, 4); + table1.setValueAt(isNotBuy, 6, 5); - table1.setValueAt("ͼֽ", 7, 4); - table1.setValueAt(drawingTo, 7, 5); + table1.setValueAt("ͼֽ", 9, 0); + table1.setValueAt(drawingTo, 9, 1); + + - table1.setValueAt("Ŀ", 8, 0); - table1.setValueAt(projectCode, 8, 1); + table1.setValueAt("Ŀ", 5, 0); + table1.setValueAt(projectCode, 5, 1); - table1.setValueAt("ԭ", 9, 0); - table1.setValueAt(changeReason, 9, 1); + table1.setValueAt("ԭ*", 5, 2); + table1.setValueAt(changeReason, 5, 3); - table1.setValueAt("", 10, 0);// + table1.setValueAt("", 2, 4);// String[] stringArray = ((TCSession) app.getSession()).getPreferenceService() .getStringValues("DFL_Form_AccountSet"); String accountSetValue = ""; @@ -781,7 +1057,7 @@ public class ChangeNotifyForm extends AbstractRendering { accountSetValue = value.split(":")[1]; } } - table1.setValueAt(accountSetValue, 10, 1);// + table1.setValueAt(accountSetValue, 2, 5);// // ʾ JTextField showCalenderButten; @@ -789,11 +1065,15 @@ public class ChangeNotifyForm extends AbstractRendering { setValue(); DateChooser dateChooser2 = DateChooser.getInstance("yyyy-MM-dd HH:mm"); + DateChooser dateChooser3 = DateChooser.getInstance("yyyy-MM-dd"); JTextField showDate1 = new JTextField(applyDate); showDate1.setEditable(false); + JTextField showDate2 = new JTextField(needDate); + showDate2.setEditable(false); dateChooser2.register(showDate1); + dateChooser3.register(showDate2); table1.setCombo(0, 5, new DefaultCellEditor(showDate1)); - + table1.setCombo(9, 3, new DefaultCellEditor(showDate2)); JButton btn = new JButton("ѡĿ"); JButton btn_tzfz = new JButton("ͼֽ"); AddTaskListenerNotify_TZ ant = new AddTaskListenerNotify_TZ(selfform); @@ -805,29 +1085,44 @@ public class ChangeNotifyForm extends AbstractRendering { AccountSetTaskListenerChangeNotify an1 = new AccountSetTaskListenerChangeNotify(this); zt_btn.addActionListener(an1); + //רҵ + table1.setCombo(3, 5, new DefaultCellEditor(changeOfMajorBox)); + + table1.setCombo(10, 3, new DefaultCellEditor(manageclassifyBox)); + // - table1.setCombo(4, 1, new DefaultCellEditor(ChangeTypeBox)); + table1.setCombo(4, 3, new DefaultCellEditor(ChangeTypeBox)); + // ǩ + table1.setCombo(6, 1, new DefaultCellEditor(changeTagBox)); // Ʒ - table1.setCombo(4, 3, new DefaultCellEditor(ProductTypecBox)); + table1.setCombo(5, 5, new DefaultCellEditor(ProductTypecBox)); // - table1.setCombo(4, 5, new DefaultCellEditor(ErrorTypeBox)); +// table1.setCombo(4, 5, new DefaultCellEditor(ErrorTypeBox)); // ۷ - table1.setCombo(5, 3, new DefaultCellEditor(SalesClassifyBox)); + table1.setCombo(7, 3, new DefaultCellEditor(SalesClassifyBox)); // β - // table1.setCombo(3,3,new DefaultCellEditor(DutyDepartmentBox)); + table1.setCombo(3,1,new DefaultCellEditor(DutyDepartmentBox)); // ̶֪ͨ - table1.setCombo(2, 3, new DefaultCellEditor(EmergencyNotifyBox)); + table1.setCombo(9, 5, new DefaultCellEditor(EmergencyNotifyBox)); // ʱ // table1.setCombo(0,5,new DefaultCellEditor(datetime)); // Ʒ - table1.setCombo(3, 1, new DefaultCellEditor(ProductDepartmentBox)); + table1.setCombo(2, 1, new DefaultCellEditor(ProductDepartmentBox)); // ͼֽ - table1.setCombo(2, 5, new DefaultCellEditor(DrawingChangeTypeBox)); +// table1.setCombo(2, 5, new DefaultCellEditor(DrawingChangeTypeBox)); // Ƿɱʧ - table1.setCombo(5, 5, new DefaultCellEditor(IsNotProductLossBox)); +// table1.setCombo(5, 5, new DefaultCellEditor(IsNotProductLossBox)); + //ǷҪɹ + table1.setCombo(6, 5, new DefaultCellEditor(isNotBuyBox)); + //ǷӰ첼ֽӿ + table1.setCombo(4, 1, new DefaultCellEditor(isNotLayoutInterfaceBox)); + // + table1.setCombo(4, 5, new DefaultCellEditor(isNotChangeInputTypeBox)); + //ԭ + table1.setCombo(5, 3, new DefaultCellEditor(changeReasonBox)); // ϼ÷ - table1.setCombo(7, 3, new DefaultCellEditor(ReceiveClassifyBox)); + table1.setCombo(6, 3, new DefaultCellEditor(ReceiveClassifyBox)); // table1.setCombo(8, 1, new DefaultCellEditor(projectCode)); @@ -841,9 +1136,10 @@ public class ChangeNotifyForm extends AbstractRendering { table1.setRowHeight(50); table1.setRowHeight(9, 100); table1.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); - - model2 = new DefaultTableModel(null, new String[] { "", "Ʒ", "Ʒ", "ԭ汾", "ְ汾", "ԭ", "", "", - "˵", "δƷ", "δƷ", "", "", "", "", "ֿ", "" }) { +// { "", "Ʒ", "Ʒ", "ԭ汾", "ְ汾", "ԭ", "", "", +// "˵", "δƷ", "δƷ", "", "", "", "", "ֿ", "" } + model2 = new DefaultTableModel(null, new String[] { "", "Ʒ", "Ʒ", "汾", "ԭ", "", "", + "˵", "Ͻ׶", "", "", "", "ֿ" }) { public void setValueAt(Object value, int row, int col) { try { @@ -879,13 +1175,17 @@ public class ChangeNotifyForm extends AbstractRendering { table2.setValueAt(objectname, table2.getSelectedRow(), 2); table2.setComboCell(table2.getSelectedRow(), 3, new com.connor.dfl.plm.table.MyComboBoxEditor2(rev)); - table2.setComboCell(table2.getSelectedRow(), 4, - new com.connor.dfl.plm.table.MyComboBoxEditor2(rev)); - table2.setComboCell(table2.getSelectedRow(), 10, new DefaultCellEditor(WAPYJBox)); - table2.setComboCell(table2.getSelectedRow(), 12, new DefaultCellEditor(ZZYJBox)); - table2.setComboCell(table2.getSelectedRow(), 14, new DefaultCellEditor(SSYJBox)); - table2.setValueAt(kucun, table2.getSelectedRow(), 15); - table2.setComboCell(table2.getSelectedRow(), 16, new DefaultCellEditor(CLYJBox)); +// table2.setComboCell(table2.getSelectedRow(), 4, +// new com.connor.dfl.plm.table.MyComboBoxEditor2(rev)); + TextAreaCellEditor textAreaCellEditor = new TextAreaCellEditor(TEXT_MAX_LENGTH); + addMyKeyListener(textAreaCellEditor,table2); + table2.setComboCell(table2.getSelectedRow(), 7, textAreaCellEditor); + table2.setComboCell(table2.getSelectedRow(), 8, new DefaultCellEditor(itemStateBox)); +// table2.setComboCell(table2.getSelectedRow(), 10, new DefaultCellEditor(WAPYJBox)); +// table2.setComboCell(table2.getSelectedRow(), 12, new DefaultCellEditor(ZZYJBox)); +// table2.setComboCell(table2.getSelectedRow(), 14, new DefaultCellEditor(SSYJBox)); +// table2.setValueAt(kucun, table2.getSelectedRow(), 15); + table2.setComboCell(table2.getSelectedRow(), 9, new DefaultCellEditor(CLYJBox)); } else { javax.swing.JOptionPane.showMessageDialog(null, "ƷƷдûа汾", "ϵͳʾ", @@ -909,25 +1209,91 @@ public class ChangeNotifyForm extends AbstractRendering { table2 = new MyTable() { @Override public boolean isCellEditable(int row, int column) { - if (column == 0) { + if (column == 0 || column == 6) { return false; } return true; } }; - + model2.addTableModelListener(new TableModelListener() { + + @Override + public void tableChanged(TableModelEvent e) { + // TODO Auto-generated method stub + int column = e.getColumn(); + int firstRow = e.getFirstRow(); + System.out.println("("+firstRow+","+column+")"); + int selectedRow = table2.getSelectedRow(); + System.out.println("selectedRow = "+selectedRow); + + if( column == 4) { + if(table2.getValueAt(firstRow, column)!=null && table2.getValueAt(firstRow, column+1)!=null) { + try { + + Float ysl = Float.parseFloat(((String) table2.getValueAt(firstRow, column))); + Float xsl = Float.parseFloat(((String) table2.getValueAt(firstRow, column+1))); +// int ysl = Integer.parseInt(((String) table2.getValueAt(firstRow, column))); +// int xsl = Integer.parseInt(((String) table2.getValueAt(firstRow, column+1))); + BigDecimal b1 = new BigDecimal(ysl.toString()); + + + BigDecimal b2 = new BigDecimal(xsl.toString()); + + float ss = b2.subtract(b1).floatValue(); + + table2.setValueAt(ss, firstRow, column+2); + } catch (Exception e2) { + // TODO: handle exception + e2.printStackTrace(); + MessageBox.post("!","",MessageBox.ERROR); + } + } + }else if(column == 5) { + if(table2.getValueAt(firstRow, column)!=null && table2.getValueAt(firstRow, column-1)!=null) { + try { +// int ysl = Integer.parseInt(((String) table2.getValueAt(firstRow, column-1))); +// int xsl = Integer.parseInt(((String) table2.getValueAt(firstRow, column))); + Float ysl = Float.parseFloat(((String) table2.getValueAt(firstRow, column-1))); + Float xsl = Float.parseFloat(((String) table2.getValueAt(firstRow, column))); + BigDecimal b1 = new BigDecimal(ysl.toString()); + + + BigDecimal b2 = new BigDecimal(xsl.toString()); + + float ss = b2.subtract(b1).floatValue(); + table2.setValueAt(ss, firstRow, column+1); + } catch (Exception e2) { + // TODO: handle exception + e2.printStackTrace(); + MessageBox.post("!","",MessageBox.ERROR); + } + } + } +// else if(column == 7) { +// String string = table2.getValueAt(selectedRow, column).toString(); +// if(string!=null) { +// int length = string.length(); +// int height = (length%15==0?length/15:length/15+1)*30+20; +// table2.setRowHeight(selectedRow, height); +// System.out.println("õ"+selectedRow+"иΪ"+height); +// } +// } + + + } + }); table2.setModel(model2); - table2.setColumnModel(getColumn(table2, new int[] { 60, 150, 260, 70,70,70,70, 70,260, 90,90,70,70, 70, 70,70,150})); - table2.setRowHeight(50); - tcr = new DefaultTableCellRenderer(); - tcr.setHorizontalAlignment(SwingConstants.CENTER); + tcr = new TableCellTextAreaRenderer(TEXT_MAX_LENGTH); +// tcr.setHorizontalAlignment(SwingConstants.CENTER); table1.setBorder(new LineBorder(Color.BLACK)); table1.setDefaultRenderer(Object.class, tcr); table2.setBorder(new LineBorder(Color.BLACK)); table2.setDefaultRenderer(Object.class, tcr); table2.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + table2.setColumnModel(getColumn(table2, new int[] { 60, 150, 260,70,70,70, 70,260, 90,90,70,70})); + table2.setRowHeight(50); addButton = new JButton(" "); delButton = new JButton(" ɾ "); @@ -943,43 +1309,46 @@ public class ChangeNotifyForm extends AbstractRendering { // for(int j =0 ;j 6) { int count = rows1 - 6; @@ -1150,7 +1519,7 @@ public class ChangeNotifyForm extends AbstractRendering { mainPanel.add(rootPanel, BorderLayout.NORTH); mainPanel.add(test, BorderLayout.CENTER); - this.setSize(1600, 1300); + this.setSize(1600, 800); // this.setPreferredSize(new Dimension(1600,1000)); this.setLayout(new BorderLayout()); @@ -1209,83 +1578,248 @@ public class ChangeNotifyForm extends AbstractRendering { } }); this.setVisible(true); + // + new Thread(new Runnable() { + @Override + public void run() { + // TODO Auto-generated method stub + do { + + if(ChangeNotifyForm.this.getParent()!=null)break; + else + try { + Thread.sleep(100); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + }while(true); + String tempstr = ChangeNotifyForm.this.getParent().getParent().getParent().getParent().getParent()!=null?ChangeNotifyForm.this.getParent().getParent().getParent().getParent().getParent().getClass().toString():""; + + if(!"".equals(tempstr)) { + System.out.println("tempstr:"+tempstr); + if(tempstr.equals("class com.teamcenter.rac.commands.open.OpenFormDialog")) { + lastDialog = (OpenFormDialog) ChangeNotifyForm.this.getParent().getParent().getParent().getParent().getParent(); + Container container = ChangeNotifyForm.this.getParent().getParent().getParent().getParent(); + final JFrame frame = new JFrame(); + frame.add(container); + frame.pack(); + frame.setVisible(true); + lastDialog.setVisible(false); + lastDialog.addWindowListener(new WindowListener() { + + @Override + public void windowOpened(WindowEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void windowIconified(WindowEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void windowDeiconified(WindowEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void windowDeactivated(WindowEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void windowClosing(WindowEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void windowClosed(WindowEvent e) { + // TODO Auto-generated method stub + System.out.println("ڹر"); + frame.dispose(); + } + + @Override + public void windowActivated(WindowEvent e) { + // TODO Auto-generated method stub + + } + }); + } +// else if(tempstr.equals("class javax.swing.JFrame")) { +// JFrame frame = (JFrame) QuickChangeForm.this.getParent().getParent().getParent().getParent().getParent(); +// Container container = QuickChangeForm.this.getParent().getParent().getParent().getParent(); +// lastDialog.add(container); +// frame.dispose(); +// } + } + } + }).start(); + } + + private void addMyKeyListener(TextAreaCellEditor editor,JTable table) { + editor.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 + + } + + @Override + public void keyPressed(KeyEvent e) { + // TODO Auto-generated method stub + char keyChar = e.getKeyChar(); + if(keyChar == KeyEvent.VK_ENTER) { + (table2.getCellEditor(table2.getSelectedRow(), table2.getSelectedColumn())).stopCellEditing(); + } + } + }); } @Override public void saveRendering() { - if(model1.getValueAt(0, 5)==null||model1.getValueAt(4, 1)==null) { - MessageBox.post("ʱΪ","",MessageBox.ERROR); + + if("ⲿ-SAT".equals(receiveClassify) || "-".equals(receiveClassify) || "-".equals(receiveClassify)) { + Object valueAt = model1.getValueAt(10, 5); + if(valueAt == null || "".equals(valueAt)) { + MessageBox.post("kkű","",MessageBox.ERROR); + return; + } + } + + if(model1.getValueAt(0, 5)==null|| model1.getValueAt(1, 3)==null || model1.getValueAt(1, 5)==null + || model1.getValueAt(5, 5)==null || model1.getValueAt(7, 1)==null || model1.getValueAt(7, 3)==null || model1.getValueAt(8, 1)==null) { + MessageBox.post("ʱ䡢ƷͺšͻơƷ͡۸Ԥ۷ࡢԭΪ","",MessageBox.ERROR); } delChangeForm(masterName); - ChangeOrderBean bn = new ChangeOrderBean(); - bn.setObjectCode(masterName); - bn.setApplyName(model1.getValueAt(0, 1) == null ? "" : model1.getValueAt(0, 1).toString()); + ChangeOrderBean2 bn = new ChangeOrderBean2(); + bn.setApplyman(applyname); + bn.setChangeCode(masterName); bn.setApplyDate(model1.getValueAt(0, 5) == null ? "" : model1.getValueAt(0, 5).toString()); - bn.setProjectCode(model1.getValueAt(8, 1) == null ? "" : model1.getValueAt(8, 1).toString()); - bn.setClientNae(model1.getValueAt(1, 5) == null ? "" : model1.getValueAt(1, 5).toString()); - bn.setProductDepartment(model1.getValueAt(3, 1) == null ? "" : model1.getValueAt(3, 1).toString()); - bn.setProductName(model1.getValueAt(1, 1) == null ? "" : model1.getValueAt(1, 1).toString()); - bn.setProjectModel(model1.getValueAt(1, 3) == null ? "" : model1.getValueAt(1, 3).toString()); - // Ӱ豸 - bn.setAffectedPart(model1.getValueAt(6, 1) == null ? "" : model1.getValueAt(6, 1).toString()); - - bn.setChangeType(model1.getValueAt(4, 1) == null ? "" : model1.getValueAt(4, 1).toString()); - bn.setProductType(model1.getValueAt(4, 3) == null ? "" : model1.getValueAt(4, 3).toString()); - bn.setErrorType(model1.getValueAt(4, 5) == null ? "" : model1.getValueAt(4, 5).toString()); - bn.setDutyDepartment(model1.getValueAt(3, 3) == null ? "" : model1.getValueAt(3, 3).toString()); - bn.setDutyMan(model1.getValueAt(3, 5) == null ? "" : model1.getValueAt(3, 5).toString()); - // ԭ - bn.setChangeReason(model1.getValueAt(9, 1) == null ? "" : model1.getValueAt(9, 1).toString()); - - bn.setSalseClassify(model1.getValueAt(5, 3) == null ? "" : model1.getValueAt(5, 3).toString()); - bn.setPriceBooking(model1.getValueAt(5, 1) == null ? "" : model1.getValueAt(5, 1).toString()); - bn.setIsNotProductLoss(model1.getValueAt(5, 5) == null ? "" : model1.getValueAt(5, 5).toString()); - bn.setReceiveClassify(model1.getValueAt(7, 3) == null ? "" : model1.getValueAt(7, 3).toString()); - bn.setWarehouseCode(model1.getValueAt(2, 1) == null ? "" : model1.getValueAt(2, 1).toString()); - // ̶֪ͨ - bn.setNotifyEmergencyProcedures(model1.getValueAt(2, 3) == null ? "" : model1.getValueAt(2, 3).toString()); - - bn.setDrawingTo(model1.getValueAt(7, 5) == null ? "" : model1.getValueAt(7, 5).toString()); - - bn.setChangeListCode(model1.getValueAt(0, 3) == null ? "" : model1.getValueAt(0, 3).toString()); - bn.setTZChangeType(model1.getValueAt(2, 5) == null ? "" : model1.getValueAt(2, 5).toString()); - - bn.setSUOSU_ProductDepartment(""); - // model1.getValueAt(6, 1) == null ? "" :model1.getValueAt(6, 1).toString() - - // ˾ - bn.setAccountSet(model1.getValueAt(10, 1) == null ? "" : model1.getValueAt(10, 1).toString()); - - bn.setProjectState(model1.getValueAt(7, 1) == null ? "" : model1.getValueAt(7, 1).toString()); - insertMes(bn); + bn.setProductCode(model1.getValueAt(1, 1) == null ? "" : model1.getValueAt(1, 1).toString()); + bn.setProductTypeXh(model1.getValueAt(1, 3) == null ? "" : model1.getValueAt(1, 3).toString()); + bn.setClientName(model1.getValueAt(1, 5) == null ? "" : model1.getValueAt(1, 5).toString()); + bn.setProductDepart(model1.getValueAt(2, 1) == null ? "" : model1.getValueAt(2, 1).toString()); + bn.setStorageNum(model1.getValueAt(2, 3) == null ? "" : model1.getValueAt(2, 3).toString()); + bn.setWareHourse(model1.getValueAt(2, 5) == null ? "" : model1.getValueAt(2, 5).toString()); + bn.setDutyDepartment(model1.getValueAt(3, 1) == null ? "" : model1.getValueAt(3, 1).toString()); + bn.setDutyMan(model1.getValueAt(3, 3) == null ? "" : model1.getValueAt(3, 3).toString()); + bn.setChangeOfMajor(model1.getValueAt(3, 5) == null ? "" : model1.getValueAt(3, 5).toString()); + bn.setLayoutInterface(model1.getValueAt(4, 1) == null ? "" : model1.getValueAt(4, 1).toString()); + bn.setChangeType(model1.getValueAt(4, 3) == null ? "" : model1.getValueAt(4, 3).toString()); + bn.setChangeInputType(model1.getValueAt(4, 5) == null ? "" : model1.getValueAt(4, 5).toString()); + bn.setSystemCode(model1.getValueAt(5, 1) == null ? "" : model1.getValueAt(5, 1).toString()); + bn.setChangeReason(model1.getValueAt(5, 3) == null ? "" : model1.getValueAt(5, 3).toString()); + bn.setProductType(model1.getValueAt(5, 5) == null ? "" : model1.getValueAt(5, 5).toString()); + bn.setChangeTag(model1.getValueAt(6, 1) == null ? "" : model1.getValueAt(6, 1).toString()); + bn.setItemLYLX(model1.getValueAt(6, 3) == null ? "" : model1.getValueAt(6, 3).toString()); + bn.setNeedBuy(model1.getValueAt(6, 5) == null ? "" : model1.getValueAt(6, 5).toString()); + bn.setPricePri(model1.getValueAt(7, 1) == null ? "" : model1.getValueAt(7, 1).toString()); + bn.setSaleClass(model1.getValueAt(7, 3) == null ? "" : model1.getValueAt(7, 3).toString()); + bn.setCloseMan(model1.getValueAt(7, 5) == null ? "" : model1.getValueAt(7, 5).toString()); + bn.setReasonDetail(model1.getValueAt(8, 1) == null ? "" : model1.getValueAt(8, 1).toString()); + bn.setHandleOpinion(model1.getValueAt(9, 1) == null ? "" : model1.getValueAt(9, 1).toString()); + bn.setItemNeedDate(model1.getValueAt(9, 3) == null ? "" : model1.getValueAt(9, 3).toString()); + bn.setDegreeOfurgency(model1.getValueAt(9, 5) == null ? "" : model1.getValueAt(9, 5).toString()); + bn.setPkeyword(model1.getValueAt(10, 1) == null ? "" : model1.getValueAt(10, 1).toString()); + bn.setManageclassify(model1.getValueAt(10, 3) == null ? "" : model1.getValueAt(10, 3).toString()); + bn.setKkcode(model1.getValueAt(10, 5) == null ? "" : model1.getValueAt(10, 5).toString()); + +// bn.setApplyName(model1.getValueAt(0, 1) == null ? "" : model1.getValueAt(0, 1).toString()); +// bn.setApplyDate(model1.getValueAt(0, 5) == null ? "" : model1.getValueAt(0, 5).toString()); +// bn.setProjectCode(model1.getValueAt(4, 5) == null ? "" : model1.getValueAt(4, 5).toString()); +// bn.setClientNae(model1.getValueAt(1, 5) == null ? "" : model1.getValueAt(1, 5).toString()); +// bn.setProductDepartment(model1.getValueAt(2, 1) == null ? "" : model1.getValueAt(2, 1).toString()); +//// bn.setProductName(model1.getValueAt(1, 1) == null ? "" : model1.getValueAt(1, 1).toString()); +// bn.setProjectModel(model1.getValueAt(1, 3) == null ? "" : model1.getValueAt(1, 3).toString()); +// // Ӱ豸 +// bn.setAffectedPart(model1.getValueAt(6, 1) == null ? "" : model1.getValueAt(6, 1).toString()); +// +// bn.setChangeType(model1.getValueAt(4, 1) == null ? "" : model1.getValueAt(4, 1).toString()); +// bn.setProductType(model1.getValueAt(4, 3) == null ? "" : model1.getValueAt(4, 3).toString()); +// bn.setErrorType(model1.getValueAt(4, 5) == null ? "" : model1.getValueAt(4, 5).toString()); +// bn.setDutyDepartment(model1.getValueAt(3, 3) == null ? "" : model1.getValueAt(3, 3).toString()); +// bn.setDutyMan(model1.getValueAt(3, 5) == null ? "" : model1.getValueAt(3, 5).toString()); +// // ԭ +// bn.setChangeReason(model1.getValueAt(9, 1) == null ? "" : model1.getValueAt(9, 1).toString()); +// +// bn.setSalseClassify(model1.getValueAt(5, 3) == null ? "" : model1.getValueAt(5, 3).toString()); +// bn.setPriceBooking(model1.getValueAt(5, 1) == null ? "" : model1.getValueAt(5, 1).toString()); +// bn.setIsNotProductLoss(model1.getValueAt(5, 5) == null ? "" : model1.getValueAt(5, 5).toString()); +// bn.setReceiveClassify(model1.getValueAt(7, 3) == null ? "" : model1.getValueAt(7, 3).toString()); +// bn.setWarehouseCode(model1.getValueAt(2, 1) == null ? "" : model1.getValueAt(2, 1).toString()); +// // ̶֪ͨ +// bn.setNotifyEmergencyProcedures(model1.getValueAt(2, 3) == null ? "" : model1.getValueAt(2, 3).toString()); +// +// bn.setDrawingTo(model1.getValueAt(7, 5) == null ? "" : model1.getValueAt(7, 5).toString()); +// +// bn.setChangeListCode(model1.getValueAt(0, 3) == null ? "" : model1.getValueAt(0, 3).toString()); +// bn.setTZChangeType(model1.getValueAt(2, 5) == null ? "" : model1.getValueAt(2, 5).toString()); +// +// bn.setSUOSU_ProductDepartment(""); +// // model1.getValueAt(6, 1) == null ? "" :model1.getValueAt(6, 1).toString() +// +// // ˾ +// bn.setAccountSet(model1.getValueAt(10, 1) == null ? "" : model1.getValueAt(10, 1).toString()); +// +// bn.setProjectState(model1.getValueAt(7, 1) == null ? "" : model1.getValueAt(7, 1).toString()); + insertMes2(bn); // =================================================================== delAllChangedetil(masterName); for (int cdss = 0; cdss < table2.getRowCount(); cdss++) { - changedeList.add(new ChangeDetils()); + changedeList.add(new ChangeDetails2()); } List changedetials = new ArrayList(); // for (int k = 0; k < table2.getRowCount(); k++) { ChangeDetils cds = new ChangeDetils(); changedeList.get(k).setObjectCode(masterName); - changedeList.get(k).setPH(model2.getValueAt(k, 1) == null ? "" : model2.getValueAt(k, 1).toString()); - changedeList.get(k).setPM(model2.getValueAt(k, 2) == null ? "" : model2.getValueAt(k, 2).toString()); - changedeList.get(k).setYBB(model2.getValueAt(k, 3) == null ? "" : model2.getValueAt(k, 3).toString()); - changedeList.get(k).setXBB(model2.getValueAt(k, 4) == null ? "" : model2.getValueAt(k, 4).toString()); - changedeList.get(k).setYSL(model2.getValueAt(k, 5) == null ? "" : model2.getValueAt(k, 5).toString()); - changedeList.get(k).setXSL(model2.getValueAt(k, 6) == null ? "" : model2.getValueAt(k, 6).toString()); - changedeList.get(k).setBGSL(model2.getValueAt(k, 7) == null ? "" : model2.getValueAt(k, 7).toString()); - changedeList.get(k).setGGSM(model2.getValueAt(k, 8) == null ? "" : model2.getValueAt(k, 8).toString()); - changedeList.get(k).setWZPSL(model2.getValueAt(k, 9) == null ? "" : model2.getValueAt(k, 9).toString()); - changedeList.get(k).setWZPUJ(model2.getValueAt(k, 10) == null ? "" : model2.getValueAt(k, 10).toString()); - changedeList.get(k).setZZSL(model2.getValueAt(k, 11) == null ? "" : model2.getValueAt(k, 11).toString()); - changedeList.get(k).setZZYJ(model2.getValueAt(k, 12) == null ? "" : model2.getValueAt(k, 12).toString()); - changedeList.get(k).setSCSL(model2.getValueAt(k, 13) == null ? "" : model2.getValueAt(k, 13).toString()); - changedeList.get(k).setSSYJ(model2.getValueAt(k, 14) == null ? "" : model2.getValueAt(k, 14).toString()); - changedeList.get(k).setCKSL(model2.getValueAt(k, 15) == null ? "" : model2.getValueAt(k, 15).toString()); - changedeList.get(k).setCLYJ(model2.getValueAt(k, 16) == null ? "" : model2.getValueAt(k, 16).toString()); + changedeList.get(k).setOrder(model2.getValueAt(k, 0) == null ? "" : model2.getValueAt(k, 0).toString()); + changedeList.get(k).setItemCode(model2.getValueAt(k, 1) == null ? "" : model2.getValueAt(k, 1).toString()); + changedeList.get(k).setItemName(model2.getValueAt(k, 2) == null ? "" : model2.getValueAt(k, 2).toString()); + changedeList.get(k).setRevNum(model2.getValueAt(k, 3) == null ? "" : model2.getValueAt(k, 3).toString()); +// changedeList.get(k).setRevNow(model2.getValueAt(k, 4) == null ? "" : model2.getValueAt(k, 4).toString()); + changedeList.get(k).setProtolNum(model2.getValueAt(k, 4) == null ? "" : model2.getValueAt(k, 4).toString()); + changedeList.get(k).setNowNum(model2.getValueAt(k, 5) == null ? "" : model2.getValueAt(k, 5).toString()); + changedeList.get(k).setChangeNum(model2.getValueAt(k, 6) == null ? "" : model2.getValueAt(k, 6).toString()); + changedeList.get(k).setChangeInroduct(model2.getValueAt(k, 7) == null ? "" : model2.getValueAt(k, 7).toString()); + changedeList.get(k).setItemState(model2.getValueAt(k, 8) == null ? "" : model2.getValueAt(k, 8).toString()); + changedeList.get(k).setHandleOpinion(model2.getValueAt(k, 9) == null ? "" : model2.getValueAt(k, 9).toString()); + changedeList.get(k).setProductingNum(model2.getValueAt(k, 10) == null ? "" : model2.getValueAt(k, 10).toString()); + changedeList.get(k).setProductNum(model2.getValueAt(k, 11) == null ? "" : model2.getValueAt(k, 11).toString()); + changedeList.get(k).setStorageNum(model2.getValueAt(k, 12) == null ? "" : model2.getValueAt(k, 12).toString()); + +// changedeList.get(k).setPH(model2.getValueAt(k, 1) == null ? "" : model2.getValueAt(k, 1).toString()); +// changedeList.get(k).setPM(model2.getValueAt(k, 2) == null ? "" : model2.getValueAt(k, 2).toString()); +// changedeList.get(k).setYBB(model2.getValueAt(k, 3) == null ? "" : model2.getValueAt(k, 3).toString()); +// changedeList.get(k).setXBB(model2.getValueAt(k, 4) == null ? "" : model2.getValueAt(k, 4).toString()); +// changedeList.get(k).setYSL(model2.getValueAt(k, 5) == null ? "" : model2.getValueAt(k, 5).toString()); +// changedeList.get(k).setXSL(model2.getValueAt(k, 6) == null ? "" : model2.getValueAt(k, 6).toString()); +// changedeList.get(k).setBGSL(model2.getValueAt(k, 7) == null ? "" : model2.getValueAt(k, 7).toString()); +// changedeList.get(k).setGGSM(model2.getValueAt(k, 8) == null ? "" : model2.getValueAt(k, 8).toString()); +// changedeList.get(k).setWZPSL(model2.getValueAt(k, 9) == null ? "" : model2.getValueAt(k, 9).toString()); +// changedeList.get(k).setWZPUJ(model2.getValueAt(k, 10) == null ? "" : model2.getValueAt(k, 10).toString()); +// changedeList.get(k).setZZSL(model2.getValueAt(k, 11) == null ? "" : model2.getValueAt(k, 11).toString()); +// changedeList.get(k).setZZYJ(model2.getValueAt(k, 12) == null ? "" : model2.getValueAt(k, 12).toString()); +// changedeList.get(k).setSCSL(model2.getValueAt(k, 13) == null ? "" : model2.getValueAt(k, 13).toString()); +// changedeList.get(k).setSSYJ(model2.getValueAt(k, 14) == null ? "" : model2.getValueAt(k, 14).toString()); +// changedeList.get(k).setCKSL(model2.getValueAt(k, 15) == null ? "" : model2.getValueAt(k, 15).toString()); +// changedeList.get(k).setCLYJ(model2.getValueAt(k, 16) == null ? "" : model2.getValueAt(k, 16).toString()); changedetials.add(changedeList.get(k)); } @@ -1328,9 +1862,9 @@ public class ChangeNotifyForm extends AbstractRendering { for(TCComponent comp2:referenceListProperty) { if(comp2 instanceof TCComponentDataset) { TCComponentDataset ds = (TCComponentDataset)comp2; - if(ds.getStringProperty("object_name").equals(masterName+"-"+objname)) { +// if(ds.getStringProperty("object_name").equals(masterName+"-"+objname)) { ds.setFiles(as1, as2); - } +// } } } }else { @@ -1404,8 +1938,8 @@ public class ChangeNotifyForm extends AbstractRendering { * @throws FileNotFoundException * @author xinhy */ - private void create(String filepath, String filename, List changeMesg, - List changeDetils, String model) throws IOException, FileNotFoundException { + private void create(String filepath, String filename, List changeMesg, + List changeDetils, String model) throws IOException, FileNotFoundException { // ļģ InputStream modeFile = ChangeNotifyForm.class.getResourceAsStream(model); // XSSFWorkbook(excelĵ) @@ -1416,32 +1950,41 @@ public class ChangeNotifyForm extends AbstractRendering { // XSSFCell cell1 = row1.getCell(0); // XSSFCellStyle style = cell1.getCellStyle(); if (changeMesg != null && changeMesg.size() > 0) { - ChangeOrderBean cob = changeMesg.get(0); - String sqr = cob.getApplyName(); + ChangeOrderBean2 cob = changeMesg.get(0); + String sqr = cob.getApplyman(); String sqsj = cob.getApplyDate(); - String xmbh = cob.getProjectCode(); - String khmc = cob.getClientNae(); - String cpbm = cob.getProductDepartment(); - String cpmc = cob.getProductName(); - String cpxh = cob.getProjectModel(); + String xmbh = cob.getSystemCode(); + String khmc = cob.getClientName(); + String cpbm = cob.getProductDepart(); + String cpbh = cob.getProductCode(); + String cpxh = cob.getProductTypeXh(); String gglx = cob.getChangeType(); - String cplx = cob.getProductType(); - String tzgglx = cob.getTZChangeType(); - String cwlx = cob.getErrorType(); + String bgsclx = cob.getChangeInputType(); String zrbm = cob.getDutyDepartment(); String zrr = cob.getDutyMan(); + String bgzy = cob.getChangeOfMajor(); + String pkeyword2 = cob.getPkeyword(); + String manageclassify2 = cob.getManageclassify(); + String kkcode2 = cob.getKkcode(); String ggyy = cob.getChangeReason(); - String ssfl = cob.getSalseClassify(); - String jgyg = cob.getPriceBooking(); - String sfcscbss = cob.getIsNotProductLoss(); - String ljlyfl = cob.getReceiveClassify(); - String ckbh = cob.getWarehouseCode(); - String zt = cob.getAccountSet(); - String tzjjcd = cob.getNotifyEmergencyProcedures(); - String tzfz = cob.getDrawingTo(); - String syxdsbhlbj = cob.getAffectedPart(); - String xmjd = cob.getProjectState(); - String bgtzdh = cob.getChangeListCode(); + String ckbh = cob.getStorageNum(); + String zt = cob.getWareHourse(); + String bgtzdh = cob.getChangeCode(); + String sfyxbjjk = cob.getLayoutInterface(); + String bgyy = cob.getChangeReason(); + String cplx = cob.getProductType(); + String bgbq = cob.getChangeTag(); + String wlfl = cob.getItemLYLX(); + String sfxycg = cob.getNeedBuy(); + String jtyy = cob.getReasonDetail(); + String wlxqrq = cob.getItemNeedDate(); + String tzjjcd = cob.getDegreeOfurgency(); + String jgyg = cob.getPricePri(); + String xsfl = cob.getSaleClass(); + String gbqrr = cob.getCloseMan(); + String tzfsz = cob.getHandleOpinion(); + + XSSFRow row = sheet.getRow(0); XSSFCell cell = row.getCell(0); @@ -1452,123 +1995,140 @@ public class ChangeNotifyForm extends AbstractRendering { cell = row.getCell(2); richTextString = new XSSFRichTextString(sqr); cell.setCellValue(richTextString); - cell = row.getCell(6); + cell = row.getCell(5); richTextString = new XSSFRichTextString(bgtzdh); cell.setCellValue(richTextString); - cell = row.getCell(12); + cell = row.getCell(10); richTextString = new XSSFRichTextString(sqsj); cell.setCellValue(richTextString); row = sheet.getRow(2); cell = row.getCell(2); - richTextString = new XSSFRichTextString(cpmc); + richTextString = new XSSFRichTextString(cpbh); cell.setCellValue(richTextString); - cell = row.getCell(6); + cell = row.getCell(5); richTextString = new XSSFRichTextString(cpxh); cell.setCellValue(richTextString); - cell = row.getCell(12); + cell = row.getCell(10); richTextString = new XSSFRichTextString(khmc); cell.setCellValue(richTextString); row = sheet.getRow(3); cell = row.getCell(2); - richTextString = new XSSFRichTextString(ckbh); + richTextString = new XSSFRichTextString(cpbm); cell.setCellValue(richTextString); - cell = row.getCell(6); - richTextString = new XSSFRichTextString(tzjjcd); + cell = row.getCell(5); + richTextString = new XSSFRichTextString(ckbh); cell.setCellValue(richTextString); - cell = row.getCell(12); - richTextString = new XSSFRichTextString(tzgglx); + cell = row.getCell(10); + richTextString = new XSSFRichTextString(zt); cell.setCellValue(richTextString); row = sheet.getRow(4); cell = row.getCell(2); - richTextString = new XSSFRichTextString(cpbm); - cell.setCellValue(richTextString); - cell = row.getCell(6); richTextString = new XSSFRichTextString(zrbm); cell.setCellValue(richTextString); - cell = row.getCell(12); + cell = row.getCell(5); richTextString = new XSSFRichTextString(zrr); cell.setCellValue(richTextString); + cell = row.getCell(10); + richTextString = new XSSFRichTextString(bgzy); + cell.setCellValue(richTextString); row = sheet.getRow(5); cell = row.getCell(2); - richTextString = new XSSFRichTextString(gglx); + richTextString = new XSSFRichTextString(sfyxbjjk); cell.setCellValue(richTextString); - cell = row.getCell(6); - richTextString = new XSSFRichTextString(cplx); + cell = row.getCell(5); + richTextString = new XSSFRichTextString(gglx); cell.setCellValue(richTextString); - cell = row.getCell(12); - richTextString = new XSSFRichTextString(cwlx); + cell = row.getCell(10); + richTextString = new XSSFRichTextString(bgsclx); cell.setCellValue(richTextString); row = sheet.getRow(6); cell = row.getCell(2); - richTextString = new XSSFRichTextString(jgyg); + richTextString = new XSSFRichTextString(xmbh); cell.setCellValue(richTextString); - cell = row.getCell(6); - richTextString = new XSSFRichTextString(ssfl); + cell = row.getCell(5); + richTextString = new XSSFRichTextString(bgyy); cell.setCellValue(richTextString); - cell = row.getCell(12); - richTextString = new XSSFRichTextString(sfcscbss); + cell = row.getCell(10); + richTextString = new XSSFRichTextString(cplx); cell.setCellValue(richTextString); row = sheet.getRow(7); cell = row.getCell(2); - richTextString = new XSSFRichTextString(syxdsbhlbj); + richTextString = new XSSFRichTextString(bgbq); + cell.setCellValue(richTextString); + cell = row.getCell(5); + richTextString = new XSSFRichTextString(wlfl); + cell.setCellValue(richTextString); + cell = row.getCell(10); + richTextString = new XSSFRichTextString(sfxycg); cell.setCellValue(richTextString); row = sheet.getRow(8); cell = row.getCell(2); - richTextString = new XSSFRichTextString(xmjd); + richTextString = new XSSFRichTextString(jgyg); cell.setCellValue(richTextString); - cell = row.getCell(6); - richTextString = new XSSFRichTextString(ljlyfl); + cell = row.getCell(5); + richTextString = new XSSFRichTextString(xsfl); cell.setCellValue(richTextString); - cell = row.getCell(12); - richTextString = new XSSFRichTextString(tzfz); + cell = row.getCell(10); + richTextString = new XSSFRichTextString(gbqrr); cell.setCellValue(richTextString); row = sheet.getRow(9); cell = row.getCell(2); - richTextString = new XSSFRichTextString(xmbh); + richTextString = new XSSFRichTextString(jtyy); cell.setCellValue(richTextString); row = sheet.getRow(10); cell = row.getCell(2); - richTextString = new XSSFRichTextString(ggyy); + richTextString = new XSSFRichTextString(tzfsz); cell.setCellValue(richTextString); - + cell = row.getCell(5); + richTextString = new XSSFRichTextString(wlxqrq); + cell.setCellValue(richTextString); + cell = row.getCell(10); + richTextString = new XSSFRichTextString(tzfsz); + cell.setCellValue(tzjjcd); + row = sheet.getRow(11); cell = row.getCell(2); - richTextString = new XSSFRichTextString(zt); - cell.setCellValue(richTextString); + richTextString = new XSSFRichTextString(pkeyword2); + cell.setCellValue(richTextString); + cell = row.getCell(5); + richTextString = new XSSFRichTextString(manageclassify2); + cell.setCellValue(richTextString); + cell = row.getCell(10); + richTextString = new XSSFRichTextString(kkcode2); + cell.setCellValue(richTextString); + } if (changeDetils != null && changeDetils.size() > 0) { for (int i = 0; i < changeDetils.size(); i++) { - XSSFRow row = sheet.getRow(i + 16); + XSSFRow row = sheet.getRow(i + 14); if (row == null) { - row = sheet.createRow(i + 16); + row = sheet.createRow(i + 14); } - ChangeDetils changeDetil = changeDetils.get(i); - String ph = changeDetil.getPH(); - String pm = changeDetil.getPM(); - String ybb = changeDetil.getYBB(); - String xbb = changeDetil.getXBB(); - String ysl = changeDetil.getYSL(); - String xsl = changeDetil.getXSL(); - String bgsl = changeDetil.getBGSL(); - String ggsm = changeDetil.getGGSM(); - String wzpsl = changeDetil.getWZPSL(); - String wzpuj = changeDetil.getWZPUJ(); - String zzsl = changeDetil.getZZSL(); - String zzyj = changeDetil.getZZYJ(); - String scsl = changeDetil.getSCSL(); - String ssyj = changeDetil.getSSYJ(); - String cksl = changeDetil.getCKSL(); - String clyj = changeDetil.getCLYJ(); + ChangeDetails2 changeDetil = changeDetils.get(i); + System.out.println(changeDetil); + String ph = changeDetil.getItemCode(); + String pm = changeDetil.getItemName(); + String ybb = changeDetil.getRevNum(); + String xbb = changeDetil.getRevNow(); + String ysl = changeDetil.getProtolNum(); + String xsl = changeDetil.getNowNum(); + String bgsl = changeDetil.getChangeNum(); + String ggsm = changeDetil.getChangeInroduct(); + String wljd = changeDetil.getItemState(); + String clyj = changeDetil.getHandleOpinion(); + String zzsl = changeDetil.getProductingNum(); + String scsl = changeDetil.getProductNum(); + String cksl = changeDetil.getStorageNum(); XSSFCell cell = row.getCell(0); if (cell == null) { @@ -1594,6 +2154,14 @@ public class ChangeNotifyForm extends AbstractRendering { richTextString = new XSSFRichTextString(pm); cell.setCellValue(richTextString); +// cell = row.getCell(3); +// if (cell == null) { +// cell = row.createCell(3); +// +// } +// richTextString = new XSSFRichTextString(ybb); +// cell.setCellValue(richTextString); +// cell = row.getCell(3); if (cell == null) { cell = row.createCell(3); @@ -1607,7 +2175,7 @@ public class ChangeNotifyForm extends AbstractRendering { cell = row.createCell(4); } - richTextString = new XSSFRichTextString(xbb); + richTextString = new XSSFRichTextString(ysl); cell.setCellValue(richTextString); cell = row.getCell(5); @@ -1615,7 +2183,7 @@ public class ChangeNotifyForm extends AbstractRendering { cell = row.createCell(5); } - richTextString = new XSSFRichTextString(ysl); + richTextString = new XSSFRichTextString(xsl); cell.setCellValue(richTextString); cell = row.getCell(6); @@ -1623,7 +2191,7 @@ public class ChangeNotifyForm extends AbstractRendering { cell = row.createCell(6); } - richTextString = new XSSFRichTextString(xsl); + richTextString = new XSSFRichTextString(bgsl); cell.setCellValue(richTextString); cell = row.getCell(7); @@ -1631,7 +2199,7 @@ public class ChangeNotifyForm extends AbstractRendering { cell = row.createCell(7); } - richTextString = new XSSFRichTextString(bgsl); + richTextString = new XSSFRichTextString(ggsm); cell.setCellValue(richTextString); cell = row.getCell(8); @@ -1639,7 +2207,7 @@ public class ChangeNotifyForm extends AbstractRendering { cell = row.createCell(8); } - richTextString = new XSSFRichTextString(ggsm); + richTextString = new XSSFRichTextString(wljd); cell.setCellValue(richTextString); cell = row.getCell(9); @@ -1647,7 +2215,7 @@ public class ChangeNotifyForm extends AbstractRendering { cell = row.createCell(9); } - richTextString = new XSSFRichTextString(wzpsl); + richTextString = new XSSFRichTextString(clyj); cell.setCellValue(richTextString); cell = row.getCell(10); @@ -1655,7 +2223,7 @@ public class ChangeNotifyForm extends AbstractRendering { cell = row.createCell(10); } - richTextString = new XSSFRichTextString(wzpuj); + richTextString = new XSSFRichTextString(zzsl); cell.setCellValue(richTextString); cell = row.getCell(11); @@ -1663,48 +2231,17 @@ public class ChangeNotifyForm extends AbstractRendering { cell = row.createCell(11); } - richTextString = new XSSFRichTextString(zzsl); + richTextString = new XSSFRichTextString(scsl); cell.setCellValue(richTextString); cell = row.getCell(12); if (cell == null) { cell = row.createCell(12); - } - richTextString = new XSSFRichTextString(zzyj); - cell.setCellValue(richTextString); - - cell = row.getCell(13); - if (cell == null) { - cell = row.createCell(13); - - } - richTextString = new XSSFRichTextString(scsl); - cell.setCellValue(richTextString); - - cell = row.getCell(14); - if (cell == null) { - cell = row.createCell(14); - - } - richTextString = new XSSFRichTextString(ssyj); - cell.setCellValue(richTextString); - - cell = row.getCell(15); - if (cell == null) { - cell = row.createCell(15); - } richTextString = new XSSFRichTextString(cksl); cell.setCellValue(richTextString); - - cell = row.getCell(16); - if (cell == null) { - cell = row.createCell(16); - - } - richTextString = new XSSFRichTextString(clyj); - cell.setCellValue(richTextString); + } } @@ -1726,10 +2263,10 @@ public class ChangeNotifyForm extends AbstractRendering { } } - private void changeRevProperty(ChangeOrderBean bn) { + private void changeRevProperty(ChangeOrderBean2 bn) { String changeType = bn.getChangeType(); - String receiveClassify = bn.getReceiveClassify(); - String drawingTo = bn.getDrawingTo(); + String receiveClassify = bn.getItemLYLX(); + String drawingTo = bn.getHandleOpinion(); String[] split = drawingTo.split(";"); List list = null; if(split!=null&&split.length>0) { @@ -1889,45 +2426,53 @@ public class ChangeNotifyForm extends AbstractRendering { private List getChangeMesg(String id) { List list = new ArrayList(); - ChangeOrderBean bn = new ChangeOrderBean(); + ChangeOrderBean2 bn = new ChangeOrderBean2(); ResultSet r = null; Connection con = null; PreparedStatement stmt = null; - String sql = "select * from DFL_CHANGEFORM where objectCode=?";// + String sql = "select OBJECTCODE,APPLYNAME,APPLYDATE,PROODUCTCODE,PRODUCTTYPE,CLIENTNAME,PRODUCTDEPARTMENT,WAREHOUSECODE,ACCOUNTSET,DUTYDEPARTMENT,DUTYMAN,FORM_MAJOR,LAYOUTINTERFACE," + + "CHANGETYPE,CHANGEINPUTTYPE,PROJECTCODE,CHANGEREASON,PROJECTMODEL,CHANGETAG,RECEIVECLASSIFY,NEEDBUY,PRICEBOOKING,SALSECLASSIFY,CLOSEMAN,REASONDETAIL,HANDLEOPINION,ITEMNEEDDATE,NOTIFYEMERGENCYPROCEDURES,PKEYWORD,MANAGECLASSIFY,KKCODE from DFL_CHANGEFORM where objectCode=?";// try { con = ConnectionFun(); stmt = con.prepareStatement(sql); stmt.setString(1, id); r = stmt.executeQuery(); + String sql1 = "insert into DFL_CHANGEFORM(OBJECTCODE,APPLYNAME,APPLYDATE,PROODUCTCODE,PRODUCTTYPE," + + "CLIENTNAME,PRODUCTDEPARTMENT,WAREHOUSECODE,ACCOUNTSET,DUTYDEPARTMENT,DUTYMAN,FORM_MAJOR,LAYOUTINTERFACE," + + "CHANGETYPE,CHANGEINPUTTYPE,PROJECTCODE,CHANGEREASON,PROJECTMODEL,CHANGETAG,RECEIVECLASSIFY,NEEDBUY," + + "PRICEBOOKING,SALSECLASSIFY,CLOSEMAN,REASONDETAIL,HANDLEOPINION,ITEMNEEDDATE,NOTIFYEMERGENCYPROCEDURES,PKEYWORD,MANAGECLASSIFY,KKCODE)"; while (r.next()) { - bn.setObjectCode(r.getString(1)); - bn.setApplyName(r.getString(2)); + bn.setChangeCode(r.getString(1)); + bn.setApplyman(table1.getValueAt(0, 1).toString()); bn.setApplyDate(r.getString(3)); - bn.setProjectCode(r.getString(4)); - bn.setClientNae(r.getString(5)); - bn.setProductDepartment(r.getString(6)); - bn.setProductName(r.getString(7)); - bn.setProjectModel(r.getString(8)); - bn.setAffectedPart(r.getString(9)); - bn.setChangeType(r.getString(10)); - bn.setProductType(r.getString(11)); - bn.setErrorType(r.getString(12)); - bn.setDutyDepartment(r.getString(13)); - bn.setDutyMan(r.getString(14)); - bn.setChangeReason(r.getString(15)); - bn.setSalseClassify(r.getString(16)); - bn.setPriceBooking(r.getString(17)); - bn.setIsNotProductLoss(r.getString(18)); - bn.setReceiveClassify(r.getString(19)); - bn.setWarehouseCode(r.getString(20)); - bn.setAccountSet(r.getString(21)); - bn.setNotifyEmergencyProcedures(r.getString(22)); - bn.setDrawingTo(r.getString(23)); - bn.setChangeListCode(r.getString(24)); - - bn.setTZChangeType(r.getString(25)); - bn.setSUOSU_ProductDepartment(r.getString(26)); - bn.setProjectState(r.getString(27)); + bn.setProductCode(r.getString(4)); + bn.setProductType(r.getString(5)); + bn.setClientName(r.getString(6)); + bn.setProductDepart(r.getString(7)); + bn.setWareHourse(r.getString(9)); + bn.setStorageNum(r.getString(8)); + bn.setDutyMan(r.getString(11)); + bn.setDutyDepartment(r.getString(10)); + bn.setChangeOfMajor(r.getString(12)); + bn.setLayoutInterface(r.getString(13)); + bn.setChangeType(r.getString(14)); + bn.setChangeInputType(r.getString(15)); + bn.setSystemCode(r.getString(16)); + bn.setChangeReason(r.getString(17)); + bn.setProductTypeXh(r.getString(18)); + bn.setChangeTag(r.getString(19)); + bn.setItemLYLX(r.getString(20)); + bn.setNeedBuy(r.getString(21)); + bn.setPricePri(r.getString(22)); + bn.setSaleClass(r.getString(23)); + bn.setCloseMan(r.getString(24)); + bn.setReasonDetail(r.getString(25)); + bn.setHandleOpinion(r.getString(26)); + bn.setItemNeedDate(r.getString(27)); + bn.setDegreeOfurgency(r.getString(28)); + bn.setPkeyword(r.getString(29)); + bn.setManageclassify(r.getString(30)); + bn.setKkcode(r.getString(31)); list.add(bn); } @@ -1935,9 +2480,17 @@ public class ChangeNotifyForm extends AbstractRendering { e.printStackTrace(); } finally { try { - r.close(); - stmt.close(); - con.close(); + if(r!=null) { + r.close(); + + + } + if(stmt!=null) { + stmt.close(); + } + if(con!=null) { + con.close(); + } } catch (SQLException e) { e.printStackTrace(); } @@ -1952,41 +2505,45 @@ public class ChangeNotifyForm extends AbstractRendering { ResultSet r = null; Connection con = null; PreparedStatement stmt = null; - String sql = "select * from DFL_CHANGEDETAILS where objectCode=?";// + String sql = "select OBJECTCODE,ORDERNUM,PH,PM,YBB,XBB,YSL,XSL,BGSL,GGSM,ITEMSTATE,CLYJ,ZZSL,SCSL,CKSL from DFL_CHANGEDETAILS where objectCode=? order by ORDERNUM asc";// try { con = ConnectionFun(); stmt = con.prepareStatement(sql); stmt.setString(1, id); r = stmt.executeQuery(); while (r.next()) { - ChangeDetils cd = new ChangeDetils(); + ChangeDetails2 cd = new ChangeDetails2(); System.out.println(r.getString(1)); cd.setObjectCode(r.getString(1)); - cd.setPH(r.getString(2)); - cd.setPM(r.getString(3)); - cd.setYBB(r.getString(4)); - cd.setXBB(r.getString(5)); - cd.setYSL(r.getString(6)); - cd.setXSL(r.getString(7)); - cd.setBGSL(r.getString(8)); - cd.setWZPSL(r.getString(9)); - cd.setWZPUJ(r.getString(10)); - cd.setZZSL(r.getString(11)); - cd.setZZYJ(r.getString(12)); - cd.setSCSL(r.getString(13)); - cd.setSSYJ(r.getString(14)); - cd.setCKSL(r.getString(15)); - cd.setCLYJ(r.getString(16)); - cd.setGGSM(r.getString(17)); + cd.setOrder(r.getString(2)); + cd.setItemCode(r.getString(3)); + cd.setItemName(r.getString(4)); + cd.setRevNum(r.getString(5)); + cd.setRevNow(r.getString(6)); + cd.setProtolNum(r.getString(7)); + cd.setNowNum(r.getString(8)); + cd.setChangeNum(r.getString(9)); + cd.setChangeInroduct(r.getString(10)); + cd.setItemState(r.getString(11)); + cd.setHandleOpinion(r.getString(12)); + cd.setProductingNum(r.getString(13)); + cd.setProductNum(r.getString(14)); + cd.setStorageNum(r.getString(15)); list.add(cd); } } catch (SQLException e) { e.printStackTrace(); } finally { try { - r.close(); - stmt.close(); - con.close(); + if(r!=null) { + r.close(); + } + if(stmt!=null) { + stmt.close(); + } + if(con!=null) { + con.close(); + } } catch (SQLException e) { e.printStackTrace(); } @@ -2000,43 +2557,41 @@ public class ChangeNotifyForm extends AbstractRendering { List list = getChangeMesg(masterName); System.out.println("masterName==============" + masterName); if (list.size() > 0) { - ChangeOrderBean bn = (ChangeOrderBean) list.get(list.size() - 1); + ChangeOrderBean2 bn = (ChangeOrderBean2) list.get(list.size() - 1); - System.out.println(bn.getApplyName()); - table1.setValueAt(bn.getApplyName(), 0, 1); + System.out.println(bn.getChangeCode()); + table1.setValueAt(bn.getApplyman()==null || bn.getApplyman().length()==0?applyname:bn.getApplyman(), 0, 1); + table1.setValueAt(bn.getChangeCode(), 0, 3); table1.setValueAt(bn.getApplyDate(), 0, 5); - table1.setValueAt(bn.getProjectCode(), 8, 1); - table1.setValueAt(bn.getClientNae(), 1, 5); - table1.setValueAt(bn.getProductDepartment(), 3, 1); - table1.setValueAt(bn.getProductName(), 1, 1); - table1.setValueAt(bn.getProjectModel(), 1, 3); - // Ӱ㲿 - table1.setValueAt(bn.getAffectedPart(), 6, 1); - - table1.setValueAt(bn.getChangeType(), 4, 1); - table1.setValueAt(bn.getProductType(), 4, 3); - table1.setValueAt(bn.getErrorType(), 4, 5); - table1.setValueAt(bn.getDutyDepartment(), 3, 3); - table1.setValueAt(bn.getDutyMan(), 3, 5); - table1.setValueAt(bn.getChangeReason(), 9, 1); - table1.setValueAt(bn.getSalseClassify(), 5, 3); - table1.setValueAt(bn.getPriceBooking(), 5, 1); - table1.setValueAt(bn.getIsNotProductLoss(), 5, 5); - table1.setValueAt(bn.getReceiveClassify(), 7, 3); - table1.setValueAt(bn.getWarehouseCode(), 2, 1); - - // - table1.setValueAt(bn.getAccountSet(), 10, 1); - // ̶֪ͨ - table1.setValueAt(bn.getNotifyEmergencyProcedures(), 2, 3); - - table1.setValueAt(bn.getDrawingTo(), 7, 5); - - table1.setValueAt(bn.getChangeListCode(), 0, 3); - table1.setValueAt(bn.getTZChangeType(), 2, 5); - // table1.setValueAt(bn.getSUOSU_ProductDepartment(),6, 1); - table1.setValueAt(bn.getProjectState(), 7, 1); - + table1.setValueAt(bn.getProductCode(), 1, 1); + table1.setValueAt(bn.getProductTypeXh(), 1, 3); + table1.setValueAt(bn.getClientName(), 1, 5); + table1.setValueAt(bn.getProductDepart(), 2, 1); + table1.setValueAt(bn.getStorageNum(), 2, 3); + table1.setValueAt(bn.getWareHourse(), 2, 5); + table1.setValueAt(bn.getDutyDepartment(), 3, 1); + table1.setValueAt(bn.getDutyMan(), 3, 3); + table1.setValueAt(bn.getChangeOfMajor(), 3, 5); + table1.setValueAt(bn.getLayoutInterface(), 4, 1); + table1.setValueAt(bn.getChangeType(), 4, 3); + table1.setValueAt(bn.getChangeInputType(), 4, 5); + table1.setValueAt(bn.getSystemCode(), 5, 1); + table1.setValueAt(bn.getChangeReason(), 5, 3); + table1.setValueAt(bn.getProductType(), 5, 5); + table1.setValueAt(bn.getChangeTag(), 6, 1); + table1.setValueAt(bn.getItemLYLX(), 6, 3); + table1.setValueAt(bn.getNeedBuy(), 6, 5); + table1.setValueAt(bn.getPricePri(), 7, 1); + table1.setValueAt(bn.getSaleClass(), 7, 3); + table1.setValueAt(bn.getCloseMan(), 7, 5); + table1.setValueAt(bn.getReasonDetail(), 8, 1); + table1.setValueAt(bn.getHandleOpinion(), 9, 1); + table1.setValueAt(bn.getItemNeedDate(), 9, 3); + table1.setValueAt(bn.getDegreeOfurgency(), 9, 5); + table1.setValueAt(bn.getPkeyword(), 10, 1); + table1.setValueAt(bn.getManageclassify(), 10, 3); + table1.setValueAt(bn.getKkcode(), 10, 5); + // table2 м } @@ -2046,7 +2601,7 @@ public class ChangeNotifyForm extends AbstractRendering { public void insertMes(ChangeOrderBean bn) { Connection con = null; PreparedStatement stmt = null; - String sql = "insert into DFL_CHANGEFORM values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + String sql = "insert into DFL_CHANGEFORM values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; try { con = ConnectionFun(); stmt = con.prepareStatement(sql); @@ -2068,6 +2623,7 @@ public class ChangeNotifyForm extends AbstractRendering { stmt.setString(13, bn.getDutyDepartment()); stmt.setString(14, bn.getDutyMan()); + stmt.setString(15, bn.getChangeReason()); stmt.setString(16, bn.getSalseClassify()); @@ -2086,6 +2642,68 @@ public class ChangeNotifyForm extends AbstractRendering { stmt.setString(25, bn.getTZChangeType()); stmt.setString(26, bn.getSUOSU_ProductDepartment()); stmt.setString(27, bn.getProjectState()); + stmt.setString(28, bn.getFormMajor()); + stmt.setString(29, bn.getPkeyword()); + stmt.setString(30, bn.getManageclassify()); + stmt.setString(31, bn.getKkcode()); + stmt.executeUpdate(); + System.out.println("ݲݿ"); + + } catch (Exception ex) { + ex.printStackTrace(); + } finally { + try { + stmt.close(); + con.close(); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + + } + + public void insertMes2(ChangeOrderBean2 bn) { + Connection con = null; + PreparedStatement stmt = null; + String sql = "insert into DFL_CHANGEFORM(OBJECTCODE,APPLYNAME,APPLYDATE,PROODUCTCODE,PRODUCTTYPE," + + "CLIENTNAME,PRODUCTDEPARTMENT,WAREHOUSECODE,ACCOUNTSET,DUTYDEPARTMENT,DUTYMAN,FORM_MAJOR,LAYOUTINTERFACE," + + "CHANGETYPE,CHANGEINPUTTYPE,PROJECTCODE,CHANGEREASON,PROJECTMODEL,CHANGETAG,RECEIVECLASSIFY,NEEDBUY," + + "PRICEBOOKING,SALSECLASSIFY,CLOSEMAN,REASONDETAIL,HANDLEOPINION,ITEMNEEDDATE,NOTIFYEMERGENCYPROCEDURES,PKEYWORD,MANAGECLASSIFY,KKCODE) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + try { + con = ConnectionFun(); + stmt = con.prepareStatement(sql); + + stmt.setString(1, bn.getChangeCode()); + stmt.setString(2, bn.getApplyman()); + stmt.setString(3, bn.getApplyDate()); + stmt.setString(4, bn.getProductCode()); + stmt.setString(5, bn.getProductType()); + stmt.setString(6, bn.getClientName()); + stmt.setString(7, bn.getProductDepart()); + stmt.setString(9, bn.getWareHourse()); + stmt.setString(8, bn.getStorageNum()); + stmt.setString(10, bn.getDutyDepartment()); + stmt.setString(11, bn.getDutyMan()); + stmt.setString(12, bn.getChangeOfMajor()); + stmt.setString(13, bn.getLayoutInterface()); + stmt.setString(14, bn.getChangeType()); + stmt.setString(15, bn.getChangeInputType()); + stmt.setString(16, bn.getSystemCode()); + stmt.setString(17, bn.getChangeReason()); + stmt.setString(18, bn.getProductTypeXh()); + stmt.setString(19, bn.getChangeTag()); + stmt.setString(20, bn.getItemLYLX()); + stmt.setString(21, bn.getNeedBuy()); + stmt.setString(22, bn.getPricePri()); + stmt.setString(23, bn.getSaleClass()); + stmt.setString(24, bn.getCloseMan()); + stmt.setString(25, bn.getReasonDetail()); + stmt.setString(26, bn.getHandleOpinion()); + stmt.setString(27, bn.getItemNeedDate()); + stmt.setString(28, bn.getDegreeOfurgency()); + stmt.setString(29, bn.getPkeyword()); + stmt.setString(30, bn.getManageclassify()); + stmt.setString(31, bn.getKkcode()); stmt.executeUpdate(); System.out.println("ݲݿ"); @@ -2106,30 +2724,28 @@ public class ChangeNotifyForm extends AbstractRendering { * ϸ */ - public void insertChangeDetailsMes(ChangeDetils cd) { + public void insertChangeDetailsMes(ChangeDetails2 cd) { Connection con = null; PreparedStatement stmt = null; - String sql = "insert into DFL_CHANGEDETAILS values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + String sql = "insert into DFL_CHANGEDETAILS(OBJECTCODE,ORDERNUM,PH,PM,YBB,XBB,YSL,XSL,BGSL,GGSM,ITEMSTATE,CLYJ,ZZSL,SCSL,CKSL) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; try { con = ConnectionFun(); stmt = con.prepareStatement(sql); stmt.setString(1, cd.getObjectCode()); - stmt.setString(2, cd.getPH()); - stmt.setString(3, cd.getPM()); - stmt.setString(4, cd.getYBB()); - stmt.setString(5, cd.getXBB()); - stmt.setString(6, cd.getYSL()); - stmt.setString(7, cd.getXSL()); - stmt.setString(8, cd.getBGSL()); - stmt.setString(9, cd.getWZPSL()); - stmt.setString(10, cd.getWZPUJ()); - stmt.setString(11, cd.getZZSL()); - stmt.setString(12, cd.getZZYJ()); - stmt.setString(13, cd.getSCSL()); - stmt.setString(14, cd.getSSYJ()); - stmt.setString(15, cd.getCKSL()); - stmt.setString(16, cd.getCLYJ()); - stmt.setString(17, cd.getGGSM()); + stmt.setString(2, cd.getOrder()); + stmt.setString(3, cd.getItemCode()); + stmt.setString(4, cd.getItemName()); + stmt.setString(5, cd.getRevNum()); + stmt.setString(6, cd.getRevNow()); + stmt.setString(7, cd.getProtolNum()); + stmt.setString(8, cd.getNowNum()); + stmt.setString(9, cd.getChangeNum()); + stmt.setString(10, cd.getChangeInroduct()); + stmt.setString(11, cd.getItemState()); + stmt.setString(12, cd.getHandleOpinion()); + stmt.setString(13, cd.getProductingNum()); + stmt.setString(14, cd.getProductNum()); + stmt.setString(15, cd.getStorageNum()); System.out.println(sql); stmt.executeUpdate(); System.out.println("ݲݿ"); diff --git a/src/com/connor/dfl/plm/forms/ChangeOrderBean.java b/src/com/connor/dfl/plm/forms/ChangeOrderBean.java index c96f50b..1c92fb3 100644 --- a/src/com/connor/dfl/plm/forms/ChangeOrderBean.java +++ b/src/com/connor/dfl/plm/forms/ChangeOrderBean.java @@ -18,6 +18,7 @@ public class ChangeOrderBean { private String errorType;// private String dutyDepartment;//β private String dutyMan;// + private String formMajor;//רҵ private String changeReason;//ԭ private String salseClassify;//۷ private String priceBooking;//۸Ԥ @@ -31,6 +32,9 @@ public class ChangeOrderBean { private String TZChangeType;//ͼֽ private String SUOSU_ProductDepartment;//Ʒ private String projectState;//Ŀ׶ + private String pkeyword;//ؼ + private String manageclassify; //ƹ + private String kkcode; //kk @@ -40,8 +44,31 @@ public class ChangeOrderBean { - - public String getProjectState() { + public String getKkcode() { + return kkcode; + } + public void setKkcode(String kkcode) { + this.kkcode = kkcode; + } + public String getFormMajor() { + return formMajor; + } + public void setFormMajor(String formMajor) { + this.formMajor = formMajor; + } + public String getPkeyword() { + return pkeyword; + } + public void setPkeyword(String pkeyword) { + this.pkeyword = pkeyword; + } + public String getManageclassify() { + return manageclassify; + } + public void setManageclassify(String manageclassify) { + this.manageclassify = manageclassify; + } + public String getProjectState() { return projectState; } public void setProjectState(String projectState) { @@ -50,44 +77,49 @@ public class ChangeOrderBean { public ChangeOrderBean() { } - public ChangeOrderBean(String objectCode,String applyName, String applyDate, String projectCode, String clientNae, - String productDepartment, String productCode, String productName, String projectModel, String affectedPart, - String changeType, String productType, String errorType, String dutyDepartment, String dutyMan, - String changeReason, String salseClassify, String priceBooking, String isNotProductLoss, - String receiveClassify, String warehouseCode, String accountSet, String notifyEmergencyProcedures, - String drawingTo,String ChangeListCode,String TZChangeType,String SUOSU_ProductDepartment,String projectState) { - - this.projectState =projectState; - this.SUOSU_ProductDepartment = SUOSU_ProductDepartment; - this.TZChangeType = TZChangeType; - this.ChangeListCode = ChangeListCode; - this.objectCode = objectCode; - this.applyName = applyName; - this.applyDate = applyDate; - this.projectCode = projectCode; - this.clientNae = clientNae; - this.productDepartment = productDepartment; - - this.productName = productName; - this.projectModel = projectModel; - this.affectedPart = affectedPart; - this.changeType = changeType; - this.productType = productType; - this.errorType = errorType; - this.dutyDepartment = dutyDepartment; - this.dutyMan = dutyMan; - this.changeReason = changeReason; - this.salseClassify = salseClassify; - this.priceBooking = priceBooking; - this.isNotProductLoss = isNotProductLoss; - this.receiveClassify = receiveClassify; - this.warehouseCode = warehouseCode; - this.accountSet = accountSet; - this.NotifyEmergencyProcedures = notifyEmergencyProcedures; - this.drawingTo = drawingTo; - } + - public String getSUOSU_ProductDepartment() { + public ChangeOrderBean(String objectCode, String applyName, String applyDate, String projectCode, String clientNae, + String productDepartment, String productName, String projectModel, String affectedPart, String changeType, + String productType, String errorType, String dutyDepartment, String dutyMan, String formMajor, + String changeReason, String salseClassify, String priceBooking, String isNotProductLoss, + String receiveClassify, String warehouseCode, String accountSet, String notifyEmergencyProcedures, + String drawingTo, String changeListCode, String tZChangeType, String sUOSU_ProductDepartment, + String projectState, String pkeyword, String manageclassify,String kkcode) { + super(); + this.objectCode = objectCode; + this.applyName = applyName; + this.applyDate = applyDate; + this.projectCode = projectCode; + this.clientNae = clientNae; + this.productDepartment = productDepartment; + this.productName = productName; + this.projectModel = projectModel; + this.affectedPart = affectedPart; + this.changeType = changeType; + this.productType = productType; + this.errorType = errorType; + this.dutyDepartment = dutyDepartment; + this.dutyMan = dutyMan; + this.formMajor = formMajor; + this.changeReason = changeReason; + this.salseClassify = salseClassify; + this.priceBooking = priceBooking; + this.isNotProductLoss = isNotProductLoss; + this.receiveClassify = receiveClassify; + this.warehouseCode = warehouseCode; + this.accountSet = accountSet; + NotifyEmergencyProcedures = notifyEmergencyProcedures; + this.drawingTo = drawingTo; + ChangeListCode = changeListCode; + TZChangeType = tZChangeType; + SUOSU_ProductDepartment = sUOSU_ProductDepartment; + this.projectState = projectState; + this.pkeyword = pkeyword; + this.manageclassify = manageclassify; + this.kkcode = kkcode; + } + public String getSUOSU_ProductDepartment() { return SUOSU_ProductDepartment; } public void setSUOSU_ProductDepartment(String sUOSU_ProductDepartment) { diff --git a/src/com/connor/dfl/plm/forms/QuickChangeForm.java b/src/com/connor/dfl/plm/forms/QuickChangeForm.java index 5cedea6..0f4f81a 100644 --- a/src/com/connor/dfl/plm/forms/QuickChangeForm.java +++ b/src/com/connor/dfl/plm/forms/QuickChangeForm.java @@ -3,18 +3,28 @@ package com.connor.dfl.plm.forms; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; +import java.awt.Container; +import java.awt.Dialog; import java.awt.Dimension; import java.awt.Font; +import java.awt.LayoutManager; import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.awt.event.WindowEvent; +import java.awt.event.WindowListener; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; +import java.math.BigDecimal; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; @@ -37,6 +47,7 @@ import javax.swing.DefaultCellEditor; import javax.swing.DefaultComboBoxModel; import javax.swing.JButton; import javax.swing.JCheckBox; +import javax.swing.JCheckBoxMenuItem; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JLabel; @@ -48,6 +59,8 @@ import javax.swing.ScrollPaneConstants; import javax.swing.SwingConstants; import javax.swing.border.LineBorder; import javax.swing.event.CellEditorListener; +import javax.swing.event.TableModelEvent; +import javax.swing.event.TableModelListener; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.DefaultTableModel; import javax.swing.table.JTableHeader; @@ -61,8 +74,10 @@ import org.apache.poi.xssf.usermodel.XSSFRichTextString; 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.dfl044.DataBaseControl2; +import com.connor.dfl.plm.forms.ChangeNotifyForm.MyTable; import com.connor.dfl.plm.table.CTMap; import com.connor.dfl.plm.table.CTable; import com.connor.dfl.plm.util.DateChooser; @@ -70,6 +85,7 @@ import com.teamcenter.rac.aif.AbstractAIFApplication; import com.teamcenter.rac.aif.kernel.AIFComponentContext; import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; import com.teamcenter.rac.aifrcp.AIFUtility; +import com.teamcenter.rac.commands.open.OpenFormDialog; import com.teamcenter.rac.kernel.TCComponent; import com.teamcenter.rac.kernel.TCComponentDataset; import com.teamcenter.rac.kernel.TCComponentDatasetType; @@ -97,10 +113,10 @@ public class QuickChangeForm extends AbstractRendering { private InterfaceAIFComponent targetComp = app.getTargetComponent(); private TCComponentItemType itemType; private QuickChangeForm selfform; - private DefaultTableCellRenderer tcr; + private TableCellTextAreaRenderer tcr; CTable table1; private MyTable table2; - + private int TEXT_MAX_LENGTH = 500; private JScrollPane tablePanel2; private JScrollPane scrollPane; @@ -110,26 +126,38 @@ public class QuickChangeForm extends AbstractRendering { private String name; private String objname; + private String masterName; private String zhangtao; private String cangku; private JButton addButton; private JButton delButton; - private JComboBox ChangeTypeBox; - private JComboBox ProductTypecBox; + private JComboBox ChangeTypeBox;// + private JComboBox changeTagBox;//ǩ + private JComboBox ProductTypecBox;// Ʒ private JComboBox ErrorTypeBox; private JComboBox DutyDepartmentBox; - private JComboBox SalesClassifyBox; - private JComboBox EmergencyNotifyBox; + private JComboBox SalesClassifyBox;// ۷ + private JComboBox EmergencyNotifyBox;// ̶֪ͨ private JComboBox ProductDepartmentBox;// Ʒ + private JComboBox dutyDepartBox; // β private JComboBox DrawingChangeTypeBox;// ͼֽ private JComboBox IsNotProductLossBox;// Ƿɱʧ + private JComboBox isNotBuyBox; // ǷҪɹ + private JComboBox changeOfMajorBox;// רҵ + private JComboBox manageclassifyBox;//ƹ + private JComboBox isNotLayoutInterfaceBox; //ǷӰ첼ֽӿ + private JComboBox isNotChangeInputTypeBox; // private JComboBox ReceiveClassifyBox;// ϼ÷ private JComboBox WAPYJBox;// δƷ + private JComboBox itemStateBox; //Ͻ׶ private JComboBox ZZYJBox;// private JComboBox SSYJBox;// private JComboBox CLYJBox;// + private JComboBox changeReasonBox; //ԭ +// private JCheckBoxMenuItem private DataBaseControl2 data; + // ʱ public DefaultComboBoxModel jsrBoxModel; @@ -141,60 +169,94 @@ public class QuickChangeForm extends AbstractRendering { private String my_item_id; - private String clientname; - private String pd; - private String productname; - private String productmodel; - private String producttype; - private String department; - private String duty; - private String type; - private String projectState; - // table2еݣ浽ݿʹ - List changedeList = new ArrayList(); + List changedeList = new ArrayList(); + + private String applyName;// + private String applyDate;// ʱ + private String needDate; + private String projectCode;// Ŀ + private String clientNae;// ͻ + private String productDepartment;// Ʒ + // private String productCode;//Ʒ + private String productName;// Ʒ + private String projectModel;// Ʒͺ + private String affectedPart;// Ӱ豸/㲿 + private String changeType;// + private String productType;// Ʒ + private String errorType;// + private String dutyDepartment;// β + private String dutyMan;// + private String changeOfMajor;// רҵ + private String pkeyword;//ؼ + private String manageclassify; //ƹ + private String kkcode; //kk + + + private String changeReason;// ԭ + private String salseClassify;// ۷ + private String priceBooking;// ۸Ԥ + // private String change;//ϸ + private String isNotProductLoss;// ǷƷʧ + private String isNotLayoutInterface; // ǷӰӿڲ + private String isNotChangeInputType; // + private String receiveClassify;// ϼ÷ + private String isNotBuy; //ǷҪɹ + private String warehouseCode;// + private String accountSet;// + private String NotifyEmergencyProcedures;// ̶֪ͨ + private String drawingTo;// ͼֽ + private String ChangeListCode;// + private String TZChangeType; + private String changeTag; // ǩ + private String SUOSU_productdepartment; + private String projectState; + private String pricePri; //۸Ԥ + private String closeMan; //۸Ԥ + private String reasonDetail; //ԭ + + private OpenFormDialog lastDialog; public QuickChangeForm(TCComponent arg0) throws Exception { super(arg0); form = (TCComponentForm) arg0; this.session = ((TCSession) app.getSession()); //ȡݿӵַ - this.data = new DataBaseControl2(session,"DFL2_ERP_SQL_Connect"); - //ȡѡϢ - String[] BOMZT = session.getPreferenceService().getStringValues("DFL2_ZHANGTAO_WAREHOUSE"); - if (BOMZT == null || BOMZT.length <= 0 ) { - MessageBox.post("ѡDFL2_ZHANGTAO_WAREHOUSEδ,ϵԱ!!", - "", MessageBox.ERROR); - return; - } - TCComponentGroup group = session.getCurrentGroup(); - try { - String group_name = group.getStringProperty("display_name"); - System.out.println("11.04group_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(";"); - if(names[names.length-2].equals(zts[0])) { - this.zhangtao = zts[1]; - System.out.println("11.04======"+zhangtao); - this.cangku = zts[2]; - System.out.println("11.04ֿ======"+cangku); - break; + this.data = new DataBaseControl2(session,"DFL2_ERP_SQL_Connect"); + //ȡѡϢ + String[] BOMZT = session.getPreferenceService().getStringValues("DFL2_ZHANGTAO_WAREHOUSE"); + if (BOMZT == null || BOMZT.length <= 0 ) { + MessageBox.post("ѡDFL2_ZHANGTAO_WAREHOUSEδ,ϵԱ!!", + "", MessageBox.ERROR); + return; + } + TCComponentGroup group = session.getCurrentGroup(); + try { + String group_name = group.getStringProperty("display_name"); + System.out.println("11.04group_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(";"); + if(names[names.length-2].equals(zts[0])) { + this.zhangtao = zts[1]; + System.out.println("11.04======"+zhangtao); + this.cangku = zts[2]; + System.out.println("11.04ֿ======"+cangku); + break; + } + } } } } + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } - } - } catch (TCException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } this.selfform = this; loadRendering(); - } String[] stringArray = ((TCSession) app.getSession()).getPreferenceService().getStringValues("DFL2_SQL_Connect"); @@ -245,8 +307,15 @@ public class QuickChangeForm extends AbstractRendering { private void initUI() throws TCException, SQLException { - // + // private JComboBox ChangeTypeBox; + // private JComboBox ProductTypecBox; + // private JComboBox ErrorTypeBox; + // private JComboBox DutyDepartmentBox; + // private JComboBox SalesClassifyBox; + // private JCheckBox EmergencyNotifyBox; + // public DefaultComboBoxModel jsrBoxModel; + // String[] change_type_stringArrays = session.getPreferenceService().getStringValues("DFL_Form_ChangeType"); if (change_type_stringArrays == null || change_type_stringArrays.length <= 0) { MessageBox.post("ѡDFL_Form_ChangeTypeδ,ϵԱ!!", "", MessageBox.ERROR); @@ -258,8 +327,64 @@ public class QuickChangeForm extends AbstractRendering { ChangeTypeBox.addItem(change_type_stringArrays[change_type_number]); } + + ChangeTypeBox.addItemListener(new ItemListener() { + + @Override + public void itemStateChanged(ItemEvent e) { + // TODO Auto-generated method stub + if(e.getStateChange() == ItemEvent.SELECTED) { + System.out.println(e.getItem()); + if(e.getItem().toString().contains("ƴ")) { + changeReasonBox.removeAllItems(); + changeReasonBox.addItem("(ҪBA)"); + changeReasonBox.addItem("©"); + changeReasonBox.addItem("˿"); + changeReasonBox.addItem("Ʋ棩"); + }else if(e.getItem().toString().contains("ڲ")) { + changeReasonBox.removeAllItems(); + changeReasonBox.addItem(""); + changeReasonBox.addItem("Ż"); + changeReasonBox.addItem("λ"); + changeReasonBox.addItem("ӿ"); + changeReasonBox.addItem("С-500Ԫ"); + }else if(e.getItem().toString().contains("Ż")) { + changeReasonBox.removeAllItems(); + changeReasonBox.addItem("ʹ"); + changeReasonBox.addItem("ת"); + changeReasonBox.addItem("׼"); + }else if(e.getItem().toString().contains("ϵͳ")) { + changeReasonBox.removeAllItems(); + changeReasonBox.addItem(""); + changeReasonBox.addItem("Ż"); + changeReasonBox.addItem("С-500Ԫ"); + changeReasonBox.addItem("AӰB"); + }else if(e.getItem().toString().contains("ɹ")) { + changeReasonBox.removeAllItems(); + changeReasonBox.addItem("ڽ"); + changeReasonBox.addItem("Ʒ"); + changeReasonBox.addItem("ERPϢ"); + changeReasonBox.addItem(""); + }else if(e.getItem().toString().contains("۱")) { + changeReasonBox.removeAllItems(); + changeReasonBox.addItem(""); + changeReasonBox.addItem("ͻԭ"); + changeReasonBox.addItem("ԭ򣨱Ŀ"); + changeReasonBox.addItem("ԭ򣨷DZĿ"); + changeReasonBox.addItem("ӳֲ"); + changeReasonBox.addItem("ǩЭ"); + } + } + } + }); + + //ǩ + changeTagBox = new JComboBox(); + changeTagBox.addItem("ͼ"); + changeTagBox.addItem("ظ"); + changeTagBox.addItem("ż"); + changeTagBox.addItem(""); - // ChangeTypeBox = new JComboBox(); // ChangeTypeBox.addItem("ƴ"); // ChangeTypeBox.addItem("Ż"); // ChangeTypeBox.addItem("ڲ"); @@ -309,6 +434,7 @@ public class QuickChangeForm extends AbstractRendering { // ProductTypecBox.addItem("CRABS"); // ProductTypecBox.addItem("תϵͳ"); // ProductTypecBox.addItem("ϵͳ"); + // // @@ -333,8 +459,7 @@ public class QuickChangeForm extends AbstractRendering { // ErrorTypeBox.addItem("ƽ沼ͼ"); // ErrorTypeBox.addItem(""); - // β - DutyDepartmentBox = new JComboBox(); + // ۷ // ۷ String[] Sale_type_stringArrays = session.getPreferenceService().getStringValues("DFL_Form_SalesClassify"); @@ -348,8 +473,6 @@ public class QuickChangeForm extends AbstractRendering { for (int sale_type_number = 0; sale_type_number < Sale_type_stringArrays.length; sale_type_number++) { SalesClassifyBox.addItem(Sale_type_stringArrays[sale_type_number]); } - - // SalesClassifyBox = new JComboBox(); // SalesClassifyBox.addItem(""); // SalesClassifyBox.addItem(""); @@ -362,7 +485,6 @@ public class QuickChangeForm extends AbstractRendering { return; } EmergencyNotifyBox = new JComboBox(); - for (int energency_type_number = 0; energency_type_number < Emergency_type_stringArrays.length; energency_type_number++) { EmergencyNotifyBox.addItem(Emergency_type_stringArrays[energency_type_number]); @@ -381,6 +503,12 @@ public class QuickChangeForm extends AbstractRendering { for (int ProductDepartment_type_number = 0; ProductDepartment_type_number < ProductDepartment_type_stringArrays.length; ProductDepartment_type_number++) { ProductDepartmentBox.addItem(ProductDepartment_type_stringArrays[ProductDepartment_type_number]); } + + DutyDepartmentBox = new JComboBox(); + for (int ProductDepartment_type_number = 0; ProductDepartment_type_number < ProductDepartment_type_stringArrays.length; ProductDepartment_type_number++) { + DutyDepartmentBox.addItem(ProductDepartment_type_stringArrays[ProductDepartment_type_number]); + } + // ͼֽ String[] DrawingChangeType_type_stringArrays = session.getPreferenceService() .getStringValues("DFL_Form_DrawingChangeType"); @@ -394,6 +522,23 @@ public class QuickChangeForm extends AbstractRendering { for (int DrawingChangeType_type_number = 0; DrawingChangeType_type_number < DrawingChangeType_type_stringArrays.length; DrawingChangeType_type_number++) { DrawingChangeTypeBox.addItem(DrawingChangeType_type_stringArrays[DrawingChangeType_type_number]); } + // + changeOfMajorBox = new JComboBox(); + changeOfMajorBox.addItem("е"); + changeOfMajorBox.addItem(""); + changeOfMajorBox.setSelectedItem("е"); + + + //ƹ + String[] manageclassify_stringArrays = session.getPreferenceService().getStringValues("DFL_manageclassify"); + if (manageclassify_stringArrays == null || manageclassify_stringArrays.length <= 0) { + MessageBox.post("ѡDFL_manageclassifyδ,ϵԱ!!", "", MessageBox.ERROR); + return; + } + manageclassifyBox = new JComboBox(); + for(String manageclassifyString : manageclassify_stringArrays) { + manageclassifyBox.addItem(manageclassifyString); + } // Ƿɱʧ String[] IsNotProductLoss_type_stringArrays = session.getPreferenceService() @@ -408,6 +553,28 @@ public class QuickChangeForm extends AbstractRendering { for (int IsNotProductLoss_type_number = 0; IsNotProductLoss_type_number < IsNotProductLoss_type_stringArrays.length; IsNotProductLoss_type_number++) { IsNotProductLossBox.addItem(IsNotProductLoss_type_stringArrays[IsNotProductLoss_type_number]); } + + isNotBuyBox = new JComboBox(); + isNotBuyBox.addItem(""); + isNotBuyBox.addItem(""); + + isNotLayoutInterfaceBox = new JComboBox(); + + isNotLayoutInterfaceBox.addItem(""); + isNotLayoutInterfaceBox.addItem(""); + + isNotChangeInputTypeBox = new JComboBox(); + isNotChangeInputTypeBox.addItem("BOM"); + isNotChangeInputTypeBox.addItem("PID"); + isNotChangeInputTypeBox.addItem("ͼ"); + isNotChangeInputTypeBox.addItem("ͼ"); + isNotChangeInputTypeBox.addItem("ͼ"); + isNotChangeInputTypeBox.addItem("ͼ"); + isNotChangeInputTypeBox.addItem("ͼ"); + isNotChangeInputTypeBox.addItem("Эͼ"); + isNotChangeInputTypeBox.addItem("ͼֽ"); + + changeReasonBox = new JComboBox(); // ϼ÷ String[] ReceiveClassify_type_stringArrays = session.getPreferenceService() @@ -435,6 +602,12 @@ public class QuickChangeForm extends AbstractRendering { WAPYJBox.addItem(WAPYJ_type_stringArrays[WAPYJ_type_number]); } + + itemStateBox = new JComboBox(); + itemStateBox.addItem("δƷ"); + itemStateBox.addItem("Ʒ"); + itemStateBox.addItem("ڿƷ"); + itemStateBox.addItem(""); // String[] ZZYJ_type_stringArrays = session.getPreferenceService() @@ -474,16 +647,11 @@ public class QuickChangeForm extends AbstractRendering { } - // EmergencyNotifyBox = new JComboBox(); - // EmergencyNotifyBox.addItem(""); - // EmergencyNotifyBox.addItem(""); - // EmergencyNotifyBox.addItem("һ"); - // datetime = new JComboBox(); // datetime.addItem(time); TCComponent comp = (TCComponent) targetComp; - // name = comp.getStringProperty("object_name"); + // TCComponentItemRevision comprev = (TCComponentItemRevision) comp ; // applyname = comp.getStringProperty("owning_user"); @@ -491,7 +659,7 @@ public class QuickChangeForm extends AbstractRendering { String applyname = comp.getTCProperty("owning_user").getReferenceValueInString(); // owingname.getStringProperty("user_name"); // .getReferenceValueArray()[0]; - System.out.println("========" + name); + System.out.println("========" + masterName); // System.out.println("========"+applyname); comp.whereReferenced(); @@ -501,25 +669,84 @@ public class QuickChangeForm extends AbstractRendering { if (contex[c].getComponent() instanceof TCComponentItemRevision) { TCComponentItemRevision rev = (TCComponentItemRevision) contex[c].getComponent(); - // rev TCComponentItem item = rev.getItem(); - my_item_id = item.getStringProperty("item_id"); + AIFComponentContext contex1[] = item.whereReferenced(); + for (int i = 0; i < contex1.length; i++) { + InterfaceAIFComponent comp2 = contex1[i].getComponent(); + if (comp2 instanceof TCComponentItemRevision) { + TCComponentItemRevision rev2 = (TCComponentItemRevision) comp2; + if ("T2_ECRRevision".equals(rev2.getType())) { + TCComponent form1 = rev2.getReferenceListProperty("IMAN_master_form_rev")[0]; + name = form1.getStringProperty("object_name"); + } + } + } objname = rev.getStringProperty("object_name"); - name = comp.getStringProperty("object_name"); - clientname = rev.getStringProperty("t2_CustomerName"); - pd = rev.getStringProperty("t2_PD"); - productname = rev.getStringProperty("t2_ProductName"); - productmodel = rev.getStringProperty("t2_ProductModel"); - producttype = rev.getStringProperty("t2_ProductType"); - department = rev.getStringProperty("t2_Department"); - duty = rev.getStringProperty("t2_duty"); - type = rev.getStringProperty("t2_type"); - projectState = rev.getStringProperty("t2_ProjectPhase"); + masterName = comp.getStringProperty("object_name"); + my_item_id = item.getStringProperty("item_id"); + Date date = rev.getDateProperty("creation_date"); + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm"); + applyDate = df.format(date); + + String apply_name = rev.getStringProperty("t2_CustomerName"); + System.out.println("===================" + apply_name); + + // ȡ뵥ţͨŽԴݿȡʾڱ֪ͨ + List applyformlist = getChangeMesg(apply_name); + System.out.println("objectlength" + applyformlist); + + if (applyformlist.size() > 0) { + ChangeOrderBean2 cb = (ChangeOrderBean2) applyformlist.get(applyformlist.size() - 1); + + applyName = cb.getApplyman();// + + applyDate = cb.getApplyDate();//ʱ + ChangeListCode = cb.getChangeCode();// + productType = cb.getProductTypeXh(); //Ʒͺ + clientNae = cb.getClientName();// ͻ + productDepartment = cb.getProductDepart();// Ʒ + warehouseCode = cb.getStorageNum();// + accountSet = cb.getWareHourse();// + dutyDepartment = cb.getDutyDepartment();// β + dutyMan = cb.getDutyMan();// + changeOfMajor = cb.getChangeOfMajor(); + //changeOfMajor.setSelectedItem(cb.getChangeOfMajor());//רҵ + //changeOfMajor = cb.getChangeOfMajor(); + isNotLayoutInterface = cb.getLayoutInterface(); + changeType = cb.getChangeType(); + isNotChangeInputType = cb.getChangeInputType(); + projectCode = cb.getSystemCode();// Ŀ + changeReason = cb.getChangeReason();// ԭ + productType = cb.getProductType();// Ʒ + changeTag = cb.getChangeTag(); // ǩ + receiveClassify = cb.getItemLYLX();// ϼ÷ + isNotBuy = cb.getNeedBuy(); // ǷҪɹ + // String productCode;//Ʒ + priceBooking = cb.getPricePri();// ۸Ԥ + salseClassify = cb.getSaleClass();// ۷ + closeMan = cb.getCloseMan(); //رȷ + reasonDetail = cb.getReasonDetail(); // رȷ + drawingTo = cb.getHandleOpinion();// ͼֽ + needDate = cb.getItemNeedDate();// Ʒ + NotifyEmergencyProcedures = cb.getDegreeOfurgency();// ֪ͨ +// projectModel = cb.getProjectModel();// Ʒͺ +// affectedPart = cb.getAffectedPart();// Ӱ豸/㲿 +// changeType = cb.getChangeType();// +// +// errorType = cb.getErrorType();// + // change;//ϸ +// isNotProductLoss = cb.getIsNotProductLoss();// ǷƷʧ +// TZChangeType = cb.getTZChangeType(); +// SUOSU_productdepartment = cb.getSUOSU_ProductDepartment(); +// projectState = cb.getProjectState(); + } } } - String titleName = name + "ٱ"; + // lcomp + + String titleName = masterName + "֪ͨ"; JLabel titleLable = new JLabel(titleName); titleLable.setFont(new Font("", 1, 16)); @@ -541,9 +768,114 @@ public class QuickChangeForm extends AbstractRendering { }; model1.combine(new int[] { 8 }, new int[] { 1, 2, 3, 4, 5 }); - model1.combine(new int[] { 9 }, new int[] { 1, 2, 3, 4, 5 }); - model1.combine(new int[] { 10 }, new int[] { 1, 2, 3, 4, 5 }); - model1.combine(new int[] { 6 }, new int[] { 1, 2, 3, 4, 5 }); +// model1.combine(new int[] { 9 }, new int[] { 1, 2, 3, 4, 5 }); +// model1.combine(new int[] { 10 }, new int[] { 1, 2, 3, 4, 5 }); +// model1.combine(new int[] { 6 }, new int[] { 1, 2, 3, 4, 5 }); + model1.addTableModelListener(new TableModelListener() { + + @Override + public void tableChanged(TableModelEvent e) { + // TODO Auto-generated method stub + int column = e.getColumn(); + int firstRow = e.getFirstRow(); + System.out.println("("+firstRow+","+column+")"); + + if(e.getType() == TableModelEvent.UPDATE && column == 1 && firstRow == 2 ){ + System.out.println("wwww"); + String[] stringArray_warehouse = ((TCSession) app.getSession()).getPreferenceService() + .getStringValues("DFL_Form_WarehouseCode"); + String warehouse = ""; + String hourseNum = "01"; + String valueAt = (String)model1.getValueAt(firstRow, column); + if(null == valueAt) { + return; + } + for (int z = 0; z < stringArray_warehouse.length; z++) { + String value = stringArray_warehouse[z]; + String groupn = value.split(":")[0]; + + if (valueAt.contains(groupn)) { + warehouse = value.split(":")[1]; + table1.setValueAt(warehouse, 2, 3); +// table1.setValueAt(hourseNum, 2, 5); + } + } + } + + if(column == 1 && firstRow == 1 ) { + + String deviceNumber = (String) table1.getValueAt(column, firstRow); + System.out.println("=>deviceNumber"+deviceNumber); + DataBaseControl2 control2 = new DataBaseControl2("oracle.jdbc.driver.OracleDriver", + "jdbc:oracle:thin:@192.168.1.105:1521:ekp", "ekp", "ekp"); + ResultSet dbQuery = control2.dbQuery("select rownum,a.fd_359a8ba984efb6 as 豸,fd_359782e5fc5f3c as 豸ͺ,b.fd_34A888D23094E4 AS ϵͳĿ,b.FD_35EC81852B443A AS ͻ from ekp_17161e29395832d6d388 a left outer join ekp_17161e29394b49a9e97c b on a.fd_parent_id = b.fd_id where a.fd_359a8ba984efb6 = '"+deviceNumber+"' and rownum = 1 union select rownum,a.fd_359a8ba984efb6 as 豸,fd_359782e5fc5f3c as 豸ͺ,b.fd_34A888D23094E4 AS ϵͳĿ,b.FD_35EC81852B443A AS ͻ from ekp_17161e29395832d6d388 a left outer join ekp_17161e29394b49a9e97c b on a.fd_parent_id = b.fd_id where a.fd_359a8ba984efb6 = '"+deviceNumber+"' and rownum = 1"); + try { + while (dbQuery.next()) { + System.out.println(dbQuery.getString(3)); + table1.setValueAt(dbQuery.getString(3), 1, 3); + System.out.println(dbQuery.getString(4)); + //table1.setValueAt(dbQuery.getString(4), 4, 5); + table1.setValueAt(dbQuery.getString(4), 5, 1); + System.out.println(dbQuery.getString(5)); + table1.setValueAt(dbQuery.getString(5), 1, 5); + } + } catch (SQLException e1) { + // TODO Auto-generated catch block + control2.closeDataBase(); + e1.printStackTrace(); + } + control2.closeDataBase(); + } + + // ʮһеڶ + + // System.out.println("ʮһеڶݱ仯"); + if(table1.getValueAt(10, 1) != null) { + String value = table1.getValueAt(10, 1).toString(); + if(value.length()>10) { + MessageBox.post("ȱС10","ʾ",MessageBox.INFORMATION); + table1.setValueAt("", 10, 1); + return; + } + } + + if(column == 1 && firstRow == 1 ) { + + String deviceNumber = (String) table1.getValueAt(column, firstRow); + System.out.println("=>deviceNumber"+deviceNumber); + if (deviceNumber==null) return; + if(!deviceNumber.startsWith("0") && !deviceNumber.startsWith("C")) { + MessageBox.post("豸ű0ͷCͷ","ʾ",MessageBox.INFORMATION); + table1.setValueAt(null, 1, 1); + return; + } + DataBaseControl2 control2 = new DataBaseControl2("oracle.jdbc.driver.OracleDriver", + "jdbc:oracle:thin:@192.168.1.105:1521:ekp", "ekp", "ekp"); + ResultSet dbQuery = control2.dbQuery("select rownum,a.fd_359a8ba984efb6 as 豸,fd_359782e5fc5f3c as 豸ͺ,b.fd_34A888D23094E4 AS ϵͳĿ,b.FD_35EC81852B443A AS ͻ from ekp_17161e29395832d6d388 a left outer join ekp_17161e29394b49a9e97c b on a.fd_parent_id = b.fd_id where a.fd_359a8ba984efb6 = '"+deviceNumber+"' and rownum = 1 union select rownum,a.fd_359a8ba984efb6 as 豸,fd_359782e5fc5f3c as 豸ͺ,b.fd_34A888D23094E4 AS ϵͳĿ,b.FD_35EC81852B443A AS ͻ from ekp_17161e29395832d6d388 a left outer join ekp_17161e29394b49a9e97c b on a.fd_parent_id = b.fd_id where a.fd_359a8ba984efb6 = '"+deviceNumber+"' and rownum = 1"); + try { + while (dbQuery.next()) { + System.out.println(dbQuery.getString(3)); + table1.setValueAt(dbQuery.getString(3), 1, 3); + System.out.println(dbQuery.getString(4)); + //table1.setValueAt(dbQuery.getString(4), 4, 5); + table1.setValueAt(dbQuery.getString(4), 5, 1); + System.out.println(dbQuery.getString(5)); + table1.setValueAt(dbQuery.getString(5), 1, 5); + } + } catch (SQLException e1) { + // TODO Auto-generated catch block + control2.closeDataBase(); + e1.printStackTrace(); + } + control2.closeDataBase(); + } + //޸ĺ󣬱ԭ + if(firstRow == 4 && column == 1) { + table1.setValueAt("", 5, 1); + } + + } + }); table1 = new CTable(model1) { @Override @@ -563,15 +895,13 @@ public class QuickChangeForm extends AbstractRendering { return false; } + if (column == 0 && row == 10) { return false; } -// if (column == 1 && row == 8) { -// return false; -// -// } + // if (column == 5 && row == 7) { // return false; // @@ -581,6 +911,7 @@ public class QuickChangeForm extends AbstractRendering { // // } + return true; } @@ -600,22 +931,26 @@ public class QuickChangeForm extends AbstractRendering { table1.setValueAt("", 0, 0); table1.setValueAt(applyname, 0, 1); - table1.setValueAt("ٱ", 0, 2); + table1.setValueAt("֪ͨ", 0, 2); table1.setValueAt(my_item_id, 0, 3); table1.setValueAt("ʱ", 0, 4); + table1.setValueAt(applyDate, 0, 5); + + table1.setValueAt("", 9, 2); + table1.setValueAt(needDate, 9, 3); - table1.setValueAt("Ʒ", 1, 0); - table1.setValueAt(productname, 1, 1); + table1.setValueAt("豸*", 1, 0); + table1.setValueAt(productName, 1, 1); table1.setValueAt("Ʒͺ", 1, 2); - table1.setValueAt(productmodel, 1, 3); + table1.setValueAt(projectModel, 1, 3); - table1.setValueAt("ͻ", 1, 4); + table1.setValueAt("ͻ*", 1, 4); + table1.setValueAt(clientNae, 1, 5); - table1.setValueAt(clientname, 1, 5); + table1.setValueAt("ֿ", 2, 2);// - table1.setValueAt("ֿ", 2, 0);// String[] stringArray_warehouse = ((TCSession) app.getSession()).getPreferenceService() .getStringValues("DFL_Form_WarehouseCode"); String warehouse = ""; @@ -627,165 +962,158 @@ public class QuickChangeForm extends AbstractRendering { warehouse = value.split(":")[1]; } } - table1.setValueAt(warehouse, 2, 1); - - table1.setValueAt("̶֪ͨ", 2, 2); + table1.setValueAt(warehouse, 2, 3); - table1.setValueAt("ͼֽ", 2, 4); + table1.setValueAt("̶֪ͨ", 9, 4); + table1.setValueAt(NotifyEmergencyProcedures, 9, 5); + + table1.setValueAt("ؼ(ʮ)", 10, 0); + table1.setValueAt(pkeyword, 10, 1); + + table1.setValueAt("ƹ", 10, 2); + table1.setValueAt(manageclassify, 10, 3); + + table1.setValueAt("kk", 10, 4); + table1.setValueAt(kkcode, 10, 5); + + table1.setValueAt("ǩ", 6, 0); + table1.setValueAt(changeTag, 6, 1); + + table1.setValueAt("۸Ԥ(λ:Ԫ)*", 7, 0); + table1.setValueAt(pricePri, 7, 1); + + table1.setValueAt("رȷ", 7, 4); + table1.setValueAt(closeMan, 7, 5); + + table1.setValueAt("ԭ*", 8, 0); + table1.setValueAt(reasonDetail, 8, 1); - table1.setValueAt("Ʒ", 3, 0); + table1.setValueAt("Ʒ*", 2, 0); table1.setValueAt(groupname, 3, 1); - table1.setValueAt("β", 3, 2); - table1.setValueAt(department, 3, 3); - - table1.setValueAt("", 3, 4); - table1.setValueAt(duty, 3, 5); - - table1.setValueAt("", 4, 0); - table1.setValueAt("Ʒ", 4, 2); - table1.setValueAt(producttype, 4, 3); + table1.setValueAt("β", 3, 0); + table1.setValueAt(dutyDepartment, 3, 1); - table1.setValueAt("", 4, 4); - - table1.setValueAt("۸Ԥ", 5, 0);// - table1.setValueAt("۷", 5, 2); - table1.setValueAt(type, 5, 3); + table1.setValueAt("*", 3, 2); + table1.setValueAt(dutyMan, 3, 3); + + table1.setValueAt("רҵ*", 3, 4); + table1.setValueAt(changeOfMajor, 3, 5); + + table1.setValueAt("ǷӰ첼ֽӿ*", 4, 0); + table1.setValueAt(isNotLayoutInterface, 4, 1); - table1.setValueAt("Ƿɱʧ", 5, 4); + table1.setValueAt("*", 4, 2); + table1.setValueAt(changeType, 4, 3); - // table1.setValueAt("Ʒ", 6, 0);// - // table1.setValueAt(pd, 6, 1);// + table1.setValueAt("*", 4, 4); + table1.setValueAt(isNotChangeInputType, 4, 5); + + table1.setValueAt("Ʒ*", 5, 4); + table1.setValueAt(productType, 5, 5); - table1.setValueAt("Ӱ豸㲿", 6, 0); + table1.setValueAt("۷", 7, 2); + table1.setValueAt(salseClassify, 7, 3); - table1.setValueAt("Ŀ׶", 7, 0); - table1.setValueAt(projectState, 7, 1); + table1.setValueAt("ϼ÷", 6, 2); + table1.setValueAt(receiveClassify, 6, 3) ; + + table1.setValueAt("ǷҪɹ*", 6, 4); + table1.setValueAt(isNotBuy, 6, 5); - table1.setValueAt("ϼ÷", 7, 2); - table1.setValueAt("ͼֽ", 7, 4); + table1.setValueAt("ͼֽ", 9, 0); + table1.setValueAt(drawingTo, 9, 1); + + - table1.setValueAt("Ŀ", 8, 0); - table1.setValueAt(" ", 8, 1); + table1.setValueAt("Ŀ", 5, 0); + table1.setValueAt(projectCode, 5, 1); - table1.setValueAt("ԭ", 9, 0); - table1.setValueAt("", 9, 1); + table1.setValueAt("ԭ*", 5, 2); + table1.setValueAt(changeReason, 5, 3); - table1.setValueAt("", 10, 0); + table1.setValueAt("", 2, 4);// + String[] stringArray = ((TCSession) app.getSession()).getPreferenceService() .getStringValues("DFL_Form_AccountSet"); String accountSetValue = ""; for (int z = 0; z < stringArray.length; z++) { String value = stringArray[z]; String groupn = value.split(":")[0]; + if (groupname.contains(groupn)) { accountSetValue = value.split(":")[1]; } } - - table1.setValueAt(accountSetValue, 10, 1); + table1.setValueAt(accountSetValue, 2, 5);// // ʾ JTextField showCalenderButten; setValue(); - - JButton btn = new JButton("ѡĿ"); - JButton btn_tzfz = new JButton("ͼֽ"); - - AddTaskListenerQuickChange_TZ aqc = new AddTaskListenerQuickChange_TZ(selfform); - btn_tzfz.addActionListener(aqc); - // projectCode = new JComboBox(); - AddTaskListenerQuickChange aq = new AddTaskListenerQuickChange(this); - btn.addActionListener(aq); - - JButton zt_btn = new JButton("ѡ"); - AccountSetTaskListenerPressureQECN aq1 = new AccountSetTaskListenerPressureQECN(this); - zt_btn.addActionListener(aq1); - -// DateChooser dateChooser1 = DateChooser.getInstance("yyyy-M-d HH:mm"); - + DateChooser dateChooser2 = DateChooser.getInstance("yyyy-MM-dd HH:mm"); - Date date = new Date(); - SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - String time = df.format(date); - - // JComboBox timebox = new JComboBox(); - // timebox.addItem(time); - JTextField showDate1 = new JTextField(time); + DateChooser dateChooser3 = DateChooser.getInstance("yyyy-MM-dd"); + JTextField showDate1 = new JTextField(applyDate); showDate1.setEditable(false); + JTextField showDate2 = new JTextField(needDate); + showDate2.setEditable(false); dateChooser2.register(showDate1); + dateChooser3.register(showDate2); table1.setCombo(0, 5, new DefaultCellEditor(showDate1)); + table1.setCombo(9, 3, new DefaultCellEditor(showDate2)); + JButton btn = new JButton("ѡĿ"); + JButton btn_tzfz = new JButton("ͼֽ"); + AddTaskListenerQuickChange_TZ ant = new AddTaskListenerQuickChange_TZ(selfform); + btn_tzfz.addActionListener(ant); + AddTaskListenerQuickChange an = new AddTaskListenerQuickChange(this); + btn.addActionListener(an); - // table1.setValueAt(showCalenderButten.getText(),0, 5); - // - // - // showDate2 = new JTextField(time); - // dateChooser1.register(showDate1); - // dateChooser2.register(showDate2); - - // MyThread myThread=new MyThread(); - // myThread.start(); - // boolean flag = true; - // while(flag) { - // if(myThread.isAlive()==false) { - // List ll = new ArrayList(); - // ll = getselectTime(); - // if(ll.size()>0) { - // DateBean dbs=(DateBean) ll.get(ll.size()-1); - // table1.setValueAt(dbs.getDate(),0, 5); - // del_date(); - // flag = false; - // } - // } - // - // } - - // String[] keys = new String[] { "ID" }; - // TCComponentUser user = session.getUser(); - // String user_id = user.getStringProperty("user_id"); - // String[] values = new String[] { user_id }; - // List compList = queryObject("ûĿ", keys, values); - // if (compList != null && compList.size() > 0) { - // for (int i = 0; i < compList.size(); i++) { - // TCComponent comp1 = compList.get(i); - // if (comp1 instanceof TCComponentProject) { - // TCComponentProject project = (TCComponentProject) comp1; - // try { - // String id = project.getStringProperty("project_id"); - // projectCode.addItem(id); - // } catch (TCException e1) { - // // TODO Auto-generated catch block - // e1.printStackTrace(); - // } - // } - // } - // } + JButton zt_btn = new JButton("ѡ"); + AccountSetTaskListenerPressureQECN an1 = new AccountSetTaskListenerPressureQECN(this); + zt_btn.addActionListener(an1); // - table1.setCombo(4, 1, new DefaultCellEditor(ChangeTypeBox)); + table1.setCombo(4, 3, new DefaultCellEditor(ChangeTypeBox)); + // ǩ + table1.setCombo(6, 1, new DefaultCellEditor(changeTagBox)); // Ʒ - table1.setCombo(4, 3, new DefaultCellEditor(ProductTypecBox)); + table1.setCombo(5, 5, new DefaultCellEditor(ProductTypecBox)); // - table1.setCombo(4, 5, new DefaultCellEditor(ErrorTypeBox)); +// table1.setCombo(4, 5, new DefaultCellEditor(ErrorTypeBox)); // ۷ - table1.setCombo(5, 3, new DefaultCellEditor(SalesClassifyBox)); + table1.setCombo(7, 3, new DefaultCellEditor(SalesClassifyBox)); // β - // table1.setCombo(3,3,new DefaultCellEditor(DutyDepartmentBox)); + table1.setCombo(3,1,new DefaultCellEditor(DutyDepartmentBox)); // ̶֪ͨ - table1.setCombo(2, 3, new DefaultCellEditor(EmergencyNotifyBox)); + table1.setCombo(9, 5, new DefaultCellEditor(EmergencyNotifyBox)); // ʱ + + // table1.setCombo(0,5,new DefaultCellEditor(datetime)); // Ʒ - table1.setCombo(3, 1, new DefaultCellEditor(ProductDepartmentBox)); + table1.setCombo(2, 1, new DefaultCellEditor(ProductDepartmentBox)); // ͼֽ - table1.setCombo(2, 5, new DefaultCellEditor(DrawingChangeTypeBox)); +// table1.setCombo(2, 5, new DefaultCellEditor(DrawingChangeTypeBox)); // Ƿɱʧ - table1.setCombo(5, 5, new DefaultCellEditor(IsNotProductLossBox)); +// table1.setCombo(5, 5, new DefaultCellEditor(IsNotProductLossBox)); + //רҵ + table1.setCombo(3, 5, new DefaultCellEditor(changeOfMajorBox)); + + //Ʒ + table1.setCombo(10, 3, new DefaultCellEditor(manageclassifyBox)); + + //ǷҪɹ + table1.setCombo(6, 5, new DefaultCellEditor(isNotBuyBox)); + //ǷӰ첼ֽӿ + table1.setCombo(4, 1, new DefaultCellEditor(isNotLayoutInterfaceBox)); + // + table1.setCombo(4, 5, new DefaultCellEditor(isNotChangeInputTypeBox)); + //ԭ + table1.setCombo(5, 3, new DefaultCellEditor(changeReasonBox)); // ϼ÷ - table1.setCombo(7, 3, new DefaultCellEditor(ReceiveClassifyBox)); - // table1.setCombo(0,5,new DefaultCellEditor(datetime)); + table1.setCombo(6, 3, new DefaultCellEditor(ReceiveClassifyBox)); + // table1.setCombo(8, 1, new DefaultCellEditor(projectCode)); @@ -799,14 +1127,23 @@ public class QuickChangeForm extends AbstractRendering { table1.setRowHeight(50); table1.setRowHeight(9, 100); table1.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); - - model2 = new DefaultTableModel(null, new String[] { "", "Ʒ", "Ʒ", "ԭ汾", "ְ汾", "ԭ", "", "", - "˵", "δƷ", "δƷ", "", "", "", "", "ֿ", "" }) { + + + + + + + + +// { "", "Ʒ", "Ʒ", "ԭ汾", "ְ汾", "ԭ", "", "", +// "˵", "δƷ", "δƷ", "", "", "", "", "ֿ", "" } + model2 = new DefaultTableModel(null, new String[] { " ", "Ʒ", "Ʒ", "汾", "ԭ", "", "", + "˵", "Ͻ׶", "", "", "", "ֿ" }) { + public void setValueAt(Object value, int row, int col) { try { if (row == table2.getSelectedRow() && col == 1) { - System.out.println("ִеλ==============================="); String val = value.toString(); itemType = (TCComponentItemType) session.getTypeComponent("Item"); TCComponentItem item = itemType.find(val); @@ -838,17 +1175,20 @@ public class QuickChangeForm extends AbstractRendering { table2.setValueAt(objectname, table2.getSelectedRow(), 2); table2.setComboCell(table2.getSelectedRow(), 3, new com.connor.dfl.plm.table.MyComboBoxEditor2(rev)); - table2.setComboCell(table2.getSelectedRow(), 4, - new com.connor.dfl.plm.table.MyComboBoxEditor2(rev)); - table2.setComboCell(table2.getSelectedRow(), 10, new DefaultCellEditor(WAPYJBox)); - table2.setComboCell(table2.getSelectedRow(), 12, new DefaultCellEditor(ZZYJBox)); - table2.setComboCell(table2.getSelectedRow(), 14, new DefaultCellEditor(SSYJBox)); - table2.setValueAt(kucun, table2.getSelectedRow(), 15); - table2.setComboCell(table2.getSelectedRow(), 16, new DefaultCellEditor(CLYJBox)); - +// table2.setComboCell(table2.getSelectedRow(), 4, +// new com.connor.dfl.plm.table.MyComboBoxEditor2(rev)); + TextAreaCellEditor textAreaCellEditor = new TextAreaCellEditor(TEXT_MAX_LENGTH); + addMyKeyListener(textAreaCellEditor,table2); + table2.setComboCell(table2.getSelectedRow(), 7, textAreaCellEditor); + table2.setComboCell(table2.getSelectedRow(), 8, new DefaultCellEditor(itemStateBox)); +// table2.setComboCell(table2.getSelectedRow(), 10, new DefaultCellEditor(WAPYJBox)); +// table2.setComboCell(table2.getSelectedRow(), 12, new DefaultCellEditor(ZZYJBox)); +// table2.setComboCell(table2.getSelectedRow(), 14, new DefaultCellEditor(SSYJBox)); +// table2.setValueAt(kucun, table2.getSelectedRow(), 15); + table2.setComboCell(table2.getSelectedRow(), 9, new DefaultCellEditor(CLYJBox)); } else { - javax.swing.JOptionPane.showMessageDialog(null, "ƷƷûа汾", "ϵͳʾ", + javax.swing.JOptionPane.showMessageDialog(null, "ƷƷдûа汾", "ϵͳʾ", javax.swing.JOptionPane.WARNING_MESSAGE); setValueAt("", table2.getSelectedRow(), 2); @@ -864,35 +1204,107 @@ public class QuickChangeForm extends AbstractRendering { fireTableCellUpdated(row, col); } + }; table2 = new MyTable() { @Override public boolean isCellEditable(int row, int column) { - if (column == 0) { + if (column == 0 || column == 6) { return false; } return true; } }; + model2.addTableModelListener(new TableModelListener() { + + @Override + public void tableChanged(TableModelEvent e) { + // TODO Auto-generated method stub + int column = e.getColumn(); + int firstRow = e.getFirstRow(); + System.out.println("("+firstRow+","+column+")"); + int selectedRow = table2.getSelectedRow(); + System.out.println("selectedRow = "+selectedRow); + + if( column == 4) { + if(table2.getValueAt(firstRow, column)!=null && table2.getValueAt(firstRow, column+1)!=null) { + try { +// int ysl = Integer.parseInt(((String) table2.getValueAt(firstRow, column))); +// int xsl = Integer.parseInt(((String) table2.getValueAt(firstRow, column+1))); +// table2.setValueAt(xsl-ysl, firstRow, column+2); + + Float ysl = Float.parseFloat(((String) table2.getValueAt(firstRow, column))); + Float xsl = Float.parseFloat(((String) table2.getValueAt(firstRow, column+1))); +// int ysl = Integer.parseInt(((String) table2.getValueAt(firstRow, column))); +// int xsl = Integer.parseInt(((String) table2.getValueAt(firstRow, column+1))); + BigDecimal b1 = new BigDecimal(ysl.toString()); + + + BigDecimal b2 = new BigDecimal(xsl.toString()); + float ss = b2.subtract(b1).floatValue(); + + table2.setValueAt(ss, firstRow, column+2); + + } catch (Exception e2) { + // TODO: handle exception + e2.printStackTrace(); + MessageBox.post("!","",MessageBox.ERROR); + } + } + }else if(column == 5) { + if(table2.getValueAt(firstRow, column)!=null && table2.getValueAt(firstRow, column-1)!=null) { + try { +// int ysl = Integer.parseInt(((String) table2.getValueAt(firstRow, column-1))); +// int xsl = Integer.parseInt(((String) table2.getValueAt(firstRow, column))); +// table2.setValueAt(xsl-ysl, firstRow, column+1); + Float ysl = Float.parseFloat(((String) table2.getValueAt(firstRow, column-1))); + Float xsl = Float.parseFloat(((String) table2.getValueAt(firstRow, column))); + BigDecimal b1 = new BigDecimal(ysl.toString()); + + + BigDecimal b2 = new BigDecimal(xsl.toString()); + + float ss = b2.subtract(b1).floatValue(); + table2.setValueAt(ss, firstRow, column+1); + } catch (Exception e2) { + // TODO: handle exception + e2.printStackTrace(); + MessageBox.post("!","",MessageBox.ERROR); + } + } + } +// else if(column == 7) { +// String string = table2.getValueAt(selectedRow, column).toString(); +// if(string!=null) { +// int length = string.length(); +// int height = (length%15==0?length/15:length/15+1)*30+20; +// table2.setRowHeight(selectedRow, height); +// System.out.println("õ"+selectedRow+"иΪ"+height); +// } +// } + + } + }); + table2.setModel(model2); - table2.setColumnModel(getColumn(table2, new int[] { 60, 150, 260, 70,70,70,70, 70,260, 90,90,70,70, 70, 70,70,150})); - table2.setRowHeight(50); - tcr = new DefaultTableCellRenderer(); - tcr.setHorizontalAlignment(SwingConstants.CENTER); + tcr = new TableCellTextAreaRenderer(TEXT_MAX_LENGTH); +// tcr.setHorizontalAlignment(SwingConstants.CENTER); table1.setBorder(new LineBorder(Color.BLACK)); table1.setDefaultRenderer(Object.class, tcr); table2.setBorder(new LineBorder(Color.BLACK)); table2.setDefaultRenderer(Object.class, tcr); table2.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + table2.setColumnModel(getColumn(table2, new int[] { 60, 150, 260,70,70,70, 70,260, 90,90,70,70})); + table2.setRowHeight(50); addButton = new JButton(" "); delButton = new JButton(" ɾ "); - List listdetils = getChangeDetail(name); + List listdetils = getChangeDetail(masterName); if (listdetils.size() > 0) { for (int j = 0; j < listdetils.size(); j++) { @@ -903,43 +1315,46 @@ public class QuickChangeForm extends AbstractRendering { // for(int j =0 ;j 6) { int count = rows1 - 6; @@ -974,7 +1389,7 @@ public class QuickChangeForm extends AbstractRendering { for (int j = sRows.length - 1; j >= 0; j--) { String PH = (String) model2.getValueAt(sRows[j], 1); System.out.println("=============Ʒ" + PH); - delChangedetil(name, PH); + delChangedetil(masterName, PH); // Connection con = null; // // String sql = "delete from DFL_CHANGEDETAILS where PH=?"; @@ -1040,25 +1455,6 @@ public class QuickChangeForm extends AbstractRendering { } }); - JPanel tablePanel1 = new JPanel(); - tablePanel1.add(table1); - tablePanel1.setPreferredSize(new Dimension(1600, 700)); - // JPanel showCalendarPanel = new JPanel(); - // showCalendarPanel.add("1.1.left.top",showCalenderButten); - - tablePanel2 = new JScrollPane(table2); - tablePanel2.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); - if (rows1 > 6) { - int count = rows1 - 6; - count = 300 + count * 50; - tablePanel2.setPreferredSize(new Dimension(1600, count)); - } else { - tablePanel2.setPreferredSize(new Dimension(1600, 300)); - } - JPanel buttonPanel = new JPanel(new PropertyLayout()); - buttonPanel.add("1.1.left.top", addButton); - buttonPanel.add("2.1.left.top", delButton); - JPanel buttonPanel0 = new JPanel(new PropertyLayout()); buttonPanel0.add("1.1.left.top", new JLabel(" ")); buttonPanel0.add("2.1.left.top", new JLabel(" ")); @@ -1077,9 +1473,9 @@ public class QuickChangeForm extends AbstractRendering { buttonPanel0.add("15.1.left.top", new JLabel(" ")); buttonPanel0.add("16.1.left.top", btn_tzfz); buttonPanel0.add("17.1.left.top", new JLabel(" ")); - buttonPanel0.add("18.1.left.top", btn); +// buttonPanel0.add("18.1.left.top", new JLabel(" ")); + buttonPanel0.add("18.1.left.top",btn); buttonPanel0.add("19.1.left.top", new JLabel(" ")); - buttonPanel0.add("20.1.left.top", new JLabel(" ")); buttonPanel0.add("21.1.left.top", new JLabel(" ")); buttonPanel0.add("22.1.left.top", zt_btn); @@ -1087,33 +1483,93 @@ public class QuickChangeForm extends AbstractRendering { buttonPanel0.add("24.1.left.top", new JLabel(" ")); buttonPanel0.add("25.1.left.top", new JLabel(" ")); + JPanel tablePanel1 = new JPanel(); + tablePanel1.add(table1); + tablePanel1.setPreferredSize(new Dimension(1600, 700)); + + // JPanel showCalendarPanel = new JPanel(); + // showCalendarPanel.add("1.1.left.top",showCalenderButten); + +// JPanel tablePanel2 = new JPanel(); +// tablePanel2.add(table2); + tablePanel2 = new JScrollPane(table2); + tablePanel2.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); + if (rows1 > 6) { + int count = rows1 - 6; + count = 300 + count * 50; + tablePanel2.setPreferredSize(new Dimension(1600, count)); + } else { + tablePanel2.setPreferredSize(new Dimension(1600, 300)); + } + + JPanel buttonPanel = new JPanel(new PropertyLayout()); + buttonPanel.add("1.1.left.top", addButton); + buttonPanel.add("2.1.left.top", delButton); + JPanel rootPanel = new JPanel(new PropertyLayout()); JLabel detailsLable = new JLabel("ϸ"); detailsLable.setFont(new Font("", 1, 14)); - +// //󻯰ť +// JButton button = new JButton("/ԭ"); +// button.addActionListener(new ActionListener() { +// +// @Override +// public void actionPerformed(ActionEvent e) { +// // TODO Auto-generated method stub +// String tempstr = QuickChangeForm.this.getParent().getParent().getParent().getParent().getParent()!=null?QuickChangeForm.this.getParent().getParent().getParent().getParent().getParent().getClass().toString():""; +// +// if(!"".equals(tempstr)) { +// System.out.println("tempstr:"+tempstr); +// if(tempstr.equals("class com.teamcenter.rac.commands.open.OpenFormDialog")) { +// lastDialog = (OpenFormDialog) QuickChangeForm.this.getParent().getParent().getParent().getParent().getParent(); +// Container container = QuickChangeForm.this.getParent().getParent().getParent().getParent(); +// JFrame frame = new JFrame(); +// frame.add(container); +// frame.pack(); +// frame.setVisible(true); +// }else if(tempstr.equals("class javax.swing.JFrame")) { +// JFrame frame = (JFrame) QuickChangeForm.this.getParent().getParent().getParent().getParent().getParent(); +// Container container = QuickChangeForm.this.getParent().getParent().getParent().getParent(); +// lastDialog.add(container); +// frame.dispose(); +// } +// } +// } +// }); +// rootPanel.add("1.1.center.top", button); rootPanel.add("1.1.center.top", titleLable); rootPanel.add("2.1.left.top", tablePanel1); rootPanel.add("2.2.left.top", buttonPanel0); // rootPanel.add("2.2.left.top",showCalendarPanel); rootPanel.add("3.1.left.top", detailsLable); - JPanel test = new JPanel(new PropertyLayout()); test.add("1.1.left.top", tablePanel2); test.add("1.2.left.top", buttonPanel); JPanel mainPanel = new JPanel(new BorderLayout()); mainPanel.add(rootPanel, BorderLayout.NORTH); - mainPanel.add(test, BorderLayout.WEST); + mainPanel.add(test, BorderLayout.CENTER); + + this.setSize(1600, 800); +// this.setPreferredSize(new Dimension(1600,1000)); - this.setSize(1600, 1300); this.setLayout(new BorderLayout()); scrollPane = new JScrollPane(mainPanel); scrollPane.getVerticalScrollBar().setUnitIncrement(20); +// scrollPane.setPreferredSize(new Dimension(1600, +// 1300)); + scrollPane.setPreferredSize(new Dimension((int) mainPanel.getPreferredSize().getWidth(), + (int) mainPanel.getPreferredSize().getHeight())); +// System.out.println("scWid:"+scrollPane.getPreferredSize().getWidth()); +// System.out.println("scHei:"+scrollPane.getPreferredSize().getHeight()); this.add(scrollPane, BorderLayout.CENTER); this.setBackground(Color.WHITE); +// this.setPreferredSize(new Dimension((int) scrollPane.getPreferredSize().getWidth(), +// (int) scrollPane.getPreferredSize().getHeight())); + this.addComponentListener(new ComponentListener() { @Override @@ -1156,85 +1612,249 @@ public class QuickChangeForm extends AbstractRendering { } }); - this.setVisible(true); + new Thread(new Runnable() { + + @Override + public void run() { + // TODO Auto-generated method stub + do { + if(QuickChangeForm.this.getParent()!=null)break; + else + try { + Thread.sleep(100); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + }while(true); + String tempstr = QuickChangeForm.this.getParent().getParent().getParent().getParent().getParent()!=null?QuickChangeForm.this.getParent().getParent().getParent().getParent().getParent().getClass().toString():""; + + if(!"".equals(tempstr)) { + System.out.println("tempstr:"+tempstr); + if(tempstr.equals("class com.teamcenter.rac.commands.open.OpenFormDialog")) { + lastDialog = (OpenFormDialog) QuickChangeForm.this.getParent().getParent().getParent().getParent().getParent(); + Container container = QuickChangeForm.this.getParent().getParent().getParent().getParent(); + final JFrame frame = new JFrame(); + frame.add(container); + frame.pack(); +// frame.setSize(1600, 1300); + frame.setVisible(true); + lastDialog.setVisible(false); + lastDialog.addWindowListener(new WindowListener() { + + @Override + public void windowOpened(WindowEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void windowIconified(WindowEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void windowDeiconified(WindowEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void windowDeactivated(WindowEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void windowClosing(WindowEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void windowClosed(WindowEvent e) { + // TODO Auto-generated method stub + System.out.println("ڹر"); + frame.dispose(); + } + + @Override + public void windowActivated(WindowEvent e) { + // TODO Auto-generated method stub + + } + }); + } +// else if(tempstr.equals("class javax.swing.JFrame")) { +// JFrame frame = (JFrame) QuickChangeForm.this.getParent().getParent().getParent().getParent().getParent(); +// Container container = QuickChangeForm.this.getParent().getParent().getParent().getParent(); +// lastDialog.add(container); +// frame.dispose(); +// } + } + } + }).start(); } + private void addMyKeyListener(TextAreaCellEditor editor,JTable table) { + editor.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 + + } + + @Override + public void keyPressed(KeyEvent e) { + // TODO Auto-generated method stub + char keyChar = e.getKeyChar(); + if(keyChar == KeyEvent.VK_ENTER) { + (table2.getCellEditor(table2.getSelectedRow(), table2.getSelectedColumn())).stopCellEditing(); + } + } + }); + } + @Override public void saveRendering() { - if(model1.getValueAt(0, 5)==null||model1.getValueAt(4, 1)==null) { - MessageBox.post("ʱΪ","",MessageBox.ERROR); - } - delChangeForm(name); - ChangeOrderBean bn = new ChangeOrderBean(); - bn.setObjectCode(name); - bn.setApplyName(model1.getValueAt(0, 1) == null ? "" : model1.getValueAt(0, 1).toString()); + if("ⲿ-SAT".equals(receiveClassify) || "-".equals(receiveClassify) || "-".equals(receiveClassify)) { + Object valueAt = model1.getValueAt(10, 5); + if(valueAt == null || "".equals(valueAt)) { + MessageBox.post("kkű","",MessageBox.ERROR); + return; + } + } + + if(model1.getValueAt(0, 5)==null || model1.getValueAt(1, 3)==null || model1.getValueAt(1, 5)==null + || model1.getValueAt(5, 5)==null || model1.getValueAt(7, 1)==null || model1.getValueAt(7, 3)==null || model1.getValueAt(8, 1)==null) { + MessageBox.post("ʱ䡢ƷͺšͻơƷ͡۸Ԥ۷ࡢԭΪ","",MessageBox.ERROR); + } + delChangeForm(masterName); + ChangeOrderBean2 bn = new ChangeOrderBean2(); + bn.setApplyman(table1.getValueAt(0, 1).toString()); + System.out.println(table1.getValueAt(0, 1).toString()); + bn.setChangeCode(masterName); bn.setApplyDate(model1.getValueAt(0, 5) == null ? "" : model1.getValueAt(0, 5).toString()); - bn.setProjectCode(model1.getValueAt(8, 1) == null ? "" : model1.getValueAt(8, 1).toString()); - bn.setClientNae(model1.getValueAt(1, 5) == null ? "" : model1.getValueAt(1, 5).toString()); - bn.setProductDepartment(model1.getValueAt(3, 1) == null ? "" : model1.getValueAt(3, 1).toString()); - bn.setProductName(model1.getValueAt(1, 1) == null ? "" : model1.getValueAt(1, 1).toString()); - bn.setProjectModel(model1.getValueAt(1, 3) == null ? "" : model1.getValueAt(1, 3).toString()); - // Ӱ豸 - bn.setAffectedPart(model1.getValueAt(6, 1) == null ? "" : model1.getValueAt(6, 1).toString()); - - bn.setChangeType(model1.getValueAt(4, 1) == null ? "" : model1.getValueAt(4, 1).toString()); - bn.setProductType(model1.getValueAt(4, 3) == null ? "" : model1.getValueAt(4, 3).toString()); - bn.setErrorType(model1.getValueAt(4, 5) == null ? "" : model1.getValueAt(4, 5).toString()); - bn.setDutyDepartment(model1.getValueAt(3, 3) == null ? "" : model1.getValueAt(3, 3).toString()); - bn.setDutyMan(model1.getValueAt(3, 5) == null ? "" : model1.getValueAt(3, 5).toString()); - // ԭ - bn.setChangeReason(model1.getValueAt(9, 1) == null ? "" : model1.getValueAt(9, 1).toString()); - - bn.setSalseClassify(model1.getValueAt(5, 3) == null ? "" : model1.getValueAt(5, 3).toString()); - bn.setPriceBooking(model1.getValueAt(5, 1) == null ? "" : model1.getValueAt(5, 1).toString()); - bn.setIsNotProductLoss(model1.getValueAt(5, 5) == null ? "" : model1.getValueAt(5, 5).toString()); - bn.setReceiveClassify(model1.getValueAt(7, 3) == null ? "" : model1.getValueAt(7, 3).toString()); - bn.setWarehouseCode(model1.getValueAt(2, 1) == null ? "" : model1.getValueAt(2, 1).toString()); - // ̶֪ͨ - bn.setNotifyEmergencyProcedures(model1.getValueAt(2, 3) == null ? "" : model1.getValueAt(2, 3).toString()); - - bn.setDrawingTo(model1.getValueAt(7, 5) == null ? "" : model1.getValueAt(7, 5).toString()); - - bn.setChangeListCode(model1.getValueAt(0, 3) == null ? "" : model1.getValueAt(0, 3).toString()); - bn.setTZChangeType(model1.getValueAt(2, 5) == null ? "" : model1.getValueAt(2, 5).toString()); - - bn.setSUOSU_ProductDepartment(""); - // model1.getValueAt(6, 1) == null ? "" :model1.getValueAt(6, 1).toString() - - // ˾ - bn.setAccountSet(model1.getValueAt(10, 1) == null ? "" : model1.getValueAt(10, 1).toString()); - - bn.setProjectState(model1.getValueAt(7, 1) == null ? "" : model1.getValueAt(7, 1).toString()); - insertMes(bn); + bn.setProductCode(model1.getValueAt(1, 1) == null ? "" : model1.getValueAt(1, 1).toString()); + bn.setProductTypeXh(model1.getValueAt(1, 3) == null ? "" : model1.getValueAt(1, 3).toString()); + bn.setClientName(model1.getValueAt(1, 5) == null ? "" : model1.getValueAt(1, 5).toString()); + bn.setProductDepart(model1.getValueAt(2, 1) == null ? "" : model1.getValueAt(2, 1).toString()); + bn.setStorageNum(model1.getValueAt(2, 3) == null ? "" : model1.getValueAt(2, 3).toString()); + bn.setWareHourse(model1.getValueAt(2, 5) == null ? "" : model1.getValueAt(2, 5).toString()); + bn.setDutyDepartment(model1.getValueAt(3, 1) == null ? "" : model1.getValueAt(3, 1).toString()); + bn.setDutyMan(model1.getValueAt(3, 3) == null ? "" : model1.getValueAt(3, 3).toString()); + bn.setChangeOfMajor(model1.getValueAt(3, 5) == null ? "" : model1.getValueAt(3, 5).toString()); + + bn.setLayoutInterface(model1.getValueAt(4,1) == null ? "" : model1.getValueAt(4, 1).toString()); + bn.setChangeType(model1.getValueAt(4, 3) == null ? "" : model1.getValueAt(4, 3).toString()); + bn.setChangeInputType(model1.getValueAt(4, 5) == null ? "" : model1.getValueAt(4, 5).toString()); + bn.setSystemCode(model1.getValueAt(5, 1) == null ? "" : model1.getValueAt(5, 1).toString()); + bn.setChangeReason(model1.getValueAt(5, 3) == null ? "" : model1.getValueAt(5, 3).toString()); + bn.setProductType(model1.getValueAt(5, 5) == null ? "" : model1.getValueAt(5, 5).toString()); + bn.setChangeTag(model1.getValueAt(6, 1) == null ? "" : model1.getValueAt(6, 1).toString()); + bn.setItemLYLX(model1.getValueAt(6, 3) == null ? "" : model1.getValueAt(6, 3).toString()); + bn.setNeedBuy(model1.getValueAt(6, 5) == null ? "" : model1.getValueAt(6, 5).toString()); + bn.setPricePri(model1.getValueAt(7, 1) == null ? "" : model1.getValueAt(7, 1).toString()); + bn.setSaleClass(model1.getValueAt(7, 3) == null ? "" : model1.getValueAt(7, 3).toString()); + bn.setCloseMan(model1.getValueAt(7, 5) == null ? "" : model1.getValueAt(7, 5).toString()); + bn.setReasonDetail(model1.getValueAt(8, 1) == null ? "" : model1.getValueAt(8, 1).toString()); + bn.setHandleOpinion(model1.getValueAt(9, 1) == null ? "" : model1.getValueAt(9, 1).toString()); + bn.setItemNeedDate(model1.getValueAt(9, 3) == null ? "" : model1.getValueAt(9, 3).toString()); + bn.setDegreeOfurgency(model1.getValueAt(9, 5) == null ? "" : model1.getValueAt(9, 5).toString()); + bn.setPkeyword(model1.getValueAt(10, 1) == null ? "" : model1.getValueAt(10, 1).toString()); + bn.setManageclassify(model1.getValueAt(10, 3) == null ? "" : model1.getValueAt(10, 3).toString()); + bn.setKkcode(model1.getValueAt(10, 5) == null ? "" : model1.getValueAt(10, 5).toString()); +// bn.setApplyName(model1.getValueAt(0, 1) == null ? "" : model1.getValueAt(0, 1).toString()); +// bn.setApplyDate(model1.getValueAt(0, 5) == null ? "" : model1.getValueAt(0, 5).toString()); +// bn.setProjectCode(model1.getValueAt(4, 5) == null ? "" : model1.getValueAt(4, 5).toString()); +// bn.setClientNae(model1.getValueAt(1, 5) == null ? "" : model1.getValueAt(1, 5).toString()); +// bn.setProductDepartment(model1.getValueAt(2, 1) == null ? "" : model1.getValueAt(2, 1).toString()); +//// bn.setProductName(model1.getValueAt(1, 1) == null ? "" : model1.getValueAt(1, 1).toString()); +// bn.setProjectModel(model1.getValueAt(1, 3) == null ? "" : model1.getValueAt(1, 3).toString()); +// // Ӱ豸 +// bn.setAffectedPart(model1.getValueAt(6, 1) == null ? "" : model1.getValueAt(6, 1).toString()); +// +// bn.setChangeType(model1.getValueAt(4, 1) == null ? "" : model1.getValueAt(4, 1).toString()); +// bn.setProductType(model1.getValueAt(4, 3) == null ? "" : model1.getValueAt(4, 3).toString()); +// bn.setErrorType(model1.getValueAt(4, 5) == null ? "" : model1.getValueAt(4, 5).toString()); +// bn.setDutyDepartment(model1.getValueAt(3, 3) == null ? "" : model1.getValueAt(3, 3).toString()); +// bn.setDutyMan(model1.getValueAt(3, 5) == null ? "" : model1.getValueAt(3, 5).toString()); +// // ԭ +// bn.setChangeReason(model1.getValueAt(9, 1) == null ? "" : model1.getValueAt(9, 1).toString()); +// +// bn.setSalseClassify(model1.getValueAt(5, 3) == null ? "" : model1.getValueAt(5, 3).toString()); +// bn.setPriceBooking(model1.getValueAt(5, 1) == null ? "" : model1.getValueAt(5, 1).toString()); +// bn.setIsNotProductLoss(model1.getValueAt(5, 5) == null ? "" : model1.getValueAt(5, 5).toString()); +// bn.setReceiveClassify(model1.getValueAt(7, 3) == null ? "" : model1.getValueAt(7, 3).toString()); +// bn.setWarehouseCode(model1.getValueAt(2, 1) == null ? "" : model1.getValueAt(2, 1).toString()); +// // ̶֪ͨ +// bn.setNotifyEmergencyProcedures(model1.getValueAt(2, 3) == null ? "" : model1.getValueAt(2, 3).toString()); +// +// bn.setDrawingTo(model1.getValueAt(7, 5) == null ? "" : model1.getValueAt(7, 5).toString()); +// +// bn.setChangeListCode(model1.getValueAt(0, 3) == null ? "" : model1.getValueAt(0, 3).toString()); +// bn.setTZChangeType(model1.getValueAt(2, 5) == null ? "" : model1.getValueAt(2, 5).toString()); +// +// bn.setSUOSU_ProductDepartment(""); +// // model1.getValueAt(6, 1) == null ? "" :model1.getValueAt(6, 1).toString() +// +// // ˾ +// bn.setAccountSet(model1.getValueAt(10, 1) == null ? "" : model1.getValueAt(10, 1).toString()); +// +// bn.setProjectState(model1.getValueAt(7, 1) == null ? "" : model1.getValueAt(7, 1).toString()); + insertMes2(bn); // =================================================================== - delAllChangedetil(name); + delAllChangedetil(masterName); for (int cdss = 0; cdss < table2.getRowCount(); cdss++) { - changedeList.add(new ChangeDetils()); + changedeList.add(new ChangeDetails2()); } List changedetials = new ArrayList(); // for (int k = 0; k < table2.getRowCount(); k++) { ChangeDetils cds = new ChangeDetils(); - changedeList.get(k).setObjectCode(name); - changedeList.get(k).setPH(model2.getValueAt(k, 1) == null ? "" : model2.getValueAt(k, 1).toString()); - changedeList.get(k).setPM(model2.getValueAt(k, 2) == null ? "" : model2.getValueAt(k, 2).toString()); - changedeList.get(k).setYBB(model2.getValueAt(k, 3) == null ? "" : model2.getValueAt(k, 3).toString()); - changedeList.get(k).setXBB(model2.getValueAt(k, 4) == null ? "" : model2.getValueAt(k, 4).toString()); - changedeList.get(k).setYSL(model2.getValueAt(k, 5) == null ? "" : model2.getValueAt(k, 5).toString()); - changedeList.get(k).setXSL(model2.getValueAt(k, 6) == null ? "" : model2.getValueAt(k, 6).toString()); - changedeList.get(k).setBGSL(model2.getValueAt(k, 7) == null ? "" : model2.getValueAt(k, 7).toString()); - changedeList.get(k).setGGSM(model2.getValueAt(k, 8) == null ? "" : model2.getValueAt(k, 8).toString()); - changedeList.get(k).setWZPSL(model2.getValueAt(k, 9) == null ? "" : model2.getValueAt(k, 9).toString()); - changedeList.get(k).setWZPUJ(model2.getValueAt(k, 10) == null ? "" : model2.getValueAt(k, 10).toString()); - changedeList.get(k).setZZSL(model2.getValueAt(k, 11) == null ? "" : model2.getValueAt(k, 11).toString()); - changedeList.get(k).setZZYJ(model2.getValueAt(k, 12) == null ? "" : model2.getValueAt(k, 12).toString()); - changedeList.get(k).setSCSL(model2.getValueAt(k, 13) == null ? "" : model2.getValueAt(k, 13).toString()); - changedeList.get(k).setSSYJ(model2.getValueAt(k, 14) == null ? "" : model2.getValueAt(k, 14).toString()); - changedeList.get(k).setCKSL(model2.getValueAt(k, 15) == null ? "" : model2.getValueAt(k, 15).toString()); - changedeList.get(k).setCLYJ(model2.getValueAt(k, 16) == null ? "" : model2.getValueAt(k, 16).toString()); + changedeList.get(k).setObjectCode(masterName); + changedeList.get(k).setOrder(model2.getValueAt(k, 0) == null ? "" : model2.getValueAt(k, 0).toString()); + changedeList.get(k).setItemCode(model2.getValueAt(k, 1) == null ? "" : model2.getValueAt(k, 1).toString()); + changedeList.get(k).setItemName(model2.getValueAt(k, 2) == null ? "" : model2.getValueAt(k, 2).toString()); + changedeList.get(k).setRevNum(model2.getValueAt(k, 3) == null ? "" : model2.getValueAt(k, 3).toString()); +// changedeList.get(k).setRevNow(model2.getValueAt(k, 4) == null ? "" : model2.getValueAt(k, 4).toString()); + changedeList.get(k).setProtolNum(model2.getValueAt(k, 4) == null ? "" : model2.getValueAt(k, 4).toString()); + changedeList.get(k).setNowNum(model2.getValueAt(k, 5) == null ? "" : model2.getValueAt(k, 5).toString()); + changedeList.get(k).setChangeNum(model2.getValueAt(k, 6) == null ? "" : model2.getValueAt(k, 6).toString()); + changedeList.get(k).setChangeInroduct(model2.getValueAt(k, 7) == null ? "" : model2.getValueAt(k, 7).toString()); + changedeList.get(k).setItemState(model2.getValueAt(k, 8) == null ? "" : model2.getValueAt(k, 8).toString()); + changedeList.get(k).setHandleOpinion(model2.getValueAt(k, 9) == null ? "" : model2.getValueAt(k, 9).toString()); + changedeList.get(k).setProductingNum(model2.getValueAt(k, 10) == null ? "" : model2.getValueAt(k, 10).toString()); + changedeList.get(k).setProductNum(model2.getValueAt(k, 11) == null ? "" : model2.getValueAt(k, 11).toString()); + changedeList.get(k).setStorageNum(model2.getValueAt(k, 12) == null ? "" : model2.getValueAt(k, 12).toString()); + +// changedeList.get(k).setPH(model2.getValueAt(k, 1) == null ? "" : model2.getValueAt(k, 1).toString()); +// changedeList.get(k).setPM(model2.getValueAt(k, 2) == null ? "" : model2.getValueAt(k, 2).toString()); +// changedeList.get(k).setYBB(model2.getValueAt(k, 3) == null ? "" : model2.getValueAt(k, 3).toString()); +// changedeList.get(k).setXBB(model2.getValueAt(k, 4) == null ? "" : model2.getValueAt(k, 4).toString()); +// changedeList.get(k).setYSL(model2.getValueAt(k, 5) == null ? "" : model2.getValueAt(k, 5).toString()); +// changedeList.get(k).setXSL(model2.getValueAt(k, 6) == null ? "" : model2.getValueAt(k, 6).toString()); +// changedeList.get(k).setBGSL(model2.getValueAt(k, 7) == null ? "" : model2.getValueAt(k, 7).toString()); +// changedeList.get(k).setGGSM(model2.getValueAt(k, 8) == null ? "" : model2.getValueAt(k, 8).toString()); +// changedeList.get(k).setWZPSL(model2.getValueAt(k, 9) == null ? "" : model2.getValueAt(k, 9).toString()); +// changedeList.get(k).setWZPUJ(model2.getValueAt(k, 10) == null ? "" : model2.getValueAt(k, 10).toString()); +// changedeList.get(k).setZZSL(model2.getValueAt(k, 11) == null ? "" : model2.getValueAt(k, 11).toString()); +// changedeList.get(k).setZZYJ(model2.getValueAt(k, 12) == null ? "" : model2.getValueAt(k, 12).toString()); +// changedeList.get(k).setSCSL(model2.getValueAt(k, 13) == null ? "" : model2.getValueAt(k, 13).toString()); +// changedeList.get(k).setSSYJ(model2.getValueAt(k, 14) == null ? "" : model2.getValueAt(k, 14).toString()); +// changedeList.get(k).setCKSL(model2.getValueAt(k, 15) == null ? "" : model2.getValueAt(k, 15).toString()); +// changedeList.get(k).setCLYJ(model2.getValueAt(k, 16) == null ? "" : model2.getValueAt(k, 16).toString()); changedetials.add(changedeList.get(k)); } @@ -1243,13 +1863,13 @@ public class QuickChangeForm extends AbstractRendering { insertChangeDetailsMes(changedeList.get(l)); } + changeRevProperty(bn); updateExcelAtRev(); } private void updateExcelAtRev() { - System.out.println("λ1"); - List changeDetail = getChangeDetail(name); - List changeMesg = getChangeMesg(name); + List changeDetail = getChangeDetail(masterName); + List changeMesg = getChangeMesg(masterName); // ݼ 1: 2: 3: try { @@ -1263,25 +1883,26 @@ public class QuickChangeForm extends AbstractRendering { rev = (TCComponentItemRevision) component2; } } - + System.out.println("Ƿݼ"+rev != null); if (rev != null) { String as1[] = { "C:\\test\\"+my_item_id+"-"+objname+".xlsx" }; String as2[] = { "excel" }; TCComponentDatasetType tccomponentDatasetType = (TCComponentDatasetType) session .getTypeComponent("MSExcelX"); - TCComponentDataset tccomponentDataset = tccomponentDatasetType.create(name + "-"+objname, "", "MSExcelX"); + TCComponentDataset tccomponentDataset = tccomponentDatasetType.create(masterName + "-"+objname, "", + "MSExcelX"); tccomponentDataset.setFiles(as1, as2); // ϴݼļ TCComponent[] referenceListProperty = rev.getReferenceListProperty("IMAN_specification"); - if (referenceListProperty != null && referenceListProperty.length != 0) { - for (TCComponent comp2 : referenceListProperty) { - if (comp2 instanceof TCComponentDataset) { - TCComponentDataset ds = (TCComponentDataset) comp2; - if (ds.getStringProperty("object_name").equals(name + "-"+objname)) { + if(referenceListProperty!=null&&referenceListProperty.length!=0) { + for(TCComponent comp2:referenceListProperty) { + if(comp2 instanceof TCComponentDataset) { + TCComponentDataset ds = (TCComponentDataset)comp2; +// if(ds.getStringProperty("object_name").equals(masterName+"-"+objname)) { ds.setFiles(as1, as2); - } +// } } } - } else { + }else { rev.add("IMAN_specification", tccomponentDataset); } } @@ -1337,8 +1958,8 @@ public class QuickChangeForm extends AbstractRendering { } } return flag; - } - + } + /** * excel * @@ -1352,8 +1973,8 @@ public class QuickChangeForm extends AbstractRendering { * @throws FileNotFoundException * @author xinhy */ - private void create(String filepath, String filename, List changeMesg, - List changeDetils, String model) throws IOException, FileNotFoundException { + private void create(String filepath, String filename, List changeMesg, + List changeDetils, String model) throws IOException, FileNotFoundException { // ļģ InputStream modeFile = ChangeNotifyForm.class.getResourceAsStream(model); // XSSFWorkbook(excelĵ) @@ -1364,159 +1985,187 @@ public class QuickChangeForm extends AbstractRendering { // XSSFCell cell1 = row1.getCell(0); // XSSFCellStyle style = cell1.getCellStyle(); if (changeMesg != null && changeMesg.size() > 0) { - ChangeOrderBean cob = changeMesg.get(0); - String sqr = cob.getApplyName(); + ChangeOrderBean2 cob = changeMesg.get(0); + System.out.println("cob=>"+cob); + String sqr = cob.getApplyman(); String sqsj = cob.getApplyDate(); - String xmbh = cob.getProjectCode(); - String khmc = cob.getClientNae(); - String cpbm = cob.getProductDepartment(); - String cpmc = cob.getProductName(); - String cpxh = cob.getProjectModel(); + String xmbh = cob.getSystemCode(); + String khmc = cob.getClientName(); + String cpbm = cob.getProductDepart(); + String cpbh = cob.getProductCode(); + String cpxh = cob.getProductTypeXh(); String gglx = cob.getChangeType(); - String cplx = cob.getProductType(); - String tzgglx = cob.getTZChangeType(); - String cwlx = cob.getErrorType(); + String bgsclx = cob.getChangeInputType(); String zrbm = cob.getDutyDepartment(); String zrr = cob.getDutyMan(); + String bgzy = cob.getChangeOfMajor(); + String pkeyword2 = cob.getPkeyword(); + String manageclassify2 = cob.getManageclassify(); + String kkcode2 = cob.getKkcode(); String ggyy = cob.getChangeReason(); - String ssfl = cob.getSalseClassify(); - String jgyg = cob.getPriceBooking(); - String sfcscbss = cob.getIsNotProductLoss(); - String ljlyfl = cob.getReceiveClassify(); - String ckbh = cob.getWarehouseCode(); - String zt = cob.getAccountSet(); - String tzjjcd = cob.getNotifyEmergencyProcedures(); - String tzfz = cob.getDrawingTo(); - String syxdsbhlbj = cob.getAffectedPart(); - String xmjd = cob.getProjectState(); - String bgtzdh = cob.getChangeListCode(); + String ckbh = cob.getStorageNum(); + String zt = cob.getWareHourse(); + String bgtzdh = cob.getChangeCode(); + String sfyxbjjk = cob.getLayoutInterface(); + String bgyy = cob.getChangeReason(); + String cplx = cob.getProductType(); + String bgbq = cob.getChangeTag(); + String wlfl = cob.getItemLYLX(); + String sfxycg = cob.getNeedBuy(); + String jtyy = cob.getReasonDetail(); + String wlxqrq = cob.getItemNeedDate(); + String tzjjcd = cob.getDegreeOfurgency(); + String jgyg = cob.getPricePri(); + String xsfl = cob.getSaleClass(); + String gbqrr = cob.getCloseMan(); + String tzfsz = cob.getHandleOpinion(); + + XSSFRow row = sheet.getRow(0); XSSFCell cell = row.getCell(0); - XSSFRichTextString richTextString = new XSSFRichTextString(name + "-"+objname); + XSSFRichTextString richTextString = new XSSFRichTextString(masterName + "-"+objname); cell.setCellValue(richTextString); row = sheet.getRow(1); cell = row.getCell(2); richTextString = new XSSFRichTextString(sqr); cell.setCellValue(richTextString); - cell = row.getCell(6); + cell = row.getCell(5); richTextString = new XSSFRichTextString(bgtzdh); cell.setCellValue(richTextString); - cell = row.getCell(12); + cell = row.getCell(10); richTextString = new XSSFRichTextString(sqsj); cell.setCellValue(richTextString); row = sheet.getRow(2); cell = row.getCell(2); - richTextString = new XSSFRichTextString(cpmc); + richTextString = new XSSFRichTextString(cpbh); cell.setCellValue(richTextString); - cell = row.getCell(6); + cell = row.getCell(5); richTextString = new XSSFRichTextString(cpxh); cell.setCellValue(richTextString); - cell = row.getCell(12); + cell = row.getCell(10); richTextString = new XSSFRichTextString(khmc); cell.setCellValue(richTextString); row = sheet.getRow(3); cell = row.getCell(2); - richTextString = new XSSFRichTextString(ckbh); + richTextString = new XSSFRichTextString(cpbm); cell.setCellValue(richTextString); - cell = row.getCell(6); - richTextString = new XSSFRichTextString(tzjjcd); + cell = row.getCell(5); + richTextString = new XSSFRichTextString(ckbh); cell.setCellValue(richTextString); - cell = row.getCell(12); - richTextString = new XSSFRichTextString(tzgglx); + cell = row.getCell(10); + richTextString = new XSSFRichTextString(zt); cell.setCellValue(richTextString); row = sheet.getRow(4); cell = row.getCell(2); - richTextString = new XSSFRichTextString(cpbm); - cell.setCellValue(richTextString); - cell = row.getCell(6); richTextString = new XSSFRichTextString(zrbm); cell.setCellValue(richTextString); - cell = row.getCell(12); + cell = row.getCell(5); richTextString = new XSSFRichTextString(zrr); cell.setCellValue(richTextString); + cell = row.getCell(10); + richTextString = new XSSFRichTextString(bgzy); + cell.setCellValue(richTextString); row = sheet.getRow(5); cell = row.getCell(2); - richTextString = new XSSFRichTextString(gglx); + richTextString = new XSSFRichTextString(sfyxbjjk); cell.setCellValue(richTextString); - cell = row.getCell(6); - richTextString = new XSSFRichTextString(cplx); + cell = row.getCell(5); + richTextString = new XSSFRichTextString(gglx); cell.setCellValue(richTextString); - cell = row.getCell(12); - richTextString = new XSSFRichTextString(cwlx); + cell = row.getCell(10); + richTextString = new XSSFRichTextString(bgsclx); cell.setCellValue(richTextString); row = sheet.getRow(6); cell = row.getCell(2); - richTextString = new XSSFRichTextString(jgyg); + richTextString = new XSSFRichTextString(xmbh); cell.setCellValue(richTextString); - cell = row.getCell(6); - richTextString = new XSSFRichTextString(ssfl); + cell = row.getCell(5); + richTextString = new XSSFRichTextString(bgyy); cell.setCellValue(richTextString); - cell = row.getCell(12); - richTextString = new XSSFRichTextString(sfcscbss); + cell = row.getCell(10); + richTextString = new XSSFRichTextString(cplx); cell.setCellValue(richTextString); row = sheet.getRow(7); cell = row.getCell(2); - richTextString = new XSSFRichTextString(syxdsbhlbj); + richTextString = new XSSFRichTextString(bgbq); + cell.setCellValue(richTextString); + cell = row.getCell(5); + richTextString = new XSSFRichTextString(wlfl); + cell.setCellValue(richTextString); + cell = row.getCell(10); + richTextString = new XSSFRichTextString(sfxycg); cell.setCellValue(richTextString); row = sheet.getRow(8); cell = row.getCell(2); - richTextString = new XSSFRichTextString(xmjd); + richTextString = new XSSFRichTextString(jgyg); cell.setCellValue(richTextString); - cell = row.getCell(6); - richTextString = new XSSFRichTextString(ljlyfl); + cell = row.getCell(5); + richTextString = new XSSFRichTextString(xsfl); cell.setCellValue(richTextString); - cell = row.getCell(12); - richTextString = new XSSFRichTextString(tzfz); + cell = row.getCell(10); + richTextString = new XSSFRichTextString(gbqrr); cell.setCellValue(richTextString); row = sheet.getRow(9); cell = row.getCell(2); - richTextString = new XSSFRichTextString(xmbh); + richTextString = new XSSFRichTextString(jtyy); cell.setCellValue(richTextString); row = sheet.getRow(10); cell = row.getCell(2); - richTextString = new XSSFRichTextString(ggyy); + richTextString = new XSSFRichTextString(tzfsz); cell.setCellValue(richTextString); - + cell = row.getCell(5); + richTextString = new XSSFRichTextString(wlxqrq); + cell.setCellValue(richTextString); + cell = row.getCell(10); + richTextString = new XSSFRichTextString(tzfsz); + cell.setCellValue(tzjjcd); + row = sheet.getRow(11); cell = row.getCell(2); - richTextString = new XSSFRichTextString(zt); + richTextString = new XSSFRichTextString(pkeyword2); + cell.setCellValue(richTextString); + cell = row.getCell(5); + richTextString = new XSSFRichTextString(manageclassify2); cell.setCellValue(richTextString); + cell = row.getCell(10); + richTextString = new XSSFRichTextString(kkcode2); + cell.setCellValue(richTextString); + + } if (changeDetils != null && changeDetils.size() > 0) { for (int i = 0; i < changeDetils.size(); i++) { - XSSFRow row = sheet.getRow(i + 16); + XSSFRow row = sheet.getRow(i + 14); if (row == null) { - row = sheet.createRow(i + 16); + row = sheet.createRow(i + 14); } - ChangeDetils changeDetil = changeDetils.get(i); - String ph = changeDetil.getPH(); - String pm = changeDetil.getPM(); - String ybb = changeDetil.getYBB(); - String xbb = changeDetil.getXBB(); - String ysl = changeDetil.getYSL(); - String xsl = changeDetil.getXSL(); - String bgsl = changeDetil.getBGSL(); - String ggsm = changeDetil.getGGSM(); - String wzpsl = changeDetil.getWZPSL(); - String wzpuj = changeDetil.getWZPUJ(); - String zzsl = changeDetil.getZZSL(); - String zzyj = changeDetil.getZZYJ(); - String scsl = changeDetil.getSCSL(); - String ssyj = changeDetil.getSSYJ(); - String cksl = changeDetil.getCKSL(); - String clyj = changeDetil.getCLYJ(); + ChangeDetails2 changeDetil = changeDetils.get(i); + System.out.println(changeDetil); + String ph = changeDetil.getItemCode(); + String pm = changeDetil.getItemName(); + String ybb = changeDetil.getRevNum(); + String xbb = changeDetil.getRevNow(); + String ysl = changeDetil.getProtolNum(); + String xsl = changeDetil.getNowNum(); + String bgsl = changeDetil.getChangeNum(); + String ggsm = changeDetil.getChangeInroduct(); + String wljd = changeDetil.getItemState(); + String clyj = changeDetil.getHandleOpinion(); + String zzsl = changeDetil.getProductingNum(); + String scsl = changeDetil.getProductNum(); + String cksl = changeDetil.getStorageNum(); XSSFCell cell = row.getCell(0); if (cell == null) { @@ -1542,6 +2191,14 @@ public class QuickChangeForm extends AbstractRendering { richTextString = new XSSFRichTextString(pm); cell.setCellValue(richTextString); +// cell = row.getCell(3); +// if (cell == null) { +// cell = row.createCell(3); +// +// } +// richTextString = new XSSFRichTextString(ybb); +// cell.setCellValue(richTextString); +// cell = row.getCell(3); if (cell == null) { cell = row.createCell(3); @@ -1555,7 +2212,7 @@ public class QuickChangeForm extends AbstractRendering { cell = row.createCell(4); } - richTextString = new XSSFRichTextString(xbb); + richTextString = new XSSFRichTextString(ysl); cell.setCellValue(richTextString); cell = row.getCell(5); @@ -1563,7 +2220,7 @@ public class QuickChangeForm extends AbstractRendering { cell = row.createCell(5); } - richTextString = new XSSFRichTextString(ysl); + richTextString = new XSSFRichTextString(xsl); cell.setCellValue(richTextString); cell = row.getCell(6); @@ -1571,7 +2228,7 @@ public class QuickChangeForm extends AbstractRendering { cell = row.createCell(6); } - richTextString = new XSSFRichTextString(xsl); + richTextString = new XSSFRichTextString(bgsl); cell.setCellValue(richTextString); cell = row.getCell(7); @@ -1579,7 +2236,7 @@ public class QuickChangeForm extends AbstractRendering { cell = row.createCell(7); } - richTextString = new XSSFRichTextString(bgsl); + richTextString = new XSSFRichTextString(ggsm); cell.setCellValue(richTextString); cell = row.getCell(8); @@ -1587,7 +2244,7 @@ public class QuickChangeForm extends AbstractRendering { cell = row.createCell(8); } - richTextString = new XSSFRichTextString(ggsm); + richTextString = new XSSFRichTextString(wljd); cell.setCellValue(richTextString); cell = row.getCell(9); @@ -1595,7 +2252,7 @@ public class QuickChangeForm extends AbstractRendering { cell = row.createCell(9); } - richTextString = new XSSFRichTextString(wzpsl); + richTextString = new XSSFRichTextString(clyj); cell.setCellValue(richTextString); cell = row.getCell(10); @@ -1603,7 +2260,7 @@ public class QuickChangeForm extends AbstractRendering { cell = row.createCell(10); } - richTextString = new XSSFRichTextString(wzpuj); + richTextString = new XSSFRichTextString(zzsl); cell.setCellValue(richTextString); cell = row.getCell(11); @@ -1611,48 +2268,17 @@ public class QuickChangeForm extends AbstractRendering { cell = row.createCell(11); } - richTextString = new XSSFRichTextString(zzsl); + richTextString = new XSSFRichTextString(scsl); cell.setCellValue(richTextString); cell = row.getCell(12); if (cell == null) { cell = row.createCell(12); - } - richTextString = new XSSFRichTextString(zzyj); - cell.setCellValue(richTextString); - - cell = row.getCell(13); - if (cell == null) { - cell = row.createCell(13); - - } - richTextString = new XSSFRichTextString(scsl); - cell.setCellValue(richTextString); - - cell = row.getCell(14); - if (cell == null) { - cell = row.createCell(14); - - } - richTextString = new XSSFRichTextString(ssyj); - cell.setCellValue(richTextString); - - cell = row.getCell(15); - if (cell == null) { - cell = row.createCell(15); - } richTextString = new XSSFRichTextString(cksl); cell.setCellValue(richTextString); - - cell = row.getCell(16); - if (cell == null) { - cell = row.createCell(16); - - } - richTextString = new XSSFRichTextString(clyj); - cell.setCellValue(richTextString); + } } @@ -1672,52 +2298,218 @@ public class QuickChangeForm extends AbstractRendering { if (!file.exists()) { file.mkdirs(); } + } + + private void changeRevProperty(ChangeOrderBean2 bn) { + String changeType = bn.getChangeType(); + String receiveClassify = bn.getItemLYLX(); + String drawingTo = bn.getHandleOpinion(); + String[] split = drawingTo.split(";"); + List list = null; + if(split!=null&&split.length>0) { + list = Arrays.asList(split); + + } + + if("ƴ-".equals(changeType)) { + changeType = "SJCW"; + }else if("ƴ-©".equals(changeType)) { + changeType = "SJCWLX"; + }else if("ƴ-".equals(changeType)) { + changeType = "SJCWXZ"; + }else if("Ż-ʹ".equals(changeType)){ + changeType = "SJYH"; + }else if("Ż-ת".equals(changeType)){ + changeType = "SJYHBH"; + }else if("Ż-׼".equals(changeType)){ + changeType = "SJYHSJ"; + }else if("ڲ-".equals(changeType)){ + changeType = "NBFAGG"; + }else if("ڲ-©".equals(changeType)){ + changeType = "NBFAGGYL"; + }else if("ڲ-Ż".equals(changeType)){ + changeType = "NBFAGGYH"; + }else if("ڲ-С".equals(changeType)){ + changeType = "NBFAGGBW"; + }else if("ڲ-".equals(changeType)){ + changeType = "NBFAGGXZ"; + }else if("-".equals(changeType)){ + changeType = "FAGG"; + }else if("-©".equals(changeType)){ + changeType = "FAGGYL"; + }else if("-Ż".equals(changeType)){ + changeType = "FAGGYH"; + }else if("-".equals(changeType)){ + changeType = "FAGGXZ"; + }else if("ɹ-ƷƱ".equals(changeType)){ + changeType = "CGGG"; + }else if("ɹ-Ʒű".equals(changeType)){ + changeType = "CGGGPH"; + }else if("ɹ-油".equals(changeType)){ + changeType = "CGGGKC"; + }else if("۸".equals(changeType)){ + changeType = "XSGG"; + }else if("۸-".equals(changeType)){ + changeType = "XSGGBG"; + } + + if("ڲ-".equals(receiveClassify)) { + receiveClassify = "CNZZ"; + }else if("ڲ-FAT".equals(receiveClassify)){ + receiveClassify = "CNFAT"; + }else if("ⲿ-SAT".equals(receiveClassify)){ + receiveClassify = "CWSAT"; + }else if("-".equals(receiveClassify)){ + receiveClassify = "FWBN"; + }else if("-".equals(receiveClassify)){ + receiveClassify = "FWBW"; + } + + String wk = null; + String cg = null; + if(list!=null) { + if(list.contains("")) { + wk = "Yes"; + }else { + wk = "No"; + } + + if(list.contains("ɹ")) { + cg = "Yes"; + }else { + cg = "No"; + } + + }else { + if("".equals(drawingTo)) { + wk = "Yes"; + }else { + wk = "No"; + } + + if("ɹ".equals(drawingTo)) { + cg = "Yes"; + }else { + cg = "No"; + } + } + + TCComponent component = (TCComponent)targetComp; + AIFComponentContext[] whereReferenced; + try { + whereReferenced = component.whereReferenced(); + if(whereReferenced!=null&&whereReferenced.length>0) { + for(AIFComponentContext acc: whereReferenced) { + TCComponent comp =(TCComponent)acc.getComponent(); + if(comp instanceof TCComponentItemRevision) { + TCComponentItemRevision rev = (TCComponentItemRevision)comp; + rev.setStringProperty("t2_ecnchangetype", changeType); + rev.setStringProperty("t2_pickingclassification", receiveClassify); + rev.setStringProperty("t2_wukong", wk); + rev.setStringProperty("t2_caigou", cg); + } + } + } + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } + + + + + // public List getselectTime() { + // List list = new ArrayList(); + // DateBean db = new DateBean(); + // ResultSet r = null; + // Connection con = null; + // PreparedStatement stmt=null; + // String sql = "select * from dfl_changetime"; + // try { + // con = ConnectionFun(); + // stmt=con.prepareStatement(sql); + // + // r=stmt.executeQuery(); + // while(r.next()){ + // db.setDate(r.getString(1)); + // + // list.add(db); + // } + // }catch (SQLException e) { + // e.printStackTrace(); + // }finally{ + // try { + // r.close(); + // stmt.close(); + // con.close(); + // } catch (SQLException e) { + // e.printStackTrace(); + // } + // } + // + // + // return list; + // } + // + // + // + // + // ȡϢ private List getChangeMesg(String id) { List list = new ArrayList(); - ChangeOrderBean bn = new ChangeOrderBean(); + ChangeOrderBean2 bn = new ChangeOrderBean2(); ResultSet r = null; Connection con = null; PreparedStatement stmt = null; - String sql = "select * from DFL_CHANGEFORM where objectCode=?";// + String sql = "select OBJECTCODE,APPLYNAME,APPLYDATE,PROODUCTCODE,PRODUCTTYPE,CLIENTNAME,PRODUCTDEPARTMENT,WAREHOUSECODE,ACCOUNTSET,DUTYDEPARTMENT,DUTYMAN,FORM_MAJOR,LAYOUTINTERFACE," + + "CHANGETYPE,CHANGEINPUTTYPE,PROJECTCODE,CHANGEREASON,PROJECTMODEL,CHANGETAG,RECEIVECLASSIFY,NEEDBUY,PRICEBOOKING,SALSECLASSIFY,CLOSEMAN,REASONDETAIL,HANDLEOPINION,ITEMNEEDDATE,NOTIFYEMERGENCYPROCEDURES,PKEYWORD,MANAGECLASSIFY,KKCODE from DFL_CHANGEFORM where objectCode=?";// try { con = ConnectionFun(); stmt = con.prepareStatement(sql); stmt.setString(1, id); r = stmt.executeQuery(); + String sql1 = "insert into DFL_CHANGEFORM(OBJECTCODE,APPLYNAME,APPLYDATE,PROODUCTCODE,PRODUCTTYPE," + + "CLIENTNAME,PRODUCTDEPARTMENT,WAREHOUSECODE,ACCOUNTSET,DUTYDEPARTMENT,DUTYMAN,FORM_MAJOR,LAYOUTINTERFACE," + + "CHANGETYPE,CHANGEINPUTTYPE,PROJECTCODE,CHANGEREASON,PROJECTMODEL,CHANGETAG,RECEIVECLASSIFY,NEEDBUY," + + "PRICEBOOKING,SALSECLASSIFY,CLOSEMAN,REASONDETAIL,HANDLEOPINION,ITEMNEEDDATE,NOTIFYEMERGENCYPROCEDURES,PKEYWORD,MANAGECLASSIFY,KKCODE)"; while (r.next()) { - bn.setObjectCode(r.getString(1)); - bn.setApplyName(r.getString(2)); + bn.setChangeCode(r.getString(1)); + bn.setApplyman(r.getString(2)); bn.setApplyDate(r.getString(3)); - bn.setProjectCode(r.getString(4)); - bn.setClientNae(r.getString(5)); - bn.setProductDepartment(r.getString(6)); - bn.setProductName(r.getString(7)); - bn.setProjectModel(r.getString(8)); - bn.setAffectedPart(r.getString(9)); - bn.setChangeType(r.getString(10)); - bn.setProductType(r.getString(11)); - bn.setErrorType(r.getString(12)); - bn.setDutyDepartment(r.getString(13)); - bn.setDutyMan(r.getString(14)); - bn.setChangeReason(r.getString(15)); - bn.setSalseClassify(r.getString(16)); - bn.setPriceBooking(r.getString(17)); - bn.setIsNotProductLoss(r.getString(18)); - bn.setReceiveClassify(r.getString(19)); - bn.setWarehouseCode(r.getString(20)); - bn.setAccountSet(r.getString(21)); - bn.setNotifyEmergencyProcedures(r.getString(22)); - bn.setDrawingTo(r.getString(23)); - bn.setChangeListCode(r.getString(24)); - bn.setTZChangeType(r.getString(25)); - bn.setSUOSU_ProductDepartment(r.getString(26)); - bn.setProjectState(r.getString(27)); + bn.setProductCode(r.getString(4)); + bn.setProductType(r.getString(5)); + bn.setClientName(r.getString(6)); + bn.setProductDepart(r.getString(7)); + bn.setWareHourse(r.getString(9)); + bn.setStorageNum(r.getString(8)); + bn.setDutyDepartment(r.getString(10)); + bn.setDutyMan(r.getString(11)); + bn.setChangeOfMajor(r.getString(12)); + bn.setLayoutInterface(r.getString(13)); + bn.setChangeType(r.getString(14)); + bn.setChangeInputType(r.getString(15)); + bn.setSystemCode(r.getString(16)); + bn.setChangeReason(r.getString(17)); + bn.setProductTypeXh(r.getString(18)); + bn.setChangeTag(r.getString(19)); + bn.setItemLYLX(r.getString(20)); + bn.setNeedBuy(r.getString(21)); + bn.setPricePri(r.getString(22)); + bn.setSaleClass(r.getString(23)); + bn.setCloseMan(r.getString(24)); + bn.setReasonDetail(r.getString(25)); + bn.setHandleOpinion(r.getString(26)); + bn.setItemNeedDate(r.getString(27)); + bn.setDegreeOfurgency(r.getString(28)); + bn.setPkeyword(r.getString(29)); + bn.setManageclassify(r.getString(30)); + bn.setKkcode(r.getString(31)); list.add(bn); } @@ -1725,9 +2517,17 @@ public class QuickChangeForm extends AbstractRendering { e.printStackTrace(); } finally { try { - r.close(); - stmt.close(); - con.close(); + if(r!=null) { + r.close(); + + + } + if(stmt!=null) { + stmt.close(); + } + if(con!=null) { + con.close(); + } } catch (SQLException e) { e.printStackTrace(); } @@ -1742,41 +2542,45 @@ public class QuickChangeForm extends AbstractRendering { ResultSet r = null; Connection con = null; PreparedStatement stmt = null; - String sql = "select * from DFL_CHANGEDETAILS where objectCode=?";// + String sql = "select OBJECTCODE,ORDERNUM,PH,PM,YBB,XBB,YSL,XSL,BGSL,GGSM,ITEMSTATE,CLYJ,ZZSL,SCSL,CKSL from DFL_CHANGEDETAILS where objectCode=? order by ORDERNUM asc";// try { con = ConnectionFun(); stmt = con.prepareStatement(sql); stmt.setString(1, id); r = stmt.executeQuery(); while (r.next()) { - ChangeDetils cd = new ChangeDetils(); + ChangeDetails2 cd = new ChangeDetails2(); System.out.println(r.getString(1)); cd.setObjectCode(r.getString(1)); - cd.setPH(r.getString(2)); - cd.setPM(r.getString(3)); - cd.setYBB(r.getString(4)); - cd.setXBB(r.getString(5)); - cd.setYSL(r.getString(6)); - cd.setXSL(r.getString(7)); - cd.setBGSL(r.getString(8)); - cd.setWZPSL(r.getString(9)); - cd.setWZPUJ(r.getString(10)); - cd.setZZSL(r.getString(11)); - cd.setZZYJ(r.getString(12)); - cd.setSCSL(r.getString(13)); - cd.setSSYJ(r.getString(14)); - cd.setCKSL(r.getString(15)); - cd.setCLYJ(r.getString(16)); - cd.setGGSM(r.getString(17)); + cd.setOrder(r.getString(2)); + cd.setItemCode(r.getString(3)); + cd.setItemName(r.getString(4)); + cd.setRevNum(r.getString(5)); + cd.setRevNow(r.getString(6)); + cd.setProtolNum(r.getString(7)); + cd.setNowNum(r.getString(8)); + cd.setChangeNum(r.getString(9)); + cd.setChangeInroduct(r.getString(10)); + cd.setItemState(r.getString(11)); + cd.setHandleOpinion(r.getString(12)); + cd.setProductingNum(r.getString(13)); + cd.setProductNum(r.getString(14)); + cd.setStorageNum(r.getString(15)); list.add(cd); } } catch (SQLException e) { e.printStackTrace(); } finally { try { - r.close(); - stmt.close(); - con.close(); + if(r!=null) { + r.close(); + } + if(stmt!=null) { + stmt.close(); + } + if(con!=null) { + con.close(); + } } catch (SQLException e) { e.printStackTrace(); } @@ -1787,44 +2591,48 @@ public class QuickChangeForm extends AbstractRendering { public void setValue() { System.out.println(""); - List list = getChangeMesg(name); + List list = getChangeMesg(masterName); + System.out.println("masterName==============" + masterName); if (list.size() > 0) { - ChangeOrderBean bn = (ChangeOrderBean) list.get(list.size() - 1); - System.out.println(bn.getApplyName()); - table1.setValueAt(bn.getApplyName(), 0, 1); + ChangeOrderBean2 bn = (ChangeOrderBean2) list.get(list.size() - 1); + + System.out.println(bn.getChangeCode()); + table1.setValueAt(bn.getApplyman()==null || bn.getApplyman().length()==0?applyname:bn.getApplyman(), 0, 1); + table1.setValueAt(bn.getChangeCode(), 0, 3); table1.setValueAt(bn.getApplyDate(), 0, 5); - table1.setValueAt(bn.getProjectCode(), 8, 1); - table1.setValueAt(bn.getClientNae(), 1, 5); - table1.setValueAt(bn.getProductDepartment(), 3, 1); - table1.setValueAt(bn.getProductName(), 1, 1); - table1.setValueAt(bn.getProjectModel(), 1, 3); - // Ӱ㲿 - table1.setValueAt(bn.getAffectedPart(), 6, 1); - - table1.setValueAt(bn.getChangeType(), 4, 1); - table1.setValueAt(bn.getProductType(), 4, 3); - table1.setValueAt(bn.getErrorType(), 4, 5); - table1.setValueAt(bn.getDutyDepartment(), 3, 3); - table1.setValueAt(bn.getDutyMan(), 3, 5); - table1.setValueAt(bn.getChangeReason(), 9, 1); - table1.setValueAt(bn.getSalseClassify(), 5, 3); - table1.setValueAt(bn.getPriceBooking(), 5, 1); - table1.setValueAt(bn.getIsNotProductLoss(), 5, 5); - table1.setValueAt(bn.getReceiveClassify(), 7, 3); - table1.setValueAt(bn.getWarehouseCode(), 2, 1); - // - table1.setValueAt(bn.getAccountSet(), 10, 1); - // ̶֪ͨ - table1.setValueAt(bn.getNotifyEmergencyProcedures(), 2, 3); - - table1.setValueAt(bn.getDrawingTo(), 7, 1); - - table1.setValueAt(bn.getChangeListCode(), 0, 3); - table1.setValueAt(bn.getTZChangeType(), 2, 5); - // table1.setValueAt(bn.getSUOSU_ProductDepartment(),6, 1); - table1.setValueAt(bn.getProjectState(), 7, 5); + table1.setValueAt(bn.getProductCode(), 1, 1); + table1.setValueAt(bn.getProductTypeXh(), 1, 3); + table1.setValueAt(bn.getClientName(), 1, 5); + table1.setValueAt(bn.getProductDepart(), 2, 1); + table1.setValueAt(bn.getStorageNum(), 2, 3); + table1.setValueAt(bn.getWareHourse(), 2, 5); + table1.setValueAt(bn.getDutyDepartment(), 3, 1); + table1.setValueAt(bn.getDutyMan(), 3, 3); + table1.setValueAt(bn.getChangeOfMajor(), 3, 5); + + table1.setValueAt(bn.getLayoutInterface(), 4,1); + table1.setValueAt(bn.getChangeType(), 4, 3); + table1.setValueAt(bn.getChangeInputType(), 4, 5); + table1.setValueAt(bn.getSystemCode(), 5, 1); + table1.setValueAt(bn.getChangeReason(), 5, 3); + table1.setValueAt(bn.getProductType(), 5, 5); + table1.setValueAt(bn.getChangeTag(), 6, 1); + table1.setValueAt(bn.getItemLYLX(), 6, 3); + table1.setValueAt(bn.getNeedBuy(), 6, 5); + table1.setValueAt(bn.getPricePri(), 7, 1); + table1.setValueAt(bn.getSaleClass(), 7, 3); + table1.setValueAt(bn.getCloseMan(), 7, 5); + table1.setValueAt(bn.getReasonDetail(), 8, 1); + table1.setValueAt(bn.getHandleOpinion(), 9, 1); + table1.setValueAt(bn.getItemNeedDate(), 9, 3); + table1.setValueAt(bn.getDegreeOfurgency(), 9, 5); + table1.setValueAt(bn.getPkeyword(), 10, 1); + table1.setValueAt(bn.getManageclassify(), 10, 3); + table1.setValueAt(bn.getKkcode(), 10, 5); + // table2 м } + } // ʱύݿ @@ -1871,6 +2679,10 @@ public class QuickChangeForm extends AbstractRendering { stmt.setString(25, bn.getTZChangeType()); stmt.setString(26, bn.getSUOSU_ProductDepartment()); stmt.setString(27, bn.getProjectState()); + stmt.setString(28, bn.getFormMajor()); + stmt.setString(29, bn.getPkeyword()); + stmt.setString(30, bn.getManageclassify()); + stmt.setString(31, bn.getKkcode()); stmt.executeUpdate(); System.out.println("ݲݿ"); @@ -1886,37 +2698,53 @@ public class QuickChangeForm extends AbstractRendering { } } - - /** - * ϸ - */ - - public void insertChangeDetailsMes(ChangeDetils cd) { + + public void insertMes2(ChangeOrderBean2 bn) { + System.out.println("save=>"+bn); Connection con = null; PreparedStatement stmt = null; - String sql = "insert into DFL_CHANGEDETAILS values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + String sql = "insert into DFL_CHANGEFORM(OBJECTCODE,APPLYNAME,APPLYDATE,PROODUCTCODE,PRODUCTTYPE," + + "CLIENTNAME,PRODUCTDEPARTMENT,WAREHOUSECODE,ACCOUNTSET,DUTYDEPARTMENT,DUTYMAN,FORM_MAJOR,LAYOUTINTERFACE," + + "CHANGETYPE,CHANGEINPUTTYPE,PROJECTCODE,CHANGEREASON,PROJECTMODEL,CHANGETAG,RECEIVECLASSIFY,NEEDBUY," + + "PRICEBOOKING,SALSECLASSIFY,CLOSEMAN,REASONDETAIL,HANDLEOPINION,ITEMNEEDDATE,NOTIFYEMERGENCYPROCEDURES,PKEYWORD,MANAGECLASSIFY,KKCODE) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; try { con = ConnectionFun(); stmt = con.prepareStatement(sql); - stmt.setString(1, cd.getObjectCode()); - stmt.setString(2, cd.getPH()); - stmt.setString(3, cd.getPM()); - stmt.setString(4, cd.getYBB()); - stmt.setString(5, cd.getXBB()); - stmt.setString(6, cd.getYSL()); - stmt.setString(7, cd.getXSL()); - stmt.setString(8, cd.getBGSL()); - stmt.setString(9, cd.getWZPSL()); - stmt.setString(10, cd.getWZPUJ()); - stmt.setString(11, cd.getZZSL()); - stmt.setString(12, cd.getZZYJ()); - stmt.setString(13, cd.getSCSL()); - stmt.setString(14, cd.getSSYJ()); - stmt.setString(15, cd.getCKSL()); - stmt.setString(16, cd.getCLYJ()); - stmt.setString(17, cd.getGGSM()); + + stmt.setString(1, bn.getChangeCode()); + stmt.setString(2, bn.getApplyman()); + stmt.setString(3, bn.getApplyDate()); + stmt.setString(4, bn.getProductCode()); + stmt.setString(5, bn.getProductType()); + stmt.setString(6, bn.getClientName()); + stmt.setString(7, bn.getProductDepart()); + stmt.setString(9, bn.getWareHourse()); + stmt.setString(8, bn.getStorageNum()); + stmt.setString(10, bn.getDutyDepartment()); + stmt.setString(11, bn.getDutyMan()); + stmt.setString(12, bn.getChangeOfMajor()); + stmt.setString(13, bn.getLayoutInterface()); + stmt.setString(14, bn.getChangeType()); + stmt.setString(15, bn.getChangeInputType()); + stmt.setString(16, bn.getSystemCode()); + stmt.setString(17, bn.getChangeReason()); + stmt.setString(18, bn.getProductTypeXh()); + stmt.setString(19, bn.getChangeTag()); + stmt.setString(20, bn.getItemLYLX()); + stmt.setString(21, bn.getNeedBuy()); + stmt.setString(22, bn.getPricePri()); + stmt.setString(23, bn.getSaleClass()); + stmt.setString(24, bn.getCloseMan()); + stmt.setString(25, bn.getReasonDetail()); + stmt.setString(26, bn.getHandleOpinion()); + stmt.setString(27, bn.getItemNeedDate()); + stmt.setString(28, bn.getDegreeOfurgency()); + stmt.setString(29, bn.getPkeyword()); + stmt.setString(30, bn.getManageclassify()); + stmt.setString(31, bn.getKkcode()); stmt.executeUpdate(); System.out.println("ݲݿ"); + } catch (Exception ex) { ex.printStackTrace(); } finally { @@ -1930,25 +2758,46 @@ public class QuickChangeForm extends AbstractRendering { } - // ɾʱ - public void del_date() { + /** + * ϸ + */ + + public void insertChangeDetailsMes(ChangeDetails2 cd) { Connection con = null; - String sql = "delete from dfl_changetime"; - System.out.println(sql); + PreparedStatement stmt = null; + String sql = "insert into DFL_CHANGEDETAILS(OBJECTCODE,ORDERNUM,PH,PM,YBB,XBB,YSL,XSL,BGSL,GGSM,ITEMSTATE,CLYJ,ZZSL,SCSL,CKSL) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; try { con = ConnectionFun(); - PreparedStatement prepStmt = conn.prepareStatement(sql); - prepStmt.executeUpdate(); - System.out.println("ݿɾɹ"); + stmt = con.prepareStatement(sql); + stmt.setString(1, cd.getObjectCode()); + stmt.setString(2, cd.getOrder()); + stmt.setString(3, cd.getItemCode()); + stmt.setString(4, cd.getItemName()); + stmt.setString(5, cd.getRevNum()); + stmt.setString(6, cd.getRevNow()); + stmt.setString(7, cd.getProtolNum()); + stmt.setString(8, cd.getNowNum()); + stmt.setString(9, cd.getChangeNum()); + stmt.setString(10, cd.getChangeInroduct()); + stmt.setString(11, cd.getItemState()); + stmt.setString(12, cd.getHandleOpinion()); + stmt.setString(13, cd.getProductingNum()); + stmt.setString(14, cd.getProductNum()); + stmt.setString(15, cd.getStorageNum()); + System.out.println(sql); + stmt.executeUpdate(); + System.out.println("ݲݿ"); } catch (Exception ex) { ex.printStackTrace(); } finally { try { + stmt.close(); con.close(); } catch (Exception ex) { ex.printStackTrace(); } } + } public void delChangeForm(String id) { @@ -1997,7 +2846,6 @@ public class QuickChangeForm extends AbstractRendering { } } - } public void delAllChangedetil(String id) { @@ -2025,7 +2873,6 @@ public class QuickChangeForm extends AbstractRendering { } } - } // ݿǶиö @@ -2073,7 +2920,6 @@ public class QuickChangeForm extends AbstractRendering { rs = stmt.executeQuery(); while (rs.next()) { i = i + 1; - } } catch (Exception ex) { diff --git a/src/com/connor/dfl/plm/forms/变更单导出模板.xlsx b/src/com/connor/dfl/plm/forms/变更单导出模板.xlsx index 4e1267d..38869ac 100644 Binary files a/src/com/connor/dfl/plm/forms/变更单导出模板.xlsx and b/src/com/connor/dfl/plm/forms/变更单导出模板.xlsx differ diff --git a/src/com/connor/dfl/plm/util/AutoSign.java b/src/com/connor/dfl/plm/util/AutoSign.java index 6e7e03b..796c235 100644 --- a/src/com/connor/dfl/plm/util/AutoSign.java +++ b/src/com/connor/dfl/plm/util/AutoSign.java @@ -3,11 +3,14 @@ package com.connor.dfl.plm.util; import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; +import java.text.SimpleDateFormat; +import java.util.Date; import com.teamcenter.rac.aif.AbstractAIFApplication; import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; @@ -48,12 +51,12 @@ public class AutoSign { } public Connection ConnectionFun(String url,String user,String password) throws SQLException { - Connection conn = null;// + Connection conn = null;// try { -// System.out.println(url); -// System.out.println(user); -// System.out.println(password); + // System.out.println(url); + // System.out.println(user); + // System.out.println(password); Class.forName("oracle.jdbc.driver.OracleDriver"); System.out.println("سɹ"); } catch (ClassNotFoundException e) { @@ -68,88 +71,65 @@ public class AutoSign { } - - - - - public void insertNewTxtFile(String filename,File file,String uid ,String user_id ,String url,String user,String password,String fun,String txt_pinhao,String zhangtao,String userID,String item_uid) { - Connection con = null; - PreparedStatement stmt=null; - ResultSet rs = null; - BufferedInputStream bis = null; - java.io.OutputStream out = null; - String tempPath = System.getProperty("java.io.tmpdir"); - String sqlNewdate ="insert into DFL_SEND_TXT_TO_ERP values(seq_on_DFL.nextval,'"+fun+"', '"+filename+"',empty_blob(),0,'"+uid+"' ,'"+user_id+"','"+txt_pinhao+"','"+zhangtao+"','"+userID+"','"+item_uid+"')"; - // insert into dfl_send_txt_to_erp VALUES(seq_on_DFL.nextval,'33','33',empty_blob(),2,'fdfdfdfd'); - //String sqlupdate="update DFL_SEND_TXT_TO_ERP SET TXTFILE=empty_blob() where myuid='"+uid+"' for update "; - String sql = "select * from DFL_SEND_TXT_TO_ERP where myuid ='"+uid+"' for update "; - String insert="update DFL_SEND_TXT_TO_ERP SET TXTFILE=? where myuid='"+uid+"'"; - + public void insertNewTxtFile(String filePath,String fileName,String uid ,String user_id ,String url,String user,String password,String fun,String txt_pinhao,String zhangtao,String userID,String item_uid,String uid_file_name,TCSession session) { + String[] stringArray = session.getPreferenceService().getStringValues("DFL2_FTP_Connect"); + fileName = fileName + ".txt"; + uid_file_name = uid_file_name + ".txt"; + Date date = new Date(); + SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss"); + SimpleDateFormat sd1 = new SimpleDateFormat("yyyy-MM-dd"); + String ssd = sd.format(date); + String ssd1 = sd1.format(date); + String[] split = ssd1.split("-"); + boolean flag = false; try { - con = ConnectionFun( url, user, password); - con.setAutoCommit(false); - stmt = con.prepareStatement(sqlNewdate); - stmt.executeUpdate(); - System.out.println("µݲݿ"); - stmt.close(); - // stmt = con.prepareStatement(sqlupdate); - // - // stmt.executeUpdate(); - // stmt.close(); - stmt =con.prepareStatement(sql); - con.commit(); - rs = stmt.executeQuery(); - while(rs.next()) { - String ss = rs.getString(2); - System.out.println("-=================" + ss); - BLOB blob = (BLOB) rs.getBlob(4); - int size = blob.getBufferSize(); - bis = new BufferedInputStream(new FileInputStream(new File(tempPath + filename + ".txt")),size); - out = blob.getBinaryOutputStream(); - System.out.println(size); - - - byte b[]=new byte[size]; - int en=0; - - - while((en = bis.read(b,0,size))!=-1) { - out.write(b,0,en); + FileInputStream in = new FileInputStream(new File(filePath)); + flag = FtpUtil2.uploadFile(stringArray[0], 21, stringArray[1], stringArray[2], "", "/"+ split[0]+"/"+split[1] +"/"+split[2], fileName, in); + in = new FileInputStream(new File(item_uid)); + flag = FtpUtil2.uploadFile(stringArray[0], 21, stringArray[1], stringArray[2], "", "/"+ split[0]+"/"+split[1] +"/"+split[2], uid_file_name, in); +// FtpUtil.uploadFile(stringArray[0], 21, stringArray[1], stringArray[2], "/"+ split[0], "/"+split[1] +"/"+split[2], fileName, in); +// in = new FileInputStream(new File(item_uid)); +// FtpUtil.uploadFile(stringArray[0], 21, stringArray[1], stringArray[2], "/"+ split[0], "/"+split[1] +"/"+split[2], uid_file_name, in); + + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + if(flag) { + String ftpPath1 = "/"+ split[0]+ "/"+split[1] +"/"+split[2]+"/"+fileName; + String ftpPath2 = "/"+ split[0]+ "/"+split[1] +"/"+split[2]+"/"+uid_file_name; + Connection con = null; + PreparedStatement stmt = null; + String sqlNewdate ="insert into DFL_SEND_FILE_TO_ERP_NEW values(seq_on_DFL.nextval,'"+fun+"', '"+ftpPath1+"',0,'"+uid+"' ,'"+user_id+"','"+txt_pinhao+"','"+zhangtao+"','"+userID+"','"+ftpPath2+"',null,'"+ssd+"',null,null,null)"; + try + { + con = ConnectionFun( url, user, password); + con.setAutoCommit(false); + stmt = con.prepareStatement(sqlNewdate); + stmt.executeUpdate(); + System.out.println("µݲݿ"); + stmt.close(); - } - out.flush(); - stmt =con.prepareStatement(insert); - stmt.setBlob(1, blob); - //stmt.setString(2, uid); - stmt.executeUpdate(); - bis.close(); - out.close(); con.commit(); } - - - - - - - } catch (Exception ex) { - ex.printStackTrace(); - } finally { - try { - - stmt.close(); - con.close(); - } catch (Exception ex) { + catch (Exception ex) + { ex.printStackTrace(); } + finally + { + try + { + stmt.close(); + con.close(); + } + catch (Exception ex) + { + ex.printStackTrace(); + } + } } } - - - - - - - } + diff --git a/src/com/connor/dfl/plm/util/ClassValueUtil.java b/src/com/connor/dfl/plm/util/ClassValueUtil.java index ab7e6d4..15b125c 100644 --- a/src/com/connor/dfl/plm/util/ClassValueUtil.java +++ b/src/com/connor/dfl/plm/util/ClassValueUtil.java @@ -1,10 +1,15 @@ package com.connor.dfl.plm.util; +import java.sql.ResultSet; +import java.sql.SQLException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import org.apache.xpath.operations.And; + +import com.connor.dfl.plm.classLov.DbPool; import com.connor.dfl.plm.dfl019.ClassPropBean; import com.teamcenter.rac.aif.AbstractAIFApplication; import com.teamcenter.rac.aifrcp.AIFUtility; @@ -19,6 +24,386 @@ import com.teamcenter.rac.kernel.ics.ICSProperty; import com.teamcenter.rac.util.MessageBox; public class ClassValueUtil { + +// public static String getClassOracle + + public static ClassValueBean getClassOracle(TCComponentItemRevision rev,List errList,TCSession session) throws TCException{ + + String idString = rev.getStringProperty("item_id")+"/"+rev.getStringProperty("item_revision_id"); + + String selectTXT = "select * from PICM0 where PID = '"+idString+"'"; + System.out.println("idString===>"+idString); + ClassValueBean valueBean = new ClassValueBean(); + StringBuilder sb = new StringBuilder(); + + try { + DbPool.getConnection(session); + ResultSet selectSql = DbPool.executeSelectSql(selectTXT); + + if(selectSql.next()) { + + String puid = selectSql.getString("PCID"); + String dwPuid = puid.substring(0, puid.length()-4); + String dwPuid2 = puid.substring(0, puid.length()-2); + String getLov = + "select txt.puid,a.* from (select cnt.pname,cnt.pformat,a.PDBINDEX from(select lb1.PUNCT,lb1.PDBINDEX from PSMLB1 lb1,PSMLB0 lb0 where lb1.rtag_to_headeru = lb0.PUID and lb0.pcid = " + + "'"+puid+"') a, PUNCT_DICT cnt where cnt.PUNCT = a.PUNCT)a left JOIN PSTXT txt on" + + " txt.pid = a.pformat"; + String dwPuidLov = + "select txt.puid,a.* from (select cnt.pname,cnt.pformat,a.PDBINDEX from(select lb1.PUNCT,lb1.PDBINDEX from PSMLB1 lb1,PSMLB0 lb0 where lb1.rtag_to_headeru = lb0.PUID and lb0.pcid = " + + "'"+dwPuid+"') a, PUNCT_DICT cnt where cnt.PUNCT = a.PUNCT)a left JOIN PSTXT txt on" + + " txt.pid = a.pformat"; + + String dwPuidLov2 = + "select txt.puid,a.* from (select cnt.pname,cnt.pformat,a.PDBINDEX from(select lb1.PUNCT,lb1.PDBINDEX from PSMLB1 lb1,PSMLB0 lb0 where lb1.rtag_to_headeru = lb0.PUID and lb0.pcid = " + + "'"+dwPuid2+"') a, PUNCT_DICT cnt where cnt.PUNCT = a.PUNCT)a left JOIN PSTXT txt on" + + " txt.pid = a.pformat"; + + ResultSet getLovSql = DbPool.executeSelectSql(getLov); + ResultSet dwPuidLovSql = DbPool.executeSelectSql(dwPuidLov); + ResultSet dwPuidLovSql2 = DbPool.executeSelectSql(dwPuidLov2); + + while(dwPuidLovSql.next()) { + String attrName = dwPuidLovSql.getString("pname"); + int int1 = dwPuidLovSql.getInt("PDBINDEX"); + String uid = dwPuidLovSql.getString("PUID"); + String value = selectSql.getString("psm"+String.format("%02d", int1)); + if(uid!=null&& !uid.equals("")) { + + if("/".equals(value) || "null".equals(value) || "".equals(value)) { + continue; + } +// Integer valueOf = Integer.valueOf(value); +// String getLovVal = "select PVAL_0 from PVALUE where puid = '"+uid+"' and PSEQ = '"+valueOf+"'" ; + String getLovVal = "select val.* from " + + "(select * from PKEY key where key.puid = '"+uid+"' and PVAL_0 = '"+value+"'" + + ")a LEFT JOIN PVALUE val on val.PSEQ = a.PSEQ and val.puid = a.puid"; + ResultSet LovValSql = DbPool.executeSelectSql(getLovVal); + if(LovValSql.next()) { + value = LovValSql.getString("PVAL_0"); + if("λ".equals(attrName)){ + valueBean.setUnit(value); + } + } + }else { + if("λ".equals(attrName)){ + valueBean.setUnit(value); + } + } + } + + while(dwPuidLovSql2.next()) { + String attrName = dwPuidLovSql2.getString("pname"); + int int1 = dwPuidLovSql2.getInt("PDBINDEX"); + String uid = dwPuidLovSql2.getString("PUID"); + String value = selectSql.getString("psm"+String.format("%02d", int1)); + if(uid!=null&& !uid.equals("")) { + + if("/".equals(value) || "null".equals(value) || "".equals(value)) { + continue; + } +// Integer valueOf = Integer.valueOf(value); +// String getLovVal = "select PVAL_0 from PVALUE where puid = '"+uid+"' and PSEQ = '"+valueOf+"'" ; + String getLovVal = "select val.* from " + + "(select * from PKEY key where key.puid = '"+uid+"' and PVAL_0 = '"+value+"'" + + ")a LEFT JOIN PVALUE val on val.PSEQ = a.PSEQ and val.puid = a.puid"; + ResultSet LovValSql = DbPool.executeSelectSql(getLovVal); + if(LovValSql.next()) { + value = LovValSql.getString("PVAL_0"); + if("λ".equals(attrName)){ + valueBean.setUnit(value); + } + } + }else { + if("λ".equals(attrName)){ + valueBean.setUnit(value); + } + } + } + + while(getLovSql.next()) { + + String attrName = getLovSql.getString("pname"); +// System.out.println(attrName); + int int1 = getLovSql.getInt("PDBINDEX"); + String uid = getLovSql.getString("PUID"); + String value = selectSql.getString("psm"+String.format("%02d", int1)); +// System.out.println(int1); +// System.out.println(value); +// System.out.println(uid); + if(uid!=null && !uid.equals("")) { + + if( value ==null || "/".equals(value) || "null".equals(value) || "".equals(value)) { + continue; + } +// Integer valueOf = Integer.valueOf(value)-1; +// String getLovVal = "select PVAL_0 from PVALUE where puid = '"+uid+"' and PSEQ = '"+valueOf+"'" ; + String getLovVal = "select val.* from " + + "(select * from PKEY key where key.puid = '"+uid+"' and PVAL_0 = '"+value+"'" + + ")a LEFT JOIN PVALUE val on val.PSEQ = a.PSEQ and val.puid = a.puid"; + ResultSet LovValSql = DbPool.executeSelectSql(getLovVal); + if(LovValSql.next()) { + value = LovValSql.getString("PVAL_0"); + if("Ʒ".equals(attrName)) { + valueBean.setBrand(value); + }else if("λ".equals(attrName)){ + valueBean.setUnit(value); + }else if(attrName.startsWith("")){ + valueBean.setSpec(value); + }else if(attrName.contains("")){ + valueBean.setCode(value); + }else { + if("/".equals(value) || "null".equals(value) || "".equals(value)) { +// System.out.println("ƴ"); + continue; + } + sb.append(value); + sb.append(";"); + } + } + + }else { + if("Ʒ".equals(attrName)) { + valueBean.setBrand(value); + }else if(attrName.contains("λ")){ + valueBean.setUnit(value); + }else if(attrName.startsWith("")){ + valueBean.setSpec(value); + }else if(attrName.contains("")){ + valueBean.setCode(value); + }else { + if("/".equals(value) || "null".equals(value) || "".equals(value)) { +// System.out.println("ƴ"); + continue; + } + sb.append(value); + sb.append(";"); + } + } + } + + + }else { + MessageBox.post(rev.getStringProperty("item_id")+"ûз࣬ȷͷ!!", + "ʾ", MessageBox.WARNING); + return null; + } + String sb2 = ""; + if(sb.length()>1) { + sb2 = sb.substring(0, sb.length()-1); + } + StringBuilder specSB = new StringBuilder(); + if(valueBean.getBrand() != null) { + if(!("".equals((valueBean.getBrand()).trim())) + && !("/".equals((valueBean.getBrand()).trim())) + && !("null".equals((valueBean.getBrand()).trim()))) { + specSB.append(valueBean.getBrand()); + specSB.append(";"); + } + } + if(valueBean.getSpec() != null) { + if(!("".equals((valueBean.getSpec()).trim())) + && !("/".equals((valueBean.getSpec()).trim())) + && !("null".equals((valueBean.getSpec()).trim()))) { + specSB.append(valueBean.getSpec()); + specSB.append(";"); + } + } + if(valueBean.getCode() != null) { + if(!("".equals((valueBean.getCode()).trim())) + && !("/".equals((valueBean.getCode()).trim())) + && !("null".equals((valueBean.getCode()).trim()))) { + specSB.append(valueBean.getCode()); + specSB.append(";"); + } + } + specSB.append(sb2); + valueBean.setSpecs(specSB.toString()); +// return valueBean; + + } + catch (Exception e) { + // TODO: handle exception + e.printStackTrace(); + }finally { + DbPool.freeAll(); + } + return valueBean; + + + } + + private static Map> classPropMap = new HashMap>(); + private static Map> claMapMap = new HashMap>(); + + public static void getClassMap(TCComponentItemRevision rev,String className,TCSession session) throws TCException{ + + List classPropList = new ArrayList(); + + TCClassificationService classificationService = session.getClassificationService(); + TCComponentICO[] icos = rev.getClassificationObjects(); + ICSAdminClass c = classificationService.newICSAdminClass(); + c.load(className); + + if(classPropMap.containsKey(className)) { + return; + } + + //String icoPUID = icos[0].getUid(); + Map claMap = new HashMap(); + if(icos != null && icos.length>0){ + ICSProperty[] icss = icos[0].getICSProperties(true); + for (ICSProperty ics : icss) { + claMap.put(ics.getId(), ics.getValue()); + } + } + ICSAdminClassAttribute[] icsAttrS = c.getAttributes(); + + if (icsAttrS != null) { + for (ICSAdminClassAttribute attr : icsAttrS) { + if (attr.isReferenceAttribute()) { + continue; + } + if (attr.isReference()) { + continue; + } + ClassPropBean bean = new ClassPropBean(attr); + classPropList.add(bean); + } + + } + claMapMap.put(className, claMap); + classPropMap.put(className, classPropList); + } + + public static ClassValueBean getOutBuyPartValue1(TCComponentItemRevision rev,List errList,TCSession session) { + // TODO Auto-generated method stub + ClassValueBean valueBean = new ClassValueBean(); + StringBuilder sb = new StringBuilder(); + + + try { + + + String className = rev.getClassificationClass(); + if("".equals(className.trim())) { + errList.add(className); + MessageBox.post(rev.getStringProperty("item_id")+"ûз࣬ȷͷ!!", + "ʾ", MessageBox.WARNING); + return null; + } + + getClassMap(rev,className,session); + Map claMap = claMapMap.get(className); + List classPropList = classPropMap.get(className); + + for (int i = 0; i < classPropList.size(); i++) { + ClassPropBean bean = classPropList.get(i); + String attrName = bean.propDisName; + System.out.println("attrName==========="+attrName); + String value = claMap.get(bean.propID); + if(bean.isLov) { + String lovValue = bean.lovMapping.get(value); + if("Ʒ".equals(attrName)) { + valueBean.setBrand(lovValue); + }else if("λ".equals(attrName)){ + valueBean.setUnit(lovValue); + } + else if(attrName.contains("")){ + String kaitou1 = attrName.substring(0,2); + //ǰǷΪ + if("".equals(kaitou1)) { + valueBean.setSpec(lovValue); + }else { + if("/".equals(lovValue) || "null".equals(lovValue)) { + System.out.println("ƴ"); + continue; + } + sb.append(lovValue); + if(i < classPropList.size()-1) { + sb.append(";"); + } + } + } + else if(attrName.contains("")){ + valueBean.setCode(lovValue); + }else { + if("/".equals(lovValue) || "null".equals(lovValue)) { + System.out.println("ƴ"); + continue; + } + sb.append(lovValue); + if(i < classPropList.size()-1) { + sb.append(";"); + } + } + }else { + if("Ʒ".equals(attrName)) { + valueBean.setBrand(value); + }else if("λ".equals(attrName)){ + valueBean.setUnit(value); + }else if(attrName.contains("")){ + String kaitou2 = attrName.substring(0,2); + //ǰǷΪ + if("".equals(kaitou2)) { + valueBean.setSpec(value); + }else { + if("/".equals(value) || "null".equals(value)) { + System.out.println("ƴ"); + continue; + } + sb.append(value); + if(i < classPropList.size()-1) { + sb.append(";"); + } + } + }else if(attrName.contains("")){ + valueBean.setCode(value); + }else { + if("/".equals(value) || "null".equals(value)) { + System.out.println("ƴ"); + continue; + } + sb.append(value); + if(i < classPropList.size()-1) { + sb.append(";"); + } + } + } + } + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + StringBuilder specSB = new StringBuilder(); + if(valueBean.getBrand() != null) { + if(!("".equals((valueBean.getBrand()).trim())) + && !("/".equals((valueBean.getBrand()).trim())) + && !("null".equals((valueBean.getBrand()).trim()))) { + specSB.append(valueBean.getBrand()); + specSB.append(";"); + } + } + if(valueBean.getSpec() != null) { + if(!("".equals((valueBean.getSpec()).trim())) + && !("/".equals((valueBean.getSpec()).trim())) + && !("null".equals((valueBean.getSpec()).trim()))) { + specSB.append(valueBean.getSpec()); + specSB.append(";"); + } + } + if(valueBean.getCode() != null) { + if(!("".equals((valueBean.getCode()).trim())) + && !("/".equals((valueBean.getCode()).trim())) + && !("null".equals((valueBean.getCode()).trim()))) { + specSB.append(valueBean.getCode()); + specSB.append(";"); + } + } + specSB.append(sb.toString()); + valueBean.setSpecs(specSB.toString()); + return valueBean; + } public static ClassValueBean getOutBuyPartValue(TCComponentItemRevision rev,List errList) { @@ -26,7 +411,6 @@ public class ClassValueUtil { ClassValueBean valueBean = new ClassValueBean(); AbstractAIFApplication app = AIFUtility.getCurrentApplication(); TCSession session = (TCSession) app.getSession(); - List vals = new ArrayList(); StringBuilder sb = new StringBuilder(); List classPropList = new ArrayList(); TCClassificationService classificationService = session.getClassificationService(); @@ -74,6 +458,7 @@ public class ClassValueUtil { String value = claMap.get(bean.propID); if(bean.isLov) { String lovValue = bean.lovMapping.get(value); + System.out.println("value==========="+lovValue); if("Ʒ".equals(attrName)) { valueBean.setBrand(lovValue); }else if("λ".equals(attrName)){ @@ -84,6 +469,15 @@ public class ClassValueUtil { //ǰǷΪ if("".equals(kaitou1)) { valueBean.setSpec(lovValue); + }else { + if("/".equals(lovValue) || "null".equals(lovValue)) { + System.out.println("ƴ"); + continue; + } + sb.append(lovValue); + if(i < classPropList.size()-1) { + sb.append(";"); + } } } else if(attrName.contains("")){ @@ -98,7 +492,8 @@ public class ClassValueUtil { sb.append(";"); } } - }else { + }else { + System.out.println("value==========="+value); if("Ʒ".equals(attrName)) { valueBean.setBrand(value); }else if("λ".equals(attrName)){ @@ -108,6 +503,15 @@ public class ClassValueUtil { //ǰǷΪ if("".equals(kaitou2)) { valueBean.setSpec(value); + }else { + if("/".equals(value) || "null".equals(value)) { + System.out.println("ƴ"); + continue; + } + sb.append(value); + if(i < classPropList.size()-1) { + sb.append(";"); + } } }else if(attrName.contains("")){ valueBean.setCode(value); diff --git a/src/com/connor/dfl/plm/util/DataBaseControl.java b/src/com/connor/dfl/plm/util/DataBaseControl.java index efce79f..6381afc 100644 --- a/src/com/connor/dfl/plm/util/DataBaseControl.java +++ b/src/com/connor/dfl/plm/util/DataBaseControl.java @@ -416,7 +416,7 @@ public class DataBaseControl { if("ȫ".equals(product)) { product = ""; } - String sql = "select * from DFL_CHANGEFORM where PRODUCTDEPARTMENT like '%"+product+"%'";// + String sql = "select APPLYNAME,OBJECTCODE,APPLYDATE,PRODUCTNAME,PROJECTMODEL,CLIENTNAME,WAREHOUSECODE,NOTIFYEMERGENCYPROCEDURES,TZGGLX,PRODUCTDEPARTMENT,DUTYDEPARTMENT,DUTYMAN,CHANGETYPE,PRODUCTTYPE,ERRORTYPE,PRICEBOOKING,SALSECLASSIFY,ISNOTPRODUCTLOSS,XMJD,RECEIVECLASSIFY,DRAWINGTO,PROJECTCODE,CHANGEREASON,ACCOUNTSET,FORM_MAJOR,PKEYWORD,MANAGECLASSIFY,KKCODE,case when REASONDETAIL is null then changereason else REASONDETAIL end as REASONDETAIL from DFL_CHANGEFORM where PRODUCTDEPARTMENT like '%"+product+"%'";// SimpleDateFormat df = new SimpleDateFormat("yyyy-M-d HH:mm"); openDataBase(); System.out.println("sql============"+sql); @@ -436,30 +436,36 @@ public class DataBaseControl { } if(date.after(date1) && date.before(date2)) { ChangeBean bn = new ChangeBean(); - bn.setApplyName(rs.getString(2)); + bn.setApplyName(rs.getString(1)); bn.setApplyDate(rs.getString(3)); - bn.setProjectCode(rs.getString(4)); - bn.setClientNae(rs.getString(5)); - bn.setProductName(rs.getString(7)); - bn.setProjectModel(rs.getString(8)); - bn.setChangeType(rs.getString(10)); - bn.setProductType(rs.getString(11)); - bn.setErrorType(rs.getString(12)); - bn.setDutyDepartment(rs.getString(13)); - bn.setDutyMan(rs.getString(14)); - bn.setChangeReason(rs.getString(15)); - bn.setSalseClassify(rs.getString(16)); - bn.setPriceBooking(rs.getString(17)); + bn.setProjectCode(rs.getString(22)); + bn.setClientNae(rs.getString(6)); + bn.setProductName(rs.getString(4)); + bn.setProjectModel(rs.getString(5)); + bn.setChangeType(rs.getString(13)); + bn.setProductType(rs.getString(14)); + bn.setErrorType(rs.getString(15)); + bn.setDutyDepartment(rs.getString(11)); + bn.setDutyMan(rs.getString(12)); + bn.setChangeReason(rs.getString(23)); + bn.setSalseClassify(rs.getString(17)); + bn.setPriceBooking(rs.getString(16)); bn.setIsNotProductLoss(rs.getString(18)); - bn.setReceiveClassify(rs.getString(19)); - bn.setWarehouseCode(rs.getString(20)); - bn.setAccountSet(rs.getString(21)); - bn.setNotifyEmergencyProcedures(rs.getString(22)); - bn.setDrawingTo(rs.getString(23)); - bn.setChangeListCode(rs.getString(24)); - bn.setTZChangeType(rs.getString(25)); - bn.setSUOSU_ProductDepartment(rs.getString(26)); - bn.setProjectState(rs.getString(27)); + bn.setReceiveClassify(rs.getString(20)); + bn.setWarehouseCode(rs.getString(7)); + bn.setAccountSet(rs.getString(24)); + bn.setNotifyEmergencyProcedures(rs.getString(8)); + bn.setDrawingTo(rs.getString(21)); + bn.setChangeListCode(rs.getString(2)); + bn.setTZChangeType(rs.getString(9)); + bn.setSUOSU_ProductDepartment(rs.getString(10)); + bn.setProjectState(rs.getString(19)); + bn.setFormMajor(rs.getString(25)); + bn.setPkeyword(rs.getString(26)); + bn.setManageclassify(rs.getString(27)); + bn.setKkcode(rs.getString(28)); + + bn.setReasonDetail(rs.getString(29)); list.add(bn); } } catch (ParseException e) { @@ -549,13 +555,14 @@ public class DataBaseControl { String max = selCodeBean.getMax(); openDataBase(); - String query = "select * from (select * from pitem where pitem_id like '"+prefix+"%' order by pitem_id desc) where rownum<=1"; + //String query = "select * from (select * from pitem where pitem_id like '"+prefix+"%' order by pitem_id desc) where rownum<=1"; + String query = "select LSH from PLM_LSH where PREFIX = prefix"; // ѯidݿе ResultSet rs = dbQuery(query); String lshstr = col; String lsh = ""; if (rs.next()) { - lsh = rs.getString(2); + lsh = rs.getString(0); System.out.println("sslsh=" + lsh); if ("".equals(lsh)) { throw new Exception("ˮΪգ"); diff --git a/src/com/connor/dfl/plm/util/DateChooser.java b/src/com/connor/dfl/plm/util/DateChooser.java index 413ddc2..06cc5b1 100644 --- a/src/com/connor/dfl/plm/util/DateChooser.java +++ b/src/com/connor/dfl/plm/util/DateChooser.java @@ -1,1391 +1,698 @@ package com.connor.dfl.plm.util; -import java.awt.BasicStroke; +import java.awt.BasicStroke; import java.awt.BorderLayout; - import java.awt.Color; - import java.awt.Component; - import java.awt.Cursor; - import java.awt.Dimension; - import java.awt.Font; - import java.awt.Graphics; - import java.awt.Graphics2D; - import java.awt.GridLayout; - import java.awt.Point; - import java.awt.Polygon; - import java.awt.Stroke; - import java.awt.Toolkit; - import java.awt.event.FocusEvent; - import java.awt.event.FocusListener; - import java.awt.event.MouseAdapter; - import java.awt.event.MouseEvent; - import java.awt.event.MouseListener; - import java.awt.event.MouseMotionListener; - import java.text.SimpleDateFormat; - import java.util.ArrayList; - import java.util.Calendar; - import java.util.Comparator; - import java.util.Date; - import java.util.List; - - import javax.swing.BorderFactory; - import javax.swing.JComponent; - import javax.swing.JFrame; - import javax.swing.JLabel; - import javax.swing.JPanel; - import javax.swing.JTextField; - import javax.swing.Popup; - import javax.swing.PopupFactory; - import javax.swing.SwingUtilities; - import javax.swing.event.AncestorEvent; - import javax.swing.event.AncestorListener; - - /** - * ѡָڵʾʽ - */ - public class DateChooser extends JPanel { - - private static final long serialVersionUID = 4529266044762990227L; - - private Date initDate; - private Calendar now = Calendar.getInstance(); - private Calendar select; - private JPanel monthPanel;// - private JP1 jp1;//Ŀ, - private JP2 jp2; - private JP3 jp3; - private JP4 jp4; - private Font font = new Font("", Font.PLAIN, 12); - private final LabelManager lm = new LabelManager(); - private SimpleDateFormat sdf; - private boolean isShow = false; - private Popup pop; - - private JComponent showDate; - - public static DateChooser getInstance() { - return new DateChooser(); - } - - public static DateChooser getInstance(Date date) { - return new DateChooser(date); - } - - public static DateChooser getInstance(String format) { - return new DateChooser(format); - } - - public static DateChooser getInstance(Date date, String format) { - return new DateChooser(date, format); - } - - /** - * Creates a new instance of DateChooser - */ - private DateChooser() { - this(new Date()); - } - - private DateChooser(Date date) { - this(date, "yyyyMMdd"); - } - - private DateChooser(String format) { - this(new Date(), format); - } - - private DateChooser(Date date, String format) { - initDate = date; - sdf = new SimpleDateFormat(format); - select = Calendar.getInstance(); - select.setTime(initDate); - initPanel(); - } - - /** - * Ƿûѡ - */ - public void setEnabled(boolean b) { - super.setEnabled(b); - showDate.setEnabled(b); - } - - /** - *õǰѡ - */ - public Date getDate() { - return select.getTime(); - } - - public String getStrDate() { - return sdf.format(select.getTime()); - } - - public String getStrDate(String format) { - sdf = new SimpleDateFormat(format); - return sdf.format(select.getTime()); - } - - //ݳʼ,ʼ - private void initPanel() { - monthPanel = new JPanel(new BorderLayout()); - monthPanel.setBorder(BorderFactory.createLineBorder(Color.BLUE)); - JPanel up = new JPanel(new BorderLayout()); - up.add(jp1 = new JP1(), BorderLayout.NORTH); - up.add(jp2 = new JP2(), BorderLayout.CENTER); - monthPanel.add(jp3 = new JP3(), BorderLayout.CENTER); - monthPanel.add(up, BorderLayout.NORTH); - monthPanel.add(jp4 = new JP4(), BorderLayout.SOUTH); - this.addAncestorListener(new AncestorListener() { - public void ancestorAdded(AncestorEvent event) { - - } - - public void ancestorRemoved(AncestorEvent event) { - - } - - //ֻҪһƶ,Ͼpopupʧ - public void ancestorMoved(AncestorEvent event) { - hidePanel(); - } - }); - } - - public void register(final JComponent showDate) { - this.showDate = showDate; - - showDate.setRequestFocusEnabled(true); - showDate.addMouseListener(new MouseAdapter() { - public void mousePressed(MouseEvent me) { - showDate.requestFocusInWindow(); - } - }); - this.setBackground(Color.WHITE); - this.add(showDate, BorderLayout.CENTER); - this.setPreferredSize(new Dimension(90, 25)); - this.setBorder(BorderFactory.createLineBorder(Color.GRAY)); - showDate.addMouseListener(new MouseAdapter() { - public void mouseEntered(MouseEvent me) { - if (showDate.isEnabled()) { - showDate.setCursor(new Cursor(Cursor.HAND_CURSOR)); - showDate.setForeground(Color.RED); - } - } - - public void mouseExited(MouseEvent me) { - if (showDate.isEnabled()) { - showDate.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); - showDate.setForeground(Color.BLACK); - } - } - - public void mousePressed(MouseEvent me) { - if (showDate.isEnabled()) { - showDate.setForeground(Color.CYAN); - if (isShow) { - hidePanel(); - } else { - showPanel(showDate); - } - } - } - - public void mouseReleased(MouseEvent me) { - if (showDate.isEnabled()) { - showDate.setForeground(Color.BLACK); - } - } - }); - showDate.addFocusListener(new FocusListener() { - public void focusLost(FocusEvent e) { - hidePanel(); - } - - public void focusGained(FocusEvent e) { - - } - }); - } - - //µˢ - private void refresh() { - jp1.updateDate(); - jp2.updateDate(); - jp3.updateDate(); - jp4.updateDate(); - SwingUtilities.updateComponentTreeUI(this); - } - - //ύ - private void commit() { - //TODO add other components here - if (showDate instanceof JTextField) { - ((JTextField) showDate).setText(sdf.format(select.getTime())); - }else if (showDate instanceof JLabel) { - ((JLabel) showDate).setText(sdf.format(select.getTime())); - } - - hidePanel(); - } - - //ѡ - private void hidePanel() { - if (pop != null) { - isShow = false; - pop.hide(); - pop = null; - } - } - - //ʾѡ - private void showPanel(Component owner) { - if (pop != null) { - pop.hide(); - } - Point show = new Point(0, showDate.getHeight()); - SwingUtilities.convertPointToScreen(show, showDate); - Dimension size = Toolkit.getDefaultToolkit().getScreenSize(); - int x = show.x; - int y = show.y; - if (x < 0) { - x = 0; - } - if (x > size.width - 295) { - x = size.width - 295; - } - if (y < size.height - 170) { - } else { - y -= 188; - } - pop = PopupFactory.getSharedInstance().getPopup(owner, monthPanel, x, y); - pop.show(); - isShow = true; - } - - /** - * ʾ·ݵ - */ - private class JP1 extends JPanel { - private static final long serialVersionUID = -5638853772805561174L; - JLabel yearleft, yearright, monthleft, monthright, center, centercontainer; - - public JP1() { - super(new BorderLayout()); - this.setBackground(new Color(160, 185, 215)); - initJP1(); - } - - private void initJP1() { - yearleft = new JLabel(" <<", JLabel.CENTER); - yearleft.setToolTipText("һ"); - yearright = new JLabel(">> ", JLabel.CENTER); - yearright.setToolTipText("һ"); - yearleft.setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0)); - yearright.setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0)); - - monthleft = new JLabel(" <", JLabel.RIGHT); - monthleft.setToolTipText("һ"); - monthright = new JLabel("> ", JLabel.LEFT); - monthright.setToolTipText("һ"); - monthleft.setBorder(BorderFactory.createEmptyBorder(2, 30, 0, 0)); - monthright.setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 30)); - - centercontainer = new JLabel("", JLabel.CENTER); - centercontainer.setLayout(new BorderLayout()); - center = new JLabel("", JLabel.CENTER); - - centercontainer.add(monthleft, BorderLayout.WEST); - centercontainer.add(center, BorderLayout.CENTER); - centercontainer.add(monthright, BorderLayout.EAST); - - this.add(yearleft, BorderLayout.WEST); - this.add(centercontainer, BorderLayout.CENTER); - this.add(yearright, BorderLayout.EAST); - this.setPreferredSize(new Dimension(295, 25)); - - updateDate(); - - yearleft.addMouseListener(new MouseAdapter() { - public void mouseEntered(MouseEvent me) { - yearleft.setCursor(new Cursor(Cursor.HAND_CURSOR)); - yearleft.setForeground(Color.RED); - } - - public void mouseExited(MouseEvent me) { - yearleft.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); - yearleft.setForeground(Color.BLACK); - } - - public void mousePressed(MouseEvent me) { - select.add(Calendar.YEAR, -1); - yearleft.setForeground(Color.WHITE); - refresh(); - } - - public void mouseReleased(MouseEvent me) { - yearleft.setForeground(Color.BLACK); - } - }); - yearright.addMouseListener(new MouseAdapter() { - public void mouseEntered(MouseEvent me) { - yearright.setCursor(new Cursor(Cursor.HAND_CURSOR)); - yearright.setForeground(Color.RED); - } - - public void mouseExited(MouseEvent me) { - yearright.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); - yearright.setForeground(Color.BLACK); - } - - public void mousePressed(MouseEvent me) { - select.add(Calendar.YEAR, 1); - yearright.setForeground(Color.WHITE); - refresh(); - } - - public void mouseReleased(MouseEvent me) { - yearright.setForeground(Color.BLACK); - } - }); - monthleft.addMouseListener(new MouseAdapter() { - public void mouseEntered(MouseEvent me) { - monthleft.setCursor(new Cursor(Cursor.HAND_CURSOR)); - monthleft.setForeground(Color.RED); - } - - public void mouseExited(MouseEvent me) { - monthleft.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); - monthleft.setForeground(Color.BLACK); - } - - public void mousePressed(MouseEvent me) { - select.add(Calendar.MONTH, -1); - monthleft.setForeground(Color.WHITE); - refresh(); - } - - public void mouseReleased(MouseEvent me) { - monthleft.setForeground(Color.BLACK); - } - }); - monthright.addMouseListener(new MouseAdapter() { - public void mouseEntered(MouseEvent me) { - monthright.setCursor(new Cursor(Cursor.HAND_CURSOR)); - monthright.setForeground(Color.RED); - } - - public void mouseExited(MouseEvent me) { - monthright.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); - monthright.setForeground(Color.BLACK); - } - - public void mousePressed(MouseEvent me) { - select.add(Calendar.MONTH, 1); - monthright.setForeground(Color.WHITE); - refresh(); - } - - public void mouseReleased(MouseEvent me) { - monthright.setForeground(Color.BLACK); - } - }); - } - - private void updateDate() { - center.setText(select.get(Calendar.YEAR) + "" + (select.get(Calendar.MONTH) + 1) + ""); - } - } - - private class JP2 extends JPanel { - private static final long serialVersionUID = -8176264838786175724L; - - public JP2() { - this.setPreferredSize(new Dimension(295, 20)); - } - - protected void paintComponent(Graphics g) { - g.setFont(font); - g.drawString(" һ ڶ ", 5, 10); - g.drawLine(0, 15, getWidth(), 15); - } - - private void updateDate() { - - } - } - - private class JP3 extends JPanel { - private static final long serialVersionUID = 43157272447522985L; - - public JP3() { - super(new GridLayout(6, 7)); - this.setPreferredSize(new Dimension(295, 100)); - initJP3(); - } - - private void initJP3() { - updateDate(); - } - - public void updateDate() { - this.removeAll(); - lm.clear(); - Date temp = select.getTime(); - Calendar select = Calendar.getInstance(); - select.setTime(temp); - select.set(Calendar.DAY_OF_MONTH, 1); - int index = select.get(Calendar.DAY_OF_WEEK); - int sum = (index == 1 ? 8 : index); - select.add(Calendar.DAY_OF_MONTH, 0 - sum); - for (int i = 0; i < 42; i++) { - select.add(Calendar.DAY_OF_MONTH, 1); - lm.addLabel(new MyLabel(select.get(Calendar.YEAR), select.get(Calendar.MONTH), select.get(Calendar.DAY_OF_MONTH))); - } - for (MyLabel my : lm.getLabels()) { - this.add(my); - } - select.setTime(temp); - } - } - - private class MyLabel extends JLabel implements Comparator, MouseListener, MouseMotionListener { - private static final long serialVersionUID = 3668734399227577214L; - private int year, month, day; - private boolean isSelected; - - public MyLabel(int year, int month, int day) { - super("" + day, JLabel.CENTER); - this.year = year; - this.day = day; - this.month = month; - this.addMouseListener(this); - this.addMouseMotionListener(this); - this.setFont(font); - if (month == select.get(Calendar.MONTH)) { - this.setForeground(Color.BLACK); - } else { - this.setForeground(Color.LIGHT_GRAY); - } - if (day == select.get(Calendar.DAY_OF_MONTH)) { - this.setBackground(new Color(160, 185, 215)); - } else { - this.setBackground(Color.WHITE); - } - } - - public boolean getIsSelected() { - return isSelected; - } - - public void setSelected(boolean b, boolean isDrag) { - isSelected = b; - if (b && !isDrag) { - int temp = select.get(Calendar.MONTH); - select.set(year, month, day); - if (temp == month) { - SwingUtilities.updateComponentTreeUI(jp3); - } else { - refresh(); - } - } - this.repaint(); - } - - protected void paintComponent(Graphics g) { - if (day == select.get(Calendar.DAY_OF_MONTH) && month == select.get(Calendar.MONTH)) { - //ǰѡ,ʾ - g.setColor(new Color(160, 185, 215)); - g.fillRect(0, 0, getWidth(), getHeight()); - } - if (year == now.get(Calendar.YEAR) && month == now.get(Calendar.MONTH) && day == now.get(Calendar.DAY_OF_MONTH)) { - //ں͵ǰһ,ú - Graphics2D gd = (Graphics2D) g; - gd.setColor(Color.RED); - Polygon p = new Polygon(); - p.addPoint(0, 0); - p.addPoint(getWidth() - 1, 0); - p.addPoint(getWidth() - 1, getHeight() - 1); - p.addPoint(0, getHeight() - 1); - gd.drawPolygon(p); - } - if (isSelected) {//ѡ˾ͻһ߿ - Stroke s = new BasicStroke(1.0f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_BEVEL, 1.0f, new float[] { 2.0f, 2.0f }, 1.0f); - Graphics2D gd = (Graphics2D) g; - gd.setStroke(s); - gd.setColor(Color.BLACK); - Polygon p = new Polygon(); - p.addPoint(0, 0); - p.addPoint(getWidth() - 1, 0); - p.addPoint(getWidth() - 1, getHeight() - 1); - p.addPoint(0, getHeight() - 1); - gd.drawPolygon(p); - } - super.paintComponent(g); - } - - public boolean contains(Point p) { - return this.getBounds().contains(p); - } - - private void update() { - repaint(); - } - - public void mouseClicked(MouseEvent e) { - } - - public void mousePressed(MouseEvent e) { - isSelected = true; - update(); - } - - public void mouseReleased(MouseEvent e) { - Point p = SwingUtilities.convertPoint(this, e.getPoint(), jp3); - lm.setSelect(p, false); - commit(); - } - - public void mouseEntered(MouseEvent e) { - } - - public void mouseExited(MouseEvent e) { - } - - public void mouseDragged(MouseEvent e) { - Point p = SwingUtilities.convertPoint(this, e.getPoint(), jp3); - lm.setSelect(p, true); - } - - public void mouseMoved(MouseEvent e) { - } - - public int compare(MyLabel o1, MyLabel o2) { - Calendar c1 = Calendar.getInstance(); - c1.set(o1.year, o2.month, o1.day); - Calendar c2 = Calendar.getInstance(); - c2.set(o2.year, o2.month, o2.day); - return c1.compareTo(c2); - } - } - - private class LabelManager { - private List list; - - public LabelManager() { - list = new ArrayList(); - } - - public List getLabels() { - return list; - } - - public void addLabel(MyLabel my) { - list.add(my); - } - - public void clear() { - list.clear(); - } - - @SuppressWarnings("unused") - public void setSelect(MyLabel my, boolean b) { - for (MyLabel m : list) { - if (m.equals(my)) { - m.setSelected(true, b); - } else { - m.setSelected(false, b); - } - } - } - - public void setSelect(Point p, boolean b) { - //϶,ҪŻһ,Ч - if (b) { - //ʾǷܷ,ñȽеıǩ,ܷصı־ǰһǩ - //Ҫʾıǩҵ˾Ϳ - boolean findPrevious = false, findNext = false; - for (MyLabel m : list) { - if (m.contains(p)) { - findNext = true; - if (m.getIsSelected()) { - findPrevious = true; - } else { - m.setSelected(true, b); - } - } else if (m.getIsSelected()) { - findPrevious = true; - m.setSelected(false, b); - } - if (findPrevious && findNext) { - return; - } - } - } else { - MyLabel temp = null; - for (MyLabel m : list) { - if (m.contains(p)) { - temp = m; - } else if (m.getIsSelected()) { - m.setSelected(false, b); - } - } - if (temp != null) { - temp.setSelected(true, b); - } - } - } - - } - - private class JP4 extends JPanel { - private static final long serialVersionUID = -6391305687575714469L; - - public JP4() { - super(new BorderLayout()); - this.setPreferredSize(new Dimension(295, 20)); - this.setBackground(new Color(160, 185, 215)); - SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); - final JLabel jl = new JLabel(": " + sdf.format(new Date())); - jl.setToolTipText("ѡ"); - this.add(jl, BorderLayout.CENTER); - jl.addMouseListener(new MouseAdapter() { - public void mouseEntered(MouseEvent me) { - jl.setCursor(new Cursor(Cursor.HAND_CURSOR)); - jl.setForeground(Color.RED); - } - - public void mouseExited(MouseEvent me) { - jl.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); - jl.setForeground(Color.BLACK); - } - - public void mousePressed(MouseEvent me) { - jl.setForeground(Color.WHITE); - select.setTime(new Date()); - refresh(); - commit(); - } - - public void mouseReleased(MouseEvent me) { - jl.setForeground(Color.BLACK); - } - }); - } - - private void updateDate() { - - } - } - - public static void main(String[] args) { - DateChooser dateChooser1 = DateChooser.getInstance("yyyy-MM-dd"); - DateChooser dateChooser2 = DateChooser.getInstance("yyyy-MM-dd"); - JTextField showDate1 = new JTextField("ѡ"); - JLabel showDate2 = new JLabel("ѡ"); - - dateChooser1.register(showDate1); - dateChooser2.register(showDate2); - - JFrame jf = new JFrame("ѡ"); - jf.add(showDate1, BorderLayout.NORTH); - jf.add(showDate2, BorderLayout.SOUTH); - jf.pack(); - jf.setLocationRelativeTo(null); - jf.setVisible(true); - jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - } - -} \ No newline at end of file +} diff --git a/src/com/connor/dfl/plm/util/ExcelUtil.java b/src/com/connor/dfl/plm/util/ExcelUtil.java index 1235532..dc949fb 100644 --- a/src/com/connor/dfl/plm/util/ExcelUtil.java +++ b/src/com/connor/dfl/plm/util/ExcelUtil.java @@ -1,268 +1,13 @@ package com.connor.dfl.plm.util; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import javax.swing.JOptionPane; - -import org.apache.poi.ddf.EscherBSERecord; -import org.apache.poi.ddf.EscherBitmapBlip; -import org.apache.poi.hssf.model.InternalWorkbook; -import org.apache.poi.hssf.usermodel.HSSFCell; -import org.apache.poi.hssf.usermodel.HSSFCellStyle; -import org.apache.poi.hssf.usermodel.HSSFClientAnchor; -import org.apache.poi.hssf.usermodel.HSSFPatriarch; -import org.apache.poi.hssf.usermodel.HSSFRow; -import org.apache.poi.hssf.usermodel.HSSFSheet; -import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.Cell; -import org.apache.poi.ss.usermodel.CellStyle; -import org.apache.poi.ss.usermodel.Font; -import org.apache.poi.ss.usermodel.Row; -import org.apache.poi.ss.util.CellRangeAddress; -import org.apache.poi.hssf.util.HSSFCellUtil; - -/** - * Excelд - * */ -public class ExcelUtil { -/** - * ܣHSSFSheet - * @param wb HSSFWorkbook - * @param sheetName String - * @return HSSFSheet -*/ - public static HSSFSheet createSheet(HSSFWorkbook wb,String sheetName){ - HSSFSheet sheet=wb.createSheet(sheetName); - sheet.setDefaultColumnWidth(12); - sheet.setGridsPrinted(false); - sheet.setDisplayGridlines(false); - return sheet; - } - -/** - * ܣHSSFRow - * @param sheet HSSFSheet - * @param rowNum int - * @param height int - * @return HSSFRow -*/ - public static HSSFRow createRow(HSSFSheet sheet,int rowNum,int height){ - HSSFRow row=sheet.createRow(rowNum); - row.setHeight((short)height); - return row; - } - - public static HSSFCell createCell0(HSSFRow row,int cellNum){ - HSSFCell cell=row.createCell(cellNum); - return cell; - } - -/** - * ܣCELL - * @param row HSSFRow - * @param cellNum int - * @param style HSSFStyle - * @return HSSFCell -*/ - public static HSSFCell createCell(HSSFRow row,int cellNum,CellStyle style){ - HSSFCell cell=row.createCell(cellNum); - cell.setCellStyle(style); - return cell; - } - -/** - * ܣCellStyleʽ - * @param wb HSSFWorkbook - * @param backgroundColor ɫ - * @param foregroundColor ǰɫ - * @param font - * @return CellStyle -*/ - public static CellStyle createCellStyle(HSSFWorkbook wb,short backgroundColor,short foregroundColor,short halign,Font font){ - CellStyle cs=wb.createCellStyle(); - cs.setAlignment(CellStyle.ALIGN_CENTER);//halign - cs.setVerticalAlignment(CellStyle.VERTICAL_CENTER); - cs.setFillBackgroundColor(backgroundColor); - cs.setFillForegroundColor(foregroundColor); - cs.setFillPattern(CellStyle.SOLID_FOREGROUND); - cs.setFont(font); - return cs; - } +import org.apache.poi.ss.usermodel.DataFormatter; -/** - * ܣ߿CellStyleʽ - * @param wb HSSFWorkbook - * @param backgroundColor ɫ - * @param foregroundColor ǰɫ - * @param font - * @return CellStyle -*/ - public static CellStyle createBorderCellStyle(HSSFWorkbook wb,short backgroundColor,short foregroundColor,short halign,Font font){ - CellStyle cs=wb.createCellStyle(); - cs.setAlignment(halign); - cs.setVerticalAlignment(CellStyle.VERTICAL_CENTER); - cs.setFillBackgroundColor(backgroundColor); - cs.setFillForegroundColor(foregroundColor); - cs.setFillPattern(CellStyle.SOLID_FOREGROUND); - cs.setFont(font); - cs.setBorderLeft(CellStyle.BORDER_DASHED); - cs.setBorderRight(CellStyle.BORDER_DASHED); - cs.setBorderTop(CellStyle.BORDER_DASHED); - cs.setBorderBottom(CellStyle.BORDER_DASHED); - return cs; - } -/** - * ܣже뵽Excelñʽ -*/ - public static void writeArrayToExcel(HSSFSheet sheet,int rows,int cells,Object [][]value){ - Row row[]=new HSSFRow[rows]; - Cell cell[]=new HSSFCell[cells]; - for(int i=0;i