|
|
@ -34,7 +34,6 @@ import javax.swing.JTable;
|
|
|
|
import javax.swing.JTextField;
|
|
|
|
import javax.swing.JTextField;
|
|
|
|
import javax.swing.SwingConstants;
|
|
|
|
import javax.swing.SwingConstants;
|
|
|
|
import javax.swing.border.EmptyBorder;
|
|
|
|
import javax.swing.border.EmptyBorder;
|
|
|
|
import javax.swing.filechooser.FileFilter;
|
|
|
|
|
|
|
|
import javax.swing.table.DefaultTableCellRenderer;
|
|
|
|
import javax.swing.table.DefaultTableCellRenderer;
|
|
|
|
|
|
|
|
|
|
|
|
import com.connor.jd.plm.table.CTMap;
|
|
|
|
import com.connor.jd.plm.table.CTMap;
|
|
|
@ -46,6 +45,7 @@ import com.connor.jd.plm.table.MyCellEditor1;
|
|
|
|
import com.connor.jd.plm.table.MyCellEditor2;
|
|
|
|
import com.connor.jd.plm.table.MyCellEditor2;
|
|
|
|
import com.connor.jd.plm.table.MyComboBoxRenderer;
|
|
|
|
import com.connor.jd.plm.table.MyComboBoxRenderer;
|
|
|
|
import com.connor.jd.plm.table.TCTableUtil;
|
|
|
|
import com.connor.jd.plm.table.TCTableUtil;
|
|
|
|
|
|
|
|
import com.connor.jd.plm.utils.JDMethodUtil;
|
|
|
|
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
|
|
|
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
|
|
|
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
|
|
|
|
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
|
|
|
|
import com.teamcenter.rac.aifrcp.AIFUtility;
|
|
|
|
import com.teamcenter.rac.aifrcp.AIFUtility;
|
|
|
@ -59,6 +59,7 @@ import com.teamcenter.rac.kernel.TCException;
|
|
|
|
import com.teamcenter.rac.kernel.TCSession;
|
|
|
|
import com.teamcenter.rac.kernel.TCSession;
|
|
|
|
import com.teamcenter.rac.kernel.ics.ICSProperty;
|
|
|
|
import com.teamcenter.rac.kernel.ics.ICSProperty;
|
|
|
|
import com.teamcenter.rac.stylesheet.AbstractRendering;
|
|
|
|
import com.teamcenter.rac.stylesheet.AbstractRendering;
|
|
|
|
|
|
|
|
import com.teamcenter.rac.util.MessageBox;
|
|
|
|
|
|
|
|
|
|
|
|
public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
private AbstractAIFApplication app = AIFUtility.getCurrentApplication();
|
|
|
|
private AbstractAIFApplication app = AIFUtility.getCurrentApplication();
|
|
|
@ -315,59 +316,6 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
table3.addMouseListener(rightClick3());
|
|
|
|
table3.addMouseListener(rightClick3());
|
|
|
|
|
|
|
|
|
|
|
|
// 属性映射
|
|
|
|
|
|
|
|
prop = form.getProperties();
|
|
|
|
|
|
|
|
AIFComponentContext[] parents = rev.getItem().whereReferenced();
|
|
|
|
|
|
|
|
TCComponentItemRevision parentRev = null;
|
|
|
|
|
|
|
|
for (AIFComponentContext aif : parents) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
System.out.println(aif.getComponent().getProperty("object_string"));
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (aif.getComponent() instanceof TCComponentItemRevision) {
|
|
|
|
|
|
|
|
parentRev = (TCComponentItemRevision) aif.getComponent();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (parentRev != null) {
|
|
|
|
|
|
|
|
String partName = parentRev.getProperty("object_name");
|
|
|
|
|
|
|
|
System.out.println(partName);
|
|
|
|
|
|
|
|
if (prop.containsKey("jd2_ljm")) {
|
|
|
|
|
|
|
|
form.setProperty("jd2_ljm", partName);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
String materialCode = parentRev.getProperty("item_id");
|
|
|
|
|
|
|
|
System.out.println(materialCode);
|
|
|
|
|
|
|
|
if (prop.containsKey("jd2_wlbm")) {
|
|
|
|
|
|
|
|
form.setProperty("jd2_wlbm", materialCode);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
TCComponent[] drawings = parentRev.getReferenceListProperty("TC_Is_Represented_By");
|
|
|
|
|
|
|
|
if (drawings != null && drawings.length > 0) {
|
|
|
|
|
|
|
|
TCComponentItemRevision drawingRev = (TCComponentItemRevision) drawings[0];
|
|
|
|
|
|
|
|
String drawingId = drawingRev.getProperty("item_id");
|
|
|
|
|
|
|
|
System.out.println(drawingId);
|
|
|
|
|
|
|
|
if (prop.containsKey("jd2_th")) {
|
|
|
|
|
|
|
|
form.setProperty("jd2_th", drawingId);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (parentRev.getClassificationObjects() != null && parentRev.getClassificationObjects().length > 0) {
|
|
|
|
|
|
|
|
TCComponentICO ico = parentRev.getClassificationObjects()[0];
|
|
|
|
|
|
|
|
ICSProperty[] parentICSProps = ico.getICSProperties(true);
|
|
|
|
|
|
|
|
for (int i = 0; i < parentICSProps.length; i++) {
|
|
|
|
|
|
|
|
if (parentICSProps[i].getId() == 1050) {
|
|
|
|
|
|
|
|
if (prop.containsKey("jd2_ljywm")) {
|
|
|
|
|
|
|
|
form.setProperty("jd2_ljywm", parentICSProps[i].getValue());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (parentICSProps[i].getId() == 1058) {
|
|
|
|
|
|
|
|
if (prop.containsKey("jd2_gg")) {
|
|
|
|
|
|
|
|
form.setProperty("jd2_gg", parentICSProps[i].getValue());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 填写数据
|
|
|
|
// 填写数据
|
|
|
|
prop = form.getProperties();
|
|
|
|
prop = form.getProperties();
|
|
|
|
for (Entry<String, int[]> entry : general.entrySet()) {
|
|
|
|
for (Entry<String, int[]> entry : general.entrySet()) {
|
|
|
@ -514,6 +462,61 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
System.out.println("属性‘jd2_ypqrdtable’未找到");
|
|
|
|
System.out.println("属性‘jd2_ypqrdtable’未找到");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 属性映射
|
|
|
|
|
|
|
|
prop = form.getProperties();
|
|
|
|
|
|
|
|
AIFComponentContext[] parents = rev.getItem().whereReferenced();
|
|
|
|
|
|
|
|
TCComponentItemRevision parentRev = null;
|
|
|
|
|
|
|
|
for (AIFComponentContext aif : parents) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
System.out.println(aif.getComponent().getProperty("object_string"));
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (aif.getComponent() instanceof TCComponentItemRevision) {
|
|
|
|
|
|
|
|
parentRev = (TCComponentItemRevision) aif.getComponent();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (parentRev != null) {
|
|
|
|
|
|
|
|
String partName = parentRev.getProperty("object_name");
|
|
|
|
|
|
|
|
System.out.println(partName);
|
|
|
|
|
|
|
|
if (prop.containsKey("jd2_ljm")) {
|
|
|
|
|
|
|
|
model.setValueAt(partName, general.get("jd2_ljm")[0], general.get("jd2_ljm")[1]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
String materialCode = parentRev.getProperty("item_id");
|
|
|
|
|
|
|
|
System.out.println(materialCode);
|
|
|
|
|
|
|
|
if (prop.containsKey("jd2_wlbm")) {
|
|
|
|
|
|
|
|
model.setValueAt(materialCode, general.get("jd2_wlbm")[0], general.get("jd2_wlbm")[1]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
TCComponent[] drawings = parentRev.getReferenceListProperty("TC_Is_Represented_By");
|
|
|
|
|
|
|
|
if (drawings != null && drawings.length > 0) {
|
|
|
|
|
|
|
|
TCComponentItemRevision drawingRev = (TCComponentItemRevision) drawings[0];
|
|
|
|
|
|
|
|
String drawingId = drawingRev.getProperty("item_id");
|
|
|
|
|
|
|
|
System.out.println(drawingId);
|
|
|
|
|
|
|
|
if (prop.containsKey("jd2_th")) {
|
|
|
|
|
|
|
|
model.setValueAt(drawingId, general.get("jd2_th")[0], general.get("jd2_th")[1]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (parentRev.getClassificationObjects() != null && parentRev.getClassificationObjects().length > 0) {
|
|
|
|
|
|
|
|
TCComponentICO ico = parentRev.getClassificationObjects()[0];
|
|
|
|
|
|
|
|
ICSProperty[] parentICSProps = ico.getICSProperties(true);
|
|
|
|
|
|
|
|
for (int i = 0; i < parentICSProps.length; i++) {
|
|
|
|
|
|
|
|
if (parentICSProps[i].getId() == 1050) {
|
|
|
|
|
|
|
|
if (prop.containsKey("jd2_ljywm")) {
|
|
|
|
|
|
|
|
model.setValueAt(parentICSProps[i].getValue(), general.get("jd2_ljywm")[0],
|
|
|
|
|
|
|
|
general.get("jd2_ljywm")[1]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (parentICSProps[i].getId() == 1058) {
|
|
|
|
|
|
|
|
if (prop.containsKey("jd2_gg")) {
|
|
|
|
|
|
|
|
model.setValueAt(parentICSProps[i].getValue(), general.get("jd2_gg")[0],
|
|
|
|
|
|
|
|
general.get("jd2_gg")[1]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
JPanel inner = new JPanel(new BorderLayout());
|
|
|
|
JPanel inner = new JPanel(new BorderLayout());
|
|
|
|
inner.add(table, BorderLayout.CENTER);
|
|
|
|
inner.add(table, BorderLayout.CENTER);
|
|
|
|
inner.add(table3, BorderLayout.SOUTH);
|
|
|
|
inner.add(table3, BorderLayout.SOUTH);
|
|
|
@ -1417,33 +1420,34 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
JFileChooser fileChooser = new JFileChooser();
|
|
|
|
JFileChooser fileChooser = new JFileChooser();
|
|
|
|
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
|
|
|
|
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
|
|
|
|
fileChooser.setMultiSelectionEnabled(false);
|
|
|
|
fileChooser.setMultiSelectionEnabled(false);
|
|
|
|
fileChooser.setFileFilter(new FileFilter() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public String getDescription() {
|
|
|
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
return "(图片)*.png;*.jpg;*.jpeg;*.bmp;";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public boolean accept(File var1) {
|
|
|
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
return var1.getName().endsWith(".png") || var1.getName().endsWith(".jpg")
|
|
|
|
|
|
|
|
|| var1.getName().endsWith(".jpeg") || var1.getName().endsWith(".bmp");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
fileChooser.showOpenDialog(menu);// 参数表示定位
|
|
|
|
fileChooser.showOpenDialog(menu);// 参数表示定位
|
|
|
|
File file = fileChooser.getSelectedFile();
|
|
|
|
File file = fileChooser.getSelectedFile();
|
|
|
|
|
|
|
|
|
|
|
|
if (file != null) {
|
|
|
|
if (file != null) {
|
|
|
|
System.out.println("fileName:" + file.getName());
|
|
|
|
System.out.println("fileName:" + file.getName());
|
|
|
|
String as1[] = { file.getPath() };// 文件的物理路径
|
|
|
|
String as1[] = { file.getPath() };// 文件的物理路径
|
|
|
|
String as2[] = { "Image" };
|
|
|
|
String as2[] = new String[1];
|
|
|
|
|
|
|
|
String type = null;
|
|
|
|
|
|
|
|
String suffix = file.getName().substring(file.getName().lastIndexOf(".") + 1);
|
|
|
|
|
|
|
|
String[] datasets = JDMethodUtil.getPrefStrArray("connor_default_dataset", session);
|
|
|
|
|
|
|
|
for (String str : datasets) {
|
|
|
|
|
|
|
|
String prefSuffix = str.substring(0, str.indexOf("="));
|
|
|
|
|
|
|
|
if (suffix.equals(prefSuffix)) {
|
|
|
|
|
|
|
|
String temp = str.substring(str.indexOf("=") + 1);
|
|
|
|
|
|
|
|
String[] temps = temp.split(",");
|
|
|
|
|
|
|
|
type = temps[0];
|
|
|
|
|
|
|
|
as2[0] = temps[1];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (type == null) {
|
|
|
|
|
|
|
|
MessageBox.post("上传文件类型不支持!", "提示", MessageBox.WARNING);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
TCComponentDatasetType datasetType;
|
|
|
|
TCComponentDatasetType datasetType;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
datasetType = (TCComponentDatasetType) session.getTypeComponent("Dataset");
|
|
|
|
datasetType = (TCComponentDatasetType) session.getTypeComponent("Dataset");
|
|
|
|
TCComponentDataset dataset = datasetType.create(file.getName(), "", "Image");
|
|
|
|
TCComponentDataset dataset = datasetType.create(file.getName(), "", type);
|
|
|
|
dataset.setFiles(as1, as2);
|
|
|
|
dataset.setFiles(as1, as2);
|
|
|
|
TCComponent[] comps = form.getRelatedComponents();
|
|
|
|
|
|
|
|
rev.add("IMAN_specification", dataset);
|
|
|
|
rev.add("IMAN_specification", dataset);
|
|
|
|
String uid = dataset.getUid();
|
|
|
|
String uid = dataset.getUid();
|
|
|
|
System.out.println("uid:" + uid);
|
|
|
|
System.out.println("uid:" + uid);
|
|
|
@ -1682,52 +1686,49 @@ public class SampleConfirmationForm extends AbstractRendering {
|
|
|
|
JFileChooser fileChooser = new JFileChooser();
|
|
|
|
JFileChooser fileChooser = new JFileChooser();
|
|
|
|
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
|
|
|
|
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
|
|
|
|
fileChooser.setMultiSelectionEnabled(false);
|
|
|
|
fileChooser.setMultiSelectionEnabled(false);
|
|
|
|
fileChooser.setFileFilter(new FileFilter() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public String getDescription() {
|
|
|
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
return "(文档,表格,图片)*.doc;*.docx;*.xls;*.xlsx;*.png;*.jpg;*.jpeg;*.bmp;";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public boolean accept(File var1) {
|
|
|
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
|
|
return var1.getName().endsWith(".doc") || var1.getName().endsWith(".docx")
|
|
|
|
|
|
|
|
|| var1.getName().endsWith(".xls") || var1.getName().endsWith(".xlsx")
|
|
|
|
|
|
|
|
|| var1.getName().endsWith(".png") || var1.getName().endsWith(".jpg")
|
|
|
|
|
|
|
|
|| var1.getName().endsWith(".jpeg") || var1.getName().endsWith(".bmp");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
fileChooser.showOpenDialog(menu3);// 参数表示定位
|
|
|
|
fileChooser.showOpenDialog(menu3);// 参数表示定位
|
|
|
|
File file = fileChooser.getSelectedFile();
|
|
|
|
File file = fileChooser.getSelectedFile();
|
|
|
|
if (file != null) {
|
|
|
|
if (file != null) {
|
|
|
|
System.out.println("fileName:" + file.getName());
|
|
|
|
System.out.println("fileName:" + file.getName());
|
|
|
|
String as1[] = { file.getPath() };// 文件的物理路径
|
|
|
|
String as1[] = { file.getPath() };// 文件的物理路径
|
|
|
|
String as2[] = new String[1];
|
|
|
|
String as2[] = new String[1];
|
|
|
|
String type = "";
|
|
|
|
String type = null;
|
|
|
|
if (file.getName().endsWith(".doc")) {
|
|
|
|
String suffix = file.getName().substring(file.getName().lastIndexOf(".") + 1);
|
|
|
|
as2[0] = "word";
|
|
|
|
String[] datasets = JDMethodUtil.getPrefStrArray("connor_default_dataset", session);
|
|
|
|
type = "MSWord";
|
|
|
|
for (String str : datasets) {
|
|
|
|
} else if (file.getName().endsWith(".docx")) {
|
|
|
|
String prefSuffix = str.substring(0, str.indexOf("="));
|
|
|
|
as2[0] = "word";
|
|
|
|
if (suffix.equals(prefSuffix)) {
|
|
|
|
type = "MSWordX";
|
|
|
|
String temp = str.substring(str.indexOf("=") + 1);
|
|
|
|
} else if (file.getName().endsWith(".xls")) {
|
|
|
|
String[] temps = temp.split(",");
|
|
|
|
as2[0] = "excel";
|
|
|
|
type = temps[0];
|
|
|
|
type = "MSExcel";
|
|
|
|
as2[0] = temps[1];
|
|
|
|
} else if (file.getName().endsWith(".xlsx")) {
|
|
|
|
}
|
|
|
|
as2[0] = "excel";
|
|
|
|
}
|
|
|
|
type = "MSExcelX";
|
|
|
|
if (type == null) {
|
|
|
|
} else {
|
|
|
|
MessageBox.post("上传文件类型不支持!", "提示", MessageBox.WARNING);
|
|
|
|
as2[0] = "Image";
|
|
|
|
return;
|
|
|
|
type = "Image";
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// if (file.getName().endsWith(".doc")) {
|
|
|
|
|
|
|
|
// as2[0] = "word";
|
|
|
|
|
|
|
|
// type = "MSWord";
|
|
|
|
|
|
|
|
// } else if (file.getName().endsWith(".docx")) {
|
|
|
|
|
|
|
|
// as2[0] = "word";
|
|
|
|
|
|
|
|
// type = "MSWordX";
|
|
|
|
|
|
|
|
// } else if (file.getName().endsWith(".xls")) {
|
|
|
|
|
|
|
|
// as2[0] = "excel";
|
|
|
|
|
|
|
|
// type = "MSExcel";
|
|
|
|
|
|
|
|
// } else if (file.getName().endsWith(".xlsx")) {
|
|
|
|
|
|
|
|
// as2[0] = "excel";
|
|
|
|
|
|
|
|
// type = "MSExcelX";
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// as2[0] = "Image";
|
|
|
|
|
|
|
|
// type = "Image";
|
|
|
|
|
|
|
|
// }
|
|
|
|
TCComponentDatasetType datasetType;
|
|
|
|
TCComponentDatasetType datasetType;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
datasetType = (TCComponentDatasetType) session.getTypeComponent("Dataset");
|
|
|
|
datasetType = (TCComponentDatasetType) session.getTypeComponent("Dataset");
|
|
|
|
TCComponentDataset dataset = datasetType.create(file.getName(), "", type);
|
|
|
|
TCComponentDataset dataset = datasetType.create(file.getName(), "", type);
|
|
|
|
dataset.setFiles(as1, as2);
|
|
|
|
dataset.setFiles(as1, as2);
|
|
|
|
TCComponent[] comps = form.getRelatedComponents();
|
|
|
|
|
|
|
|
rev.add("IMAN_specification", dataset);
|
|
|
|
rev.add("IMAN_specification", dataset);
|
|
|
|
String uid = dataset.getUid();
|
|
|
|
String uid = dataset.getUid();
|
|
|
|
System.out.println("uid:" + uid);
|
|
|
|
System.out.println("uid:" + uid);
|
|
|
|