From 13f76a72d70ba101a2a0c17f89fc80dc6d249270 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=B3=B4=EA=B3=A4?= Date: Tue, 17 Mar 2026 14:21:36 +0900 Subject: [PATCH] =?UTF-8?q?docs:=20[api-specs]=20=EC=A0=88=EA=B3=A1?= =?UTF-8?q?=ED=92=88=20LOT=20API=20v2=20=E2=80=94=20=EC=9B=90=EC=9E=90?= =?UTF-8?q?=EC=9E=AC=20LOT=20=EC=A1=B0=ED=9A=8C,=20=EC=B7=A8=EC=86=8C=20?= =?UTF-8?q?=EB=B3=B5=EC=9B=90,=20=EB=8B=B4=EB=8B=B9=EC=9E=90=20=EA=B8=B0?= =?UTF-8?q?=EB=B3=B8=EA=B0=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/api-specs/bending-lot-api.md | 98 ++++++++++++++++++++++++++- 1 file changed, 96 insertions(+), 2 deletions(-) diff --git a/frontend/api-specs/bending-lot-api.md b/frontend/api-specs/bending-lot-api.md index 296c4c0..268b726 100644 --- a/frontend/api-specs/bending-lot-api.md +++ b/frontend/api-specs/bending-lot-api.md @@ -18,7 +18,9 @@ | `GET` | `/api/v1/bending/code-map` | 드롭다운 코드 체계 전체 조회 | | `GET` | `/api/v1/bending/resolve-item` | 선택 조합 → 품목 매핑 조회 | | `POST` | `/api/v1/bending/generate-lot` | LOT 번호 생성 (일련번호 포함) | +| `GET` | `/api/v1/bending/material-lots` | 원자재 LOT 목록 (수입검사 완료 입고) | | `POST` | `/api/v1/orders` | 재고생산 저장 (기존 API, options 확장) | +| `PATCH` | `/api/v1/orders/{id}/status` | 상태 변경 (취소→등록 복원 포함) | ### 1.2 인증 @@ -214,7 +216,99 @@ GI6317-53-001 --- -## 5. 재고생산 저장 (기존 API 확장) +## 5. 원자재 LOT 목록 조회 + +``` +GET /api/v1/bending/material-lots?material={재질명} +``` + +수입검사가 완료된(`status=completed`) 입고 건 중 재질이 일치하는 LOT 목록을 반환한다. +원자재 LOT 선택 모달에서 사용한다. + +### 파라미터 + +| 파라미터 | 필수 | 설명 | 예시 | +|---------|------|------|------| +| `material` | △ | 원자재 재질명 (부분 일치 검색) | `SUS 1.2T`, `EGI 1.55T`, `화이바원단` | + +### 응답 + +```json +{ + "success": true, + "data": [ + { + "id": 42, + "lot_no": "RM-20260301-001", + "supplier_lot": "SUP-2026-A123", + "item_name": "SUS 1.2T", + "specification": "1219 × 2438", + "receiving_qty": "500.00", + "receiving_date": "2026-03-01", + "supplier": "○○철강", + "options": { + "inspection_status": "적", + "inspection_result": "합격" + } + } + ] +} +``` + +### 프론트엔드 사용법 + +```typescript +// 원자재 재질은 code-map의 material_map에서 결정 +const material = codeMap.material_map[`${prodCode}:${specCode}`]; +// 예: 'SUS 1.2T', 'EGI 1.55T', '화이바원단' + +// 해당 재질의 입고 LOT 목록 조회 +const lots = await fetchMaterialLots(material); +// → 모달에서 사용자가 LOT 선택 +``` + +--- + +## 6. 취소 → 등록 복원 + +``` +PATCH /api/v1/orders/{id}/status +``` + +기존 상태 변경 API를 사용한다. `CANCELLED → DRAFT` 전환이 허용된다. + +### 요청 + +```json +{ + "status": "DRAFT" +} +``` + +### 상태 전환 규칙 + +| 현재 상태 | 가능한 전환 | +|----------|-----------| +| `DRAFT` | `CONFIRMED`, `CANCELLED` | +| `CONFIRMED` | `IN_PROGRESS`, `CANCELLED` | +| `IN_PROGRESS` | `COMPLETED`, `CANCELLED` | +| `COMPLETED` | (변경 불가) | +| **`CANCELLED`** | **`DRAFT` (복원)** | + +### 프론트엔드 구현 + +취소 상태일 때 "수정" 버튼 또는 "복원" 버튼을 표시하고, 클릭 시 `updateStockOrderStatus(id, 'draft')`를 호출한다. + +--- + +## 7. 담당자 기본값 + +STOCK 주문 생성 시 `options.manager_name`이 비어 있으면 **로그인 사용자 이름이 자동 설정**된다. +프론트엔드에서 별도 처리 불필요. 저장 후 응답에서 `manager_name`이 채워져 돌아온다. + +--- + +## 8. 재고생산 저장 (기존 API 확장) ``` POST /api/v1/orders @@ -382,4 +476,4 @@ if (bendingLot) { --- -**최종 업데이트**: 2026-03-17 +**최종 업데이트**: 2026-03-17 (v2: 원자재 LOT 조회, 취소 복원, 담당자 기본값 추가)