feat:correct_zt_gxerp逐批打印计算结果
cal_zt_big返回计算摘要, 回刷脚本每个大批实时输出良率/白料/口径 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
cd3faa0ad7
commit
a90351bb93
|
|
@ -499,6 +499,8 @@ def cal_zt_big(big_batch: str):
|
|||
data["直通_良率"] = None
|
||||
big_bs.data = json.loads(json.dumps(data, cls=MyJSONEncoder))
|
||||
big_bs.save(update_fields=["data", "update_time"])
|
||||
return {"白料数": big_bs.data.get("直通_白料数"), "总合格数": big_bs.data.get("直通_总合格数"),
|
||||
"良率": big_bs.data.get("直通_良率"), "口径": big_bs.data.get("直通_口径"), "子批数": len(sub_batches)}
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ def main(since: str = "2026-06-01", fresh: bool = False):
|
|||
if (ind + 1) % 1000 == 0:
|
||||
print(f"归属解析 {ind + 1}/{total}")
|
||||
|
||||
print(f"共 {len(bigs)} 个大批, 开始计算直通良率")
|
||||
print(f"共 {len(bigs)} 个大批, 开始计算直通良率", flush=True)
|
||||
for ind, big in enumerate(bigs):
|
||||
try:
|
||||
if fresh:
|
||||
|
|
@ -62,11 +62,11 @@ def main(since: str = "2026-06-01", fresh: bool = False):
|
|||
data.pop("直通_白料数", None)
|
||||
big_bs.data = json.loads(json.dumps(data, cls=MyJSONEncoder))
|
||||
big_bs.save(update_fields=["data", "update_time"])
|
||||
cal_zt_big(big)
|
||||
res = cal_zt_big(big) or {}
|
||||
print(f"[{ind + 1}/{len(bigs)}] {big} 良率={res.get('良率')} 白料={res.get('白料数')} "
|
||||
f"合格={res.get('总合格数')} 子批={res.get('子批数')} 口径={res.get('口径')}", flush=True)
|
||||
except Exception as e:
|
||||
print(f"{big} 计算失败: {e}")
|
||||
if (ind + 1) % 200 == 0:
|
||||
print(f"大批 {ind + 1}/{len(bigs)}")
|
||||
print(f"[{ind + 1}/{len(bigs)}] {big} 计算失败: {e}", flush=True)
|
||||
print("done")
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue