fix: batchst create bug
This commit is contained in:
parent
9780cd8021
commit
f57604492b
|
@ -589,13 +589,11 @@ class BatchSt(BaseModel):
|
|||
"""
|
||||
创建新的批次
|
||||
"""
|
||||
try:
|
||||
BatchSt.objects.get(batch=batch)
|
||||
raise ParseError(f"{batch} 该批号不可使用")
|
||||
except BatchSt.DoesNotExist:
|
||||
if mio is None and handover is None and mlog is None:
|
||||
raise ParseError("mio or handover or mlog must be provided")
|
||||
BatchSt.objects.create(batch=batch, mio=mio, handover=handover, mlog=mlog)
|
||||
if BatchSt.objects.filter(batch=batch).exists():
|
||||
raise ParseError(f"{batch} 该批号已存在不可用")
|
||||
if mio is None and handover is None and mlog is None:
|
||||
raise ParseError("mio or handover or mlog must be provided")
|
||||
BatchSt.objects.create(batch=batch, mio=mio, handover=handover, mlog=mlog)
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue