special nhzs
Showing
2 changed files
with
20 additions
and
2 deletions
| ... | @@ -519,6 +519,8 @@ OTHER_TUPLE = (None, None, None, None, None, None, None, None, None, None, None, | ... | @@ -519,6 +519,8 @@ OTHER_TUPLE = (None, None, None, None, None, None, None, None, None, None, None, |
| 519 | # "35":"针式打印-部分格线-竖版-邮储银行", | 519 | # "35":"针式打印-部分格线-竖版-邮储银行", |
| 520 | # "36":"针式打印-部分格线-竖版-邮储银行-绿卡", | 520 | # "36":"针式打印-部分格线-竖版-邮储银行-绿卡", |
| 521 | 521 | ||
| 522 | # "38":"普通打印-无格线-农业银行-整数-特殊", | ||
| 523 | |||
| 522 | CLASSIFY_LIST = [ | 524 | CLASSIFY_LIST = [ |
| 523 | ('其他', OTHER_TUPLE), | 525 | ('其他', OTHER_TUPLE), |
| 524 | ('其他', OTHER_TUPLE), | 526 | ('其他', OTHER_TUPLE), |
| ... | @@ -560,6 +562,8 @@ CLASSIFY_LIST = [ | ... | @@ -560,6 +562,8 @@ CLASSIFY_LIST = [ |
| 560 | ('针式打印-部分格线-竖版-邮储银行', (2, None, 5, 6, None, 4, None, 7, None, None, None, None, None)), | 562 | ('针式打印-部分格线-竖版-邮储银行', (2, None, 5, 6, None, 4, None, 7, None, None, None, None, None)), |
| 561 | ('针式打印-部分格线-竖版-邮储银行-绿卡', (2, None, 5, 6, None, 4, None, 7, None, None, None, None, None)), | 563 | ('针式打印-部分格线-竖版-邮储银行-绿卡', (2, None, 5, 6, None, 4, None, 7, None, None, None, None, None)), |
| 562 | ('其他', OTHER_TUPLE), | 564 | ('其他', OTHER_TUPLE), |
| 565 | |||
| 566 | ('普通打印-无格线-农业银行-整数-特殊', (1, None, 3, 4, None, 2, None, 5, None, None, None, None, None)), | ||
| 563 | ] | 567 | ] |
| 564 | 568 | ||
| 565 | CLASSIFY_HEADER_LIST = [ | 569 | CLASSIFY_HEADER_LIST = [ |
| ... | @@ -603,6 +607,8 @@ CLASSIFY_HEADER_LIST = [ | ... | @@ -603,6 +607,8 @@ CLASSIFY_HEADER_LIST = [ |
| 603 | ('序号', '交易日期', '交易渠道', '摘要', '交易金额', '账户余额', '对方账号/卡号/汇票号', '原子账号', '交易机构名称'), | 607 | ('序号', '交易日期', '交易渠道', '摘要', '交易金额', '账户余额', '对方账号/卡号/汇票号', '原子账号', '交易机构名称'), |
| 604 | ('序号', '交易日期', '交易渠道', '摘要', '交易金额', '账户余额', '对方账号/卡号/汇票号', '原子账号', '交易机构名称'), | 608 | ('序号', '交易日期', '交易渠道', '摘要', '交易金额', '账户余额', '对方账号/卡号/汇票号', '原子账号', '交易机构名称'), |
| 605 | OTHER_TUPLE, | 609 | OTHER_TUPLE, |
| 610 | |||
| 611 | ('交易日期', '摘要/附言', '交易金额', '账户余额', '对方账号和户名'), | ||
| 606 | ] | 612 | ] |
| 607 | 613 | ||
| 608 | # ----------license相关------------------------------------------------------------------------------------------------ | 614 | # ----------license相关------------------------------------------------------------------------------------------------ |
| ... | @@ -946,6 +952,8 @@ LICENSE_CLASSIFY_SET_1 = {IC_CLASSIFY, VAT_CLASSIFY, MVC_CLASSIFY, MVI_CLASSIFY, | ... | @@ -946,6 +952,8 @@ LICENSE_CLASSIFY_SET_1 = {IC_CLASSIFY, VAT_CLASSIFY, MVC_CLASSIFY, MVI_CLASSIFY, |
| 946 | LICENSE_CLASSIFY_SET_2 = {BL_CLASSIFY, EEP_CLASSIFY, DL_CLASSIFY, PP_CLASSIFY, BC_CLASSIFY} | 952 | LICENSE_CLASSIFY_SET_2 = {BL_CLASSIFY, EEP_CLASSIFY, DL_CLASSIFY, PP_CLASSIFY, BC_CLASSIFY} |
| 947 | 953 | ||
| 948 | NYYH_CLASSIFY = {17, 18} | 954 | NYYH_CLASSIFY = {17, 18} |
| 955 | NYZS_CLASSIFY = 18 | ||
| 956 | SPECIAL_NYZS_CLASSIFY = 38 | ||
| 949 | MS_CLASSIFY = 21 | 957 | MS_CLASSIFY = 21 |
| 950 | MS_ERROR_COL = (5, 6) | 958 | MS_ERROR_COL = (5, 6) |
| 951 | WECHART_CLASSIFY = 12 | 959 | WECHART_CLASSIFY = 12 | ... | ... |
| ... | @@ -127,7 +127,7 @@ class BSWorkbook(Workbook): | ... | @@ -127,7 +127,7 @@ class BSWorkbook(Workbook): |
| 127 | max_column_list.append(ws.max_column) | 127 | max_column_list.append(ws.max_column) |
| 128 | 128 | ||
| 129 | @staticmethod | 129 | @staticmethod |
| 130 | def header_statistics(sheet_header_info, header_info, classify): | 130 | def header_statistics(sheet_header_info, header_info, classify, special_nhzs): |
| 131 | # statistics_header_info = { | 131 | # statistics_header_info = { |
| 132 | # SUMMARY_KEY: 2, | 132 | # SUMMARY_KEY: 2, |
| 133 | # DATE_KEY: 3, | 133 | # DATE_KEY: 3, |
| ... | @@ -144,6 +144,8 @@ class BSWorkbook(Workbook): | ... | @@ -144,6 +144,8 @@ class BSWorkbook(Workbook): |
| 144 | best_sheet_info = sheet_header_info.get(sheet_order_list[0]) | 144 | best_sheet_info = sheet_header_info.get(sheet_order_list[0]) |
| 145 | max_find_count = best_sheet_info.get(consts.FIND_COUNT_KEY, 0) | 145 | max_find_count = best_sheet_info.get(consts.FIND_COUNT_KEY, 0) |
| 146 | if max_find_count == 0: | 146 | if max_find_count == 0: |
| 147 | if special_nhzs: | ||
| 148 | classify = consts.SPECIAL_NYZS_CLASSIFY | ||
| 147 | for key, value in consts.CLASSIFY_MAP.items(): | 149 | for key, value in consts.CLASSIFY_MAP.items(): |
| 148 | col = consts.CLASSIFY_LIST[classify][1][value] | 150 | col = consts.CLASSIFY_LIST[classify][1][value] |
| 149 | statistics_header_info[key] = col - 1 if isinstance(col, int) else None | 151 | statistics_header_info[key] = col - 1 if isinstance(col, int) else None |
| ... | @@ -572,6 +574,7 @@ class BSWorkbook(Workbook): | ... | @@ -572,6 +574,7 @@ class BSWorkbook(Workbook): |
| 572 | # } | 574 | # } |
| 573 | # } | 575 | # } |
| 574 | for card, summary in bs_summary.items(): | 576 | for card, summary in bs_summary.items(): |
| 577 | special_nhzs = False | ||
| 575 | new_card = self.get_new_card(card) | 578 | new_card = self.get_new_card(card) |
| 576 | # 1.原表表头收集、按照月份分割 | 579 | # 1.原表表头收集、按照月份分割 |
| 577 | # 1.1 总结首行信息 | 580 | # 1.1 总结首行信息 |
| ... | @@ -580,10 +583,17 @@ class BSWorkbook(Workbook): | ... | @@ -580,10 +583,17 @@ class BSWorkbook(Workbook): |
| 580 | header_info = {} | 583 | header_info = {} |
| 581 | max_column_list = [] | 584 | max_column_list = [] |
| 582 | sheets_list = summary.get('sheet', []) | 585 | sheets_list = summary.get('sheet', []) |
| 586 | special_nhzs_max_col = 0 | ||
| 583 | for sheet in sheets_list: | 587 | for sheet in sheets_list: |
| 584 | ws = self.get_sheet_by_name(sheet) | 588 | ws = self.get_sheet_by_name(sheet) |
| 589 | if classify == consts.NYZS_CLASSIFY: | ||
| 590 | special_nhzs_max_col += ws.max_column | ||
| 585 | self.header_collect(ws, sheet_header_info, header_info, max_column_list, classify) | 591 | self.header_collect(ws, sheet_header_info, header_info, max_column_list, classify) |
| 586 | statistics_header_info, max_find_count = self.header_statistics(sheet_header_info, header_info, classify) | 592 | # 农业银行整数表头特殊处理 |
| 593 | if classify == consts.NYZS_CLASSIFY and round(special_nhzs_max_col / len(sheets_list)) == 5: | ||
| 594 | special_nhzs = True | ||
| 595 | statistics_header_info, max_find_count = self.header_statistics( | ||
| 596 | sheet_header_info, header_info, classify, special_nhzs) | ||
| 587 | max_column = max(max_column_list) | 597 | max_column = max(max_column_list) |
| 588 | 598 | ||
| 589 | # 1.2.按月份分割 min_row 正文第一行 date_col 日期行 | 599 | # 1.2.按月份分割 min_row 正文第一行 date_col 日期行 | ... | ... |
-
Please register or sign in to post a comment