fix(dispatch): 사방넷 코드 맵 비면 공란 파일 대신 명확한 에러
사방넷 코드 맵이 통째로 비어 상품코드[필수] 열이 전부 공란이 되는 경우, 조용히 잘못된 파일을 주지 않고 single_items/set_items SELECT 권한/등록 확인을 안내하는 422 를 반환. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -448,6 +448,20 @@ async def stock_export(
|
||||
detail += f" (itemcode 리더 오류: {hint})"
|
||||
raise HTTPException(status_code=422, detail=detail)
|
||||
|
||||
# 사방넷 코드 맵이 통째로 비어 있으면 A열(상품코드[필수])이 전부 공란이 된다.
|
||||
# 보통 itemcode_ro 의 single_items/set_items SELECT 권한 누락이 원인.
|
||||
reader = getattr(request.app.state, "malaysia_itemcode", None)
|
||||
if getattr(reader, "enabled", False) and not sabangnet_map:
|
||||
hint = getattr(reader, "last_error", "") or getattr(reader, "reason", "")
|
||||
detail = (
|
||||
"사방넷 코드 맵이 비어 있어 상품코드[필수] 열을 채울 수 없습니다. "
|
||||
"itemcode_db 의 single_items/set_items 에 sabangnet_code 가 등록돼 있는지, "
|
||||
"읽기 전용 역할(itemcode_ro)에 두 테이블 SELECT 권한이 있는지 확인하세요."
|
||||
)
|
||||
if hint:
|
||||
detail += f" (itemcode 리더 오류: {hint})"
|
||||
raise HTTPException(status_code=422, detail=detail)
|
||||
|
||||
xlsx_bytes = export.build_stock_xlsx(rows=rows, set_bom=set_bom, sabangnet_map=sabangnet_map)
|
||||
fname = export.stock_filename(d)
|
||||
headers = {
|
||||
|
||||
Reference in New Issue
Block a user