From 56d49b4d267095caa459d92fd1e331bd28b905bb Mon Sep 17 00:00:00 2001 From: caoqianming Date: Tue, 18 Feb 2025 10:56:09 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20cal=5Fmaterial=5Fcount=20=E5=8F=AA?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E5=90=88=E6=A0=BC=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/mtm/services.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/mtm/services.py b/apps/mtm/services.py index fb66a955..5bdcdce8 100644 --- a/apps/mtm/services.py +++ b/apps/mtm/services.py @@ -24,8 +24,8 @@ def cal_material_count(materialId_list: List[str]=None): else: objs = Material.objects.all() for material in objs: - mb_count = MaterialBatch.objects.filter(material=material).aggregate(total=Sum("count"))["total"] or 0 - wm_count = WMaterial.objects.filter(material=material).aggregate(total=Sum("count"))["total"] or 0 + mb_count = MaterialBatch.objects.filter(material=material, state=10).aggregate(total=Sum("count"))["total"] or 0 + wm_count = WMaterial.objects.filter(material=material, state=10).aggregate(total=Sum("count"))["total"] or 0 if mb_count is None: mb_count = 0 if wm_count is None: