From 5f2385ccd18682fac9eb1555d921a2e125dd57df Mon Sep 17 00:00:00 2001 From: caoqianming Date: Thu, 17 Apr 2025 09:06:34 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20fmlog=E5=A1=AB=E5=86=99mtask=E6=88=96rou?= =?UTF-8?q?te=E5=8D=B3=E5=8F=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wpm/serializers.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/wpm/serializers.py b/apps/wpm/serializers.py index 1045945e..28311394 100644 --- a/apps/wpm/serializers.py +++ b/apps/wpm/serializers.py @@ -983,10 +983,10 @@ class HandoverSerializer(CustomModelSerializer): raise ParseError('必须指定交接工段') if 'recive_mgroup' in attrs and attrs['recive_mgroup']: attrs['recive_dept'] = attrs['recive_mgroup'].belong_dept - if 'recive_dept' not in attrs and 'recive_mgroup' not in attrs: - raise ParseError('收料车间和收料工段必须有一个') - if 'send_dept' not in attrs and 'send_mgroup' not in attrs: - raise ParseError('送料车间和送料工段必须有一个') + if not attrs.get('recive_dept', None) and not attrs.get('recive_mgroup', None): + raise ParseError('必须指定收料车间或收料工段') + if not attrs.get('send_dept', None) and not attrs.get('send_mgroup', None): + raise ParseError('必须指定送料车间或送料工段') t_count = 0 tracking = attrs["material"].tracking for ind, item in enumerate(attrs['handoverb']): @@ -1186,7 +1186,7 @@ class FmlogSerializer(CustomModelSerializer): is_fix = attrs.get("is_fix", False) if is_fix: attrs["mtask"] = None - elif not attrs.get("mtask", None) or not attrs.get("route", None): + elif not attrs.get("mtask", None) and not attrs.get("route", None): raise ParseError("请选择任务或工艺步骤") mtask: Mtask = attrs['mtask'] if mtask and mtask.state != Mtask.MTASK_ASSGINED: