使用案例 12:透過定義範圍產生下游結構
您可以透過定義範圍來產生下游結構。您可以建立屬性,並使用它來定義範圍。
假設 BOM 轉換器中存在以下結構:
Upstream Parent Part (Design)Downstream Parent Part (Manufacturing) 之間存在對等連結。
結構中所有零件的零件類型均為 wt.part.WTPart
偏好設定「用於定義範圍的分隔符號」的值設定為 >。此為預設值。
屬性 GDS_Match 建立在 WTPart 中。使用此屬性可定義範圍。
Part D1 (Manufacturing) 的屬性 source 的值設定為 buy
欲透過定義範圍產生下游結構,您可以使用規則檔案或內容檔案來指定轉換與重新建構規則。
使用規則檔案
{
"transformRules": [
{
"sourceType": "wt.part.WTPart",
"newAttributeMappings": [
[
"source.usage.GDS_Match:1>9",
"target.part.source:buy"
]
"targetType": "wt.part.WTPart",
"transformOption": "newBranch"
}
]
}
使用內容檔案
1. 存取位於 Windchill/codebase/com/ptc/core/foundation/associativity 中的 associativity.properties.xconf 檔案。
2. 新增下列重新建構規則:
<Property name="com.ptc.windchill.associativity.reconciliation.addusage.wt.part.WTPart" multivalued="," default=""/>
<AddToProperty name="com.ptc.windchill.associativity.reconciliation.addusage.wt.part.WTPart" value="transformOption=newBranch"/>
<AddToProperty name="com.ptc.windchill.associativity.reconciliation.addusage.wt.part.WTPart" value="targetType=wt.part.WTPart"/>
<AddToProperty name="com.ptc.windchill.associativity.reconciliation.addusage.wt.part.WTPart" value="attributeMapping.rule1=GDS_Match:1>9:source:buy"/>
* 
GDS_Match1>9 描述範圍。偏好設定「用於定義範圍的分隔符號」的值設定為 >1>9 表示範圍從 19。在此情況下,系統會考慮下列值進行比較:123456789
執行「產生下游結構」動作之後,下列結構會顯示在「BOM 轉換器」中:
系統會橫移所選零件下方的結構。此組態可確保上游零件的 GDS_Match 屬性的值為從 19 時,將上游零件新增為目標相符下游零件下的新分支。
根據指定的條件,Part C1 (Manufacturing)Part C2 (Manufacturing)Part C5 (Manufacturing) 會新增為 Part D1 (Manufacturing) 下的新零件。
Part C3Part C4 不會傳輸至下游檢視,因為 GDS_Match 屬性的值不在內容的指定範圍內。
這是否有幫助?