From 233591728aadcfcab748329c9895c9bb80eefbe8 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Wed, 4 Sep 2024 09:13:26 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20fmlog=E5=88=9B=E5=BB=BA=E6=97=B6?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wpm/serializers.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/apps/wpm/serializers.py b/apps/wpm/serializers.py index 42338ecc..cab75060 100644 --- a/apps/wpm/serializers.py +++ b/apps/wpm/serializers.py @@ -607,6 +607,15 @@ class FmlogSerializer(CustomModelSerializer): model = Fmlog fields = '__all__' read_only_fields = EXCLUDE_FIELDS + + def validate(self, attrs): + route: Route = attrs['route'] + mtask: Mtask = attrs['mtask'] + mgroup: Mgroup = attrs['mgroup'] + if route.process != mgroup.process: + raise ParseError('工序不匹配') + if mtask.mgroup != mgroup: + raise ParseError('工段不匹配') class FmlogUpdateSerializer(CustomModelSerializer): class Meta: