From 3d28edfcad855d2386fc6928aa55202c1bd95c26 Mon Sep 17 00:00:00 2001 From: ThomasRossmeisl Date: Fri, 16 Dec 2022 13:07:43 +0100 Subject: [PATCH] #234 - Check-Items now marks entities with error when item number is to long --- Files/powerGate/Modules/BomWindow.psm1 | 27 ++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/Files/powerGate/Modules/BomWindow.psm1 b/Files/powerGate/Modules/BomWindow.psm1 index 6711565..c84d331 100644 --- a/Files/powerGate/Modules/BomWindow.psm1 +++ b/Files/powerGate/Modules/BomWindow.psm1 @@ -16,12 +16,14 @@ function Check-Items($entities) { if (-not $number) { if ($entity._VaultStatus.Status.LockState -eq "Locked") { Update-BomWindowEntity $entity -Status "Error" -StatusDetails "Number is empty! Entity is locked" - }else { + } + else { Update-BomWindowEntity $entity -Status "New" -StatusDetails "Item does not exist in ERP. Will be created." } continue } + $erpMaterial = Get-ERPObject -EntitySet "Materials" -Keys @{ Number = $number } if ($? -eq $false) { continue @@ -33,21 +35,26 @@ function Check-Items($entities) { if ($number.Length -gt 20) { $statusDetails = "The number '$($number)' is longer than 20 characters. The ERP item cannot be created" Update-BomWindowEntity $entity -Status "Error" -StatusDetails $statusDetails + + continue } + Update-BomWindowEntity $entity -Status "New" -StatusDetails "Item does not exist in ERP. Will be created." + + continue + } + + + if (-not $entity._EntityTypeID) { + Update-BomWindowEntity $entity -Status "Identical" -StatusDetails "Virtual Component or Raw Material where no file in Vault is present" } else { - if (-not $entity._EntityTypeID) { - Update-BomWindowEntity $entity -Status "Identical" -StatusDetails "Virtual Component or Raw Material where no file in Vault is present" + $differences = CompareErpMaterial -erpMaterial $erpMaterial -vaultEntity $entity + if ($differences) { + Update-BomWindowEntity $entity -Status "Different" -StatusDetails $differences } else { - $differences = CompareErpMaterial -erpMaterial $erpMaterial -vaultEntity $entity - if ($differences) { - Update-BomWindowEntity $entity -Status "Different" -StatusDetails $differences - } - else { - Update-BomWindowEntity $entity -Status "Identical" -StatusDetails "Item is identical between Vault and ERP" - } + Update-BomWindowEntity $entity -Status "Identical" -StatusDetails "Item is identical between Vault and ERP" } } }