From 00e352d8ef20237445c6d15b2761e4f1da4e81b3 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Fri, 18 Apr 2025 14:52:03 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=B9=E7=89=88=E4=BA=A4=E6=8E=A5?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E8=A7=A6=E5=8F=91=E7=BB=9F=E8=AE=A1=E6=95=B0?= =?UTF-8?q?=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wpm/services.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/apps/wpm/services.py b/apps/wpm/services.py index 410b22fe..cbfa4562 100644 --- a/apps/wpm/services.py +++ b/apps/wpm/services.py @@ -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)