Skip to content

Commit

Permalink
#238 Check for virtual components in GetVaultBomRows now uses _Entity…
Browse files Browse the repository at this point in the history
…TypeID instead of Bom_XrefTyp

Added "BomType" = "Virtual" Property to virtual bom rows
  • Loading branch information
ThomasRossmeisl committed Mar 10, 2023
1 parent 3d5368d commit 6802862
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Files/powerGate/Modules/BomFunctions.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ function PrepareBomHeaderForCreate($erpBomHeader, $vaultEntity) {

if ($vaultEntity._EntityTypeID -eq "ITEM") { $descriptionProp = '_Description(Item,CO)' }
else { $descriptionProp = '_Description' }

#TODO: Property mapping and assignment for bom header creation
$erpBomHeader.Number = $number
$erpBomHeader.Description = $vaultEntity.$descriptionProp
$erpBomHeader.Description = $vaultEntity.$descriptionProp
$erpBomHeader.State = "New"

Log -End
Expand Down Expand Up @@ -100,7 +100,7 @@ function GetVaultBomRows {

if ($null -eq $entity._EntityTypeID) { return @() }
if ($entity._EntityTypeID -eq "File") {
if ($entity._Extension -eq 'ipt') {
if ($entity._Extension -eq 'ipt') {
if ($entity.$rawMaterialQuantityProperty -gt 0 -and $entity.$rawMaterialNumberProperty -ne "") {
# Raw Material
$rawMaterial = New-Object PsObject -Property @{
Expand All @@ -126,10 +126,11 @@ function GetVaultBomRows {
#if ($entity._Category -eq 'Part') { return @() }
$bomRows = Get-VaultItemBom -Number $entity._Number
}

foreach ($vaultBomRow in $bomRows) {
if ($vaultBomRow.Bom_XrefTyp -eq "Internal") {
if ($null -eq $vaultBomRow._EntityTypeID) {
# Virtual Component
Add-Member -InputObject $vaultBomRow -Name "BomType" -Value "Virtual" -MemberType NoteProperty -Force
Add-Member -InputObject $vaultBomRow -Name "_Name" -Value $vaultBomRow.'Bom_Part Number' -MemberType NoteProperty -Force
Add-Member -InputObject $vaultBomRow -Name "Part Number" -Value $vaultBomRow.'Bom_Part Number' -MemberType NoteProperty -Force
Add-Member -InputObject $vaultBomRow -Name "_PartNumber" -Value $vaultBomRow.'Bom_Part Number' -MemberType NoteProperty -Force
Expand Down

0 comments on commit 6802862

Please sign in to comment.