Merge remote-tracking branches 'origin/main_laptop_1' and 'origin/sub_laptop_1' into sub_laptop_6
This commit is contained in:
@@ -24,57 +24,6 @@
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.m02-hopyo__search {
|
||||
max-width: 320px;
|
||||
}
|
||||
|
||||
/* 실무자료 표 — 한글은 낱말 단위로만 줄바꿈(두세 글자마다 안 갈라짐) · 너무 긴 낱말만 쪼갬 */
|
||||
.m02-hopyo__table :is(th, td) {
|
||||
word-break: keep-all;
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
|
||||
/* 우리 로직 칸 — 대상 여럿 = 칸 안 여러 줄(이름 · 키 · 몫 · 배 칸 · [옵션]) */
|
||||
.m02-hopyo__parts {
|
||||
min-width: 11em;
|
||||
}
|
||||
|
||||
.m02-hopyo__part {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: var(--spacing-4);
|
||||
}
|
||||
|
||||
.m02-hopyo__part + .m02-hopyo__part {
|
||||
margin-top: var(--spacing-4);
|
||||
}
|
||||
|
||||
.m02-hopyo__times {
|
||||
width: 6em;
|
||||
}
|
||||
|
||||
.m02-hopyo__unit {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-4);
|
||||
}
|
||||
|
||||
/* 단위 환산 칸 앞뒤 글 — 「엑셀 1 ㎡ = 우리 [ ] 본」 */
|
||||
.m02-hopyo__unit-text {
|
||||
color: var(--color-text-secondary);
|
||||
font-size: var(--text-sm);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.m02-hopyo__acts {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.m02-hopyo__acts > button + button {
|
||||
margin-left: var(--spacing-4);
|
||||
}
|
||||
|
||||
/* 엑셀 보기(329) — 왼쪽 읽기 전용 시트 · 오른쪽 호표 목록 */
|
||||
.m02-hopyo-sheet {
|
||||
display: grid;
|
||||
|
||||
@@ -65,7 +65,6 @@ export function gridOf(id: string, scope: HopyoScope, key: string): Promise<Hopy
|
||||
got.catch(() => kept?.got === got && (kept = null));
|
||||
return got;
|
||||
}
|
||||
export const dropGrid = (): void => void (kept = null);
|
||||
|
||||
/** 역할 시트 탭 글 통일 — 역할 → 시트 id */
|
||||
export function nameTabs(book: Workbook, grid: HopyoGrid): Partial<Record<Role, string>> {
|
||||
|
||||
@@ -48,7 +48,6 @@ export function buildHopyoSection(opt: HopyoSectionOptions): HopyoSection {
|
||||
start.classList.add("m02-layers__btn");
|
||||
start.title =
|
||||
"파일 하나 — 경쟁사 엑셀(.xls · .xlsx) 또는 경쟁사 파일(.estx · .STC) → 우리 정보로 다시 만듦(한시 · 끝내거나 떠나면 올린 파일 지움)";
|
||||
start.dataset.hopyoWizardOpen = "";
|
||||
const jobs = el("div", { className: "m02-hopyo-side", attrs: { "data-hopyo-jobs": "" } });
|
||||
const body = el("div", {
|
||||
className: "m02-hopyo-side",
|
||||
|
||||
@@ -152,14 +152,6 @@ def flat(s: Any) -> str:
|
||||
return re.sub(r"\s+", "", str(s or ""))
|
||||
|
||||
|
||||
def _hcol(rows: list[list[Any]], word: str, start: int = 2) -> int | None:
|
||||
for r in rows[start : start + 2]:
|
||||
for j, v in enumerate(r):
|
||||
if flat(v) == word:
|
||||
return j
|
||||
return None
|
||||
|
||||
|
||||
def _n(v: Any) -> float | None:
|
||||
if isinstance(v, (int, float)):
|
||||
return float(v)
|
||||
@@ -192,51 +184,3 @@ def applied_how(r: list[Any]) -> tuple[dict[str, float], str | None]:
|
||||
return got, None # 쓸 값이 없음 — 표지할 것 없음
|
||||
why = "적용 칸 합이 안 맞음" if a["T"] else "적용 칸 비어 있음"
|
||||
return got, f"당초 칸 사용 — {why}" + (f" ({gap})" if gap else "")
|
||||
|
||||
|
||||
def applied(r: list[Any]) -> dict[str, float]:
|
||||
return applied_how(r)[0]
|
||||
|
||||
|
||||
def est_prices(book: dict[str, list]) -> tuple[list[dict[str, Any]], dict[int, dict[str, Any]]]:
|
||||
"""→ (단가 목록 [{종류, 이름, 규격, 비목, 값}], 산근 총괄 {번: {T, L, M, S, 이름, 규격}})."""
|
||||
out: list[dict[str, Any]] = []
|
||||
lab = book.get("노임단가", [])
|
||||
c = _hcol(lab, "적용단가")
|
||||
for r in lab[3:]:
|
||||
if c is not None and len(r) > c and r[2] and isinstance(r[c], (int, float)):
|
||||
out.append(
|
||||
{"종류": "노임", "이름": flat(r[2]), "규격": "", "비목": "L", "값": float(r[c])}
|
||||
)
|
||||
mat = book.get("자재단가", [])
|
||||
c = _hcol(mat, "적용단가")
|
||||
for r in mat[4:]:
|
||||
if c is not None and len(r) > c and r[2] and isinstance(r[c], (int, float)):
|
||||
out.append(
|
||||
{
|
||||
"종류": "자재",
|
||||
"이름": flat(r[2]),
|
||||
"규격": flat(r[3]),
|
||||
"비목": "M",
|
||||
"값": float(r[c]),
|
||||
}
|
||||
)
|
||||
for sheet, kind in (("기계경비총괄표", "기계"), ("견적단가", "견적")):
|
||||
for r in book.get(sheet, [])[3:]:
|
||||
if len(r) > 28 and r[2]:
|
||||
for k, v in applied(r).items():
|
||||
if isinstance(v, (int, float)) and (v or k != "T"):
|
||||
one = {"종류": kind, "이름": flat(r[2]), "규격": flat(r[3])}
|
||||
out.append({**one, "비목": k, "값": float(v or 0)})
|
||||
san: dict[int, dict[str, Any]] = {}
|
||||
for r in book.get("단가산출총괄표", [])[3:]:
|
||||
if len(r) > 28 and str(r[1]).strip().isdigit():
|
||||
n = int(str(r[1]).strip())
|
||||
got, note = applied_how(r)
|
||||
san[n] = {k: float(v or 0) for k, v in got.items()}
|
||||
san[n] |= {"이름": flat(r[2]), "규격": flat(r[3]), "칸": note}
|
||||
for k in "TLMS":
|
||||
if san[n][k] or k != "T":
|
||||
one = {"종류": "산근", "이름": f"단산{n}", "규격": ""}
|
||||
out.append({**one, "비목": k, "값": san[n][k]})
|
||||
return out, san
|
||||
|
||||
@@ -139,12 +139,6 @@ def chosen(item: dict) -> dict | None:
|
||||
return got if got and not _apart(res) else None
|
||||
|
||||
|
||||
def item_key(res: dict) -> str | None:
|
||||
"""줄 품목 키 — 고름 › 엔진 이음."""
|
||||
found = res.get("재료찾기") or {}
|
||||
return (found.get("고름") or {}).get("키") or found.get("키")
|
||||
|
||||
|
||||
def apart_note(found: dict) -> str:
|
||||
"""별도계상 줄 설명 — 품목이 있으면 「별도계상 · 품목: 이름 규격」."""
|
||||
from M02_MasterTemplete import M02_San_Link as link
|
||||
|
||||
@@ -182,10 +182,3 @@ def parse_line(g: str | None) -> dict[str, Any]:
|
||||
if refs:
|
||||
return {**head, **_ref_line(st, refs[0])}
|
||||
return {**head, **_assign_line(st)}
|
||||
|
||||
|
||||
def parse_block(lines: list[dict[str, Any]]) -> list[dict[str, Any]]:
|
||||
"""[{행, G}] → 줄 나무 목록(행 · 원문 붙임)."""
|
||||
return [
|
||||
{"행": ln.get("행"), "글": ln.get("G") or "", **parse_line(ln.get("G"))} for ln in lines
|
||||
]
|
||||
|
||||
@@ -122,7 +122,7 @@ def _table(rows: list[list[Any]], price: tuple[str, ...]) -> list[dict[str, Any]
|
||||
|
||||
def resources(sheets: dict[str, list]) -> dict[str, list[dict[str, Any]]]:
|
||||
"""같은 책 단가표 → {종류: [{번 · 이름 · 규격 · 단위 · 표 · 값 {T L M S}}]}(노임 · 자재 = 적용단가 ·
|
||||
기계 · 견적 · 산근 = 적용 칸(합이 안 맞으면 당초 · `M02_San_Book.applied`))."""
|
||||
기계 · 견적 · 산근 = 적용 칸(합이 안 맞으면 당초 · `M02_San_Book.applied_how`))."""
|
||||
out: dict[str, list[dict[str, Any]]] = {}
|
||||
for kind, sheet, comp in (("노임", "노임단가", "L"), ("자재", "자재단가", "M")):
|
||||
rows = sheets.get(sheet) or []
|
||||
|
||||
@@ -561,7 +561,8 @@ def create(
|
||||
new: bool = False, use: str | None = None,
|
||||
) -> dict[str, Any]: # fmt: skip
|
||||
"""엔진 로직 줄 + 원본 → 지금 층 새 가져온 식 SK — 서버가 다시 셈해 엑셀과 맞댐(검산 ·
|
||||
다르면 `같음` False 로 표지 · 막지 않음) · 같은 층 같은 내용 = 409(`ask` · 733-2)."""
|
||||
다르면 `같음` False 로 표지 · 막지 않음) · 같은 층 같은 내용 = 409(`ask` · 733-2) ·
|
||||
서버 길(POST sangeun/imported)은 853-3 에서 걷음 — 시험이 가져온 식 SK 바탕으로 씀."""
|
||||
return keep(new_doc(logic, source, name, unit, head), new, use)
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""M02 단가산출(SK) 셈 길(PLAN 715-1b) — `POST /api/m02/layers/{층}/sangeun/calc` ·
|
||||
일위대가 [+ 줄] M01 기초 = 그 층 SK 사본(811-1 · `M02_Labor_SkRow`) `…/sangeun/from-logic`(층 쓰기) ·
|
||||
가져온 식(793-2 · `M02_Sangeun_Imported`) `…/sangeun/imported`(만들기 · 층 쓰기) · `/price` ·
|
||||
가져온 식(793-2 · `M02_Sangeun_Imported`) `…/sangeun/imported/price` ·
|
||||
`/link`(화면 캐시 문서 고침 · 저장 없음 · 층 읽기 · 기초로 바꾸기 없음 · 809-1) ·
|
||||
불러오기 단산 블록 → 가져온 식(793-3b · `M02_Sangeun_FromHopyo`) `…/sangeun/from-hopyo`
|
||||
(늘 개인 층 쓰기 · 몸 `문서` = 미리 보기에서 고친 문서) · 미리 보기 `…/from-hopyo/preview`(층 읽기 · 안 씀 · 835-1).
|
||||
@@ -81,31 +81,6 @@ def calc_sangeun(
|
||||
return _call(_root(session, layer, owner), _calc, body)
|
||||
|
||||
|
||||
class ImportedBody(BaseModel):
|
||||
로직: dict[str, Any]
|
||||
원본: dict[str, Any] | None = None
|
||||
이름: str = ""
|
||||
단위: str = ""
|
||||
구분: str = ""
|
||||
상세구분: str = ""
|
||||
새로: bool = False
|
||||
씀: str | None = None
|
||||
|
||||
|
||||
@router.post("/layers/{layer}/sangeun/imported")
|
||||
def sangeun_imported(
|
||||
layer: Layer,
|
||||
body: ImportedBody,
|
||||
owner: str | None = None,
|
||||
session: Session = Depends(verify_session),
|
||||
) -> dict:
|
||||
"""가져온 식 단가산출 만들기(793-2) — 답 = {이름, 검산, 단가기준} · 같은 내용 409."""
|
||||
folder = _root(session, layer, owner, write=True)
|
||||
head = {"구분": body.구분, "상세구분": body.상세구분}
|
||||
args = (body.로직, body.원본, body.이름, body.단위, head, body.새로, body.씀)
|
||||
return _call(folder, _sd(imp.create), *args)
|
||||
|
||||
|
||||
class FromHopyoBody(BaseModel):
|
||||
층: Layer
|
||||
주인: str | None = None
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
/* =============================================================================
|
||||
* M02_MasterTemplete_Hopyo_Unit.ts — 확인 창 대상 이름 옆 「단위 환산」 칸의 보이기 판정(PLAN 784-2 · 요구 635-2).
|
||||
* 순수 계산(화면 · fetch 없음) — 숨김 조건 · 두 단위 글 재료 · 추정 두께.
|
||||
* · same = 배 1 · 단위 같음(서버 갈래 같음 · 두 단위 · 단위표 1) → 칸 숨김 · 「단위 같음 ×1」
|
||||
* · quota = 배가 몫(0.1)과 같음 → 칸 숨김 · 「몫 0.1」 만
|
||||
* · input = 빈칸 · 추정 · 그 밖 → 입력 칸 「엑셀 1 ㎡ = 우리 [ ] 본」
|
||||
* 값 자체(배)는 안 바꿈 — 서버 `Match.factor` 가 낸 배 · 갈래를 보이기만 다르게.
|
||||
* ========================================================================== */
|
||||
|
||||
export interface UnitPart {
|
||||
배: number | null;
|
||||
몫?: number | null;
|
||||
환산?: { 배: number | null; 갈래: string } | null;
|
||||
단위?: string | null;
|
||||
}
|
||||
|
||||
export type UnitMode = "same" | "quota" | "input";
|
||||
|
||||
export interface UnitView {
|
||||
mode: UnitMode;
|
||||
/** 엑셀 단위 · 우리 단위(빈 글 = 모름) */
|
||||
from: string;
|
||||
to: string;
|
||||
/** 추정 갈래 — 두께 m(㎡ → ㎥ 일 때만 · 아니면 null) */
|
||||
thick: number | null;
|
||||
estimated: boolean;
|
||||
}
|
||||
|
||||
const plain = (u: string | null | undefined): string =>
|
||||
String(u ?? "")
|
||||
.replace(/\s+/g, "")
|
||||
.replace("㎡", "m2")
|
||||
.replace("㎥", "m3")
|
||||
.toLowerCase();
|
||||
const close = (a: number, b: number): boolean => Math.abs(a - b) < 1e-9;
|
||||
|
||||
export function unitView(
|
||||
p: UnitPart,
|
||||
from: string | null | undefined,
|
||||
to?: string | null,
|
||||
): UnitView {
|
||||
const f = String(from ?? "").trim();
|
||||
const t = String(to ?? p.단위 ?? "").trim();
|
||||
const quota = p.몫 != null && p.몫 !== 1; // 몫 1 = 몫 없음과 같음
|
||||
const kind = p.환산?.갈래;
|
||||
const unitSame = kind
|
||||
? kind === "같음" || kind === "두 단위" || (kind === "단위표" && p.환산?.배 === 1)
|
||||
: plain(f) !== "" && plain(f) === plain(t);
|
||||
const at = quota ? (p.몫 as number) : 1;
|
||||
const hidden = p.배 !== null && close(p.배, at) && unitSame;
|
||||
const estimated = kind === "추정";
|
||||
const thick =
|
||||
estimated && plain(f) === "m2" && plain(t) === "m3" && p.환산?.배 != null ? p.환산.배 : null;
|
||||
return {
|
||||
mode: hidden ? (quota ? "quota" : "same") : "input",
|
||||
from: f,
|
||||
to: t,
|
||||
thick,
|
||||
estimated,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user