fix: batchst reuse_node逻辑完善2

This commit is contained in:
caoqianming 2025-05-29 10:16:23 +08:00
parent 49efafcaff
commit 725a471fd8
1 changed files with 3 additions and 3 deletions

View File

@ -641,10 +641,10 @@ class BatchSt(BaseModel):
if mio is None and handover is None and mlog is None: if mio is None and handover is None and mlog is None:
raise ParseError("mio or handover or mlog must be provided") 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: if reuse_node:
cls = cls.objects.filter(batch=batch) node:BatchSt = (cls_qs.filter(mio__isnull=False)|cls_qs.filter(
node:BatchSt = (cls.objects.filter(mio__isnull=False)|cls.objects.filter(
material_start__isnull=True)).order_by('-version').first() material_start__isnull=True)).order_by('-version').first()
if node is None: if node is None:
raise ParseError(f"{batch}-该批次号因物料不同不可引用") raise ParseError(f"{batch}-该批次号因物料不同不可引用")