33 lines
1.5 KiB
PowerShell
33 lines
1.5 KiB
PowerShell
$ErrorActionPreference = 'Stop'
|
|
$htmlPath = Join-Path $PSScriptRoot '..\assets\app.js'
|
|
$html = [System.IO.File]::ReadAllText($htmlPath, [System.Text.Encoding]::UTF8)
|
|
|
|
$orderNoLabel = -join [char[]](0x6362,0x6807,0x5355,0x53F7)
|
|
$boxCountLabel = -join [char[]](0x7BB1,0x6570)
|
|
$unitsPerBoxLabel = -join [char[]](0x6BCF,0x7BB1,0x4E2A,0x6570)
|
|
$requirementLabel = -join [char[]](0x8D34,0x6807,0x8981,0x6C42)
|
|
$requiredLabels = @(
|
|
"relabelOrderNo:'$orderNoLabel'",
|
|
"relabelBoxCount:'$boxCountLabel'",
|
|
"relabelUnitsPerBox:'$unitsPerBoxLabel'",
|
|
"relabelRequirement:'$requirementLabel'"
|
|
)
|
|
|
|
$missingLabels = $requiredLabels | Where-Object { -not $html.Contains($_) }
|
|
if ($missingLabels) { throw "Missing relabel list labels: $($missingLabels -join ', ')" }
|
|
|
|
$start = $html.LastIndexOf('function relabelView()')
|
|
$end = $html.IndexOf('function relabelDetailView', $start)
|
|
if ($start -lt 0 -or $end -lt 0) { throw 'Relabel list view function not found' }
|
|
$render = $html.Substring($start, $end - $start)
|
|
|
|
foreach ($token in @('relabelOrderNo','relabelBoxCount','relabelUnitsPerBox','relabelRequirement',"t('status')",'openRelabelWork')) {
|
|
if (-not $render.Contains($token)) { throw "Relabel list is missing $token" }
|
|
}
|
|
|
|
if ($render.Contains("t('inboundCode')") -or $render.Contains("t('palletCount')") -or $render.Contains("t('relabelStatus')")) {
|
|
throw 'Relabel list still renders an obsolete field'
|
|
}
|
|
|
|
Write-Output 'PASS: relabel list columns match carton-mark and SKU-label requirements'
|