feat: mlogboutupdate兼容性处理

This commit is contained in:
caoqianming 2025-02-28 15:38:36 +08:00
parent 286a5306e3
commit c5bcfb4e53
1 changed files with 8 additions and 9 deletions

View File

@ -748,11 +748,10 @@ class MlogbOutUpdateSerializer(CustomModelSerializer):
def validate(self, attrs):
mlogbdefect = attrs.get("mlogbdefect", [])
if mlogbdefect:
pass
# attrs.pop("count_notok_json")
# for i in attrs:
# if 'count_n_' in i:
# attrs.pop(i, None)
attrs.pop("count_notok_json")
for i in attrs:
if 'count_n_' in i:
attrs.pop(i, None)
else:
count_notok_json = attrs.get('count_notok_json', [])
# count_notok_json字段处理
@ -782,10 +781,10 @@ class MlogbOutUpdateSerializer(CustomModelSerializer):
raise ParseError(f'{i}不存在')
count_notok = count_notok + attrs[i]
attrs['count_notok'] = count_notok
if attrs['count_real'] >= attrs['count_ok'] + attrs['count_notok']:
pass
else:
raise ParseError('生产数量不能小于合格数量')
if attrs['count_real'] >= attrs['count_ok'] + attrs['count_notok']:
pass
else:
raise ParseError('生产数量不能小于合格数量')
return attrs
class MlogRevertSerializer(serializers.Serializer):