feat(testdata): 参考库/测试库目录分离+双输入框手动粘贴;修 lme_lib 同 code 撞唯一约束
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -11,6 +11,8 @@ node_modules/
|
|||||||
/release/*
|
/release/*
|
||||||
# testdata 测试数据生成器是源码,必须入库(2026-10-09 差点因未跟踪丢失)
|
# testdata 测试数据生成器是源码,必须入库(2026-10-09 差点因未跟踪丢失)
|
||||||
!/release/testdata/
|
!/release/testdata/
|
||||||
|
# 运行时配置(存本机数据目录路径),不入库
|
||||||
|
/release/testdata/config.json
|
||||||
|
|
||||||
|
|
||||||
# ===== 数据 / 样本 / 生成物:不入库 =====
|
# ===== 数据 / 样本 / 生成物:不入库 =====
|
||||||
|
|||||||
6
release/testdata/gen_testdata.py
vendored
6
release/testdata/gen_testdata.py
vendored
@@ -761,7 +761,11 @@ def build_project_data(rng, cfg, words, m_idx, bid_local=True):
|
|||||||
# 每条清单的定额 + 每条定额的工料机
|
# 每条清单的定额 + 每条定额的工料机
|
||||||
nrm_lo, nrm_hi = int(cfg["norm_lo"]), max(int(cfg["norm_lo"]), int(cfg["norm_hi"]))
|
nrm_lo, nrm_hi = int(cfg["norm_lo"]), max(int(cfg["norm_lo"]), int(cfg["norm_hi"]))
|
||||||
res_lo, res_hi = int(cfg["res_lo"]), max(int(cfg["res_lo"]), int(cfg["res_hi"]))
|
res_lo, res_hi = int(cfg["res_lo"]), max(int(cfg["res_lo"]), int(cfg["res_hi"]))
|
||||||
lme_pool = rng.sample(words.lmes, min(len(words.lmes), rng.randint(260, 520)))
|
_u = {} # 真实库同 code 跨批次重复,lme_lib 有
|
||||||
|
for it in words.lmes: # (batch_id, code) 唯一约束 → 先去重再抽样
|
||||||
|
_u.setdefault(it[0], it)
|
||||||
|
_uniq = list(_u.values())
|
||||||
|
lme_pool = rng.sample(_uniq, min(len(_uniq), rng.randint(260, 520)))
|
||||||
lme_by_kind = {1: [], 2: [], 3: []}
|
lme_by_kind = {1: [], 2: [], 3: []}
|
||||||
for it in lme_pool:
|
for it in lme_pool:
|
||||||
lme_by_kind.setdefault(it[4] or 2, []).append(it)
|
lme_by_kind.setdefault(it[4] or 2, []).append(it)
|
||||||
|
|||||||
Reference in New Issue
Block a user