fix bug
Showing
3 changed files
with
10 additions
and
9 deletions
... | @@ -79,7 +79,7 @@ TRANS_MAP = { | ... | @@ -79,7 +79,7 @@ TRANS_MAP = { |
79 | TRANS = str.maketrans(TRANS_MAP) | 79 | TRANS = str.maketrans(TRANS_MAP) |
80 | ERROR_CHARS = {'.', '。', ':', ':', '•', '·', ',', ','} | 80 | ERROR_CHARS = {'.', '。', ':', ':', '•', '·', ',', ','} |
81 | RES_SHEET_NAME = '结果统计' | 81 | RES_SHEET_NAME = '结果统计' |
82 | RES_SHEET_HEADER = ('页码', '序号', '结果') | 82 | RES_SHEET_HEADER = ('页码', '图片序号', '检测图片序号', '结果') |
83 | RES_SUCCESS = '识别成功' | 83 | RES_SUCCESS = '识别成功' |
84 | RES_SUCCESS_OTHER = '识别成功(其他类)' | 84 | RES_SUCCESS_OTHER = '识别成功(其他类)' |
85 | RES_SUCCESS_EMPTY = '识别成功(空数据)' | 85 | RES_SUCCESS_EMPTY = '识别成功(空数据)' | ... | ... |
... | @@ -108,7 +108,7 @@ class Command(BaseCommand, LoggerMixin): | ... | @@ -108,7 +108,7 @@ class Command(BaseCommand, LoggerMixin): |
108 | res_list.append((pno, ino, part_idx, consts.RES_SUCCESS_EMPTY)) | 108 | res_list.append((pno, ino, part_idx, consts.RES_SUCCESS_EMPTY)) |
109 | return | 109 | return |
110 | # confidence = ocr_data.get('confidence', 1) | 110 | # confidence = ocr_data.get('confidence', 1) |
111 | img_name = 'page_{0}_img_{1}'.format(pno, ino) | 111 | img_name = 'page_{0}_img_{1}_{2}'.format(pno, ino, part_idx) |
112 | cells_exists = False | 112 | cells_exists = False |
113 | for i, sheet in enumerate(sheets): | 113 | for i, sheet in enumerate(sheets): |
114 | cells = sheet.get('cells') | 114 | cells = sheet.get('cells') | ... | ... |
... | @@ -391,13 +391,14 @@ class BSWorkbook(Workbook): | ... | @@ -391,13 +391,14 @@ class BSWorkbook(Workbook): |
391 | amount_fill_row = set() | 391 | amount_fill_row = set() |
392 | 392 | ||
393 | for rows in new_ws.iter_rows(min_row=2): | 393 | for rows in new_ws.iter_rows(min_row=2): |
394 | summary_cell = None if summary_cell_idx is None else rows[summary_cell_idx] | 394 | length = len(rows) |
395 | date_cell = None if date_cell_idx is None else rows[date_cell_idx] | 395 | summary_cell = None if summary_cell_idx is None or summary_cell_idx >= length else rows[summary_cell_idx] |
396 | amount_cell = None if amount_cell_idx is None else rows[amount_cell_idx] | 396 | date_cell = None if date_cell_idx is None or date_cell_idx >= length else rows[date_cell_idx] |
397 | over_cell = None if over_cell_idx is None else rows[over_cell_idx] | 397 | amount_cell = None if amount_cell_idx is None or amount_cell_idx >= length else rows[amount_cell_idx] |
398 | income_cell = None if income_cell_idx is None else rows[income_cell_idx] | 398 | over_cell = None if over_cell_idx is None or over_cell_idx >= length else rows[over_cell_idx] |
399 | outlay_cell = None if outlay_cell_idx is None else rows[outlay_cell_idx] | 399 | income_cell = None if income_cell_idx is None or income_cell_idx >= length else rows[income_cell_idx] |
400 | borrow_cell = None if borrow_cell_idx is None else rows[borrow_cell_idx] | 400 | outlay_cell = None if outlay_cell_idx is None or outlay_cell_idx >= length else rows[outlay_cell_idx] |
401 | borrow_cell = None if borrow_cell_idx is None or borrow_cell_idx >= length else rows[borrow_cell_idx] | ||
401 | 402 | ||
402 | summary_cell_value = None if summary_cell is None else summary_cell.value | 403 | summary_cell_value = None if summary_cell is None else summary_cell.value |
403 | date_cell_value = None if date_cell is None else date_cell.value | 404 | date_cell_value = None if date_cell is None else date_cell.value | ... | ... |
-
Please register or sign in to post a comment