From c5bcfb4e538440051f4018f5e3e9f1c7b646ba9c Mon Sep 17 00:00:00 2001 From: caoqianming Date: Fri, 28 Feb 2025 15:38:36 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20mlogboutupdate=E5=85=BC=E5=AE=B9?= =?UTF-8?q?=E6=80=A7=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wpm/serializers.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/apps/wpm/serializers.py b/apps/wpm/serializers.py index 3a29fb50..8e428df9 100644 --- a/apps/wpm/serializers.py +++ b/apps/wpm/serializers.py @@ -748,11 +748,10 @@ class MlogbOutUpdateSerializer(CustomModelSerializer): def validate(self, attrs): mlogbdefect = attrs.get("mlogbdefect", []) if mlogbdefect: - pass - # attrs.pop("count_notok_json") - # for i in attrs: - # if 'count_n_' in i: - # attrs.pop(i, None) + attrs.pop("count_notok_json") + for i in attrs: + if 'count_n_' in i: + attrs.pop(i, None) else: count_notok_json = attrs.get('count_notok_json', []) # count_notok_json字段处理 @@ -782,10 +781,10 @@ class MlogbOutUpdateSerializer(CustomModelSerializer): raise ParseError(f'{i}不存在') count_notok = count_notok + attrs[i] attrs['count_notok'] = count_notok - if attrs['count_real'] >= attrs['count_ok'] + attrs['count_notok']: - pass - else: - raise ParseError('生产数量不能小于合格数量') + if attrs['count_real'] >= attrs['count_ok'] + attrs['count_notok']: + pass + else: + raise ParseError('生产数量不能小于合格数量') return attrs class MlogRevertSerializer(serializers.Serializer):