Files
sam-api/app/Http/Requests/Quote/QuoteBomCalculateRequest.php
권혁성 5448f0e57d deploy: 2026-03-12 배포
- feat: [barobill] 바로빌 카드/은행/홈택스 REST API 구현
- feat: [equipment] 설비관리 API 백엔드 구현
- feat: [payroll] 급여관리 계산 엔진 및 일괄 처리 API
- feat: [QMS] 점검표 템플릿 관리 + 로트심사 개선
- feat: [생산/출하] 수주 단위 출하 자동생성 + 상태 흐름 개선
- feat: [receiving] 입고 성적서 파일 연결
- feat: [견적] 제어기 타입 체계 변경
- feat: [email] 테넌트 메일 설정 마이그레이션 및 모델
- feat: [pmis] 시공관리 테이블 마이그레이션
- feat: [R2] 파일 업로드 커맨드 + filesystems 설정
- feat: [배포] Jenkinsfile 롤백 기능 추가
- fix: [approval] SAM API 규칙 준수 코드 개선
- fix: [account-codes] 계정과목 중복 데이터 정리
- fix: [payroll] 일괄 생성 시 삭제된 사용자 건너뛰기
- fix: [db] codebridge DB 분리 후 깨진 FK 제약조건 제거
- refactor: [barobill] 바로빌 연동 코드 전면 개선
2026-03-12 15:20:20 +09:00

91 lines
3.1 KiB
PHP

<?php
namespace App\Http\Requests\Quote;
use Illuminate\Foundation\Http\FormRequest;
/**
* BOM 기반 견적 산출 요청
*
* React 견적등록 화면에서 자동 견적 산출 시 사용됩니다.
* 완제품 코드와 입력 변수를 받아 BOM 기반으로 품목/단가/금액을 계산합니다.
*/
class QuoteBomCalculateRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
// 필수 입력
'finished_goods_code' => 'required|string|max:50',
'W0' => 'required|numeric|min:100|max:20000',
'H0' => 'required|numeric|min:100|max:20000',
// 선택 입력 (기본값 있음)
'QTY' => 'nullable|integer|min:1',
'PC' => 'nullable|string|in:SCREEN,STEEL',
'GT' => 'nullable|string|in:wall,ceiling,floor,mixed',
'MP' => 'nullable|string|in:single,three',
'CT' => 'nullable|string|in:exposed,embedded,embedded_no_box',
'WS' => 'nullable|numeric|min:0|max:500',
'INSP' => 'nullable|numeric|min:0',
// 디버그 모드 (개발용)
'debug' => 'nullable|boolean',
];
}
public function attributes(): array
{
return [
'finished_goods_code' => __('validation.attributes.finished_goods_code'),
'W0' => __('validation.attributes.open_width'),
'H0' => __('validation.attributes.open_height'),
'QTY' => __('validation.attributes.quantity'),
'PC' => __('validation.attributes.product_category'),
'GT' => __('validation.attributes.guide_rail_type'),
'MP' => __('validation.attributes.motor_power'),
'CT' => __('validation.attributes.controller'),
'WS' => __('validation.attributes.wing_size'),
'INSP' => __('validation.attributes.inspection_fee'),
];
}
public function messages(): array
{
return [
'finished_goods_code.required' => __('error.finished_goods_code_required'),
'W0.required' => __('error.open_width_required'),
'W0.min' => __('error.open_width_min'),
'W0.max' => __('error.open_width_max'),
'H0.required' => __('error.open_height_required'),
'H0.min' => __('error.open_height_min'),
'H0.max' => __('error.open_height_max'),
];
}
/**
* 입력 변수 배열 반환 (FormulaEvaluatorService용)
*/
public function getInputVariables(): array
{
$validated = $this->validated();
return [
'W0' => (float) $validated['W0'],
'H0' => (float) $validated['H0'],
'QTY' => (int) ($validated['QTY'] ?? 1),
'PC' => $validated['PC'] ?? 'SCREEN',
'GT' => $validated['GT'] ?? 'wall',
'MP' => $validated['MP'] ?? 'single',
'CT' => $validated['CT'] ?? 'exposed',
'WS' => (float) ($validated['WS'] ?? 50),
'INSP' => (float) ($validated['INSP'] ?? 50000),
];
}
}