diff --git a/.classpath b/.classpath index 35f2133..734d2ee 100644 --- a/.classpath +++ b/.classpath @@ -92,7 +92,7 @@ + - diff --git a/lib/cn.com.origin.autocode_1.0.0.jar b/lib/cn.com.origin.autocode_1.0.0.jar index 971146d..27d18de 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 ce5cb3b..393697f 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 44e00a4..5dbd8c6 100644 --- a/plugin.xml +++ b/plugin.xml @@ -232,6 +232,9 @@ + + + @@ -447,7 +450,10 @@ - + + + + @@ -507,7 +513,19 @@ - + + + + + + + + + + + + + @@ -680,7 +698,36 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -711,19 +758,7 @@ - - - - - - - - - - - - - + --> @@ -791,7 +826,7 @@ - + diff --git a/src/com/connor/dfl/plm/dfl003/Dfl003AIFDialog.java b/src/com/connor/dfl/plm/dfl003/Dfl003AIFDialog.java index 7315745..54949ff 100644 --- a/src/com/connor/dfl/plm/dfl003/Dfl003AIFDialog.java +++ b/src/com/connor/dfl/plm/dfl003/Dfl003AIFDialog.java @@ -272,7 +272,7 @@ public class Dfl003AIFDialog extends AbstractAIFDialog { e2.printStackTrace(); } jtext1.setEnabled(false); - jtext2.setEnabled(false); + jtext2.setEnabled(true); jcomname.setEnabled(false); jp2.setLayout(null); jl1.setBounds(20, 20, 30, 30); diff --git a/src/com/connor/dfl/plm/dfl019/Dfl019Operation.java b/src/com/connor/dfl/plm/dfl019/Dfl019Operation.java index ab03901..63be2da 100644 --- a/src/com/connor/dfl/plm/dfl019/Dfl019Operation.java +++ b/src/com/connor/dfl/plm/dfl019/Dfl019Operation.java @@ -361,7 +361,9 @@ 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_outsourceRevision".equals(type)||"T2_OutBuyPartRevision".equals(type) ) { + //жǷ״̬ + if("T2_outsourceRevision".equals(type)||"T2_OutBuyPartRevision".equals(type) + ) { TCProperty tcProperty = rev.getTCProperty("release_status_list"); TCComponent[] targets = tcProperty.getReferenceValueArray(); String groupcode1 = rev.getStringProperty("t2_groupCode"); @@ -373,16 +375,20 @@ public class Dfl019Operation extends AbstractAIFOperation{ "ʾ", MessageBox.WARNING); return true; } - if(groupcode1.equals("")){ - MessageBox.post(rev.getStringProperty("item_id")+"ûзȺ!!", - "ʾ", MessageBox.WARNING); - return true; - } - if(sourceCode1.equals("")){ - MessageBox.post(rev.getStringProperty("item_id")+"ûԴ!!", - "ʾ", MessageBox.WARNING); - return true; + if("T2_outsourceRevision".equals(type)||"T2_OutBuyPartRevision".equals(type) + ) { + if(groupcode1.equals("")){ + MessageBox.post(rev.getStringProperty("item_id")+"ûзȺ!!", + "ʾ", MessageBox.WARNING); + return true; + } + if(sourceCode1.equals("")){ + MessageBox.post(rev.getStringProperty("item_id")+"ûԴ!!", + "ʾ", MessageBox.WARNING); + return true; + } } + } }else { MessageBox.post("ϲERP!!", @@ -830,6 +836,8 @@ public class Dfl019Operation extends AbstractAIFOperation{ 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()) { @@ -872,6 +880,8 @@ public class Dfl019Operation extends AbstractAIFOperation{ 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()) { diff --git a/src/com/connor/dfl/plm/dfl020/Dfl020Operation.java b/src/com/connor/dfl/plm/dfl020/Dfl020Operation.java index c5b2bf9..c882cab 100644 --- a/src/com/connor/dfl/plm/dfl020/Dfl020Operation.java +++ b/src/com/connor/dfl/plm/dfl020/Dfl020Operation.java @@ -178,6 +178,8 @@ public class Dfl020Operation extends AbstractAIFOperation{ if(comp[0] instanceof TCComponentItemRevision ) { rev = (TCComponentItemRevision) comp[0]; + String rve_id = rev.getStringProperty("current_revision_id"); + System.out.println("11.17rve_id======"+rve_id); } if(comp[0] instanceof TCComponentBOMLine ) { TCComponentBOMLine get_bom_line = (TCComponentBOMLine) comp[0]; @@ -186,8 +188,10 @@ public class Dfl020Operation extends AbstractAIFOperation{ TCProperty tcProperty1 = rev.getTCProperty("release_status_list"); TCComponent[] targets1 = tcProperty1.getReferenceValueArray(); String item_type = rev.getType(); - //ûз״̬ķ汾bomerp -// if(!("T2_VirtualRevision".equals(item_type))) { + + + //ûз״̬豸汾bomerp +// if("T2_VirtualRevision".equals(item_type)||"T2_EquipmentRevision".equals(item_type)) { // if(targets1 == null || targets1.length <= 0) { // MessageBox.post("ѡеİ汾ûз״̬","ʾ",MessageBox.INFORMATION); // return; @@ -253,7 +257,7 @@ public class Dfl020Operation extends AbstractAIFOperation{ TCTypeService service = session.getTypeService(); TCComponentBOMWindowType winType = (TCComponentBOMWindowType) service.getTypeComponent("BOMWindow"); TCComponentBOMWindow view = winType.create(null); - TCComponentBOMLine line = view.setWindowTopLine(item,item.getLatestItemRevision(), null, null); + TCComponentBOMLine line = view.setWindowTopLine(item,rev, null, null); AIFComponentContext[] childs = line.getChildren(); if(childs != null && childs.length > 0) { createXMLFile(line,zhangtao); @@ -286,6 +290,8 @@ public class Dfl020Operation extends AbstractAIFOperation{ //List list = new ArrayList(); StringBuilder uidSB = new StringBuilder(); + + try { getBOMValue(line,list); if(list.size() <=0) { @@ -295,7 +301,7 @@ public class Dfl020Operation extends AbstractAIFOperation{ } } catch (Exception e) { // TODO: handle exception - MessageBox.post("BOM ʧܣBOMǷȷ" ,"ʾ",MessageBox.INFORMATION); + MessageBox.post("BOM ʧܣBOMǷȷ!" ,"ʾ",MessageBox.INFORMATION); return; } //ȡ @@ -414,6 +420,8 @@ public class Dfl020Operation extends AbstractAIFOperation{ 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); @@ -531,8 +539,13 @@ public class Dfl020Operation extends AbstractAIFOperation{ list.add(fatherBean); for (int i = 0; i < childrens.length; i++) { + TCComponentBOMLine z_line = (TCComponentBOMLine)childrens[i].getComponent(); TCComponentItem item = z_line.getItem(); +// String idString = item.getStringProperty("item_id"); +// System.out.println("11.17id======"+idString); + System.out.println("11.17z_line======="+z_line); + System.out.println("11.17list======="+list); String type = item.getType(); System.out.println("type=============" + type); if (!("T2_OutBuyPart".equals(type)) && !("T2_outsource".equals(type))) diff --git a/src/com/connor/dfl/plm/dfl025/Dfl025Operation.java b/src/com/connor/dfl/plm/dfl025/Dfl025Operation.java index 6e927e5..ebede65 100644 --- a/src/com/connor/dfl/plm/dfl025/Dfl025Operation.java +++ b/src/com/connor/dfl/plm/dfl025/Dfl025Operation.java @@ -78,6 +78,7 @@ public class Dfl025Operation extends AbstractAIFOperation{ File file = ((TCComponentDataset)excel).getTcFiles()[0].getFmsFile(); SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");// ڸʽ String time = df.format(new Date()); + System.out.println("11.12======"+lattetTime+"========"+EarlyTime); String[] keys = new String[] {"ʱ","ʱ"}; String[] values = new String[] {lattetTime,EarlyTime}; List compList = queryObject("ϵͳ", keys, values); diff --git a/src/com/connor/dfl/plm/dfl028/Dfl028AIFDialog.java b/src/com/connor/dfl/plm/dfl028/Dfl028AIFDialog.java index 0f4366f..578c964 100644 --- a/src/com/connor/dfl/plm/dfl028/Dfl028AIFDialog.java +++ b/src/com/connor/dfl/plm/dfl028/Dfl028AIFDialog.java @@ -1,39 +1,55 @@ package com.connor.dfl.plm.dfl028; +import java.awt.Color; import java.awt.Component; +import java.awt.Container; +import java.awt.Desktop; import java.awt.Dimension; +import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.io.BufferedWriter; import java.io.File; -import java.io.FileInputStream; +import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; +import java.io.OutputStreamWriter; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; import javax.swing.JButton; import javax.swing.JCheckBox; +import javax.swing.JDialog; import javax.swing.JFileChooser; -import javax.swing.JLabel; +import javax.swing.JLabel; import javax.swing.JPanel; +import javax.swing.JProgressBar; import javax.swing.JTextField; import javax.swing.filechooser.FileSystemView; +import org.jacorb.idl.runtime.int_token; + import com.teamcenter.rac.aif.AbstractAIFApplication; import com.teamcenter.rac.aif.AbstractAIFDialog; import com.teamcenter.rac.aif.kernel.AIFComponentContext; -import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; +import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; import com.teamcenter.rac.kernel.TCComponent; import com.teamcenter.rac.kernel.TCComponentBOMLine; +import com.teamcenter.rac.kernel.TCComponentBOMWindow; +import com.teamcenter.rac.kernel.TCComponentBOMWindowType; import com.teamcenter.rac.kernel.TCComponentDataset; import com.teamcenter.rac.kernel.TCComponentItem; import com.teamcenter.rac.kernel.TCComponentItemRevision; -import com.teamcenter.rac.kernel.TCComponentTcFile; -import com.teamcenter.rac.kernel.TCComponentUser; +import com.teamcenter.rac.kernel.TCComponentRevisionRule; +import com.teamcenter.rac.kernel.TCComponentTcFile; import com.teamcenter.rac.kernel.TCException; -import com.teamcenter.rac.kernel.TCSession; +import com.teamcenter.rac.kernel.TCSession; import com.teamcenter.rac.util.MessageBox; -import com.teamcenter.rac.util.PropertyLayout; +import com.teamcenter.rac.util.PropertyLayout; public class Dfl028AIFDialog extends AbstractAIFDialog { private AbstractAIFApplication app; @@ -45,13 +61,26 @@ public class Dfl028AIFDialog extends AbstractAIFDialog { private JFileChooser jFileChooser; private JButton okBut = new JButton(""); private JButton celBut = new JButton("ȡ"); - private List fmsFilelist = new ArrayList<>(); - private List hzmlist = new ArrayList<>(); - private List namelist = new ArrayList<>(); + private ArrayList fmsFilelist = new ArrayList<>(); + private ArrayList hzmlist = new ArrayList<>(); + private ArrayList namelist = new ArrayList<>(); private FileInputStream fis; private FileOutputStream fos; private JPanel btnPanel1; - + private JPanel btnPanel2; + private JPanel btnPanel3; + private String hzm; + private int iDataset=0; + private String datasetDir; + private Boolean outPartBool=false; + private JProgressBar bar; + private long fileSize=0; + private Boolean allCheck=false; + private List noFileList=new ArrayList(); + private List datasetList=new ArrayList(); + private Map pathMap=new HashMap(); + private String pathString; + ExecutorService pool = Executors.newCachedThreadPool(); public Dfl028AIFDialog(AbstractAIFApplication arg0){ this.app = arg0; this.session = (TCSession)app.getSession(); @@ -61,19 +90,30 @@ public class Dfl028AIFDialog extends AbstractAIFDialog { @Override public void run() { //ʾ - init(); - - + init(); //òѯť // qryBtn.setEnabled(true); } //ȡļб - private void getload(TCComponentDataset dataset){ - try { + private void getload(TCComponentDataset dataset,String path,List list,String itemid){ + try { TCComponentTcFile[] file = dataset.getTcFiles(); - if(file == null || file.length ==0){ - MessageBox.post("ݼûõļ飡", - "WARNING",MessageBox.WARNING); + if(file == null || file.length ==0){ + if(itemid.equals("sjj")) { + String noFileString=path+"_"+dataset.getStringProperty("object_name"); + noFileList.add(noFileString); + }else { + AIFComponentContext[] itemRev = dataset.whereReferenced(); + String items=""; + for(AIFComponentContext context:itemRev) { + if(context.getComponent() instanceof TCComponentItemRevision) { + TCComponentItemRevision revision=(TCComponentItemRevision)context.getComponent(); + items=revision.getStringProperty("item_id")+"_"+revision.getStringProperty("current_revision_id"); + } + } + String noFileString=items+"_"+dataset.getStringProperty("object_name"); + noFileList.add(noFileString); + } return; }else{ for(int i=0;i", "-").replace(":", "-").replace("|","-"). + replace("\\","-").replace("*","-").replace("?","-"); + //ȡļû + File fmsFile = file[i].getFmsFile(); + hzmlist.add(hzm); + namelist.add(path+File.separator+replace); + fmsFilelist.add(fmsFile); + fileSize=fileSize+fmsFile.length(); + } } } } catch (TCException e) { @@ -102,10 +148,40 @@ public class Dfl028AIFDialog extends AbstractAIFDialog { } } + //ȡļ׺ +// private void gethzm(TCComponentDataset dataset) { +// try { +// //ȡļ +// TCComponentTcFile[] file = dataset.getTcFiles(); +// //жݼûõļ +// if(file == null || file.length ==0){ +// MessageBox.post("ݼûõļ飡", +// "WARNING",MessageBox.WARNING); +// return; +// }else{ +// //ѭļ +// for(int i=0;i list = new ArrayList(); Component[] jcbs = btnPanel1.getComponents();//ѡݴ for(Component component : jcbs) { - JCheckBox jcb = (JCheckBox) component; - if(jcb.isSelected()) { - list.add(jcb.getText()); - if("DWG".equals(jcb.getText())) { - list.add("T2_DWG"); - }else if ("STP".equals(jcb.getText())) { - list.add("TAI2_TCAI115_AISTEP"); + if(component instanceof JCheckBox) { + JCheckBox jcb = (JCheckBox) component; + if(jcb.isSelected()) { + list.add(jcb.getText()); + if("DWG".equals(jcb.getText())) { + list.add("DWG"); + list.add("dwg"); + }else if ("STP".equals(jcb.getText())) { + list.add("stp"); + }else if("PDF".equals(jcb.getText())) { + list.add("pdf"); + list.add("PDF"); + }else if("idw".equals(jcb.getText())) { + list.add("idw"); + }else if ("ipt".equals(jcb.getText())) { + list.add("ipt"); + }else if ("iam".equals(jcb.getText())) { + list.add("iam"); + }else if ("STEP".equals(jcb.getText())) { + list.add("STEP"); + list.add("step"); + } } - } - } - if(list.size() <= 0) { - list.add("T2_DWG"); - list.add("PDF"); - list.add("TAI2_TCAI115_AISTEP"); - } + } + } try { for (int i = 0; i < targets.length; i++) { if(targets[i] instanceof TCComponentBOMLine){ + List itemlist = new ArrayList(); + //ִлȡ͵ķ + itemlist = getitemType(); + //bom TCComponentBOMLine line = (TCComponentBOMLine) targets[i]; - TCComponentItemRevision rev = line.getItemRevision(); + TCComponentItemRevision rev = line.getItemRevision(); + String objName= rev.getStringProperty("object_name"); + String replace = objName.replace("/", "-").replace("<", "-"). + replace(">", "-").replace(":", "-").replace("|","-"). + replace("\\","-").replace("*","-").replace("?","-"); + String revtype = rev.getType(); + String dataDir2 =jtf.getText()+File.separator+rev.getStringProperty("item_id")+"_"+ + rev.getStringProperty("current_revision_id")+"_"+replace;//汾ļ + File csFile=new File(dataDir2); + //ݰ汾Լļ + String dataName = rev.getStringProperty("item_id")+"_"+ rev.getStringProperty("current_revision_id")+ + "_"+replace;//ļ + pathString=dataDir2; + if(!csFile.exists()) { + csFile.mkdir(); + } + System.out.println("cs"+rev.toString()+list.get(0)); + String dataName2=""; + //ͼ ȥҷ ļѾ + getOutPart(rev,dataName,list); + String dataDir3 =jtf.getText()+File.separator+rev.getStringProperty("item_id")+"_"+ + rev.getStringProperty("current_revision_id")+"_"+replace+File.separator+rev.getStringProperty("item_id")+"_"+ + rev.getStringProperty("current_revision_id")+"_"+replace;//汾ļܳ + File csFile2=new File(dataDir3); + if(!csFile2.exists()) { + csFile2.mkdir(); + } + dataName2=dataName+File.separator+rev.getStringProperty("item_id")+"_"+ rev.getStringProperty("current_revision_id")+ + "_"+replace; TCComponent[] datasets = rev.getReferenceListProperty("IMAN_specification"); TCComponent[] datasets2 = rev.getReferenceListProperty("IMAN_Rendering"); for (int j = 0; j < datasets.length; j++) { - String type = datasets[j].getType(); - if(list.contains(type)) { - TCComponentDataset dataset = (TCComponentDataset) datasets[j]; - getload(dataset); + //ȡݼ + TCComponentDataset dataset01 = null; + if(datasets[j] instanceof TCComponentDataset) { + dataset01 = (TCComponentDataset) datasets[j]; + }else { + continue; + } + //ִлȡ׺ķ +// gethzm(dataset01); + //ִлȡ͵ķ + String type = dataset01.getType(); + //жlisthzmֵַ itemlistrevtypeֵ + if(itemlist.contains(revtype)||allCheck) { + if(datasetList.contains(type)) { + //ȡݼ + TCComponentDataset dataset02 = (TCComponentDataset) datasets[j]; + //ִgetload + getload(dataset02,dataName,list,rev.getStringProperty("item_id")); + getload(dataset02,dataName2,list,rev.getStringProperty("item_id")); + } } } for (int j = 0; j < datasets2.length; j++) { - String type = datasets2[j].getType(); - if(list.contains(type)) { - TCComponentDataset dataset = (TCComponentDataset) datasets2[j]; - getload(dataset); + //ȡݼ + TCComponentDataset dataset02 = null; + if(datasets2[j] instanceof TCComponentDataset) { + dataset02 = (TCComponentDataset) datasets2[j]; + }else { + continue; + } + //ִлȡ׺ķ +// gethzm(dataset02); + String type = dataset02.getType(); + //жǷΪҪ + if(itemlist.contains(revtype)||allCheck) { + if(datasetList.contains(type)) { + TCComponentDataset dataset = (TCComponentDataset) datasets2[j]; + getload(dataset,dataName,list,rev.getStringProperty("item_id")); + getload(dataset,dataName2,list,rev.getStringProperty("item_id")); + } } } - }else if(targets[i] instanceof TCComponentItemRevision){ + } + else if(targets[i] instanceof TCComponentItemRevision){ + List itemlist = new ArrayList(); + //ִлȡ͵ķ + itemlist = getitemType(); TCComponentItemRevision rev = (TCComponentItemRevision) targets[i]; + String revtype = rev.getType(); + String objName= rev.getStringProperty("object_name"); + String replace = objName.replace("/", "-").replace("<", "-"). + replace(">", "-").replace(":", "-").replace("|","-"). + replace("\\","-").replace("*","-").replace("?","-"); + String dataDir =jtf.getText()+File.separator+rev.getStringProperty("item_id")+"_"+ + rev.getStringProperty("current_revision_id")+"_"+replace;//汾ļ + + File csFile=new File(dataDir); + //ݰ汾Լļ + String dataName =rev.getStringProperty("item_id")+"_"+ + rev.getStringProperty("current_revision_id")+"_"+replace;//ļ + String dataName2=""; + pathString=dataDir; + if(!csFile.exists()) { + csFile.mkdir(); + } + //ͼ ȥҷ ļѾ + getOutPart(rev,dataName,list); + String dataDir3 =jtf.getText()+File.separator+rev.getStringProperty("item_id")+"_"+ + rev.getStringProperty("current_revision_id")+"_"+replace+File.separator+rev.getStringProperty("item_id")+"_"+ + rev.getStringProperty("current_revision_id")+"_"+replace;//汾ļܳ + File csFile2=new File(dataDir3); + if(!csFile2.exists()) { + csFile2.mkdir(); + } + dataName2 =dataName+File.separator+rev.getStringProperty("item_id")+"_"+ + rev.getStringProperty("current_revision_id")+"_"+replace;//ļ TCComponent[] datasets = rev.getReferenceListProperty("IMAN_specification"); TCComponent[] datasets2 = rev.getReferenceListProperty("IMAN_Rendering"); for (int j = 0; j < datasets.length; j++) { - String type = datasets[j].getType(); - if(list.contains(type)) { - TCComponentDataset dataset = (TCComponentDataset) datasets[j]; - System.out.println("ļ"); - getload(dataset); + + //ȡݼ + TCComponentDataset dataset02 = null; + if(datasets[j] instanceof TCComponentDataset) { + dataset02 = (TCComponentDataset) datasets[j]; + }else { + continue; + } + //ִлȡ׺ķ +// gethzm(dataset02); + String type = dataset02.getType(); + //ж + if(itemlist.contains(revtype)||allCheck) { + if(datasetList.contains(type)) { + TCComponentDataset dataset = (TCComponentDataset) datasets[j]; + System.out.println("ļ"); + getload(dataset,dataName,list,rev.getStringProperty("item_id")); + getload(dataset,dataName2,list,rev.getStringProperty("item_id")); + } } } for (int j = 0; j < datasets2.length; j++) { - String type = datasets2[j].getType(); - if(list.contains(type)) { - TCComponentDataset dataset = (TCComponentDataset) datasets2[j]; - getload(dataset); + //ȡݼ + TCComponentDataset dataset02 = null; + if(datasets2[j] instanceof TCComponentDataset) { + dataset02 = (TCComponentDataset) datasets2[j]; + }else { + continue; + } + //ִлȡ׺ķ +// gethzm(dataset02); + String type = dataset02.getType(); + //ж + if (itemlist.contains(revtype)||allCheck) { + if(datasetList.contains(type)) { + TCComponentDataset dataset = (TCComponentDataset) datasets2[j]; + getload(dataset,dataName,list,rev.getStringProperty("item_id")); + getload(dataset,dataName2,list,rev.getStringProperty("item_id")); + } } } - }else if(targets[i] instanceof TCComponentDataset) { + }else if(targets[i] instanceof TCComponentDataset) { TCComponentDataset dataset = (TCComponentDataset) targets[i]; - getload(dataset); + String dataName=""; + String objName = dataset.getStringProperty("object_name"); + String replaceName = objName.replace("/", "-").replace("<", "-"). + replace(">", "-").replace(":", "-").replace("|","-"). + replace("\\","-").replace("*","-").replace("?","-"); + if(iDataset==0) { + dataName=jtf.getText()+File.separator+replaceName; + datasetDir=replaceName; + pathString=dataName; + File csFile=new File(dataName); + if(!csFile.exists()) { + csFile.mkdir(); + } + } + iDataset=1; + String type = dataset.getType(); +// gethzm(dataset); + if(datasetList.contains(type)) { + getload(dataset,datasetDir,list,"sjj"); + } }else if(targets[i] instanceof TCComponentItem){ + List itemlist = new ArrayList(); + //ִлȡ͵ķ + itemlist = getitemType(); TCComponentItem item = (TCComponentItem) targets[i]; +// item.getReleasedItemRevisions(); TCComponentItemRevision rev = item.getLatestItemRevision(); + String revtype = rev.getType(); + String objName= rev.getStringProperty("object_name"); + String replace = objName.replace("/", "-").replace("<", "-"). + replace(">", "-").replace(":", "-").replace("|","-"). + replace("\\","-").replace("*","-").replace("?","-"); + String dataDir2 =jtf.getText()+File.separator+rev.getStringProperty("item_id")+"_"+ + rev.getStringProperty("current_revision_id")+"_"+replace;//汾ļ + File csFile=new File(dataDir2); + //ݰ汾Լļ + String dataName = rev.getStringProperty("item_id")+"_"+ + rev.getStringProperty("current_revision_id")+"_"+replace;//ļ + pathString=dataDir2; + if(!csFile.exists()) { + csFile.mkdir(); + + } + String dataName2=""; + //ͼ ȥҷ ļѾ + getOutPart(rev,dataName,list); + String dataDir3 =jtf.getText()+File.separator+rev.getStringProperty("item_id")+"_"+ + rev.getStringProperty("current_revision_id")+"_"+replace+File.separator+rev.getStringProperty("item_id")+"_"+ + rev.getStringProperty("current_revision_id")+"_"+replace;//汾ļܳ + File csFile2=new File(dataDir3); + if(!csFile2.exists()) { + csFile2.mkdir(); + } + dataName2 =dataName+File.separator+rev.getStringProperty("item_id")+"_"+ + rev.getStringProperty("current_revision_id")+"_"+replace;//ļ TCComponent[] datasets = rev.getReferenceListProperty("IMAN_specification"); TCComponent[] datasets2 = rev.getReferenceListProperty("IMAN_Rendering"); for (int j = 0; j < datasets.length; j++) { - String type = datasets[j].getType(); - if(list.contains(type)) { - TCComponentDataset dataset = (TCComponentDataset) datasets[j]; - getload(dataset); + //ȡݼ + TCComponentDataset dataset02 = null; + if(datasets[j] instanceof TCComponentDataset) { + dataset02 = (TCComponentDataset) datasets[j]; + }else { + continue; + } + //ִлȡ׺ķ + String type = dataset02.getType(); +// gethzm(dataset02); + if(itemlist.contains(revtype)||allCheck) { + if(datasetList.contains(type)) { + TCComponentDataset dataset = (TCComponentDataset) datasets[j]; + getload(dataset,dataName,list,rev.getStringProperty("item_id")); + getload(dataset,dataName2,list,rev.getStringProperty("item_id")); + } } } for (int j = 0; j < datasets2.length; j++) { - String type = datasets2[j].getType(); - if(list.contains(type)) { - TCComponentDataset dataset = (TCComponentDataset) datasets2[j]; - getload(dataset); + //ȡݼ + TCComponentDataset dataset02 = null; + if(datasets2[j] instanceof TCComponentDataset) { + dataset02 = (TCComponentDataset) datasets2[j]; + }else { + continue; + } + //ִлȡ׺ķ +// gethzm(dataset02); + String type = dataset02.getType(); + if(itemlist.contains(revtype)||allCheck) { + if(datasetList.contains(type)) { + TCComponentDataset dataset = (TCComponentDataset) datasets2[j]; + getload(dataset, dataName,list,rev.getStringProperty("item_id")); + getload(dataset, dataName2,list,rev.getStringProperty("item_id")); + } } } }else { @@ -304,7 +727,261 @@ public class Dfl028AIFDialog extends AbstractAIFDialog { } } catch (Exception e) { // TODO: handle exception + e.printStackTrace(); } } - + //ȡ + public List getitemType() { + List itemlist = new ArrayList(); + Component[] jcbs = btnPanel2.getComponents();//ѡݴ + //ѡ + for(Component component : jcbs) { + if(component instanceof JCheckBox) { + JCheckBox jcb = (JCheckBox) component; + //жԪǷѡ + if(jcb.isSelected()) { + itemlist.add(jcb.getText()); + itemlist.add(jcb.getText()); + if("ȫ".equals(jcb.getText())) { + allCheck=true; + itemlist.add("T2_VirtualRevision"); + itemlist.add("T2_OutBuyPartRevision"); + itemlist.add("T2_outsourceRevision"); + itemlist.add("T2_EquipmentRevision"); + }else if ("Э".equals(jcb.getText())) { + itemlist.add("T2_outsourceRevision"); + }else if ("⹺".equals(jcb.getText())) { + itemlist.add("T2_OutBuyPartRevision"); + }else if ("".equals(jcb.getText())) { + itemlist.add("T2_VirtualRevision"); + } + } + + } + } + return itemlist; + } + public void getOutPart(TCComponentItemRevision rev ,String dir,List list) throws TCException { + //豸ȡ ȡӼ ȫ ȫȡ ⹺ жϵǰ ⹺Ӽж + TCComponentItem item = rev.getItem(); + List itemlist = new ArrayList(); + //ִлȡ͵ķ + itemlist = getitemType(); + Boolean sxTj = getSxTj(); + TCComponentBOMWindowType winType = (TCComponentBOMWindowType) session.getTypeService() + .getTypeComponent("BOMWindow"); + TCComponentRevisionRule[] listAllRules = TCComponentRevisionRule.listAllRules(session); + TCComponentBOMWindow window = winType.create(null); + for(TCComponentRevisionRule rule:listAllRules) { + if(sxTj&&rule.toString().equals("Precise;Any Status;Latest Working")) { + window.setRevisionRule(rule); + }else if (!sxTj&&rule.toString().equals("Latest Working")) { + window.setRevisionRule(rule); + } + } + window.lock(); + TCComponentBOMLine topLine = window.setWindowTopLine( + item, rev, null, null); + AIFComponentContext[] children2=new AIFComponentContext[4096]; + children2=topLine.getChildren(); +// AIFComponentContext[] children = topLine.getChildren(); + for(int i=0;i listRev=new ArrayList(); +// for(TCComponent revs:revList) { +// TCComponentItemRevision revision=(TCComponentItemRevision)revs; +// TCComponent[] status = revision.getReferenceListProperty("release_status_list"); +// if(status.length!=0) { +// if(status[0].toString().equals("TCM ѷ")) { +// listRev.add(revision); +// } +// } +// } +// +// if(listRev.size()!=0) { +// latestRev=listRev.get(0); +// Date newDate=latestRev.getDateProperty("creation_date"); +// for(TCComponentItemRevision revision:listRev) { +// Date date = revision.getDateProperty("creation_date"); +// int datei = newDate.compareTo(date); +// if(datei<0) { +// newDate=date; +// latestRev=revision; +// } +// } +// } +// } catch (TCException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } +// return latestRev; +// } + //bomͼҳЭ ⹺ iжDzǵһЭ⹺ + public void getOutPartInBom(TCComponentBOMLine bomLine,Boolean sxtj,int i,List itemList, + String dir,List list,int bomNum,String dirFs) throws TCException { + TCComponentItemRevision rev = bomLine.getItemRevision(); +// if(sxtj) { +// rev=findLatesStatus(rev); +// } + String dirTop=dir; +// String revtype = rev.getStringProperty("object_type"); + String revtype= rev.getType();//ʵֵ + if((itemList.contains(revtype)&&bomNum==0)||allCheck||bomNum==1) { + Boolean l=revtype.equals("T2_OutBuyPartRevision")||revtype.equals("T2_outsourceRevision")||revtype.equals("ItemRevision"); + if(outPartBool&&l) { + String dirString=jtf.getText()+File.separator+dir+File.separator+rev.getStringProperty("item_id")+"_"+ + rev.getStringProperty("current_revision_id")+"_"+rev.getStringProperty("object_name"); + dir=dir+File.separator+rev.getStringProperty("item_id")+"_"+ + rev.getStringProperty("current_revision_id")+"_"+rev.getStringProperty("object_name"); + dirTop=dir; + File csFile=new File(dirString); + if(!csFile.exists()) { + csFile.mkdir(); + } + if(bomLine.getChildren().length!=0) { + dirString=dirString+File.separator+rev.getStringProperty("item_id")+"_"+ + rev.getStringProperty("current_revision_id")+"_"+rev.getStringProperty("object_name"); + dir=dir+File.separator+rev.getStringProperty("item_id")+"_"+ + rev.getStringProperty("current_revision_id")+"_"+rev.getStringProperty("object_name"); + + File csFile2=new File(dirString); + if(!csFile2.exists()) { + csFile2.mkdir(); + } + + } + if(i==0 ) { + pathMap.put("1", dir); + if(bomLine.getChildren().length!=0) { + dirString=dirString+File.separator+rev.getStringProperty("item_id")+"_"+ + rev.getStringProperty("current_revision_id")+"_"+rev.getStringProperty("object_name"); + File csFile3=new File(dirString); + if(!csFile3.exists()) { + csFile3.mkdir(); + } + + dir=dir+File.separator+rev.getStringProperty("item_id")+"_"+ + rev.getStringProperty("current_revision_id")+"_"+rev.getStringProperty("object_name"); + } + }i++; + } + TCComponent[] datasets = rev.getReferenceListProperty("IMAN_specification"); + TCComponent[] datasets2 = rev.getReferenceListProperty("IMAN_Rendering"); + for (int j = 0; j < datasets.length; j++) { + //ȡݼ + TCComponentDataset dataset01=null; + if(datasets[j] instanceof TCComponentDataset) { + dataset01 = (TCComponentDataset) datasets[j]; + } + else { + continue; + } +// TCComponentDataset dataset01 = (TCComponentDataset) datasets[j]; + //ִлȡ׺ķ +// gethzm(dataset01); + //ִлȡ͵ķ + String type = dataset01.getStringProperty("object_type"); + + //жlisthzmֵַ itemlistrevtypeֵ + if(datasetList.contains(type)) { + //ȡݼ + TCComponentDataset dataset02 = null; + if(datasets[j] instanceof TCComponentDataset) { + dataset02 = (TCComponentDataset) datasets[j]; + }else { + continue; + } + //ִgetload + getload(dataset02,dir,list,rev.getStringProperty("item_id")); + //һݵ + if(!dir.equals(dirFs)) { + getload(dataset02,dirFs,list,rev.getStringProperty("item_id")); + } + if(!dir.equals(pathMap.get("1"))&& pathMap.get("1")!=null) { + getload(dataset02,pathMap.get("1"),list,rev.getStringProperty("item_id")); + } + } + } + for (int j = 0; j < datasets2.length; j++) { + //ȡݼ + TCComponentDataset dataset02 = null; + if(datasets2[j] instanceof TCComponentDataset) { + dataset02 = (TCComponentDataset) datasets2[j]; + }else { + continue; + } + //ִлȡ׺ķ +// gethzm(dataset02); + //жǷΪҪ + String type = dataset02.getStringProperty("object_type"); + if(datasetList.contains(type)) { + TCComponentDataset dataset = (TCComponentDataset) datasets2[j]; + getload(dataset,dir,list,rev.getStringProperty("item_id")); + if(!dir.equals(dirFs)) { + getload(dataset,dirFs,list,rev.getStringProperty("item_id")); + } + if(!dir.equals(pathMap.get("1"))) { + getload(dataset02,pathMap.get("1"),list,rev.getStringProperty("item_id")); + } + } + + } + AIFComponentContext[] children = bomLine.getChildren(); + for(AIFComponentContext context:children) { + TCComponentBOMLine line=(TCComponentBOMLine)context.getComponent(); + getOutPartInBom(line,sxtj,i,itemList,dirTop,list,1,dirFs); + } + } else { + AIFComponentContext[] children = bomLine.getChildren(); + for(AIFComponentContext context:children) { + TCComponentBOMLine line=(TCComponentBOMLine)context.getComponent(); + getOutPartInBom(line,sxtj,0,itemList,dirTop,list,0,dirFs); + } + } + } + private static void updateProgress(JProgressBar copyProgressBar, int progressSize) { + copyProgressBar.setString(progressSize + "%"); + copyProgressBar.setValue(progressSize); + } + public Boolean getSxTj(){ + List tjlist = new ArrayList(); + Boolean statusBool=false; + Component[] jcbs = btnPanel3.getComponents(); + for(Component component:jcbs) { + if(component instanceof JCheckBox) { + JCheckBox jcb = (JCheckBox) component; + if(jcb.isSelected()) { + tjlist.add(jcb.getText()); + } + } + } + for(String s:tjlist) { + if(s.equals("ѷͼֽ")) { + statusBool=true; + } + if(s.equals("Э/⹺")) { + outPartBool=true; + } + } + return statusBool; + } } diff --git a/src/com/connor/dfl/plm/dfl032/Dfl032Dialog.java b/src/com/connor/dfl/plm/dfl032/Dfl032Dialog.java index e093039..82cd113 100644 --- a/src/com/connor/dfl/plm/dfl032/Dfl032Dialog.java +++ b/src/com/connor/dfl/plm/dfl032/Dfl032Dialog.java @@ -95,14 +95,14 @@ public class Dfl032Dialog extends AbstractAIFDialog{ @Override public void run() { - ParseXMLUtil xml=new ParseXMLUtil(); - File file=xml.getSXX("DFL_CLASS_Xml", session); - attrList =xml.parseXMLCode(file); - if(attrList == null || attrList.size() <= 0) { - MessageBox.post("ѡDFL_CLASS_Xmlδã飡", "WARNING", - MessageBox.WARNING); - return; - } +// ParseXMLUtil xml=new ParseXMLUtil(); +// File file=xml.getSXX("DFL_CLASS_Xml", session); +// attrList =xml.parseXMLCode(file); +// if(attrList == null || attrList.size() <= 0) { +// MessageBox.post("ѡDFL_CLASS_Xmlδã飡", "WARNING", +// MessageBox.WARNING); +// return; +// } InterfaceAIFComponent comp = app.getTargetComponent(); String compType = comp.getType(); System.out.println("compType=============="+compType); @@ -381,19 +381,19 @@ public class Dfl032Dialog extends AbstractAIFDialog{ classPropList.add(bean); } } - for (int i = 0; i < attrList.size(); i++) { - String classValue = attrList.get(i); - if(classValue.contains(";")) { - String[] classValues = classValue.split(";"); - if(c.getId().equals(classValues[0])) { - attrName = new String [classValues.length -1]; - for (int j = 0; j < attrName.length; j++) { - attrName[j] = classValues[j+1]; - } - break; - } - } - } +// for (int i = 0; i < attrList.size(); i++) { +// String classValue = attrList.get(i); +// if(classValue.contains(";")) { +// String[] classValues = classValue.split(";"); +// if(c.getId().equals(classValues[0])) { +// attrName = new String [classValues.length -1]; +// for (int j = 0; j < attrName.length; j++) { +// attrName[j] = classValues[j+1]; +// } +// break; +// } +// } +// } String[] columnNames = new String[icsAttrS.length + 3]; columnNames[0] = ""; columnNames[1] = "Ʒ"; @@ -448,18 +448,18 @@ public class Dfl032Dialog extends AbstractAIFDialog{ model.setDataVector(cellData, columnNames); //DefaultTableCellRendererԻƵԪıɫȹ - DefaultTableCellRenderer backGroundColor = new DefaultTableCellRenderer(); + // DefaultTableCellRenderer backGroundColor = new DefaultTableCellRenderer(); //ƲеıΪɫ - backGroundColor.setBackground(Color.yellow); - if(attrName != null && attrName.length > 0) { - for (int i = 0; i < attrName.length; i++) { - List colList = Arrays.asList(columnNames); - if(colList.contains(attrName[i])) { - TableColumn tableColumn = qryTable.getColumn(attrName[i]); - tableColumn.setCellRenderer(backGroundColor); - } - } - } + // backGroundColor.setBackground(Color.yellow); +// if(attrName != null && attrName.length > 0) { +// for (int i = 0; i < attrName.length; i++) { +// List colList = Arrays.asList(columnNames); +// if(colList.contains(attrName[i])) { +// TableColumn tableColumn = qryTable.getColumn(attrName[i]); +// tableColumn.setCellRenderer(backGroundColor); +// } +// } +// } qryTable.getColumnModel().getColumn(0).setPreferredWidth(10); qryTable.setDefaultRenderer(Object.class, new TableCellTextAreaRenderer()); JScrollPane scrollPane=new JScrollPane(qryTable); diff --git a/src/com/connor/dfl/plm/dfl040/DFL038Jframe.java b/src/com/connor/dfl/plm/dfl040/DFL038Jframe.java index 5e890c3..015cb3f 100644 --- a/src/com/connor/dfl/plm/dfl040/DFL038Jframe.java +++ b/src/com/connor/dfl/plm/dfl040/DFL038Jframe.java @@ -61,10 +61,12 @@ 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.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.javafx.image.IntPixelAccessor; import com.teamcenter.rac.aif.kernel.AIFComponentContext; import com.teamcenter.rac.kernel.TCComponent; import com.teamcenter.rac.kernel.TCComponentQuery; @@ -142,7 +144,7 @@ public class DFL038Jframe extends JFrame { private JButton cancelButton; private JPanel centerPanel1; - private String[] title = new String[] { "Ʒ", "Ʒ", "֪ͨ", "Ʒͺ", "ͻ", "", "ԭ", "ͼֽ", "β", + private String[] title = new String[] { "Ʒ", "Ʒ", "֪ͨ", "Ʒͺ", "ͻ", "","", "ԭ", "ͼֽ", "β", "", "Ʒ", "Ʒ", "ԭ汾", "ְ汾", "", "Ʒ", "", "۸Ԥ", "۷", "Ƿɱʧ", "Ŀ׶", "ϼ÷", "ͼֽ", "Ŀ", "̶֪ͨ", "ʱ", "", "̽׶" }; @@ -480,7 +482,7 @@ public class DFL038Jframe extends JFrame { "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.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 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 "; // ȡҪжϵ @@ -491,21 +493,24 @@ public class DFL038Jframe extends JFrame { + " 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"; + + 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 " + 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"; + + 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 " + 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"; + + endTime + "','yyyy-MM-dd HH24:mi:ss') " + conditions + + " order by F.PRODUCTDEPARTMENT,F.APPLYDATE"; } System.out.println(sql1); @@ -584,11 +589,11 @@ public class DFL038Jframe extends JFrame { i++; XSSFRow Row = sheet2.createRow(i); String changeFormId = dbQuery.getString(3); - if (changeFormId!=null && !changeFormId.equals(lastChangeFormId)) { + 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) { + if (queryObject != null && queryObject.size() > 0) { TCComponent component = queryObject.get(0); AIFComponentContext[] versions = component.getChildren("revision_list"); TCComponent versionComponent = (TCComponent) versions[0].getComponent(); @@ -623,8 +628,11 @@ public class DFL038Jframe extends JFrame { } Set set = new HashSet(); + int db2 = 0; + while (dbQuery2.next()) { set.add(dbQuery2.getString(3)); + db2++; } dbQuery2.first(); dbQuery2.previous(); @@ -636,7 +644,7 @@ public class DFL038Jframe extends JFrame { // Collections.sort(list,new MyComparator()); Collections.sort(list); - + // ͷ XSSFRow[] rows = new XSSFRow[list.size()]; @@ -663,30 +671,19 @@ public class DFL038Jframe extends JFrame { createCell.setCellValue(0); } } - - System.out.println(dbQuery2.getRow()+"--1--"+changeType.length); + + System.out.println(dbQuery2.getRow() + "--1--" + changeType.length); int[][] CTN = new int[list.size()][changeType.length]; - - String year = list.get(0).substring(0,4); - int lastRN = list.size()+1; - + 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++) { -// System.out.println(year+"-----2------"+rows[j].getCell(0).getStringCellValue().substring(0,4)); -// if(!year.equals(rows[j].getCell(0).getStringCellValue().substring(0,4))) { -// System.out.println(year); -// year = rows[j].getCell(0).getStringCellValue().substring(0,4); -// System.out.println("after"+year); -// XSSFRow row = sheet1.createRow(lastRN++); -// row.createCell(0).setCellValue("ϼ:"); -// for(int o=0;o"+(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]); } - XSSFCell createCell = row.createCell(changeType.length+1); - createCell.setCellStyle(cellStyle); - createCell.setCellValue(getArrayCount(CTN[j-1])-getArrayCount(lastYearDetail)); - lastYearDetail = CTN[j-1]; + cell = row.createCell(changeType.length + 1); + cell.setCellStyle(cellStyle); + cell.setCellValue(getArrayCount(CTN[CTN.length-1])-getArrayCount(countNum)); } - yearNum++; - break; - } - -// System.out.println(year+"-----2------"+rows[j].getCell(0).getStringCellValue().substring(0,4)); - if(!year.equals(rows[j].getCell(0).getStringCellValue().substring(0,4))) { - System.out.println(year); - year = rows[j].getCell(0).getStringCellValue().substring(0,4); - System.out.println("after"+year); - sheet1.shiftRows(j+1, lastRN++, 1, true, false); - XSSFRow row = sheet1.createRow(j+1); - XSSFCell createCell2 = row.createCell(0); - createCell2.setCellStyle(cellStyle); - createCell2.setCellValue("ϼ:"); - if(lastYearDetail ==null) { - for(int o=0;o0&&sb.charAt(sb.length()-1)!=';') { sb.append(";"); } + sb.append(list.get(i)); +// if(i < list.size()-1) { +// sb.append(";"); +// } } //changeform.model1.setValueAt(proid, 8, 1); diff --git a/src/com/connor/dfl/plm/forms/AddDialogNotify_TZ.java b/src/com/connor/dfl/plm/forms/AddDialogNotify_TZ.java index e1afa29..a1ef7fd 100644 --- a/src/com/connor/dfl/plm/forms/AddDialogNotify_TZ.java +++ b/src/com/connor/dfl/plm/forms/AddDialogNotify_TZ.java @@ -100,10 +100,13 @@ public class AddDialogNotify_TZ extends AbstractAIFDialog { if(!("".equals(s.trim()))) { sb.append(";"); } - sb.append(list.get(i)); - if(i < list.size()-1) { + if(sb.length()>0&&sb.charAt(sb.length()-1)!=';') { sb.append(";"); } + sb.append(list.get(i)); +// if(i < list.size()-1) { +// sb.append(";"); +// } } //changeform.model1.setValueAt(proid, 8, 1); diff --git a/src/com/connor/dfl/plm/forms/AddDialogQuickChange_TZ.java b/src/com/connor/dfl/plm/forms/AddDialogQuickChange_TZ.java index 4e9c799..d6f7974 100644 --- a/src/com/connor/dfl/plm/forms/AddDialogQuickChange_TZ.java +++ b/src/com/connor/dfl/plm/forms/AddDialogQuickChange_TZ.java @@ -442,10 +442,13 @@ public class AddDialogQuickChange_TZ extends AbstractAIFDialog { if(!("".equals(s.trim()))) { sb.append(";"); } - sb.append(list.get(i)); - if(i < list.size()-1) { + if(sb.length()>0&&sb.charAt(sb.length()-1)!=';') { sb.append(";"); } + sb.append(list.get(i)); +// if(i < list.size()-1) { +// sb.append(";"); +// } } //changeform.model1.setValueAt(proid, 8, 1); diff --git a/src/com/connor/dfl/plm/forms/ChangeApplyForm.java b/src/com/connor/dfl/plm/forms/ChangeApplyForm.java index 3bcb060..91ca784 100644 --- a/src/com/connor/dfl/plm/forms/ChangeApplyForm.java +++ b/src/com/connor/dfl/plm/forms/ChangeApplyForm.java @@ -1,12 +1,21 @@ 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.Font; 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.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; @@ -16,6 +25,7 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; +import java.util.Enumeration; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -36,12 +46,18 @@ import javax.swing.SwingConstants; import javax.swing.border.LineBorder; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.DefaultTableModel; +import javax.swing.table.JTableHeader; import javax.swing.table.TableCellEditor; import javax.swing.table.TableColumn; import javax.swing.table.TableColumnModel; +import org.apache.poi.xssf.usermodel.XSSFCell; +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 com.connor.dfl.plm.dfl044.DataBaseControl2; import com.connor.dfl.plm.table.CTMap; import com.connor.dfl.plm.table.CTable; import com.connor.dfl.plm.util.DateChooser; @@ -49,8 +65,12 @@ 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; import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCComponentGroup; import com.teamcenter.rac.kernel.TCComponentItem; import com.teamcenter.rac.kernel.TCComponentItemRevision; import com.teamcenter.rac.kernel.TCComponentItemType; @@ -63,11 +83,10 @@ import com.teamcenter.rac.util.DateButton; import com.teamcenter.rac.util.MessageBox; import com.teamcenter.rac.util.PropertyLayout; - -public class ChangeApplyForm extends AbstractRendering { +public class ChangeApplyForm extends AbstractRendering { private TCComponentForm form; private TCSession session; - AbstractAIFApplication app= AIFUtility.getCurrentApplication(); + AbstractAIFApplication app = AIFUtility.getCurrentApplication(); private InterfaceAIFComponent targetComp = app.getTargetComponent(); private TCComponentItemType itemType; public ChangeApplyForm selfform; @@ -76,44 +95,45 @@ public class ChangeApplyForm extends AbstractRendering { private MyTable table2; String pid = ""; + private JScrollPane tablePanel2; + private JScrollPane scrollPane; - // Project_Code pc = new Project_Code(); + // Project_Code pc = new Project_Code(); public List hadList; - //private CTMap model1, model2; + // private CTMap model1, model2; private CTMap model1; DefaultTableModel model2; private String name; - + private String objname; + private String zhangtao; + private String cangku; private JButton addButton; private JButton delButton; - + private DataBaseControl2 data; private JButton addProjectBtn; - private JComboBox ChangeTypeBox;// - private JComboBox ProductTypecBox;//Ʒ - private JComboBox ErrorTypeBox;// - private JComboBox DutyDepartmentBox;//β - private JComboBox SalesClassifyBox;//۷ - private JComboBox EmergencyNotifyBox;//̶֪ͨ - private JComboBox ProductDepartmentBox;//Ʒ - private JComboBox DrawingChangeTypeBox;//ͼֽ - private JComboBox IsNotProductLossBox;//Ƿɱʧ - private JComboBox ReceiveClassifyBox;//ϼ÷ - private JComboBox WAPYJBox;//δƷ - private JComboBox ZZYJBox;// - private JComboBox SSYJBox;// - private JComboBox CLYJBox;// - - - - - //ʱ + private JComboBox ChangeTypeBox;// + private JComboBox ProductTypecBox;// Ʒ + private JComboBox ErrorTypeBox;// + private JComboBox DutyDepartmentBox;// β + private JComboBox SalesClassifyBox;// ۷ + private JComboBox EmergencyNotifyBox;// ̶֪ͨ + private JComboBox ProductDepartmentBox;// Ʒ + private JComboBox DrawingChangeTypeBox;// ͼֽ + private JComboBox IsNotProductLossBox;// Ƿɱʧ + private JComboBox ReceiveClassifyBox;// ϼ÷ + private JComboBox WAPYJBox;// δƷ + private JComboBox ZZYJBox;// + private JComboBox SSYJBox;// + private JComboBox CLYJBox;// + + // ʱ public DefaultComboBoxModel jsrBoxModel; String projectid; - //private JComboBox projectCode;//Ŀ + // private JComboBox projectCode;//Ŀ static String time; int rows1 = 1; String applyname; @@ -134,48 +154,70 @@ public class ChangeApplyForm extends AbstractRendering { private String projectCode; private String affectedPart; - - //table2еݣ浽ݿʹ + // table2еݣ浽ݿʹ List changedeList = new ArrayList(); - - - - - - - - public ChangeApplyForm() throws Exception { + public ChangeApplyForm() throws Exception { } - - public ChangeApplyForm(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; + } + } + } + } + } + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } this.selfform = this; - loadRendering(); + loadRendering(); } - String[] stringArray = ((TCSession) app.getSession()).getPreferenceService().getStringValues("DFL2_SQL_Connect"); + String[] stringArray = ((TCSession) app.getSession()).getPreferenceService().getStringValues("DFL2_SQL_Connect"); - private String url = "jdbc:oracle:thin:@//"+stringArray[0];// + private String url = "jdbc:oracle:thin:@//" + stringArray[0];// - private String user = stringArray[1];// + private String user = stringArray[1];// - private String password = stringArray[2];// + private String password = stringArray[2];// - private Connection conn = null;// + private Connection conn = null;// - private PreparedStatement pre = null;// + private PreparedStatement pre = null;// - private ResultSet result = null;// + private ResultSet result = null;// - - - public Connection ConnectionFun() throws SQLException { + public Connection ConnectionFun() throws SQLException { try { System.out.println(url); @@ -184,19 +226,16 @@ public class ChangeApplyForm extends AbstractRendering { Class.forName("oracle.jdbc.driver.OracleDriver"); System.out.println("سɹ"); } catch (ClassNotFoundException e) { - System.out.println("ʧ"); + System.out.println("ʧ"); } - conn=DriverManager.getConnection(url,user,password); + conn = DriverManager.getConnection(url, user, password); System.out.println("ݿӳɹ"); return conn; - } - - @Override public void loadRendering() throws TCException { try { @@ -207,247 +246,239 @@ public class ChangeApplyForm extends AbstractRendering { } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); - } - } - private void initUI() throws TCException, SQLException { + } + } + private void initUI() throws TCException, SQLException { this.hadList = new ArrayList(); 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); + if (change_type_stringArrays == null || change_type_stringArrays.length <= 0) { + MessageBox.post("ѡDFL_Form_ChangeTypeδ,ϵԱ!!", "", MessageBox.ERROR); return; } - // + // ChangeTypeBox = new JComboBox(); - for(int change_type_number = 0;change_type_number=2) { - groupname = buisnisDivisions[buisnisDivisions.length-2]; + if (buisnisDivisions.length >= 2) { + groupname = buisnisDivisions[buisnisDivisions.length - 2]; } table1.setValueAt("", 0, 0); - table1.setValueAt(applyname, 0,1); + table1.setValueAt(applyname, 0, 1); table1.setValueAt("", 0, 2); - System.out.println(" "+my_item_id); + System.out.println(" " + my_item_id); 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("Ʒͺ", 1, 2); table1.setValueAt(productmodel, 1, 3); - - table1.setValueAt("ͻ", 1, 4); table1.setValueAt(clientname, 1, 5); - table1.setValueAt("ֿ", 2, 0);// + String[] stringArray_warehouse = ((TCSession) app.getSession()).getPreferenceService() + .getStringValues("DFL_Form_WarehouseCode"); - 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); + if (stringArray_warehouse == null || stringArray_warehouse.length <= 0) { + MessageBox.post("ѡDFL_Form_WarehouseCodeδ,ϵԱ!!", "", MessageBox.ERROR); return; - } - - - String warehouse = ""; + } + String warehouse = ""; - for(int z = 0 ;z 0) { List list = new ArrayList(); @@ -719,12 +743,15 @@ public class ChangeApplyForm 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(), 9, new DefaultCellEditor(WAPYJBox)); - table2.setComboCell(table2.getSelectedRow(), 11, new DefaultCellEditor(ZZYJBox)); - table2.setComboCell(table2.getSelectedRow(), 13, new DefaultCellEditor(SSYJBox)); - table2.setComboCell(table2.getSelectedRow(), 15, new DefaultCellEditor(CLYJBox)); + 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)); } else { javax.swing.JOptionPane.showMessageDialog(null, "ƷƷдûа汾", "ϵͳʾ", @@ -735,7 +762,7 @@ public class ChangeApplyForm extends AbstractRendering { } } } catch (Exception e) { - System.out.println("eeee="+e.getMessage()); + System.out.println("eeee=" + e.getMessage()); e.printStackTrace(); } Vector rowVector = (Vector) dataVector.elementAt(row); @@ -745,31 +772,22 @@ public class ChangeApplyForm extends AbstractRendering { } }; - - - table2 = new MyTable() { @Override public boolean isCellEditable(int row, int column) { - if(column == 0) { - return false; + if (column == 0) { + return false; } return true; } }; - - 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[] { 90, 180, 180, 180,180,180,180, 180, 180,180,180,180, 180, 180,180,180 })); + 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.setRowHeight(35); - - - - + table2.setRowHeight(50); tcr = new DefaultTableCellRenderer(); tcr.setHorizontalAlignment(SwingConstants.CENTER); @@ -780,69 +798,90 @@ public class ChangeApplyForm extends AbstractRendering { table2.setDefaultRenderer(Object.class, tcr); table2.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + addButton = new JButton(" "); + delButton = new JButton(" ɾ "); - addButton = new JButton(""); - delButton = new JButton("ɾ"); - - List listdetils = getChangeDetail(name); - if(listdetils.size()>0) { + List listdetils = getChangeDetail(name); + if (listdetils.size() > 0) { - for(int j = 0;j< listdetils.size();j++) { + 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()); + ChangeDetils cd = (ChangeDetils) listdetils.get(j); + System.out.println("%%%%%%%%%%%%%" + cd.getPH()); System.out.println(cd.getObjectCode()); int count = table2.getRowCount(); - System.out.println("==============="+count); + System.out.println("===============" + count); - table2.setValueAt( cd.getPH(),j, 1); + table2.setValueAt(cd.getPH(), j, 1); table2.setValueAt(cd.getPM(), j, 2); table2.setValueAt(cd.getYBB(), j, 3); table2.setValueAt(cd.getXBB(), j, 4); - table2.setValueAt(cd.getYSL() , j, 5); + table2.setValueAt(cd.getYSL(), j, 5); table2.setValueAt(cd.getXSL(), j, 6); table2.setValueAt(cd.getBGSL(), j, 7); - table2.setValueAt(cd.getWZPSL(), j, 8); - table2.setValueAt(cd.getWZPUJ(), j, 9); - table2.setValueAt(cd.getZZSL(), j, 10); - table2.setValueAt(cd.getZZYJ(), j, 11); - table2.setValueAt(cd.getSCSL(), j, 12); - table2.setValueAt(cd.getSSYJ(), j, 13); - table2.setValueAt(cd.getCKSL(), j, 14); - table2.setValueAt(cd.getCLYJ() , j, 15); - + table2.setValueAt(cd.getGGSM(), j, 8); + + table2.setValueAt(cd.getWZPSL(), j, 9); + table2.setValueAt(cd.getWZPUJ(), j, 10); + table2.setValueAt(cd.getZZSL(), j, 11); + table2.setValueAt(cd.getZZYJ(), j, 12); + table2.setValueAt(cd.getSCSL(), j, 13); + table2.setValueAt(cd.getSSYJ(), j, 14); + table2.setValueAt(cd.getCKSL(), j, 15); + table2.setValueAt(cd.getCLYJ(), j, 16); + + table2.setComboCell(j, 10, new DefaultCellEditor(WAPYJBox)); + table2.setComboCell(j, 12, new DefaultCellEditor(ZZYJBox)); + table2.setComboCell(j, 14, new DefaultCellEditor(SSYJBox)); + table2.setComboCell(j, 16, new DefaultCellEditor(CLYJBox)); } } - - addButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { + table2.setComboCell(rows1-1, 10, new DefaultCellEditor(WAPYJBox)); + table2.setComboCell(rows1-1, 12, new DefaultCellEditor(ZZYJBox)); + table2.setComboCell(rows1-1, 14, new DefaultCellEditor(SSYJBox)); + table2.setComboCell(rows1-1, 16, new DefaultCellEditor(CLYJBox)); model2.addRow(new String[] { Integer.toString(rows1++) }); // Object[] rowData = new Object[] {"","","","","","","","","",WAPYJBox,"",ZZYJBox,"","","",""}; // model2.addRow(rowData); + if (rows1 > 6) { + int count = rows1 - 6; + count = 300 + count * 50; + tablePanel2.setPreferredSize(new Dimension((int) tablePanel2.getPreferredSize().getWidth(), count)); + tablePanel2.revalidate(); + tablePanel2.repaint(); + scrollPane.revalidate(); + scrollPane.repaint(); + } else { + tablePanel2.setPreferredSize(new Dimension((int) tablePanel2.getPreferredSize().getWidth(), 300)); + tablePanel2.revalidate(); + tablePanel2.repaint(); + scrollPane.revalidate(); + scrollPane.repaint(); + } } }); delButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int sRow = table2.getSelectedRow(); - if(sRow == -1) { + if (sRow == -1) { javax.swing.JOptionPane.showMessageDialog(null, "ѡкƳ", "ϵͳʾ", javax.swing.JOptionPane.WARNING_MESSAGE); return; } - //List list =getChangeDetail(name); + // List list =getChangeDetail(name); int[] sRows = table2.getSelectedRows(); - int p ; - for (int j = sRows.length-1; j >=0 ; j--) { + int p; + for (int j = sRows.length - 1; j >= 0; j--) { String PH = (String) model2.getValueAt(sRows[j], 1); - System.out.println("=============Ʒ"+PH); + System.out.println("=============Ʒ" + PH); delChangedetil(name, PH); model2.removeRow(table2.getSelectedRow()); for (int i = sRows[j]; i < table2.getRowCount(); i++) { @@ -851,185 +890,676 @@ public class ChangeApplyForm extends AbstractRendering { rows1--; } + if (rows1 > 6) { + int count = rows1 - 6; + count = 300 + count * 50; + tablePanel2.setPreferredSize(new Dimension((int) tablePanel2.getPreferredSize().getWidth(), count)); + tablePanel2.revalidate(); + tablePanel2.repaint(); + scrollPane.revalidate(); + scrollPane.repaint(); + } else { + tablePanel2.setPreferredSize(new Dimension((int) tablePanel2.getPreferredSize().getWidth(), 300)); + tablePanel2.revalidate(); + tablePanel2.repaint(); + scrollPane.revalidate(); + scrollPane.repaint(); + } } }); JPanel tablePanel1 = new JPanel(); tablePanel1.add(table1); tablePanel1.setPreferredSize(new Dimension(1600, 700)); - JScrollPane tablePanel2 = new JScrollPane(table2); + tablePanel2 = new JScrollPane(table2); tablePanel2.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); - tablePanel2.setPreferredSize(new Dimension(1600, 300)); + 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); + 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(" ")); - buttonPanel0.add("3.1.left.top",new JLabel(" ")); - buttonPanel0.add("4.1.left.top",new JLabel(" ")); - buttonPanel0.add("5.1.left.top",new JLabel(" ")); - buttonPanel0.add("6.1.left.top",new JLabel(" ")); - buttonPanel0.add("7.1.left.top",new JLabel(" ")); - buttonPanel0.add("8.1.left.top",new JLabel(" ")); - buttonPanel0.add("9.1.left.top",new JLabel(" ")); - buttonPanel0.add("10.1.left.top",new JLabel(" ")); - buttonPanel0.add("11.1.left.top",new JLabel(" ")); - buttonPanel0.add("12.1.left.top",new JLabel(" ")); - buttonPanel0.add("13.1.left.top",new JLabel(" ")); - buttonPanel0.add("14.1.left.top",new JLabel(" ")); - 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",new JLabel(" ")); - buttonPanel0.add("19.1.left.top",new JLabel(" ")); - // buttonPanel0.add("20.1.left.top",btn); - buttonPanel0.add("20.1.left.top",new JLabel(" ")); - buttonPanel0.add("21.1.left.top",new JLabel(" ")); - buttonPanel0.add("22.1.left.top",zt_btn); - buttonPanel0.add("23.1.left.top",new JLabel(" ")); - buttonPanel0.add("24.1.left.top",new JLabel(" ")); - buttonPanel0.add("25.1.left.top",new JLabel(" ")); - + buttonPanel0.add("1.1.left.top", new JLabel(" ")); + buttonPanel0.add("2.1.left.top", new JLabel(" ")); + buttonPanel0.add("3.1.left.top", new JLabel(" ")); + buttonPanel0.add("4.1.left.top", new JLabel(" ")); + buttonPanel0.add("5.1.left.top", new JLabel(" ")); + buttonPanel0.add("6.1.left.top", new JLabel(" ")); + buttonPanel0.add("7.1.left.top", new JLabel(" ")); + buttonPanel0.add("8.1.left.top", new JLabel(" ")); + buttonPanel0.add("9.1.left.top", new JLabel(" ")); + buttonPanel0.add("10.1.left.top", new JLabel(" ")); + buttonPanel0.add("11.1.left.top", new JLabel(" ")); + buttonPanel0.add("12.1.left.top", new JLabel(" ")); + buttonPanel0.add("13.1.left.top", new JLabel(" ")); + buttonPanel0.add("14.1.left.top", new JLabel(" ")); + 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", 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); + buttonPanel0.add("23.1.left.top", new JLabel(" ")); + buttonPanel0.add("24.1.left.top", new JLabel(" ")); + buttonPanel0.add("25.1.left.top", new JLabel(" ")); JPanel rootPanel = new JPanel(new PropertyLayout()); JLabel detailsLable = new JLabel("ϸ"); detailsLable.setFont(new Font("", 1, 14)); + rootPanel.add("1.1.center.top", titleLable); + rootPanel.add("2.1.left.top", tablePanel1); + rootPanel.add("2.2.left.top", buttonPanel0); - 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("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); - rootPanel.add("3.1.left.top",detailsLable); + JPanel mainPanel = new JPanel(new BorderLayout()); + mainPanel.add(rootPanel, BorderLayout.NORTH); + mainPanel.add(test, BorderLayout.WEST); - rootPanel.add("4.1.left.top",tablePanel2); - rootPanel.add("4.2.left.top",buttonPanel); - - //this.setPreferredSize(new Dimension(1820, 1000)); + // this.setPreferredSize(new Dimension(1820, 1000)); this.setSize(1600, 1300); - this.setLayout(new BorderLayout()); - JScrollPane scrollPane = new JScrollPane(rootPanel); + scrollPane = new JScrollPane(mainPanel); scrollPane.getVerticalScrollBar().setUnitIncrement(20); - this.add(scrollPane,BorderLayout.CENTER); + this.add(scrollPane, BorderLayout.CENTER); this.setBackground(Color.WHITE); + + this.addComponentListener(new ComponentListener() { + + @Override + public void componentShown(ComponentEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void componentResized(ComponentEvent e) { + // TODO Auto-generated method stub + Component component2 = e.getComponent(); + int width3 = component2.getWidth(); + if (width3 < 1711) { + tablePanel2.setPreferredSize(new Dimension(1600, (int) tablePanel2.getPreferredSize().getHeight())); + tablePanel2.revalidate(); + tablePanel2.repaint(); + scrollPane.revalidate(); + scrollPane.repaint(); + } else { + tablePanel2.setPreferredSize( + new Dimension((width3 - 1711) + 1600, (int) tablePanel2.getPreferredSize().getHeight())); + tablePanel2.revalidate(); + tablePanel2.repaint(); + scrollPane.revalidate(); + scrollPane.repaint(); + } + + } + + @Override + public void componentMoved(ComponentEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void componentHidden(ComponentEvent e) { + // TODO Auto-generated method stub + + } + }); + 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()); - 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.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(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()); + // 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()); + bn.setProjectState(model1.getValueAt(7, 1) == null ? "" : model1.getValueAt(7, 1).toString()); insertMes(bn); - - - - - //=================================================================== - - + // =================================================================== delAllChangedetil(name); - for(int cdss = 0 ; cdss changeMesg, + List changeDetils, String model) throws IOException, FileNotFoundException { + // ļģ + InputStream modeFile = ChangeNotifyForm.class.getResourceAsStream(model); + // XSSFWorkbook(excelĵ) + XSSFWorkbook wb; + wb = new XSSFWorkbook(modeFile); + XSSFSheet sheet = wb.getSheetAt(0); +// XSSFRow row1 = sheet.getRow(startRow); +// XSSFCell cell1 = row1.getCell(0); +// XSSFCellStyle style = cell1.getCellStyle(); + if (changeMesg != null && changeMesg.size() > 0) { + ChangeOrderBean cob = changeMesg.get(0); + String sqr = cob.getApplyName(); + 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 gglx = cob.getChangeType(); + String cplx = cob.getProductType(); + String tzgglx = cob.getTZChangeType(); + String cwlx = cob.getErrorType(); + String zrbm = cob.getDutyDepartment(); + String zrr = cob.getDutyMan(); + 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(); + + XSSFRow row = sheet.getRow(0); + XSSFCell cell = row.getCell(0); + XSSFRichTextString richTextString = new XSSFRichTextString(name +"-"+ objname); + cell.setCellValue(richTextString); + + row = sheet.getRow(1); + cell = row.getCell(2); + richTextString = new XSSFRichTextString(sqr); + cell.setCellValue(richTextString); + cell = row.getCell(6); + richTextString = new XSSFRichTextString(bgtzdh); + cell.setCellValue(richTextString); + cell = row.getCell(12); + richTextString = new XSSFRichTextString(sqsj); + cell.setCellValue(richTextString); + + row = sheet.getRow(2); + cell = row.getCell(2); + richTextString = new XSSFRichTextString(cpmc); + cell.setCellValue(richTextString); + cell = row.getCell(6); + richTextString = new XSSFRichTextString(cpxh); + cell.setCellValue(richTextString); + cell = row.getCell(12); + richTextString = new XSSFRichTextString(khmc); + cell.setCellValue(richTextString); + + row = sheet.getRow(3); + cell = row.getCell(2); + richTextString = new XSSFRichTextString(ckbh); + cell.setCellValue(richTextString); + cell = row.getCell(6); + richTextString = new XSSFRichTextString(tzjjcd); + cell.setCellValue(richTextString); + cell = row.getCell(12); + richTextString = new XSSFRichTextString(tzgglx); + 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); + richTextString = new XSSFRichTextString(zrr); + cell.setCellValue(richTextString); + + row = sheet.getRow(5); + cell = row.getCell(2); + richTextString = new XSSFRichTextString(gglx); + cell.setCellValue(richTextString); + cell = row.getCell(6); + richTextString = new XSSFRichTextString(cplx); + cell.setCellValue(richTextString); + cell = row.getCell(12); + richTextString = new XSSFRichTextString(cwlx); + cell.setCellValue(richTextString); + + row = sheet.getRow(6); + cell = row.getCell(2); + richTextString = new XSSFRichTextString(jgyg); + cell.setCellValue(richTextString); + cell = row.getCell(6); + richTextString = new XSSFRichTextString(ssfl); + cell.setCellValue(richTextString); + cell = row.getCell(12); + richTextString = new XSSFRichTextString(sfcscbss); + cell.setCellValue(richTextString); + + row = sheet.getRow(7); + cell = row.getCell(2); + richTextString = new XSSFRichTextString(syxdsbhlbj); + cell.setCellValue(richTextString); + + row = sheet.getRow(8); + cell = row.getCell(2); + richTextString = new XSSFRichTextString(xmjd); + cell.setCellValue(richTextString); + cell = row.getCell(6); + richTextString = new XSSFRichTextString(ljlyfl); + cell.setCellValue(richTextString); + cell = row.getCell(12); + richTextString = new XSSFRichTextString(tzfz); + cell.setCellValue(richTextString); + + row = sheet.getRow(9); + cell = row.getCell(2); + richTextString = new XSSFRichTextString(xmbh); + cell.setCellValue(richTextString); + + row = sheet.getRow(10); + cell = row.getCell(2); + richTextString = new XSSFRichTextString(ggyy); + cell.setCellValue(richTextString); + + row = sheet.getRow(11); + cell = row.getCell(2); + richTextString = new XSSFRichTextString(zt); + cell.setCellValue(richTextString); + } + + if (changeDetils != null && changeDetils.size() > 0) { + for (int i = 0; i < changeDetils.size(); i++) { + XSSFRow row = sheet.getRow(i + 16); + if (row == null) { + row = sheet.createRow(i + 16); + } + 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(); + + XSSFCell cell = row.getCell(0); + if (cell == null) { + cell = row.createCell(0); + + } + XSSFRichTextString richTextString = new XSSFRichTextString(i + 1 + ""); + cell.setCellValue(richTextString); + + cell = row.getCell(1); + if (cell == null) { + cell = row.createCell(1); + + } + richTextString = new XSSFRichTextString(ph); + cell.setCellValue(richTextString); + + cell = row.getCell(2); + if (cell == null) { + cell = row.createCell(2); + + } + 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(4); + if (cell == null) { + cell = row.createCell(4); + + } + richTextString = new XSSFRichTextString(xbb); + cell.setCellValue(richTextString); + + cell = row.getCell(5); + if (cell == null) { + cell = row.createCell(5); + + } + richTextString = new XSSFRichTextString(ysl); + cell.setCellValue(richTextString); + + cell = row.getCell(6); + if (cell == null) { + cell = row.createCell(6); + + } + richTextString = new XSSFRichTextString(xsl); + cell.setCellValue(richTextString); + + cell = row.getCell(7); + if (cell == null) { + cell = row.createCell(7); + + } + richTextString = new XSSFRichTextString(bgsl); + cell.setCellValue(richTextString); + + cell = row.getCell(8); + if (cell == null) { + cell = row.createCell(8); + + } + richTextString = new XSSFRichTextString(ggsm); + cell.setCellValue(richTextString); + + cell = row.getCell(9); + if (cell == null) { + cell = row.createCell(9); + + } + richTextString = new XSSFRichTextString(wzpsl); + cell.setCellValue(richTextString); + + cell = row.getCell(10); + if (cell == null) { + cell = row.createCell(10); + + } + richTextString = new XSSFRichTextString(wzpuj); + cell.setCellValue(richTextString); + + cell = row.getCell(11); + if (cell == null) { + cell = row.createCell(11); + } + richTextString = new XSSFRichTextString(zzsl); + 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); + } + } + + // жǷĿ¼. 򴴽 + isChartPathExist(filepath); + // Excelļ + // FileOutputStream output = new FileOutputStream(filepath + "\\" + filename); + FileOutputStream output = new FileOutputStream(new File(filepath + "\\" + filename)); + wb.write(output); + + output.close(); + modeFile.close(); + } + + private void isChartPathExist(String dirPath) { + File file = new File(dirPath); + if (!file.exists()) { + file.mkdirs(); + } + } + + + + // ȡϢ private List getChangeMesg(String id) { List list = new ArrayList(); ChangeOrderBean bn = new ChangeOrderBean(); ResultSet r = null; Connection con = null; - PreparedStatement stmt=null; + PreparedStatement stmt = null; String sql = "select * from DFL_CHANGEFORM where objectCode=?";// try { con = ConnectionFun(); - stmt=con.prepareStatement(sql); - stmt.setString(1,id); - r=stmt.executeQuery(); - while(r.next()){ + stmt = con.prepareStatement(sql); + stmt.setString(1, id); + r = stmt.executeQuery(); + while (r.next()) { bn.setObjectCode(r.getString(1)); bn.setApplyName(r.getString(2)); bn.setApplyDate(r.getString(3)); @@ -1062,9 +1592,9 @@ public class ChangeApplyForm extends AbstractRendering { list.add(bn); } - }catch (SQLException e) { + } catch (SQLException e) { e.printStackTrace(); - }finally{ + } finally { try { r.close(); stmt.close(); @@ -1075,24 +1605,21 @@ public class ChangeApplyForm extends AbstractRendering { } return list; - } - - - + } public List getChangeDetail(String id) { List list = new ArrayList(); ResultSet r = null; Connection con = null; - PreparedStatement stmt=null; + PreparedStatement stmt = null; String sql = "select * from DFL_CHANGEDETAILS where objectCode=?";// try { con = ConnectionFun(); - stmt=con.prepareStatement(sql); - stmt.setString(1,id); - r=stmt.executeQuery(); - while(r.next()){ + stmt = con.prepareStatement(sql); + stmt.setString(1, id); + r = stmt.executeQuery(); + while (r.next()) { ChangeDetils cd = new ChangeDetils(); System.out.println(r.getString(1)); cd.setObjectCode(r.getString(1)); @@ -1111,11 +1638,12 @@ public class ChangeApplyForm extends AbstractRendering { cd.setSSYJ(r.getString(14)); cd.setCKSL(r.getString(15)); cd.setCLYJ(r.getString(16)); + cd.setGGSM(r.getString(17)); list.add(cd); } - }catch (SQLException e) { + } catch (SQLException e) { e.printStackTrace(); - }finally{ + } finally { try { r.close(); stmt.close(); @@ -1125,122 +1653,108 @@ public class ChangeApplyForm extends AbstractRendering { } } - return list; } - - - - - public void setValue() { System.out.println(""); - List list = getChangeMesg(name); -System.out.println("list.size=================="+list.size()); - if(list.size() > 0) { - ChangeOrderBean bn = (ChangeOrderBean) list.get(list.size()-1); + List list = getChangeMesg(name); + System.out.println("list.size==================" + list.size()); + if (list.size() > 0) { + ChangeOrderBean bn = (ChangeOrderBean) list.get(list.size() - 1); System.out.println(bn.getApplyName()); - table1.setValueAt(bn.getApplyName(),0, 1); - 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); - - - //table2 м + table1.setValueAt(bn.getApplyName(), 0, 1); + 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); + + // table2 м } - - // List listsss = getChangeDetail(name); - // System.out.println(listsss.size()); - // if(listsss.size()>0) { - // // - // } - // } - - - - + // List listsss = getChangeDetail(name); + // System.out.println(listsss.size()); + // if(listsss.size()>0) { + // // + // } + // } } - - //ʱύݿ + // ʱύݿ public void insertMes(ChangeOrderBean bn) { Connection con = null; - PreparedStatement stmt=null; + PreparedStatement stmt = null; String sql = "insert into DFL_CHANGEFORM values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; try { con = ConnectionFun(); stmt = con.prepareStatement(sql); - stmt.setString(1,bn.getObjectCode()); - stmt.setString(2,bn.getApplyName()); - stmt.setString(3,bn.getApplyDate()); - stmt.setString(4,bn.getProjectCode()); - stmt.setString(5,bn.getClientNae()); - stmt.setString(6,bn.getProductDepartment()); - stmt.setString(7,bn.getProductName()); + stmt.setString(1, bn.getObjectCode()); + stmt.setString(2, bn.getApplyName()); + stmt.setString(3, bn.getApplyDate()); + stmt.setString(4, bn.getProjectCode()); + stmt.setString(5, bn.getClientNae()); + stmt.setString(6, bn.getProductDepartment()); + stmt.setString(7, bn.getProductName()); - stmt.setString(8,bn.getProjectModel()); - stmt.setString(9,bn.getAffectedPart()); - stmt.setString(10,bn.getChangeType()); - stmt.setString(11,bn.getProductType()); + stmt.setString(8, bn.getProjectModel()); + stmt.setString(9, bn.getAffectedPart()); + stmt.setString(10, bn.getChangeType()); + stmt.setString(11, bn.getProductType()); + stmt.setString(12, bn.getErrorType()); + stmt.setString(13, bn.getDutyDepartment()); + stmt.setString(14, bn.getDutyMan()); - stmt.setString(12,bn.getErrorType()); - stmt.setString(13,bn.getDutyDepartment()); - stmt.setString(14,bn.getDutyMan()); + stmt.setString(15, bn.getChangeReason()); - stmt.setString(15,bn.getChangeReason()); + stmt.setString(16, bn.getSalseClassify()); - stmt.setString(16,bn.getSalseClassify()); + stmt.setString(17, bn.getPriceBooking()); - stmt.setString(17,bn.getPriceBooking()); + stmt.setString(18, bn.getIsNotProductLoss()); + stmt.setString(19, bn.getReceiveClassify()); + stmt.setString(20, bn.getWarehouseCode()); + stmt.setString(21, bn.getAccountSet()); - stmt.setString(18,bn.getIsNotProductLoss()); - stmt.setString(19,bn.getReceiveClassify()); - stmt.setString(20,bn.getWarehouseCode()); - stmt.setString(21,bn.getAccountSet()); + stmt.setString(22, bn.getNotifyEmergencyProcedures()); + stmt.setString(23, bn.getDrawingTo()); + stmt.setString(24, bn.getChangeListCode()); - stmt.setString(22,bn.getNotifyEmergencyProcedures()); - stmt.setString(23,bn.getDrawingTo()); - stmt.setString(24,bn.getChangeListCode()); - - stmt.setString(25,bn.getTZChangeType()); - stmt.setString(26,bn.getSUOSU_ProductDepartment()); - stmt.setString(27,bn.getProjectState()); - stmt.executeUpdate() ; + stmt.setString(25, bn.getTZChangeType()); + stmt.setString(26, bn.getSUOSU_ProductDepartment()); + stmt.setString(27, bn.getProjectState()); + stmt.executeUpdate(); System.out.println("ݲݿ"); } catch (Exception ex) { @@ -1254,43 +1768,37 @@ System.out.println("list.size=================="+list.size()); } } - } - - - - /** - * ϸ + * ϸ */ - - public void insertChangeDetailsMes(ChangeDetils cd) { Connection con = null; - PreparedStatement stmt=null; - String sql = "insert into DFL_CHANGEDETAILS values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + PreparedStatement stmt = null; + String sql = "insert into DFL_CHANGEDETAILS 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.executeUpdate() ; + 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.executeUpdate(); System.out.println("ݲݿ"); } catch (Exception ex) { ex.printStackTrace(); @@ -1303,9 +1811,9 @@ System.out.println("list.size=================="+list.size()); } } - } + } - //ɾʱ + // ɾʱ public void del_date() { Connection con = null; String sql = "delete from dfl_changetime"; @@ -1326,9 +1834,6 @@ System.out.println("list.size=================="+list.size()); } } - - - public void delChangeForm(String id) { Connection con = null; String sql = "delete from dfl_changeform where objectCode=?"; @@ -1336,7 +1841,7 @@ System.out.println("list.size=================="+list.size()); try { con = ConnectionFun(); PreparedStatement prepStmt = conn.prepareStatement(sql); - prepStmt.setString(1,id); + prepStmt.setString(1, id); prepStmt.executeUpdate(); System.out.println("ݿɾɹ"); } catch (Exception ex) { @@ -1350,13 +1855,7 @@ System.out.println("list.size=================="+list.size()); } } - - - - - - - public void delChangedetil(String id ,String ph) { + public void delChangedetil(String id, String ph) { Connection con = null; String sql = "delete from DFL_CHANGEDETAILS where objectCode=? and PH = ?"; System.out.println(sql); @@ -1364,12 +1863,12 @@ System.out.println("list.size=================="+list.size()); con = ConnectionFun(); PreparedStatement prepStmt = conn.prepareStatement(sql); - prepStmt.setString(1,id); - prepStmt.setString(2,ph); + prepStmt.setString(1, id); + prepStmt.setString(2, ph); prepStmt.executeUpdate(); - // Statement stmt=conn.createStatement();//Statement - // stmt.executeUpdate(sql);//ִsql + // Statement stmt=conn.createStatement();//Statement + // stmt.executeUpdate(sql);//ִsql System.out.println("ݿɾɹ"); } catch (Exception ex) { ex.printStackTrace(); @@ -1380,15 +1879,11 @@ System.out.println("list.size=================="+list.size()); ex.printStackTrace(); } - } - } - - - public void delAllChangedetil(String id ) { + public void delAllChangedetil(String id) { Connection con = null; String sql = "delete from DFL_CHANGEDETAILS where objectCode=?"; System.out.println(sql); @@ -1396,12 +1891,12 @@ System.out.println("list.size=================="+list.size()); con = ConnectionFun(); PreparedStatement prepStmt = conn.prepareStatement(sql); - prepStmt.setString(1,id); + prepStmt.setString(1, id); prepStmt.executeUpdate(); - // Statement stmt=conn.createStatement();//Statement - // stmt.executeUpdate(sql);//ִsql + // Statement stmt=conn.createStatement();//Statement + // stmt.executeUpdate(sql);//ִsql System.out.println("ݿɾɹ"); } catch (Exception ex) { ex.printStackTrace(); @@ -1412,31 +1907,25 @@ System.out.println("list.size=================="+list.size()); ex.printStackTrace(); } - } - } - - - - - //ݿǶиö + // ݿǶиö public int ifcountform(String id) { int i = 0; Connection con = null; - PreparedStatement stmt=null; + PreparedStatement stmt = null; String sql = "select * from DFL_CHANGEFORM where objectCode=?"; try { con = ConnectionFun(); stmt = con.prepareStatement(sql); - ResultSet rs=null; - stmt.setString(1,id); - rs=stmt.executeQuery(); - while(rs.next()) { - i=i+1; + ResultSet rs = null; + stmt.setString(1, id); + rs = stmt.executeQuery(); + while (rs.next()) { + i = i + 1; } @@ -1452,20 +1941,21 @@ System.out.println("list.size=================="+list.size()); } return i; } - //ͳ + + // ͳ public int ifcountdetial(String id) { int i = 0; Connection con = null; - PreparedStatement stmt=null; + PreparedStatement stmt = null; String sql = "select * from DFL_CHANGEDETAILS where objectCode=?"; try { con = ConnectionFun(); stmt = con.prepareStatement(sql); - ResultSet rs=null; - stmt.setString(1,id); - rs=stmt.executeQuery(); - while(rs.next()) { - i=i+1; + ResultSet rs = null; + stmt.setString(1, id); + rs = stmt.executeQuery(); + while (rs.next()) { + i = i + 1; } @@ -1482,10 +1972,6 @@ System.out.println("list.size=================="+list.size()); return i; } - - - - /** * JTableп */ @@ -1498,9 +1984,6 @@ System.out.println("list.size=================="+list.size()); return columns; } - - - class MyButtonEditor extends DefaultCellEditor { protected DateButton button; @@ -1522,8 +2005,6 @@ System.out.println("list.size=================="+list.size()); } } - - class MyTable extends JTable { int myRow = -1, myCol = -1; TableCellEditor myEditor; @@ -1548,7 +2029,19 @@ System.out.println("list.size=================="+list.size()); } } } - + //ݿѯ + 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; + } /** * ͨѯѯĿ * @@ -1578,6 +2071,4 @@ System.out.println("list.size=================="+list.size()); } } - - } diff --git a/src/com/connor/dfl/plm/forms/ChangeDetils.java b/src/com/connor/dfl/plm/forms/ChangeDetils.java index 300cdc5..bd9abfe 100644 --- a/src/com/connor/dfl/plm/forms/ChangeDetils.java +++ b/src/com/connor/dfl/plm/forms/ChangeDetils.java @@ -1,5 +1,7 @@ package com.connor.dfl.plm.forms; +import org.jacorb.idl.runtime.int_token; + /** * * @author @@ -14,6 +16,7 @@ public class ChangeDetils { private String YSL; private String XSL; private String BGSL; + private String GGSM; private String WZPSL; private String WZPUJ; private String ZZSL; @@ -30,7 +33,7 @@ public class ChangeDetils { public ChangeDetils() { } - public ChangeDetils(String objtctCode,String pH, String pM, String yBB, String xBB, String ySL, String xSL, String bGSL, String wZPSL, + public ChangeDetils(String objtctCode,String pH, String pM, String yBB, String xBB, String ySL, String xSL, String bGSL,String gGSM, String wZPSL, String wZPUJ, String zZSL, String zZYJ, String sCSL, String sSYJ, String cKSL, String cLYJ) { this.objectCode= objtctCode; this.PH = pH; @@ -40,6 +43,7 @@ public class ChangeDetils { this.YSL = ySL; this.XSL = xSL; this.BGSL = bGSL; + this.GGSM = gGSM; this.WZPSL = wZPSL; this.WZPUJ = wZPUJ; this.ZZSL = zZSL; @@ -94,11 +98,19 @@ public class ChangeDetils { XSL = xSL; } public String getBGSL() { + return BGSL; } public void setBGSL(String bGSL) { + BGSL = bGSL; } + public String getGGSM() { + return GGSM; + } + public void setGGSM(String gGSM) { + GGSM = gGSM; + } public String getWZPSL() { return WZPSL; } diff --git a/src/com/connor/dfl/plm/forms/ChangeNotifyForm.java b/src/com/connor/dfl/plm/forms/ChangeNotifyForm.java index 49b7748..c5a7e0a 100644 --- a/src/com/connor/dfl/plm/forms/ChangeNotifyForm.java +++ b/src/com/connor/dfl/plm/forms/ChangeNotifyForm.java @@ -1,13 +1,24 @@ package com.connor.dfl.plm.forms; + import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; +import java.awt.FlowLayout; import java.awt.Font; +import java.awt.GridLayout; +import java.awt.LayoutManager; import java.awt.Point; +import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.ComponentEvent; +import java.awt.event.ComponentListener; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; import java.io.IOException; +import java.io.InputStream; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; @@ -18,6 +29,7 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; +import java.util.Enumeration; import java.util.EventObject; import java.util.HashMap; import java.util.List; @@ -42,22 +54,36 @@ import javax.swing.border.LineBorder; import javax.swing.event.CellEditorListener; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.DefaultTableModel; +import javax.swing.table.JTableHeader; import javax.swing.table.TableCellEditor; import javax.swing.table.TableCellRenderer; import javax.swing.table.TableColumn; import javax.swing.table.TableColumnModel; +import org.apache.poi.xssf.usermodel.XSSFCell; +import org.apache.poi.xssf.usermodel.XSSFCellStyle; +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.table.CTMap; import com.connor.dfl.plm.table.CTable; import com.connor.dfl.plm.util.DateChooser; +import com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ; import com.teamcenter.rac.aif.AbstractAIFApplication; +import com.teamcenter.rac.aif.AbstractAIFDialog; import com.teamcenter.rac.aif.kernel.AIFComponentContext; import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; import com.teamcenter.rac.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; import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCComponentGroup; import com.teamcenter.rac.kernel.TCComponentItem; import com.teamcenter.rac.kernel.TCComponentItemRevision; import com.teamcenter.rac.kernel.TCComponentItemType; @@ -73,11 +99,12 @@ import com.teamcenter.rac.util.DateButton; import com.teamcenter.rac.util.MessageBox; import com.teamcenter.rac.util.PropertyLayout; +//import sun.net.www.content.image.jpeg; -public class ChangeNotifyForm extends AbstractRendering { +public class ChangeNotifyForm extends AbstractRendering { private TCComponentForm form; private TCSession session; - AbstractAIFApplication app= AIFUtility.getCurrentApplication(); + AbstractAIFApplication app = AIFUtility.getCurrentApplication(); private InterfaceAIFComponent targetComp = app.getTargetComponent(); private TCComponentItemType itemType; private ChangeNotifyForm selfform; @@ -85,112 +112,140 @@ public class ChangeNotifyForm extends AbstractRendering { CTable table1; private MyTable table2; - //private CTMap model1, model2; + private JScrollPane scrollPane; + private JScrollPane tablePanel2; + + private ChangeNotifyForm fu = this; + private final double MINWIDTH = 1700d; + private final double MINHEIGHT = 700d; + + // 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 JComboBox ChangeTypeBox;// - private JComboBox ProductTypecBox;//Ʒ + private JComboBox ChangeTypeBox;// + private JComboBox ProductTypecBox;// Ʒ private JComboBox ErrorTypeBox; private JComboBox DutyDepartmentBox; - private JComboBox SalesClassifyBox;//۷ - private JComboBox EmergencyNotifyBox;//̶֪ͨ - private JComboBox ProductDepartmentBox;//Ʒ - private JComboBox DrawingChangeTypeBox;//ͼֽ - private JComboBox IsNotProductLossBox;//Ƿɱʧ - private JComboBox ReceiveClassifyBox;//ϼ÷ - private JComboBox WAPYJBox;//δƷ - private JComboBox ZZYJBox;// - private JComboBox SSYJBox;// - private JComboBox CLYJBox;// - - //ʱ + private JComboBox SalesClassifyBox;// ۷ + private JComboBox EmergencyNotifyBox;// ̶֪ͨ + private JComboBox ProductDepartmentBox;// Ʒ + private JComboBox DrawingChangeTypeBox;// ͼֽ + private JComboBox IsNotProductLossBox;// Ƿɱʧ + private JComboBox ReceiveClassifyBox;// ϼ÷ + private JComboBox WAPYJBox;// δƷ + private JComboBox ZZYJBox;// + private JComboBox SSYJBox;// + private JComboBox CLYJBox;// + private DataBaseControl2 data; + // ʱ public DefaultComboBoxModel jsrBoxModel; - - - - //private JComboBox projectCode;//Ŀ + // private JComboBox projectCode;//Ŀ static String time; int rows1 = 1; private String applyname; private String my_item_id; - - - - //table2еݣ浽ݿʹ + // table2еݣ浽ݿʹ List changedeList = new ArrayList(); - - - - private String applyName ;// - private String applyDate;//ʱ - 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 changeReason;//ԭ - private String salseClassify ;//۷ - private String priceBooking ;//۸Ԥ - // private String change;//ϸ - private String isNotProductLoss ;//ǷƷʧ - private String receiveClassify ;//ϼ÷ - private String warehouseCode ;// - private String accountSet ;// - private String NotifyEmergencyProcedures;//֪ͨ - private String drawingTo ;//ͼֽ - private String ChangeListCode;// - private String TZChangeType ; - private String SUOSU_productdepartment ; - private String projectState ; - - - - + private String applyName;// + private String applyDate;// ʱ + 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 changeReason;// ԭ + private String salseClassify;// ۷ + private String priceBooking;// ۸Ԥ + // private String change;//ϸ + private String isNotProductLoss;// ǷƷʧ + private String receiveClassify;// ϼ÷ + private String warehouseCode;// + private String accountSet;// + private String NotifyEmergencyProcedures;// ֪ͨ + private String drawingTo;// ͼֽ + private String ChangeListCode;// + private String TZChangeType; + private String SUOSU_productdepartment; + private String projectState; public ChangeNotifyForm(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; + } + } + } + } + } + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } this.selfform = this; - loadRendering(); + loadRendering(); } - String[] stringArray = ((TCSession) app.getSession()).getPreferenceService().getStringValues("DFL2_SQL_Connect"); - - private String url = "jdbc:oracle:thin:@//"+stringArray[0];// - - private String user = stringArray[1];// + String[] stringArray = ((TCSession) app.getSession()).getPreferenceService().getStringValues("DFL2_SQL_Connect"); - private String password = stringArray[2];// + private String url = "jdbc:oracle:thin:@//" + stringArray[0];// - private Connection conn = null;// + private String user = stringArray[1];// - private PreparedStatement pre = null;// + private String password = stringArray[2];// - private ResultSet result = null;// + private Connection conn = null;// + private PreparedStatement pre = null;// + private ResultSet result = null;// - public Connection ConnectionFun() throws SQLException { + public Connection ConnectionFun() throws SQLException { try { System.out.println(url); @@ -199,19 +254,16 @@ public class ChangeNotifyForm extends AbstractRendering { Class.forName("oracle.jdbc.driver.OracleDriver"); System.out.println("سɹ"); } catch (ClassNotFoundException e) { - System.out.println("ʧ"); + System.out.println("ʧ"); } - conn=DriverManager.getConnection(url,user,password); + conn = DriverManager.getConnection(url, user, password); System.out.println("ݿӳɹ"); return conn; - } - - @Override public void loadRendering() throws TCException { try { @@ -222,339 +274,323 @@ public class ChangeNotifyForm extends AbstractRendering { } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); - } - } + } + } + 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; + // 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); + if (change_type_stringArrays == null || change_type_stringArrays.length <= 0) { + MessageBox.post("ѡDFL_Form_ChangeTypeδ,ϵԱ!!", "", MessageBox.ERROR); return; } - // + // ChangeTypeBox = new JComboBox(); - for(int change_type_number = 0;change_type_number0) { - ChangeOrderBean cb = (ChangeOrderBean) 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();// - dutyDepartment = cb.getDutyDepartment();//β - dutyMan = cb.getDutyMan();// - 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();// + 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) { + ChangeOrderBean cb = (ChangeOrderBean) 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();// + dutyDepartment = cb.getDutyDepartment();// β + dutyMan = cb.getDutyMan();// + 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(); @@ -563,27 +599,17 @@ public class ChangeNotifyForm extends AbstractRendering { } } - //lcomp - - + // lcomp - - - - - - - - String titleName =masterName+"֪ͨ" ; + 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) { + if (row == 0 && column == 1) { + if (value == null) { return; } @@ -596,141 +622,121 @@ 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[] { 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 }); table1 = new CTable(model1) { @Override public boolean isCellEditable(int row, int column) { - if(column == 0&&row<8 || column ==2&&row<8 || column==4&&row<8 ) { + if (column == 0 && row < 8 || column == 2 && row < 8 || column == 4 && row < 8) { return false; } - if(column == 0 && row ==6) { + if (column == 0 && row == 6) { return false; } - if(column == 0 && row ==8) { + if (column == 0 && row == 8) { return false; } - if(column == 0 && row ==9) { + if (column == 0 && row == 9) { return false; } - if(column == 0 && row ==10) { + if (column == 0 && row == 10) { return false; } + +// if (column == 5 && row == 7) { +// return false; +// +// } +// if (column == 1 && row == 10) { +// return false; +// +// } + + return true; } }; - // table1.setCombo(2, 1, new DefaultCellEditor(cBox3)); - + // table1.setCombo(2, 1, new DefaultCellEditor(cBox3)); + String groupnames = session.getGroup().getStringProperty("display_name"); + String[] buisnisDivisions = groupnames.split("\\."); + String groupname = ""; - String groupnames = session.getGroup().getStringProperty("display_name"); - String [] buisnisDivisions= groupnames.split("\\."); - String groupname =""; - - if(buisnisDivisions.length>=2) { - groupname = buisnisDivisions[buisnisDivisions.length-2]; - - } - + if (buisnisDivisions.length >= 2) { + groupname = buisnisDivisions[buisnisDivisions.length - 2]; + } table1.setValueAt("", 0, 0); - table1.setValueAt(applyname, 0,1); - + table1.setValueAt(applyname, 0, 1); 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("Ʒͺ", 1, 2); table1.setValueAt(projectModel, 1, 3); - - table1.setValueAt("ͻ", 1, 4); table1.setValueAt(clientNae, 1, 5); - table1.setValueAt("ֿ", 2, 0);// - - - String[] stringArray_warehouse = ((TCSession) app.getSession()).getPreferenceService().getStringValues("DFL_Form_WarehouseCode"); - String warehouse = ""; - for(int z = 0 ;z 0) { List list = new ArrayList(); @@ -896,13 +877,15 @@ public class ChangeNotifyForm extends AbstractRendering { 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(), 9, new DefaultCellEditor(WAPYJBox)); - table2.setComboCell(table2.getSelectedRow(), 11, new DefaultCellEditor(ZZYJBox)); - table2.setComboCell(table2.getSelectedRow(), 13, new DefaultCellEditor(SSYJBox)); - table2.setComboCell(table2.getSelectedRow(), 15, new DefaultCellEditor(CLYJBox)); - + 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)); } else { javax.swing.JOptionPane.showMessageDialog(null, "ƷƷдûа汾", "ϵͳʾ", @@ -913,7 +896,7 @@ public class ChangeNotifyForm extends AbstractRendering { } } } catch (Exception e) { - System.out.println("eeee="+e.getMessage()); + System.out.println("eeee=" + e.getMessage()); e.printStackTrace(); } Vector rowVector = (Vector) dataVector.elementAt(row); @@ -923,28 +906,21 @@ public class ChangeNotifyForm extends AbstractRendering { } }; - table2 = new MyTable() { @Override public boolean isCellEditable(int row, int column) { - if(column == 0) { - return false; + if (column == 0) { + return false; } return true; } }; - - table2.setModel(model2); - table2.setColumnModel(getColumn(table2, new int[] { 90, 180, 180, 180,180,180,180, 180, 180,180,180,180, 180, 180,180,180 })); + 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); table1.setBorder(new LineBorder(Color.BLACK)); @@ -953,108 +929,131 @@ public class ChangeNotifyForm extends AbstractRendering { table2.setDefaultRenderer(Object.class, tcr); table2.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + addButton = new JButton(" "); + delButton = new JButton(" ɾ "); - addButton = new JButton(""); - delButton = new JButton("ɾ"); - - List listdetils = getChangeDetail(masterName); - if(listdetils.size()>0) { + List listdetils = getChangeDetail(masterName); + if (listdetils.size() > 0) { - for(int j = 0;j< listdetils.size();j++) { + for (int j = 0; j < listdetils.size(); j++) { model2.addRow(new String[] { Integer.toString(rows1++) }); - //int i =1; - //for(int j =0 ;j 6) { + int count = rows1 - 6; + count = 300 + count * 50; + tablePanel2.setPreferredSize(new Dimension((int) tablePanel2.getPreferredSize().getWidth(), count)); + tablePanel2.revalidate(); + tablePanel2.repaint(); + scrollPane.revalidate(); + scrollPane.repaint(); + } else { + tablePanel2.setPreferredSize(new Dimension((int) tablePanel2.getPreferredSize().getWidth(), 300)); + tablePanel2.revalidate(); + tablePanel2.repaint(); + scrollPane.revalidate(); + scrollPane.repaint(); + } } }); delButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int sRow = table2.getSelectedRow(); - if(sRow == -1) { + if (sRow == -1) { javax.swing.JOptionPane.showMessageDialog(null, "ѡкƳ", "ϵͳʾ", javax.swing.JOptionPane.WARNING_MESSAGE); return; } - //List list =getChangeDetail(name); + // List list =getChangeDetail(name); int[] sRows = table2.getSelectedRows(); - int p ; - for (int j = sRows.length-1; j >=0 ; j--) { + int p; + for (int j = sRows.length - 1; j >= 0; j--) { String PH = (String) model2.getValueAt(sRows[j], 1); - System.out.println("=============Ʒ"+PH); + System.out.println("=============Ʒ" + PH); delChangedetil(masterName, PH); - // Connection con = null; + // 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("ɾʧ"); - // } - // // + // 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(); + // //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((int) tablePanel2.getPreferredSize().getWidth(), count)); + tablePanel2.revalidate(); + tablePanel2.repaint(); + scrollPane.revalidate(); + scrollPane.repaint(); + } else { + tablePanel2.setPreferredSize(new Dimension((int) tablePanel2.getPreferredSize().getWidth(), 300)); + tablePanel2.revalidate(); + tablePanel2.repaint(); + scrollPane.revalidate(); + scrollPane.repaint(); + } } }); - - - JPanel buttonPanel0 = new JPanel(new PropertyLayout()); - buttonPanel0.add("1.1.left.top",new JLabel(" ")); - buttonPanel0.add("2.1.left.top",new JLabel(" ")); - buttonPanel0.add("3.1.left.top",new JLabel(" ")); - buttonPanel0.add("4.1.left.top",new JLabel(" ")); - buttonPanel0.add("5.1.left.top",new JLabel(" ")); - buttonPanel0.add("6.1.left.top",new JLabel(" ")); - buttonPanel0.add("7.1.left.top",new JLabel(" ")); - buttonPanel0.add("8.1.left.top",new JLabel(" ")); - buttonPanel0.add("9.1.left.top",new JLabel(" ")); - buttonPanel0.add("10.1.left.top",new JLabel(" ")); - buttonPanel0.add("11.1.left.top",new JLabel(" ")); - buttonPanel0.add("12.1.left.top",new JLabel(" ")); - buttonPanel0.add("13.1.left.top",new JLabel(" ")); - buttonPanel0.add("14.1.left.top",new JLabel(" ")); - 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",new JLabel(" ")); - buttonPanel0.add("19.1.left.top",new JLabel(" ")); -// buttonPanel0.add("20.1.left.top",btn); - buttonPanel0.add("20.1.left.top",new JLabel(" ")); - buttonPanel0.add("21.1.left.top",new JLabel(" ")); - buttonPanel0.add("22.1.left.top",zt_btn); - buttonPanel0.add("23.1.left.top",new JLabel(" ")); - buttonPanel0.add("24.1.left.top",new JLabel(" ")); - buttonPanel0.add("25.1.left.top",new JLabel(" ")); - - + buttonPanel0.add("1.1.left.top", new JLabel(" ")); + buttonPanel0.add("2.1.left.top", new JLabel(" ")); + buttonPanel0.add("3.1.left.top", new JLabel(" ")); + buttonPanel0.add("4.1.left.top", new JLabel(" ")); + buttonPanel0.add("5.1.left.top", new JLabel(" ")); + buttonPanel0.add("6.1.left.top", new JLabel(" ")); + buttonPanel0.add("7.1.left.top", new JLabel(" ")); + buttonPanel0.add("8.1.left.top", new JLabel(" ")); + buttonPanel0.add("9.1.left.top", new JLabel(" ")); + buttonPanel0.add("10.1.left.top", new JLabel(" ")); + buttonPanel0.add("11.1.left.top", new JLabel(" ")); + buttonPanel0.add("12.1.left.top", new JLabel(" ")); + buttonPanel0.add("13.1.left.top", new JLabel(" ")); + buttonPanel0.add("14.1.left.top", new JLabel(" ")); + 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", 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); + buttonPanel0.add("23.1.left.top", new JLabel(" ")); + 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 showCalendarPanel = new JPanel(); + // showCalendarPanel.add("1.1.left.top",showCalenderButten); - - - JScrollPane tablePanel2 = new JScrollPane(table2); +// JPanel tablePanel2 = new JPanel(); +// tablePanel2.add(table2); + tablePanel2 = new JScrollPane(table2); tablePanel2.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); - tablePanel2.setPreferredSize(new Dimension(1600, 300)); - + 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); - - + 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)); + 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("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); + 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); - rootPanel.add("4.1.left.top",tablePanel2); - rootPanel.add("4.2.left.top",buttonPanel); + JPanel mainPanel = new JPanel(new BorderLayout()); + mainPanel.add(rootPanel, BorderLayout.NORTH); + mainPanel.add(test, BorderLayout.CENTER); this.setSize(1600, 1300); +// this.setPreferredSize(new Dimension(1600,1000)); + this.setLayout(new BorderLayout()); - JScrollPane scrollPane = new JScrollPane(rootPanel); + scrollPane = new JScrollPane(mainPanel); scrollPane.getVerticalScrollBar().setUnitIncrement(20); - this.add(scrollPane,BorderLayout.CENTER); + 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() { - this.setVisible(true); - } + @Override + public void componentShown(ComponentEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void componentResized(ComponentEvent e) { + // TODO Auto-generated method stub + Component component2 = e.getComponent(); + int width3 = component2.getWidth(); + if (width3 < 1711) { + tablePanel2.setPreferredSize(new Dimension(1600, (int) tablePanel2.getPreferredSize().getHeight())); + tablePanel2.revalidate(); + tablePanel2.repaint(); + scrollPane.revalidate(); + scrollPane.repaint(); + } else { + tablePanel2.setPreferredSize( + new Dimension((width3 - 1711) + 1600, (int) tablePanel2.getPreferredSize().getHeight())); + tablePanel2.revalidate(); + tablePanel2.repaint(); + scrollPane.revalidate(); + scrollPane.repaint(); + } + + } + + @Override + public void componentMoved(ComponentEvent e) { + // TODO Auto-generated method stub + } + @Override + public void componentHidden(ComponentEvent e) { + // TODO Auto-generated method stub + + } + }); + this.setVisible(true); + } @Override public void saveRendering() { + if(model1.getValueAt(0, 5)==null||model1.getValueAt(4, 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()); - 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.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(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() + // model1.getValueAt(6, 1) == null ? "" :model1.getValueAt(6, 1).toString() - //˾ - bn.setAccountSet(model1.getValueAt(10, 1) == null ? "" :model1.getValueAt(10, 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()); + bn.setProjectState(model1.getValueAt(7, 1) == null ? "" : model1.getValueAt(7, 1).toString()); insertMes(bn); - - - //=================================================================== - - - - + // =================================================================== delAllChangedetil(masterName); - for(int cdss = 0 ; cdss changeMesg, + List changeDetils, String model) throws IOException, FileNotFoundException { + // ļģ + InputStream modeFile = ChangeNotifyForm.class.getResourceAsStream(model); + // XSSFWorkbook(excelĵ) + XSSFWorkbook wb; + wb = new XSSFWorkbook(modeFile); + XSSFSheet sheet = wb.getSheetAt(0); +// XSSFRow row1 = sheet.getRow(startRow); +// XSSFCell cell1 = row1.getCell(0); +// XSSFCellStyle style = cell1.getCellStyle(); + if (changeMesg != null && changeMesg.size() > 0) { + ChangeOrderBean cob = changeMesg.get(0); + String sqr = cob.getApplyName(); + 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 gglx = cob.getChangeType(); + String cplx = cob.getProductType(); + String tzgglx = cob.getTZChangeType(); + String cwlx = cob.getErrorType(); + String zrbm = cob.getDutyDepartment(); + String zrr = cob.getDutyMan(); + 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(); + + XSSFRow row = sheet.getRow(0); + XSSFCell cell = row.getCell(0); + 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); + richTextString = new XSSFRichTextString(bgtzdh); + cell.setCellValue(richTextString); + cell = row.getCell(12); + richTextString = new XSSFRichTextString(sqsj); + cell.setCellValue(richTextString); + + row = sheet.getRow(2); + cell = row.getCell(2); + richTextString = new XSSFRichTextString(cpmc); + cell.setCellValue(richTextString); + cell = row.getCell(6); + richTextString = new XSSFRichTextString(cpxh); + cell.setCellValue(richTextString); + cell = row.getCell(12); + richTextString = new XSSFRichTextString(khmc); + cell.setCellValue(richTextString); + + row = sheet.getRow(3); + cell = row.getCell(2); + richTextString = new XSSFRichTextString(ckbh); + cell.setCellValue(richTextString); + cell = row.getCell(6); + richTextString = new XSSFRichTextString(tzjjcd); + cell.setCellValue(richTextString); + cell = row.getCell(12); + richTextString = new XSSFRichTextString(tzgglx); + 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); + richTextString = new XSSFRichTextString(zrr); + cell.setCellValue(richTextString); + + row = sheet.getRow(5); + cell = row.getCell(2); + richTextString = new XSSFRichTextString(gglx); + cell.setCellValue(richTextString); + cell = row.getCell(6); + richTextString = new XSSFRichTextString(cplx); + cell.setCellValue(richTextString); + cell = row.getCell(12); + richTextString = new XSSFRichTextString(cwlx); + cell.setCellValue(richTextString); + + row = sheet.getRow(6); + cell = row.getCell(2); + richTextString = new XSSFRichTextString(jgyg); + cell.setCellValue(richTextString); + cell = row.getCell(6); + richTextString = new XSSFRichTextString(ssfl); + cell.setCellValue(richTextString); + cell = row.getCell(12); + richTextString = new XSSFRichTextString(sfcscbss); + cell.setCellValue(richTextString); + + row = sheet.getRow(7); + cell = row.getCell(2); + richTextString = new XSSFRichTextString(syxdsbhlbj); + cell.setCellValue(richTextString); + + row = sheet.getRow(8); + cell = row.getCell(2); + richTextString = new XSSFRichTextString(xmjd); + cell.setCellValue(richTextString); + cell = row.getCell(6); + richTextString = new XSSFRichTextString(ljlyfl); + cell.setCellValue(richTextString); + cell = row.getCell(12); + richTextString = new XSSFRichTextString(tzfz); + cell.setCellValue(richTextString); + + row = sheet.getRow(9); + cell = row.getCell(2); + richTextString = new XSSFRichTextString(xmbh); + cell.setCellValue(richTextString); + + row = sheet.getRow(10); + cell = row.getCell(2); + richTextString = new XSSFRichTextString(ggyy); + cell.setCellValue(richTextString); + + row = sheet.getRow(11); + cell = row.getCell(2); + richTextString = new XSSFRichTextString(zt); + cell.setCellValue(richTextString); + } - // 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; - // } - // - // - // - // + if (changeDetils != null && changeDetils.size() > 0) { + for (int i = 0; i < changeDetils.size(); i++) { + XSSFRow row = sheet.getRow(i + 16); + if (row == null) { + row = sheet.createRow(i + 16); + } + 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(); + + XSSFCell cell = row.getCell(0); + if (cell == null) { + cell = row.createCell(0); + + } + XSSFRichTextString richTextString = new XSSFRichTextString(i + 1 + ""); + cell.setCellValue(richTextString); + + cell = row.getCell(1); + if (cell == null) { + cell = row.createCell(1); + + } + richTextString = new XSSFRichTextString(ph); + cell.setCellValue(richTextString); + + cell = row.getCell(2); + if (cell == null) { + cell = row.createCell(2); + + } + 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(4); + if (cell == null) { + cell = row.createCell(4); + + } + richTextString = new XSSFRichTextString(xbb); + cell.setCellValue(richTextString); + + cell = row.getCell(5); + if (cell == null) { + cell = row.createCell(5); + + } + richTextString = new XSSFRichTextString(ysl); + cell.setCellValue(richTextString); + + cell = row.getCell(6); + if (cell == null) { + cell = row.createCell(6); + + } + richTextString = new XSSFRichTextString(xsl); + cell.setCellValue(richTextString); + + cell = row.getCell(7); + if (cell == null) { + cell = row.createCell(7); + + } + richTextString = new XSSFRichTextString(bgsl); + cell.setCellValue(richTextString); + + cell = row.getCell(8); + if (cell == null) { + cell = row.createCell(8); + + } + richTextString = new XSSFRichTextString(ggsm); + cell.setCellValue(richTextString); + + cell = row.getCell(9); + if (cell == null) { + cell = row.createCell(9); + + } + richTextString = new XSSFRichTextString(wzpsl); + cell.setCellValue(richTextString); + cell = row.getCell(10); + if (cell == null) { + cell = row.createCell(10); + } + richTextString = new XSSFRichTextString(wzpuj); + cell.setCellValue(richTextString); + cell = row.getCell(11); + if (cell == null) { + cell = row.createCell(11); + } + richTextString = new XSSFRichTextString(zzsl); + 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); + } + } + // жǷĿ¼. 򴴽 + isChartPathExist(filepath); + // Excelļ + // FileOutputStream output = new FileOutputStream(filepath + "\\" + filename); + FileOutputStream output = new FileOutputStream(new File(filepath + "\\" + filename)); + wb.write(output); - //ȡϢ + output.close(); + modeFile.close(); + } + + private void isChartPathExist(String dirPath) { + File file = new File(dirPath); + if (!file.exists()) { + file.mkdirs(); + } + } + + private void changeRevProperty(ChangeOrderBean bn) { + String changeType = bn.getChangeType(); + String receiveClassify = bn.getReceiveClassify(); + String drawingTo = bn.getDrawingTo(); + 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(); ResultSet r = null; Connection con = null; - PreparedStatement stmt=null; + PreparedStatement stmt = null; String sql = "select * from DFL_CHANGEFORM where objectCode=?";// try { con = ConnectionFun(); - stmt=con.prepareStatement(sql); - stmt.setString(1,id); - r=stmt.executeQuery(); - while(r.next()){ + stmt = con.prepareStatement(sql); + stmt.setString(1, id); + r = stmt.executeQuery(); + while (r.next()) { bn.setObjectCode(r.getString(1)); bn.setApplyName(r.getString(2)); bn.setApplyDate(r.getString(3)); @@ -1336,9 +1931,9 @@ public class ChangeNotifyForm extends AbstractRendering { list.add(bn); } - }catch (SQLException e) { + } catch (SQLException e) { e.printStackTrace(); - }finally{ + } finally { try { r.close(); stmt.close(); @@ -1349,21 +1944,21 @@ public class ChangeNotifyForm extends AbstractRendering { } return list; - } + } public List getChangeDetail(String id) { List list = new ArrayList(); ResultSet r = null; Connection con = null; - PreparedStatement stmt=null; + PreparedStatement stmt = null; String sql = "select * from DFL_CHANGEDETAILS where objectCode=?";// try { con = ConnectionFun(); - stmt=con.prepareStatement(sql); - stmt.setString(1,id); - r=stmt.executeQuery(); - while(r.next()){ + stmt = con.prepareStatement(sql); + stmt.setString(1, id); + r = stmt.executeQuery(); + while (r.next()) { ChangeDetils cd = new ChangeDetils(); System.out.println(r.getString(1)); cd.setObjectCode(r.getString(1)); @@ -1382,11 +1977,12 @@ public class ChangeNotifyForm extends AbstractRendering { cd.setSSYJ(r.getString(14)); cd.setCKSL(r.getString(15)); cd.setCLYJ(r.getString(16)); + cd.setGGSM(r.getString(17)); list.add(cd); } - }catch (SQLException e) { + } catch (SQLException e) { e.printStackTrace(); - }finally{ + } finally { try { r.close(); stmt.close(); @@ -1396,112 +1992,101 @@ public class ChangeNotifyForm extends AbstractRendering { } } - return list; } - - - - - public void setValue() { System.out.println(""); List list = getChangeMesg(masterName); - System.out.println("masterName=============="+masterName); - if(list.size() > 0) { - ChangeOrderBean bn = (ChangeOrderBean) list.get(list.size()-1); + 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); - 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); - - - //table2 м + table1.setValueAt(bn.getApplyName(), 0, 1); + 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); + + // table2 м } - - } - - //ʱύݿ + // ʱύݿ public void insertMes(ChangeOrderBean bn) { Connection con = null; - PreparedStatement stmt=null; + PreparedStatement stmt = null; String sql = "insert into DFL_CHANGEFORM values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; try { con = ConnectionFun(); stmt = con.prepareStatement(sql); - stmt.setString(1,bn.getObjectCode()); - stmt.setString(2,bn.getApplyName()); - stmt.setString(3,bn.getApplyDate()); - stmt.setString(4,bn.getProjectCode()); - stmt.setString(5,bn.getClientNae()); - stmt.setString(6,bn.getProductDepartment()); - stmt.setString(7,bn.getProductName()); - - stmt.setString(8,bn.getProjectModel()); - stmt.setString(9,bn.getAffectedPart()); - stmt.setString(10,bn.getChangeType()); - stmt.setString(11,bn.getProductType()); + stmt.setString(1, bn.getObjectCode()); + stmt.setString(2, bn.getApplyName()); + stmt.setString(3, bn.getApplyDate()); + stmt.setString(4, bn.getProjectCode()); + stmt.setString(5, bn.getClientNae()); + stmt.setString(6, bn.getProductDepartment()); + stmt.setString(7, bn.getProductName()); + stmt.setString(8, bn.getProjectModel()); + stmt.setString(9, bn.getAffectedPart()); + stmt.setString(10, bn.getChangeType()); + stmt.setString(11, bn.getProductType()); - stmt.setString(12,bn.getErrorType()); - stmt.setString(13,bn.getDutyDepartment()); - stmt.setString(14,bn.getDutyMan()); + stmt.setString(12, bn.getErrorType()); + stmt.setString(13, bn.getDutyDepartment()); + stmt.setString(14, bn.getDutyMan()); - stmt.setString(15,bn.getChangeReason()); + stmt.setString(15, bn.getChangeReason()); - stmt.setString(16,bn.getSalseClassify()); + stmt.setString(16, bn.getSalseClassify()); - stmt.setString(17,bn.getPriceBooking()); + stmt.setString(17, bn.getPriceBooking()); - stmt.setString(18,bn.getIsNotProductLoss()); - stmt.setString(19,bn.getReceiveClassify()); - stmt.setString(20,bn.getWarehouseCode()); - stmt.setString(21,bn.getAccountSet()); + stmt.setString(18, bn.getIsNotProductLoss()); + stmt.setString(19, bn.getReceiveClassify()); + stmt.setString(20, bn.getWarehouseCode()); + stmt.setString(21, bn.getAccountSet()); - stmt.setString(22,bn.getNotifyEmergencyProcedures()); - stmt.setString(23,bn.getDrawingTo()); - stmt.setString(24,bn.getChangeListCode()); + stmt.setString(22, bn.getNotifyEmergencyProcedures()); + stmt.setString(23, bn.getDrawingTo()); + stmt.setString(24, bn.getChangeListCode()); - stmt.setString(25,bn.getTZChangeType()); - stmt.setString(26,bn.getSUOSU_ProductDepartment()); - stmt.setString(27,bn.getProjectState()); - stmt.executeUpdate() ; + stmt.setString(25, bn.getTZChangeType()); + stmt.setString(26, bn.getSUOSU_ProductDepartment()); + stmt.setString(27, bn.getProjectState()); + stmt.executeUpdate(); System.out.println("ݲݿ"); } catch (Exception ex) { @@ -1515,42 +2100,38 @@ public class ChangeNotifyForm extends AbstractRendering { } } - } - - - /** - * ϸ + * ϸ */ - - public void insertChangeDetailsMes(ChangeDetils cd) { Connection con = null; - PreparedStatement stmt=null; - String sql = "insert into DFL_CHANGEDETAILS values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + PreparedStatement stmt = null; + String sql = "insert into DFL_CHANGEDETAILS 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.executeUpdate() ; + 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()); + System.out.println(sql); + stmt.executeUpdate(); System.out.println("ݲݿ"); } catch (Exception ex) { ex.printStackTrace(); @@ -1563,10 +2144,7 @@ public class ChangeNotifyForm extends AbstractRendering { } } - - } - - + } public void delChangeForm(String id) { Connection con = null; @@ -1575,7 +2153,7 @@ public class ChangeNotifyForm extends AbstractRendering { try { con = ConnectionFun(); PreparedStatement prepStmt = conn.prepareStatement(sql); - prepStmt.setString(1,id); + prepStmt.setString(1, id); prepStmt.executeUpdate(); System.out.println("ݿɾɹ"); } catch (Exception ex) { @@ -1589,8 +2167,7 @@ public class ChangeNotifyForm extends AbstractRendering { } } - - public void delChangedetil(String id ,String ph) { + public void delChangedetil(String id, String ph) { Connection con = null; String sql = "delete from DFL_CHANGEDETAILS where objectCode=? and PH = ?"; System.out.println(sql); @@ -1598,12 +2175,12 @@ public class ChangeNotifyForm extends AbstractRendering { con = ConnectionFun(); PreparedStatement prepStmt = conn.prepareStatement(sql); - prepStmt.setString(1,id); - prepStmt.setString(2,ph); + prepStmt.setString(1, id); + prepStmt.setString(2, ph); prepStmt.executeUpdate(); - // Statement stmt=conn.createStatement();//Statement - // stmt.executeUpdate(sql);//ִsql + // Statement stmt=conn.createStatement();//Statement + // stmt.executeUpdate(sql);//ִsql System.out.println("ݿɾɹ"); } catch (Exception ex) { ex.printStackTrace(); @@ -1614,14 +2191,10 @@ public class ChangeNotifyForm extends AbstractRendering { ex.printStackTrace(); } - } } - - - - public void delAllChangedetil(String id ) { + public void delAllChangedetil(String id) { Connection con = null; String sql = "delete from DFL_CHANGEDETAILS where objectCode=?"; System.out.println(sql); @@ -1629,12 +2202,12 @@ public class ChangeNotifyForm extends AbstractRendering { con = ConnectionFun(); PreparedStatement prepStmt = conn.prepareStatement(sql); - prepStmt.setString(1,id); + prepStmt.setString(1, id); prepStmt.executeUpdate(); - // Statement stmt=conn.createStatement();//Statement - // stmt.executeUpdate(sql);//ִsql + // Statement stmt=conn.createStatement();//Statement + // stmt.executeUpdate(sql);//ִsql System.out.println("ݿɾɹ"); } catch (Exception ex) { ex.printStackTrace(); @@ -1645,26 +2218,24 @@ public class ChangeNotifyForm extends AbstractRendering { ex.printStackTrace(); } - } } - - //ݿǶиö + // ݿǶиö public int ifcountform(String id) { int i = 0; Connection con = null; - PreparedStatement stmt=null; + PreparedStatement stmt = null; String sql = "select * from DFL_CHANGEFORM where objectCode=?"; try { con = ConnectionFun(); stmt = con.prepareStatement(sql); - ResultSet rs=null; - stmt.setString(1,id); - rs=stmt.executeQuery(); - while(rs.next()) { - i=i+1; + ResultSet rs = null; + stmt.setString(1, id); + rs = stmt.executeQuery(); + while (rs.next()) { + i = i + 1; } @@ -1680,20 +2251,21 @@ public class ChangeNotifyForm extends AbstractRendering { } return i; } - //ͳ + + // ͳ public int ifcountdetial(String id) { int i = 0; Connection con = null; - PreparedStatement stmt=null; + PreparedStatement stmt = null; String sql = "select * from DFL_CHANGEDETAILS where objectCode=?"; try { con = ConnectionFun(); stmt = con.prepareStatement(sql); - ResultSet rs=null; - stmt.setString(1,id); - rs=stmt.executeQuery(); - while(rs.next()) { - i=i+1; + ResultSet rs = null; + stmt.setString(1, id); + rs = stmt.executeQuery(); + while (rs.next()) { + i = i + 1; } } catch (Exception ex) { @@ -1709,10 +2281,6 @@ public class ChangeNotifyForm extends AbstractRendering { return i; } - - - - /** * JTableп */ @@ -1725,9 +2293,6 @@ public class ChangeNotifyForm extends AbstractRendering { return columns; } - - - class MyButtonEditor extends DefaultCellEditor { protected DateButton button; @@ -1749,7 +2314,6 @@ public class ChangeNotifyForm extends AbstractRendering { } } - class MyTable extends JTable { int myRow = -1, myCol = -1; TableCellEditor myEditor; @@ -1774,7 +2338,19 @@ public class ChangeNotifyForm 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; + } /** * ͨѯѯĿ * @@ -1804,6 +2380,4 @@ public class ChangeNotifyForm extends AbstractRendering { } } - - } diff --git a/src/com/connor/dfl/plm/forms/QuickChangeForm.java b/src/com/connor/dfl/plm/forms/QuickChangeForm.java index eedb5bc..5cedea6 100644 --- a/src/com/connor/dfl/plm/forms/QuickChangeForm.java +++ b/src/com/connor/dfl/plm/forms/QuickChangeForm.java @@ -1,4 +1,5 @@ package com.connor.dfl.plm.forms; + import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; @@ -7,7 +8,13 @@ import java.awt.Font; 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.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; import java.io.IOException; +import java.io.InputStream; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; @@ -18,6 +25,7 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; +import java.util.Enumeration; import java.util.EventObject; import java.util.HashMap; import java.util.List; @@ -42,12 +50,19 @@ import javax.swing.border.LineBorder; import javax.swing.event.CellEditorListener; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.DefaultTableModel; +import javax.swing.table.JTableHeader; import javax.swing.table.TableCellEditor; import javax.swing.table.TableCellRenderer; import javax.swing.table.TableColumn; import javax.swing.table.TableColumnModel; +import org.apache.poi.xssf.usermodel.XSSFCell; +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 com.connor.dfl.plm.dfl044.DataBaseControl2; import com.connor.dfl.plm.table.CTMap; import com.connor.dfl.plm.table.CTable; import com.connor.dfl.plm.util.DateChooser; @@ -56,7 +71,10 @@ 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.TCComponentDataset; +import com.teamcenter.rac.kernel.TCComponentDatasetType; import com.teamcenter.rac.kernel.TCComponentForm; +import com.teamcenter.rac.kernel.TCComponentGroup; import com.teamcenter.rac.kernel.TCComponentItem; import com.teamcenter.rac.kernel.TCComponentItemRevision; import com.teamcenter.rac.kernel.TCComponentItemType; @@ -72,11 +90,10 @@ import com.teamcenter.rac.util.DateButton; import com.teamcenter.rac.util.MessageBox; import com.teamcenter.rac.util.PropertyLayout; - -public class QuickChangeForm extends AbstractRendering { +public class QuickChangeForm extends AbstractRendering { private TCComponentForm form; private TCSession session; - AbstractAIFApplication app= AIFUtility.getCurrentApplication(); + AbstractAIFApplication app = AIFUtility.getCurrentApplication(); private InterfaceAIFComponent targetComp = app.getTargetComponent(); private TCComponentItemType itemType; private QuickChangeForm selfform; @@ -84,12 +101,17 @@ public class QuickChangeForm extends AbstractRendering { CTable table1; private MyTable table2; - //private CTMap model1, model2; + private JScrollPane tablePanel2; + private JScrollPane scrollPane; + + // private CTMap model1, model2; private CTMap model1; DefaultTableModel model2; private String name; - + private String objname; + private String zhangtao; + private String cangku; private JButton addButton; private JButton delButton; @@ -99,23 +121,20 @@ public class QuickChangeForm extends AbstractRendering { private JComboBox DutyDepartmentBox; private JComboBox SalesClassifyBox; private JComboBox EmergencyNotifyBox; - private JComboBox ProductDepartmentBox;//Ʒ - private JComboBox DrawingChangeTypeBox;//ͼֽ - private JComboBox IsNotProductLossBox;//Ƿɱʧ - private JComboBox ReceiveClassifyBox;//ϼ÷ - private JComboBox WAPYJBox;//δƷ - private JComboBox ZZYJBox;// - private JComboBox SSYJBox;// - private JComboBox CLYJBox;// - - //ʱ + private JComboBox ProductDepartmentBox;// Ʒ + private JComboBox DrawingChangeTypeBox;// ͼֽ + private JComboBox IsNotProductLossBox;// Ƿɱʧ + private JComboBox ReceiveClassifyBox;// ϼ÷ + private JComboBox WAPYJBox;// δƷ + private JComboBox ZZYJBox;// + private JComboBox SSYJBox;// + private JComboBox CLYJBox;// + private DataBaseControl2 data; + // ʱ public DefaultComboBoxModel jsrBoxModel; - - - - //private JComboBox projectCode;//Ŀ + // private JComboBox projectCode;//Ŀ static String time; int rows1 = 1; private String applyname; @@ -132,43 +151,67 @@ public class QuickChangeForm extends AbstractRendering { private String type; private String projectState; - - //table2еݣ浽ݿʹ + // table2еݣ浽ݿʹ List changedeList = new ArrayList(); - - - - - - - - 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; + } + } + } + } + } + } catch (TCException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } this.selfform = this; - loadRendering(); + loadRendering(); + } - String[] stringArray = ((TCSession) app.getSession()).getPreferenceService().getStringValues("DFL2_SQL_Connect"); - - private String url = "jdbc:oracle:thin:@//"+stringArray[0];// - - private String user = stringArray[1];// + String[] stringArray = ((TCSession) app.getSession()).getPreferenceService().getStringValues("DFL2_SQL_Connect"); - private String password = stringArray[2];// + private String url = "jdbc:oracle:thin:@//" + stringArray[0];// - private Connection conn = null;// + private String user = stringArray[1];// - private PreparedStatement pre = null;// + private String password = stringArray[2];// - private ResultSet result = null;// + private Connection conn = null;// + private PreparedStatement pre = null;// + private ResultSet result = null;// - public Connection ConnectionFun() throws SQLException { + public Connection ConnectionFun() throws SQLException { try { System.out.println(url); @@ -177,19 +220,16 @@ public class QuickChangeForm extends AbstractRendering { Class.forName("oracle.jdbc.driver.OracleDriver"); System.out.println("سɹ"); } catch (ClassNotFoundException e) { - System.out.println("ʧ"); + System.out.println("ʧ"); } - conn=DriverManager.getConnection(url,user,password); + conn = DriverManager.getConnection(url, user, password); System.out.println("ݿӳɹ"); return conn; - } - - @Override public void loadRendering() throws TCException { try { @@ -200,316 +240,294 @@ public class QuickChangeForm extends AbstractRendering { } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); - } - } - private void initUI() throws TCException, SQLException { + } + } + private void initUI() throws TCException, SQLException { - // + // 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); + if (change_type_stringArrays == null || change_type_stringArrays.length <= 0) { + MessageBox.post("ѡDFL_Form_ChangeTypeδ,ϵԱ!!", "", MessageBox.ERROR); return; } - // + // ChangeTypeBox = new JComboBox(); - for(int change_type_number = 0;change_type_number=2) { - groupname = buisnisDivisions[buisnisDivisions.length-2]; + if (buisnisDivisions.length >= 2) { + groupname = buisnisDivisions[buisnisDivisions.length - 2]; } - table1.setValueAt("", 0, 0); - table1.setValueAt(applyname, 0,1); + table1.setValueAt(applyname, 0, 1); table1.setValueAt("ٱ", 0, 2); table1.setValueAt(my_item_id, 0, 3); - - table1.setValueAt("ʱ", 0, 4); table1.setValueAt("Ʒ", 1, 0); table1.setValueAt(productname, 1, 1); - table1.setValueAt("Ʒͺ", 1, 2); table1.setValueAt(productmodel, 1, 3); - - table1.setValueAt("ͻ", 1, 4); table1.setValueAt(clientname, 1, 5); - table1.setValueAt("ֿ", 2, 0);// - String[] stringArray_warehouse = ((TCSession) app.getSession()).getPreferenceService().getStringValues("DFL_Form_WarehouseCode"); - String warehouse = ""; - for(int z = 0 ;z0) { - // 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(); - // } - // } - // } - // } - - - - - - - // - table1.setCombo(4,1,new DefaultCellEditor(ChangeTypeBox)); - //Ʒ - table1.setCombo(4,3,new DefaultCellEditor(ProductTypecBox)); - // - table1.setCombo(4,5,new DefaultCellEditor(ErrorTypeBox)); - //۷ - table1.setCombo(5,3,new DefaultCellEditor(SalesClassifyBox)); - //β - //table1.setCombo(3,3,new DefaultCellEditor(DutyDepartmentBox)); - //̶֪ͨ - table1.setCombo(2,3,new DefaultCellEditor(EmergencyNotifyBox)); - //ʱ - //Ʒ - table1.setCombo(3,1,new DefaultCellEditor(ProductDepartmentBox)); - //ͼֽ - table1.setCombo(2,5,new DefaultCellEditor(DrawingChangeTypeBox)); - //Ƿɱʧ - table1.setCombo(5,5,new DefaultCellEditor(IsNotProductLossBox)); - //ϼ÷ - table1.setCombo(7,3,new DefaultCellEditor(ReceiveClassifyBox)); - //table1.setCombo(0,5,new DefaultCellEditor(datetime)); - - - - - //table1.setCombo(8, 1, new DefaultCellEditor(projectCode)); + table1.setCombo(0, 5, new DefaultCellEditor(showDate1)); + // 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(); + // } + // } + // } + // } + + // + table1.setCombo(4, 1, new DefaultCellEditor(ChangeTypeBox)); + // Ʒ + table1.setCombo(4, 3, new DefaultCellEditor(ProductTypecBox)); + // + table1.setCombo(4, 5, new DefaultCellEditor(ErrorTypeBox)); + // ۷ + table1.setCombo(5, 3, new DefaultCellEditor(SalesClassifyBox)); + // β + // table1.setCombo(3,3,new DefaultCellEditor(DutyDepartmentBox)); + // ̶֪ͨ + table1.setCombo(2, 3, new DefaultCellEditor(EmergencyNotifyBox)); + // ʱ + // Ʒ + table1.setCombo(3, 1, new DefaultCellEditor(ProductDepartmentBox)); + // ͼֽ + table1.setCombo(2, 5, new DefaultCellEditor(DrawingChangeTypeBox)); + // Ƿɱʧ + table1.setCombo(5, 5, new DefaultCellEditor(IsNotProductLossBox)); + // ϼ÷ + table1.setCombo(7, 3, new DefaultCellEditor(ReceiveClassifyBox)); + // table1.setCombo(0,5,new DefaultCellEditor(datetime)); + + // table1.setCombo(8, 1, new DefaultCellEditor(projectCode)); table1.getColumnModel().getColumn(0).setPreferredWidth(130); table1.getColumnModel().getColumn(1).setPreferredWidth(400); @@ -820,23 +800,20 @@ public class QuickChangeForm extends AbstractRendering { 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 { + 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); String objectname = item.getStringProperty("object_name"); + 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"); if (allRev.length > 0) { List list = new ArrayList(); @@ -859,15 +836,19 @@ public class QuickChangeForm extends AbstractRendering { 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(), 9, new DefaultCellEditor(WAPYJBox)); - table2.setComboCell(table2.getSelectedRow(), 11, new DefaultCellEditor(ZZYJBox)); - table2.setComboCell(table2.getSelectedRow(), 13, new DefaultCellEditor(SSYJBox)); - table2.setComboCell(table2.getSelectedRow(), 15, new DefaultCellEditor(CLYJBox)); + 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)); + } else { - javax.swing.JOptionPane.showMessageDialog(null, "ƷƷдûа汾", "ϵͳʾ", + javax.swing.JOptionPane.showMessageDialog(null, "ƷƷûа汾", "ϵͳʾ", javax.swing.JOptionPane.WARNING_MESSAGE); setValueAt("", table2.getSelectedRow(), 2); @@ -875,7 +856,7 @@ public class QuickChangeForm extends AbstractRendering { } } } catch (Exception e) { - System.out.println("eeee="+e.getMessage()); + System.out.println("eeee=" + e.getMessage()); e.printStackTrace(); } Vector rowVector = (Vector) dataVector.elementAt(row); @@ -885,28 +866,21 @@ public class QuickChangeForm extends AbstractRendering { } }; - table2 = new MyTable() { @Override public boolean isCellEditable(int row, int column) { - if(column == 0) { - return false; + if (column == 0) { + return false; } return true; } }; - - table2.setModel(model2); - table2.setColumnModel(getColumn(table2, new int[] { 90, 180, 180, 180,180,180,180, 180, 180,180,180,180, 180, 180,180,180 })); + 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); table1.setBorder(new LineBorder(Color.BLACK)); @@ -915,107 +889,131 @@ public class QuickChangeForm extends AbstractRendering { table2.setDefaultRenderer(Object.class, tcr); table2.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + addButton = new JButton(" "); + delButton = new JButton(" ɾ "); - addButton = new JButton(""); - delButton = new JButton("ɾ"); - - List listdetils = getChangeDetail(name); - if(listdetils.size()>0) { + List listdetils = getChangeDetail(name); + if (listdetils.size() > 0) { - for(int j = 0;j< listdetils.size();j++) { + for (int j = 0; j < listdetils.size(); j++) { model2.addRow(new String[] { Integer.toString(rows1++) }); - //int i =1; - //for(int j =0 ;j 6) { + int count = rows1 - 6; + count = 300 + count * 50; + tablePanel2.setPreferredSize(new Dimension((int) tablePanel2.getPreferredSize().getWidth(), count)); + tablePanel2.revalidate(); + tablePanel2.repaint(); + scrollPane.revalidate(); + scrollPane.repaint(); + } else { + tablePanel2.setPreferredSize(new Dimension((int) tablePanel2.getPreferredSize().getWidth(), 300)); + tablePanel2.revalidate(); + tablePanel2.repaint(); + scrollPane.revalidate(); + scrollPane.repaint(); + } } }); delButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int sRow = table2.getSelectedRow(); - if(sRow == -1) { + if (sRow == -1) { javax.swing.JOptionPane.showMessageDialog(null, "ѡкƳ", "ϵͳʾ", javax.swing.JOptionPane.WARNING_MESSAGE); return; } - //List list =getChangeDetail(name); + // List list =getChangeDetail(name); int[] sRows = table2.getSelectedRows(); - int p ; - for (int j = sRows.length-1; j >=0 ; j--) { + int p; + for (int j = sRows.length - 1; j >= 0; j--) { String PH = (String) model2.getValueAt(sRows[j], 1); - System.out.println("=============Ʒ"+PH); + System.out.println("=============Ʒ" + PH); delChangedetil(name, PH); - // Connection con = null; + // 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("ɾʧ"); - // } - // // + // 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(); + // //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((int) tablePanel2.getPreferredSize().getWidth(), count)); + tablePanel2.revalidate(); + tablePanel2.repaint(); + scrollPane.revalidate(); + scrollPane.repaint(); + } else { + tablePanel2.setPreferredSize(new Dimension((int) tablePanel2.getPreferredSize().getWidth(), 300)); + tablePanel2.revalidate(); + tablePanel2.repaint(); + scrollPane.revalidate(); + scrollPane.repaint(); + } } }); - - - 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 showCalendarPanel = new JPanel(); + // showCalendarPanel.add("1.1.left.top",showCalenderButten); - JScrollPane tablePanel2 = new JScrollPane(table2); + tablePanel2 = new JScrollPane(table2); tablePanel2.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); - tablePanel2.setPreferredSize(new Dimension(1600, 300)); + 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); + 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(" ")); + buttonPanel0.add("3.1.left.top", new JLabel(" ")); + buttonPanel0.add("4.1.left.top", new JLabel(" ")); + buttonPanel0.add("5.1.left.top", new JLabel(" ")); + buttonPanel0.add("6.1.left.top", new JLabel(" ")); + buttonPanel0.add("7.1.left.top", new JLabel(" ")); + buttonPanel0.add("8.1.left.top", new JLabel(" ")); + buttonPanel0.add("9.1.left.top", new JLabel(" ")); + buttonPanel0.add("10.1.left.top", new JLabel(" ")); + buttonPanel0.add("11.1.left.top", new JLabel(" ")); + buttonPanel0.add("12.1.left.top", new JLabel(" ")); + buttonPanel0.add("13.1.left.top", new JLabel(" ")); + buttonPanel0.add("14.1.left.top", new JLabel(" ")); + 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("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); + buttonPanel0.add("23.1.left.top", new JLabel(" ")); + buttonPanel0.add("24.1.left.top", new JLabel(" ")); + buttonPanel0.add("25.1.left.top", new JLabel(" ")); + JPanel rootPanel = new JPanel(new PropertyLayout()); + JLabel detailsLable = new JLabel("ϸ"); + detailsLable.setFont(new Font("", 1, 14)); - JPanel buttonPanel0 = new JPanel(new PropertyLayout()); - buttonPanel0.add("1.1.left.top",new JLabel(" ")); - buttonPanel0.add("2.1.left.top",new JLabel(" ")); - buttonPanel0.add("3.1.left.top",new JLabel(" ")); - buttonPanel0.add("4.1.left.top",new JLabel(" ")); - buttonPanel0.add("5.1.left.top",new JLabel(" ")); - buttonPanel0.add("6.1.left.top",new JLabel(" ")); - buttonPanel0.add("7.1.left.top",new JLabel(" ")); - buttonPanel0.add("8.1.left.top",new JLabel(" ")); - buttonPanel0.add("9.1.left.top",new JLabel(" ")); - buttonPanel0.add("10.1.left.top",new JLabel(" ")); - buttonPanel0.add("11.1.left.top",new JLabel(" ")); - buttonPanel0.add("12.1.left.top",new JLabel(" ")); - buttonPanel0.add("13.1.left.top",new JLabel(" ")); - buttonPanel0.add("14.1.left.top",new JLabel(" ")); - 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",new JLabel(" ")); - buttonPanel0.add("19.1.left.top",btn); - - buttonPanel0.add("20.1.left.top",new JLabel(" ")); - buttonPanel0.add("21.1.left.top",new JLabel(" ")); - buttonPanel0.add("22.1.left.top",zt_btn); - buttonPanel0.add("23.1.left.top",new JLabel(" ")); - buttonPanel0.add("24.1.left.top",new JLabel(" ")); - buttonPanel0.add("25.1.left.top",new JLabel(" ")); + 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); + this.setSize(1600, 1300); + this.setLayout(new BorderLayout()); + scrollPane = new JScrollPane(mainPanel); + scrollPane.getVerticalScrollBar().setUnitIncrement(20); + this.add(scrollPane, BorderLayout.CENTER); + this.setBackground(Color.WHITE); - JPanel rootPanel = new JPanel(new PropertyLayout()); + this.addComponentListener(new ComponentListener() { - JLabel detailsLable = new JLabel("ϸ"); - detailsLable.setFont(new Font("", 1, 14)); + @Override + public void componentShown(ComponentEvent e) { + // TODO Auto-generated method stub + } - 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); + @Override + public void componentResized(ComponentEvent e) { + // TODO Auto-generated method stub + Component component2 = e.getComponent(); + int width3 = component2.getWidth(); + if (width3 < 1711) { + tablePanel2.setPreferredSize(new Dimension(1600, (int) tablePanel2.getPreferredSize().getHeight())); + tablePanel2.revalidate(); + tablePanel2.repaint(); + scrollPane.revalidate(); + scrollPane.repaint(); + } else { + tablePanel2.setPreferredSize( + new Dimension((width3 - 1711) + 1600, (int) tablePanel2.getPreferredSize().getHeight())); + tablePanel2.revalidate(); + tablePanel2.repaint(); + scrollPane.revalidate(); + scrollPane.repaint(); + } + } - rootPanel.add("3.1.left.top",detailsLable); + @Override + public void componentMoved(ComponentEvent e) { + // TODO Auto-generated method stub - rootPanel.add("4.1.left.top",tablePanel2); - rootPanel.add("4.2.left.top",buttonPanel); + } + @Override + public void componentHidden(ComponentEvent e) { + // TODO Auto-generated method stub + } + }); - this.setSize(1600, 1300); - this.setLayout(new BorderLayout()); - JScrollPane scrollPane = new JScrollPane(rootPanel); - scrollPane.getVerticalScrollBar().setUnitIncrement(20); - this.add(scrollPane,BorderLayout.CENTER); - this.setBackground(Color.WHITE); 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()); - 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.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(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() + // model1.getValueAt(6, 1) == null ? "" :model1.getValueAt(6, 1).toString() - //˾ - bn.setAccountSet(model1.getValueAt(10, 1) == null ? "" :model1.getValueAt(10, 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()); + bn.setProjectState(model1.getValueAt(7, 1) == null ? "" : model1.getValueAt(7, 1).toString()); insertMes(bn); - - - - - - //=================================================================== - + // =================================================================== delAllChangedetil(name); - for(int cdss = 0 ; cdss changeMesg, + List changeDetils, String model) throws IOException, FileNotFoundException { + // ļģ + InputStream modeFile = ChangeNotifyForm.class.getResourceAsStream(model); + // XSSFWorkbook(excelĵ) + XSSFWorkbook wb; + wb = new XSSFWorkbook(modeFile); + XSSFSheet sheet = wb.getSheetAt(0); +// XSSFRow row1 = sheet.getRow(startRow); +// XSSFCell cell1 = row1.getCell(0); +// XSSFCellStyle style = cell1.getCellStyle(); + if (changeMesg != null && changeMesg.size() > 0) { + ChangeOrderBean cob = changeMesg.get(0); + String sqr = cob.getApplyName(); + 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 gglx = cob.getChangeType(); + String cplx = cob.getProductType(); + String tzgglx = cob.getTZChangeType(); + String cwlx = cob.getErrorType(); + String zrbm = cob.getDutyDepartment(); + String zrr = cob.getDutyMan(); + 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(); + + XSSFRow row = sheet.getRow(0); + XSSFCell cell = row.getCell(0); + XSSFRichTextString richTextString = new XSSFRichTextString(name + "-"+objname); + cell.setCellValue(richTextString); + + row = sheet.getRow(1); + cell = row.getCell(2); + richTextString = new XSSFRichTextString(sqr); + cell.setCellValue(richTextString); + cell = row.getCell(6); + richTextString = new XSSFRichTextString(bgtzdh); + cell.setCellValue(richTextString); + cell = row.getCell(12); + richTextString = new XSSFRichTextString(sqsj); + cell.setCellValue(richTextString); + + row = sheet.getRow(2); + cell = row.getCell(2); + richTextString = new XSSFRichTextString(cpmc); + cell.setCellValue(richTextString); + cell = row.getCell(6); + richTextString = new XSSFRichTextString(cpxh); + cell.setCellValue(richTextString); + cell = row.getCell(12); + richTextString = new XSSFRichTextString(khmc); + cell.setCellValue(richTextString); + + row = sheet.getRow(3); + cell = row.getCell(2); + richTextString = new XSSFRichTextString(ckbh); + cell.setCellValue(richTextString); + cell = row.getCell(6); + richTextString = new XSSFRichTextString(tzjjcd); + cell.setCellValue(richTextString); + cell = row.getCell(12); + richTextString = new XSSFRichTextString(tzgglx); + 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); + richTextString = new XSSFRichTextString(zrr); + cell.setCellValue(richTextString); + + row = sheet.getRow(5); + cell = row.getCell(2); + richTextString = new XSSFRichTextString(gglx); + cell.setCellValue(richTextString); + cell = row.getCell(6); + richTextString = new XSSFRichTextString(cplx); + cell.setCellValue(richTextString); + cell = row.getCell(12); + richTextString = new XSSFRichTextString(cwlx); + cell.setCellValue(richTextString); + + row = sheet.getRow(6); + cell = row.getCell(2); + richTextString = new XSSFRichTextString(jgyg); + cell.setCellValue(richTextString); + cell = row.getCell(6); + richTextString = new XSSFRichTextString(ssfl); + cell.setCellValue(richTextString); + cell = row.getCell(12); + richTextString = new XSSFRichTextString(sfcscbss); + cell.setCellValue(richTextString); + + row = sheet.getRow(7); + cell = row.getCell(2); + richTextString = new XSSFRichTextString(syxdsbhlbj); + cell.setCellValue(richTextString); + + row = sheet.getRow(8); + cell = row.getCell(2); + richTextString = new XSSFRichTextString(xmjd); + cell.setCellValue(richTextString); + cell = row.getCell(6); + richTextString = new XSSFRichTextString(ljlyfl); + cell.setCellValue(richTextString); + cell = row.getCell(12); + richTextString = new XSSFRichTextString(tzfz); + cell.setCellValue(richTextString); + + row = sheet.getRow(9); + cell = row.getCell(2); + richTextString = new XSSFRichTextString(xmbh); + cell.setCellValue(richTextString); + + row = sheet.getRow(10); + cell = row.getCell(2); + richTextString = new XSSFRichTextString(ggyy); + cell.setCellValue(richTextString); + + row = sheet.getRow(11); + cell = row.getCell(2); + richTextString = new XSSFRichTextString(zt); + cell.setCellValue(richTextString); + } + if (changeDetils != null && changeDetils.size() > 0) { + for (int i = 0; i < changeDetils.size(); i++) { + XSSFRow row = sheet.getRow(i + 16); + if (row == null) { + row = sheet.createRow(i + 16); + } + 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(); + + XSSFCell cell = row.getCell(0); + if (cell == null) { + cell = row.createCell(0); + } + XSSFRichTextString richTextString = new XSSFRichTextString(i + 1 + ""); + cell.setCellValue(richTextString); + cell = row.getCell(1); + if (cell == null) { + cell = row.createCell(1); + } + richTextString = new XSSFRichTextString(ph); + cell.setCellValue(richTextString); + cell = row.getCell(2); + if (cell == null) { + cell = row.createCell(2); + } + 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(4); + if (cell == null) { + cell = row.createCell(4); + } + richTextString = new XSSFRichTextString(xbb); + cell.setCellValue(richTextString); + cell = row.getCell(5); + if (cell == null) { + cell = row.createCell(5); + } + richTextString = new XSSFRichTextString(ysl); + cell.setCellValue(richTextString); + cell = row.getCell(6); + if (cell == null) { + cell = row.createCell(6); + } + richTextString = new XSSFRichTextString(xsl); + cell.setCellValue(richTextString); + + cell = row.getCell(7); + if (cell == null) { + cell = row.createCell(7); + } + richTextString = new XSSFRichTextString(bgsl); + cell.setCellValue(richTextString); + cell = row.getCell(8); + if (cell == null) { + cell = row.createCell(8); + + } + richTextString = new XSSFRichTextString(ggsm); + cell.setCellValue(richTextString); - //ȡϢ + cell = row.getCell(9); + if (cell == null) { + cell = row.createCell(9); + + } + richTextString = new XSSFRichTextString(wzpsl); + cell.setCellValue(richTextString); + + cell = row.getCell(10); + if (cell == null) { + cell = row.createCell(10); + + } + richTextString = new XSSFRichTextString(wzpuj); + cell.setCellValue(richTextString); + + cell = row.getCell(11); + if (cell == null) { + cell = row.createCell(11); + + } + richTextString = new XSSFRichTextString(zzsl); + 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); + } + } + + // жǷĿ¼. 򴴽 + isChartPathExist(filepath); + // Excelļ + // FileOutputStream output = new FileOutputStream(filepath + "\\" + filename); + FileOutputStream output = new FileOutputStream(new File(filepath + "\\" + filename)); + wb.write(output); + + output.close(); + modeFile.close(); + } + + private void isChartPathExist(String dirPath) { + File file = new File(dirPath); + if (!file.exists()) { + file.mkdirs(); + } + } + + + + // ȡϢ private List getChangeMesg(String id) { List list = new ArrayList(); ChangeOrderBean bn = new ChangeOrderBean(); ResultSet r = null; Connection con = null; - PreparedStatement stmt=null; + PreparedStatement stmt = null; String sql = "select * from DFL_CHANGEFORM where objectCode=?";// try { con = ConnectionFun(); - stmt=con.prepareStatement(sql); - stmt.setString(1,id); - r=stmt.executeQuery(); - while(r.next()){ + stmt = con.prepareStatement(sql); + stmt.setString(1, id); + r = stmt.executeQuery(); + while (r.next()) { bn.setObjectCode(r.getString(1)); bn.setApplyName(r.getString(2)); bn.setApplyDate(r.getString(3)); @@ -1256,17 +1713,17 @@ public class QuickChangeForm extends AbstractRendering { bn.setWarehouseCode(r.getString(20)); bn.setAccountSet(r.getString(21)); bn.setNotifyEmergencyProcedures(r.getString(22)); - bn.setDrawingTo(r.getString(27)); + 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(23)); + bn.setProjectState(r.getString(27)); list.add(bn); } - }catch (SQLException e) { + } catch (SQLException e) { e.printStackTrace(); - }finally{ + } finally { try { r.close(); stmt.close(); @@ -1277,24 +1734,21 @@ public class QuickChangeForm extends AbstractRendering { } return list; - } - - - + } public List getChangeDetail(String id) { List list = new ArrayList(); ResultSet r = null; Connection con = null; - PreparedStatement stmt=null; + PreparedStatement stmt = null; String sql = "select * from DFL_CHANGEDETAILS where objectCode=?";// try { con = ConnectionFun(); - stmt=con.prepareStatement(sql); - stmt.setString(1,id); - r=stmt.executeQuery(); - while(r.next()){ + stmt = con.prepareStatement(sql); + stmt.setString(1, id); + r = stmt.executeQuery(); + while (r.next()) { ChangeDetils cd = new ChangeDetils(); System.out.println(r.getString(1)); cd.setObjectCode(r.getString(1)); @@ -1313,11 +1767,12 @@ public class QuickChangeForm extends AbstractRendering { cd.setSSYJ(r.getString(14)); cd.setCKSL(r.getString(15)); cd.setCLYJ(r.getString(16)); + cd.setGGSM(r.getString(17)); list.add(cd); } - }catch (SQLException e) { + } catch (SQLException e) { e.printStackTrace(); - }finally{ + } finally { try { r.close(); stmt.close(); @@ -1327,104 +1782,96 @@ public class QuickChangeForm extends AbstractRendering { } } - return list; } - - - - - public void setValue() { System.out.println(""); - List list = getChangeMesg(name); - if(list.size() > 0) { - ChangeOrderBean bn = (ChangeOrderBean) list.get(list.size()-1); + List list = getChangeMesg(name); + if (list.size() > 0) { + ChangeOrderBean bn = (ChangeOrderBean) list.get(list.size() - 1); System.out.println(bn.getApplyName()); - table1.setValueAt(bn.getApplyName(),0, 1); - 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); - //table2 м + table1.setValueAt(bn.getApplyName(), 0, 1); + 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); + // table2 м } } - - //ʱύݿ + // ʱύݿ public void insertMes(ChangeOrderBean bn) { Connection con = null; - PreparedStatement stmt=null; + PreparedStatement stmt = null; String sql = "insert into DFL_CHANGEFORM values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; try { con = ConnectionFun(); stmt = con.prepareStatement(sql); - stmt.setString(1,bn.getObjectCode()); - stmt.setString(2,bn.getApplyName()); - stmt.setString(3,bn.getApplyDate()); - stmt.setString(4,bn.getProjectCode()); - stmt.setString(5,bn.getClientNae()); - stmt.setString(6,bn.getProductDepartment()); - stmt.setString(7,bn.getProductName()); - - stmt.setString(8,bn.getProjectModel()); - stmt.setString(9,bn.getAffectedPart()); - stmt.setString(10,bn.getChangeType()); - stmt.setString(11,bn.getProductType()); + stmt.setString(1, bn.getObjectCode()); + stmt.setString(2, bn.getApplyName()); + stmt.setString(3, bn.getApplyDate()); + stmt.setString(4, bn.getProjectCode()); + stmt.setString(5, bn.getClientNae()); + stmt.setString(6, bn.getProductDepartment()); + stmt.setString(7, bn.getProductName()); + stmt.setString(8, bn.getProjectModel()); + stmt.setString(9, bn.getAffectedPart()); + stmt.setString(10, bn.getChangeType()); + stmt.setString(11, bn.getProductType()); - stmt.setString(12,bn.getErrorType()); - stmt.setString(13,bn.getDutyDepartment()); - stmt.setString(14,bn.getDutyMan()); + stmt.setString(12, bn.getErrorType()); + stmt.setString(13, bn.getDutyDepartment()); + stmt.setString(14, bn.getDutyMan()); - stmt.setString(15,bn.getChangeReason()); + stmt.setString(15, bn.getChangeReason()); - stmt.setString(16,bn.getSalseClassify()); + stmt.setString(16, bn.getSalseClassify()); - stmt.setString(17,bn.getPriceBooking()); + stmt.setString(17, bn.getPriceBooking()); - stmt.setString(18,bn.getIsNotProductLoss()); - stmt.setString(19,bn.getReceiveClassify()); - stmt.setString(20,bn.getWarehouseCode()); - stmt.setString(21,bn.getAccountSet()); + stmt.setString(18, bn.getIsNotProductLoss()); + stmt.setString(19, bn.getReceiveClassify()); + stmt.setString(20, bn.getWarehouseCode()); + stmt.setString(21, bn.getAccountSet()); - stmt.setString(22,bn.getNotifyEmergencyProcedures()); - stmt.setString(23,bn.getDrawingTo()); - stmt.setString(24,bn.getChangeListCode()); + stmt.setString(22, bn.getNotifyEmergencyProcedures()); + stmt.setString(23, bn.getDrawingTo()); + stmt.setString(24, bn.getChangeListCode()); - stmt.setString(25,bn.getTZChangeType()); - stmt.setString(26,bn.getSUOSU_ProductDepartment()); - stmt.setString(27,bn.getProjectState()); - stmt.executeUpdate() ; + stmt.setString(25, bn.getTZChangeType()); + stmt.setString(26, bn.getSUOSU_ProductDepartment()); + stmt.setString(27, bn.getProjectState()); + stmt.executeUpdate(); System.out.println("ݲݿ"); } catch (Exception ex) { @@ -1438,43 +1885,37 @@ public class QuickChangeForm extends AbstractRendering { } } - } - - - - /** - * ϸ + * ϸ */ - - public void insertChangeDetailsMes(ChangeDetils cd) { Connection con = null; - PreparedStatement stmt=null; - String sql = "insert into DFL_CHANGEDETAILS values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + PreparedStatement stmt = null; + String sql = "insert into DFL_CHANGEDETAILS 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.executeUpdate() ; + 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.executeUpdate(); System.out.println("ݲݿ"); } catch (Exception ex) { ex.printStackTrace(); @@ -1487,10 +1928,9 @@ public class QuickChangeForm extends AbstractRendering { } } + } - } - - //ɾʱ + // ɾʱ public void del_date() { Connection con = null; String sql = "delete from dfl_changetime"; @@ -1511,9 +1951,6 @@ public class QuickChangeForm extends AbstractRendering { } } - - - public void delChangeForm(String id) { Connection con = null; String sql = "delete from dfl_changeform where objectCode=?"; @@ -1521,7 +1958,7 @@ public class QuickChangeForm extends AbstractRendering { try { con = ConnectionFun(); PreparedStatement prepStmt = conn.prepareStatement(sql); - prepStmt.setString(1,id); + prepStmt.setString(1, id); prepStmt.executeUpdate(); System.out.println("ݿɾɹ"); } catch (Exception ex) { @@ -1535,13 +1972,7 @@ public class QuickChangeForm extends AbstractRendering { } } - - - - - - - public void delChangedetil(String id ,String ph) { + public void delChangedetil(String id, String ph) { Connection con = null; String sql = "delete from DFL_CHANGEDETAILS where objectCode=? and PH = ?"; System.out.println(sql); @@ -1549,12 +1980,12 @@ public class QuickChangeForm extends AbstractRendering { con = ConnectionFun(); PreparedStatement prepStmt = conn.prepareStatement(sql); - prepStmt.setString(1,id); - prepStmt.setString(2,ph); + prepStmt.setString(1, id); + prepStmt.setString(2, ph); prepStmt.executeUpdate(); - // Statement stmt=conn.createStatement();//Statement - // stmt.executeUpdate(sql);//ִsql + // Statement stmt=conn.createStatement();//Statement + // stmt.executeUpdate(sql);//ִsql System.out.println("ݿɾɹ"); } catch (Exception ex) { ex.printStackTrace(); @@ -1565,15 +1996,11 @@ public class QuickChangeForm extends AbstractRendering { ex.printStackTrace(); } - } - } - - - public void delAllChangedetil(String id ) { + public void delAllChangedetil(String id) { Connection con = null; String sql = "delete from DFL_CHANGEDETAILS where objectCode=?"; System.out.println(sql); @@ -1581,12 +2008,12 @@ public class QuickChangeForm extends AbstractRendering { con = ConnectionFun(); PreparedStatement prepStmt = conn.prepareStatement(sql); - prepStmt.setString(1,id); + prepStmt.setString(1, id); prepStmt.executeUpdate(); - // Statement stmt=conn.createStatement();//Statement - // stmt.executeUpdate(sql);//ִsql + // Statement stmt=conn.createStatement();//Statement + // stmt.executeUpdate(sql);//ִsql System.out.println("ݿɾɹ"); } catch (Exception ex) { ex.printStackTrace(); @@ -1597,31 +2024,25 @@ public class QuickChangeForm extends AbstractRendering { ex.printStackTrace(); } - } - } - - - - - //ݿǶиö + // ݿǶиö public int ifcountform(String id) { int i = 0; Connection con = null; - PreparedStatement stmt=null; + PreparedStatement stmt = null; String sql = "select * from DFL_CHANGEFORM where objectCode=?"; try { con = ConnectionFun(); stmt = con.prepareStatement(sql); - ResultSet rs=null; - stmt.setString(1,id); - rs=stmt.executeQuery(); - while(rs.next()) { - i=i+1; + ResultSet rs = null; + stmt.setString(1, id); + rs = stmt.executeQuery(); + while (rs.next()) { + i = i + 1; } @@ -1637,20 +2058,21 @@ public class QuickChangeForm extends AbstractRendering { } return i; } - //ͳ + + // ͳ public int ifcountdetial(String id) { int i = 0; Connection con = null; - PreparedStatement stmt=null; + PreparedStatement stmt = null; String sql = "select * from DFL_CHANGEDETAILS where objectCode=?"; try { con = ConnectionFun(); stmt = con.prepareStatement(sql); - ResultSet rs=null; - stmt.setString(1,id); - rs=stmt.executeQuery(); - while(rs.next()) { - i=i+1; + ResultSet rs = null; + stmt.setString(1, id); + rs = stmt.executeQuery(); + while (rs.next()) { + i = i + 1; } @@ -1667,10 +2089,6 @@ public class QuickChangeForm extends AbstractRendering { return i; } - - - - /** * JTableп */ @@ -1683,9 +2101,6 @@ public class QuickChangeForm extends AbstractRendering { return columns; } - - - class MyButtonEditor extends DefaultCellEditor { protected DateButton button; @@ -1707,8 +2122,6 @@ public class QuickChangeForm extends AbstractRendering { } } - - class MyTable extends JTable { int myRow = -1, myCol = -1; TableCellEditor myEditor; @@ -1733,7 +2146,19 @@ public class QuickChangeForm 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; + } /** * ͨѯѯĿ * @@ -1763,6 +2188,4 @@ public class QuickChangeForm extends AbstractRendering { } } - - } diff --git a/src/com/connor/dfl/plm/util/ClassValueUtil.java b/src/com/connor/dfl/plm/util/ClassValueUtil.java index 4dbf6ff..ab7e6d4 100644 --- a/src/com/connor/dfl/plm/util/ClassValueUtil.java +++ b/src/com/connor/dfl/plm/util/ClassValueUtil.java @@ -83,7 +83,7 @@ public class ClassValueUtil { String kaitou1 = attrName.substring(0,2); //ǰǷΪ if("".equals(kaitou1)) { - valueBean.setSpec(value); + valueBean.setSpec(lovValue); } } else if(attrName.contains("")){