feat: 导入物料明细支持直接从名称等匹配
This commit is contained in:
parent
75305bd1fd
commit
0141e539e7
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in New Issue