Merge remote-tracking branch 'origin/main_laptop_1' into sub_laptop_3
This commit is contained in:
@@ -28,3 +28,9 @@ export function cfMachineNames(): Promise<Record<string, string>> {
|
||||
.catch(() => ((machineNames = null), {}));
|
||||
return machineNames;
|
||||
}
|
||||
|
||||
/** 끈 기계 원문번호(842-2) — 이름과 함께 한 번 받아 둠(못 받으면 빈 목록) */
|
||||
export const cfMachineOff = (): Promise<string[]> =>
|
||||
fetch(`${API_BASE_URL}/m02/df/machine-off`, { credentials: "include" })
|
||||
.then((r) => (r.ok ? (r.json() as Promise<string[]>) : []))
|
||||
.catch(() => []);
|
||||
|
||||
@@ -33,6 +33,17 @@ def get_machine_names() -> dict:
|
||||
return out
|
||||
|
||||
|
||||
@router.get("/machine-off")
|
||||
def get_machine_off() -> list[str]:
|
||||
"""끈 기계 원문번호(842-2) — 그 번호 기계가 모두 「비활성」 · 옵션 고르기 목록에서 뺌(고른 값은 남김)."""
|
||||
on, off = set(), set()
|
||||
for data in store.loaded()[0].values():
|
||||
if data.get("그룹") == "기계":
|
||||
for row in data.get(store.items_key(data)) or []:
|
||||
(off if row.get("비활성") else on).add(str(row.get("원문번호") or ""))
|
||||
return sorted(off - on - {""})
|
||||
|
||||
|
||||
@router.get("/standards")
|
||||
def get_standards() -> dict:
|
||||
try:
|
||||
|
||||
@@ -48,7 +48,8 @@ def get_materials(
|
||||
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="요소 파일(인력 · 재료 · 기계)만 읽음")
|
||||
return m01.get_rows(file, page, size, q, False, sub, "", "")
|
||||
on = "켜짐" if file.startswith("기계") else "" # 끈 기계 뺌(842-2)
|
||||
return m01.get_rows(file, page, size, q, False, sub, "", on)
|
||||
|
||||
|
||||
@router.get("/table")
|
||||
|
||||
@@ -145,7 +145,7 @@ class Row:
|
||||
|
||||
@lru_cache(maxsize=4)
|
||||
def _table(whole: Any) -> tuple[list[Row], frozenset[str], dict[str, Row]]:
|
||||
rows = [Row(r) for r in whole.numbers.get("EQ", {}).values()]
|
||||
rows = [Row(r) for r in whole.numbers.get("EQ", {}).values() if not r.get("비활성")] # 842-2
|
||||
words = frozenset(w for r in rows for w in r.words)
|
||||
return rows, words, {r.key: r for r in rows}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ def find(q: str, limit: int = 30) -> list[dict]:
|
||||
if all(w in f"{r.get('이름')} {r.get('규격')} {r.get('키')}".lower() for w in words)
|
||||
]
|
||||
exact = (m01.loaded()[1].numbers.get("EQ") or {}).get(q.strip())
|
||||
head = [exact] if exact is not None and not mym.mine(exact.get("키")) else []
|
||||
head = [exact] if exact and not mym.mine(exact.get("키")) and not exact.get("비활성") else []
|
||||
m01_rows = [*head, *_m01m().find(q, limit)]
|
||||
seen = set()
|
||||
for r in m01_rows:
|
||||
|
||||
Reference in New Issue
Block a user