From 01d93d7814123f463ed4ea2e9b4521c218716872 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Wed, 19 Nov 2025 13:51:32 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96ana=20batchwork?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wpm/views_ana.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/wpm/views_ana.py b/apps/wpm/views_ana.py index 3688b3a6..fc9f563f 100644 --- a/apps/wpm/views_ana.py +++ b/apps/wpm/views_ana.py @@ -7,6 +7,7 @@ from apps.wpm.serializers import BatchMgroupSerializer from apps.wpm.models import WMaterial, Mlogb from django.db.models import Q, Sum, F, ExpressionWrapper from collections import defaultdict +from apps.mtm.models import Material @@ -26,12 +27,12 @@ class BatchWorkView(APIView): mgroup:Mgroup = Mgroup.objects.get(name=vdata['mgroup_name']) except Exception: raise ParseError(f"获取工段信息失败-{vdata['mgroup_name']}") - matoutIds = mgroup.process.get_canout_mat_ids() + matinIds = mgroup.process.get_canin_mat_ids() # 待加工的批次 wm_qs = WMaterial.objects.filter(mgroup=mgroup, count__gt=0) - wm_todo_qs = wm_qs.filter(state=WMaterial.WM_OK).exclude(material__id__in=matoutIds)|wm_qs.filter(state=WMaterial.WM_REPAIR) + wm_todo_qs = wm_qs.filter(material__id__in=matinIds).exclude(state=WMaterial.WM_REPAIRED)|wm_qs.filter(state=WMaterial.WM_REPAIR, mgroup=mgroup) wm_v = wm_todo_qs.order_by("batch").values("count", "batch", wmid=F("id")) # 对应的操作子日志投入