fix: [numbering] scopeKey 누적 할당 오류 수정

- scopeKey = value → scopeKey .= value 수정 (param, mapping 세그먼트)
- stock_production 문서유형 추가
This commit is contained in:
김보곤
2026-03-18 19:56:16 +09:00
parent 6af9162ce4
commit b7c6e7f69d

View File

@@ -10,7 +10,7 @@ class NumberingService extends Service
/**
* 채번 규칙 기반 번호 생성
*
* @param string $documentType 문서유형 (quote, order, sale, work_order, material_receipt)
* @param string $documentType 문서유형 (quote, order, sale, work_order, material_receipt, stock_production)
* @param array $params 외부 파라미터 (pair_code, product_category 등)
* @return string|null 생성된 번호 (규칙 없으면 null → 호출자가 기존 로직 사용)
*/
@@ -49,14 +49,14 @@ public function generate(string $documentType, array $params = []): ?string
case 'param':
$value = $params[$segment['key']] ?? $segment['default'] ?? '';
$result .= $value;
$scopeKey = $value;
$scopeKey .= $value;
break;
case 'mapping':
$inputValue = $params[$segment['key']] ?? '';
$value = $segment['map'][$inputValue] ?? $segment['default'] ?? '';
$result .= $value;
$scopeKey = $value;
$scopeKey .= $value;
break;
case 'sequence':
@@ -121,13 +121,13 @@ public function preview(string $documentType, array $params = []): ?array
case 'param':
$value = $params[$segment['key']] ?? $segment['default'] ?? '';
$result .= $value;
$scopeKey = $value;
$scopeKey .= $value;
break;
case 'mapping':
$inputValue = $params[$segment['key']] ?? '';
$value = $segment['map'][$inputValue] ?? $segment['default'] ?? '';
$result .= $value;
$scopeKey = $value;
$scopeKey .= $value;
break;
case 'sequence':
$periodKey = match ($rule->reset_period) {
@@ -188,4 +188,4 @@ private function nextSequence(
->where('period_key', $periodKey)
->value('last_sequence');
}
}
}