windchill开发基础CreateTable
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
package com.ptc;
import java.rmi.RemoteException;
import java.util.Iterator;
import java.util.Vector;
import wt.fc.ObjectReference;
import wt.fc.PersistenceHelper;
import wt.fc.QueryResult;
import wt.fc.ReferenceFactory;
import wt.fc.collections.WTCollection;
import wt.fc.collections.WTHashSet;
import wt.maturity.MaturityHelper;
import wt.maturity.PromotionNotice;
import wt.method.RemoteAccess;
import wt.part.WTPart;
import wt.query.QuerySpec;
import wt.query.SearchCondition;
import wt.util.WTException;
import wt.util.WTRuntimeException;
import mon.QueryException;
public class CreateTable implements RemoteAccess {
public static void main(String[] args) throws WTRuntimeException,WTException, RemoteException{
wt.method.RemoteMethodServer server = wt.method.RemoteMethodServer.getDefault();
server.setUserName("wcadmin");
server.setPassword("wcadmin");
QueryResult part = CreateTable.getWTPart();
System.out.println("=="+part.size());
}
public static WTPart getWTPart1() throws WTException {
String folderPath = "/GOLF_CART/Design";
String partName = "GC000001";
QuerySpec qs;
WTPart part = null;
try {
qs = new QuerySpec(WTPart.class);
QueryResult qr = null;
qs.appendWhere(new SearchCondition(WTPart.class,WTPart.NUMBER, SearchCondition.EQUAL, partName, false));
qr = PersistenceHelper.manager.find(qs);
part = (WTPart) qr.nextElement();
//findRelatedPromotion(doc);
} catch (QueryException e) {
// TODO Auto-generated catch block
//e.printStackTrace();
} catch (WTException e) {
// TODO Auto-generated catch block
//e.printStackTrace();
}
return part;
}
@SuppressWarnings("deprecation")
public static QueryResult getWTPart() throws WTException {
String[] partName ={"GC000002","GC000020","GC000004","GC000005"};
QuerySpec qs;
QueryResult qr = null;
WTPart part = null;
try {
qs = new QuerySpec(WTPart.class);
SearchCondition sc = new SearchCondition(WTPart.class,WTPart.NUMBER, partName, false);
qs.appendSearchCondition(sc);
qr = PersistenceHelper.manager.find(qs);
} catch (QueryException e) {
e.printStackTrace();
} catch (WTException e) {
e.printStackTrace();
}
return qr;
}
/**
* 查找關聯的推進流程
*
* @param epm
* 圖檔對象
* @return 推進對象
*/
public static Vector findRelatedPromotion(WTPart epm) {
Vector vector = new Vector();