Transfer-Items
This function is executed when clicking the “Transfer” button within the Item Tab.
All the Items from the BOM Window can be transferred to to ERP.
Syntax
Transfer-Items [-Items] <Item[]>
Parameters
Type |
Name |
Description |
input/output |
Mandatory |
Default value |
---|---|---|---|---|---|
Item [] |
Items |
The Items which should be transfered |
input |
yes |
Return type
void
Remarks
Each unique Item shown in the BOM Window with another Status then Unknown will be passed to this function.
It is recommended to update the Status of all the Items with the Update-BomWindowEntity cmdlet.
When an exception is thrown within this function, the BOM Window shows the Exception message of the terminated Transfer operation.
The Status of all the Items that where not updated, gets automatically changed to Unknown.
Examples
Remove all the items with Status “Remove” from ERP. When operation succeeded the item gets removed from the Dialog, otherwise item is marked as “Error”:
function Transfer-Items($items) {
foreach($item in $items) {
if($item._Status -eq 'Remove'){
$removed = Remove-ERPObject -EntitySet 'Materials' -Keys @{'Number'=$item._PartNumber}
if($removed) {
$item | Remove-BomWindowEntity
}else{
$item | Update-BomWindowEntity -Status 'Error' -StatusDetails "Error occured when removing item: $($Error[0].Exception.Message)"
}
}
}
}