Add preview functionality for outsource purchase order numbers

- Introduced a new endpoint `/preview-order-no` to generate order numbers based on registered numbering rules without incrementing the sequence.
- Implemented the `previewOrderNo` function in the `outsourcePurchaseController` to handle the logic for generating the preview order number.
- Updated the `outsourcePurchaseRoutes` to include the new route for previewing order numbers.
- Enhanced the `RegistrationModal` component to automatically fill the order number input with the preview value when the modal opens.
- Added a new API function `previewOrderNo` in the frontend to call the backend endpoint.

(TASK:ERP-019)
This commit is contained in:
kjs
2026-05-06 18:33:23 +09:00
parent 970a8f708a
commit fa0a28df42
5 changed files with 251 additions and 8 deletions

View File

@@ -182,6 +182,22 @@ export async function autoProcesses(
}
}
// ─────────────────────────────────────────────────────────────────────────────
// 외주발주번호 미리보기 — 모달 진입 시 input 자동 채움용 (시퀀스 증가 없음)
// ─────────────────────────────────────────────────────────────────────────────
export async function previewOrderNo(
req: AuthenticatedRequest,
res: Response,
) {
try {
const companyCode = req.user!.companyCode;
const code = await svc.previewOrderNo(companyCode);
return ok(res, { generatedCode: code || "" });
} catch (e: any) {
return fail(res, 500, e?.message || "외주발주번호 미리보기 실패", e);
}
}
// ─────────────────────────────────────────────────────────────────────────────
// 공정 자재투입(material_input) 자동 채움
// — 사급자재 체크 시 해당 공정의 자재 목록을 외주발주 자재 형식으로 반환