feat: 隐式物料不可出入库
This commit is contained in:
parent
a7b14994b7
commit
923ac2276c
|
@ -128,16 +128,18 @@ class MIOItemCreateSerializer(CustomModelSerializer):
|
||||||
|
|
||||||
material: Material = validated_data['material']
|
material: Material = validated_data['material']
|
||||||
batch = validated_data['batch']
|
batch = validated_data['batch']
|
||||||
|
if material.is_hidden:
|
||||||
|
raise ParseError('隐式物料不可出入库')
|
||||||
|
|
||||||
if mio.state != MIO.MIO_CREATE:
|
if mio.state != MIO.MIO_CREATE:
|
||||||
raise ValidationError('出入库记录非创建中不可新增')
|
raise ParseError('出入库记录非创建中不可新增')
|
||||||
# 生产领料要校验是否进行检验
|
# 生产领料要校验是否进行检验
|
||||||
# 某些客户此处无需校验
|
# 某些客户此处无需校验
|
||||||
check_test_when_do_out = get_sysconfig('mes.check_test_when_do_out', True)
|
check_test_when_do_out = get_sysconfig('mes.check_test_when_do_out', True)
|
||||||
if check_test_when_do_out and mio.type == MIO.MIO_TYPE_DO_OUT:
|
if check_test_when_do_out and mio.type == MIO.MIO_TYPE_DO_OUT:
|
||||||
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])
|
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()):
|
if mis.exists() and (not mis.exclude(test_date=None).exists()):
|
||||||
raise ValidationError('该批次的物料未经检验')
|
raise ParseError('该批次的物料未经检验')
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
count = validated_data["count"]
|
count = validated_data["count"]
|
||||||
batch = validated_data["batch"]
|
batch = validated_data["batch"]
|
||||||
|
|
Loading…
Reference in New Issue