From b919f3ae305976e95cb1063a416565e08550fa66 Mon Sep 17 00:00:00 2001 From: king Date: Wed, 27 May 2026 00:26:30 +0900 Subject: [PATCH] =?UTF-8?q?=EA=B2=B0=EA=B3=BC=20=EC=97=91=EC=85=80?= =?UTF-8?q?=EC=9D=84=20A=EC=97=B4(=EC=82=AC=EB=B0=A9=EB=84=B7=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C)=20=EC=98=A4=EB=A6=84=EC=B0=A8=EC=88=9C=20=EC=A0=95?= =?UTF-8?q?=EB=A0=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 문자열 비교 기준 정렬 (숫자/문자 혼재 대비) - mergesort 로 안정 정렬 보장 - pandas to_excel 은 헤더를 별도로 다루므로 1행 헤더는 영향 없음 Co-Authored-By: Claude Sonnet 4.6 --- app/routers/orders.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/routers/orders.py b/app/routers/orders.py index 1d932a3..ec5855b 100644 --- a/app/routers/orders.py +++ b/app/routers/orders.py @@ -814,6 +814,13 @@ def upload_file( ) df_out = pd.DataFrame(excel_rows, columns=["상품코드[필수]", "가용수량", "불용수량"]) + # A열(사방넷 코드) 기준 오름차순 정렬 — 헤더는 영향 받지 않음 + if not df_out.empty: + df_out = df_out.sort_values( + by="상품코드[필수]", + key=lambda col: col.astype(str), + kind="mergesort", + ).reset_index(drop=True) # 엑셀 파일 쓰기 (1행 헤더, 2행부터 데이터 — pandas to_excel 기본 동작) # 작성 직후 A~C 열 너비를 콘텐츠 길이에 맞춰 자동 조절한다.