|
|
@ -1,35 +1,51 @@
|
|
|
|
package com.connor.dfl.plm.dfl028;
|
|
|
|
package com.connor.dfl.plm.dfl028;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.awt.Color;
|
|
|
|
import java.awt.Component;
|
|
|
|
import java.awt.Component;
|
|
|
|
|
|
|
|
import java.awt.Container;
|
|
|
|
|
|
|
|
import java.awt.Desktop;
|
|
|
|
import java.awt.Dimension;
|
|
|
|
import java.awt.Dimension;
|
|
|
|
|
|
|
|
import java.awt.GridLayout;
|
|
|
|
import java.awt.event.ActionEvent;
|
|
|
|
import java.awt.event.ActionEvent;
|
|
|
|
import java.awt.event.ActionListener;
|
|
|
|
import java.awt.event.ActionListener;
|
|
|
|
|
|
|
|
import java.io.BufferedWriter;
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.FileInputStream;
|
|
|
|
import java.io.FileInputStream;
|
|
|
|
import java.io.FileOutputStream;
|
|
|
|
import java.io.FileOutputStream;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
import java.io.OutputStreamWriter;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.List;
|
|
|
|
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.JButton;
|
|
|
|
import javax.swing.JCheckBox;
|
|
|
|
import javax.swing.JCheckBox;
|
|
|
|
|
|
|
|
import javax.swing.JDialog;
|
|
|
|
import javax.swing.JFileChooser;
|
|
|
|
import javax.swing.JFileChooser;
|
|
|
|
import javax.swing.JLabel;
|
|
|
|
import javax.swing.JLabel;
|
|
|
|
import javax.swing.JPanel;
|
|
|
|
import javax.swing.JPanel;
|
|
|
|
|
|
|
|
import javax.swing.JProgressBar;
|
|
|
|
import javax.swing.JTextField;
|
|
|
|
import javax.swing.JTextField;
|
|
|
|
import javax.swing.filechooser.FileSystemView;
|
|
|
|
import javax.swing.filechooser.FileSystemView;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.jacorb.idl.runtime.int_token;
|
|
|
|
|
|
|
|
|
|
|
|
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
|
|
|
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
|
|
|
import com.teamcenter.rac.aif.AbstractAIFDialog;
|
|
|
|
import com.teamcenter.rac.aif.AbstractAIFDialog;
|
|
|
|
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
|
|
|
|
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.TCComponent;
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentBOMLine;
|
|
|
|
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.TCComponentDataset;
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentItem;
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentItem;
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
|
|
|
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentRevisionRule;
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentTcFile;
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentTcFile;
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentUser;
|
|
|
|
|
|
|
|
import com.teamcenter.rac.kernel.TCException;
|
|
|
|
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.MessageBox;
|
|
|
@ -45,13 +61,26 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
|
|
|
|
private JFileChooser jFileChooser;
|
|
|
|
private JFileChooser jFileChooser;
|
|
|
|
private JButton okBut = new JButton("下载");
|
|
|
|
private JButton okBut = new JButton("下载");
|
|
|
|
private JButton celBut = new JButton("取消");
|
|
|
|
private JButton celBut = new JButton("取消");
|
|
|
|
private List<File> fmsFilelist = new ArrayList<>();
|
|
|
|
private ArrayList<File> fmsFilelist = new ArrayList<>();
|
|
|
|
private List<String> hzmlist = new ArrayList<>();
|
|
|
|
private ArrayList<String> hzmlist = new ArrayList<>();
|
|
|
|
private List<String> namelist = new ArrayList<>();
|
|
|
|
private ArrayList<String> namelist = new ArrayList<>();
|
|
|
|
private FileInputStream fis;
|
|
|
|
private FileInputStream fis;
|
|
|
|
private FileOutputStream fos;
|
|
|
|
private FileOutputStream fos;
|
|
|
|
private JPanel btnPanel1;
|
|
|
|
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<String> noFileList=new ArrayList<String>();
|
|
|
|
|
|
|
|
private List<String> datasetList=new ArrayList<String>();
|
|
|
|
|
|
|
|
private Map<String, String> pathMap=new HashMap<String, String>();
|
|
|
|
|
|
|
|
private String pathString;
|
|
|
|
|
|
|
|
ExecutorService pool = Executors.newCachedThreadPool();
|
|
|
|
public Dfl028AIFDialog(AbstractAIFApplication arg0){
|
|
|
|
public Dfl028AIFDialog(AbstractAIFApplication arg0){
|
|
|
|
this.app = arg0;
|
|
|
|
this.app = arg0;
|
|
|
|
this.session = (TCSession)app.getSession();
|
|
|
|
this.session = (TCSession)app.getSession();
|
|
|
@ -62,18 +91,29 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
|
|
|
|
public void run() {
|
|
|
|
public void run() {
|
|
|
|
//显示窗口
|
|
|
|
//显示窗口
|
|
|
|
init();
|
|
|
|
init();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//启用查询按钮
|
|
|
|
//启用查询按钮
|
|
|
|
// qryBtn.setEnabled(true);
|
|
|
|
// qryBtn.setEnabled(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//获取下载文件列表
|
|
|
|
//获取下载文件列表
|
|
|
|
private void getload(TCComponentDataset dataset){
|
|
|
|
private void getload(TCComponentDataset dataset,String path,List<String> list,String itemid){
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
TCComponentTcFile[] file = dataset.getTcFiles();
|
|
|
|
TCComponentTcFile[] file = dataset.getTcFiles();
|
|
|
|
if(file == null || file.length ==0){
|
|
|
|
if(file == null || file.length ==0){
|
|
|
|
MessageBox.post("数据集没有命名引用的文件,请检查!",
|
|
|
|
if(itemid.equals("sjj")) {
|
|
|
|
"WARNING",MessageBox.WARNING);
|
|
|
|
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;
|
|
|
|
return;
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
|
for(int i=0;i<file.length;i++){
|
|
|
|
for(int i=0;i<file.length;i++){
|
|
|
@ -81,18 +121,24 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//获取后缀名
|
|
|
|
//获取后缀名
|
|
|
|
String hzm = file[i].getTCProperty("file_ext").getStringValue();
|
|
|
|
hzm = file[i].getTCProperty("file_ext").getStringValue();
|
|
|
|
//获取文件名(带后缀)
|
|
|
|
//获取文件名(带后缀)
|
|
|
|
|
|
|
|
if(list.contains(hzm)) {
|
|
|
|
String name = file[i].getTCProperty("original_file_name").getStringValue();
|
|
|
|
String name = file[i].getTCProperty("original_file_name").getStringValue();
|
|
|
|
if(name.contains(".")){
|
|
|
|
if(name.contains(".")){
|
|
|
|
//获取文件名(不带后缀)
|
|
|
|
//获取文件名(不带后缀)
|
|
|
|
name = name.substring(0, name.lastIndexOf("."));
|
|
|
|
name = name.substring(0, name.lastIndexOf("."));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
String replace = name.replace("/", "-").replace("<", "-").
|
|
|
|
|
|
|
|
replace(">", "-").replace(":", "-").replace("|","-").
|
|
|
|
|
|
|
|
replace("\\","-").replace("*","-").replace("?","-");
|
|
|
|
//获取文件用户下载
|
|
|
|
//获取文件用户下载
|
|
|
|
File fmsFile = file[i].getFmsFile();
|
|
|
|
File fmsFile = file[i].getFmsFile();
|
|
|
|
hzmlist.add(hzm);
|
|
|
|
hzmlist.add(hzm);
|
|
|
|
namelist.add(name);
|
|
|
|
namelist.add(path+File.separator+replace);
|
|
|
|
fmsFilelist.add(fmsFile);
|
|
|
|
fmsFilelist.add(fmsFile);
|
|
|
|
|
|
|
|
fileSize=fileSize+fmsFile.length();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (TCException e) {
|
|
|
|
} 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<file.length;i++){
|
|
|
|
|
|
|
|
// //判断文件类型不是"ImanFile"
|
|
|
|
|
|
|
|
// if(!file[i].getType().equals("ImanFile")){
|
|
|
|
|
|
|
|
// continue;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// //获取后缀名
|
|
|
|
|
|
|
|
// hzm = file[i].getTCProperty("file_ext").getStringValue();
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }catch (TCException e) {
|
|
|
|
|
|
|
|
// // TODO Auto-generated catch block
|
|
|
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
|
|
|
|
// MessageBox.post("发生错误:"+e.getMessage(),"错误",MessageBox.ERROR);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
//文件下载到指定路径
|
|
|
|
//文件下载到指定路径
|
|
|
|
private void downloadfile(String fpath){
|
|
|
|
private void downloadfile(String fpath){
|
|
|
|
try{
|
|
|
|
try{
|
|
|
|
|
|
|
|
long hasReadByte = 0L;// 已经读取的字节个数
|
|
|
|
|
|
|
|
float result;
|
|
|
|
|
|
|
|
int progressSize = 0;
|
|
|
|
for(int i=0;i<hzmlist.size();i++){
|
|
|
|
for(int i=0;i<hzmlist.size();i++){
|
|
|
|
//拼接输出文件名
|
|
|
|
//拼接输出文件名
|
|
|
|
String filename = namelist.get(i)+"."+hzmlist.get(i);
|
|
|
|
String filename = namelist.get(i)+"."+hzmlist.get(i);
|
|
|
@ -119,11 +195,21 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
|
|
|
|
int len = 0;
|
|
|
|
int len = 0;
|
|
|
|
while((len=fis.read(bs))!=-1){
|
|
|
|
while((len=fis.read(bs))!=-1){
|
|
|
|
fos.write(bs, 0, len);
|
|
|
|
fos.write(bs, 0, len);
|
|
|
|
|
|
|
|
hasReadByte = hasReadByte + len;
|
|
|
|
|
|
|
|
result = (float) ((double) hasReadByte / fileSize);
|
|
|
|
|
|
|
|
progressSize = Math.round(result * 100);
|
|
|
|
|
|
|
|
updateProgress(bar, progressSize);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (progressSize <100) {
|
|
|
|
|
|
|
|
updateProgress(bar, progressSize);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(progressSize==100) {
|
|
|
|
|
|
|
|
bar.setForeground(Color.blue);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(fos!=null) fos.close();
|
|
|
|
if(fos!=null) fos.close();
|
|
|
|
if(fis!=null) fis.close();
|
|
|
|
if(fis!=null) fis.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
MessageBox.post("下载成功","成功",MessageBox.INFORMATION);
|
|
|
|
|
|
|
|
}catch(Exception e){
|
|
|
|
}catch(Exception e){
|
|
|
|
e.printStackTrace();
|
|
|
|
e.printStackTrace();
|
|
|
|
MessageBox.post("下载失败:"+e.getMessage(),"错误",MessageBox.ERROR);
|
|
|
|
MessageBox.post("下载失败:"+e.getMessage(),"错误",MessageBox.ERROR);
|
|
|
@ -131,6 +217,8 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
fos.close();
|
|
|
|
fos.close();
|
|
|
|
fis.close();
|
|
|
|
fis.close();
|
|
|
|
|
|
|
|
MessageBox.post("下载完成","2",2);
|
|
|
|
|
|
|
|
this.dispose();
|
|
|
|
} catch (IOException e) {
|
|
|
|
} catch (IOException e) {
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
|
|
|
|
|
|
|
@ -153,19 +241,54 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
|
|
|
|
//界面初始化
|
|
|
|
//界面初始化
|
|
|
|
private void init(){
|
|
|
|
private void init(){
|
|
|
|
this.setLayout(new PropertyLayout());
|
|
|
|
this.setLayout(new PropertyLayout());
|
|
|
|
this.setPreferredSize(new Dimension(550, 150));
|
|
|
|
this.setPreferredSize(new Dimension(650, 300));
|
|
|
|
FileSystemView fsv = FileSystemView.getFileSystemView();
|
|
|
|
FileSystemView fsv = FileSystemView.getFileSystemView();
|
|
|
|
String deskPath = fsv.getHomeDirectory().getPath();
|
|
|
|
String deskPath = fsv.getHomeDirectory().getPath();
|
|
|
|
|
|
|
|
//第一行:图纸类型
|
|
|
|
btnPanel1 = new JPanel();
|
|
|
|
btnPanel1 = new JPanel();
|
|
|
|
|
|
|
|
JLabel drawingtype = new JLabel("图纸类型:");
|
|
|
|
JCheckBox checkBox1 = new JCheckBox("DWG");
|
|
|
|
JCheckBox checkBox1 = new JCheckBox("DWG");
|
|
|
|
JCheckBox checkBox2 = new JCheckBox("PDF");
|
|
|
|
JCheckBox checkBox2 = new JCheckBox("idw");//new
|
|
|
|
JCheckBox checkBox3 = new JCheckBox("STP");
|
|
|
|
JCheckBox checkBox3 = new JCheckBox("PDF");
|
|
|
|
btnPanel1.add(checkBox1);
|
|
|
|
JCheckBox checkBox4 = new JCheckBox("ipt");//new
|
|
|
|
btnPanel1.add(checkBox2);
|
|
|
|
JCheckBox checkBox5 = new JCheckBox("iam");//new
|
|
|
|
btnPanel1.add(checkBox3);
|
|
|
|
JCheckBox checkBox6 = new JCheckBox("STP");
|
|
|
|
|
|
|
|
JCheckBox checkBox7 = new JCheckBox("STEP");//new
|
|
|
|
|
|
|
|
//btnPanel1.add(drawingtype);
|
|
|
|
|
|
|
|
btnPanel1.add("1.1.left.top",drawingtype);
|
|
|
|
|
|
|
|
btnPanel1.add("1.2.left.top",checkBox1);
|
|
|
|
|
|
|
|
btnPanel1.add("1.3.left.top",checkBox2);
|
|
|
|
|
|
|
|
btnPanel1.add("1.4.left.top",checkBox3);
|
|
|
|
|
|
|
|
btnPanel1.add("1.5.left.top",checkBox4);
|
|
|
|
|
|
|
|
btnPanel1.add("1.6.left.top",checkBox5);
|
|
|
|
|
|
|
|
btnPanel1.add("1.7.left.top",checkBox6);
|
|
|
|
|
|
|
|
btnPanel1.add("1.8.left.top",checkBox7);
|
|
|
|
|
|
|
|
//第二行:零件类型
|
|
|
|
|
|
|
|
btnPanel2 = new JPanel();
|
|
|
|
|
|
|
|
JLabel itemtype = new JLabel("零件类型:");
|
|
|
|
|
|
|
|
JCheckBox checkBox11 = new JCheckBox("全部");
|
|
|
|
|
|
|
|
JCheckBox checkBox12 = new JCheckBox("外购件");
|
|
|
|
|
|
|
|
JCheckBox checkBox13 = new JCheckBox("外协件");
|
|
|
|
|
|
|
|
JCheckBox checkBox14 = new JCheckBox("虚拟件");
|
|
|
|
|
|
|
|
//btnPanel2.add(itemtype);
|
|
|
|
|
|
|
|
btnPanel2.add("1.1.left.top",itemtype);
|
|
|
|
|
|
|
|
btnPanel2.add("1.2.left.top",checkBox11);
|
|
|
|
|
|
|
|
btnPanel2.add("1.3.left.top",checkBox12);
|
|
|
|
|
|
|
|
btnPanel2.add("1.4.left.top",checkBox13);
|
|
|
|
|
|
|
|
btnPanel2.add("1.5.left.top",checkBox14);
|
|
|
|
|
|
|
|
//第三行附加条件
|
|
|
|
|
|
|
|
btnPanel3 = new JPanel();
|
|
|
|
|
|
|
|
JLabel additional = new JLabel("附加筛选:");
|
|
|
|
|
|
|
|
JCheckBox checkBox21 = new JCheckBox("外协件/外购件打包下载");
|
|
|
|
|
|
|
|
JCheckBox checkBox22 = new JCheckBox("仅下载已发布图纸");
|
|
|
|
|
|
|
|
//btnPanel3.add(additional);
|
|
|
|
|
|
|
|
btnPanel3.add("1.1.left.top",additional);
|
|
|
|
|
|
|
|
btnPanel3.add("1.2.left.top",checkBox21);
|
|
|
|
|
|
|
|
btnPanel3.add("1.3.left.top",checkBox22);
|
|
|
|
|
|
|
|
//第四行下载选项
|
|
|
|
jLabel = new JLabel("下载路径:");
|
|
|
|
jLabel = new JLabel("下载路径:");
|
|
|
|
jtf.setText(deskPath);
|
|
|
|
jtf.setText(deskPath);
|
|
|
|
jButton = new JButton("...");
|
|
|
|
jButton = new JButton("浏览");
|
|
|
|
jFileChooser = new JFileChooser();
|
|
|
|
jFileChooser = new JFileChooser();
|
|
|
|
this.jFileChooser.setCurrentDirectory(new File(deskPath));
|
|
|
|
this.jFileChooser.setCurrentDirectory(new File(deskPath));
|
|
|
|
this.jFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
|
|
|
|
this.jFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
|
|
|
@ -176,7 +299,12 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
|
|
|
|
panel.add("2.1.left.top",okBut);
|
|
|
|
panel.add("2.1.left.top",okBut);
|
|
|
|
panel.add("2.2.left.top",celBut);
|
|
|
|
panel.add("2.2.left.top",celBut);
|
|
|
|
this.add("1.1.left.top",btnPanel1);
|
|
|
|
this.add("1.1.left.top",btnPanel1);
|
|
|
|
this.add("2.1.left.top",panel);
|
|
|
|
// this.add("2.1.left.top",itemtype);
|
|
|
|
|
|
|
|
this.add("2.1.left.top",btnPanel2);
|
|
|
|
|
|
|
|
// this.add("3.1.left.top",additional);
|
|
|
|
|
|
|
|
this.add("3.1.left.top",btnPanel3);
|
|
|
|
|
|
|
|
this.add("4.1.left.top",panel);
|
|
|
|
|
|
|
|
// this.add("5.1.left.top",paneljdt);
|
|
|
|
this.setResizable(false);
|
|
|
|
this.setResizable(false);
|
|
|
|
this.setBounds(5, 5, 5, 5);
|
|
|
|
this.setBounds(5, 5, 5, 5);
|
|
|
|
this.centerToScreen();
|
|
|
|
this.centerToScreen();
|
|
|
@ -191,16 +319,106 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
|
|
|
|
okBut.addActionListener(new ActionListener() {
|
|
|
|
okBut.addActionListener(new ActionListener() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
|
|
|
|
|
datasetList.add("DWG");
|
|
|
|
|
|
|
|
datasetList.add("Tofflon_DWG");
|
|
|
|
|
|
|
|
datasetList.add("T2_DWG");
|
|
|
|
|
|
|
|
datasetList.add("AIDrawing");
|
|
|
|
|
|
|
|
datasetList.add("PDF");
|
|
|
|
|
|
|
|
datasetList.add("AIPart");
|
|
|
|
|
|
|
|
datasetList.add("AIAssembly");
|
|
|
|
|
|
|
|
datasetList.add("TAI2_TCAI115_AISTEP");
|
|
|
|
|
|
|
|
datasetList.add("TAI2_TCAI115_AISTEP");
|
|
|
|
|
|
|
|
Component[] jcbs = btnPanel2.getComponents();//将勾选的内容存入数组
|
|
|
|
|
|
|
|
Boolean btnpa2=false;
|
|
|
|
|
|
|
|
for(Component component : jcbs) {
|
|
|
|
|
|
|
|
if(component instanceof JCheckBox) {
|
|
|
|
|
|
|
|
JCheckBox checkBox=(JCheckBox)component;
|
|
|
|
|
|
|
|
if(checkBox.isSelected()) {
|
|
|
|
|
|
|
|
btnpa2=true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Component[] jcbs2 = btnPanel1.getComponents();//将勾选的内容存入数组
|
|
|
|
|
|
|
|
Boolean btnpa1=false;
|
|
|
|
|
|
|
|
for(Component component : jcbs2) {
|
|
|
|
|
|
|
|
if(component instanceof JCheckBox) {
|
|
|
|
|
|
|
|
JCheckBox checkBox=(JCheckBox)component;
|
|
|
|
|
|
|
|
if(checkBox.isSelected()) {
|
|
|
|
|
|
|
|
btnpa1=true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!btnpa1) {
|
|
|
|
|
|
|
|
MessageBox.post("请选择图纸类型","提示",2);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Boolean ljlxno=false;
|
|
|
|
|
|
|
|
for(int t=0;t<targets.length;t++) {
|
|
|
|
|
|
|
|
if(targets[t] instanceof TCComponentDataset) {
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
ljlxno=true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!btnpa2 && ljlxno) {
|
|
|
|
|
|
|
|
MessageBox.post("请选择零件类型","提示",2);
|
|
|
|
|
|
|
|
}
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
if((btnpa2||!ljlxno)&&btnpa1) {
|
|
|
|
getTypes();
|
|
|
|
getTypes();
|
|
|
|
|
|
|
|
if(fmsFilelist.size()!=0) {
|
|
|
|
System.out.print("开始下载");
|
|
|
|
System.out.print("开始下载");
|
|
|
|
String fpath = jtf.getText();
|
|
|
|
final String fpath = jtf.getText();
|
|
|
|
if(fpath != null && (!fpath.trim().equals(""))){
|
|
|
|
if(fpath != null && (!fpath.trim().equals(""))){
|
|
|
|
|
|
|
|
// ProgressBarThread wait = new ProgressBarThread("下载", "下载中。。。");
|
|
|
|
|
|
|
|
// wait.start();
|
|
|
|
|
|
|
|
new Thread(new Runnable() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void run() {
|
|
|
|
|
|
|
|
JDialog dialog = new JDialog();
|
|
|
|
|
|
|
|
bar=new JProgressBar(0,100);
|
|
|
|
|
|
|
|
Container contentPane = dialog.getContentPane();
|
|
|
|
|
|
|
|
contentPane.setLayout(new GridLayout(2, 1));
|
|
|
|
|
|
|
|
JTextField text=new JTextField("下载中");
|
|
|
|
|
|
|
|
contentPane.add("1.1.center.top", text);
|
|
|
|
|
|
|
|
contentPane.add("2.1.center.top", bar);
|
|
|
|
|
|
|
|
dialog.setSize(300, 100);
|
|
|
|
|
|
|
|
dialog.setVisible(true);
|
|
|
|
|
|
|
|
dialog.setLocationRelativeTo(dialog.getParent());
|
|
|
|
downloadfile(fpath);
|
|
|
|
downloadfile(fpath);
|
|
|
|
setVisible(false);
|
|
|
|
dialog.setVisible(false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}).start();
|
|
|
|
|
|
|
|
// wait.setBool(true);// 关闭进度条
|
|
|
|
|
|
|
|
// wait.interrupt();
|
|
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
|
MessageBox.post("文件路径不能为空!", "警告", MessageBox.INFORMATION);
|
|
|
|
MessageBox.post("文件路径不能为空!", "警告", MessageBox.INFORMATION);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
MessageBox.post("没有找到符合条件的图纸","提示",2);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(noFileList.size()!=0) {
|
|
|
|
|
|
|
|
OutputStreamWriter outputStreamWriter;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
outputStreamWriter = new OutputStreamWriter(new FileOutputStream(pathString+File.separator+"部分数据集没有命名的引用.txt"));
|
|
|
|
|
|
|
|
BufferedWriter bWriter = new BufferedWriter(outputStreamWriter);
|
|
|
|
|
|
|
|
for(String liString:noFileList) {
|
|
|
|
|
|
|
|
bWriter.write(liString);
|
|
|
|
|
|
|
|
bWriter.newLine();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
bWriter.close();
|
|
|
|
|
|
|
|
outputStreamWriter.close();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(Desktop.isDesktopSupported()){
|
|
|
|
|
|
|
|
File worksheet = new File(pathString+File.separator+"部分数据集没有命名的引用.txt");
|
|
|
|
|
|
|
|
Desktop.getDesktop().open(worksheet); // or Desktop.getDesktop().edit(worksheet);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (Exception e1) {
|
|
|
|
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
|
|
|
|
e1.printStackTrace();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
celBut.addActionListener(new ActionListener() {
|
|
|
|
celBut.addActionListener(new ActionListener() {
|
|
|
@ -215,86 +433,291 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
|
|
|
|
this.centerToScreen();
|
|
|
|
this.centerToScreen();
|
|
|
|
this.showDialog();
|
|
|
|
this.showDialog();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//获取图纸类型
|
|
|
|
public void getTypes() {
|
|
|
|
public void getTypes() {
|
|
|
|
List<String> list = new ArrayList<String>();
|
|
|
|
List<String> list = new ArrayList<String>();
|
|
|
|
Component[] jcbs = btnPanel1.getComponents();//将勾选的内容存入数组
|
|
|
|
Component[] jcbs = btnPanel1.getComponents();//将勾选的内容存入数组
|
|
|
|
for(Component component : jcbs) {
|
|
|
|
for(Component component : jcbs) {
|
|
|
|
|
|
|
|
if(component instanceof JCheckBox) {
|
|
|
|
JCheckBox jcb = (JCheckBox) component;
|
|
|
|
JCheckBox jcb = (JCheckBox) component;
|
|
|
|
if(jcb.isSelected()) {
|
|
|
|
if(jcb.isSelected()) {
|
|
|
|
list.add(jcb.getText());
|
|
|
|
list.add(jcb.getText());
|
|
|
|
if("DWG".equals(jcb.getText())) {
|
|
|
|
if("DWG".equals(jcb.getText())) {
|
|
|
|
list.add("T2_DWG");
|
|
|
|
list.add("DWG");
|
|
|
|
|
|
|
|
list.add("dwg");
|
|
|
|
}else if ("STP".equals(jcb.getText())) {
|
|
|
|
}else if ("STP".equals(jcb.getText())) {
|
|
|
|
list.add("TAI2_TCAI115_AISTEP");
|
|
|
|
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 {
|
|
|
|
try {
|
|
|
|
for (int i = 0; i < targets.length; i++) {
|
|
|
|
for (int i = 0; i < targets.length; i++) {
|
|
|
|
if(targets[i] instanceof TCComponentBOMLine){
|
|
|
|
if(targets[i] instanceof TCComponentBOMLine){
|
|
|
|
|
|
|
|
List<String> itemlist = new ArrayList<String>();
|
|
|
|
|
|
|
|
//执行获取零件类型的方法
|
|
|
|
|
|
|
|
itemlist = getitemType();
|
|
|
|
|
|
|
|
//定义bom行
|
|
|
|
TCComponentBOMLine line = (TCComponentBOMLine) targets[i];
|
|
|
|
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[] datasets = rev.getReferenceListProperty("IMAN_specification");
|
|
|
|
TCComponent[] datasets2 = rev.getReferenceListProperty("IMAN_Rendering");
|
|
|
|
TCComponent[] datasets2 = rev.getReferenceListProperty("IMAN_Rendering");
|
|
|
|
for (int j = 0; j < datasets.length; j++) {
|
|
|
|
for (int j = 0; j < datasets.length; j++) {
|
|
|
|
String type = datasets[j].getType();
|
|
|
|
//获取数据集数组
|
|
|
|
if(list.contains(type)) {
|
|
|
|
TCComponentDataset dataset01 = null;
|
|
|
|
TCComponentDataset dataset = (TCComponentDataset) datasets[j];
|
|
|
|
if(datasets[j] instanceof TCComponentDataset) {
|
|
|
|
getload(dataset);
|
|
|
|
dataset01 = (TCComponentDataset) datasets[j];
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//执行获取后缀名的方法
|
|
|
|
|
|
|
|
// gethzm(dataset01);
|
|
|
|
|
|
|
|
//执行获取零件类型的方法
|
|
|
|
|
|
|
|
String type = dataset01.getType();
|
|
|
|
|
|
|
|
//判断list包含hzm字符串的值 且 itemlist包含revtype的值
|
|
|
|
|
|
|
|
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++) {
|
|
|
|
for (int j = 0; j < datasets2.length; j++) {
|
|
|
|
String type = datasets2[j].getType();
|
|
|
|
//获取数据集数组
|
|
|
|
if(list.contains(type)) {
|
|
|
|
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];
|
|
|
|
TCComponentDataset dataset = (TCComponentDataset) datasets2[j];
|
|
|
|
getload(dataset);
|
|
|
|
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<String> itemlist = new ArrayList<String>();
|
|
|
|
|
|
|
|
//执行获取零件类型的方法
|
|
|
|
|
|
|
|
itemlist = getitemType();
|
|
|
|
TCComponentItemRevision rev = (TCComponentItemRevision) targets[i];
|
|
|
|
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[] datasets = rev.getReferenceListProperty("IMAN_specification");
|
|
|
|
TCComponent[] datasets2 = rev.getReferenceListProperty("IMAN_Rendering");
|
|
|
|
TCComponent[] datasets2 = rev.getReferenceListProperty("IMAN_Rendering");
|
|
|
|
for (int j = 0; j < datasets.length; j++) {
|
|
|
|
for (int j = 0; j < datasets.length; j++) {
|
|
|
|
String type = datasets[j].getType();
|
|
|
|
|
|
|
|
if(list.contains(type)) {
|
|
|
|
//获取数据集数组
|
|
|
|
|
|
|
|
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];
|
|
|
|
TCComponentDataset dataset = (TCComponentDataset) datasets[j];
|
|
|
|
System.out.println("下载文件");
|
|
|
|
System.out.println("下载文件");
|
|
|
|
getload(dataset);
|
|
|
|
getload(dataset,dataName,list,rev.getStringProperty("item_id"));
|
|
|
|
|
|
|
|
getload(dataset,dataName2,list,rev.getStringProperty("item_id"));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (int j = 0; j < datasets2.length; j++) {
|
|
|
|
for (int j = 0; j < datasets2.length; j++) {
|
|
|
|
String type = datasets2[j].getType();
|
|
|
|
//获取数据集数组
|
|
|
|
if(list.contains(type)) {
|
|
|
|
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];
|
|
|
|
TCComponentDataset dataset = (TCComponentDataset) datasets2[j];
|
|
|
|
getload(dataset);
|
|
|
|
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];
|
|
|
|
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){
|
|
|
|
}else if(targets[i] instanceof TCComponentItem){
|
|
|
|
|
|
|
|
List<String> itemlist = new ArrayList<String>();
|
|
|
|
|
|
|
|
//执行获取零件类型的方法
|
|
|
|
|
|
|
|
itemlist = getitemType();
|
|
|
|
TCComponentItem item = (TCComponentItem) targets[i];
|
|
|
|
TCComponentItem item = (TCComponentItem) targets[i];
|
|
|
|
|
|
|
|
// item.getReleasedItemRevisions();
|
|
|
|
TCComponentItemRevision rev = item.getLatestItemRevision();
|
|
|
|
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[] datasets = rev.getReferenceListProperty("IMAN_specification");
|
|
|
|
TCComponent[] datasets2 = rev.getReferenceListProperty("IMAN_Rendering");
|
|
|
|
TCComponent[] datasets2 = rev.getReferenceListProperty("IMAN_Rendering");
|
|
|
|
for (int j = 0; j < datasets.length; j++) {
|
|
|
|
for (int j = 0; j < datasets.length; j++) {
|
|
|
|
String type = datasets[j].getType();
|
|
|
|
//获取数据集数组
|
|
|
|
if(list.contains(type)) {
|
|
|
|
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];
|
|
|
|
TCComponentDataset dataset = (TCComponentDataset) datasets[j];
|
|
|
|
getload(dataset);
|
|
|
|
getload(dataset,dataName,list,rev.getStringProperty("item_id"));
|
|
|
|
|
|
|
|
getload(dataset,dataName2,list,rev.getStringProperty("item_id"));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (int j = 0; j < datasets2.length; j++) {
|
|
|
|
for (int j = 0; j < datasets2.length; j++) {
|
|
|
|
String type = datasets2[j].getType();
|
|
|
|
//获取数据集数组
|
|
|
|
if(list.contains(type)) {
|
|
|
|
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];
|
|
|
|
TCComponentDataset dataset = (TCComponentDataset) datasets2[j];
|
|
|
|
getload(dataset);
|
|
|
|
getload(dataset, dataName,list,rev.getStringProperty("item_id"));
|
|
|
|
|
|
|
|
getload(dataset, dataName2,list,rev.getStringProperty("item_id"));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}else {
|
|
|
|
}else {
|
|
|
@ -304,7 +727,261 @@ public class Dfl028AIFDialog extends AbstractAIFDialog {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
// TODO: handle exception
|
|
|
|
// TODO: handle exception
|
|
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//获取零件类型
|
|
|
|
|
|
|
|
public List<String> getitemType() {
|
|
|
|
|
|
|
|
List<String> itemlist = new ArrayList<String>();
|
|
|
|
|
|
|
|
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<String> list) throws TCException {
|
|
|
|
|
|
|
|
//设备获取完成了 获取子键 全部 全获取 外购 判断当前 外购子键不判断
|
|
|
|
|
|
|
|
TCComponentItem item = rev.getItem();
|
|
|
|
|
|
|
|
List<String> itemlist = new ArrayList<String>();
|
|
|
|
|
|
|
|
//执行获取零件类型的方法
|
|
|
|
|
|
|
|
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<children2.length;i++) {
|
|
|
|
|
|
|
|
TCComponentBOMLine line=(TCComponentBOMLine)children2[i].getComponent();
|
|
|
|
|
|
|
|
getOutPartInBom(line,sxTj,0,itemlist,dir,list,0,dir);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// for(AIFComponentContext context:children2) {
|
|
|
|
|
|
|
|
// TCComponentBOMLine line=(TCComponentBOMLine)context.getComponent();
|
|
|
|
|
|
|
|
// //判断发布 版本规则 判断
|
|
|
|
|
|
|
|
//// TCComponentItemRevision revision = line.getItemRevision();
|
|
|
|
|
|
|
|
//// if(itemlist.contains(revision.getType())||allCheck) {//外协外购虚拟
|
|
|
|
|
|
|
|
// getOutPartInBom(line,sxTj,0,itemlist,dir,list,0,dir); //不论什么类型父级都要遍历下面所有的 选择的类型
|
|
|
|
|
|
|
|
//// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
window.save();
|
|
|
|
|
|
|
|
window.unlock();
|
|
|
|
|
|
|
|
window.close();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// public TCComponentItemRevision findLatesStatus(TCComponentItemRevision rev) {
|
|
|
|
|
|
|
|
// TCComponentItemRevision latestRev=rev;
|
|
|
|
|
|
|
|
// try {
|
|
|
|
|
|
|
|
// TCComponentItem item = rev.getItem();
|
|
|
|
|
|
|
|
// TCComponent[] revList = item.getReferenceListProperty("revision_list");
|
|
|
|
|
|
|
|
// List<TCComponentItemRevision> listRev=new ArrayList<TCComponentItemRevision>();
|
|
|
|
|
|
|
|
// 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判断是不是第一层外协外购
|
|
|
|
|
|
|
|
public void getOutPartInBom(TCComponentBOMLine bomLine,Boolean sxtj,int i,List<String> itemList,
|
|
|
|
|
|
|
|
String dir,List<String> 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");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//判断list包含hzm字符串的值 且 itemlist包含revtype的值
|
|
|
|
|
|
|
|
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<String> tjlist = new ArrayList<String>();
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|