Merge branch 'feature/contract' into feature/0918
Showing
2 changed files
with
11 additions
and
7 deletions
... | @@ -209,7 +209,7 @@ class Command(BaseCommand, LoggerMixin): | ... | @@ -209,7 +209,7 @@ class Command(BaseCommand, LoggerMixin): |
209 | 209 | ||
210 | def contract_process(self, ocr_data, contract_result, res_list, pno, ino, part_idx, img_path): | 210 | def contract_process(self, ocr_data, contract_result, res_list, pno, ino, part_idx, img_path): |
211 | contract_dict = ocr_data.get('data') | 211 | contract_dict = ocr_data.get('data') |
212 | if not contract_dict or 'page_num' not in contract_dict or 'page_info' not in contract_dict: | 212 | if not contract_dict or contract_dict.get('page_num') is None or contract_dict.get('page_info') is None: |
213 | res_list.append((pno, ino, part_idx, consts.RES_SUCCESS_EMPTY)) | 213 | res_list.append((pno, ino, part_idx, consts.RES_SUCCESS_EMPTY)) |
214 | return | 214 | return |
215 | res_list.append((pno, ino, part_idx, consts.RES_SUCCESS)) | 215 | res_list.append((pno, ino, part_idx, consts.RES_SUCCESS)) | ... | ... |
... | @@ -706,12 +706,16 @@ class BSWorkbook(Workbook): | ... | @@ -706,12 +706,16 @@ class BSWorkbook(Workbook): |
706 | if len(contract_result) == 0: | 706 | if len(contract_result) == 0: |
707 | return | 707 | return |
708 | ws = self.create_sheet(consts.CONTRACT_SHEET_NAME) | 708 | ws = self.create_sheet(consts.CONTRACT_SHEET_NAME) |
709 | for page_num, info_list in contract_result.items(): | 709 | for i in range(15): |
710 | ws.append(('page {0}'.format(page_num), )) | 710 | if str(i) in contract_result: |
711 | for info in info_list: | 711 | page_num = str(i) |
712 | for row in info: | 712 | info_list = contract_result.get(page_num) |
713 | ws.append(row) | 713 | # for page_num, info_list in contract_result.items(): |
714 | ws.append((None, )) | 714 | ws.append(('page {0}'.format(page_num), )) |
715 | for info in info_list: | ||
716 | for row in info: | ||
717 | ws.append(row) | ||
718 | ws.append((None, )) | ||
715 | 719 | ||
716 | @staticmethod | 720 | @staticmethod |
717 | def remove_yuan(amount_key_set, key, src_str): | 721 | def remove_yuan(amount_key_set, key, src_str): | ... | ... |
-
Please register or sign in to post a comment