Merge remote-tracking branches 'origin/sub_laptop_4', 'origin/sub_laptop_5' and 'origin/sub_laptop_8' into sub_laptop_1
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
M01 상세 부품(`M01_MasterData_UI_Logic_Api.ts` · `Api_Fetch.ts` · `Logic_Note.ts`)이 길 앞머리만
|
||||
`/m02/logic-lib` 로 바꿔 부름 — 길 · 몸 · 답 = M01 `/api/m01/…` 와 같음(M01 길 함수를 부름).
|
||||
쓰기 없음 — `/calc` · `/text` 의 `row`(저장 안 한 고친 줄)는 메모리 사본에서만 셈(`Store._swap`).
|
||||
쓰기 없음 · 옛 셈 길 `/calc` · `/text` 는 855 2-E1 에 걷음(화면 부름 0).
|
||||
`/logics` · `/subs` · `/logic` · 원문은 `M02_MasterTemplete_Router_Combos.py` 에 있음.
|
||||
"""
|
||||
|
||||
@@ -21,11 +21,6 @@ ROW_FILES = ("인력", "재료", "기계")
|
||||
TABLE_FILES = ("소요량_", "계수_")
|
||||
|
||||
|
||||
@router.get("/logic/auto")
|
||||
def get_auto(key: str) -> dict:
|
||||
return m01.get_logic_auto(key)
|
||||
|
||||
|
||||
@router.get("/elements")
|
||||
def get_elements(group: str, q: str = "", limit: int = 50) -> dict:
|
||||
return m01.get_elements(group, q, min(limit, 200))
|
||||
@@ -58,17 +53,6 @@ def get_table(file: str, key: str) -> dict:
|
||||
return m01.get_table(file, key)
|
||||
|
||||
|
||||
@router.post("/calc")
|
||||
def post_calc(body: m01.CalcBody) -> dict:
|
||||
"""M01 `/calc` 와 같음 — `row` = 저장 안 한 고친 줄(셈만 · 쓰기 없음)."""
|
||||
return m01.post_calc(body)
|
||||
|
||||
|
||||
@router.post("/text")
|
||||
def post_text(body: m01.CalcBody) -> dict:
|
||||
return m01.post_text(body)
|
||||
|
||||
|
||||
@router.get("/machine-hourly")
|
||||
def get_machine_hourly(key: str) -> dict:
|
||||
"""기계(EQ) 한 시간 값 노 · 재 · 경(736-3 · [항목 추가] 기계 고정 줄 단가)."""
|
||||
|
||||
@@ -267,21 +267,6 @@ def _top_add(key: str) -> bool:
|
||||
return bool(hit) and not hit[2]
|
||||
|
||||
|
||||
def kinds(doc: dict, spot: str) -> list[str]:
|
||||
"""자리의 덮개 갈래 — 품 · 단가 · 상수 · 표값 · 뺌(차례 그대로)."""
|
||||
cover, out = (doc.get("덮개") or {}).get(spot) or {}, []
|
||||
if "qty" in cover or "배율" in cover:
|
||||
out.append("품")
|
||||
if any(k in cover for k in sd.PARTS):
|
||||
out.append("단가")
|
||||
out += [
|
||||
n
|
||||
for n, k in (("상수", "상수덮개"), ("표값", "표값덮개"), ("식", "식덮개"))
|
||||
if spot in (doc.get(k) or {})
|
||||
]
|
||||
return out + (["뺌"] if spot in (doc.get("뺀줄") or []) else [])
|
||||
|
||||
|
||||
# ── 셈 답 ──────────────────────────────────────────────────────────
|
||||
def answer(got: dict, clean: dict) -> dict:
|
||||
"""`M02_Sangeun_Calc.calc_doc` 답 — 셈 답(1 단위 몫) + 가져온 식 원본 보기(옛 `원래` · `시트` · 머리 걷음)."""
|
||||
|
||||
@@ -16,9 +16,7 @@
|
||||
재생성 = 지금 M01 로 새로 찍음 — 덮개 · 식덮개 · 변수줄 · 상수 · 표값 · 까닭은 cid 열쇠라
|
||||
새 사본에 그대로 얹힘 · 못 얹은 칸 = 짝잃음.
|
||||
저장 때 = 사본에 없는 새 줄(더한줄 로직 더함 · 기초 바꿈)만 지금 M01 에서 더함.
|
||||
길(`M02_Sangeun_Router`): POST …/sangeun/copy/{price|regen} 몸 {문서, 입력값?} →
|
||||
{문서(사본할일), 전, 후, 바뀐자원 [{키, 이름, 전, 후, 지워짐?}] · 못얹은 [{cid, 까닭}]}
|
||||
(저장 없음).
|
||||
미리 셈 = `M02_Doc_Sk_Path.preview`(몸 `할일` · 옛 `preview` 는 걷음 · 855 2-E2).
|
||||
셈 답 덧칸 `사본` = {시점, 단가시점, M01새판, 지운키, 단가새값} · 같은 내용 지문 몫 = `same_part`.
|
||||
"""
|
||||
|
||||
@@ -386,43 +384,3 @@ def same_part(doc: Any) -> str | None:
|
||||
seen = state(copy, whole_())
|
||||
fresh = not (seen["M01새판"] or seen["지운키"] or seen["단가새값"])
|
||||
return None if fresh else f"{copy.get('판')}:{copy.get('단가판')}"
|
||||
|
||||
|
||||
# ── [단가 갱신] · [재생성] 미리 셈(저장 없음) ──────────────────────────
|
||||
def _money(ans: dict) -> dict | None:
|
||||
base = ans.get("기준")
|
||||
return {k: base.get(k) for k in ("노무비", "재료비", "경비", "계")} if base else None
|
||||
|
||||
|
||||
def _lost(ans: dict) -> dict[str, dict]:
|
||||
rows = [*(ans.get("짝잃음") or []), *((ans.get("시트") or {}).get("짝잃음") or [])]
|
||||
return {str(x.get("cid")): x for x in rows if isinstance(x, dict)}
|
||||
|
||||
|
||||
def preview(doc: Any, job: str, given: dict | None = None) -> dict[str, Any]:
|
||||
"""{문서(할일 얹음), 전, 후, 바뀐자원 · 못얹은} — 재생성은 단가갱신을 품음."""
|
||||
from M02_MasterTemplete import M02_Sangeun_Calc as calc
|
||||
|
||||
if not isinstance(doc, dict):
|
||||
raise sd.DocError("단가산출 문서가 묶음 아님")
|
||||
old = doc.get(JOB)
|
||||
new = REGEN if REGEN in (old, job) else job
|
||||
after_doc = {**doc, JOB: new}
|
||||
before = calc.calc_doc(doc, given)
|
||||
after = calc.calc_doc(after_doc, given)
|
||||
out: dict[str, Any] = {"문서": after_doc, "전": _money(before), "후": _money(after)}
|
||||
if cut := [
|
||||
str(x.get("이름") or x.get("로직")) for x in doc.get("더한줄") or [] if x.get("끊음")
|
||||
]:
|
||||
out["끊은기초"] = cut # 줄은 그대로 · 자원 단가만(요구 656-1)
|
||||
if job == PRICE:
|
||||
copy = _stored(doc.get("키")) or taken(held(doc))
|
||||
out["바뀐자원"] = refresh(copy, whole_())[1] if copy else []
|
||||
else:
|
||||
was = _lost(before)
|
||||
out["못얹은"] = [
|
||||
{"cid": c, "까닭": x.get("까닭") or "새 사본에 그 줄 없음"}
|
||||
for c, x in _lost(after).items()
|
||||
if c not in was
|
||||
]
|
||||
return out
|
||||
|
||||
@@ -456,74 +456,3 @@ def _path(deps: dict, start: str, goal: str) -> list[str] | None:
|
||||
seen.add(nxt)
|
||||
todo.append([*path, nxt])
|
||||
return None
|
||||
|
||||
|
||||
# ── 셈 답 덧칸(790-2 `시트`) ─────────────────────────────────────────
|
||||
def sheet_more(spots: dict, base: dict, clean: dict, mids: dict) -> list[dict]:
|
||||
"""790-2 시트 자리에 덧칸 — 식글(지금 식 이름 꼴) · 원식글 · 식덮개 · 식틀림 · 변수 줄 ·
|
||||
더한줄 식글 · 돌려줌 = 틀린 식 · 짝 잃은 식 칸(시트 `짝잃음` 에 더함)."""
|
||||
from M02_MasterTemplete import M02_Sangeun_Const as const
|
||||
|
||||
row, bad, fixed = settle(base, clean)
|
||||
eff, covers = const._swapped(row, clean), fixed.get("식덮개") or {}
|
||||
now, why = _places(eff), clean.get("까닭") or {}
|
||||
wrong: dict[str, list[str]] = {}
|
||||
for b in bad:
|
||||
wrong.setdefault(b["cid"], []).append(b["까닭"])
|
||||
for spot, one in spots.items():
|
||||
if spot in now and one.get("갈래") != "더한줄":
|
||||
part, at = now[spot]
|
||||
one["원식글"] = to_name(str(one.get("식")), base)
|
||||
one["식글"] = to_name(str(eff[part][at].get(FIELD[part])), base)
|
||||
one["식덮개"] = spot in covers
|
||||
hit = _ADD.match(spot)
|
||||
adds = fixed.get("더한줄") or []
|
||||
if hit and int(hit[1]) < len(adds) and adds[int(hit[1])].get("수량식"):
|
||||
one["식"] = adds[int(hit[1])]["수량식"]
|
||||
one["식글"] = to_name(one["식"], base)
|
||||
if spot in wrong:
|
||||
one["식틀림"] = wrong[spot]
|
||||
good = {x["이름"]: x["식"] for x in fixed.get("변수줄") or []}
|
||||
for line in clean.get("변수줄") or []:
|
||||
spot, text = f"mid:{line['이름']}", good.get(line["이름"], line["식"])
|
||||
spots[spot] = {
|
||||
"갈래": "변수",
|
||||
"이름": line["이름"],
|
||||
"식": text,
|
||||
"식글": to_name(text, base),
|
||||
"표시": line.get("표시"),
|
||||
"자리": line["자리"],
|
||||
"원래": None,
|
||||
"지금": mids.get(line["이름"]) if line["이름"] in good else None,
|
||||
"덮개": [],
|
||||
"까닭": why.get(spot),
|
||||
"M01바뀜": False,
|
||||
**({"식틀림": wrong[spot]} if spot in wrong else {}),
|
||||
}
|
||||
return bad
|
||||
|
||||
|
||||
def name_table(base: dict, clean: dict) -> list[dict]:
|
||||
"""식 칸에서 부를 이름 — 입력 · 중간 · 변수 · 덧줄 · 비목 · 별칭 · 자원 · 번지 · 단계."""
|
||||
mf = _eng()
|
||||
out = [{"글": str(x.get("이름")), "갈래": "입력"} for x in base.get("입력") or []]
|
||||
out += [{"글": str(x.get("이름")), "갈래": "중간"} for x in base.get("중간") or []]
|
||||
out += [{"글": x["이름"], "갈래": "변수"} for x in clean.get("변수줄") or []]
|
||||
out += [{"글": str(x.get("이름")), "갈래": "덧줄"} for x in base.get("덧줄") or []]
|
||||
out += [{"글": k, "갈래": "비목"} for k in mf.COST_ITEMS]
|
||||
out += [{"글": f"[{k}]", "갈래": "별칭"} for k in aliases(base)]
|
||||
label_of, seen = _labels(_whole())[0], set()
|
||||
for part in FIELD:
|
||||
for x in base.get(part) or []:
|
||||
texts = [
|
||||
str(x.get(FIELD[part])),
|
||||
*([x["요소"]] if isinstance(x.get("요소"), str) else []),
|
||||
]
|
||||
for key in (k for t in texts for k in mf.mk.KEY.findall(t)):
|
||||
if key in label_of and key not in seen:
|
||||
seen.add(key)
|
||||
out.append({"글": f"[{label_of[key]}]", "갈래": "자원"})
|
||||
lines = [*(base.get("호표") or []), *(base.get("덧줄") or [])]
|
||||
out += [{"글": f"번지.{x['번지']}", "갈래": "번지"} for x in lines if x.get("번지")]
|
||||
out += [{"글": f"단계.'{x.get('이름')}'", "갈래": "단계"} for x in base.get("단계") or []]
|
||||
return out
|
||||
|
||||
Reference in New Issue
Block a user