diff --git a/apps/inm/services.py b/apps/inm/services.py index 58b8d048..f52d870f 100644 --- a/apps/inm/services.py +++ b/apps/inm/services.py @@ -223,7 +223,7 @@ class InmService: """ # 统计物料数量 m_ids = MIOItem.objects.filter(mio=instance).values_list('material_id', flat=True) - MyThread(target=cal_material_count, args=(m_ids, ), daemon=True).start() + cal_material_count(m_ids) @classmethod def update_inm(cls, instance: MIO, is_reverse: bool = False): diff --git a/apps/wpm/services.py b/apps/wpm/services.py index 5b2ff402..13f95968 100644 --- a/apps/wpm/services.py +++ b/apps/wpm/services.py @@ -21,6 +21,7 @@ from datetime import timedelta from apps.wpmw.models import Wpr, WprDefect from ..qm.models import Defect, Ftest from django.db.models import Count, Q +from apps.utils.tasks import ctask_run myLogger = logging.getLogger('log') @@ -322,7 +323,7 @@ def mlog_submit(mlog: Mlog, user: User, now: Union[datetime.datetime, None]): cal_mtask_progress_from_mlog(mlog) # 更新物料数量 - MyThread(target=cal_material_count_from_mlog,args=(mlog,)).start() + cal_material_count_from_mlog(mlog) # 触发批次统计分析 if mlog.batch: @@ -497,7 +498,7 @@ def mlog_revert(mlog: Mlog, user: User, now: Union[datetime.datetime, None]): cal_mtask_progress_from_mlog(mlog) # 更新物料数量 - MyThread(target=cal_material_count_from_mlog,args=(mlog,)).start() + cal_material_count_from_mlog(mlog) # 触发批次统计分析 if mlog.batch: