|
|
@ -13,7 +13,6 @@ import java.awt.event.MouseEvent;
|
|
|
|
import java.awt.event.MouseWheelEvent;
|
|
|
|
import java.awt.event.MouseWheelEvent;
|
|
|
|
import java.awt.event.MouseWheelListener;
|
|
|
|
import java.awt.event.MouseWheelListener;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
|
|
|
import java.util.Enumeration;
|
|
|
|
import java.util.Enumeration;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.HashSet;
|
|
|
|
import java.util.HashSet;
|
|
|
@ -53,6 +52,12 @@ import com.teamcenter.rac.util.ButtonLayout;
|
|
|
|
import com.teamcenter.rac.util.MessageBox;
|
|
|
|
import com.teamcenter.rac.util.MessageBox;
|
|
|
|
import com.teamcenter.rac.util.PropertyLayout;
|
|
|
|
import com.teamcenter.rac.util.PropertyLayout;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 设计bom转化为物料bom
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @author conner.mcc
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
*/
|
|
|
|
public class TransformDesignToPartDialog extends AbstractAIFDialog implements ActionListener {
|
|
|
|
public class TransformDesignToPartDialog extends AbstractAIFDialog implements ActionListener {
|
|
|
|
private AbstractAIFApplication app;
|
|
|
|
private AbstractAIFApplication app;
|
|
|
|
private TCSession session;
|
|
|
|
private TCSession session;
|
|
|
@ -69,7 +74,6 @@ public class TransformDesignToPartDialog extends AbstractAIFDialog implements Ac
|
|
|
|
private int index = 1;
|
|
|
|
private int index = 1;
|
|
|
|
private String[] types;
|
|
|
|
private String[] types;
|
|
|
|
TCComponentBOMWindow win;
|
|
|
|
TCComponentBOMWindow win;
|
|
|
|
private JButton testBtn;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public TransformDesignToPartDialog(AbstractAIFApplication app, TCComponentBOMLine topBomline, String[] types) {
|
|
|
|
public TransformDesignToPartDialog(AbstractAIFApplication app, TCComponentBOMLine topBomline, String[] types) {
|
|
|
|
// TODO Auto-generated constructor stub
|
|
|
|
// TODO Auto-generated constructor stub
|
|
|
@ -174,14 +178,10 @@ public class TransformDesignToPartDialog extends AbstractAIFDialog implements Ac
|
|
|
|
okButton.addActionListener(this);
|
|
|
|
okButton.addActionListener(this);
|
|
|
|
celButton = new JButton("Í˳ö");
|
|
|
|
celButton = new JButton("Í˳ö");
|
|
|
|
celButton.addActionListener(this);
|
|
|
|
celButton.addActionListener(this);
|
|
|
|
testBtn = new JButton("²âÊÔ");
|
|
|
|
|
|
|
|
testBtn.addActionListener(this);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
botomJPanel.add("1.1.left.top", okButton);
|
|
|
|
botomJPanel.add("1.1.left.top", okButton);
|
|
|
|
botomJPanel.add("1.2.left.top", new JLabel(" "));
|
|
|
|
botomJPanel.add("1.2.left.top", new JLabel(" "));
|
|
|
|
botomJPanel.add("1.3.left.top", celButton);
|
|
|
|
botomJPanel.add("1.3.left.top", celButton);
|
|
|
|
botomJPanel.add("1.4.left.top", new JLabel(" "));
|
|
|
|
|
|
|
|
botomJPanel.add("1.5.left.top", testBtn);
|
|
|
|
|
|
|
|
JPanel rootJPanel = new JPanel(new PropertyLayout());
|
|
|
|
JPanel rootJPanel = new JPanel(new PropertyLayout());
|
|
|
|
rootJPanel.add("1.1.left.top", leftJPanel);
|
|
|
|
rootJPanel.add("1.1.left.top", leftJPanel);
|
|
|
|
rootJPanel.add("1.2.left.top", rightroot);
|
|
|
|
rootJPanel.add("1.2.left.top", rightroot);
|
|
|
@ -275,21 +275,6 @@ public class TransformDesignToPartDialog extends AbstractAIFDialog implements Ac
|
|
|
|
} else if (e.getSource().equals(celButton)) {
|
|
|
|
} else if (e.getSource().equals(celButton)) {
|
|
|
|
|
|
|
|
|
|
|
|
dispose();
|
|
|
|
dispose();
|
|
|
|
} else if (e.getSource().equals(testBtn)) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
TCComponent[] comps = session.search("Item Name", new String[] { "Áã×é¼þÃû³Æ" },
|
|
|
|
|
|
|
|
new String[] { "dtoeTest*" });
|
|
|
|
|
|
|
|
TCComponentItem parent = (TCComponentItem) comps[0];
|
|
|
|
|
|
|
|
List<TCComponentItemRevision> childRevList = new ArrayList<TCComponentItemRevision>();
|
|
|
|
|
|
|
|
for (int i = 1; i < comps.length; i++) {
|
|
|
|
|
|
|
|
childRevList.add(((TCComponentItem) comps[i]).getLatestItemRevision());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
createBom(parent.getLatestItemRevision(), childRevList, null, null);
|
|
|
|
|
|
|
|
} catch (Exception e1) {
|
|
|
|
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
|
|
|
|
e1.printStackTrace();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -362,9 +347,7 @@ public class TransformDesignToPartDialog extends AbstractAIFDialog implements Ac
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
createBom(materialRev, childrenList, null, quantityList);
|
|
|
|
createBom(materialRev, childrenList, null, quantityList);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private TreePath findInPath(TreePath treePath, String str) {
|
|
|
|
private TreePath findInPath(TreePath treePath, String str) {
|
|
|
@ -460,9 +443,7 @@ public class TransformDesignToPartDialog extends AbstractAIFDialog implements Ac
|
|
|
|
childbox.setSelectedIndex(-1);
|
|
|
|
childbox.setSelectedIndex(-1);
|
|
|
|
childbox.setEditable(true);
|
|
|
|
childbox.setEditable(true);
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println("bomRef====>" + Arrays.toString(bomRef));
|
|
|
|
if (childbox.getItemCount() <= 2 && childbox.getItemAt(1) != null && !childbox.getItemAt(1).equals("")) {
|
|
|
|
|
|
|
|
|
|
|
|
if (childbox.getItemCount() <= 2 && !(childbox.getItemAt(1) == null || "".equals(childbox.getItemAt(1)))) {
|
|
|
|
|
|
|
|
childbox.setSelectedIndex(1);
|
|
|
|
childbox.setSelectedIndex(1);
|
|
|
|
childbox.setEditable(false);
|
|
|
|
childbox.setEditable(false);
|
|
|
|
childNode.setSelected(true);
|
|
|
|
childNode.setSelected(true);
|
|
|
@ -556,7 +537,6 @@ public class TransformDesignToPartDialog extends AbstractAIFDialog implements Ac
|
|
|
|
System.out.println("Ö´ÐÐÅжÏ" + rev.getProperty("object_name"));
|
|
|
|
System.out.println("Ö´ÐÐÅжÏ" + rev.getProperty("object_name"));
|
|
|
|
if (rev != null && isRevBomReleased(rev)) {
|
|
|
|
if (rev != null && isRevBomReleased(rev)) {
|
|
|
|
setUnable(childNode);
|
|
|
|
setUnable(childNode);
|
|
|
|
System.out.println(rev.getProperty("object_name") + "ÒÑ·¢²¼");
|
|
|
|
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
restoreSelect(childNode);
|
|
|
|
restoreSelect(childNode);
|
|
|
@ -734,16 +714,11 @@ public class TransformDesignToPartDialog extends AbstractAIFDialog implements Ac
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (int i = 0; i < childRevList.size(); i++) {
|
|
|
|
for (int i = 0; i < childRevList.size(); i++) {
|
|
|
|
TCComponentItemRevision rev = childRevList.get(i);
|
|
|
|
TCComponentItemRevision rev = childRevList.get(i);
|
|
|
|
System.out.println("object_string====>" + rev.getProperty("object_string"));
|
|
|
|
|
|
|
|
line.lock();
|
|
|
|
line.lock();
|
|
|
|
System.out.println("line object_string=====>" + line.getItemRevision().getProperty("object_string"));
|
|
|
|
TCComponentBOMLine childBomLine = line.add(rev.getItem(), rev, null, false, "");
|
|
|
|
session.getUserService().call("bs_bypass", new Object[] { true });
|
|
|
|
|
|
|
|
TCComponentBOMLine childBomLine = line.add(rev.getItem(), rev, null, false);
|
|
|
|
|
|
|
|
session.getUserService().call("bs_bypass", new Object[] { false });
|
|
|
|
|
|
|
|
line.save();
|
|
|
|
line.save();
|
|
|
|
line.unlock();
|
|
|
|
line.unlock();
|
|
|
|
|
|
|
|
if (countNoList.get(i) != null && !countNoList.get(i).equals("")) {
|
|
|
|
if (countNoList != null && countNoList.get(i) != null && !countNoList.get(i).equals("")) {
|
|
|
|
|
|
|
|
childBomLine.lock();
|
|
|
|
childBomLine.lock();
|
|
|
|
childBomLine.setProperties(setProps, new String[] { countNoList.get(i) });
|
|
|
|
childBomLine.setProperties(setProps, new String[] { countNoList.get(i) });
|
|
|
|
childBomLine.save();
|
|
|
|
childBomLine.save();
|
|
|
@ -753,20 +728,20 @@ public class TransformDesignToPartDialog extends AbstractAIFDialog implements Ac
|
|
|
|
}
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
win.save();
|
|
|
|
win.save();
|
|
|
|
|
|
|
|
win.unlock();
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
win.unlock();
|
|
|
|
|
|
|
|
win.close();
|
|
|
|
|
|
|
|
win = null;
|
|
|
|
|
|
|
|
System.out.println("windows close");
|
|
|
|
TCComponent[] comps = parentRev.getTCProperty("structure_revisions").getReferenceValueArray();
|
|
|
|
TCComponent[] comps = parentRev.getTCProperty("structure_revisions").getReferenceValueArray();
|
|
|
|
if (comps.length > 0) {
|
|
|
|
if (comps.length > 0) {
|
|
|
|
parentRev.remove("structure_revisions", comps[0]);
|
|
|
|
parentRev.remove("structure_revisions", comps[0]);
|
|
|
|
comps[0].lock();
|
|
|
|
|
|
|
|
comps[0].delete();
|
|
|
|
comps[0].delete();
|
|
|
|
;
|
|
|
|
;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
e.printStackTrace();
|
|
|
|
throw e;
|
|
|
|
throw e;
|
|
|
|
} finally {
|
|
|
|
|
|
|
|
win.unlock();
|
|
|
|
|
|
|
|
win.close();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|