parent
fa86106be6
commit
65c5903c8f
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,2 @@
|
|||||||
|
ERROR_NOT_CHANGE=\u8BF7\u9009\u62E9\u66F4\u6539\u901A\u77E5\u5355\u5BF9\u8C61
|
||||||
|
ERROR_NO_CHANGE=\u672A\u627E\u5230\u53D8\u66F4\u524D\u540E\u5BF9\u8C61,\u65E0\u6CD5\u63D0\u53D6\u5DEE\u5F02\u9879\uFF01
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,126 @@
|
|||||||
|
package com.chint.plm.createbomdifference;
|
||||||
|
|
||||||
|
public class BOMCompareBean {
|
||||||
|
private int index;
|
||||||
|
private String changeType; // 更改类别
|
||||||
|
private String zt2_MaterialNo_Parent; // 父件物料编码
|
||||||
|
private String object_desc_Parent; // 父件物料描述
|
||||||
|
private String zt2_MaterialNo_Old; // 旧物料编码
|
||||||
|
private String object_desc_Old; // 旧物料描述
|
||||||
|
private String num_Old; // 旧物料数量
|
||||||
|
private String zt2_MaterialNo_new; // 新物料编码
|
||||||
|
private String object_desc_new; // 新物料描述
|
||||||
|
private String num_new; // 新物料数量
|
||||||
|
|
||||||
|
public int getIndex() {
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndex(int index) {
|
||||||
|
this.index = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getZt2_MaterialNo_Parent() {
|
||||||
|
return zt2_MaterialNo_Parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setZt2_MaterialNo_Parent(String zt2_MaterialNo_Parent) {
|
||||||
|
this.zt2_MaterialNo_Parent = zt2_MaterialNo_Parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getObject_desc_Parent() {
|
||||||
|
return object_desc_Parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setObject_desc_Parent(String object_desc_Parent) {
|
||||||
|
this.object_desc_Parent = object_desc_Parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getZt2_MaterialNo_Old() {
|
||||||
|
return zt2_MaterialNo_Old;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setZt2_MaterialNo_Old(String zt2_MaterialNo_Old) {
|
||||||
|
this.zt2_MaterialNo_Old = zt2_MaterialNo_Old;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getObject_desc_Old() {
|
||||||
|
return object_desc_Old;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setObject_desc_Old(String object_desc_Old) {
|
||||||
|
this.object_desc_Old = object_desc_Old;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNum_Old() {
|
||||||
|
return num_Old;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNum_Old(String num_Old) {
|
||||||
|
this.num_Old = num_Old;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getZt2_MaterialNo_new() {
|
||||||
|
return zt2_MaterialNo_new;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setZt2_MaterialNo_new(String zt2_MaterialNo_new) {
|
||||||
|
this.zt2_MaterialNo_new = zt2_MaterialNo_new;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getObject_desc_new() {
|
||||||
|
return object_desc_new;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setObject_desc_new(String object_desc_new) {
|
||||||
|
this.object_desc_new = object_desc_new;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNum_new() {
|
||||||
|
return num_new;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNum_new(String num_new) {
|
||||||
|
this.num_new = num_new;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getChangeType() {
|
||||||
|
return changeType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChangeType(String changeType) {
|
||||||
|
this.changeType = changeType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BOMCompareBean(String changeType, String zt2_MaterialNo_Parent, String object_desc_Parent,
|
||||||
|
String zt2_MaterialNo_Old, String object_desc_Old, String num_Old, String zt2_MaterialNo_new,
|
||||||
|
String object_desc_new, String num_new) {
|
||||||
|
super();
|
||||||
|
this.changeType = changeType;
|
||||||
|
this.zt2_MaterialNo_Parent = zt2_MaterialNo_Parent;
|
||||||
|
this.object_desc_Parent = object_desc_Parent;
|
||||||
|
this.zt2_MaterialNo_Old = zt2_MaterialNo_Old;
|
||||||
|
this.object_desc_Old = object_desc_Old;
|
||||||
|
this.num_Old = num_Old;
|
||||||
|
this.zt2_MaterialNo_new = zt2_MaterialNo_new;
|
||||||
|
this.object_desc_new = object_desc_new;
|
||||||
|
this.num_new = num_new;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "BOMCompareBean [index=" + index + ", changeType=" + changeType + ", zt2_MaterialNo_Parent="
|
||||||
|
+ zt2_MaterialNo_Parent + ", object_desc_Parent=" + object_desc_Parent + ", zt2_MaterialNo_Old="
|
||||||
|
+ zt2_MaterialNo_Old + ", object_desc_Old=" + object_desc_Old + ", num_Old=" + num_Old
|
||||||
|
+ ", zt2_MaterialNo_new=" + zt2_MaterialNo_new + ", object_desc_new=" + object_desc_new + ", num_new="
|
||||||
|
+ num_new + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object[] getRowData(int index) {
|
||||||
|
this.index = index;
|
||||||
|
|
||||||
|
return new Object[] { this.index, changeType, zt2_MaterialNo_Parent, object_desc_Parent, zt2_MaterialNo_Old,
|
||||||
|
object_desc_Old, num_Old, zt2_MaterialNo_new, object_desc_new, num_new, "", "", "" };
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,169 @@
|
|||||||
|
package com.chint.plm.createbomdifference;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentBOMLine;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentItem;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||||
|
|
||||||
|
public class BOMCoutBean {
|
||||||
|
private TCComponentItemRevision part_child_new; // 新物料
|
||||||
|
private TCComponentItemRevision part_child_old; // 旧物料
|
||||||
|
private TCComponentBOMLine line_new; // 新BOMLine
|
||||||
|
private TCComponentBOMLine line_old; // 旧BOMLine
|
||||||
|
private double num_new = 0; // 新BOM物料数量
|
||||||
|
private double num_old = 0; // 旧BOM物料数量
|
||||||
|
private int index_num; // 排序
|
||||||
|
|
||||||
|
private String zt2_DesignWeight_old;
|
||||||
|
private String zt2_DesignWeight_new;
|
||||||
|
private Map<TCComponentItem, TCComponentBOMLine> map_line_new = new HashMap<>();
|
||||||
|
private Map<TCComponentItem, TCComponentBOMLine> map_line_old = new HashMap<>();
|
||||||
|
|
||||||
|
private TCComponentItemRevision rev; // 对象
|
||||||
|
private TCComponentItemRevision part_parent; // 父项物料
|
||||||
|
|
||||||
|
public TCComponentItemRevision getPart_parent() {
|
||||||
|
return part_parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPart_parent(TCComponentItemRevision part_parent) {
|
||||||
|
this.part_parent = part_parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addItemLineNew(TCComponentItem item, TCComponentBOMLine line) {
|
||||||
|
map_line_new.put(item, line);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addItemLineOld(TCComponentItem item, TCComponentBOMLine line) {
|
||||||
|
map_line_old.put(item, line);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<TCComponentItem, TCComponentBOMLine> getMap_line_new() {
|
||||||
|
return map_line_new;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMap_line_new(Map<TCComponentItem, TCComponentBOMLine> map_line_new) {
|
||||||
|
this.map_line_new = map_line_new;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<TCComponentItem, TCComponentBOMLine> getMap_line_old() {
|
||||||
|
return map_line_old;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMap_line_old(Map<TCComponentItem, TCComponentBOMLine> map_line_old) {
|
||||||
|
this.map_line_old = map_line_old;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TCComponentItemRevision getRev() {
|
||||||
|
return rev;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRev(TCComponentItemRevision rev) {
|
||||||
|
this.rev = rev;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getIndex_num() {
|
||||||
|
return index_num;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndex_num(int index_num) {
|
||||||
|
if (this.index_num == 0)
|
||||||
|
this.index_num = index_num;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TCComponentItemRevision getPart_child_new() {
|
||||||
|
return part_child_new;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPart_child_new(TCComponentItemRevision part_child_new) {
|
||||||
|
this.part_child_new = part_child_new;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TCComponentItemRevision getPart_child_old() {
|
||||||
|
return part_child_old;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPart_child_old(TCComponentItemRevision part_child_old) {
|
||||||
|
this.part_child_old = part_child_old;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TCComponentBOMLine getLine_new() {
|
||||||
|
return line_new;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLine_new(TCComponentBOMLine line_new) {
|
||||||
|
this.line_new = line_new;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TCComponentBOMLine getLine_old() {
|
||||||
|
return line_old;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLine_old(TCComponentBOMLine line_old) {
|
||||||
|
this.line_old = line_old;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getNum_new() {
|
||||||
|
return num_new;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNum_new(double num_new) {
|
||||||
|
this.num_new = num_new;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getNum_old() {
|
||||||
|
return num_old;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNum_old(double num_old) {
|
||||||
|
this.num_old = num_old;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addNum_new(double num) {
|
||||||
|
this.num_new += num;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addNum_old(double num) {
|
||||||
|
this.num_old += num;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getZt2_DesignWeight_old() {
|
||||||
|
return zt2_DesignWeight_old;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setZt2_DesignWeight_old(String zt2_DesignWeight_old) {
|
||||||
|
this.zt2_DesignWeight_old = zt2_DesignWeight_old;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getZt2_DesignWeight_new() {
|
||||||
|
return zt2_DesignWeight_new;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setZt2_DesignWeight_new(String zt2_DesignWeight_new) {
|
||||||
|
this.zt2_DesignWeight_new = zt2_DesignWeight_new;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @Override public String toString() { return "BOMCoutBean [part_child_new=" +
|
||||||
|
* part_child_new + ", part_child_old=" + part_child_old + ", line_new=" +
|
||||||
|
* line_new + ", line_old=" + line_old + ", num_new=" + num_new + ", num_old=" +
|
||||||
|
* num_old + ", index_num=" + index_num + ", zt2_DesignWeight_old=" +
|
||||||
|
* zt2_DesignWeight_old + ", zt2_DesignWeight_new=" + zt2_DesignWeight_new +
|
||||||
|
* ", map_line_new=" + map_line_new + ", map_line_old=" + map_line_old +
|
||||||
|
* ", rev=" + rev + "]"; }
|
||||||
|
*/
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
BOMCoutBean bean = new BOMCoutBean();
|
||||||
|
System.out.println(bean.getIndex_num());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "BOMCoutBean [part_child_new=" + part_child_new + ", part_child_old=" + part_child_old + ", num_new="
|
||||||
|
+ num_new + ", num_old=" + num_old + ", index_num=" + index_num + ", part_parent=" + part_parent + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,137 @@
|
|||||||
|
package com.chint.plm.createbomdifference;
|
||||||
|
|
||||||
|
import java.awt.Component;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import javax.swing.AbstractCellEditor;
|
||||||
|
import javax.swing.JComboBox;
|
||||||
|
import javax.swing.JTable;
|
||||||
|
import javax.swing.JTextField;
|
||||||
|
import javax.swing.table.TableCellEditor;
|
||||||
|
|
||||||
|
import com.connor.chint.sap2.util.KUtil;
|
||||||
|
|
||||||
|
public class BOMDifCellEditor extends AbstractCellEditor implements TableCellEditor {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -6384535937264729978L;
|
||||||
|
private Map<String, Map<String, String>> class_subclass = new HashMap<>();// 大小类
|
||||||
|
private List<JComboBox<String>> jcom_subclass = new ArrayList<>(32); // 小类下拉框
|
||||||
|
private List<JTextField> jtf_subclass = new ArrayList<>(32); // 小类文本框
|
||||||
|
private int size = 0;
|
||||||
|
|
||||||
|
private int row;
|
||||||
|
// private int col;
|
||||||
|
private JTable table;
|
||||||
|
|
||||||
|
private Map<String, String> map_class;
|
||||||
|
private Map<String, String[]> map_values;
|
||||||
|
|
||||||
|
public BOMDifCellEditor(Map<String, Map<String, String>> class_subclass, Map<String, String> map_class, int size) {
|
||||||
|
this.class_subclass = class_subclass;
|
||||||
|
this.map_class = map_class;
|
||||||
|
this.size = size;
|
||||||
|
initUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initUI() {
|
||||||
|
|
||||||
|
JTextField jtf = null;
|
||||||
|
|
||||||
|
List<Entry<String, String>> list = new ArrayList<>(map_class.entrySet());
|
||||||
|
String[] keys = new String[list.size() + 1];
|
||||||
|
Collections.sort(list, new Comparator<Entry<String, String>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compare(Entry<String, String> o1, Entry<String, String> o2) {
|
||||||
|
return o1.getValue().compareTo(o2.getValue());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
keys[0] = "";
|
||||||
|
|
||||||
|
map_values = new HashMap<>(8);
|
||||||
|
List<Entry<String, String>> list2 = null;
|
||||||
|
Map<String, String> map = null;
|
||||||
|
String[] subclass = null;
|
||||||
|
for (Entry<String, Map<String, String>> entry : class_subclass.entrySet()) {
|
||||||
|
map = entry.getValue();
|
||||||
|
list2 = new ArrayList<>(map.entrySet());
|
||||||
|
Collections.sort(list2, new Comparator<Entry<String, String>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compare(Entry<String, String> o1, Entry<String, String> o2) {
|
||||||
|
return o1.getValue().compareTo(o2.getValue());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
subclass = new String[list2.size() + 1];
|
||||||
|
subclass[0] = "";
|
||||||
|
for (int i = 0, len = list2.size(); i < len; i++) {
|
||||||
|
subclass[i + 1] = list2.get(i).getKey();
|
||||||
|
}
|
||||||
|
map_values.put(entry.getKey(), subclass);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0, len = list.size(); i < len; i++) {
|
||||||
|
keys[i + 1] = list.get(i).getKey();
|
||||||
|
}
|
||||||
|
JComboBox<String> jcom = null;
|
||||||
|
for (int i = 0; i < size; i++) {
|
||||||
|
jcom = new JComboBox<String>();
|
||||||
|
jtf = new JTextField();
|
||||||
|
jcom_subclass.add(jcom);
|
||||||
|
jtf_subclass.add(jtf);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getCellEditorValue() {
|
||||||
|
String class_value = String.valueOf(table.getValueAt(row, 10));
|
||||||
|
Component comp = null;
|
||||||
|
if (!KUtil.isEmpty(class_value) && class_subclass.containsKey(class_value)) {
|
||||||
|
comp = jcom_subclass.get(row);
|
||||||
|
return ((JComboBox<?>) comp).getSelectedItem();
|
||||||
|
} else {
|
||||||
|
comp = jtf_subclass.get(row);
|
||||||
|
return ((JTextField) comp).getText();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
|
||||||
|
this.table = table;
|
||||||
|
this.row = row;
|
||||||
|
// this.col = column;
|
||||||
|
Map<String, String> map = null;
|
||||||
|
if (row > -1) {
|
||||||
|
String class_value = String.valueOf(table.getValueAt(row, 10));
|
||||||
|
String subclass_value = String.valueOf(table.getValueAt(row, 11));
|
||||||
|
JComboBox<String> jcom = jcom_subclass.get(row);
|
||||||
|
jcom.removeAllItems();
|
||||||
|
if (column == 11) {
|
||||||
|
if (!KUtil.isEmpty(class_value) && class_subclass.containsKey(class_value)) {
|
||||||
|
String[] values = map_values.get(class_value);
|
||||||
|
map = class_subclass.get(class_value);
|
||||||
|
for (int i = 0, len = values.length; i < len; i++) {
|
||||||
|
jcom.addItem(values[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (map.containsKey(subclass_value))
|
||||||
|
jcom.setSelectedItem(subclass_value);
|
||||||
|
return jcom;
|
||||||
|
}
|
||||||
|
JTextField jtf = jtf_subclass.get(row);
|
||||||
|
jtf.setText(subclass_value);
|
||||||
|
return jtf;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,279 @@
|
|||||||
|
package com.chint.plm.createbomdifference;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentBOMLine;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentItem;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||||
|
|
||||||
|
public class BOMDifferenceBean {
|
||||||
|
/**
|
||||||
|
* 旧版本
|
||||||
|
*/
|
||||||
|
public TCComponentItemRevision oldRev;
|
||||||
|
/**
|
||||||
|
* 新版本
|
||||||
|
*/
|
||||||
|
public TCComponentItemRevision newRev;
|
||||||
|
/**
|
||||||
|
* 旧物料
|
||||||
|
*/
|
||||||
|
public TCComponentItemRevision oldPartRev;
|
||||||
|
/**
|
||||||
|
* 新物料
|
||||||
|
*/
|
||||||
|
public TCComponentItemRevision newPartRev;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父项物料
|
||||||
|
*/
|
||||||
|
public TCComponentItemRevision parentPartRev;
|
||||||
|
/**
|
||||||
|
* 父项物料号
|
||||||
|
*/
|
||||||
|
public String zt2_MaterialNo_Parent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父项物料描述
|
||||||
|
*/
|
||||||
|
public String object_desc_Parent;
|
||||||
|
/**
|
||||||
|
* 父项物料名称
|
||||||
|
*/
|
||||||
|
public String object_name_Parent;
|
||||||
|
|
||||||
|
public String getObject_name_Parent() {
|
||||||
|
return object_name_Parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setObject_name_Parent(String object_name_Parent) {
|
||||||
|
this.object_name_Parent = object_name_Parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对象
|
||||||
|
*/
|
||||||
|
public TCComponentItem item;
|
||||||
|
/**
|
||||||
|
* 新的BOMLine
|
||||||
|
*/
|
||||||
|
TCComponentBOMLine oldBOMLine;
|
||||||
|
/**
|
||||||
|
* 旧的BOMLine
|
||||||
|
*/
|
||||||
|
TCComponentBOMLine newBOMLine;
|
||||||
|
/**
|
||||||
|
* 版本类型
|
||||||
|
*/
|
||||||
|
private String rev_object_type;
|
||||||
|
|
||||||
|
private TCComponentItemRevision rev;
|
||||||
|
|
||||||
|
public TCComponentItem getItem() {
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setItem(TCComponentItem item) {
|
||||||
|
this.item = item;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TCComponentBOMLine getOldBOMLine() {
|
||||||
|
return oldBOMLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOldBOMLine(TCComponentBOMLine oldBOMLine) {
|
||||||
|
this.oldBOMLine = oldBOMLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TCComponentBOMLine getNewBOMLine() {
|
||||||
|
return newBOMLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNewBOMLine(TCComponentBOMLine newBOMLine) {
|
||||||
|
this.newBOMLine = newBOMLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRev_object_type() {
|
||||||
|
return rev_object_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRev_object_type(String rev_object_type) {
|
||||||
|
this.rev_object_type = rev_object_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TCComponentItemRevision getOldRev() {
|
||||||
|
return oldRev;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOldRev(TCComponentItemRevision oldRev) {
|
||||||
|
this.oldRev = oldRev;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TCComponentItemRevision getNewRev() {
|
||||||
|
return newRev;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNewRev(TCComponentItemRevision newRev) {
|
||||||
|
this.newRev = newRev;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "BOMDifferenceBean [oldRev=" + oldRev + ", newRev=" + newRev + ", oldPartRev=" + oldPartRev
|
||||||
|
+ ", newPartRev=" + newPartRev + ", parentPartRev=" + parentPartRev + ", zt2_MaterialNo_Parent="
|
||||||
|
+ zt2_MaterialNo_Parent + ", object_desc_Parent=" + object_desc_Parent + ", item=" + item
|
||||||
|
+ ", oldBOMLine=" + oldBOMLine + ", newBOMLine=" + newBOMLine + ", rev_object_type=" + rev_object_type
|
||||||
|
+ ", level=" + level + ", Quantity=" + Quantity + ", oldQuantity=" + oldQuantity + ", newQuantity="
|
||||||
|
+ newQuantity + ", m_virtualNode=" + m_virtualNode + ", current_rev=" + current_rev + ", childs="
|
||||||
|
+ childs + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 层级
|
||||||
|
*/
|
||||||
|
private int level;
|
||||||
|
/**
|
||||||
|
* 数量
|
||||||
|
*/
|
||||||
|
private double Quantity = 0;
|
||||||
|
/**
|
||||||
|
* 旧物料数量
|
||||||
|
*/
|
||||||
|
private double oldQuantity = 0;
|
||||||
|
/**
|
||||||
|
* 新物料数量
|
||||||
|
*/
|
||||||
|
private double newQuantity = 0;
|
||||||
|
/**
|
||||||
|
* 是否虚拟项
|
||||||
|
*/
|
||||||
|
protected boolean m_virtualNode;
|
||||||
|
|
||||||
|
private TCComponentItemRevision current_rev;
|
||||||
|
|
||||||
|
private List<BOMDifferenceBean> childs = new ArrayList<>();
|
||||||
|
|
||||||
|
public int getLevel() {
|
||||||
|
return level;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLevel(int level) {
|
||||||
|
this.level = level;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getQuantity() {
|
||||||
|
return Quantity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQuantity(double quantity) {
|
||||||
|
Quantity = quantity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isM_virtualNode() {
|
||||||
|
return m_virtualNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setM_virtualNode(boolean m_virtualNode) {
|
||||||
|
this.m_virtualNode = m_virtualNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TCComponentItemRevision getCurrent_rev() {
|
||||||
|
return current_rev;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrent_rev(TCComponentItemRevision current_rev) {
|
||||||
|
this.current_rev = current_rev;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<BOMDifferenceBean> getChilds() {
|
||||||
|
return childs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChilds(List<BOMDifferenceBean> childs) {
|
||||||
|
this.childs = childs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addChilds(List<BOMDifferenceBean> list) {
|
||||||
|
BOMDifferenceBean bean;
|
||||||
|
for (int i = 0, len = list.size(); i < len; i++) {
|
||||||
|
bean = list.get(i);
|
||||||
|
if (childs.indexOf(bean) == -1) {
|
||||||
|
childs.add(bean);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public TCComponentItemRevision getOldPartRev() {
|
||||||
|
return oldPartRev;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOldPartRev(TCComponentItemRevision oldPartRev) {
|
||||||
|
this.oldPartRev = oldPartRev;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TCComponentItemRevision getNewPartRev() {
|
||||||
|
return newPartRev;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNewPartRev(TCComponentItemRevision newPartRev) {
|
||||||
|
this.newPartRev = newPartRev;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getOldQuantity() {
|
||||||
|
return oldQuantity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOldQuantity(double oldQuantity) {
|
||||||
|
this.oldQuantity = oldQuantity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getNewQuantity() {
|
||||||
|
return newQuantity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNewQuantity(double newQuantity) {
|
||||||
|
this.newQuantity = newQuantity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addOldQuantity(double num) {
|
||||||
|
this.oldQuantity += num;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addNewQuantity(double num) {
|
||||||
|
this.newQuantity += num;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TCComponentItemRevision getParentPartRev() {
|
||||||
|
return parentPartRev;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParentPartRev(TCComponentItemRevision parentPartRev) {
|
||||||
|
this.parentPartRev = parentPartRev;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getZt2_MaterialNo_Parent() {
|
||||||
|
return zt2_MaterialNo_Parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setZt2_MaterialNo_Parent(String zt2_MaterialNo_Parent) {
|
||||||
|
this.zt2_MaterialNo_Parent = zt2_MaterialNo_Parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getObject_desc_Parent() {
|
||||||
|
return object_desc_Parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setObject_desc_Parent(String object_desc_Parent) {
|
||||||
|
this.object_desc_Parent = object_desc_Parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TCComponentItemRevision getRev() {
|
||||||
|
return rev;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRev(TCComponentItemRevision rev) {
|
||||||
|
this.rev = rev;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,40 @@
|
|||||||
|
/**
|
||||||
|
* Copyright 2024 eSunny Info. Tech Ltd. All rights reserved.
|
||||||
|
*
|
||||||
|
* @Package: com.chint.plm.createbomdifference
|
||||||
|
* @author: cyh
|
||||||
|
* @date: 2024年1月12日 下午4:04:10
|
||||||
|
*/
|
||||||
|
package com.chint.plm.createbomdifference;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.kernel.TCComponent;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author cyh
|
||||||
|
* 记录变更前的图纸对象和变更后的
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ChangeDesignBean {
|
||||||
|
|
||||||
|
private TCComponentItemRevision oldDesgin;
|
||||||
|
private TCComponentItemRevision newDesgin;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "ChangeDesignBean [oldDesgin=" + oldDesgin + ", newDesgin=" + newDesgin + "]";
|
||||||
|
}
|
||||||
|
public TCComponentItemRevision getOldDesgin() {
|
||||||
|
return oldDesgin;
|
||||||
|
}
|
||||||
|
public void setOldDesgin(TCComponentItemRevision oldDesgin) {
|
||||||
|
this.oldDesgin = oldDesgin;
|
||||||
|
}
|
||||||
|
public TCComponentItemRevision getNewDesgin() {
|
||||||
|
return newDesgin;
|
||||||
|
}
|
||||||
|
public void setNewDesgin(TCComponentItemRevision newDesgin) {
|
||||||
|
this.newDesgin = newDesgin;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,512 @@
|
|||||||
|
package com.chint.plm.createbomdifference;
|
||||||
|
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
//import com.connor.chint.sap2.assignfactoryno.FactoryController;
|
||||||
|
import com.connor.chint.sap2.util.SAPUtil;
|
||||||
|
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
|
||||||
|
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.TCComponentItem;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||||
|
import com.teamcenter.rac.kernel.TCException;
|
||||||
|
import com.teamcenter.rac.kernel.TCSession;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 低压制造部
|
||||||
|
*
|
||||||
|
* @author xiaol
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class CreateBOMDifference_DYController {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param oldComponents 变更前
|
||||||
|
* @param newComponents 变更后
|
||||||
|
* @throws TCException
|
||||||
|
*/
|
||||||
|
public static void getRevMap(TCSession session, TCComponent[] oldComponents, TCComponent[] newComponents,
|
||||||
|
List<BOMCompareBean> beans, String groupID) throws TCException {
|
||||||
|
// Map<String, String> map_types = new HashMap<>();
|
||||||
|
// Map<String, Integer> map_num = new HashMap<>();
|
||||||
|
// FactoryController.getFactoryType(session, map_types, map_num, groupID);
|
||||||
|
|
||||||
|
TCComponentItem item = null;
|
||||||
|
TCComponentItemRevision rev = null;
|
||||||
|
BOMDifferenceBean bean;
|
||||||
|
/**
|
||||||
|
* 对象 -
|
||||||
|
*/
|
||||||
|
Map<TCComponentItem, BOMDifferenceBean> map_item_beans = new HashMap<>();
|
||||||
|
/**
|
||||||
|
* 出厂编号-变更前后对象
|
||||||
|
*/
|
||||||
|
Map<TCComponent, List<BOMDifferenceBean>> map_factoryNo_beans = new HashMap<>();
|
||||||
|
/**
|
||||||
|
* 产成品-出厂编号
|
||||||
|
*/
|
||||||
|
Map<TCComponent, List<TCComponent>> map_ccp_factoryNo = new HashMap<>();
|
||||||
|
TCComponent factoryNo = null;
|
||||||
|
TCComponent comps[] = null;
|
||||||
|
List<BOMDifferenceBean> list_beans;
|
||||||
|
List<TCComponent> list_comps;
|
||||||
|
for (TCComponent comp : oldComponents) {
|
||||||
|
if (comp instanceof TCComponentItemRevision) {
|
||||||
|
rev = (TCComponentItemRevision) comp;
|
||||||
|
item = rev.getItem();
|
||||||
|
bean = map_item_beans.get(item);
|
||||||
|
if (bean == null) {
|
||||||
|
bean = new BOMDifferenceBean();
|
||||||
|
bean.setOldRev(rev);
|
||||||
|
}
|
||||||
|
bean.setItem(item);
|
||||||
|
map_item_beans.put(item, bean);
|
||||||
|
if (("Part Revision").equals(rev.getType())) {
|
||||||
|
comps = rev.getRelatedComponents("ZT2_FactoryNumber");
|
||||||
|
if (comps.length > 0) {
|
||||||
|
factoryNo = comps[0];
|
||||||
|
// 非产成品对象才放入比较
|
||||||
|
list_beans = map_factoryNo_beans.get(factoryNo);
|
||||||
|
if (list_beans == null) {
|
||||||
|
list_beans = new ArrayList<>();
|
||||||
|
}
|
||||||
|
if (list_beans.indexOf(bean) == -1) {
|
||||||
|
list_beans.add(bean);
|
||||||
|
}
|
||||||
|
map_factoryNo_beans.put(factoryNo, list_beans);
|
||||||
|
// if (isCCP(rev, map_types)) {
|
||||||
|
// bean.setRev(rev);
|
||||||
|
// list_comps = map_ccp_factoryNo.get(item);
|
||||||
|
// if (list_comps == null) {
|
||||||
|
// list_comps = new ArrayList<>();
|
||||||
|
// }
|
||||||
|
// if (list_comps.indexOf(factoryNo) == -1) {
|
||||||
|
// list_comps.add(factoryNo);
|
||||||
|
// }
|
||||||
|
// map_ccp_factoryNo.put(item, list_comps);
|
||||||
|
// } else {
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (TCComponent comp : newComponents) {
|
||||||
|
if (comp instanceof TCComponentItemRevision) {
|
||||||
|
rev = (TCComponentItemRevision) comp;
|
||||||
|
item = rev.getItem();
|
||||||
|
bean = map_item_beans.get(item);
|
||||||
|
if (bean == null) {
|
||||||
|
bean = new BOMDifferenceBean();
|
||||||
|
}
|
||||||
|
bean.setItem(item);
|
||||||
|
bean.setNewRev(rev);
|
||||||
|
map_item_beans.put(item, bean);
|
||||||
|
|
||||||
|
if (("Part Revision").equals(rev.getType())) {
|
||||||
|
comps = rev.getRelatedComponents("ZT2_FactoryNumber");
|
||||||
|
if (comps.length > 0) {
|
||||||
|
|
||||||
|
factoryNo = comps[0];
|
||||||
|
// if (isCCP(rev, map_types)) {
|
||||||
|
// bean.setRev(rev);
|
||||||
|
// list_comps = map_ccp_factoryNo.get(item);
|
||||||
|
// if (list_comps == null) {
|
||||||
|
// list_comps = new ArrayList<>();
|
||||||
|
// }
|
||||||
|
// if (list_comps.indexOf(factoryNo) == -1) {
|
||||||
|
// list_comps.add(factoryNo);
|
||||||
|
// }
|
||||||
|
// map_ccp_factoryNo.put(item, list_comps);
|
||||||
|
// } else {
|
||||||
|
list_beans = map_factoryNo_beans.get(factoryNo);
|
||||||
|
if (list_beans == null) {
|
||||||
|
list_beans = new ArrayList<>();
|
||||||
|
}
|
||||||
|
if (list_beans.indexOf(bean) == -1) {
|
||||||
|
list_beans.add(bean);
|
||||||
|
}
|
||||||
|
map_factoryNo_beans.put(factoryNo, list_beans);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.out.println("出厂编号遍历-------开始");
|
||||||
|
for (Entry<TCComponent, List<BOMDifferenceBean>> entry : map_factoryNo_beans.entrySet()) {
|
||||||
|
factoryNo = entry.getKey();
|
||||||
|
System.out.println("出厂编号--------" + factoryNo);
|
||||||
|
list_beans = entry.getValue();
|
||||||
|
for (int i = 0, len = list_beans.size(); i < len; i++) {
|
||||||
|
System.out.println(i + "--" + list_beans.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.out.println("出厂编号遍历-------结束");
|
||||||
|
// 找到产成品
|
||||||
|
List<BOMDifferenceBean> list_ccps = new ArrayList<>();
|
||||||
|
if (map_ccp_factoryNo.size() > 0) {
|
||||||
|
List<TCComponentItem> childs = new ArrayList<>();
|
||||||
|
for (Entry<TCComponent, List<TCComponent>> entry : map_ccp_factoryNo.entrySet()) {
|
||||||
|
item = (TCComponentItem) entry.getKey();
|
||||||
|
list_comps = entry.getValue();
|
||||||
|
bean = map_item_beans.get(item);
|
||||||
|
// 确保产成品 变更前变更后都放进去了
|
||||||
|
if (bean.getOldRev() == null || bean.getNewRev() == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for (int i = 0, len = list_comps.size(); i < len; i++) {
|
||||||
|
factoryNo = list_comps.get(i);
|
||||||
|
// System.out.println("父项:"+item+";出厂编号:"+factoryNo);
|
||||||
|
list_beans = map_factoryNo_beans.get(factoryNo);
|
||||||
|
// System.out.println("------"+list_beans);
|
||||||
|
if (list_beans != null && list_beans.size() > 0) {
|
||||||
|
// 添加子项
|
||||||
|
bean.addChilds(list_beans);
|
||||||
|
for (int j = 0, len2 = list_beans.size(); j < len2; j++) {
|
||||||
|
childs.add(list_beans.get(j).getItem());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 产成品比较
|
||||||
|
if (bean.getChilds().size() > 0) {
|
||||||
|
childs.add(item);
|
||||||
|
list_ccps.add(bean);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = 0, len = childs.size(); i < len; i++) {
|
||||||
|
item = childs.get(i);
|
||||||
|
map_item_beans.remove(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 无产成品 一对一比较
|
||||||
|
TCComponentItemRevision oldRev = null;
|
||||||
|
TCComponentItemRevision newRev = null;
|
||||||
|
|
||||||
|
BOMDifferenceBean childBean;
|
||||||
|
List<TCComponentItem> list_items = new ArrayList<>();
|
||||||
|
String zt2_MaterialNo_Parent;
|
||||||
|
String object_desc_Parent;
|
||||||
|
|
||||||
|
String zt2_MaterialNo;
|
||||||
|
String object_desc;
|
||||||
|
|
||||||
|
BOMCompareBean compareBean;
|
||||||
|
TCComponentBOMWindowType bomWinType;
|
||||||
|
// BOMDifferenceBean parentBean;
|
||||||
|
bomWinType = (TCComponentBOMWindowType) session.getTypeComponent("BOMWindow");
|
||||||
|
TCComponentBOMWindow win = bomWinType.create(null);
|
||||||
|
win.lock();
|
||||||
|
TCComponentBOMWindow win2 = bomWinType.create(null);
|
||||||
|
win2.lock();
|
||||||
|
TCComponentItemRevision parentRev;
|
||||||
|
try {
|
||||||
|
for (int i = 0, len = list_ccps.size(); i < len; i++) {
|
||||||
|
bean = list_ccps.get(i);
|
||||||
|
item = bean.getItem();
|
||||||
|
System.out.println("产成品:" + item);
|
||||||
|
if (list_items.indexOf(item) != -1) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
list_items.add(item);
|
||||||
|
rev = bean.getRev();
|
||||||
|
zt2_MaterialNo_Parent = rev.getProperty("zt2_MaterialNo");
|
||||||
|
object_desc_Parent = rev.getProperty("object_desc");
|
||||||
|
list_beans = bean.getChilds();
|
||||||
|
for (int j = 0, len2 = list_beans.size(); j < len2; j++) {
|
||||||
|
|
||||||
|
childBean = list_beans.get(j);
|
||||||
|
System.out.println("子项:" + childBean);
|
||||||
|
if (item == childBean.getItem())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
item = childBean.getItem();
|
||||||
|
// System.out.println("子项:"+item);
|
||||||
|
if (list_items.indexOf(item) != -1) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
list_items.add(item);
|
||||||
|
oldRev = childBean.getOldRev();
|
||||||
|
newRev = childBean.getNewRev();
|
||||||
|
// 单元新增
|
||||||
|
if (oldRev == null && newRev != null) {
|
||||||
|
zt2_MaterialNo = newRev.getProperty("zt2_MaterialNo");
|
||||||
|
object_desc = newRev.getProperty("object_desc");
|
||||||
|
compareBean = new BOMCompareBean("物料新增", zt2_MaterialNo_Parent, object_desc_Parent, "", "", "",
|
||||||
|
zt2_MaterialNo, object_desc, "1");
|
||||||
|
beans.add(compareBean);
|
||||||
|
}
|
||||||
|
// 单元删除
|
||||||
|
if (oldRev != null && newRev == null) {
|
||||||
|
zt2_MaterialNo = oldRev.getProperty("zt2_MaterialNo");
|
||||||
|
object_desc = oldRev.getProperty("object_desc");
|
||||||
|
compareBean = new BOMCompareBean("物料删除", zt2_MaterialNo_Parent, object_desc_Parent,
|
||||||
|
zt2_MaterialNo, object_desc, "1", "", "", "");
|
||||||
|
beans.add(compareBean);
|
||||||
|
}
|
||||||
|
// BOM展开比较
|
||||||
|
if (oldRev != null && newRev != null) {
|
||||||
|
// 比较
|
||||||
|
win.setWindowTopLine(item, bean.getOldRev(), null, null);
|
||||||
|
win2.setWindowTopLine(item, bean.getNewRev(), null, null);
|
||||||
|
win.refresh();
|
||||||
|
win2.refresh();
|
||||||
|
childBean.setNewBOMLine(win2.getTopBOMLine());
|
||||||
|
childBean.setOldBOMLine(win.getTopBOMLine());
|
||||||
|
zt2_MaterialNo = newRev.getProperty("zt2_MaterialNo");
|
||||||
|
object_desc = newRev.getProperty("object_desc");
|
||||||
|
childBean.setZt2_MaterialNo_Parent(zt2_MaterialNo);
|
||||||
|
childBean.setObject_desc_Parent(object_desc);
|
||||||
|
childBean.setParentPartRev(newRev);
|
||||||
|
|
||||||
|
bomCompare_M030(childBean, session, 1, 1, beans, list_items);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Entry<TCComponentItem, BOMDifferenceBean> entry : map_item_beans.entrySet()) {
|
||||||
|
bean = entry.getValue();
|
||||||
|
oldRev = bean.getOldRev();
|
||||||
|
newRev = bean.getNewRev();
|
||||||
|
if (oldRev != null && newRev != null && oldRev != newRev) {
|
||||||
|
win.setWindowTopLine(item, bean.getOldRev(), null, null);
|
||||||
|
win2.setWindowTopLine(item, bean.getNewRev(), null, null);
|
||||||
|
win.refresh();
|
||||||
|
win2.refresh();
|
||||||
|
bean.setNewBOMLine(win2.getTopBOMLine());
|
||||||
|
bean.setOldBOMLine(win.getTopBOMLine());
|
||||||
|
zt2_MaterialNo = "";
|
||||||
|
object_desc = "";
|
||||||
|
parentRev = null;
|
||||||
|
parentRev = SAPUtil.getSAPPart(bean.getNewBOMLine(), session);
|
||||||
|
if (parentRev != null) {
|
||||||
|
zt2_MaterialNo = parentRev.getProperty("zt2_MaterialNo");
|
||||||
|
object_desc = parentRev.getProperty("object_desc");
|
||||||
|
}
|
||||||
|
bean.setZt2_MaterialNo_Parent(zt2_MaterialNo);
|
||||||
|
bean.setObject_desc_Parent(object_desc);
|
||||||
|
bean.setParentPartRev(newRev);
|
||||||
|
|
||||||
|
bomCompare_M030(bean, session, 1, 1, beans, list_items);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是否为产成品
|
||||||
|
*
|
||||||
|
* @param rev
|
||||||
|
* @param map_types
|
||||||
|
* @return
|
||||||
|
* @throws TCException
|
||||||
|
*/
|
||||||
|
public static boolean isCCP(TCComponentItemRevision rev, Map<String, String> map_types) throws TCException {
|
||||||
|
String object_name = rev.getProperty("object_name");
|
||||||
|
System.out.println("检查对象:" + rev + ";map_types:" + map_types);
|
||||||
|
for (Entry<String, String> entry : map_types.entrySet()) {
|
||||||
|
if (object_name.indexOf(entry.getKey()) != -1) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void bomCompare_M030(BOMDifferenceBean parentBean, TCSession session, double parent_quantity_old,
|
||||||
|
double parent_quantity_new, List<BOMCompareBean> beans, List<TCComponentItem> item_compares)
|
||||||
|
throws TCException, SQLException {
|
||||||
|
if (item_compares.indexOf(parentBean.getItem()) != -1) {
|
||||||
|
System.out.println("已添加过" + parentBean.getItem());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
System.out.println("未添加过:" + parentBean.getItem());
|
||||||
|
item_compares.add(parentBean.getItem());
|
||||||
|
TCComponentBOMLine parentLine_new = parentBean.getNewBOMLine();
|
||||||
|
TCComponentBOMLine parentLine_old = parentBean.getOldBOMLine();
|
||||||
|
System.out.println("比较:" + parentLine_old + "--" + parent_quantity_old + "||" + parentLine_new + "--"
|
||||||
|
+ parent_quantity_new);
|
||||||
|
BOMDifferenceBean bean;
|
||||||
|
Map<TCComponentItem, BOMDifferenceBean> map_child_beans = new HashMap<>();
|
||||||
|
TCComponentItem item = null;
|
||||||
|
TCComponentItemRevision rev = null;
|
||||||
|
TCComponentBOMLine line;
|
||||||
|
TCComponentItemRevision oldPartRev = null;
|
||||||
|
TCComponentItemRevision newPartRev = null;
|
||||||
|
// 物料数量
|
||||||
|
String bl_quantity;
|
||||||
|
double quantity;
|
||||||
|
String rev_object_type;
|
||||||
|
if (parentLine_new != null) {
|
||||||
|
AIFComponentContext[] childs_new = parentLine_new.getChildren();
|
||||||
|
for (int i = 0, len = childs_new.length; i < len; i++) {
|
||||||
|
line = (TCComponentBOMLine) childs_new[i].getComponent();
|
||||||
|
rev = line.getItemRevision();
|
||||||
|
item = rev.getItem();
|
||||||
|
bean = map_child_beans.get(item);
|
||||||
|
newPartRev = SAPUtil.getSAPPart(line, session);
|
||||||
|
// System.out.println("子项:" + rev + ";物料:" + newPartRev);
|
||||||
|
if (newPartRev == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
bl_quantity = line.getProperty("bl_quantity");
|
||||||
|
System.out.println(rev + "-bl_quantity:" + bl_quantity);
|
||||||
|
if (bl_quantity == null || bl_quantity.trim().length() == 0) {
|
||||||
|
bl_quantity = "1";
|
||||||
|
}
|
||||||
|
quantity = Double.parseDouble(bl_quantity) * parent_quantity_new;
|
||||||
|
if (bean == null) {
|
||||||
|
bean = new BOMDifferenceBean();
|
||||||
|
bean.setItem(item);
|
||||||
|
bean.setNewRev(rev);
|
||||||
|
bean.setNewBOMLine(line);
|
||||||
|
rev_object_type = rev.getType();
|
||||||
|
bean.setRev_object_type(rev_object_type);
|
||||||
|
bean.setNewPartRev(newPartRev);
|
||||||
|
}
|
||||||
|
bean.addNewQuantity(quantity);
|
||||||
|
map_child_beans.put(item, bean);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parentLine_old != null) {
|
||||||
|
AIFComponentContext[] childs_old = parentLine_old.getChildren();
|
||||||
|
for (int i = 0, len = childs_old.length; i < len; i++) {
|
||||||
|
line = (TCComponentBOMLine) childs_old[i].getComponent();
|
||||||
|
rev = line.getItemRevision();
|
||||||
|
item = rev.getItem();
|
||||||
|
bean = map_child_beans.get(item);
|
||||||
|
oldPartRev = SAPUtil.getSAPPart(line, session);
|
||||||
|
// System.out.println("子项:" + rev + ";物料:" + oldPartRev);
|
||||||
|
if (oldPartRev == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
bl_quantity = line.getProperty("bl_quantity");
|
||||||
|
System.out.println(rev + "-bl_quantity:" + bl_quantity);
|
||||||
|
if (bl_quantity == null || bl_quantity.trim().length() == 0) {
|
||||||
|
bl_quantity = "1";
|
||||||
|
}
|
||||||
|
quantity = Double.parseDouble(bl_quantity) * parent_quantity_old;
|
||||||
|
|
||||||
|
if (bean == null) {
|
||||||
|
bean = new BOMDifferenceBean();
|
||||||
|
bean.setItem(item);
|
||||||
|
rev_object_type = rev.getType();
|
||||||
|
bean.setRev_object_type(rev_object_type);
|
||||||
|
}
|
||||||
|
bean.setOldRev(rev);
|
||||||
|
bean.setOldBOMLine(line);
|
||||||
|
bean.setOldPartRev(oldPartRev);
|
||||||
|
bean.addOldQuantity(quantity);
|
||||||
|
map_child_beans.put(item, bean);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BOMCompareBean compareBean;
|
||||||
|
// 父项物料编码
|
||||||
|
String zt2_MaterialNo_Parent;
|
||||||
|
|
||||||
|
// 父项版本描述
|
||||||
|
String object_desc_Parent = "";
|
||||||
|
|
||||||
|
// 旧物料号
|
||||||
|
String zt2_MaterialNo_Old;
|
||||||
|
String object_desc_Old;
|
||||||
|
String num_Old;
|
||||||
|
// 新物料号
|
||||||
|
String zt2_MaterialNo_New;
|
||||||
|
String object_desc_New;
|
||||||
|
String num_New;
|
||||||
|
zt2_MaterialNo_Parent = parentBean.getZt2_MaterialNo_Parent();
|
||||||
|
object_desc_Parent = parentBean.getObject_desc_Parent();
|
||||||
|
for (Entry<TCComponentItem, BOMDifferenceBean> entry : map_child_beans.entrySet()) {
|
||||||
|
bean = entry.getValue();
|
||||||
|
newPartRev = bean.getNewPartRev();
|
||||||
|
oldPartRev = bean.getOldPartRev();
|
||||||
|
System.out.println(bean.getItem() + "BOMDifferenceBean:" + bean);
|
||||||
|
if (newPartRev == null && oldPartRev != null) {
|
||||||
|
zt2_MaterialNo_Old = oldPartRev.getProperty("zt2_MaterialNo");
|
||||||
|
object_desc_Old = oldPartRev.getProperty("object_desc");
|
||||||
|
num_Old = String.format("%.1f", bean.getOldQuantity());
|
||||||
|
bean.setParentPartRev(oldPartRev);
|
||||||
|
bean.setZt2_MaterialNo_Parent(zt2_MaterialNo_Old);
|
||||||
|
bean.setObject_desc_Parent(object_desc_Old);
|
||||||
|
rev = bean.getOldRev();
|
||||||
|
compareBean = new BOMCompareBean("物料删除", zt2_MaterialNo_Parent, object_desc_Parent, zt2_MaterialNo_Old,
|
||||||
|
object_desc_Old, num_Old, "", "", "");
|
||||||
|
beans.add(compareBean);
|
||||||
|
// 物料删除遍历
|
||||||
|
bomCompare_M030(bean, session, 1, 1, beans, item_compares);
|
||||||
|
}
|
||||||
|
if (newPartRev != null && oldPartRev == null) {
|
||||||
|
// 物料新增 若变更项不为虚拟项则记录
|
||||||
|
zt2_MaterialNo_New = newPartRev.getProperty("zt2_MaterialNo");
|
||||||
|
object_desc_New = newPartRev.getProperty("object_desc");
|
||||||
|
num_New = String.format("%.1f", bean.getNewQuantity());
|
||||||
|
bean.setParentPartRev(newPartRev);
|
||||||
|
bean.setZt2_MaterialNo_Parent(zt2_MaterialNo_New);
|
||||||
|
bean.setObject_desc_Parent(object_desc_New);
|
||||||
|
compareBean = new BOMCompareBean("物料新增", zt2_MaterialNo_Parent, object_desc_Parent, "", "", "",
|
||||||
|
zt2_MaterialNo_New, object_desc_New, num_New);
|
||||||
|
beans.add(compareBean);
|
||||||
|
// 物料新增遍历
|
||||||
|
bomCompare_M030(bean, session, 1, 1, beans, item_compares);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newPartRev != null && oldPartRev != null) {
|
||||||
|
zt2_MaterialNo_New = newPartRev.getProperty("zt2_MaterialNo");
|
||||||
|
object_desc_New = newPartRev.getProperty("object_desc");
|
||||||
|
zt2_MaterialNo_Old = oldPartRev.getProperty("zt2_MaterialNo");
|
||||||
|
object_desc_Old = oldPartRev.getProperty("object_desc");
|
||||||
|
|
||||||
|
if (newPartRev != oldPartRev) {
|
||||||
|
// 物料变更
|
||||||
|
num_New = String.format("%.1f", bean.getNewQuantity());
|
||||||
|
num_Old = String.format("%.1f", bean.getOldQuantity());
|
||||||
|
compareBean = new BOMCompareBean("物料数量变更", zt2_MaterialNo_Parent, object_desc_Parent,
|
||||||
|
zt2_MaterialNo_Old, object_desc_Old, num_Old, zt2_MaterialNo_New, object_desc_New, num_New);
|
||||||
|
beans.add(compareBean);
|
||||||
|
// 物料新增遍历
|
||||||
|
bomCompare_M030(bean, session, 1, 1, beans, item_compares);
|
||||||
|
} else {
|
||||||
|
if (bean.getOldQuantity() > bean.getNewQuantity()) {
|
||||||
|
System.out.println("物料数量变更-删除-" + bean.getItem());
|
||||||
|
num_New = String.format("%.1f", bean.getNewQuantity());
|
||||||
|
num_Old = String.format("%.1f", bean.getOldQuantity());
|
||||||
|
compareBean = new BOMCompareBean("物料数量变更", zt2_MaterialNo_Parent, object_desc_Parent,
|
||||||
|
zt2_MaterialNo_Old, object_desc_Old, num_Old, zt2_MaterialNo_New, object_desc_New,
|
||||||
|
num_New);
|
||||||
|
beans.add(compareBean);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 物料数量变更->新增
|
||||||
|
if (bean.getOldQuantity() < bean.getNewQuantity()) {
|
||||||
|
System.out.println("物料数量变更-新增" + bean.getItem());
|
||||||
|
num_New = String.format("%.1f", bean.getNewQuantity() - bean.getOldQuantity());
|
||||||
|
num_Old = String.format("%.1f", bean.getOldQuantity());
|
||||||
|
compareBean = new BOMCompareBean("物料新增", zt2_MaterialNo_Parent, object_desc_Parent,
|
||||||
|
zt2_MaterialNo_Old, object_desc_New, num_Old, zt2_MaterialNo_New, object_desc_New,
|
||||||
|
num_New);
|
||||||
|
beans.add(compareBean);
|
||||||
|
}
|
||||||
|
bomCompare_M030(bean, session, 1, 1, beans, item_compares);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,2 @@
|
|||||||
|
ERROR_NOT_CHANGE=\u8BF7\u9009\u62E9\u66F4\u6539\u901A\u77E5\u5355\u5BF9\u8C61
|
||||||
|
ERROR_NO_CHANGE=\u672A\u627E\u5230\u53D8\u66F4\u524D\u540E\u5BF9\u8C61,\u65E0\u6CD5\u63D0\u53D6\u5DEE\u5F02\u9879\uFF01
|
@ -0,0 +1,53 @@
|
|||||||
|
/**
|
||||||
|
* Copyright 2024 eSunny Info. Tech Ltd. All rights reserved.
|
||||||
|
*
|
||||||
|
* @Package: com.chint.plm.createbomdifference
|
||||||
|
* @author: cyh
|
||||||
|
* @date: 2024年1月10日 下午2:21:11
|
||||||
|
*/
|
||||||
|
package com.chint.plm.createbomdifference;
|
||||||
|
|
||||||
|
import com.teamcenter.rac.kernel.TCComponent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author cyh
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class PBomBean {
|
||||||
|
//记录 E物料 和 P物料 相同物料编码
|
||||||
|
private TCComponent eMaterial;
|
||||||
|
private String eRevision = "";
|
||||||
|
private TCComponent pMaterial;
|
||||||
|
private String pRevision = "";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "PBomBean [eMaterial=" + eMaterial + ", eRevision=" + eRevision + ", pMaterial=" + pMaterial
|
||||||
|
+ ", pRevision=" + pRevision + "]";
|
||||||
|
}
|
||||||
|
public String geteRevision() {
|
||||||
|
return eRevision;
|
||||||
|
}
|
||||||
|
public void seteRevision(String eRevision) {
|
||||||
|
this.eRevision = eRevision;
|
||||||
|
}
|
||||||
|
public String getpRevision() {
|
||||||
|
return pRevision;
|
||||||
|
}
|
||||||
|
public void setpRevision(String pRevision) {
|
||||||
|
this.pRevision = pRevision;
|
||||||
|
}
|
||||||
|
public TCComponent geteMaterial() {
|
||||||
|
return eMaterial;
|
||||||
|
}
|
||||||
|
public void seteMaterial(TCComponent eMaterial) {
|
||||||
|
this.eMaterial = eMaterial;
|
||||||
|
}
|
||||||
|
public TCComponent getpMaterial() {
|
||||||
|
return pMaterial;
|
||||||
|
}
|
||||||
|
public void setpMaterial(TCComponent pMaterial) {
|
||||||
|
this.pMaterial = pMaterial;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
package com.chint.plm.createbomdifference;
|
||||||
|
|
||||||
|
public class YCLMaterialBean {
|
||||||
|
private String materialNo; // 昜蹋晤鎢
|
||||||
|
private String materialutilization; // 第蹋瞳蚚薹
|
||||||
|
private String materialunit; // 埻第蹋等弇
|
||||||
|
private String materialmark; // 第蹋梓暮
|
||||||
|
|
||||||
|
public String getMaterialNo() {
|
||||||
|
return materialNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaterialNo(String materialNo) {
|
||||||
|
this.materialNo = materialNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMaterialutilization() {
|
||||||
|
return materialutilization;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaterialutilization(String materialutilization) {
|
||||||
|
this.materialutilization = materialutilization;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMaterialunit() {
|
||||||
|
return materialunit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaterialunit(String materialunit) {
|
||||||
|
this.materialunit = materialunit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMaterialmark() {
|
||||||
|
return materialmark;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaterialmark(String materialmark) {
|
||||||
|
this.materialmark = materialmark;
|
||||||
|
}
|
||||||
|
|
||||||
|
public YCLMaterialBean(String materialNo, String materialutilization, String materialunit, String materialmark) {
|
||||||
|
super();
|
||||||
|
this.materialNo = materialNo;
|
||||||
|
this.materialutilization = materialutilization;
|
||||||
|
this.materialunit = materialunit;
|
||||||
|
this.materialmark = materialmark;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,120 @@
|
|||||||
|
/**
|
||||||
|
* Copyright 2023 eSunny Info. Tech Ltd. All rights reserved.
|
||||||
|
*
|
||||||
|
* @Package: com.chint.plm.extractDraw
|
||||||
|
* @author: cyh
|
||||||
|
* @date: 2023年12月25日 下午4:38:03
|
||||||
|
*/
|
||||||
|
package com.chint.plm.extractdraw;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.chint.plm.createEcn.CreateEcnFrame;
|
||||||
|
import com.connor.chint.sap2.util.BomToSapUtil;
|
||||||
|
import com.connor.chint.sap2.util.MyProgressBarCompent;
|
||||||
|
import com.connor.chint.sap2.util.SAPMessageUtilFram;
|
||||||
|
import com.connor.chint.yunpi.KCommand;
|
||||||
|
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
||||||
|
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
|
||||||
|
import com.teamcenter.rac.aif.kernel.AbstractAIFSession;
|
||||||
|
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.TCComponentItem;
|
||||||
|
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
||||||
|
import com.teamcenter.rac.kernel.TCException;
|
||||||
|
import com.teamcenter.rac.kernel.TCSession;
|
||||||
|
import com.teamcenter.rac.kernel.TCUserService;
|
||||||
|
import com.teamcenter.rac.util.MessageBox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author cyh 一键提取图纸 把数据集下的图纸放到项目中的指定文件夹
|
||||||
|
*/
|
||||||
|
public class ExtractDrawComd extends KCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param app
|
||||||
|
* @param commandId
|
||||||
|
* @param actionInfo
|
||||||
|
* @function 构造方法
|
||||||
|
*/
|
||||||
|
public ExtractDrawComd(AbstractAIFApplication app, String commandId, String actionInfo) {
|
||||||
|
super(app, commandId, actionInfo);
|
||||||
|
try {
|
||||||
|
TCSession session = (TCSession) app.getSession();
|
||||||
|
InterfaceAIFComponent targetComponent = app.getTargetComponent();
|
||||||
|
if (targetComponent.getType().equals("ZT2_Design3DRevision")) {
|
||||||
|
|
||||||
|
new Thread() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
MyProgressBarCompent my = new MyProgressBarCompent("", "一键提取图纸中......");
|
||||||
|
try {
|
||||||
|
// 版本获取所在的文件夹
|
||||||
|
TCComponentItemRevision itemRev = (TCComponentItemRevision) targetComponent;
|
||||||
|
TCComponentItem item = itemRev.getItem();
|
||||||
|
AIFComponentContext[] projectFolders = item.whereReferenced();
|
||||||
|
TCComponent projectFolder = null;
|
||||||
|
for (AIFComponentContext context : projectFolders) {
|
||||||
|
if (context.getComponent().getType().equals("ZT2_ProjectFolder")) {
|
||||||
|
projectFolder = (TCComponent) context.getComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.out.println("projectFolders====>" + projectFolders.length);
|
||||||
|
System.out.println("projectFolder====>" + projectFolder);
|
||||||
|
if (projectFolder != null) {
|
||||||
|
// 根据对象获取BOM
|
||||||
|
TCComponentBOMWindowType bomWinType = (TCComponentBOMWindowType) session
|
||||||
|
.getTypeComponent("BOMWindow");
|
||||||
|
TCComponentBOMWindow win = bomWinType.create(null);
|
||||||
|
TCComponentItemRevision rev = (TCComponentItemRevision) itemRev;
|
||||||
|
win.setWindowTopLine(rev.getItem(), rev, null, null);
|
||||||
|
TCComponentBOMLine bomline = win.getTopBOMLine();
|
||||||
|
// 遍历BOM
|
||||||
|
List<TCComponentItemRevision> childLines = BomToSapUtil.getBomLineTreeNodeSOA2(bomline);
|
||||||
|
childLines.add(rev);
|
||||||
|
System.out.println("childLines====>" + childLines);
|
||||||
|
// 过滤2ZDB开头的数据 获取PDF文件 提取到projectFolder下
|
||||||
|
for (TCComponentItemRevision childLine : childLines) {
|
||||||
|
if (childLine.getProperty("item_id").startsWith("2ZD")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
TCComponent[] datasets = childLine.getRelatedComponents("IMAN_specification");
|
||||||
|
for (TCComponent dataset : datasets) {
|
||||||
|
String dsType = dataset.getProperty("object_type");
|
||||||
|
if (dsType.equals("PDF")) {
|
||||||
|
try {
|
||||||
|
projectFolder.add("contents", dataset);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 文件夹已经存在就跳过
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
win.close();
|
||||||
|
}
|
||||||
|
my.setVisible(false);
|
||||||
|
MessageBox.post("一键提取完成....", "", MessageBox.INFORMATION);
|
||||||
|
} catch (TCException e1) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
if (my != null) {
|
||||||
|
my.setVisible(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.start();
|
||||||
|
|
||||||
|
// new CreateEcnFrame();
|
||||||
|
} else {
|
||||||
|
MessageBox.post("请选中图纸版本执行功能..", "", MessageBox.ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in new issue