$guideRailCodes, // 벽면 SUS 마감재 'RM' => ['24', '30', '35', '40', '42', '43'], // 벽면 본체 (EGI) 'RC' => ['24', '30', '35', '40', '42', '43'], // 벽면 C형 'RD' => ['24', '30', '35', '40', '42', '43'], // 벽면 D형 'RT' => ['30', '43'], // 벽면 본체 (철재) // 가이드레일 측면형 'SS' => ['30', '35', '40'], // 측면 SUS 마감재 'SM' => ['24', '30', '35', '40', '43'], // 측면 본체 (EGI) 'SC' => ['24', '30', '35', '40', '43'], // 측면 C형 'SD' => ['24', '30', '35', '40', '43'], // 측면 D형 'ST' => ['43'], // 측면 본체 (철재) 'SU' => ['30', '35', '40', '43'], // 측면 SUS (SUS2) // 하단마감재 'BE' => $bottomBarCodes, // EGI 마감 'BS' => ['24', '30', '35', '40', '43'], // SUS 마감 'TS' => ['43'], // 철재 SUS 'LA' => $bottomBarCodes, // L-Bar // 셔터박스 'CF' => $shutterBoxCodes, // 전면부 'CL' => $shutterBoxCodes, // 린텔부 'CP' => $shutterBoxCodes, // 점검구 'CB' => $shutterBoxCodes, // 후면코너부 // 연기차단재 'GI' => ['53', '54', '83', '84', '30', '35', '40'], // W50/W80 + 일반 // 공용/기타 'XX' => ['12', '24', '30', '35', '40', '41', '43'], // 하부BASE/셔터 상부/마구리 'YY' => ['30', '35', '40', '43'], // 별도 SUS 마감 'HH' => ['30', '40'], // 보강평철 ]; } public function handle(): int { $tenantId = (int) $this->option('tenant_id'); $this->info("=== BD-* 절곡 세부품목 마스터 검증 (tenant: {$tenantId}) ==="); $this->newLine(); // DB에서 전체 BD-* 품목 조회 $existingItems = DB::table('items') ->where('tenant_id', $tenantId) ->where('code', 'like', 'BD-%') ->whereNull('deleted_at') ->pluck('code') ->toArray(); $existingSet = array_flip($existingItems); $this->info('현재 등록된 BD-* 품목: '.count($existingItems).'개'); $this->newLine(); $prefixMap = $this->getPrefixLengthCodes(); $totalExpected = 0; $missing = []; $found = 0; foreach ($prefixMap as $prefix => $codes) { $prefixMissing = []; foreach ($codes as $code) { $itemCode = "BD-{$prefix}-{$code}"; $totalExpected++; if (isset($existingSet[$itemCode])) { $found++; } else { $prefixMissing[] = $itemCode; $missing[] = $itemCode; } } $status = empty($prefixMissing) ? '✅' : '❌'; $countStr = count($codes) - count($prefixMissing).'/'.count($codes); $this->line(" {$status} BD-{$prefix}: {$countStr}"); if (! empty($prefixMissing)) { foreach ($prefixMissing as $m) { $this->line(" ⚠️ 누락: {$m}"); } } } $this->newLine(); $this->info('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'); $this->info("검증 결과: {$found}/{$totalExpected} 등록 완료"); if (empty($missing)) { $this->info('✅ All items registered — 누락 0건'); return self::SUCCESS; } $this->warn('❌ 누락 항목: '.count($missing).'건'); $this->newLine(); $this->table(['누락 품목코드'], array_map(fn ($m) => [$m], $missing)); return self::FAILURE; } }