From 3906b0f744351ac94c7354e9686a7edb5ad254d7 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Tue, 9 Sep 2025 13:37:56 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20gen=5Fnumber=5Fwith=5Frule=E6=8C=89?= =?UTF-8?q?=E7=94=9F=E4=BA=A7=E6=97=A5=E5=BF=97=E4=B8=AD=E7=9A=84=E5=B7=A5?= =?UTF-8?q?=E6=AE=B5=E8=BF=87=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wpm/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/wpm/views.py b/apps/wpm/views.py index ce525e72..32d9739d 100644 --- a/apps/wpm/views.py +++ b/apps/wpm/views.py @@ -273,6 +273,9 @@ class MlogViewSet(CustomModelViewSet): # data = list(data_dict.values()) if self.request.query_params.get('with_wpr', False) == 'yes': pass + # wpr_dict = {item["id"]: None for item in data} + # wpr_out_qs = Mlogbw.objects.filter(mlogb__mlog__id__in=wpr_dict.keys(), + # mlogb__material_out__isnull=False).values_list('mlogb__mlog', 'number') return data @lock_model_record_d_method(Mlog) @@ -872,7 +875,7 @@ class MlogbInViewSet(CreateModelMixin, UpdateModelMixin, DestroyModelMixin, Cust c_month = handle_date.month m_model = material_out.model # 按生产日志查询 - wpr = Wpr.objects.filter(wpr_mlogbw__mlogb__material_out=material_out, + wpr = Wpr.objects.filter(wpr_mlogbw__mlogb__mlog__mgroup=mlog.mgroup, wpr_mlogbw__mlogb__mlog__is_fix=False, wpr_mlogbw__mlogb__mlog__submit_time__isnull=False, wpr_mlogbw__mlogb__mlog__handle_date__year=c_year, wpr_mlogbw__mlogb__mlog__handle_date__month=c_month).order_by("number").last()