feat: handover create 对handoverb进行处理

This commit is contained in:
caoqianming 2024-09-05 14:56:55 +08:00
parent 51a649c864
commit ec441d770b
1 changed files with 6 additions and 1 deletions

View File

@ -634,12 +634,17 @@ class HandoverSerializer(CustomModelSerializer):
def create(self, validated_data):
type = validated_data['type']
handoverb = validated_data.pop('handoverb', [])
if type == Handover.H_REPAIR:
recive_mgroup = validated_data.get("recive_mgroup", None)
if recive_mgroup is None:
raise ParseError('返工交接需指定工段')
validated_data['material_changed'] = find_material_can_change(validated_data['material'], recive_mgroup)
return super().create(validated_data)
with transaction.atomic():
ins = super().create(validated_data)
for item in handoverb:
Handoverb.objects.get_or_create(handover=ins, wm=item["wm"], count=item["count"])
return ins
class HandoverUpdateSerializer(CustomModelSerializer):
class Meta: