feat: BOM 기반 견적 계산 API 엔드포인트 추가
- QuoteBomCalculateRequest.php 생성 (BOM 계산용 FormRequest) - QuoteCalculationService.calculateBom() 메서드 추가 - QuoteController.calculateBom() 액션 추가 - POST /api/v1/quotes/calculate/bom 라우트 등록 - Swagger 문서 업데이트 (스키마 + 엔드포인트) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -76,6 +76,43 @@ public function preview(array $inputs, ?string $productCategory = null, ?int $pr
|
||||
return $this->calculate($inputs, $productCategory, $productId);
|
||||
}
|
||||
|
||||
/**
|
||||
* BOM 기반 견적 산출 (10단계 디버깅 포함)
|
||||
*
|
||||
* MNG FormulaEvaluatorService의 calculateBomWithDebug와 동일한 로직을 사용합니다.
|
||||
* React 견적등록 화면에서 자동 견적 산출 시 호출됩니다.
|
||||
*
|
||||
* @param string $finishedGoodsCode 완제품 코드
|
||||
* @param array $inputs 입력 변수 (W0, H0, QTY, PC, GT, MP, CT, WS, INSP)
|
||||
* @param bool $debug 디버그 모드 (기본 false)
|
||||
* @return array 산출 결과 (finished_goods, variables, items, grouped_items, subtotals, grand_total)
|
||||
*/
|
||||
public function calculateBom(string $finishedGoodsCode, array $inputs, bool $debug = false): array
|
||||
{
|
||||
$tenantId = $this->tenantId();
|
||||
|
||||
if (! $tenantId) {
|
||||
return [
|
||||
'success' => false,
|
||||
'error' => __('error.tenant_not_set'),
|
||||
];
|
||||
}
|
||||
|
||||
// FormulaEvaluatorService의 calculateBomWithDebug 호출
|
||||
$result = $this->formulaEvaluator->calculateBomWithDebug(
|
||||
$finishedGoodsCode,
|
||||
$inputs,
|
||||
$tenantId
|
||||
);
|
||||
|
||||
// 디버그 모드가 아니면 debug_steps 제거
|
||||
if (! $debug && isset($result['debug_steps'])) {
|
||||
unset($result['debug_steps']);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 견적 품목 재계산 (기존 견적 기준)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user