CX_BILL_OF_MATERIAL::ResolveNew
Description:
This function is inherited from CX_SET_ALLOCATION::ResolveNew() without any changes. However, it is described here specifically with regard to the problems of resolving BOMs (see also Structure of the resolved BOM):
1. hierarchical processing of quantities
The following example is about the bill of material for a part A, which itself consists of part A' and this in turn consists of part A''. The quantities on all levels of the exploded BOM are to be considered:
Each exploded BOM item (CX_ALLOCATION_TXN) has a field amount and a field baseAmount. The function CX_ALLOCATION_AMOUNT::Amount() adds both fields together to determine the total quantity of a BOM item.
The field CX_ALLOCATION_TXN::amount is created as CX_PRODUCT_AMOUNT: As the first element of this CX_PRODUCT_AMOUNT vector a CX_SUM_AMOUNT object is inserted, which itself again consists as the first element of the amount field of the previous exploded BOM item and as the second element of the baseAmount field of the previous exploded BOM item.
The second element of the CX_ALLOCATION_TXN::amount vector is the amount field of the current BOM item to be exploded.
2. processing of the allocated object
An allocation - in this case a BOM item - describes an assignment between an object - here a part - and a quantity.
If no object is referenced at an item in the master BOM, this item is omitted when exploding. The same applies if the quantities in the master BOM item are zero and the identifier "Omit item if quantity zero" has been set in the BOM item.
Depending on the mode (see below), the reference to the object is then copied from the master BOM item to the exploded BOM item or not. If the mode is set to copy the object (bit(1) is on), the following validity check takes place:
- If the object is valid at the time the parts list is exploded, this reference is adopted
- If the object is not valid at the time the bill of material is exploded, this reference is first adopted, but the system then immediately checks whether the invalid object refers to another valid exchange object: If this is the case, the reference to this now valid object is copied. This procedure can therefore lead to invalid objects without a valid exchange object being transferred to the exploded parts list.
Code example:
Var(resolveType, allocationTxn, allocation, boolean, container) // Verarbeitung der angemeldeten und gesendeten Nachricht Msg(ORDER_ALLOCATION_INSERTED) ORDER_ALLOCATION_INSERTED: -> boolean -> container -> allocationTxn allocationTxn Get(allocation) -> allocation // Check if allocated object is only pattern allocation Get(object) -> originallyAllocatedObject originallyAllocatedObject Dup if { Call(Item) Dup -> resultingAllocatedObject originallyAllocatedObject @ ifnot { resultingAllocatedObject allocationTxn SetReference(object, allocations) } "Item().ProductAllocation(resolveType,0)" container Put(accessPath) TRUE boolean Put } DropAll FinishInput // Typ der aufzulösenden Allokation definieren "CX_BILL_OF_MATERIAL" -> resolveType // Holen Objekt vom Typ CX_SET_ALLOCATION (hier abgeleitete Klasse CX_BILL_OF_MATERIAL = Stückliste) "123456" "uniqueID = %s" FindFirst(CX_BILL_OF_MATERIAL)-> allocation // Ziel Transaktion generieren CreatePersObject(CX_ALLOCATION_TXN) -> allocationTXN // Set pre message (ORDER_ALLOCATION_INSERTED) allocation Call(SetPreMessage) // Set plug space // allocationTxn must be inserted in order to be able to call // functions Allocation, AllocationAmount, Object and ObjectAmount. // If depth is bigger than 1, then this should be not necessary // but thus it is more general [ allocationTxn /* und weitere Objekte */ ] # Revert PlugSpace // Stack belegen NULL // Faktor allocationTxn // Ziel Objekt vom Typ CX_ALLOCATION_TXN "Item().ProductAllocation(resolveType,0)" // Auflösungspfad 0 // Modus (Bitmuster) allocation // Allokationsobjekt // Funktion aufrufen Call(ResolveNew)
Stack | Position | Object type | Brief description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Stack(In) | Top | CX_ALLOCATION | Allocation to be dissolved | ||||||||
Top 1 | INTEGER | Mode
| |||||||||
top 2 | STRING | Dissolution path | |||||||||
top 3 | CX_ALLOCATION_TXN | Target Transaction Object | |||||||||
top 4 | CX_VALUE | Factor |