You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
83 lines
2.3 KiB
83 lines
2.3 KiB
package com.connor.lidy.create;
|
|
|
|
import java.util.Map;
|
|
|
|
import com.teamcenter.rac.aif.AbstractAIFDialog;
|
|
import com.teamcenter.rac.aif.AbstractAIFOperation;
|
|
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
|
|
import com.teamcenter.rac.kernel.TCComponent;
|
|
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;
|
|
|
|
public class PictureMaterialOperation{
|
|
private Map<Integer, TCComponent> tableMap;
|
|
private int row;
|
|
private TCComponentItemRevision target;
|
|
private AbstractAIFDialog dialog;
|
|
private String exec;
|
|
private String search;
|
|
private TCSession session;
|
|
public String res;
|
|
public PictureMaterialOperation(Map<Integer, TCComponent> tableMap,int row,TCComponentItemRevision target,AbstractAIFDialog dialog,String search,String exec,TCSession session) {
|
|
this.tableMap=tableMap;
|
|
this.row=row;
|
|
this.target=target;
|
|
this.dialog=dialog;
|
|
this.exec = exec;
|
|
this.search = search;
|
|
this.session = session;
|
|
}
|
|
public void executeOperation() throws Exception {
|
|
switch (exec) {
|
|
case "µ¼³ö":
|
|
res = export();
|
|
|
|
break;
|
|
case "²éѯ":
|
|
((PictureMaterialDialog)dialog).search(search);
|
|
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
private String export() throws TCException {
|
|
TCComponent comp = tableMap.get(row);
|
|
AIFComponentContext[] children = target.getChildren("ML8_ProjectRelation");
|
|
if(children.length>0) {
|
|
for(AIFComponentContext c : children)
|
|
target.remove("ML8_ProjectRelation", (TCComponent)c.getComponent());
|
|
}
|
|
target.add("ML8_ProjectRelation", comp);
|
|
|
|
TCUserService userservice = session.getUserService();
|
|
Object[] obj = new Object[1];
|
|
obj[0] = target;
|
|
String res = "";
|
|
try {
|
|
res= (String)userservice.call("updateFormChangeDesc", obj);
|
|
} catch (Exception e) {
|
|
// TODO: handle exception
|
|
}
|
|
|
|
// AIFComponentContext[] forms = comp.getChildren("ML8_ProjectRelation");
|
|
// System.out.println("forms:"+forms.length);
|
|
// if(forms.length>0) {
|
|
// for(AIFComponentContext c : forms)
|
|
// target.add("ML8_ProjectRelation", (TCComponent)c.getComponent());
|
|
// }
|
|
if(res != null && !res.isEmpty()) {
|
|
res = "ÃèÊöÆ´½Ó±¨´í£º"+res;
|
|
}else {
|
|
res = "ÐÞ¸ÄÍê³É";
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|
|
}
|