feat(797-1): 엑셀 불러오기 요소 연결 — 기계 이음 [우리 단가로] 셈 · 유가 · 환율 이음 · 산근 속 산근 형제 참조 · 읽기 불가 사유 응답

- 기계(EQ) 이음 줄 [우리 단가로] = 시간당 기계경비의 그 비목(옛 Decimal × dict 실패 387 블록 풀림) · 시간당 자료 없는 EQ = 엑셀 단가 그대로
- 내보내기 `_m01` = 유가(MO) · 환율(FX) 유일 짝만 자동 · 여럿 = 표지 · 화폐는 이름 그대로일 때만(「유로폼」 오판 막음)
- 산근 속 산근 = 같은 엑셀 안쪽 블록을 형제 가져온 식 SK 로 먼저 만들어 `참조`(비목 한 줄 부름 = `참조비목`) · 단가기준 따라감 · 못 잇는 줄 = 얼림 + 표지
- 쓰는 곳 · 층 복사 · 프로젝트 굳힘이 가져온 호표 참조를 봄(`Labor_Ref.refs_in` · `_move_doc`)
- 올림 응답 `읽기불가` + 화면 토스트
- 시험 test_797_1_import_links 9 · 낡은 시험 없음

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-07 14:17:06 +09:00
co-authored by Claude Sonnet 5.5
parent b608d2aa3d
commit 430aaa9aae
10 changed files with 390 additions and 23 deletions
+36 -7
View File
@@ -176,15 +176,40 @@ def reprice(logic: dict, where: dict, price: dict[str, float]) -> int:
return n
def _m01(kind: str, src: dict) -> str | None:
"""1차 줄 판정 유일 짝 M01 키 — 없거나 여럿 = None."""
def _m01(kind: str, src: dict) -> tuple[str | None, str | None]:
"""1차 줄 판정 유일 짝 M01 키 → (키, 표지) — 없음 = (None, None) · 여럿 = (None, 표지 · 유가 ·
환율만 — 재료 · 인력 · 기계는 지금처럼 조용히 이음 없음). 재료 줄 이름이 M01 유가전력(MO)이면
유가 · 화폐 이름 그대로(달러 · USD …)면 환율(FX)로 판정(797-1 · 「유로폼」 같은 글 속 낱말은 아님)."""
if kind not in ("인력", "재료", "기계"):
return None
return None, None
from M02_MasterTemplete import M02_Hopyo_Elem as elem
from M02_MasterTemplete import M02_Hopyo_Row as hrow
got = hrow.m01_picks(kind, {k: src.get(k) or "" for k in ("이름", "규격", "단위")})
line = {k: src.get(k) or "" for k in ("이름", "규격", "단위")}
if kind == "재료":
if elem.oil_rows(line["이름"]):
kind = "유가"
elif line["이름"].strip().upper() in {x.upper() for pair in hrow.CURRENCY for x in pair}:
kind = "환율"
if kind == "유가": # MO 전부 → 줄 규격이 상세구분(전국 · 지역)이면 그것만
got = [
{"키": r["키"], "규격": str(r.get("상세구분") or "")}
for r in elem.oil_rows(line["이름"])
]
spec = line["규격"].replace(" ", "")
got = (
[x for x in got if x["규격"] == spec]
or [x for x in got if spec and spec in x["규격"]]
or got
)
else:
got = hrow.m01_picks(kind, line)
keys = {x.get("키") for x in got if x.get("키")}
return keys.pop() if len(keys) == 1 else None
if len(keys) == 1:
return keys.pop(), None
if len(keys) > 1 and kind in ("유가", "환율"):
return None, f"{NOTE}{kind} 후보 여럿({len(keys)}) · 사람 확인"
return None, None
# ── 내보낼 로직 틀 ─────────────────────────────────────────────────────
@@ -371,9 +396,11 @@ class _Stm:
if not one_ and len(sole) == 1: # 비목 꼬리 없어도 값 든 비목 하나면 단가 줄(셈 같음)
one_, to = sole[0], None
res |= {"비목": one_, "옮김": to} if one_ else {}
link = _m01(res["갈래"], res) if self.keys else None
link, many = _m01(res["갈래"], res) if self.keys else (None, None)
one = resource(o.names.item(name), pr.get("단위"), cf, res, link)
self.line(one, node, True, src)
if many:
o.glyph(src["행"], src["글"], mark=many)
def rate(self, node: dict, src: dict, cf: str) -> None:
rate, o = node["율"], self.o
@@ -558,11 +585,13 @@ def est(block: dict, lines: list[dict], want: dict, keys: bool = False, file: st
i, role = next((i, r) for i, r in L["역할"].items() if r["갈래"] == "단가")
price = next(n[1] for n in ex.numbers(L["식"]) if n[2] == i)
res = _est_res(role, price, comp)
link = _m01(res["갈래"], res) if keys else None
link, many = _m01(res["갈래"], res) if keys else (None, None)
qty = text(L["식"], {}, {i: "1"})
one = resource(o.names.item(L.get("라벨") or ""), None, qty, res, link)
one |= {**head, **({"자리": place} if place else {})}
o.add_line(one, True, at, glyph, L["값"])
if many:
o.glyph(at, glyph, mark=many)
if role.get("모호"): # 임의 선택 아님 — 후보를 사람이 고름
o.glyph(at, glyph, mark=f"{NOTE}단가 후보 여럿({role['남은']}) · 사람 확인")
elif role.get("갈림") in ("문맥", "기계 세 줄"):