Skip to content

Commit

Permalink
#234 - Check-Items now marks entities with error when item number is …
Browse files Browse the repository at this point in the history
…to long
  • Loading branch information
ThomasRossmeisl committed Dec 16, 2022
1 parent e7f93a7 commit 3d28edf
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions Files/powerGate/Modules/BomWindow.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
}
}
}
Expand Down

0 comments on commit 3d28edf

Please sign in to comment.