feat: mioitemcreate 增加校验

This commit is contained in:
caoqianming 2025-03-19 18:51:31 +08:00
parent a0084f7825
commit 1761dcdf6d
1 changed files with 6 additions and 0 deletions

View File

@ -119,6 +119,12 @@ class MIOItemCreateSerializer(CustomModelSerializer):
mio:MIO = validated_data['mio']
mb = validated_data.get('mb', None)
wm = validated_data.get('wm', None)
if mio.type == MIO.MIO_TYPE_DO_IN:
if not wm:
raise ParseError('生产入库必须指定车间库存')
elif mio.type == MIO.MIO_TYPE_DO_OUT:
if not mb:
raise ParseError('生产领料必须指定仓库库存')
if mb:
validated_data["material"] = mb.material
validated_data["batch"] = mb.batch