fba048bf by 周伟奇

fix bug

1 parent ee9fa268
......@@ -250,6 +250,7 @@ HEADERS_MAPPING.update(
HEADERS_MAPPING.update(
{
'借贷发生额(借:-贷:+)': AMOUNT_KEY,
'借贷发生额(借:-贷:+)': AMOUNT_KEY,
}
)
......
......@@ -96,8 +96,8 @@ class BSWorkbook(Workbook):
best_sheet_info = sheet_header_info.get(sheet_order_list[0])
if best_sheet_info.get(consts.FIND_COUNT_KEY, 0) == 0:
for key, value in consts.CLASSIFY_MAP.items():
col = consts.CLASSIFY_LIST[classify][1][value] - 1
statistics_header_info[key] = col
col = consts.CLASSIFY_LIST[classify][1][value]
statistics_header_info[key] = col - 1 if isinstance(col, int) else None
statistics_header_info[consts.HEADER_KEY] = consts.CLASSIFY_HEADER_LIST[classify]
else:
find_col_set = best_sheet_info.get(consts.FIND_COL_KEY, set())
......@@ -113,9 +113,9 @@ class BSWorkbook(Workbook):
find_col_set.add(col)
break
else:
fixed_col = consts.CLASSIFY_LIST[classify][1][consts.CLASSIFY_MAP[key]] - 1
if fixed_col not in find_col_set:
col = fixed_col
fixed_col = consts.CLASSIFY_LIST[classify][1][consts.CLASSIFY_MAP[key]]
if fixed_col not in find_col_set and isinstance(fixed_col, int):
col = fixed_col - 1
find_col_set.add(col)
statistics_header_info[key] = col
statistics_header_info[consts.HEADER_KEY] = best_sheet_info.get(consts.HEADER_KEY)
......@@ -134,7 +134,7 @@ class BSWorkbook(Workbook):
break
else:
fixed_col = consts.CLASSIFY_LIST[classify][1][consts.CLASSIFY_MAP[consts.DATE_KEY]]
if fixed_col not in find_col_set:
if fixed_col not in find_col_set and isinstance(fixed_col, int):
date_col = fixed_col
min_row = sheet_header_info.get(sheet, {}).get(consts.MIN_ROW_KEY, 2)
return date_col, min_row
......@@ -318,20 +318,20 @@ class BSWorkbook(Workbook):
for rows in new_ws.iter_rows(min_row=2):
# TODO 删除空行
summary_cell = None if summary_cell_idx is None else rows[summary_cell_idx]
date_cell = None if summary_cell_idx is None else rows[date_cell_idx]
amount_cell = None if summary_cell_idx is None else rows[amount_cell_idx]
over_cell = None if summary_cell_idx is None else rows[over_cell_idx]
income_cell = None if summary_cell_idx is None else rows[income_cell_idx]
outlay_cell = None if summary_cell_idx is None else rows[outlay_cell_idx]
borrow_cell = None if summary_cell_idx is None else rows[borrow_cell_idx]
date_cell = None if date_cell_idx is None else rows[date_cell_idx]
amount_cell = None if amount_cell_idx is None else rows[amount_cell_idx]
over_cell = None if over_cell_idx is None else rows[over_cell_idx]
income_cell = None if income_cell_idx is None else rows[income_cell_idx]
outlay_cell = None if outlay_cell_idx is None else rows[outlay_cell_idx]
borrow_cell = None if borrow_cell_idx is None else rows[borrow_cell_idx]
summary_cell_value = None if summary_cell is None else summary_cell.value
date_cell_value = None if summary_cell is None else date_cell.value
amount_cell_value = None if summary_cell is None else amount_cell.value
over_cell_value = None if summary_cell is None else over_cell.value
income_cell_value = None if summary_cell is None else income_cell.value
outlay_cell_value = None if summary_cell is None else outlay_cell.value
borrow_cell_value = None if summary_cell is None else borrow_cell.value
date_cell_value = None if date_cell is None else date_cell.value
amount_cell_value = None if amount_cell is None else amount_cell.value
over_cell_value = None if over_cell is None else over_cell.value
income_cell_value = None if income_cell is None else income_cell.value
outlay_cell_value = None if outlay_cell is None else outlay_cell.value
borrow_cell_value = None if borrow_cell is None else borrow_cell.value
# row = summary_cell.row
if summary_cell is not None:
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!