From e7263feecf92e7e29320307cd353577a97225e8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B6=8C=ED=98=81=EC=84=B1?= Date: Fri, 6 Mar 2026 21:09:48 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20[=ED=92=88=EC=A7=88=EA=B4=80=EB=A6=AC]?= =?UTF-8?q?=20=EC=88=98=EC=A3=BC=20=EC=97=B0=EA=B2=B0=20=EB=8F=99=EA=B8=B0?= =?UTF-8?q?=ED=99=94=20+=20=EA=B0=9C=EC=86=8C=EB=B3=84=20=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=84=B0=20=EC=A0=80=EC=9E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - transformApiToFrontend에 orderId, inspectionData 매핑 추가 - transformFormToApi에 order_ids 추가 - updateInspection에 order_ids 동기화 + locations 데이터 전송 --- .../quality/InspectionManagement/actions.ts | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/components/quality/InspectionManagement/actions.ts b/src/components/quality/InspectionManagement/actions.ts index 8170a3bb..6cd2174b 100644 --- a/src/components/quality/InspectionManagement/actions.ts +++ b/src/components/quality/InspectionManagement/actions.ts @@ -220,6 +220,7 @@ function transformApiToFrontend(api: ProductInspectionApi): ProductInspection { }, orderItems: (api.order_items || []).map((item) => ({ id: item.id, + orderId: item.order_id, orderNumber: item.order_number, siteName: item.site_name || '', deliveryDate: item.delivery_date || '', @@ -230,6 +231,7 @@ function transformApiToFrontend(api: ProductInspectionApi): ProductInspection { constructionWidth: item.construction_width, constructionHeight: item.construction_height, changeReason: item.change_reason, + inspectionData: item.inspection_data || undefined, })), }; } @@ -281,6 +283,8 @@ function transformFormToApi(data: InspectionFormData): Record { phone: data.supervisor?.phone || '', }, }, + // 수주 연결 + order_ids: data.orderItems?.map((item) => item.orderId ?? Number(item.id)) ?? [], }; } @@ -555,6 +559,23 @@ export async function updateInspection( apiData.options = options; } + // 수주 연결 동기화 (orderItems에서 orderId 추출) + if (data.orderItems !== undefined) { + apiData.order_ids = data.orderItems.map((item) => { + // orderId가 있으면 사용, 없으면 id를 숫자로 변환 + return item.orderId ?? Number(item.id); + }); + + // 개소별 데이터 (시공규격, 변경사유, 검사데이터) + apiData.locations = data.orderItems.map((item) => ({ + id: Number(item.id), + post_width: item.constructionWidth || null, + post_height: item.constructionHeight || null, + change_reason: item.changeReason || null, + inspection_data: item.inspectionData || null, + })); + } + const result = await executeServerAction({ url: buildApiUrl(`/api/v1/quality/documents/${id}`), method: 'PUT',