From 0141e539e75d99d61d1de9aa8f08bfe43562da63 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Fri, 14 Nov 2025 14:44:39 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AF=BC=E5=85=A5=E7=89=A9=E6=96=99?= =?UTF-8?q?=E6=98=8E=E7=BB=86=E6=94=AF=E6=8C=81=E7=9B=B4=E6=8E=A5=E4=BB=8E?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=E7=AD=89=E5=8C=B9=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/inm/services_daoru.py | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/apps/inm/services_daoru.py b/apps/inm/services_daoru.py index 97137496..3d93ece9 100644 --- a/apps/inm/services_daoru.py +++ b/apps/inm/services_daoru.py @@ -137,18 +137,27 @@ def daoru_mioitems(path:str, mio:MIO): mioitems = [] ind = 2 while sheet[f"a{ind}"].value: - batch = sheet[f"b{ind}"].value + batch = sheet[f"e{ind}"].value material_number = sheet[f"a{ind}"].value - try: - material = Material.objects.get(number=material_number) - except Exception as e: - raise ParseError(f"未找到物料:{material_number} {e}") + if material_number: + try: + material = Material.objects.get(number=material_number) + except Exception as e: + raise ParseError(f"未找到物料:{material_number} {e}") + else: + material_name = sheet[f"b{ind}"].value + material_model = sheet[f"c{ind}"].value + material_specification = sheet[f"d{ind}"].value + try: + material = Material.objects.get(name=material_name, model=material_model, specification=material_specification) + except Exception as e: + raise ParseError(f"未找到物料:{material_name} {material_model} {material_specification} {e}") if batch: pass else: batch = "无" - count = sheet[f"c{ind}"].value - warehouse_name = sheet[f"d{ind}"].value + count = sheet[f"f{ind}"].value + warehouse_name = sheet[f"g{ind}"].value try: warehouse = WareHouse.objects.get(name=warehouse_name) except Exception as e: