feat(inout): 입고 기록 줄 [사방넷 입고 파일] 엑셀 다운로드
- 1행 제목 상품코드·가용수량·불용수량, A=코드표 사방넷 코드, B=입고 수량, C=상품 이름 - 사방넷 코드가 없는 상품·코드표 연결 불가면 파일 대신 안내 - 발주·입고 담당, 마이그레이션 없음 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -75,6 +75,18 @@ class SingleItemReader:
|
||||
return None
|
||||
return {str(r["item_code"]).strip().upper(): str(r.get("name") or "").strip() for r in rows}
|
||||
|
||||
def sabangnet_codes(self, codes: list[str]) -> dict[str, str] | None:
|
||||
"""코드들 → {코드(대문자): 사방넷 코드}(사방넷 입고 파일, 2026-10-19). 사방넷 코드가 빈 단품은 ''. 조회 불가면 None."""
|
||||
if not self.enabled or not self._pool:
|
||||
return None
|
||||
wanted = sorted({c.strip().upper() for c in codes if c and c.strip()})
|
||||
if not wanted:
|
||||
return {}
|
||||
rows = self._run("SELECT item_code, sabangnet_code FROM single_items WHERE upper(item_code) = ANY(%(codes)s)", {"codes": wanted})
|
||||
if rows is None:
|
||||
return None
|
||||
return {str(r["item_code"]).strip().upper(): str(r.get("sabangnet_code") or "").strip() for r in rows}
|
||||
|
||||
def _run(self, sql: str, params: dict[str, Any]) -> list[dict[str, Any]] | None:
|
||||
try:
|
||||
with self._pool.connection() as conn:
|
||||
|
||||
Reference in New Issue
Block a user