- 작업지시 계획 문서 업데이트 - MES 통합 분석, 서버 컴포넌트 감사 계획 추가 - 수주관리, 인수인계서 API 연동 변경 이력 추가 - sub/ 하위 계획 문서들 추가 (카테고리, 계약, 품목, 단가 등) Co-Authored-By: Claude <noreply@anthropic.com>
141 lines
3.6 KiB
Markdown
141 lines
3.6 KiB
Markdown
# 단가관리 (Pricing) API 연동 계획
|
|
|
|
> **작성일**: 2026-01-08
|
|
> **상위 문서**: [construction-api-integration-plan.md](../construction-api-integration-plan.md)
|
|
> **상태**: ⏳ 대기
|
|
> **API 상태**: ✅ 기존 API 존재
|
|
|
|
---
|
|
|
|
## 1. 컴포넌트 분석
|
|
|
|
### 1.1 파일 위치
|
|
```
|
|
react/src/
|
|
├── app/[locale]/(protected)/construction/order/base-info/pricing/
|
|
│ └── page.tsx
|
|
└── components/business/construction/pricing-management/
|
|
├── PricingListClient.tsx
|
|
├── actions.ts
|
|
└── types.ts
|
|
```
|
|
|
|
### 1.2 현재 Mock 데이터
|
|
|
|
**actions.ts 내 Mock 함수:**
|
|
```typescript
|
|
// getPricingList에서 Mock 단가 데이터 생성
|
|
// 단가: 품목별 단가, 버전 관리, 적용일 등
|
|
```
|
|
|
|
### 1.3 현재 함수 목록
|
|
|
|
| 함수명 | 용도 | Mock 상태 |
|
|
|--------|------|:--------:|
|
|
| `getPricingList` | 단가 목록 조회 | ✅ Mock |
|
|
| `getPricingStats` | 단가 통계 조회 | ✅ Mock |
|
|
| `deletePricing` | 단가 삭제 | ✅ Mock |
|
|
| `deletePricings` | 단가 일괄 삭제 | ✅ Mock |
|
|
|
|
---
|
|
|
|
## 2. 기존 API 분석
|
|
|
|
### 2.1 기존 엔드포인트 (api/routes/api.php line 946-955)
|
|
|
|
```php
|
|
Route::prefix('construction/pricing')->group(function () {
|
|
Route::get('/', [PricingController::class, 'index']);
|
|
Route::get('/cost', [PricingController::class, 'cost']);
|
|
Route::get('/by-items', [PricingController::class, 'byItems']);
|
|
Route::post('/', [PricingController::class, 'store']);
|
|
Route::get('/{pricing}', [PricingController::class, 'show']);
|
|
Route::put('/{pricing}', [PricingController::class, 'update']);
|
|
Route::delete('/{pricing}', [PricingController::class, 'destroy']);
|
|
Route::post('/{pricing}/finalize', [PricingController::class, 'finalize']);
|
|
Route::get('/{pricing}/revisions', [PricingController::class, 'revisions']);
|
|
});
|
|
```
|
|
|
|
### 2.2 API-컴포넌트 매핑
|
|
|
|
| 컴포넌트 함수 | API 엔드포인트 | 매핑 상태 |
|
|
|--------------|---------------|:--------:|
|
|
| `getPricingList` | `GET /construction/pricing` | ✅ 매핑 가능 |
|
|
| `getPricingStats` | 없음 | ⚠️ 추가 필요 |
|
|
| `deletePricing` | `DELETE /construction/pricing/{id}` | ✅ 매핑 가능 |
|
|
| `deletePricings` | 없음 | ⚠️ bulk 추가 필요 |
|
|
|
|
---
|
|
|
|
## 3. 작업 항목
|
|
|
|
### 3.1 Backend (API)
|
|
|
|
| # | 작업 | 상태 | 비고 |
|
|
|---|------|:----:|------|
|
|
| 1 | stats 엔드포인트 추가 | ⏳ | |
|
|
| 2 | bulk delete 엔드포인트 추가 | ⏳ | |
|
|
| 3 | 프론트 타입과 정합성 확인 | ⏳ | |
|
|
|
|
### 3.2 Frontend (React)
|
|
|
|
| # | 작업 | 상태 | 비고 |
|
|
|---|------|:----:|------|
|
|
| 1 | actions.ts Mock → API 변환 | ⏳ | |
|
|
| 2 | API 클라이언트 연동 | ⏳ | |
|
|
| 3 | 에러 핸들링 추가 | ⏳ | |
|
|
| 4 | types.ts 정합성 확인 | ⏳ | |
|
|
|
|
---
|
|
|
|
## 4. 타입 정의
|
|
|
|
### 4.1 Pricing 타입
|
|
|
|
```typescript
|
|
interface Pricing {
|
|
id: string;
|
|
itemId: string;
|
|
itemName: string;
|
|
itemCode: string;
|
|
categoryId: string;
|
|
categoryName: string;
|
|
unitPrice: number;
|
|
laborCost: number;
|
|
materialCost: number;
|
|
totalPrice: number;
|
|
effectiveDate: string;
|
|
expirationDate?: string;
|
|
version: number;
|
|
status: PricingStatus;
|
|
createdAt: string;
|
|
updatedAt: string;
|
|
}
|
|
|
|
type PricingStatus = 'draft' | 'active' | 'expired' | 'finalized';
|
|
```
|
|
|
|
### 4.2 PricingStats 타입
|
|
|
|
```typescript
|
|
interface PricingStats {
|
|
total: number;
|
|
active: number;
|
|
expired: number;
|
|
draft: number;
|
|
averagePrice: number;
|
|
}
|
|
```
|
|
|
|
---
|
|
|
|
## 5. 변경 이력
|
|
|
|
| 날짜 | 작업 | 상태 |
|
|
|------|------|------|
|
|
| 2026-01-08 | 문서 초안 작성 | ✅ |
|
|
|
|
---
|
|
|
|
*상위 문서: [construction-api-integration-plan.md](../construction-api-integration-plan.md)* |