From 622d594795911cf124b14b891c37eb75d4699812 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Thu, 6 Feb 2025 16:56:06 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96mloginit=E6=8A=A5?= =?UTF-8?q?=E9=94=99=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wpm/serializers.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/wpm/serializers.py b/apps/wpm/serializers.py index 7605c18f..72698c8d 100644 --- a/apps/wpm/serializers.py +++ b/apps/wpm/serializers.py @@ -498,8 +498,10 @@ class MlogInitSerializer(CustomModelSerializer): mtype = attrs['mtype'] route: Route = attrs['route'] mgroup: Mgroup = attrs['mgroup'] + if route is None: + raise ParseError('缺少工艺路线') if route.process != mgroup.process: - raise ValidationError('工序不匹配') + raise ParseError('工序不匹配') attrs['hour_work'] = route.hour_work attrs['material_in'] = route.material_in attrs['material_out'] = route.material_out @@ -507,7 +509,7 @@ class MlogInitSerializer(CustomModelSerializer): if mtype == Mlog.MTYPE_OUT: supplier = attrs.get('supplier', None) if not supplier: - raise ValidationError('外协必须选择外协单位') + raise ParseError('外协必须选择外协单位') if attrs.get('work_end_time', None): attrs['handle_date'] = localdate(attrs['work_end_time']) return attrs