feat: mlogbout serializer update校验mlog

This commit is contained in:
caoqianming 2025-09-12 16:52:53 +08:00
parent 5709bc3a47
commit 649022eb57
1 changed files with 3 additions and 3 deletions

View File

@ -1077,6 +1077,9 @@ class MlogbOutUpdateSerializer(CustomModelSerializer):
# raise ParseError("mlogbdefect仅支持批次件")
# return ins
def update(self, instance, validated_data):
mlog:Mlog = instance.mlog
if mlog.submit_time is not None:
raise ParseError('生产日志已提交不可编辑')
mlogbdefect = validated_data.pop("mlogbdefect", None)
with transaction.atomic():
ins:Mlogb = super().update(instance, validated_data)
@ -1107,9 +1110,6 @@ class MlogbOutUpdateSerializer(CustomModelSerializer):
return ins
def validate(self, attrs):
mlog: Mlog = attrs.get("mlog")
if mlog.submit_time is not None:
raise ParseError('生产日志已提交不可编辑')
mlogbdefect = attrs.get("mlogbdefect", [])
if mlogbdefect:
attrs.pop("count_notok_json", None)