feat(848-7): 불러오기 엑셀 판 기계 정체 · 가져온 값 층 · 비목곱(세 줄 → 기계 한 줄) — 서버 · 계산기 짝
- 엑셀 판 기계 정체: view ↔ importView 가 기계 줄 숫자 연결에 입력 · 잠금(값 · 조종원 · 잡품) 남김 ·
작업량 엔진 기계 찾기(_machine_of ↔ machineOf)가 숫자 + 입력 기계도 봄 → 엑셀 판 작업량 줄 0 → 1,634 블록
- 가져온 값 층(새 M02_Doc_Import_Carry): 경쟁사 Q 식(굴착기 8-2-3 · 덤프 8-2-8 단일 구간) 변수 →
수식.위덮음 {단가 기호: {작업량: {식, 변수}}}(방식 없음) · 우리 식 Q = 경쟁사 Q 인 줄만(759 줄 · 571 블록) ·
M02_Doc_Import.run(upper) · M02_Doc_Sk copy_of · run 이 실음
- 비목곱: 금액 줄 선택 칸 {비목: 식} — 비목 수량 = 수량 × 곱(계산기 짝 master_doc_calc ↔ calc.ts) ·
M02_Doc_Import_Shape 세 줄 합침이 「두 줄 같은 수량 + 더한 인수」 꼴도 한 줄로(301 줄)
- 단위 정규화 「톤/hr」 = 「ton/hr」(norm_unit ↔ normUnit)
- 굳히기: 수식 고침 저장한 가져온 식 SK 사본 = 가져온 식 셈 유지(M02_Item_Sangeun · 전엔 사본 0 원) → B09 = M02
- 시험 test_848_7_import_carry 14(거울 · 견본 · 임시 storage B09)
- 전수 3,241 블록 엑셀 · 우리 판 계 · 비목 · 검산 전후 다름 0
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -20,6 +20,7 @@ import master_doc_cover as mcv
|
||||
import master_doc_work as mw
|
||||
|
||||
COSTS, BUNDLE = md.COSTS, md.BUNDLE
|
||||
TIMES = "비목곱" # 848-7 금액 줄 선택 칸 {비목: 식} — 그 비목 수량 = 수량 × 곱
|
||||
EPS = 1e-7 # B09_Estimation_Calc_Base.EPS 와 같음
|
||||
DEEP = 20 # 단가산출 부름 깊이
|
||||
_QUANT = {"버림": ROUND_DOWN, "반올림": ROUND_HALF_UP, "올림": ROUND_UP}
|
||||
@@ -416,12 +417,13 @@ def _money(run: _Run, doc: dict, rules: dict):
|
||||
else Decimal(1)
|
||||
)
|
||||
price = run.expr(line.get("단가"), where, {**scope, **more}) # 847-1 굳은 기계 단가
|
||||
times = _times(run, line, where, {**scope, **more}) # 848-7 비목곱
|
||||
kind = line.get("비목")
|
||||
parts, why, bare = {}, None, None
|
||||
if isinstance(qty, Stop) or isinstance(price, Stop):
|
||||
stopped, why = True, (qty if isinstance(qty, Stop) else price).why
|
||||
elif isinstance(qty, Blank):
|
||||
why = qty.why
|
||||
if any(isinstance(x, Stop) for x in (qty, price, times)):
|
||||
stopped, why = True, next(x for x in (qty, price, times) if isinstance(x, Stop)).why
|
||||
elif isinstance(qty, Blank) or isinstance(times, Blank):
|
||||
why = (qty if isinstance(qty, Blank) else times).why
|
||||
elif not isinstance(qty, Decimal):
|
||||
stopped, why = True, run.mark(Stop(f"{where} 수량이 수 아님", "셈 틀림", where)).why
|
||||
elif qty == 0 and not kind and line.get("합밖"):
|
||||
@@ -432,7 +434,7 @@ def _money(run: _Run, doc: dict, rules: dict):
|
||||
why = price.why
|
||||
elif kind == "묶음":
|
||||
if isinstance(price, dict) and all(isinstance(price.get(k), Decimal) for k in COSTS):
|
||||
parts = {k: qty * price[k] for k in COSTS}
|
||||
parts = {k: qty * times.get(k, 1) * price[k] for k in COSTS}
|
||||
else:
|
||||
stopped, why = (
|
||||
True,
|
||||
@@ -485,6 +487,19 @@ def _money(run: _Run, doc: dict, rules: dict):
|
||||
return outs, running, stopped, cover
|
||||
|
||||
|
||||
def _times(run: _Run, line: dict, where: str, scope: dict):
|
||||
"""848-7 비목곱 {비목: 식} → {비목: 값} · 없음 = {} · 틀림 = Stop | Blank(수량과 같은 길)."""
|
||||
out = {}
|
||||
for k, text in (line.get(TIMES) or {}).items():
|
||||
v = run.expr(text, where, scope)
|
||||
if isinstance(v, (Stop, Blank)):
|
||||
return v
|
||||
if not isinstance(v, Decimal):
|
||||
return run.mark(Stop(f"{where} 비목곱 {k} 수 아님", "셈 틀림", where))
|
||||
out[k] = v
|
||||
return out
|
||||
|
||||
|
||||
def _settle(doc: dict, rules: dict, total: dict) -> dict:
|
||||
"""비목 합 끝수 → 끝전(큰나머지) → 계 끝수 → 조정 → 비목 끝수."""
|
||||
costs = {k: cut(v, rules["비목"]) for k, v in total.items()}
|
||||
|
||||
@@ -38,6 +38,7 @@ EIGHT = Decimal(8)
|
||||
def norm_unit(u) -> str:
|
||||
t = re.sub(r"[mM]3", "㎥", re.sub(r"[mM]2", "㎡", str(u or "").strip())) # 848-6 대문자 꼴
|
||||
t = re.sub(r"(?<![A-Za-z])(M|HR|Hr|TON|Ton)(?![A-Za-z])", lambda m: m.group(1).lower(), t)
|
||||
t = re.sub(r"톤(?=/)", "ton", t) # 848-7 「톤/hr」 = 우리 식 「ton/hr」
|
||||
return re.sub(r"/(시간|h|Hr|HR)$", "/hr", t)
|
||||
|
||||
|
||||
@@ -325,12 +326,13 @@ NOT_MACHINE = ("지역", "보정작업", "조종원직종", "계약종별") #
|
||||
|
||||
def _machine_of(run, line: dict):
|
||||
"""금액 줄 단가가 부르는 기계 식 변수 → (작업 기계 입력 식, 변수 이름, 본 기계 칸인지) · 기계 줄 아님 = None ·
|
||||
부착 기계(브레이커 · 집게 입력) 줄 = 그 부착 기계(일하는 기계 — 굴착기 줄과 따로)."""
|
||||
부착 기계(브레이커 · 집게 입력) 줄 = 그 부착 기계(일하는 기계 — 굴착기 줄과 따로) ·
|
||||
숫자 연결 + 입력 「기계」 = 가져온 식 엑셀 판 기계 줄(848-7 — 값은 엑셀 · 기계 정체는 입력)."""
|
||||
node = _parse(line.get("단가"))
|
||||
for name in md.names(node) if node is not None else []:
|
||||
link = (run.vars.get(name) or {}).get("연결") or {}
|
||||
given = link.get("입력") or {}
|
||||
if link.get("갈래") == "단가산출" and "기계" in given:
|
||||
if link.get("갈래") in ("단가산출", "숫자") and "기계" in given:
|
||||
tool = [v for k, v in given.items() if k != "기계" and k not in NOT_MACHINE]
|
||||
return str(tool[-1] if tool else given["기계"]), name, not tool
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user