From 89449eb7c6412fe99dbd935fd6417aef933e652e Mon Sep 17 00:00:00 2001 From: caoqianming Date: Wed, 22 Jan 2025 10:14:49 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20mlogbin=20=E5=8F=AA=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=E4=B8=BB=E6=89=B9=E6=98=AF=E5=90=A6=E9=87=8D=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wpm/serializers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/wpm/serializers.py b/apps/wpm/serializers.py index 44e585d3..19079659 100644 --- a/apps/wpm/serializers.py +++ b/apps/wpm/serializers.py @@ -555,7 +555,7 @@ class MlogbInSerializer(CustomModelSerializer): def create(self, validated_data): mlog: Mlog = validated_data['mlog'] - if Mlogb.objects.filter(mlog=mlog, mtask=validated_data['mtask'], wm_in=validated_data['wm_in']).exists(): + if Mlogb.objects.filter(mlog=mlog, mtask=validated_data['mtask'], wm_in=validated_data['wm_in'], parent=None).exists(): raise ValidationError('该记录已存在') if mlog.submit_time is not None: raise ParseError('生产日志已提交不可编辑') @@ -563,7 +563,7 @@ class MlogbInSerializer(CustomModelSerializer): def update(self, instance, validated_data): mlog: Mlog = instance.mlog - if Mlogb.objects.filter(mlog=mlog, mtask=validated_data['mtask'], wm_in=validated_data['wm_in']).exclude(id=instance.id).exists(): + if Mlogb.objects.filter(mlog=mlog, mtask=validated_data['mtask'], wm_in=validated_data['wm_in'], parent=None).exclude(id=instance.id).exists(): raise ValidationError('该记录已存在') if mlog.submit_time is not None: raise ParseError('生产日志已提交不可编辑')