其他功能 > 製造流程管理 > 將 eBOM 轉換為 mBOM > 建立 mBOM > 「產生下游結構」動作概觀 > 使用案例:產生下游結構 > 使用案例 8:透過根據兩個屬性略過零件來產生下游結構
使用案例 8:透過根據兩個屬性略過零件來產生下游結構
請考慮這樣一種情境:即 BOM 轉換器中存在以下結構:
Upstream Parent Part (Design)Downstream Parent Part (Manufacturing) 之間存在對等連結。
Part C2 (Design)Part C3 (Design)Part C5 (Design)Part C6 (Design) 的零件使用關係屬性 Attribute1 設定為 true
* 
Attribute1 是類型為布林值的屬性。在 Windchill 中,此屬性的值為 YesNotruefalse 分別同步到 YesNo
結構中所有零件的零件類型均為 wt.part.WTPart
欲透過根據兩個屬性略過零件產生下游結構,您可以使用規則檔案或內容檔案來指定轉換與重新建構規則。
使用規則檔案
{
"transformRules": [
{
"sourceType": "wt.part.WTPart",
"newAttributeMappings": [
[
"source.usage.Attribute1:true",
"target.part.CustomAttribute1:String1",
"doAndValidationForAttr": "true"
]
],
"targetType": "wt.part.WTPart",
"transformOption": "newPart",
"skipAttributes":
[
"source:buy",
"Attribute2":"true"
]
}
]
}
使用內容檔案
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=newPart"/>
<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=Attribute1:true:CustomAttribute1:String1"/>
<AddToProperty name="com.ptc.windchill.associativity.reconciliation.addusage.wt.part.WTPart" value="skipAttribute.source=buy"/>
<AddToProperty name="com.ptc.windchill.associativity.reconciliation.addusage.wt.part.WTPart" value="skipAttribute.Attribute2=true"/>
<AddToProperty name="com.ptc.windchill.associativity.reconciliation.addusage.wt.part.WTPart" value="doAndValidationForAttr=true"/>
針對上游中的所選零件啟動 動作後,Windchill 系統會遍歷所選零件下方的結構。此組態可確保:
如果 Windchill 系統偵測到上游存在零件屬性 Attribute1 設定為 true 的零件,則會在下游中屬性 CustomAttribute1 設定為 String1 的零件下轉換它。會將其轉換為新零件
如果 Windchill 系統偵測到上游存在零件使用關係屬性 Attribute2 設定為 true 且屬性 Source 設定為 buy 的零件,則會跳過該零件,且不會將其新增至下游。但是,會遍歷偵測到的零件之下的結構。
下列結構會顯示在 BOM 轉換器中:
會略過 Part C1 (Design)。不會將其新增至下游,因為它符合指定的條件:
<AddToProperty name="com.ptc.windchill.associativity.reconciliation.addusage.wt.part.WTPart" value="skipAttribute.source=buy"/>
<AddToProperty name="com.ptc.windchill.associativity.reconciliation.addusage.wt.part.WTPart" value="skipAttribute.Attribute2=true"/>
<AddToProperty name="com.ptc.windchill.associativity.reconciliation.addusage.wt.part.WTPart" value="doAndValidationForAttr=true"/>
不會將 Part C4 (Design) 新增到下游中,因為 Attribute1 設定為 false
不會在 Part T2 (Manufacturing) 下新增任何零件,因為其零件使用關係屬性 CustomAttribute1 值設定為 String2,而非 String1
這是否有幫助?