fix: mioitem create时校验是否混批的bug
This commit is contained in:
parent
32b39ee423
commit
2d81424009
|
|
@ -212,11 +212,18 @@ class MIOItemCreateSerializer(CustomModelSerializer):
|
|||
mio_type = mio.type
|
||||
if mio_type != "pur_in" and mio_type != "other_in":
|
||||
wprIds = [i["wpr"].id for i in mioitemw]
|
||||
mb_ids = list(Wpr.objects.filter(id__in=wprIds).values_list("mb__id", flat=True).distinct())
|
||||
if len(mb_ids) == 1 and mb_ids[0] == instance.mb.id:
|
||||
pass
|
||||
else:
|
||||
raise ParseError(f'{batch}物料明细中存在{len(mb_ids)}个不同物料批次')
|
||||
if instance.mb:
|
||||
mb_ids = list(Wpr.objects.filter(id__in=wprIds).values_list("mb__id", flat=True).distinct())
|
||||
if len(mb_ids) == 1 and mb_ids[0] == instance.mb.id:
|
||||
pass
|
||||
else:
|
||||
raise ParseError(f'{batch}物料明细中存在{len(mb_ids)}个不同物料批次')
|
||||
elif instance.wm:
|
||||
wm_ids = list(Wpr.objects.filter(id__in=wprIds).values_list("wm__id", flat=True).distinct())
|
||||
if len(wm_ids) == 1 and wm_ids[0] == instance.wm.id:
|
||||
pass
|
||||
else:
|
||||
raise ParseError(f'{batch}物料明细中存在{len(wm_ids)}个不同物料批次')
|
||||
for item in mioitemw:
|
||||
if item.get("wpr", None) is None and mio_type != "pur_in" and mio_type != "other_in":
|
||||
raise ParseError(f'{item["number"]}_请提供产品明细ID')
|
||||
|
|
|
|||
Loading…
Reference in New Issue