我想看一级黄色大片_久久亚洲国产精品一区二区_久久精品免视看国产明星_91久久青青青国产免费

您的位置:網站首頁 > Proe教程

ProE二次開發中的Windchill PDMLink 7.0數據整理及導入經驗

時間:2011-02-24 09:39:32 來源:

  本文介紹了ProE二次開發中的Windchill PDMLink 7.0數據整理及導入經驗。

  當批量導入用戶時,我試圖將Locale設為中文,測試過:zh_CN,CN,China等都不對,雖能正常導入,但導入后用戶的Locale設置錯誤,更新用戶時還是英文的。

  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);

  ...

  根據程序并跟蹤測試,得知Locale為中文時應該寫:

  中文 (中國)

  (注意:中間必須有一個空格)

  如:User,,eric,eric,Eric Lin,中文 (中國),eric@abc.com,,,,,,,,,,x,1234

  同理, 繁體中文應設置為:

  中文 (臺灣)

  ----------------------------------------------------

  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數據庫重新導入后,導致不能通過WGM和Proe Wildfire來創建EPMDocument,解決方法是:重新運行%WT_HOME%dbsqlwnc-wsp.sql,當然這要求當前Windchill系統必須正確安裝MO10和M020的patch。

  ---------------------------------------------------

  導入Part和Doc的關聯

  導入格式:

  #PartDocLink,*文檔編號,docVersion,docIteration,*零部件編號,partVersion,partIteration

  PartDocLink,SJ0000001,,,100-10-12,,

  ...

  如上所示,如果partVersion為空,將可能導致系統創建關聯到舊版本的Part上。

  建議把該欄位全部填上“A”即可創建關聯到Part的最新版本上。

  在LoadPart.class中,根據編號、大版本、小版本獲取Part的函數如下:

  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;

  }

  可見,但大版本為空時,沒有獲取到最新小版本;

  當大版本不為空,小版本為空時,可以正常獲取到最新小版本。

  而在LoadDoc.class中,根據編號、大版本、小版本獲取Doc的函數如下:

  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;

  }

  可見,文檔的大版本和小版本都可以不寫,系統能找到最新小版本。

  利用系統的導入程序導入文件注意以下幾點:(否則會出現即使文件能正常導入但是主文件卻不入庫的情況)

  ——文件類型必須存在;

  ——導入數據中所指定了的軟屬性必須是該文件類型已經擁有的軟屬性;

  ——采用絕對路徑的格式如下:“H:DocTest.txt”、“H:documentDocTest.txt”;

  ——如果采用相對路徑是指“%WT_HOME%loadFilescontent”目錄下的相對路徑;

  ——只要采用系統提供的導入程序就可以了,但是為了正常導入,并加入文檔的創建者需要修改系統提供的csvmapfile.txt文件,修改如下:

  ————系統: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……)在導入時都要在系統的csvmapfile.txt字段的基礎上加上字段“parentContainerPath”

  ----------------------------------------------------------------------

  軟類型的導入

  當導入軟類型時,如果你的主機名不是以ptc.com結尾的,必須填寫完整的軟類型名稱,否則將無法導入。如:

  TypeNodeIconRoot,wt/clients/images,,,,,,,,,

  BeginTypeDefNode,com.ptc.SitePart,wt.part.WTPart,part.gif,SitePart,SitePart,SitePart,
TRUE,FALSE,TRUE,SitePart

  TypeDefAttrValue,ProjectPhase,Design,,,,,,,,,

  ...

  EndTypeDefNode