feat: 优化wpr change_or_new
This commit is contained in:
parent
e86f4e79d4
commit
5ae9030152
|
@ -47,16 +47,18 @@ class Wpr(BaseModel):
|
|||
ins_x = cls.objects.filter(number=number).order_by("-update_time").first()
|
||||
if ins_x:
|
||||
if ins_x.wm is None and ins_x.mb is None:
|
||||
if ins_x.version > 1: # 说明被复用了
|
||||
if wpr_from is None:
|
||||
wpr_from = ins_x
|
||||
# 创建新的wpr
|
||||
ins = cls(number=number)
|
||||
ins.version = -1
|
||||
ins.oinfo = {}
|
||||
is_create = True
|
||||
else:
|
||||
raise ParseError(f"该物料编号{number}-已存在不可使用")
|
||||
# 此时可以直接复用
|
||||
ins = ins_x
|
||||
# if ins_x.version > 1: # 说明被复用了
|
||||
# if wpr_from is None:
|
||||
# wpr_from = ins_x
|
||||
# # 创建新的wpr
|
||||
# ins = cls(number=number)
|
||||
# ins.version = -1
|
||||
# ins.oinfo = {}
|
||||
# is_create = True
|
||||
# else:
|
||||
# raise ParseError(f"该物料编号{number}-已存在不可使用")
|
||||
else:
|
||||
raise ParseError(f"该物料编号{number}-已存在不可使用")
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue