feat(API): 경동 견적 계산 개선 및 stock_transactions 관계 문서 갱신

- FormulaEvaluatorService: 완제품 미등록 상태에서도 경동 전용 계산 진행, product_model/finishing_type/installation_type 변수 추가
- LOGICAL_RELATIONSHIPS.md: stock_transactions 모델 관계 반영

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-30 11:23:35 +09:00
parent 66887c9c69
commit 63afa4fc9b
2 changed files with 35 additions and 16 deletions

View File

@@ -1,6 +1,6 @@
# 논리적 데이터베이스 관계 문서
> **자동 생성**: 2026-01-29 00:51:16
> **자동 생성**: 2026-01-29 19:41:35
> **소스**: Eloquent 모델 관계 분석
## 📊 모델별 관계 현황
@@ -907,6 +907,7 @@ ### stocks
- **item()**: belongsTo → `items`
- **creator()**: belongsTo → `users`
- **lots()**: hasMany → `stock_lots`
- **transactions()**: hasMany → `stock_transactions`
### stock_lots
**모델**: `App\Models\Tenants\StockLot`
@@ -915,6 +916,13 @@ ### stock_lots
- **receiving()**: belongsTo → `receivings`
- **creator()**: belongsTo → `users`
### stock_transactions
**모델**: `App\Models\Tenants\StockTransaction`
- **stock()**: belongsTo → `stocks`
- **stockLot()**: belongsTo → `stock_lots`
- **creator()**: belongsTo → `users`
### subscriptions
**모델**: `App\Models\Tenants\Subscription`

View File

@@ -1596,30 +1596,33 @@ private function calculateKyungdongBom(
['var' => 'QTY', 'desc' => '수량', 'value' => $QTY, 'unit' => 'EA'],
['var' => 'bracket_inch', 'desc' => '브라켓 인치', 'value' => $bracketInch, 'unit' => '인치'],
['var' => 'product_type', 'desc' => '제품 타입', 'value' => $productType, 'unit' => ''],
['var' => 'product_model', 'desc' => '모델코드', 'value' => $inputVariables['product_model'] ?? 'KSS01', 'unit' => ''],
['var' => 'finishing_type', 'desc' => '마감타입', 'value' => $inputVariables['finishing_type'] ?? 'SUS', 'unit' => ''],
['var' => 'installation_type', 'desc' => '설치타입', 'value' => $inputVariables['installation_type'] ?? '벽면형', 'unit' => ''],
],
]);
// Step 2: 완제품 조회
// Step 2: 완제품 조회 (경동 전용 계산은 완제품 없이도 동작)
$finishedGoods = $this->getItemDetails($finishedGoodsCode, $tenantId);
if (! $finishedGoods) {
$this->addDebugStep(2, '완제품선택', [
'code' => $finishedGoodsCode,
'error' => '완제품을 찾을 수 없습니다.',
]);
return [
'success' => false,
'error' => __('error.finished_goods_not_found', ['code' => $finishedGoodsCode]),
'debug_steps' => $this->debugSteps,
];
}
if ($finishedGoods) {
$this->addDebugStep(2, '완제품선택', [
'code' => $finishedGoods['code'],
'name' => $finishedGoods['name'],
'item_category' => $finishedGoods['item_category'] ?? 'N/A',
]);
} else {
// 경동 전용: 완제품 미등록 상태에서도 견적 계산 진행
$finishedGoods = [
'code' => $finishedGoodsCode,
'name' => $finishedGoodsCode,
'item_category' => 'estimate',
];
$this->addDebugStep(2, '완제품선택', [
'code' => $finishedGoodsCode,
'note' => '경동 전용 계산 - 완제품 미등록 상태로 진행',
]);
}
// KyungdongFormulaHandler 인스턴스 생성
$handler = new KyungdongFormulaHandler;
@@ -1646,6 +1649,11 @@ private function calculateKyungdongBom(
// 브라켓 크기 결정
$bracketSize = $handler->calculateBracketSize($weight, $bracketInch);
// 핸들러가 필요한 키 보장 (inputVariables에서 전달되지 않으면 기본값)
$productModel = $inputVariables['product_model'] ?? 'KSS01';
$finishingType = $inputVariables['finishing_type'] ?? 'SUS';
$installationType = $inputVariables['installation_type'] ?? '벽면형';
$calculatedVariables = array_merge($inputVariables, [
'W0' => $W0,
'H0' => $H0,
@@ -1658,6 +1666,9 @@ private function calculateKyungdongBom(
'BRACKET_SIZE' => $bracketSize,
'bracket_inch' => $bracketInch,
'product_type' => $productType,
'product_model' => $productModel,
'finishing_type' => $finishingType,
'installation_type' => $installationType,
]);
$this->addDebugStep(3, '변수계산', [