refactor: [절곡] bending_items code를 'BD' 단일값으로 통일

- bending_items.code: prod+spec(CP,RS 등) → 'BD' (절곡품 공통 접두사)
- bending_models 패턴(GR/SB/BB)과 동일 레벨로 통일
- import 스크립트 3개 + BendingCodeService.resolveItem 수정
- 마이그레이션 SQL 업데이트
- DB 266건 업데이트 완료
This commit is contained in:
2026-03-21 15:29:05 +09:00
parent 88d6547e69
commit 7cd0aab884
5 changed files with 6 additions and 6 deletions

View File

@@ -105,7 +105,7 @@ private function importItem(object $row): BendingItem
$bi = BendingItem::create([
'tenant_id' => $this->tenantId,
'code' => mb_substr($code, 0, 2),
'code' => 'BD',
'lot_no' => $code,
'legacy_code' => "CHANDJ-{$row->num}",
'legacy_bending_id' => $row->num,

View File

@@ -77,7 +77,7 @@ private function importItem(object $row): BendingItem
$bi = BendingItem::create([
'tenant_id' => $this->tenantId,
'code' => mb_substr($code, 0, 2),
'code' => 'BD',
'lot_no' => $code,
'legacy_code' => "CHANDJ-{$row->num}",
'legacy_bending_id' => $row->num,

View File

@@ -90,7 +90,7 @@ private function migrateItem(Item $item, int $tenantId): BendingItem
$bi = BendingItem::create([
'tenant_id' => $tenantId,
'code' => mb_substr($item->code, 0, 2),
'code' => 'BD',
'lot_no' => $item->code,
'legacy_code' => $item->code,
'legacy_bending_id' => $opts['legacy_bending_num'] ?? null,

View File

@@ -134,9 +134,9 @@ public function getCodeMap(): array
*/
public function resolveItem(string $prodCode, string $specCode, string $lengthCode): ?array
{
// 1차: code(코드 체계) + length_code로 조회
// 1차: lot_no 앞 2자리(prod+spec) + length_code로 조회
$item = BendingItem::where('tenant_id', $this->tenantId())
->where('code', "{$prodCode}{$specCode}")
->where('lot_no', 'like', "{$prodCode}{$specCode}%")
->where('length_code', $lengthCode)
->where('is_active', true)
->first();