feat: handover增加筛选条件

This commit is contained in:
caoqianming 2025-03-06 16:36:32 +08:00
parent f7843621df
commit 73b3ab9377
2 changed files with 4 additions and 2 deletions

View File

@ -140,6 +140,7 @@ class HandoverFilter(filters.FilterSet):
"recive_mgroup": ["exact"], "recive_mgroup": ["exact"],
"recive_mgroup__name": ["exact"], "recive_mgroup__name": ["exact"],
"type": ["exact", "in"], "type": ["exact", "in"],
"mtype": ["exact", "in"]
} }

View File

@ -951,7 +951,7 @@ class HandoverSerializer(CustomModelSerializer):
if mtype == Handover.H_DIV: if mtype == Handover.H_DIV:
if not item["batch"]: if not item["batch"]:
raise ParseError(f'{ind+1}行-请提供拆批批次号') raise ParseError(f'{ind+1}行-请提供拆批批次号')
handoverb = Handoverb.objects.create(handover=ins, batch=item["batch"], count=count) handoverb = Handoverb.objects.create(handover=ins, batch=item["batch"], count=count, wm=wm)
else: else:
handoverb = Handoverb.objects.create(handover=ins, wm=wm, count=count, batch=wm.batch) handoverb = Handoverb.objects.create(handover=ins, wm=wm, count=count, batch=wm.batch)
if wm.material.tracking == Material.MA_TRACKING_SINGLE: if wm.material.tracking == Material.MA_TRACKING_SINGLE:
@ -980,7 +980,8 @@ class HandoverSerializer(CustomModelSerializer):
if validated_data["mtype"] == Handover.H_DIV: if validated_data["mtype"] == Handover.H_DIV:
if not item["batch"]: if not item["batch"]:
raise ParseError(f'{ind+1}行-请提供拆批批次号') raise ParseError(f'{ind+1}行-请提供拆批批次号')
hb, _ = Handoverb.objects.get_or_create(handover=instance, batch=item["batch"], defaults={"count": count}) hb, _ = Handoverb.objects.get_or_create(handover=instance, batch=item["batch"], wm=wm,
defaults={"count": count})
else: else:
hb, _ = Handoverb.objects.get_or_create(handover=instance, wm=wm, defaults={"count": count, hb, _ = Handoverb.objects.get_or_create(handover=instance, wm=wm, defaults={"count": count,
"batch": wm.batch}) "batch": wm.batch})