diff --git a/apps/wpm/serializers.py b/apps/wpm/serializers.py index a6d48872..95aed8f9 100644 --- a/apps/wpm/serializers.py +++ b/apps/wpm/serializers.py @@ -582,6 +582,7 @@ class HandoverSerializer(CustomModelSerializer): if wm: material = wm.material attrs['handoverb'] = [{"wm": wm, "count": attrs["count"] }] + handoverb = attrs['handoverb'] elif handoverb: wm: WMaterial = handoverb[0]["wm"] else: @@ -600,7 +601,7 @@ class HandoverSerializer(CustomModelSerializer): if 'send_dept' not in attrs and 'send_mgroup' not in attrs: raise ValidationError('送料车间和送料工段必须有一个') t_count = 0 - for ind, item in enumerate(handoverb): + for ind, item in enumerate(attrs['handoverb']): wm = item["wm"] t_count += item["count"] if attrs["material"] != wm.material: