Merge remote-tracking branch 'origin/sub_laptop_7' into sub_laptop_6
This commit is contained in:
@@ -224,16 +224,27 @@ export const copyPartFrom = async (
|
||||
column: string,
|
||||
source: string,
|
||||
from: { layer: Layer | "practice"; owner: string | null } | null,
|
||||
pair = false,
|
||||
): Promise<void> => {
|
||||
const q = new URLSearchParams({ from: source });
|
||||
if (from) q.set("from_layer", from.layer);
|
||||
if (from?.owner) q.set("from_owner", from.owner);
|
||||
if (pair) q.set("pair", "true");
|
||||
const part = kind === "structure" ? "structures" : kind;
|
||||
await call(owned(activeLayer, `/layers/${activeLayer}/${part}/${enc(column)}/copy?${q}`), {
|
||||
method: "POST",
|
||||
});
|
||||
};
|
||||
|
||||
/** 일위대가 · 면적산출 함께 가져오기(43-9a · 카드 [가져오기]) — 원본 열의 면적산출(시트 · 알약 연결)과
|
||||
* 일위대가(담은로직 · 입력값 · 수량 · 자재)로 둘 다 덮어씀 · 도면은 안 건드림 ·
|
||||
* 원본에 면적산출이 없으면(실무문서) 일위대가만 · 인자는 `copyPartFrom` 과 같음 */
|
||||
export const copyLaborAreaFrom = (
|
||||
column: string,
|
||||
source: string,
|
||||
from: { layer: Layer | "practice"; owner: string | null } | null,
|
||||
): Promise<void> => copyPartFrom("labor", column, source, from, true);
|
||||
|
||||
/** 항목 하나 비우기(40-4 · 카드 [삭제]) — 새 열과 같은 빈 문서 · 번호 · 열 그대로 · 지금 층 */
|
||||
export const clearPart = (
|
||||
kind: "structure" | "labor" | "area",
|
||||
|
||||
@@ -363,15 +363,22 @@ def post_copy(
|
||||
owner: str | None = None,
|
||||
from_layer: Literal["system", "company", "personal", "practice"] | None = None,
|
||||
from_owner: str | None = None,
|
||||
pair: bool = False,
|
||||
session: Session = Depends(verify_session),
|
||||
):
|
||||
"""항목 하나 복사해 가져오기(덮어씀 · 번호 · 열 그대로) — 원본 = 같은 층(`from_layer` 없음) ·
|
||||
다른 층(원본 읽기 권한) · 실무문서 조합(`practice` · 일위대가만 · 시스템 관리자만)."""
|
||||
다른 층(원본 읽기 권한) · 실무문서 조합(`practice` · 일위대가만 · 시스템 관리자만) ·
|
||||
`pair` = 일위대가 · 면적산출 함께(43-9a · 답 `{area?, labor}` · 실무문서는 일위대가만)."""
|
||||
folder = _root(session, layer, owner, write=True)
|
||||
part = "structure" if kind == "structures" else kind
|
||||
if from_layer == "practice":
|
||||
if part != "labor" or not access.is_system_admin(session):
|
||||
if part not in (("labor", "area") if pair else ("labor",)) or not access.is_system_admin(
|
||||
session
|
||||
):
|
||||
raise HTTPException(status_code=403, detail="실무문서는 시스템 관리자가 일위대가로만")
|
||||
return _call(folder, _copy_practice, column, source)
|
||||
got = _call(folder, _copy_practice, column, source)
|
||||
return {"labor": got} if pair else got
|
||||
origin = _root(session, from_layer, from_owner) if from_layer else None
|
||||
if pair and part != "structure":
|
||||
return _call(folder, store.copy_pair, column, source, origin)
|
||||
return _call(folder, store.copy_from, part, column, source, origin)
|
||||
|
||||
@@ -397,6 +397,25 @@ def copy_from(
|
||||
return info
|
||||
|
||||
|
||||
def copy_pair(
|
||||
column: str,
|
||||
source: str,
|
||||
source_root: Path | None = None,
|
||||
labor_body: dict[str, Any] | None = None,
|
||||
) -> dict[str, Any]:
|
||||
"""일위대가 ↔ 면적산출 함께 가져오기(43-9a) — 같은 원본 열의 면적산출(시트 · 알약 `연결`)과
|
||||
일위대가(담은로직 · 입력값 · 수량 · 자재)로 둘 다 덮어씀 · 도면은 안 건드림 ·
|
||||
원본에 면적산출이 없으면(실무문서 `labor_body` 포함) 일위대가만 · 면적 먼저(일위대가 계산값이
|
||||
새 면적 칸 값을 읽음 · 면적 계산이 막히면 일위대가도 안 씀)."""
|
||||
with at(source_root or root()):
|
||||
has_area = labor_body is None and _path("area", source).is_file()
|
||||
out: dict[str, Any] = {}
|
||||
if has_area:
|
||||
out["area"] = copy_from("area", column, source, source_root)
|
||||
out["labor"] = copy_from("labor", column, source, source_root, labor_body)
|
||||
return out
|
||||
|
||||
|
||||
def prune_removed_structures() -> list[str]:
|
||||
"""집계표에서 지운 열(또는 구조물이 아니게 된 열)의 세 파일을 같이 지움 —
|
||||
번호는 비워 둠(다른 열 번호를 안 당김) · 옛 `inputs/` 는 안 건드림."""
|
||||
|
||||
Reference in New Issue
Block a user