Merge branch 'master' of https://e.coding.net/ctcdevteam/ehs/ehs_server
This commit is contained in:
commit
1a65e95127
|
@ -232,7 +232,6 @@ def compare_lists_of_dicts(list1, list2, ignore_order=False):
|
||||||
|
|
||||||
def compare_values(val1, val2, ignore_order=False):
|
def compare_values(val1, val2, ignore_order=False):
|
||||||
"""通用比较函数,也可以处理字典和列表。"""
|
"""通用比较函数,也可以处理字典和列表。"""
|
||||||
print(val1, val2)
|
|
||||||
if isinstance(val1, list) and isinstance(val2, list):
|
if isinstance(val1, list) and isinstance(val2, list):
|
||||||
# 假设这里我们关心列表中对象的顺序
|
# 假设这里我们关心列表中对象的顺序
|
||||||
return compare_lists_of_dicts(val1, val2, ignore_order)
|
return compare_lists_of_dicts(val1, val2, ignore_order)
|
||||||
|
|
|
@ -271,20 +271,10 @@ class MlogSerializer(CustomModelSerializer):
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
mlogb = validated_data.pop('mlogb', [])
|
mlogb = validated_data.pop('mlogb', [])
|
||||||
instance = super().update(instance, validated_data)
|
instance = super().update(instance, validated_data)
|
||||||
brotherId_should_list = instance.material_out.brothers
|
if mlogb:
|
||||||
if brotherId_should_list:
|
Mlogb.objects.filter(mlog=instance).update(count_ok=0)
|
||||||
if mlogb:
|
for item in mlogb:
|
||||||
for item in mlogb:
|
Mlogb.objects.filter(mlog=instance, material_out=item['material_out']).update(count_ok=item['count_ok'])
|
||||||
id = item.get('id', None)
|
|
||||||
if id:
|
|
||||||
mlogb = Mlogb.objects.get(id=id)
|
|
||||||
mlogb.count_ok = item['count_ok']
|
|
||||||
mlogb.save()
|
|
||||||
# elif item['material_out'].id in brotherId_should_list:
|
|
||||||
# Mlogb.objects.create(
|
|
||||||
# mlog=instance, material_out=item['material_out'], count_ok=item['count_ok'])
|
|
||||||
else:
|
|
||||||
raise ValidationError('缺少产出物信息')
|
|
||||||
return instance
|
return instance
|
||||||
|
|
||||||
def validate(self, attrs):
|
def validate(self, attrs):
|
||||||
|
|
Loading…
Reference in New Issue