feat: mlogbout serializer update校验mlog
This commit is contained in:
parent
5709bc3a47
commit
649022eb57
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue