diff --git a/M01_MasterData/M01_MasterData_Api_Fetch.ts b/M01_MasterData/M01_MasterData_Api_Fetch.ts index 156930c0..d7b4eb05 100644 --- a/M01_MasterData/M01_MasterData_Api_Fetch.ts +++ b/M01_MasterData/M01_MasterData_Api_Fetch.ts @@ -175,3 +175,28 @@ export const fetchPick = ( kind: PickKind, q: string, ): Promise<{ total: number; items: PickItem[] }> => get("/pick", { kind, q, limit: 50 }); + +/** 조합 알약 물량 하나 — 담은 로직 결과단위 분모(같은 이름 · 단위는 합침) · `배` = 원/10㎡ 의 10 */ +export interface ComboQuantity { + 키: string; + 이름: string; + 단위: string; + 로직: string[]; + 배?: number; +} + +export const fetchComboInputs = ( + combo: string, +): Promise<{ 키: string; 이름: string; 물량: ComboQuantity[]; 조건: unknown[] }> => + get(`/combo/${encodeURIComponent(combo)}/inputs`, {}); + +/** 자재 찾기 — `/pick?kind=price` 감쌈 · 이름·규격 낱말이 모두 든 줄 */ +export const searchMaterials = async ( + q: string, +): Promise<{ 코드: string; 이름: string; 규격: string; 단위: string }[]> => + (await fetchPick("price", q)).items.map((m) => ({ + 코드: m.ref, + 이름: m.이름, + 규격: m.규격, + 단위: m.단위, + }));