feat: mioitemw为1个时自动创建

This commit is contained in:
caoqianming 2025-01-03 17:46:18 +08:00
parent 38978c9dea
commit 53f3f25030
1 changed files with 7 additions and 1 deletions

View File

@ -127,7 +127,7 @@ class MIOItemCreateSerializer(CustomModelSerializer):
def create(self, validated_data): def create(self, validated_data):
mio = validated_data['mio'] mio:MIO = validated_data['mio']
mb = validated_data.get('mb', None) mb = validated_data.get('mb', None)
wm = validated_data.get('wm', None) wm = validated_data.get('wm', None)
if mb: if mb:
@ -186,6 +186,12 @@ class MIOItemCreateSerializer(CustomModelSerializer):
raise ParseError('请提供产品明细编号') raise ParseError('请提供产品明细编号')
else: else:
raise ParseError('不支持自动生成请提供产品明细') raise ParseError('不支持自动生成请提供产品明细')
elif len(mioitemw) >= 1:
pass
elif mio.type in [MIO.MIO_TYPE_PUR_IN, MIO.MIO_TYPE_OTHER_IN] and count==1:
MIOItemw.objects.create(mioitem=instance, number=batch)
return instance return instance