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