엑셀 내보내기 간소화

- 불필요한 BOM 수량, 단위, 계산과정 컬럼 제거
- 필요 수량과 구매 단위만 표시하도록 개선
- 리비전 비교시에도 구매 수량 변화 정보만 표시
- 더 깔끔하고 실용적인 엑셀 파일 생성
This commit is contained in:
Hyungi Ahn
2025-07-23 10:46:47 +09:00
parent 905344681f
commit ffa6e58a7c

View File

@@ -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 ? '신규' : '변경'