feat(simulator): Phase 4 - BOM 디버깅 UI 및 API 추가
- simulateBom API 엔드포인트 추가 (calculateBomWithDebug 연동) - simulator.blade.php: BOM 디버깅 모드 탭 추가 - 10단계 디버그 스텝 패널 - 공정별 품목 그룹화 표시 - 원가 요약 (공정별 소계, 총합계) - FormulaEvaluatorService: currentTenantId 속성 추가 - 콘솔/API에서 tenant_id 전달 가능하도록 수정 - routes/api.php: simulate-bom 라우트 추가
This commit is contained in:
@@ -317,6 +317,47 @@ public function duplicate(int $id): JsonResponse
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* BOM 기반 시뮬레이션 (디버깅 포함)
|
||||
*
|
||||
* Design 시뮬레이터와 동일한 계산 로직을 사용하여
|
||||
* 10단계 디버깅 정보, 공정별 그룹화, 카테고리 가격 계산을 포함합니다.
|
||||
*/
|
||||
public function simulateBom(Request $request): JsonResponse
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'finished_goods_code' => 'required|string|max:50',
|
||||
'input_variables' => 'required|array',
|
||||
'input_variables.W0' => 'required|numeric|min:1',
|
||||
'input_variables.H0' => 'required|numeric|min:1',
|
||||
]);
|
||||
|
||||
$tenantId = session('selected_tenant_id');
|
||||
|
||||
if (! $tenantId) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => '테넌트를 선택해주세요.',
|
||||
], 400);
|
||||
}
|
||||
|
||||
// 디버그 모드 활성화
|
||||
$this->evaluatorService->enableDebugMode();
|
||||
|
||||
// BOM 기반 계산 (10단계 디버깅 포함)
|
||||
$result = $this->evaluatorService->calculateBomWithDebug(
|
||||
$validated['finished_goods_code'],
|
||||
$validated['input_variables'],
|
||||
$tenantId
|
||||
);
|
||||
|
||||
return response()->json([
|
||||
'success' => $result['success'] ?? false,
|
||||
'data' => $result,
|
||||
'message' => $result['error'] ?? null,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 전체 품목 목록 (시뮬레이터용)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user