From 725a471fd8224f68317855479696132382a0d3ce Mon Sep 17 00:00:00 2001 From: caoqianming Date: Thu, 29 May 2025 10:16:23 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20batchst=20reuse=5Fnode=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E5=AE=8C=E5=96=842?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wpm/models.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/wpm/models.py b/apps/wpm/models.py index ffeba063..4574fddd 100644 --- a/apps/wpm/models.py +++ b/apps/wpm/models.py @@ -641,10 +641,10 @@ class BatchSt(BaseModel): if mio is None and handover is None and mlog is None: raise ParseError("mio or handover or mlog must be provided") # 带有来源的批次获取,需检查批次号是否可用 - if cls.objects.filter(batch=batch).exists(): + cls_qs = cls.objects.filter(batch=batch) + if cls_qs.exists(): if reuse_node: - cls = cls.objects.filter(batch=batch) - node:BatchSt = (cls.objects.filter(mio__isnull=False)|cls.objects.filter( + node:BatchSt = (cls_qs.filter(mio__isnull=False)|cls_qs.filter( material_start__isnull=True)).order_by('-version').first() if node is None: raise ParseError(f"{batch}-该批次号因物料不同不可引用")