Merge remote-tracking branches 'origin/sub_laptop_3', 'origin/sub_laptop_7' and 'origin/sub_laptop_8' into sub_laptop_5
This commit is contained in:
@@ -242,7 +242,8 @@ class Builder:
|
||||
hopyo, file = self.hopyo, self.doc.get("파일") or ""
|
||||
rows = hopyo.get("줄") or []
|
||||
where = {"파일": file, "호표": self.no}
|
||||
body = hmake.Lines(self, rows, where, stamp, hfix.Linker(self.strict and save))
|
||||
found = hfix.Linker(self.strict and save, hfix.clues(self.src, self.key))
|
||||
body = hmake.Lines(self, rows, where, stamp, found)
|
||||
lines, mats, missing, left = body.lines, body.mats, body.missing, body.left
|
||||
taken, linker, kids, put = body.taken, body.linker, body.kids, body.put
|
||||
nation, mat_lines = body.nation, body.mat_lines
|
||||
@@ -288,6 +289,8 @@ class Builder:
|
||||
if nation:
|
||||
doc["본뜬"]["전국자재"] = list(nation.values())
|
||||
doc["본뜬"]["품셈"] = poomsem
|
||||
if self.strict and save: # 859-4 불러온 일위대가 기본 판 = 엑셀(단가산출 불러오기와 같음)
|
||||
doc["본뜬"][hfix.fixed.BASIS] = hfix.fixed.EXCEL
|
||||
if self.dry:
|
||||
return {"남은줄": left}
|
||||
if left and save and self.strict and not self.lenient:
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
수량 없음 = 수량 1 · 단가 = 엑셀 금액(「금액만」).
|
||||
이음 = 노임(LB) · 자재(MT) = 이름 · 규격 · 단위 · 단가 다 같은 것만 · `by_name`(729-2 불러오기 길 ·
|
||||
요구서 내역19 3장 7) = 노임 = 이름 같은 LB 하나(값 = 지금 단가 책) · 기계 = 이름(갈래) · 규격 수 같은 EQ
|
||||
하나 · 못 이은 짝 = `후보` 수만 · 사용자가 고른 이음(`force` {노임|기계|자재: 키} · {비율: 기준}) = 그대로.
|
||||
하나 · 자재(859-4 · 요구 903) = 단가산출 길 찾기 한 벌(`San_Link.m01` 재료 · 같은 올림 단서 · 값 관문 없음 ·
|
||||
유가 줄 = 이음 유가 · 별도계상 = 판정만) — 금액은 일위대가 판(`Labor_Fixed.basis_of`)이 고름 ·
|
||||
못 이은 짝 = `후보` 수만 · 사용자가 고른 이음(`force` {노임|기계|자재: 키} · {비율: 기준}) = 그대로.
|
||||
% 줄 = 비율 줄 `비율 {기준, 비목}` — 엑셀 밑수(단가 계) = 다른 줄 금액[기준] 합일 때만 ·
|
||||
아니면(주재료비 등) 수량 1 · 「식」 · 단가 = 엑셀 금액.
|
||||
같은 이름 · 규격 · 단위 둘째부터 = 이름 끝 「 (2)」(줄 가름 · 705-1 400 피함).
|
||||
@@ -15,8 +17,11 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import re
|
||||
from decimal import Decimal
|
||||
from functools import lru_cache
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from M01_MasterData import M01_MasterData_Store as m01
|
||||
@@ -87,13 +92,41 @@ def linked(one: dict[str, Any], decided: bool = False) -> bool:
|
||||
return decided or bool(fx.get("비율")) or any((fx.get("이음") or {}).values())
|
||||
|
||||
|
||||
class Linker:
|
||||
"""이음 — 노임(LB 이름) · 기계(EQ 갈래 · 규격) · 자재(이름 · 규격 같은 한 품목 · 단위 · 단가 같음)."""
|
||||
def clues(folder: str | Path, key: str) -> list[dict]:
|
||||
"""같은 올림 둘 꼴 재료 단서(`Sangeun_FromHopyo` 저장본 `엑셀` · `원파일` 의 `단서` · 859-4) — 없음 = []."""
|
||||
from M02_MasterTemplete import M02_Sangeun_FromHopyo as fh
|
||||
|
||||
def __init__(self, by_name: bool = False) -> None:
|
||||
path = fh._path(folder, key)
|
||||
try:
|
||||
return list(_clues(str(path), path.stat().st_mtime_ns))
|
||||
except OSError:
|
||||
return []
|
||||
|
||||
|
||||
@lru_cache(maxsize=8)
|
||||
def _clues(path: str, _mtime: int) -> tuple:
|
||||
try:
|
||||
saved = json.loads(Path(path).read_bytes())
|
||||
except (OSError, ValueError):
|
||||
return ()
|
||||
src = saved.get("엑셀") or saved.get("원파일")
|
||||
return tuple((src.get("단서") or []) if isinstance(src, dict) else [])
|
||||
|
||||
|
||||
def excel_mat(line: dict[str, Any]) -> Decimal:
|
||||
"""엑셀 줄 재료비 단가(`line_of` 와 같은 길 — 수량 없음 = 금액)."""
|
||||
return _parts(line.get("단가") if line.get("수량") is not None else line.get("금액"))["재료비"]
|
||||
|
||||
|
||||
class Linker:
|
||||
"""이음 — 노임(LB 이름) · 기계(EQ 갈래 · 규격) · 자재(불러오기 길 = 단가산출 길 찾기 · 그 밖 = 이름 ·
|
||||
규격 같은 한 품목 · 단위 · 단가 같음)."""
|
||||
|
||||
def __init__(self, by_name: bool = False, clues: list | None = None) -> None:
|
||||
self.by_name = (
|
||||
by_name # 729-2 불러오기 길만 — 붙여넣기 · B09 통째 = 단가 같을 때만(엑셀 합계 그대로)
|
||||
)
|
||||
self.clues = list(clues or []) # 859-4 같은 올림 재료 단서
|
||||
self.whole = m01.loaded()[1]
|
||||
self.got = hm.targets()
|
||||
self.labor: dict[str, list[tuple[str, Decimal | None]]] = {}
|
||||
@@ -116,10 +149,37 @@ class Linker:
|
||||
out["노임"] = same or self._same(pairs, price["노무비"])
|
||||
elif kind == "기계" and self.by_name:
|
||||
out["기계"] = self._machine(line)
|
||||
elif kind in hm.MATERIAL_KINDS and price["재료비"] and self.by_name:
|
||||
got = self.find(line, price["재료비"])
|
||||
key = str(got.get("키") or "")
|
||||
if key[:2] in ("MT", "MO"):
|
||||
out["자재" if key[:2] == "MT" else "유가"] = key
|
||||
else:
|
||||
self.near += bool(got.get("후보"))
|
||||
elif kind in hm.MATERIAL_KINDS and price["재료비"]:
|
||||
out["자재"] = self._same(self._mats(line), price["재료비"])
|
||||
return out
|
||||
|
||||
def find(self, line: dict[str, Any], price: Decimal | None = None) -> dict[str, Any]:
|
||||
"""자재 줄 → 단가산출 길 판정 {키, 판정, 방법, 후보, 단서}(`San_Link.m01` 재료 · 859-4) ·
|
||||
`price` = 엑셀 재료비 단가(같은 품목 여러 줄 고름)."""
|
||||
from M02_MasterTemplete import M02_San_Link as sl
|
||||
from M02_MasterTemplete import M02_San_MatFind as smf
|
||||
|
||||
src = {k: line.get(k) or "" for k in ("이름", "규격", "단위")}
|
||||
src |= {"종류": "자재", "코드": line.get("코드") or ""}
|
||||
if price:
|
||||
src |= {"단가": {"M": _plain(price)}, "비목": "M"}
|
||||
with smf.clues_on(self.clues):
|
||||
key, _ = sl.m01("재료", src, "")
|
||||
return {"후보": [], **(src.get("재료찾기") or {}), "키": key}
|
||||
|
||||
def verdict(self, line: dict[str, Any]) -> str | None:
|
||||
"""못 이은 자재 줄 판정 글(단가산출 길과 같은 말 · 불러오기 길만)."""
|
||||
if not self.by_name or kind_of(line) not in hm.MATERIAL_KINDS:
|
||||
return None
|
||||
return self.find(line, excel_mat(line)).get("판정") or None
|
||||
|
||||
def _eqs(self, line: dict[str, Any]) -> list[str]:
|
||||
"""기계 줄 → EQ 후보 — 이름 · 규격 글 같음 › 기계 찾기(812-9 `M02_Machine_Find`)."""
|
||||
name, spec = mm_plain(line.get("이름")), mm_plain(line.get("규격"))
|
||||
@@ -141,6 +201,8 @@ class Linker:
|
||||
return [code for code, _ in self.labor.get(shares.trade(line.get("이름")) or "", [])]
|
||||
if kind == "기계":
|
||||
return self._eqs(line)
|
||||
if kind in hm.MATERIAL_KINDS and self.by_name:
|
||||
return [c["키"] for c in self.find(line, excel_mat(line))["후보"] if c.get("키")]
|
||||
return [code for code, _ in self._mats(line)] if kind in hm.MATERIAL_KINDS else []
|
||||
|
||||
def _machine(self, line: dict[str, Any]) -> str | None:
|
||||
|
||||
@@ -4,8 +4,9 @@
|
||||
[내 일위대가로] 와 같은 이음 규칙 · 금액 = 엑셀). 줄 표지:
|
||||
· 로직 줄 = 단산 N 참조 → 「단가산출」(번 · 가져온 식 SK 로 엶) · 일위 N 참조 → 「일위대가」(번 · 하위 호표 보기)
|
||||
· 요소 줄 = 그 밖(인력 · 재료 · 기계 · 유가 · 율 · 고정 수) — 이음 있음 = 「연결됨」(이음) ·
|
||||
후보 있음 = 「후보」(키 · 이름) · 없음 = 「못 이음」(엑셀 값 그대로)
|
||||
후보 있음 = 「후보」(키 · 이름) · 없음 = 「못 이음」(엑셀 값 그대로) · 자재 줄 = `판정`(단가산출 길과 같은 말 · 859-4)
|
||||
· 엑셀 = 줄 금액(노무비 · 재료비 · 경비 · 계)
|
||||
문서 = 불러온 일위대가 판 「엑셀」(`본뜬.단가기준` · 859-4 — 화면이 「우리」 로 바꿔 미리 셈) · 이음 = 같은 올림 단서로.
|
||||
기초 판정 · 2차 풀이 없음 · 저장 없음.
|
||||
"""
|
||||
|
||||
@@ -17,6 +18,7 @@ from typing import Any
|
||||
from M02_MasterTemplete import M02_Hopyo_Build as hbuild
|
||||
from M02_MasterTemplete import M02_Hopyo_Fixed as hfix
|
||||
from M02_MasterTemplete import M02_Hopyo_Store as hopyo_store
|
||||
from M02_MasterTemplete import M02_Labor_Fixed as fixed
|
||||
from M02_MasterTemplete import M02_Labor_Ref as refs
|
||||
from M02_MasterTemplete import M02_MasterTemplete_Store as store
|
||||
|
||||
@@ -49,6 +51,7 @@ def mark(line: dict[str, Any], one: dict[str, Any], linker: hfix.Linker) -> dict
|
||||
rate = fx.get("비율")
|
||||
return {**out, "갈래": ELEMENT, "표지": LINKED, "이음": link or {"비율": rate["기준"]}}
|
||||
near = [{"키": c, "이름": _name(linker, c)} for c in linker.candidates(line)]
|
||||
out |= {"판정": v} if (v := linker.verdict(line)) else {}
|
||||
if near:
|
||||
return {**out, "갈래": ELEMENT, "표지": NEAR, "후보": near}
|
||||
return {**out, "갈래": ELEMENT, "표지": NONE}
|
||||
@@ -56,7 +59,8 @@ def mark(line: dict[str, Any], one: dict[str, Any], linker: hfix.Linker) -> dict
|
||||
|
||||
def view(source: str | Path, key: str, no: int) -> dict[str, Any]:
|
||||
"""파일 층 HP 의 호표 하나 보기(`of`)."""
|
||||
return of(hopyo_store.read(Path(source), key), no)
|
||||
linker = hfix.Linker(True, hfix.clues(source, key))
|
||||
return of(hopyo_store.read(Path(source), key), no, linker)
|
||||
|
||||
|
||||
def of(book: dict[str, Any], no: int, linker: hfix.Linker | None = None) -> dict[str, Any]:
|
||||
@@ -73,7 +77,14 @@ def of(book: dict[str, Any], no: int, linker: hfix.Linker | None = None) -> dict
|
||||
lines.append(one)
|
||||
marks.append(mark(line, one, linker))
|
||||
name = " ".join(x for x in (hopyo.get("이름"), hopyo.get("규격")) if x)
|
||||
doc = {"이름": name, "단위": hopyo.get("단위") or None, "담은로직": lines, "자재": []}
|
||||
born = {"층": hbuild.ORIGIN, "파일": where["파일"], fixed.BASIS: fixed.EXCEL} # 859-4 기본 판
|
||||
doc = {
|
||||
"이름": name,
|
||||
"단위": hopyo.get("단위") or None,
|
||||
"담은로직": lines,
|
||||
"자재": [],
|
||||
"본뜬": born,
|
||||
}
|
||||
head = {k: hopyo.get(k) for k in ("번", "이름", "규격", "단위", "금액")}
|
||||
return {**head, "문서": doc, "줄": marks}
|
||||
|
||||
@@ -83,7 +94,7 @@ def listing(folder: str | Path, key: str, to: str | Path) -> dict[str, Any]:
|
||||
`줄상태 [[차례, 표지, 이어짐]]` · `만든` SC(만들 층 `to` · 이 파일 층 것만)."""
|
||||
book = hopyo_store.read(Path(folder), key)
|
||||
made = hbuild.confirmed(to, refs.where(Path(folder)))
|
||||
linker, units = hfix.Linker(True), []
|
||||
linker, units = hfix.Linker(True, hfix.clues(folder, key)), []
|
||||
for h in book.get("호표") or []:
|
||||
no = int(h["번"])
|
||||
marks = of(book, no, linker)["줄"]
|
||||
|
||||
@@ -133,8 +133,9 @@ def _fresh(folder: Path, kind: str, name: str, rec: Any, stamp: str | None, whol
|
||||
deps.setdefault(str(p), file_stamp(p))
|
||||
|
||||
token = refs.SEEN.set(note)
|
||||
try: # 셈마다 새 펼침 — 다른 항목 셈 기억을 나눠 쓰면 기댐이 빠짐
|
||||
out = refs.summary(folder, kind, name, Expand(whole), [])
|
||||
try: # 셈마다 새 펼침 — 다른 항목 셈 기억을 나눠 쓰면 기댐이 빠짐 · 지금 층 = 그 층(내 기계 · 자동 따라옴)
|
||||
with store.at(folder):
|
||||
out = refs.summary(folder, kind, name, Expand(whole), [])
|
||||
finally:
|
||||
refs.SEEN.reset(token)
|
||||
out.pop("쓰는곳수", None)
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
* 경쟁사 로직 인정 · 요소만 연결 — 몸 = 일위대가 컨테이너 부품(`Labor_Table` · 806-1 조합과 한 벌 · 읽기만) + 덧칸 둘:
|
||||
* · 표지 = 로직 줄 「단가산출 N」 · 「일위대가 N」 칩 / 요소 줄 「✓ 연결됨」 · 「후보 n」 · 「못 이음」(엑셀 값 그대로)
|
||||
* · 엑셀 금액 = 그 줄 엑셀 금액 계
|
||||
* 줄 = 서버 `GET …/hopyo-view/{키}/{번}`(`M02_Hopyo_View` · 엑셀 숫자 그대로 고정 줄 · 저장 없음 · 금액 = 엑셀).
|
||||
* 줄 = 서버 `GET …/hopyo-view/{키}/{번}`(`M02_Hopyo_View` · 엑셀 숫자 그대로 고정 줄 · 저장 없음 · 금액 = 엑셀 판 ·
|
||||
* 일위대가표 머리 판 고르기(859-4 `Labor_Basis`) = [우리 단가로] 미리 셈 · 후보 창 머리 = 자재 판정).
|
||||
* · 단가산출 줄 누름 = 그 블록 가져온 식 모달(`Hopyo_Imported` · 미리 보기 · 층에 안 씀 · 저장 = 모달 [저장] ·
|
||||
* 835-1 — 옛 「누르면 SK 만듦」 걷음 · [엑셀 단가 그대로 | 우리 단가로])
|
||||
* · 일위대가 줄 누름 = 그 하위 호표 [수정] 모달 · 후보 줄 누름 = 후보 목록(고르기 = [내 일위대가로] 뒤 일위대가 [연결])
|
||||
@@ -65,6 +66,8 @@ export interface ViewMark {
|
||||
번?: number | null;
|
||||
이음?: Record<string, string>;
|
||||
후보?: { 키: string; 이름: string }[];
|
||||
/** 자재 줄 판정(단가산출 불러오기와 같은 말 · 859-4) */
|
||||
판정?: string;
|
||||
엑셀: Money;
|
||||
}
|
||||
export interface ViewReply {
|
||||
@@ -120,6 +123,7 @@ function showNear(name: string, m: ViewMark): void {
|
||||
dialogClass: "m02-modal",
|
||||
mount: (body) => {
|
||||
const rows = (m.후보 ?? []).map((c) => [c.키, c.이름]);
|
||||
if (m.판정) body.append(createText(m.판정, "muted")); // 859-4 단가산출 불러오기와 같은 판정 말
|
||||
body.append(createTable([{ label: t("Key") }, { label: t("Name") }], rows, { density: "data" })); // prettier-ignore
|
||||
body.append(createText(t("NearHint"), "hint"));
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user