fba048bf by 周伟奇

fix bug

1 parent ee9fa268
...@@ -250,6 +250,7 @@ HEADERS_MAPPING.update( ...@@ -250,6 +250,7 @@ HEADERS_MAPPING.update(
250 HEADERS_MAPPING.update( 250 HEADERS_MAPPING.update(
251 { 251 {
252 '借贷发生额(借:-贷:+)': AMOUNT_KEY, 252 '借贷发生额(借:-贷:+)': AMOUNT_KEY,
253 '借贷发生额(借:-贷:+)': AMOUNT_KEY,
253 } 254 }
254 ) 255 )
255 256
......
...@@ -96,8 +96,8 @@ class BSWorkbook(Workbook): ...@@ -96,8 +96,8 @@ class BSWorkbook(Workbook):
96 best_sheet_info = sheet_header_info.get(sheet_order_list[0]) 96 best_sheet_info = sheet_header_info.get(sheet_order_list[0])
97 if best_sheet_info.get(consts.FIND_COUNT_KEY, 0) == 0: 97 if best_sheet_info.get(consts.FIND_COUNT_KEY, 0) == 0:
98 for key, value in consts.CLASSIFY_MAP.items(): 98 for key, value in consts.CLASSIFY_MAP.items():
99 col = consts.CLASSIFY_LIST[classify][1][value] - 1 99 col = consts.CLASSIFY_LIST[classify][1][value]
100 statistics_header_info[key] = col 100 statistics_header_info[key] = col - 1 if isinstance(col, int) else None
101 statistics_header_info[consts.HEADER_KEY] = consts.CLASSIFY_HEADER_LIST[classify] 101 statistics_header_info[consts.HEADER_KEY] = consts.CLASSIFY_HEADER_LIST[classify]
102 else: 102 else:
103 find_col_set = best_sheet_info.get(consts.FIND_COL_KEY, set()) 103 find_col_set = best_sheet_info.get(consts.FIND_COL_KEY, set())
...@@ -113,9 +113,9 @@ class BSWorkbook(Workbook): ...@@ -113,9 +113,9 @@ class BSWorkbook(Workbook):
113 find_col_set.add(col) 113 find_col_set.add(col)
114 break 114 break
115 else: 115 else:
116 fixed_col = consts.CLASSIFY_LIST[classify][1][consts.CLASSIFY_MAP[key]] - 1 116 fixed_col = consts.CLASSIFY_LIST[classify][1][consts.CLASSIFY_MAP[key]]
117 if fixed_col not in find_col_set: 117 if fixed_col not in find_col_set and isinstance(fixed_col, int):
118 col = fixed_col 118 col = fixed_col - 1
119 find_col_set.add(col) 119 find_col_set.add(col)
120 statistics_header_info[key] = col 120 statistics_header_info[key] = col
121 statistics_header_info[consts.HEADER_KEY] = best_sheet_info.get(consts.HEADER_KEY) 121 statistics_header_info[consts.HEADER_KEY] = best_sheet_info.get(consts.HEADER_KEY)
...@@ -134,7 +134,7 @@ class BSWorkbook(Workbook): ...@@ -134,7 +134,7 @@ class BSWorkbook(Workbook):
134 break 134 break
135 else: 135 else:
136 fixed_col = consts.CLASSIFY_LIST[classify][1][consts.CLASSIFY_MAP[consts.DATE_KEY]] 136 fixed_col = consts.CLASSIFY_LIST[classify][1][consts.CLASSIFY_MAP[consts.DATE_KEY]]
137 if fixed_col not in find_col_set: 137 if fixed_col not in find_col_set and isinstance(fixed_col, int):
138 date_col = fixed_col 138 date_col = fixed_col
139 min_row = sheet_header_info.get(sheet, {}).get(consts.MIN_ROW_KEY, 2) 139 min_row = sheet_header_info.get(sheet, {}).get(consts.MIN_ROW_KEY, 2)
140 return date_col, min_row 140 return date_col, min_row
...@@ -318,20 +318,20 @@ class BSWorkbook(Workbook): ...@@ -318,20 +318,20 @@ class BSWorkbook(Workbook):
318 for rows in new_ws.iter_rows(min_row=2): 318 for rows in new_ws.iter_rows(min_row=2):
319 # TODO 删除空行 319 # TODO 删除空行
320 summary_cell = None if summary_cell_idx is None else rows[summary_cell_idx] 320 summary_cell = None if summary_cell_idx is None else rows[summary_cell_idx]
321 date_cell = None if summary_cell_idx is None else rows[date_cell_idx] 321 date_cell = None if date_cell_idx is None else rows[date_cell_idx]
322 amount_cell = None if summary_cell_idx is None else rows[amount_cell_idx] 322 amount_cell = None if amount_cell_idx is None else rows[amount_cell_idx]
323 over_cell = None if summary_cell_idx is None else rows[over_cell_idx] 323 over_cell = None if over_cell_idx is None else rows[over_cell_idx]
324 income_cell = None if summary_cell_idx is None else rows[income_cell_idx] 324 income_cell = None if income_cell_idx is None else rows[income_cell_idx]
325 outlay_cell = None if summary_cell_idx is None else rows[outlay_cell_idx] 325 outlay_cell = None if outlay_cell_idx is None else rows[outlay_cell_idx]
326 borrow_cell = None if summary_cell_idx is None else rows[borrow_cell_idx] 326 borrow_cell = None if borrow_cell_idx is None else rows[borrow_cell_idx]
327 327
328 summary_cell_value = None if summary_cell is None else summary_cell.value 328 summary_cell_value = None if summary_cell is None else summary_cell.value
329 date_cell_value = None if summary_cell is None else date_cell.value 329 date_cell_value = None if date_cell is None else date_cell.value
330 amount_cell_value = None if summary_cell is None else amount_cell.value 330 amount_cell_value = None if amount_cell is None else amount_cell.value
331 over_cell_value = None if summary_cell is None else over_cell.value 331 over_cell_value = None if over_cell is None else over_cell.value
332 income_cell_value = None if summary_cell is None else income_cell.value 332 income_cell_value = None if income_cell is None else income_cell.value
333 outlay_cell_value = None if summary_cell is None else outlay_cell.value 333 outlay_cell_value = None if outlay_cell is None else outlay_cell.value
334 borrow_cell_value = None if summary_cell is None else borrow_cell.value 334 borrow_cell_value = None if borrow_cell is None else borrow_cell.value
335 335
336 # row = summary_cell.row 336 # row = summary_cell.row
337 if summary_cell is not None: 337 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!