fix: batchst reuse_node逻辑完善2
This commit is contained in:
parent
49efafcaff
commit
725a471fd8
|
@ -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}-该批次号因物料不同不可引用")
|
||||
|
|
Loading…
Reference in New Issue