From eb5a8df7e0d227c2e694049d00cc1fd76c0e3010 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Wed, 4 Sep 2024 18:21:32 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20mlog=20create=20=E6=97=B6=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wpm/serializers.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/wpm/serializers.py b/apps/wpm/serializers.py index 56e9f0c4..bf21fbff 100644 --- a/apps/wpm/serializers.py +++ b/apps/wpm/serializers.py @@ -363,13 +363,21 @@ class MlogSerializer(CustomModelSerializer): fmlog = attrs.get('fmlog', None) mtaskb = attrs.get('mtaskb', None) if fmlog: + attrs['fill_way'] = Mlog.MLOG_12 + wm_in: WMaterial = attrs.get('wm_in', None) + if wm_in: + pass + else: + raise ParseError('未提供消耗的车间物料') attrs['route'] = fmlog.route attrs['mgroup'] = fmlog.mgroup attrs['mtask'] = fmlog.mtask if attrs['mtask'].mtaskb and mtaskb is None: - raise ValidationError('子任务不能为空') + raise ParseError('子任务不能为空') if mtaskb and mtaskb.mtask != fmlog.mtask: - raise ValidationError('子任务不一致') + raise ParseError('子任务不一致') + if wm_in.material != attrs['mtask'].material_in: + raise ParseError('消耗物料与任务不一致') mtask = attrs.get('mtask', None) count_notok = 0 for i in attrs: