diff --git a/apps/wpm/services.py b/apps/wpm/services.py index e017a5b4..0d71ee0e 100644 --- a/apps/wpm/services.py +++ b/apps/wpm/services.py @@ -710,13 +710,16 @@ def handover_submit(handover:Handover, user: User, now: Union[datetime.datetime, batches = [new_batch] else: raise ParseError("合并批次时请提供新批次号") + create_new_batch = False for item in handoverb_list: wm_from, xcount, handover_or_b = item # 合并为新批 if mtype == Handover.H_MERGE: batch = new_batch - BatchSt.create(batch=batch, handover=handover) + if create_new_batch is False: + BatchSt.create(batch=batch, handover=handover) + create_new_batch = True BatchLog.g_create(source_b=wm_from.batch, target_b=batch, handover=handover, relation_type="merge") elif mtype == Handover.H_DIV: batch = handover_or_b.batch