From 0baec25a8b39ce75a401a5af8a2301289a50002d Mon Sep 17 00:00:00 2001 From: caoqianming Date: Thu, 5 Sep 2024 12:50:51 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20handover=20count=E5=8F=AF=E4=B8=8D?= =?UTF-8?q?=E5=A1=AB=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wpm/serializers.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/wpm/serializers.py b/apps/wpm/serializers.py index 3e81f6c2..0f4fa288 100644 --- a/apps/wpm/serializers.py +++ b/apps/wpm/serializers.py @@ -593,14 +593,17 @@ class HandoverSerializer(CustomModelSerializer): raise ValidationError('收料车间和收料工段必须有一个') if 'send_dept' not in attrs and 'send_mgroup' not in attrs: raise ValidationError('送料车间和送料工段必须有一个') + t_count = 0 for ind, item in enumerate(handoverb): wm = item["wm"] + t_count += item["count"] if attrs["material"] != wm.material: raise ParseError(f'第{ind+1}物料与交接物料不一致') if wm.notok_sign is not None and attrs['type'] in [Handover.H_NORMAL, Handover.H_TEST]: raise ParseError(f'第{ind+1}物料不合格,不能进行正常/检验交接') if wm.count_xtest is not None: raise ParseError(f'第{ind+1}物料检验中,不能进行交接') + attrs["count"] = t_count if attrs['type'] == Handover.H_SCRAP: attrs['recive_mgroup'] = attrs['send_mgroup'] attrs['recive_dept'] = attrs['send_dept'] @@ -619,6 +622,8 @@ class HandoverSerializer(CustomModelSerializer): "recive_dept": {"required": False}, "material": {"required": False}, "batch": {"required": False}, + "count": {"required": False}, + "count_eweight": {"required": False} } def create(self, validated_data):