- Flask + SQLAlchemy 物料/入库/出库/BOM/生产订单全模块管理 - PyInstaller 打包为单文件 EXE (双击运行, 自动建库) - 物料维度: 入库总数量 / 消耗总数量 / 逐次入库流水(含时间) - BOM 详情展示组成物料的规格型号与单套用量 - 支持 Altium / 嘉立创 BOM 批量导入(文本与 Excel 双通道) - 内置端到端验证脚本(tools/_exe_util.py 等, 清理进程树防残留)
44 lines
1.2 KiB
Python
44 lines
1.2 KiB
Python
"""真实 HTTP 启动检查: 等待端口 -> 登录 -> 看板渲染"""
|
|
import urllib.request, urllib.parse, http.cookiejar, time, sys
|
|
|
|
BASE = "http://127.0.0.1:8080"
|
|
cj = http.cookiejar.CookieJar()
|
|
op = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj))
|
|
|
|
|
|
def get(path):
|
|
return op.open(BASE + path, timeout=5).read().decode("utf-8", "ignore")
|
|
|
|
|
|
# 等待服务起来
|
|
for i in range(20):
|
|
try:
|
|
html = get("/login")
|
|
if "物料入库系统" in html:
|
|
print("[OK] 服务已启动, 登录页正常")
|
|
break
|
|
except Exception:
|
|
time.sleep(0.5)
|
|
else:
|
|
print("[FAIL] 服务未在 10s 内就绪")
|
|
sys.exit(1)
|
|
|
|
# 登录
|
|
data = urllib.parse.urlencode({"username": "admin", "password": "admin123"}).encode()
|
|
op.open(urllib.request.Request(BASE + "/login", data=data, method="POST"))
|
|
html = get("/dashboard")
|
|
assert "库存看板" in html, "看板未渲染"
|
|
print("[OK] 登录后看板渲染正常")
|
|
|
|
# 物料页
|
|
html = get("/materials")
|
|
assert "物料" in html
|
|
print("[OK] 物料页渲染正常")
|
|
|
|
# 入库页
|
|
html = get("/inbound")
|
|
assert "入库登记" in html
|
|
print("[OK] 入库页渲染正常")
|
|
|
|
print("\n真实服务冒烟通过 ✅")
|