From a90351bb93e1318c43f9683bf95431992d2947ac Mon Sep 17 00:00:00 2001 From: caoqianming Date: Tue, 14 Jul 2026 10:34:56 +0800 Subject: [PATCH] =?UTF-8?q?feat:correct=5Fzt=5Fgxerp=E9=80=90=E6=89=B9?= =?UTF-8?q?=E6=89=93=E5=8D=B0=E8=AE=A1=E7=AE=97=E7=BB=93=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit cal_zt_big返回计算摘要, 回刷脚本每个大批实时输出良率/白料/口径 Co-Authored-By: Claude Fable 5 --- apps/wpm/scripts/batch_gxerp.py | 2 ++ scripts/correct_zt_gxerp.py | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/apps/wpm/scripts/batch_gxerp.py b/apps/wpm/scripts/batch_gxerp.py index 69f24b46..fbbe89c9 100644 --- a/apps/wpm/scripts/batch_gxerp.py +++ b/apps/wpm/scripts/batch_gxerp.py @@ -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__': diff --git a/scripts/correct_zt_gxerp.py b/scripts/correct_zt_gxerp.py index 8bc863e5..ae59aecd 100644 --- a/scripts/correct_zt_gxerp.py +++ b/scripts/correct_zt_gxerp.py @@ -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")