fix: do_in保证production_dept赋值
This commit is contained in:
parent
21e9a49069
commit
a13ac84ccb
|
@ -185,6 +185,8 @@ def do_in(item: MIOItem):
|
||||||
"production_dept": production_dept
|
"production_dept": production_dept
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
if mb.production_dept is None:
|
||||||
|
mb.production_dept = production_dept
|
||||||
mb.count = mb.count + xcount
|
mb.count = mb.count + xcount
|
||||||
mb.save()
|
mb.save()
|
||||||
|
|
||||||
|
@ -204,10 +206,12 @@ def do_in(item: MIOItem):
|
||||||
batch=item.batch,
|
batch=item.batch,
|
||||||
defaults={"count": 0, "production_dept": production_dept}
|
defaults={"count": 0, "production_dept": production_dept}
|
||||||
)
|
)
|
||||||
mb.count = mb.count + item.count
|
|
||||||
mb.save()
|
|
||||||
if not is_created:
|
if not is_created:
|
||||||
raise ParseError("该批次组合件已存在")
|
raise ParseError("该批次组合件已存在")
|
||||||
|
if mb.production_dept is None:
|
||||||
|
mb.production_dept = production_dept
|
||||||
|
mb.count = mb.count + item.count
|
||||||
|
mb.save()
|
||||||
for mia in mias:
|
for mia in mias:
|
||||||
MaterialBatchA.objects.create(mb=mb, material=mia.material, batch=mia.batch, rate=mia.rate)
|
MaterialBatchA.objects.create(mb=mb, material=mia.material, batch=mia.batch, rate=mia.rate)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue