圆钢采购计算模块
Overview
A self-contained, frontend-only web app for round-steel (圆钢) purchasing:
maintain basic material info → assemble purchase requirement combos → compute
ordering lengths / bars / weight / cost per the steel-mill Excel convention.
Pure HTML/CSS/JS. No server, no build step. Data persists in browser localStorage.
When to use
- User asks for a "圆钢采购计算 / 订购长度计算 / 定尺下料计算" tool or page.
- User provides an Excel spec for ordering-length (订购长度) and wants a matching calculator.
- User needs a locally-runnable, copy-deployable procurement worksheet (single file).
- User wants to reproduce the Excel formula:
H=TRUNC(maxLen/L),I=L×H,J=Q/H,
bars=CEILING(J), ordering lengthG = max(I)+allow(see references/calc-formulas.md).
Quick start (deploy the bundled app)
The working implementation is in assets/round-steel-procurement/:
index.html+styles.css+app.js— multi-file source (edit logic here).圆钢采购计算.html— single-file inlined build, double-click to run, ready to copy/deploy.
To ship immediately, copy assets/round-steel-procurement/ to the user's target directory.
Either open index.html in a browser, or hand out 圆钢采购计算.html as the portable build.
From-scratch generation
When the user wants custom logic instead of the bundled copy:
- Build a 3-tab SPA:
- Tab ① 圆钢基本信息 — 货号 / ID号 / 规格Φ / 材质 / 牌号 / 密度(g/cm³) / 单价(元/kg) / 备注; CRUD + search.
- Tab ② 采购需求组合 — multiple combos; each line = 圆钢 + 所需长度(mm) + 件数; same 货号 may have multiple rows of different lengths; carry over 基本信息.
- Tab ③ 订购长度计算 — pick a combo + 工艺余量(allow) + G-mode, output 订购根数/总长/重量/金额 + per-货号 table. - Implement the calculation exactly as
references/calc-formulas.md(MAX/TRUNC/CEILING, G two-tier binning). Do NOT reintroduce the abandoned K-tier optimal version. - Persist state in
localStorage(keyround_steel_procurement_v2), add JSON export/import. - For any delete action, use an in-page confirm overlay (自建遮罩
askConfirm), neverwindow.confirm— preview sandboxes swallow native confirm.
Packaging into a single portable file
For copy-deploy, inline CSS + JS into one .html (no external src/link). Keep the
圆钢采购计算.html pattern: self-contained, opens via file://, data in localStorage.
Resources
assets/round-steel-procurement/— runnable source + single-file build (copy/deploy as-is).references/calc-formulas.md— exact Excel formula, G reproduction rule, and the attachment
verification table. Read this before writing or modifying any calculation code.
Constraints
- Chromium-family browser required (the
dialogelement,localStorage). - No credentials, no network calls. Keep it offline-capable.
- Deletion must always confirm first and clean up referencing combo lines.