feat: 批次追踪链优化2

This commit is contained in:
caoqianming 2025-07-03 14:38:16 +08:00
parent 17284dcf4f
commit 79f1322c27
1 changed files with 8 additions and 4 deletions

View File

@ -757,9 +757,11 @@ class BatchLog(BaseModel):
target = log.target
log.delete()
if not BatchLog.objects.filter(Q(source=source) | Q(target=source)).exists():
source.delete()
if source.mio is None and source.mioitem is None:
source.delete()
if not BatchLog.objects.filter(Q(source=target) | Q(target=target)).exists():
target.delete()
if target.mio is None and target.mioitem is None:
target.delete()
if mlog:
logs = cls.objects.filter(mlog=mlog)
for log in logs:
@ -767,9 +769,11 @@ class BatchLog(BaseModel):
target = log.target
log.delete()
if not BatchLog.objects.filter(Q(source=source) | Q(target=source)).exists():
source.delete()
if source.mio is None and source.mioitem is None:
source.delete()
if not BatchLog.objects.filter(Q(source=target) | Q(target=target)).exists():
target.delete()
if target.mio is None and target.mioitem is None:
target.delete()
if mio:
BatchSt.objects.filter(mio=mio).delete()
if mioitem: