fix(m02-df): 흐름 셈 = 옛 셈 — 빈 단가 줄을 부르는 덧줄은 빈 값 · 전수 1,472 모두 맞음
- 빈 단가(blank) 요소 값 = 「#N/A」(서버 Compute · 화면 값 받기 Entry_Detail · Api CfAnswer.blank) → 그 값을 쓰는 식은 빈 값 · 결과가 오류일 때만 끊긴 곳 「단가 없는 품목을 씀」(Eval NoPrice · Compute 같음) - 변환: 비목 합 · 덧줄의 비목 이름 = 빈 줄 0(SUM(IFERROR…)) · 호표 줄 = IF(수량=0,0,수량×단가) · 줄.이름은 빈 줄이면 빈 값(옛 env 줄) - 오류 값 칸은 NA() 로(Compute _is_err · Eval isErrorValue) - Compute 700줄 넘어 표 찾기 · 값 같음을 M02_DF_Lookup.py 로 나눔(Compute 가 다시 내보냄) - 전수 대조 시험입력 · 기본 입력 1,472/1,472 · 시험 test_m02_df_model 37 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VBToTCGk5dqDKeXCEP3vhk
This commit is contained in:
@@ -284,6 +284,12 @@ class _Flow:
|
||||
return take({"box": self.logic(node), "name": "결과"}, f"{node[1]} 결과")
|
||||
if kind == "@port":
|
||||
return take(node[1], node[1]["name"])
|
||||
if kind == "@sum0": # 비목 합 — 빈 줄(빈 단가 · 못 셈 덧줄)은 0(옛 엔진 sums += 0)
|
||||
cells = [f"IFERROR({take(p, p['name'])},0)" for p in node[1]]
|
||||
return f"SUM({','.join(cells)})" if cells else "0"
|
||||
if kind == "@line": # 호표 줄 수량 × 단가 — 수량 0 이면 0(옛 엔진 · 빈 단가여도)
|
||||
q, p = self.excel(node[1], take, scope), self.excel(node[2], take, scope)
|
||||
return f"IF({q}=0,0,{q}*{p})"
|
||||
if kind == "@sum":
|
||||
cells = [take(p, p["name"]) for p in node[1]]
|
||||
return f"SUM({','.join(cells)})" if cells else "0"
|
||||
@@ -294,8 +300,8 @@ class _Flow:
|
||||
raise Unsupported(f"모르는 식 마디 「{kind}」")
|
||||
|
||||
def name(self, name: str, take, scope: dict) -> str:
|
||||
if name in scope: # 덧줄의 비목 합 · 줄 금액
|
||||
return self.excel(("@sum", scope[name]), take, scope)
|
||||
if name in scope: # 덧줄의 비목 합(빈 줄 = 0) · 줄 금액(빈 줄이면 빈 값 — 옛 env 「줄」)
|
||||
return self.excel(("@sum0" if name in COSTS else "@sum", scope[name]), take, scope)
|
||||
if name in self.named:
|
||||
return take(self.named[name], name)
|
||||
if name in self.specs:
|
||||
@@ -382,7 +388,7 @@ def _body(f: _Flow, row: dict) -> None:
|
||||
ref = item["요소"] # 그룹 = 키 앞 두 글자(「MO:경유:{지역}」 = 유가전력) · 없으면 줄 종류
|
||||
group = GROUP_OF.get(ref[:2], str(item.get("종류"))) if isinstance(ref, str) else "재료"
|
||||
price = f.priced(group, ref, unit, f"{name} 단가")
|
||||
part = f.func(f"{name} 금액", ("bin", "*", qty, price))
|
||||
part = f.func(f"{name} 금액", ("@line", qty, price))
|
||||
parts[item["비목"]].append(part)
|
||||
lines.setdefault(f"줄.{name}", []).append(part)
|
||||
for extra in row.get("덧줄") or []:
|
||||
@@ -392,7 +398,7 @@ def _body(f: _Flow, row: dict) -> None:
|
||||
parts[extra["비목"]].append(part)
|
||||
for c in COSTS:
|
||||
if parts[c]:
|
||||
_output(f, c, c, f.func(f"{c} 합", ("@sum", parts[c])), rule, "계")
|
||||
_output(f, c, c, f.func(f"{c} 합", ("@sum0", parts[c])), rule, "계")
|
||||
|
||||
|
||||
# ── 자동 배치 ────────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user