From aa42ba6e3f1d9a367b9c0fb729d1835416183dd2 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Thu, 1 Aug 2024 18:12:30 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20submit=E6=97=B6=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=E6=B6=88=E8=80=97=E5=92=8C=E4=BA=A7=E5=87=BA=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E5=B7=B2=E7=BB=8F=E5=A1=AB=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wpm/views.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/wpm/views.py b/apps/wpm/views.py index 1cf92d14..4efcaf80 100644 --- a/apps/wpm/views.py +++ b/apps/wpm/views.py @@ -208,8 +208,11 @@ class MlogViewSet(CustomModelViewSet): raise ParseError('该日志已提交!') if ins.mtask and ins.mtask.state == Mtask.MTASK_STOP: raise ParseError('该任务已停止!') - if ins.fill_way == Mlog.MLOG_STEP and not Mlogb.objects.filter(material_out__isnull=False).exists(): - raise ParseError('该日志未指定产出!') + if ins.fill_way == Mlog.MLOG_STEP: + if not Mlogb.objects.filter(material_out__isnull=False).exists(): + raise ParseError('该日志未指定产出!') + if not Mlogb.objects.filter(material_in__isnull=False).exists(): + raise ParseError('该日志未指定消耗!') with transaction.atomic(): mlog_submit(ins, self.request.user, now) vdata_new = MlogSerializer(ins).data