本文介紹了ProE二次開發(fā)中的Windchill PDMLink 7.0數(shù)據(jù)整理及導(dǎo)入經(jīng)驗。
當(dāng)批量導(dǎo)入用戶時,我試圖將Locale設(shè)為中文,測試過:zh_CN,CN,China等都不對,雖能正常導(dǎo)入,但導(dǎo)入后用戶的Locale設(shè)置錯誤,更新用戶時還是英文的。
LoadUser.class中的程序:
...
String s5 = LoadServerHelper.getValue("Locale", hashtable, hashtable1, 1);
...
if(s5 == null)
s5 = "English (United States)";
if(s5.equals("US"))
s5 = "English (United States)";
Locale locale = new Locale(s5, s5);
String s17 = locale.toString();
Enumeration enumeration = (new Vector()).elements();
for(Enumeration enumeration1 = OrganizationServicesHelper.manager.getUserLanguages(); enumeration1.hasMoreElements();)
{
Locale locale1 = (Locale)enumeration1.nextElement();
String s20 = locale1.getDisplayName(locale);
if(s20.equalsIgnoreCase(s5))
s17 = locale1.toString();
}
s17 = s17.replace('_', '-');
vector1.addElement(DirContext.getMapping(defaultAdapter, "user.preferredLanguage") + '=' + s17);
...
根據(jù)程序并跟蹤測試,得知Locale為中文時應(yīng)該寫:
中文 (中國)
(注意:中間必須有一個空格)
如:User,,eric,eric,Eric Lin,中文 (中國),eric@abc.com,,,,,,,,,,x,1234
同理, 繁體中文應(yīng)設(shè)置為:
中文 (臺灣)
----------------------------------------------------
How to Bulk-Load documents that are soft-types of some Out-of-the-Box provided type.
Assuming that,
1. A Library called 'MyLib' exists and contain a folder called 'Folder1'
2. A soft-type of Out-of-the-box provided RefernceDocument, called SubOfRef was created that has two attributes. The name of this soft-type should be exactly as it is reported by Type Manager UI.
a) MBool, a boolean
b) MString, a String
3. An Organization called MyOrg exists
Then use ...
windchill wt.load.LoadFromFile -d C:PathToMyFile.xml -u wcadmin -p wcadmin -CONT_PATH "/wt.inf.container.OrgContainer=MyOrg/wt.inf.library.WTLibrary=MyLib"
...to load the data below.
Name of SoftType Load - 01
Title of SoftType Load - 01
NUM:SoftType-01
Document
description 1112-002
DESIGN
/Default/Folder1
com.ptc.ReferenceDocument│com.ptc.SubOfRef
MyAttrs/MBool
false
MyAttrs/MString
Eleven
ApplicationData
EGadWork.xls
DGadReq.doc
DGadSpec.doc
----------------------------------------------------
Windchill PDMLink 7.0數(shù)據(jù)庫重新導(dǎo)入后,導(dǎo)致不能通過WGM和Proe Wildfire來創(chuàng)建EPMDocument,解決方法是:重新運行%WT_HOME%dbsqlwnc-wsp.sql,當(dāng)然這要求當(dāng)前Windchill系統(tǒng)必須正確安裝MO10和M020的patch。
---------------------------------------------------
導(dǎo)入Part和Doc的關(guān)聯(lián)
導(dǎo)入格式:
#PartDocLink,*文檔編號,docVersion,docIteration,*零部件編號,partVersion,partIteration
PartDocLink,SJ0000001,,,100-10-12,,
...
如上所示,如果partVersion為空,將可能導(dǎo)致系統(tǒng)創(chuàng)建關(guān)聯(lián)到舊版本的Part上。
建議把該欄位全部填上“A”即可創(chuàng)建關(guān)聯(lián)到Part的最新版本上。
在LoadPart.class中,根據(jù)編號、大版本、小版本獲取Part的函數(shù)如下:
private static WTPart getPart(String s, String s1, String s2)
throws WTException
{
WTPart wtpart = getCachedPart(s, s1, s2);
if(wtpart == null && s != null)
{
boolean flag = false;
QuerySpec queryspec = new QuerySpec(wt.part.WTPart.class);
queryspec.appendWhere(new SearchCondition(wt.part.WTPart.class, "master>number", "=", s.toUpperCase(), false));
if(s1 != null)
{
queryspec.appendAnd();
queryspec.appendWhere(new SearchCondition(wt.part.WTPart.class, "versionInfo.identifier.versionId", "=", s1, false));
if(s2 != null)
{
queryspec.appendAnd();
queryspec.appendWhere(new SearchCondition(wt.part.WTPart.class, "iterationInfo.identifier.iterationId", "=", s2, false));
} else
{
queryspec.appendAnd();
queryspec.appendWhere(new SearchCondition(wt.part.WTPart.class, "iterationInfo.latest", "TRUE"));
}
} else
{
flag = true;
}
QueryResult queryresult = PersistenceHelper.manager.find(queryspec);
if(flag)
{
queryresult = (new OwnershipIndependentLatestConfigSpec()).process(queryresult);
}
if(queryresult.size() > 0)
{
wtpart = (WTPart)queryresult.nextElement();
wtpart = cachePart(wtpart);
}
}
return wtpart;
}
可見,但大版本為空時,沒有獲取到最新小版本;
當(dāng)大版本不為空,小版本為空時,可以正常獲取到最新小版本。
而在LoadDoc.class中,根據(jù)編號、大版本、小版本獲取Doc的函數(shù)如下:
public static WTDocument getDocument(String s, String s1, String s2)
throws WTException
{
WTDocument wtdocument = getCachedDocument(s, s1, s2);
if(wtdocument == null && s != null)
{
QuerySpec queryspec = new QuerySpec(wt.doc.WTDocument.class);
queryspec.appendWhere(new SearchCondition(wt.doc.WTDocument.class, "master>number", "=", s.toUpperCase(), false));
if(s1 == null)
{
queryspec.appendAnd();
queryspec.appendWhere(new SearchCondition(wt.doc.WTDocument.class, "iterationInfo.latest", "TRUE"));
} else
{
queryspec.appendAnd();
queryspec.appendWhere(new SearchCondition(wt.doc.WTDocument.class, "versionInfo.identifier.versionId", "=", s1, false));
if(s2 != null)
{
queryspec.appendAnd();
queryspec.appendWhere(new SearchCondition(wt.doc.WTDocument.class, "iterationInfo.identifier.iterationId", "=", s2, false));
}
}
QueryResult queryresult = PersistenceHelper.manager.find(queryspec);
if(queryresult.size() > 0)
{
wtdocument = (WTDocument)queryresult.nextElement();
if(s1 != null && s2 == null)
{
wtdocument = (WTDocument)VersionControlHelper.getLatestIteration(wtdocument);
}
wtdocument = cacheDocument(wtdocument);
}
}
return wtdocument;
}
可見,文檔的大版本和小版本都可以不寫,系統(tǒng)能找到最新小版本。
利用系統(tǒng)的導(dǎo)入程序?qū)胛募⒁庖韵聨c:(否則會出現(xiàn)即使文件能正常導(dǎo)入但是主文件卻不入庫的情況)
——文件類型必須存在;
——導(dǎo)入數(shù)據(jù)中所指定了的軟屬性必須是該文件類型已經(jīng)擁有的軟屬性;
——采用絕對路徑的格式如下:“H:DocTest.txt”、“H:documentDocTest.txt”;
——如果采用相對路徑是指“%WT_HOME%loadFilescontent”目錄下的相對路徑;
——只要采用系統(tǒng)提供的導(dǎo)入程序就可以了,但是為了正常導(dǎo)入,并加入文檔的創(chuàng)建者需要修改系統(tǒng)提供的csvmapfile.txt文件,修改如下:
————系統(tǒng):BeginWTDocument~create~wt.doc.LoadDoc.beginCreateWTDocument~name~title
~number~type~description~department~saveIn~teamTemplate~domain~
lifecycletemplate~lifecyclestate~typedef~version~iteration
————修改后:BeginWTDocument~create~wt.doc.LoadDoc.beginCreateWTDocument~user~name
~title~number~type~description~department~saveIn~teamTemplate~domain~
lifecycletemplate~lifecyclestate~typedef~version~iteration~parentContainerPath
NOTE:一般對象(如:Group、AccessRule……)在導(dǎo)入時都要在系統(tǒng)的csvmapfile.txt字段的基礎(chǔ)上加上字段“parentContainerPath”
----------------------------------------------------------------------
軟類型的導(dǎo)入
當(dāng)導(dǎo)入軟類型時,如果你的主機名不是以ptc.com結(jié)尾的,必須填寫完整的軟類型名稱,否則將無法導(dǎo)入。如:
TypeNodeIconRoot,wt/clients/images,,,,,,,,,
BeginTypeDefNode,com.ptc.SitePart,wt.part.WTPart,part.gif,SitePart,SitePart,SitePart,
TRUE,FALSE,TRUE,SitePart
TypeDefAttrValue,ProjectPhase,Design,,,,,,,,,
...
EndTypeDefNode
相關(guān)文章
- 2021-09-08BIM技術(shù)叢書Revit軟件應(yīng)用系列Autodesk Revit族詳解 [
- 2021-09-08全國專業(yè)技術(shù)人員計算機應(yīng)用能力考試用書 AutoCAD2004
- 2021-09-08EXCEL在工作中的應(yīng)用 制表、數(shù)據(jù)處理及宏應(yīng)用PDF下載
- 2021-08-30從零開始AutoCAD 2014中文版機械制圖基礎(chǔ)培訓(xùn)教程 [李
- 2021-08-30從零開始AutoCAD 2014中文版建筑制圖基礎(chǔ)培訓(xùn)教程 [朱
- 2021-08-30電氣CAD實例教程AutoCAD 2010中文版 [左昉 等編著] 20
- 2021-08-30電影風(fēng)暴2:Maya影像實拍與三維合成攻略PDF下載
- 2021-08-30高等院校藝術(shù)設(shè)計案例教程中文版AutoCAD 建筑設(shè)計案例
- 2021-08-29環(huán)境藝術(shù)制圖AutoCAD [徐幼光 編著] 2013年P(guān)DF下載
- 2021-08-29機械A(chǔ)utoCAD 項目教程 第3版 [繆希偉 主編] 2012年P(guān)DF