feat: 改版交接需要触发统计数量

This commit is contained in:
caoqianming 2025-04-18 14:52:03 +08:00
parent 1e379d412c
commit 00e352d8ef
1 changed files with 9 additions and 0 deletions

View File

@ -23,6 +23,7 @@ from ..qm.models import Defect, Ftest
from django.db.models import Count, Q
from apps.utils.tasks import ctask_run
from apps.mtm.models import Process
from apps.mtm.services_2 import cal_material_count
myLogger = logging.getLogger('log')
@ -719,9 +720,11 @@ def handover_submit(handover:Handover, user: User, now: Union[datetime.datetime,
raise ParseError("合并批次时请提供新批次号")
new_target = None
mids = []
for item in handoverb_list:
wmId, xcount, handover_or_b = item
wm_from = WMaterial.objects.get(id=wmId)
mids.append(wm_from.material.id)
# 合并为新批
if mtype == Handover.H_MERGE:
@ -893,6 +896,12 @@ def handover_submit(handover:Handover, user: User, now: Union[datetime.datetime,
if batches:
for batch in batches:
MyThread(target=get_alldata_with_batch_and_store, args=(batch,)).start()
# 如果是改版交接需要触发统计数量
if handover.type == Handover.H_CHANGE:
mids.append(handover.material_changed.id)
cal_material_count(mids)
def handover_revert(handover:Handover):
BatchLog.clear(handover=handover)