feat: 批次号格式错误的校验

This commit is contained in:
caoqianming 2025-11-21 11:01:59 +08:00
parent 5d7c681983
commit 5fa4881614
2 changed files with 4 additions and 0 deletions

View File

@ -156,6 +156,8 @@ class MIOItemCreateSerializer(CustomModelSerializer):
batch = validated_data.get("batch", None) batch = validated_data.get("batch", None)
if not batch: if not batch:
batch = "" batch = ""
if batch != '' and len(batch) < 5:
raise ParseError('批次号格式错误')
if material.is_hidden: if material.is_hidden:
raise ParseError('隐式物料不可出入库') raise ParseError('隐式物料不可出入库')
if mio.type in [MIO.MIO_TYPE_RETURN_IN, MIO.MIO_TYPE_BORROW_OUT]: if mio.type in [MIO.MIO_TYPE_RETURN_IN, MIO.MIO_TYPE_BORROW_OUT]:

View File

@ -156,6 +156,8 @@ def daoru_mioitems(path:str, mio:MIO):
pass pass
else: else:
batch = "" batch = ""
if batch != '' and len(batch) < 5:
raise ParseError('批次号格式错误')
count = sheet[f"f{ind}"].value count = sheet[f"f{ind}"].value
warehouse_name = sheet[f"g{ind}"].value warehouse_name = sheet[f"g{ind}"].value
try: try: