|
@@ -520,6 +520,7 @@ def other_type_string_type_parent_id_create_data(db,string,type_parent_id,file_i
|
|
reslte.append(new_person_type)
|
|
reslte.append(new_person_type)
|
|
else:
|
|
else:
|
|
file_info.remark= file_info.remark+f'\n行<{row+1}>责任类别未找到<{other_type_name}>'
|
|
file_info.remark= file_info.remark+f'\n行<{row+1}>责任类别未找到<{other_type_name}>'
|
|
|
|
+ file_info.error_num +=1
|
|
return reslte ,False
|
|
return reslte ,False
|
|
return reslte ,True
|
|
return reslte ,True
|
|
def import_data(db,file_path,user_id,file_info):
|
|
def import_data(db,file_path,user_id,file_info):
|
|
@@ -530,6 +531,7 @@ def import_data(db,file_path,user_id,file_info):
|
|
sheet = book.sheet_by_index(0)
|
|
sheet = book.sheet_by_index(0)
|
|
except :
|
|
except :
|
|
file_info.remark = file_info.remark + f'\n文件打开失败,请核实文件格式为xlsx/xlx>'
|
|
file_info.remark = file_info.remark + f'\n文件打开失败,请核实文件格式为xlsx/xlx>'
|
|
|
|
+ file_info.error_num +=1
|
|
import_status = False
|
|
import_status = False
|
|
data = []
|
|
data = []
|
|
for row in range(4, sheet.nrows):
|
|
for row in range(4, sheet.nrows):
|
|
@@ -537,23 +539,27 @@ def import_data(db,file_path,user_id,file_info):
|
|
name = sheet.cell(row, 0).value
|
|
name = sheet.cell(row, 0).value
|
|
if name == '':
|
|
if name == '':
|
|
file_info.remark = file_info.remark+f'\n行<{row+1}>姓名不能为空<{name}>'
|
|
file_info.remark = file_info.remark+f'\n行<{row+1}>姓名不能为空<{name}>'
|
|
|
|
+ file_info.error_num +=1
|
|
import_status = False
|
|
import_status = False
|
|
# 所属单位
|
|
# 所属单位
|
|
unit_name = sheet.cell(row, 1).value
|
|
unit_name = sheet.cell(row, 1).value
|
|
if unit_name == '':
|
|
if unit_name == '':
|
|
file_info.remark = file_info.remark+f'\n行<{row+1}>所属单位不能为空<{unit_name}>'
|
|
file_info.remark = file_info.remark+f'\n行<{row+1}>所属单位不能为空<{unit_name}>'
|
|
|
|
+ file_info.error_num +=1
|
|
import_status = False
|
|
import_status = False
|
|
unit_id = db_dept.get_dept_id_by_name(db, unit_name)
|
|
unit_id = db_dept.get_dept_id_by_name(db, unit_name)
|
|
# 职务
|
|
# 职务
|
|
position = sheet.cell(row, 2).value
|
|
position = sheet.cell(row, 2).value
|
|
if position =='':
|
|
if position =='':
|
|
file_info.remark = file_info.remark+f'\n行<{row+1}>职务不能为空<{position}>'
|
|
file_info.remark = file_info.remark+f'\n行<{row+1}>职务不能为空<{position}>'
|
|
|
|
+ file_info.error_num +=1
|
|
import_status = False
|
|
import_status = False
|
|
|
|
|
|
# 电话号码(如有多个手机号请用“,”分隔)
|
|
# 电话号码(如有多个手机号请用“,”分隔)
|
|
phone = str(sheet.cell(row, 3).value)
|
|
phone = str(sheet.cell(row, 3).value)
|
|
if phone =='':
|
|
if phone =='':
|
|
file_info.remark = file_info.remark+f'\n行<{row+1}>电话号码不能为空<{phone}>'
|
|
file_info.remark = file_info.remark+f'\n行<{row+1}>电话号码不能为空<{phone}>'
|
|
|
|
+ file_info.error_num +=1
|
|
import_status = False
|
|
import_status = False
|
|
phone_list = [i for i in phone.split(',')]
|
|
phone_list = [i for i in phone.split(',')]
|
|
user_id_1=-1
|
|
user_id_1=-1
|
|
@@ -579,9 +585,10 @@ def import_data(db,file_path,user_id,file_info):
|
|
area_code=get_area_info_by_area_name(db,area_name)
|
|
area_code=get_area_info_by_area_name(db,area_name)
|
|
if area_code is None:
|
|
if area_code is None:
|
|
file_info.remark = file_info.remark+f'\n行<{row+1}>责任区域未找到'
|
|
file_info.remark = file_info.remark+f'\n行<{row+1}>责任区域未找到'
|
|
|
|
+ file_info.error_num +=1
|
|
import_status = False
|
|
import_status = False
|
|
- area_code = area_code.id
|
|
|
|
area_code2 = area_code.area_code
|
|
area_code2 = area_code.area_code
|
|
|
|
+ area_code = area_code.id
|
|
new_person = ThreeProofingResponsiblePerson(
|
|
new_person = ThreeProofingResponsiblePerson(
|
|
unit_id=unit_id,
|
|
unit_id=unit_id,
|
|
unit_name=unit_name,
|
|
unit_name=unit_name,
|