|
|
|
@ -62,8 +62,6 @@ import com.teamcenter.rac.util.PropertyLayout;
|
|
|
|
|
|
|
|
|
|
import k.util.KOrgDialog;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class MpartDialog extends JFrame implements ActionListener {
|
|
|
|
|
|
|
|
|
|
private TCSession session;
|
|
|
|
@ -78,12 +76,12 @@ public class MpartDialog extends JFrame implements ActionListener {
|
|
|
|
|
private JTable t_part;
|
|
|
|
|
private JComboBox<String> gsdwComboBox = new JComboBox<String>();
|
|
|
|
|
protected DefaultTableModel tm_part;
|
|
|
|
|
public static final String[] HEADER = new String[] { "","序号", "ID", "名称", "件号", "是否自制", "是否存在M", "归属单位", "工艺小组", "责任人"};
|
|
|
|
|
public static final int[] HEADERWIDTH = new int[] { 30,40, 60, 120, 100, 60, 60, 60, 60, 100};
|
|
|
|
|
public static final String[] HEADER = new String[] { "", "序号", "ID", "名称", "件号", "是否自制", "是否存在M", "归属单位","责任人" };
|
|
|
|
|
public static final int[] HEADERWIDTH = new int[] { 30, 40, 60, 120, 100, 60, 60, 60, 100 };
|
|
|
|
|
private JTable t_part2;
|
|
|
|
|
protected DefaultTableModel tm_part2;
|
|
|
|
|
public static final String[] HEADER2 = new String[] { "序号", "对象" };
|
|
|
|
|
public static final int[] HEADERWIDTH2 = new int[] {10, 60};
|
|
|
|
|
public static final int[] HEADERWIDTH2 = new int[] { 10, 100 };
|
|
|
|
|
private ArrayList<ArrayList<Object>> valueList = new ArrayList<ArrayList<Object>>();
|
|
|
|
|
private HashMap<String, TCComponentItemRevision> objectMap = new HashMap<String, TCComponentItemRevision>();
|
|
|
|
|
private ArrayList<TCComponentItemRevision> table2RevList = new ArrayList<TCComponentItemRevision>();
|
|
|
|
@ -91,6 +89,11 @@ public class MpartDialog extends JFrame implements ActionListener {
|
|
|
|
|
TCComponentBOMWindow view;
|
|
|
|
|
TCComponentItemType type;
|
|
|
|
|
private String[] groupSplit;
|
|
|
|
|
private HashMap<String, String> fieldsMap = new HashMap<String, String>();
|
|
|
|
|
private HashMap<String, String> typesMap = new HashMap<String, String>();
|
|
|
|
|
private boolean isInitialized = false;
|
|
|
|
|
//static TCComponentGroup group;
|
|
|
|
|
//static TCComponentUser user;
|
|
|
|
|
|
|
|
|
|
public MpartDialog(TCSession session, ArrayList<TCComponentItemRevision> list) throws TCException {
|
|
|
|
|
// TODO Auto-generated constructor stub
|
|
|
|
@ -98,33 +101,47 @@ public class MpartDialog extends JFrame implements ActionListener {
|
|
|
|
|
this.list = list;
|
|
|
|
|
viewType = (TCComponentBOMWindowType) session.getTypeComponent("BOMWindow");
|
|
|
|
|
view = viewType.create(null);
|
|
|
|
|
type = (TCComponentItemType) session.getTypeComponent("LY6_ProductM");
|
|
|
|
|
initUI();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void initUI() {
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
String[] fields = session.getPreferenceService().getStringValues("LY6_EPartToMPartType");
|
|
|
|
|
for (int i = 0; i < fields.length; i++) {
|
|
|
|
|
String[] split = fields[i].split("=");
|
|
|
|
|
fieldsMap.put(split[0], split[1]);
|
|
|
|
|
|
|
|
|
|
String[] split2 = split[0].split(":");
|
|
|
|
|
typesMap.put(split2[0], split2[1]);
|
|
|
|
|
}
|
|
|
|
|
gsdwComboBox.addItemListener(new ItemListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void itemStateChanged(ItemEvent e) {
|
|
|
|
|
if (!isInitialized) {
|
|
|
|
|
// 如果还没有初始化完成,则直接返回,不执行后续代码
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (e.getStateChange() == ItemEvent.SELECTED) {
|
|
|
|
|
String selectedItem = (String) gsdwComboBox.getSelectedItem();
|
|
|
|
|
System.out.println("Selected Item: " + selectedItem);
|
|
|
|
|
// 在这里可以执行其他操作
|
|
|
|
|
int count = 0;
|
|
|
|
|
System.out.println("==========tm_part.getRowCount()=========="+tm_part.getRowCount());
|
|
|
|
|
for (int i = 0; i < tm_part.getRowCount(); i++) {
|
|
|
|
|
System.out.println("tm_part.getValueAt(i, 0).toString()========"+tm_part.getValueAt(i, 0).toString());
|
|
|
|
|
if (tm_part.getValueAt(i, 0).toString().equals("1")) {
|
|
|
|
|
tm_part.setValueAt(selectedItem, i, 7);
|
|
|
|
|
count++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (count == 0) {
|
|
|
|
|
MessageBox.post("请勾选数据!", "提示 ", MessageBox.INFORMATION);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
find.setPreferredSize(new Dimension(200, 30));
|
|
|
|
|
replace.setPreferredSize(new Dimension(200, 30));
|
|
|
|
@ -163,7 +180,6 @@ public class MpartDialog extends JFrame implements ActionListener {
|
|
|
|
|
factory = split[1];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
gsdwComboBox.addItem("");
|
|
|
|
|
if (factory != null && !factory.isEmpty()) {
|
|
|
|
@ -174,13 +190,11 @@ public class MpartDialog extends JFrame implements ActionListener {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// this.setAlwaysOnTop(true);
|
|
|
|
|
|
|
|
|
|
// 塞值
|
|
|
|
|
// 获取当前组
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < list.size(); i++) {
|
|
|
|
|
ArrayList<Object> tempList = new ArrayList<Object>();
|
|
|
|
|
tempList.add(0);
|
|
|
|
@ -201,7 +215,8 @@ public class MpartDialog extends JFrame implements ActionListener {
|
|
|
|
|
|
|
|
|
|
for (int j = 0; j < split.length; j++) {
|
|
|
|
|
|
|
|
|
|
TCComponent[] search = session.search("_SearchMFKProperties", new String[] { "ID","工厂" }, new String[] { revId,split[j] });
|
|
|
|
|
TCComponent[] search = session.search("_SearchMFKProperties", new String[] { "ID", "工厂" },
|
|
|
|
|
new String[] { revId, split[j] });
|
|
|
|
|
if (search.length > 0) {
|
|
|
|
|
|
|
|
|
|
for (int k = 0; k < search.length; k++) {
|
|
|
|
@ -235,15 +250,10 @@ public class MpartDialog extends JFrame implements ActionListener {
|
|
|
|
|
for (int j = 0; j < valueList.size(); j++) {
|
|
|
|
|
ArrayList<Object> arrayList = valueList.get(j);
|
|
|
|
|
|
|
|
|
|
tm_part.addRow(new Object[] {arrayList.get(0),arrayList.get(1),arrayList.get(2),
|
|
|
|
|
arrayList.get(3),arrayList.get(4),arrayList.get(5),arrayList.get(6),
|
|
|
|
|
arrayList.get(7),"",""});
|
|
|
|
|
tm_part.addRow(new Object[] { arrayList.get(0), arrayList.get(1), arrayList.get(2), arrayList.get(3),
|
|
|
|
|
arrayList.get(4), arrayList.get(5), arrayList.get(6), arrayList.get(7), "", "" });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
isInitialized = true;
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
return;
|
|
|
|
@ -287,7 +297,7 @@ public class MpartDialog extends JFrame implements ActionListener {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(tm_part.getValueAt(i, 9) == null || tm_part.getValueAt(i, 9).toString().isEmpty()) {
|
|
|
|
|
if (tm_part.getValueAt(i, 8) == null || tm_part.getValueAt(i, 8).toString().isEmpty()) {
|
|
|
|
|
MessageBox.post("请填写第" + (i + 1) + "行责任人!", "提示 ", MessageBox.INFORMATION);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -299,23 +309,37 @@ public class MpartDialog extends JFrame implements ActionListener {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < tm_part.getRowCount(); i++) {
|
|
|
|
|
if (tm_part.getValueAt(i, 0).toString().equals("1")) {
|
|
|
|
|
try {
|
|
|
|
|
ArrayList<Object> arrayList = valueList.get(i);
|
|
|
|
|
TCComponentItemRevision rev = (TCComponentItemRevision) arrayList.get(9);
|
|
|
|
|
TCComponentItem eItem = rev.getItem();
|
|
|
|
|
String eType = eItem.getType();
|
|
|
|
|
System.out.println("etype=============" + eType);
|
|
|
|
|
type = (TCComponentItemType) session.getTypeComponent(typesMap.get(eType));
|
|
|
|
|
TCComponentBOMLine topLine = view.setWindowTopLine(rev.getItem(), rev, null, null);
|
|
|
|
|
int childrenCount = topLine.getChildrenCount();
|
|
|
|
|
System.out.println("childrenCount========" + childrenCount);
|
|
|
|
|
TCComponent[] searchLs = session.search("_SearchMFKProperties", new String[] { "ID","工厂" }, new String[] { (String) arrayList.get(2),(String) tm_part.getValueAt(i, 7) });
|
|
|
|
|
TCComponent[] searchLs = session.search("_SearchMFKProperties", new String[] { "ID", "工厂" },
|
|
|
|
|
new String[] { (String) arrayList.get(2), (String) tm_part.getValueAt(i, 7) });
|
|
|
|
|
|
|
|
|
|
String ly6_sequenceNum = "";
|
|
|
|
|
String ly6_sequenceNum = "0";
|
|
|
|
|
// 去调用查询查看该工厂最大流水
|
|
|
|
|
if(searchLs != null && searchLs.length > 0) {
|
|
|
|
|
TCComponentItem mItem = (TCComponentItem)searchLs[0];
|
|
|
|
|
ly6_sequenceNum = mItem.getStringProperty("ly6_sequenceNum");
|
|
|
|
|
// if(searchLs != null && searchLs.length > 0) {
|
|
|
|
|
// TCComponentItem mItem = (TCComponentItem)searchLs[0];
|
|
|
|
|
// ly6_sequenceNum = mItem.getStringProperty("ly6_sequenceNum");
|
|
|
|
|
// System.out.println("ly6_sequenceNum==="+ly6_sequenceNum);
|
|
|
|
|
// System.out.println("pxuid==========="+mItem.getUid());
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
for (int j = 0; j < searchLs.length; j++) {
|
|
|
|
|
TCComponentItem mItem = (TCComponentItem) searchLs[j];
|
|
|
|
|
System.out.println(mItem.getUid() + "===========mItem.uid");
|
|
|
|
|
String num = mItem.getStringProperty("ly6_sequenceNum");
|
|
|
|
|
System.out.println("num===" + num);
|
|
|
|
|
System.out.println("ly6_sequenceNum===" + ly6_sequenceNum);
|
|
|
|
|
ly6_sequenceNum = getLargerNumber(num, ly6_sequenceNum);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (childrenCount == 0) {
|
|
|
|
@ -323,62 +347,202 @@ public class MpartDialog extends JFrame implements ActionListener {
|
|
|
|
|
String newID = (String) arrayList.get(2);
|
|
|
|
|
String newRev = type.getNewRev(null);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TCComponentItem item = type.create(newID, newRev, "LY6_ProductM", "", "", null);
|
|
|
|
|
TCComponentItem item = type.create(newID, newRev, typesMap.get(eType), "", "", null);
|
|
|
|
|
TCComponentItemRevision mRev = item.getLatestItemRevision();
|
|
|
|
|
item.setProperty("ly6_company", tm_part.getValueAt(i, 7).toString());
|
|
|
|
|
if(ly6_sequenceNum.isEmpty()) {
|
|
|
|
|
System.out.println("itemUid2============" + item.getUid());
|
|
|
|
|
if (ly6_sequenceNum.isEmpty() || ly6_sequenceNum.equals("0")) {
|
|
|
|
|
item.setProperty("ly6_sequenceNum", "01");
|
|
|
|
|
} else {
|
|
|
|
|
item.setProperty("ly6_sequenceNum", incrementNumber(ly6_sequenceNum));
|
|
|
|
|
System.out.println("itemUid3============" + item.getUid());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 删除前两个对象
|
|
|
|
|
TCComponent delItem1 = session.stringToComponent((String) arrayList.get(2));
|
|
|
|
|
|
|
|
|
|
if (delItem1 != null) {
|
|
|
|
|
System.out.println("delItem1.getUid()====" + delItem1.getUid());
|
|
|
|
|
delItem1.delete();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TCComponent delItem2 = session
|
|
|
|
|
.stringToComponent((String) arrayList.get(2) + (String) tm_part.getValueAt(i, 7));
|
|
|
|
|
|
|
|
|
|
if (delItem1 != null) {
|
|
|
|
|
System.out.println("delItem2.getUid()====" + delItem2.getUid());
|
|
|
|
|
delItem2.delete();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 给属性赋值
|
|
|
|
|
String fiedsStr = fieldsMap.get(eType + ":" + typesMap.get(eType));
|
|
|
|
|
System.out.println("fiedsStr===================" + fiedsStr);
|
|
|
|
|
if (fiedsStr != null && !fiedsStr.isEmpty()) {
|
|
|
|
|
if (fiedsStr.contains(",")) {
|
|
|
|
|
String[] split = fiedsStr.split(",");
|
|
|
|
|
System.out.println("split.length===========" + split.length);
|
|
|
|
|
for (int j = 0; j < split.length; j++) {
|
|
|
|
|
// :分割
|
|
|
|
|
String[] split2 = split[j].split(":");
|
|
|
|
|
System.out.println("split2.length=================" + split2.length);
|
|
|
|
|
if (split2.length == 2) {
|
|
|
|
|
// .分割
|
|
|
|
|
String[] split3 = split2[0].split("\\.");
|
|
|
|
|
System.out.println("split3.length=================" + split3.length);
|
|
|
|
|
if (split3.length == 2) {
|
|
|
|
|
if (split3[0].equals("item")) {
|
|
|
|
|
String[] split4 = split2[1].split("\\.");
|
|
|
|
|
if (split4.length == 2) {
|
|
|
|
|
if (split4[0].equals("item")) {
|
|
|
|
|
System.out.println("split4[1]========" + split4[1]
|
|
|
|
|
+ "split3[1]======" + split3[1]);
|
|
|
|
|
|
|
|
|
|
item.setProperty(split4[1], eItem.getProperty(split3[1]));
|
|
|
|
|
} else if (split4[0].equals("rev")) {
|
|
|
|
|
System.out.println("split4[1]========" + split4[1]
|
|
|
|
|
+ "split3[1]======" + split3[1]);
|
|
|
|
|
mRev.setProperty(split4[1], eItem.getProperty(split3[1]));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else if (split3[0].equals("rev")) {
|
|
|
|
|
String[] split4 = split2[1].split("\\.");
|
|
|
|
|
if (split4.length == 2) {
|
|
|
|
|
if (split4[0].equals("item")) {
|
|
|
|
|
System.out.println("split4[1]========" + split4[1]
|
|
|
|
|
+ "split3[1]======" + split3[1]);
|
|
|
|
|
item.setProperty(split4[1], rev.getProperty(split3[1]));
|
|
|
|
|
} else if (split4[0].equals("rev")) {
|
|
|
|
|
System.out.println("split4[1]========" + split4[1]
|
|
|
|
|
+ "split3[1]======" + split3[1]);
|
|
|
|
|
System.out.println("value==========================="+rev.getProperty(split3[1]));
|
|
|
|
|
mRev.setProperty(split4[1], rev.getProperty(split3[1]));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
// :分割
|
|
|
|
|
String[] split2 = fiedsStr.split(":");
|
|
|
|
|
if (split2.length == 2) {
|
|
|
|
|
// .分割
|
|
|
|
|
String[] split3 = split2[0].split("\\.");
|
|
|
|
|
System.out.println("split3.length=================" + split3.length);
|
|
|
|
|
if (split3.length == 2) {
|
|
|
|
|
if (split3[0].equals("item")) {
|
|
|
|
|
String[] split4 = split2[1].split("\\.");
|
|
|
|
|
if (split4.length == 2) {
|
|
|
|
|
if (split4[0].equals("item")) {
|
|
|
|
|
System.out.println("split4[1]========" + split4[1]
|
|
|
|
|
+ "split3[1]======" + split3[1]);
|
|
|
|
|
item.setProperty(split4[1], eItem.getProperty(split3[1]));
|
|
|
|
|
} else if (split4[0].equals("rev")) {
|
|
|
|
|
System.out.println("split4[1]========" + split4[1]
|
|
|
|
|
+ "split3[1]======" + split3[1]);
|
|
|
|
|
mRev.setProperty(split4[1], eItem.getProperty(split3[1]));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else if (split3[0].equals("rev")) {
|
|
|
|
|
String[] split4 = split2[1].split("\\.");
|
|
|
|
|
if (split4.length == 2) {
|
|
|
|
|
if (split4[0].equals("item")) {
|
|
|
|
|
System.out.println("split4[1]========" + split4[1]
|
|
|
|
|
+ "split3[1]======" + split3[1]);
|
|
|
|
|
item.setProperty(split4[1], rev.getProperty(split3[1]));
|
|
|
|
|
} else if (split4[0].equals("rev")) {
|
|
|
|
|
System.out.println("split4[1]========" + split4[1]
|
|
|
|
|
+ "split3[1]======" + split3[1]);
|
|
|
|
|
mRev.setProperty(split4[1], rev.getProperty(split3[1]));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//设置 ly6_homemadeStatus
|
|
|
|
|
mRev.setProperty("ly6_homemadeStatus", "自制");
|
|
|
|
|
String personId = tm_part.getValueAt(i, 8).toString();
|
|
|
|
|
System.out.println("personId========"+personId);
|
|
|
|
|
mRev.setProperty("ly6_assignUser", personId == null || personId.isEmpty() ? "" : personId);
|
|
|
|
|
// 添加流程
|
|
|
|
|
if (workflowTemplate != null || !workflowTemplate.isEmpty()) {
|
|
|
|
|
CreateProcess(session, item, workflowTemplate);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 把对象放到管理文件夹下
|
|
|
|
|
rev.add("LY6_relatedMPart", item);
|
|
|
|
|
item.getLatestItemRevision().refresh();
|
|
|
|
|
} else {
|
|
|
|
|
AIFComponentContext[] children = topLine.getChildren();
|
|
|
|
|
//直接创建对象
|
|
|
|
|
String newID = (String) arrayList.get(2);
|
|
|
|
|
String newRev = type.getNewRev(null);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TCComponentItem item = type.create(newID, newRev, "LY6_ProductM", "", "", null);
|
|
|
|
|
item.setProperty("ly6_company", tm_part.getValueAt(i, 7).toString());
|
|
|
|
|
if(ly6_sequenceNum.isEmpty()) {
|
|
|
|
|
item.setProperty("ly6_sequenceNum", "01");
|
|
|
|
|
}else {
|
|
|
|
|
item.setProperty("ly6_sequenceNum", incrementNumber(ly6_sequenceNum));
|
|
|
|
|
}
|
|
|
|
|
//把对象放到管理文件夹下
|
|
|
|
|
rev.add("LY6_relatedMPart",item);
|
|
|
|
|
item.getLatestItemRevision().refresh();
|
|
|
|
|
//搭建mBOM
|
|
|
|
|
TCComponentBOMWindowType viewType = (TCComponentBOMWindowType) session.getTypeComponent("BOMWindow");
|
|
|
|
|
TCComponentBOMWindow view = viewType.create(null);
|
|
|
|
|
TCComponentBOMLine mTopLine = view.setWindowTopLine(item, item.getLatestItemRevision(), null, null);
|
|
|
|
|
ArrayList<TCComponentItemRevision> addList = new ArrayList<TCComponentItemRevision>();// mbom的子
|
|
|
|
|
ArrayList<String> childrenList = new ArrayList<String>();// 下拉框选中的值
|
|
|
|
|
HashMap<String, TCComponentItemRevision> revMap = new HashMap<String, TCComponentItemRevision>();//object_String 和对应版本
|
|
|
|
|
for (int j = 0; j < children.length; j++) {
|
|
|
|
|
HashMap<String, TCComponentItemRevision> revMap = new HashMap<String, TCComponentItemRevision>();// object_String
|
|
|
|
|
|
|
|
|
|
StringBuilder errMsg = new StringBuilder();
|
|
|
|
|
for (int j = 0; j < children.length; j++) {
|
|
|
|
|
TCComponentBOMLine eLine = (TCComponentBOMLine) children[j].getComponent();
|
|
|
|
|
// 判断是否自制
|
|
|
|
|
TCComponentItemRevision eRev = eLine.getItemRevision();
|
|
|
|
|
String tcProperty = eRev.getTCProperty("ly6_homemadeStatus").toString();
|
|
|
|
|
System.out.println("ly6_homemadeStatus=======" + tcProperty);
|
|
|
|
|
String eId = eRev.getStringProperty("item_id");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (tcProperty.equals("自制")) {
|
|
|
|
|
// 判断e下面的m是否唯一
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//先循环一遍判断有没有 mpart
|
|
|
|
|
ArrayList<TCComponentItemRevision> list = new ArrayList<TCComponentItemRevision>();
|
|
|
|
|
|
|
|
|
|
for (int k = 0; k < groupSplit.length; k++) {
|
|
|
|
|
TCComponent[] search = session.search("_SearchMFKProperties",
|
|
|
|
|
new String[] { "ID", "工厂" }, new String[] { eId, groupSplit[k] });
|
|
|
|
|
|
|
|
|
|
for (int l = 0; l < search.length; l++) {
|
|
|
|
|
TCComponentItem tempItem = (TCComponentItem) search[l];
|
|
|
|
|
list.add(tempItem.getLatestItemRevision());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (list.size() == 0) {
|
|
|
|
|
errMsg.append(eId + "对象未创建MPart"+System.lineSeparator());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if(errMsg.length() > 0) {
|
|
|
|
|
MessageBox.post(errMsg.toString(), "提示 ", MessageBox.INFORMATION);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 和对应版本
|
|
|
|
|
for (int j = 0; j < children.length; j++) {
|
|
|
|
|
|
|
|
|
|
TCComponentBOMLine eLine = (TCComponentBOMLine) children[j].getComponent();
|
|
|
|
|
// 判断是否自制
|
|
|
|
|
TCComponentItemRevision eRev = eLine.getItemRevision();
|
|
|
|
|
String tcProperty = eRev.getTCProperty("ly6_homemadeStatus").toString();
|
|
|
|
|
System.out.println("ly6_homemadeStatus=======" + tcProperty);
|
|
|
|
|
String eId = eRev.getStringProperty("item_id");
|
|
|
|
|
if (tcProperty.equals("自制")) {
|
|
|
|
|
|
|
|
|
|
//循环 选择mpart
|
|
|
|
|
ArrayList<TCComponentItemRevision> tempMrevList = new ArrayList<TCComponentItemRevision>();
|
|
|
|
|
|
|
|
|
|
for (int k = 0; k < groupSplit.length; k++) {
|
|
|
|
|
TCComponent[] search = session.search("_SearchMFKProperties", new String[] { "ID","工厂" }, new String[] { eId,groupSplit[k] });
|
|
|
|
|
TCComponent[] search = session.search("_SearchMFKProperties",
|
|
|
|
|
new String[] { "ID", "工厂" }, new String[] { eId, groupSplit[k] });
|
|
|
|
|
|
|
|
|
|
for (int l = 0; l < search.length; l++) {
|
|
|
|
|
TCComponentItem tempItem = (TCComponentItem) search[l];
|
|
|
|
@ -386,10 +550,11 @@ public class MpartDialog extends JFrame implements ActionListener {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(tempMrevList.size() == 0) {
|
|
|
|
|
MessageBox.post(eId+"对象未创建MPart!", "提示 ", MessageBox.INFORMATION);
|
|
|
|
|
return;
|
|
|
|
|
}else if(tempMrevList.size() == 1) {
|
|
|
|
|
// if (tempMrevList.size() == 0) {
|
|
|
|
|
// MessageBox.post(eId + "对象未创建MPart!", "提示 ", MessageBox.INFORMATION);
|
|
|
|
|
// return;
|
|
|
|
|
// } else
|
|
|
|
|
if (tempMrevList.size() == 1) {
|
|
|
|
|
// 把M放bom下
|
|
|
|
|
addList.add(tempMrevList.get(0));
|
|
|
|
|
} else if (tempMrevList.size() > 1) {
|
|
|
|
@ -397,14 +562,12 @@ public class MpartDialog extends JFrame implements ActionListener {
|
|
|
|
|
|
|
|
|
|
JComboBox<String> jComboBox = new JComboBox<String>();
|
|
|
|
|
for (int k = 0; k < tempMrevList.size(); k++) {
|
|
|
|
|
String stringProperty = tempMrevList.get(k).getStringProperty("object_string");
|
|
|
|
|
String stringProperty = tempMrevList.get(k)
|
|
|
|
|
.getStringProperty("object_string");
|
|
|
|
|
revMap.put(stringProperty, tempMrevList.get(k));
|
|
|
|
|
jComboBox.addItem(stringProperty);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 创建并显示模态对话框
|
|
|
|
|
DialogFrame dialog = new DialogFrame(MpartDialog.this, jComboBox, childrenList);
|
|
|
|
|
dialog.setVisible(true);
|
|
|
|
@ -417,20 +580,158 @@ public class MpartDialog extends JFrame implements ActionListener {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
// 不为自制则直接将EPart搭建进入MBOM中
|
|
|
|
|
addList.add(eRev);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 直接创建对象
|
|
|
|
|
String newID = (String) arrayList.get(2);
|
|
|
|
|
String newRev = type.getNewRev(null);
|
|
|
|
|
|
|
|
|
|
TCComponentItem item = type.create(newID, newRev, typesMap.get(eType), "", "", null);
|
|
|
|
|
TCComponentItemRevision mRev = item.getLatestItemRevision();
|
|
|
|
|
item.setProperty("ly6_company", tm_part.getValueAt(i, 7).toString());
|
|
|
|
|
if (ly6_sequenceNum.isEmpty() || ly6_sequenceNum.equals("0")) {
|
|
|
|
|
item.setProperty("ly6_sequenceNum", "01");
|
|
|
|
|
} else {
|
|
|
|
|
item.setProperty("ly6_sequenceNum", incrementNumber(ly6_sequenceNum));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 删除前两个对象
|
|
|
|
|
TCComponent delItem1 = session.stringToComponent((String) arrayList.get(2));
|
|
|
|
|
if (delItem1 != null) {
|
|
|
|
|
System.out.println("delItem1.getUid()====" + delItem1.getUid());
|
|
|
|
|
delItem1.delete();
|
|
|
|
|
}
|
|
|
|
|
TCComponent delItem2 = session
|
|
|
|
|
.stringToComponent((String) arrayList.get(2) + (String) tm_part.getValueAt(i, 7));
|
|
|
|
|
if (delItem1 != null) {
|
|
|
|
|
System.out.println("delItem2.getUid()====" + delItem2.getUid());
|
|
|
|
|
delItem2.delete();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 给属性赋值
|
|
|
|
|
String fiedsStr = fieldsMap.get(eType + ":" + typesMap.get(eType));
|
|
|
|
|
System.out.println("fiedsStr===================" + fiedsStr);
|
|
|
|
|
if (fiedsStr != null && !fiedsStr.isEmpty()) {
|
|
|
|
|
if (fiedsStr.contains(",")) {
|
|
|
|
|
String[] split = fiedsStr.split(",");
|
|
|
|
|
System.out.println("split.length===========" + split.length);
|
|
|
|
|
for (int j = 0; j < split.length; j++) {
|
|
|
|
|
// :分割
|
|
|
|
|
String[] split2 = split[j].split(":");
|
|
|
|
|
System.out.println("split2.length=================" + split2.length);
|
|
|
|
|
if (split2.length == 2) {
|
|
|
|
|
// .分割
|
|
|
|
|
String[] split3 = split2[0].split("\\.");
|
|
|
|
|
System.out.println("split3.length=================" + split3.length);
|
|
|
|
|
if (split3.length == 2) {
|
|
|
|
|
if (split3[0].equals("item")) {
|
|
|
|
|
String[] split4 = split2[1].split("\\.");
|
|
|
|
|
if (split4.length == 2) {
|
|
|
|
|
if (split4[0].equals("item")) {
|
|
|
|
|
System.out.println("split4[1]========" + split4[1]
|
|
|
|
|
+ "split3[1]======" + split3[1]);
|
|
|
|
|
|
|
|
|
|
item.setProperty(split4[1], eItem.getProperty(split3[1]));
|
|
|
|
|
} else if (split4[0].equals("rev")) {
|
|
|
|
|
System.out.println("split4[1]========" + split4[1]
|
|
|
|
|
+ "split3[1]======" + split3[1]);
|
|
|
|
|
mRev.setProperty(split4[1], eItem.getProperty(split3[1]));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else if (split3[0].equals("rev")) {
|
|
|
|
|
String[] split4 = split2[1].split("\\.");
|
|
|
|
|
if (split4.length == 2) {
|
|
|
|
|
if (split4[0].equals("item")) {
|
|
|
|
|
System.out.println("split4[1]========" + split4[1]
|
|
|
|
|
+ "split3[1]======" + split3[1]);
|
|
|
|
|
item.setProperty(split4[1], rev.getProperty(split3[1]));
|
|
|
|
|
} else if (split4[0].equals("rev")) {
|
|
|
|
|
System.out.println("split4[1]========" + split4[1]
|
|
|
|
|
+ "split3[1]======" + split3[1]);
|
|
|
|
|
System.out.println("value==========================="+rev.getProperty(split3[1]));
|
|
|
|
|
mRev.setProperty(split4[1], rev.getProperty(split3[1]));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
//不为自制则直接将EPart搭建进入MBOM中
|
|
|
|
|
addList.add(eRev);
|
|
|
|
|
|
|
|
|
|
// :分割
|
|
|
|
|
String[] split2 = fiedsStr.split(":");
|
|
|
|
|
if (split2.length == 2) {
|
|
|
|
|
// .分割
|
|
|
|
|
String[] split3 = split2[0].split("\\.");
|
|
|
|
|
System.out.println("split3.length=================" + split3.length);
|
|
|
|
|
if (split3.length == 2) {
|
|
|
|
|
if (split3[0].equals("item")) {
|
|
|
|
|
String[] split4 = split2[1].split("\\.");
|
|
|
|
|
if (split4.length == 2) {
|
|
|
|
|
if (split4[0].equals("item")) {
|
|
|
|
|
System.out.println("split4[1]========" + split4[1]
|
|
|
|
|
+ "split3[1]======" + split3[1]);
|
|
|
|
|
item.setProperty(split4[1], eItem.getProperty(split3[1]));
|
|
|
|
|
} else if (split4[0].equals("rev")) {
|
|
|
|
|
System.out.println("split4[1]========" + split4[1]
|
|
|
|
|
+ "split3[1]======" + split3[1]);
|
|
|
|
|
mRev.setProperty(split4[1], eItem.getProperty(split3[1]));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else if (split3[0].equals("rev")) {
|
|
|
|
|
String[] split4 = split2[1].split("\\.");
|
|
|
|
|
if (split4.length == 2) {
|
|
|
|
|
if (split4[0].equals("item")) {
|
|
|
|
|
System.out.println("split4[1]========" + split4[1]
|
|
|
|
|
+ "split3[1]======" + split3[1]);
|
|
|
|
|
item.setProperty(split4[1], rev.getProperty(split3[1]));
|
|
|
|
|
} else if (split4[0].equals("rev")) {
|
|
|
|
|
System.out.println("split4[1]========" + split4[1]
|
|
|
|
|
+ "split3[1]======" + split3[1]);
|
|
|
|
|
mRev.setProperty(split4[1], rev.getProperty(split3[1]));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//设置 ly6_homemadeStatus
|
|
|
|
|
mRev.setProperty("ly6_homemadeStatus", "自制");
|
|
|
|
|
String personId = tm_part.getValueAt(i, 8).toString();
|
|
|
|
|
System.out.println("personId========"+personId);
|
|
|
|
|
mRev.setProperty("ly6_assignUser", personId == null || personId.isEmpty() ? "" : personId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 把对象放到管理文件夹下
|
|
|
|
|
rev.add("LY6_relatedMPart", item);
|
|
|
|
|
item.getLatestItemRevision().refresh();
|
|
|
|
|
// 搭建mBOM
|
|
|
|
|
TCComponentBOMWindowType viewType = (TCComponentBOMWindowType) session
|
|
|
|
|
.getTypeComponent("BOMWindow");
|
|
|
|
|
TCComponentBOMWindow view = viewType.create(null);
|
|
|
|
|
TCComponentBOMLine mTopLine = view.setWindowTopLine(item, item.getLatestItemRevision(),
|
|
|
|
|
null, null);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println("childrenList.size()=======" + childrenList.size());
|
|
|
|
|
for (int j = 0; j < childrenList.size(); j++) {
|
|
|
|
|
addList.add(revMap.get(childrenList.get(j)));
|
|
|
|
@ -461,9 +762,6 @@ public class MpartDialog extends JFrame implements ActionListener {
|
|
|
|
|
|
|
|
|
|
MessageBox.post("创建成功!", "提示 ", MessageBox.INFORMATION);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else if (this.viewlButton.equals(source)) {
|
|
|
|
|
// 打开对象到结构管理器
|
|
|
|
|
|
|
|
|
@ -488,11 +786,13 @@ public class MpartDialog extends JFrame implements ActionListener {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else if (this.xrButton.equals(source)) {
|
|
|
|
|
//KOrgDialog kOrgDialog = new KOrgDialog("");
|
|
|
|
|
TCComponentUser user = new KOrgDialog("").getUser();
|
|
|
|
|
System.out.println("Select User: " + user);
|
|
|
|
|
// TCComponentGroup group = kOrgDialog.getGroup();
|
|
|
|
|
//user = kOrgDialog.getUser();
|
|
|
|
|
//group = kOrgDialog.getGroup();
|
|
|
|
|
//System.out.println("Select User: " + user + "group===" + group);
|
|
|
|
|
String userName = "";
|
|
|
|
|
try {
|
|
|
|
|
userName = user.getUserName();
|
|
|
|
@ -504,17 +804,16 @@ public class MpartDialog extends JFrame implements ActionListener {
|
|
|
|
|
int count = 0;
|
|
|
|
|
for (int i = 0; i < tm_part.getRowCount(); i++) {
|
|
|
|
|
if (tm_part.getValueAt(i, 0).toString().equals("1")) {
|
|
|
|
|
tm_part.setValueAt(userName, i, 9);
|
|
|
|
|
tm_part.setValueAt(userName, i, 8);
|
|
|
|
|
count++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (count == 0) {
|
|
|
|
|
MessageBox.post("请勾选数据!", "提示 ", MessageBox.INFORMATION);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -546,7 +845,6 @@ public class MpartDialog extends JFrame implements ActionListener {
|
|
|
|
|
return topPanel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private JPanel getTablePanel() {
|
|
|
|
|
JPanel panel = new JPanel(new BorderLayout());
|
|
|
|
|
panel.setPreferredSize(new Dimension(1100, 600));
|
|
|
|
@ -566,8 +864,7 @@ public class MpartDialog extends JFrame implements ActionListener {
|
|
|
|
|
if (column == 5) {// 可编辑的列
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
@ -575,20 +872,15 @@ public class MpartDialog extends JFrame implements ActionListener {
|
|
|
|
|
if (column == 5) {// 可编辑的列
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SwingUtilities.invokeLater(new Runnable() {
|
|
|
|
|
public void run() {
|
|
|
|
|
// 添加鼠标监听器
|
|
|
|
@ -600,8 +892,7 @@ public class MpartDialog extends JFrame implements ActionListener {
|
|
|
|
|
int selectColumn = t_part.getTableHeader().columnAtPoint(e.getPoint());
|
|
|
|
|
int selectedRow = t_part.rowAtPoint(e.getPoint());
|
|
|
|
|
|
|
|
|
|
if(selectColumn != 0)
|
|
|
|
|
{
|
|
|
|
|
if (selectColumn != 0) {
|
|
|
|
|
t_part2.removeAll();
|
|
|
|
|
tm_part2.setRowCount(0);
|
|
|
|
|
table2RevList.clear();
|
|
|
|
@ -618,9 +909,10 @@ public class MpartDialog extends JFrame implements ActionListener {
|
|
|
|
|
for (int i = 0; i < tempList.size(); i++) {
|
|
|
|
|
TCComponentItemRevision tcComponentItemRevision = tempList.get(i);
|
|
|
|
|
try {
|
|
|
|
|
String id = tcComponentItemRevision.getStringProperty("item_id");
|
|
|
|
|
System.out.println("item_id======"+id);
|
|
|
|
|
String objectName = tcComponentItemRevision.getStringProperty("object_string");
|
|
|
|
|
// String id = tcComponentItemRevision.getStringProperty("item_id");
|
|
|
|
|
// System.out.println("item_id======" + id);
|
|
|
|
|
String objectName = tcComponentItemRevision
|
|
|
|
|
.getStringProperty("object_string");
|
|
|
|
|
tm_part2.addRow(new Object[] { i + 1, objectName });
|
|
|
|
|
} catch (TCException e1) {
|
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
@ -646,10 +938,6 @@ public class MpartDialog extends JFrame implements ActionListener {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// t_part.addMouseListener(new MouseListener() {
|
|
|
|
|
//
|
|
|
|
|
// @Override
|
|
|
|
@ -765,14 +1053,6 @@ public class MpartDialog extends JFrame implements ActionListener {
|
|
|
|
|
// jComboBox3.addItem(split[0]);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// // 添加鼠标监听器
|
|
|
|
|
// t_part.addMouseListener(new MouseAdapter() {
|
|
|
|
@ -794,28 +1074,15 @@ public class MpartDialog extends JFrame implements ActionListener {
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// this.t_part.getTableHeader().setBackground(Color.blue);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JScrollPane scroll = new JScrollPane(t_part);
|
|
|
|
|
panel.add(BorderLayout.CENTER, scroll);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
panel.setBorder(BorderFactory.createLoweredBevelBorder());
|
|
|
|
|
return panel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private JPanel getTablePanel2() {
|
|
|
|
|
JPanel panel = new JPanel(new BorderLayout());
|
|
|
|
|
panel.setPreferredSize(new Dimension(200, 600));
|
|
|
|
@ -825,34 +1092,30 @@ public class MpartDialog extends JFrame implements ActionListener {
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean isCellEditable(int row, int column) {
|
|
|
|
|
if (column == 0) {// 可编辑的列
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
tm_part2.setDataVector(null, HEADER2);
|
|
|
|
|
t_part2.getTableHeader().setReorderingAllowed(false); // 设置列不可移动,否则会发生类型转换错误(第三列)
|
|
|
|
|
this.t_part2.setRowHeight(23);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TableColumnModel colModel = this.t_part2.getColumnModel();
|
|
|
|
|
int colCnt = HEADERWIDTH2.length;
|
|
|
|
|
for (int i = 0; i < colCnt; i++) {
|
|
|
|
|
colModel.getColumn(i).setPreferredWidth(HEADERWIDTH2[i]);
|
|
|
|
|
}
|
|
|
|
|
//t_part2.getTableHeader().setDefaultRenderer(new CheckHeaderCellRenderer(t_part2));
|
|
|
|
|
//t_part2.getColumnModel().getColumn(0).setCellRenderer(new TableCellCheckboxRenderer(t_part2));
|
|
|
|
|
// t_part2.getTableHeader().setDefaultRenderer(new
|
|
|
|
|
// CheckHeaderCellRenderer(t_part2));
|
|
|
|
|
// t_part2.getColumnModel().getColumn(0).setCellRenderer(new
|
|
|
|
|
// TableCellCheckboxRenderer(t_part2));
|
|
|
|
|
// t_part2.addMouseListener(new MouseListener() {
|
|
|
|
|
//
|
|
|
|
|
// @Override
|
|
|
|
@ -921,20 +1184,11 @@ public class MpartDialog extends JFrame implements ActionListener {
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// this.t_part2.getTableHeader().setBackground(Color.blue);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JScrollPane scroll = new JScrollPane(t_part2);
|
|
|
|
|
panel.add(BorderLayout.CENTER, scroll);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
panel.setBorder(BorderFactory.createLoweredBevelBorder());
|
|
|
|
|
return panel;
|
|
|
|
|
}
|
|
|
|
@ -943,14 +1197,13 @@ public class MpartDialog extends JFrame implements ActionListener {
|
|
|
|
|
TCComponentGroup group = session.getCurrentGroup();
|
|
|
|
|
String name = group.getTCProperty("full_name").getStringValue();
|
|
|
|
|
if (name.contains(".")) {
|
|
|
|
|
String[] split = name.split(".");
|
|
|
|
|
name = split[split.length];
|
|
|
|
|
String[] split = name.split("\\.");
|
|
|
|
|
name = split[split.length - 1];
|
|
|
|
|
System.out.println("name==============" + name);
|
|
|
|
|
}
|
|
|
|
|
return name;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 对输入的字符串表示的10以下的数字加1,并返回加1后的字符串。
|
|
|
|
|
*
|
|
|
|
@ -978,15 +1231,36 @@ public class MpartDialog extends JFrame implements ActionListener {
|
|
|
|
|
public static void CreateProcess(TCSession session, TCComponent target, String processName) throws TCException {
|
|
|
|
|
try {
|
|
|
|
|
TCComponentProcessType processType = (TCComponentProcessType) session.getTypeComponent("Job");
|
|
|
|
|
TCComponentTaskTemplateType taskTemplateType = (TCComponentTaskTemplateType)session.getTypeComponent("EPMTaskTemplate");
|
|
|
|
|
TCComponentTaskTemplateType taskTemplateType = (TCComponentTaskTemplateType) session
|
|
|
|
|
.getTypeComponent("EPMTaskTemplate");
|
|
|
|
|
TCComponentTaskTemplate taskTemplate = taskTemplateType.find(processName, 0);
|
|
|
|
|
if (taskTemplate != null) {
|
|
|
|
|
String name = target.getProperty("object_string");
|
|
|
|
|
processType.create(processName + ":" + name, "", taskTemplate, new TCComponent[]{target}, new int[]{1});
|
|
|
|
|
TCComponent create = processType.create(processName + ":" + name, "", taskTemplate,
|
|
|
|
|
new TCComponent[] { target }, new int[] { 1 });
|
|
|
|
|
System.out.println("uid===================" + create.getUid());
|
|
|
|
|
System.out.println("type==" + create.getType());
|
|
|
|
|
System.out.println("type==" + create.getStringProperty("object_type"));
|
|
|
|
|
}
|
|
|
|
|
} catch (TCException var7) {
|
|
|
|
|
var7.printStackTrace();
|
|
|
|
|
throw var7;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getLargerNumber(String num1, String num2) {
|
|
|
|
|
if (num1 == null || num1.isEmpty()) {
|
|
|
|
|
return num2;
|
|
|
|
|
}
|
|
|
|
|
// 将字符串转换为整数
|
|
|
|
|
int n1 = Integer.parseInt(num1);
|
|
|
|
|
int n2 = Integer.parseInt(num2);
|
|
|
|
|
|
|
|
|
|
// 比较两个整数,返回较大的一个的字符串形式
|
|
|
|
|
if (n1 > n2) {
|
|
|
|
|
return num1;
|
|
|
|
|
} else {
|
|
|
|
|
return num2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|