feat: 生产领料校验优化
This commit is contained in:
parent
0b193c6950
commit
68fc7f4217
|
|
@ -104,7 +104,8 @@ class MIOItemCreateSerializer(CustomModelSerializer):
|
|||
raise ValidationError('出入库记录非创建中不可新增')
|
||||
# 生产领料要校验是否进行检验
|
||||
if mio.type == MIO.MIO_TYPE_DO_OUT:
|
||||
if not MIOItem.objects.filter(batch=batch, material=material, mio__type=MIO.MIO_TYPE_DO_IN).exclude(test_date=None).exists():
|
||||
mis = MIOItem.objects.filter(batch=batch, material=material, mio__type__in=[MIO.MIO_TYPE_PUR_IN, MIO.MIO_TYPE_DO_IN, MIO.MIO_TYPE_OTHER_IN])
|
||||
if mis.exists() and (not mis.exclude(test_date=None).exists()):
|
||||
raise ValidationError('该批次的物料未经检验')
|
||||
with transaction.atomic():
|
||||
assemb = validated_data.pop('assemb', [])
|
||||
|
|
|
|||
Loading…
Reference in New Issue