fix: do_in保证production_dept赋值

This commit is contained in:
caoqianming 2025-04-17 11:16:08 +08:00
parent 21e9a49069
commit a13ac84ccb
1 changed files with 6 additions and 2 deletions

View File

@ -185,6 +185,8 @@ def do_in(item: MIOItem):
"production_dept": production_dept
}
)
if mb.production_dept is None:
mb.production_dept = production_dept
mb.count = mb.count + xcount
mb.save()
@ -204,10 +206,12 @@ def do_in(item: MIOItem):
batch=item.batch,
defaults={"count": 0, "production_dept": production_dept}
)
mb.count = mb.count + item.count
mb.save()
if not is_created:
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:
MaterialBatchA.objects.create(mb=mb, material=mia.material, batch=mia.batch, rate=mia.rate)