feat: 批次追踪链条还是可以复用批次
This commit is contained in:
parent
9d634940d3
commit
76adab1571
|
|
@ -633,6 +633,8 @@ class BatchSt(BaseModel):
|
||||||
return node, False
|
return node, False
|
||||||
else:
|
else:
|
||||||
version = 1
|
version = 1
|
||||||
|
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():
|
if cls.objects.filter(batch=batch).exists():
|
||||||
if reuse_node:
|
if reuse_node:
|
||||||
|
|
@ -641,11 +643,8 @@ class BatchSt(BaseModel):
|
||||||
raise ParseError(f"{batch}-该批次号因物料不同不可引用")
|
raise ParseError(f"{batch}-该批次号因物料不同不可引用")
|
||||||
return node, False
|
return node, False
|
||||||
else:
|
else:
|
||||||
raise ParseError(f"{batch}-该批次号不可使用")
|
latest_version = BatchSt.objects.filter(batch=batch).aggregate(Max("version"))["version__max"]
|
||||||
# latest_version = BatchSt.objects.filter(batch=batch).aggregate(Max("version"))["version__max"]
|
version = latest_version + 1
|
||||||
# version = latest_version + 1
|
|
||||||
if mio is None and handover is None and mlog is None:
|
|
||||||
raise ParseError("mio or handover or mlog must be provided")
|
|
||||||
ins = cls.objects.create(batch=batch, mio=mio, handover=handover, mlog=mlog, material_start=material_start, version=version)
|
ins = cls.objects.create(batch=batch, mio=mio, handover=handover, mlog=mlog, material_start=material_start, version=version)
|
||||||
return ins, True
|
return ins, True
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue