From ffa6e58a7cf5e08b9e7a41e0a4de1c39632cabb5 Mon Sep 17 00:00:00 2001 From: Hyungi Ahn Date: Wed, 23 Jul 2025 10:46:47 +0900 Subject: [PATCH] =?UTF-8?q?=EC=97=91=EC=85=80=20=EB=82=B4=EB=B3=B4?= =?UTF-8?q?=EB=82=B4=EA=B8=B0=20=EA=B0=84=EC=86=8C=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 불필요한 BOM 수량, 단위, 계산과정 컬럼 제거 - 필요 수량과 구매 단위만 표시하도록 개선 - 리비전 비교시에도 구매 수량 변화 정보만 표시 - 더 깔끔하고 실용적인 엑셀 파일 생성 --- frontend/src/utils/excelExport.js | 60 +++++++------------------------ 1 file changed, 12 insertions(+), 48 deletions(-) diff --git a/frontend/src/utils/excelExport.js b/frontend/src/utils/excelExport.js index 583b0d9..bcd14fc 100644 --- a/frontend/src/utils/excelExport.js +++ b/frontend/src/utils/excelExport.js @@ -109,60 +109,24 @@ const formatMaterialForExcel = (material, includeComparison = false) => { '라인 번호': material.line_number || '-' }; - // 파이프인 경우 길이(m) 표시, 그 외는 수량 - if (isPipe) { - // consolidateMaterials에서 이미 계산된 totalLength 사용 - const totalLength = material.totalLength || 0; - const itemCount = material.itemCount || material.quantity || 0; - - base['길이(m)'] = totalLength > 0 ? totalLength.toFixed(2) : 0; - base['개수'] = itemCount; - base['단위'] = 'M'; - } else { - base['수량'] = material.quantity || 0; - base['단위'] = material.unit || 'EA'; - } - - // 구매 수량 정보 추가 + // 구매 수량 정보만 추가 (기존 수량/단위 정보 제거) base['필요 수량'] = purchaseInfo.purchaseQuantity || 0; base['구매 단위'] = purchaseInfo.unit || 'EA'; - base['계산 과정'] = purchaseInfo.calculation || '-'; - // 비교 모드인 경우 추가 정보 + // 비교 모드인 경우 구매 수량 변화 정보만 추가 if (includeComparison) { if (material.previous_quantity !== undefined) { - if (isPipe) { - const prevTotalLength = material.previousTotalLength || 0; - const currTotalLength = material.totalLength || 0; - - base['이전 길이(m)'] = prevTotalLength > 0 ? prevTotalLength.toFixed(2) : 0; - base['현재 길이(m)'] = currTotalLength > 0 ? currTotalLength.toFixed(2) : 0; - base['길이 변경(m)'] = ((currTotalLength - prevTotalLength)).toFixed(2); - base['이전 개수'] = material.previous_quantity; - base['현재 개수'] = material.current_quantity; - - // 이전/현재 구매 수량 계산 - const prevPurchaseInfo = calculatePurchaseQuantity({ - ...material, - quantity: material.previous_quantity, - totalLength: prevTotalLength - }); - base['이전 필요 수량'] = prevPurchaseInfo.purchaseQuantity || 0; - base['필요 수량 변경'] = (purchaseInfo.purchaseQuantity - prevPurchaseInfo.purchaseQuantity); - } else { - base['이전 수량'] = material.previous_quantity; - base['현재 수량'] = material.current_quantity; - base['변경량'] = material.quantity_change; - - // 이전/현재 구매 수량 계산 - const prevPurchaseInfo = calculatePurchaseQuantity({ - ...material, - quantity: material.previous_quantity - }); - base['이전 필요 수량'] = prevPurchaseInfo.purchaseQuantity || 0; - base['필요 수량 변경'] = (purchaseInfo.purchaseQuantity - prevPurchaseInfo.purchaseQuantity); - } + // 이전 구매 수량 계산 + const prevPurchaseInfo = calculatePurchaseQuantity({ + ...material, + quantity: material.previous_quantity, + totalLength: material.previousTotalLength || 0 + }); + + base['이전 필요 수량'] = prevPurchaseInfo.purchaseQuantity || 0; + base['필요 수량 변경'] = (purchaseInfo.purchaseQuantity - prevPurchaseInfo.purchaseQuantity); } + base['변경 유형'] = material.change_type || ( material.previous_quantity !== undefined ? '수량 변경' : material.quantity_change === undefined ? '신규' : '변경'