diff --git a/apps/inm/services.py b/apps/inm/services.py index d736b355..2aaff0de 100644 --- a/apps/inm/services.py +++ b/apps/inm/services.py @@ -242,7 +242,10 @@ class InmService: BatchLog.clear(mio=instance) else: for item in MIOItem.objects.filter(mio=instance): - BatchSt.g_create(batch=item.batch, mio=instance, material_start=item.material) + if item.mb: # 说明录入到已有批次 + BatchSt.g_create(batch=item.batch) + else: + BatchSt.g_create(batch=item.batch, mio=instance, material_start=item.material) from apps.pum.services import PumService if is_reverse: cls.update_mb(instance, -1) @@ -254,7 +257,10 @@ class InmService: BatchLog.clear(mio=instance) else: for item in MIOItem.objects.filter(mio=instance): - BatchSt.g_create(batch=item, mio=instance, material_start=item.material) + if item.mb: + BatchSt.g_create(batch=item.batch) + else: + BatchSt.g_create(batch=item, mio=instance, material_start=item.material) if is_reverse: cls.update_mb(instance, -1) else: