fix: handover 合批时创建关系链的bug

This commit is contained in:
caoqianming 2025-03-24 08:41:43 +08:00
parent f57604492b
commit 5ee10e7cc5
1 changed files with 4 additions and 1 deletions

View File

@ -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