Files
Aislo/M02_MasterTemplete/M02_Logic_Lib_Read.py
T
eomsangdonandClaude Opus 5.5 b4f8515b5d chore(853-2): 걸음 0 묶음 ① — 화면 0 서버 길 16 · 그 길만 부르던 본체 · 죽은 화면 래퍼 걷음
- 길: sangeun from-line · formula-check · copy · equation(셋) · block · labor copy · 프로젝트 양식 reset · apply · save-as · sources · drawing-import · drawing-fields · logic-lib machine-parts · logic-lib/auto
- 본체: Calc.from_line · Formula.check_doc 외 셋 · Equation 읽기 · 미리 셈 · Equation_Full 파일 · Block 끊기 · 잇기 · 수식 탭 · Labor_Copy.preview · Router_Layers 가져오기 도우미
- 화면: Api_Fetch 래퍼 여덟 · sangeunFromLine
- 시험: 죽은 길만 보던 796-2c · 796-2e 파일 지움 · 함수째 지움(715-3 · 733-2 · 792-1 · 796-2b · router_drawing · template_layers · structure_panel 글자 시험) · 살아 있는 결과는 [저장] 길로 고침(795-2 · 796-2b) · 813-2 = M01 parts.of_machine 바로
- 남김: Sangeun_Copy.preview(옛 엔진 셈 거울 — 걸음 2) · B07 이 쓰는 reset_project · B09 가 쓰는 _company_projects
- 검증: /openapi.json 524 → 508(뜻한 16 만) · 빌더 --check 같음 · 핵심 시험 99 통과 · 관련 시험 687 통과 · typecheck 0

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 11:36:15 +09:00

82 lines
3.1 KiB
Python

"""단가산출 로직 상세 읽기 · 셈 길(PLAN 717-1) — `/api/m02/logic-lib/…` · 로그인만(`main.py`).
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`).
`/logics` · `/subs` · `/logic` · 원문은 `M02_MasterTemplete_Router_Combos.py` 에 있음.
"""
from __future__ import annotations
from fastapi import APIRouter, HTTPException
from M01_MasterData import M01_MasterData_Router as m01
from M02_MasterTemplete import M02_Machine_Hourly as machine
router = APIRouter(prefix="/api/m02/logic-lib", tags=["M02 Logic Lib Read"])
#: `/rows` 로 줄을 내줄 요소 파일 앞머리 — 인력 · 재료 · 기계(고르기 표 · 품목 찾기)
ROW_FILES = ("인력", "재료", "기계")
#: `/table` 로 내줄 표 파일 앞머리 — 소요량 · 계수(설명 카드 원문 표)
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))
@router.get("/pick")
def get_pick(kind: str, q: str = "", limit: int = 50) -> dict:
return m01.get_pick(kind, q, min(limit, 200))
@router.get("/materials")
def get_materials(
sub: str, detail: str = "", spec: str = "", region: str = "", unit: str = "", limit: int = 50
) -> dict:
return m01.get_materials(sub, detail, spec, region, unit, min(limit, 200))
@router.get("/rows")
def get_rows(file: str, page: int = 1, size: int = 50, q: str = "", sub: str = "") -> dict:
if not file.startswith(ROW_FILES):
raise HTTPException(status_code=403, detail="요소 파일(인력 · 재료 · 기계)만 읽음")
on = "켜짐" if file.startswith("기계") else "" # 끈 기계 뺌(842-2)
return m01.get_rows(file, page, size, q, False, sub, "", on)
@router.get("/table")
def get_table(file: str, key: str) -> dict:
if not file.startswith(TABLE_FILES):
raise HTTPException(status_code=403, detail="소요량 · 계수 표만 읽음")
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 · [항목 추가] 기계 고정 줄 단가)."""
return machine.hourly(key)
@router.get("/machine-rows")
def get_machine_rows(keys: str) -> dict:
"""기계 창(827-1) — M01 기계 키 · 원문번호 쉼표 목록(60 까지) → 줄 값 + 시간당."""
return {"rows": machine.brief([k for k in keys.split(",") if k.strip()])}