d19ca8f1 by 周伟奇

purne back

1 parent 60c6551b
...@@ -871,7 +871,7 @@ class Command(BaseCommand, LoggerMixin): ...@@ -871,7 +871,7 @@ class Command(BaseCommand, LoggerMixin):
871 # 重构Excel文件 871 # 重构Excel文件
872 # src_excel_path = os.path.join(doc_data_path, 'src.xlsx') 872 # src_excel_path = os.path.join(doc_data_path, 'src.xlsx')
873 # wb.save(src_excel_path) 873 # wb.save(src_excel_path)
874 wb.rebuild(merged_bs_summary, license_summary, res_list, doc.document_scheme) 874 count_list = wb.rebuild(merged_bs_summary, license_summary, res_list, doc.document_scheme)
875 wb.save(excel_path) 875 wb.save(excel_path)
876 876
877 except Exception as e: 877 except Exception as e:
...@@ -918,9 +918,9 @@ class Command(BaseCommand, LoggerMixin): ...@@ -918,9 +918,9 @@ class Command(BaseCommand, LoggerMixin):
918 try: 918 try:
919 doc.end_time = timezone.now() 919 doc.end_time = timezone.now()
920 doc.duration = min((doc.end_time - doc.start_time).seconds, 32760) 920 doc.duration = min((doc.end_time - doc.start_time).seconds, 32760)
921 # for field, count in count_list: 921 for field, count in count_list:
922 # if hasattr(doc, field): 922 if hasattr(doc, field):
923 # setattr(doc, field, count) 923 setattr(doc, field, count)
924 doc.save() 924 doc.save()
925 except Exception as e: 925 except Exception as e:
926 self.online_log.error('{0} [process error (db save)] [task={1}] [error={2}]'.format( 926 self.online_log.error('{0} [process error (db save)] [task={1}] [error={2}]'.format(
......
...@@ -633,12 +633,12 @@ class BSWorkbook(Workbook): ...@@ -633,12 +633,12 @@ class BSWorkbook(Workbook):
633 for sheet in sheets_list: 633 for sheet in sheets_list:
634 self.remove(self.get_sheet_by_name(sheet)) 634 self.remove(self.get_sheet_by_name(sheet))
635 635
636 def license_rebuild(self, license_summary, document_scheme): 636 def license_rebuild(self, license_summary, document_scheme, count_list):
637 for classify, (_, name, field_order, side_diff, scheme_diff, _) in consts.LICENSE_ORDER: 637 for classify, (_, name, field_order, side_diff, scheme_diff, field_str) in consts.LICENSE_ORDER:
638 license_list = license_summary.get(classify) 638 license_list = license_summary.get(classify)
639 if not license_list: 639 if not license_list:
640 continue 640 continue
641 # count = 0 641 count = 0
642 ws = self.create_sheet(name) 642 ws = self.create_sheet(name)
643 if scheme_diff and document_scheme == consts.DOC_SCHEME_LIST[1]: 643 if scheme_diff and document_scheme == consts.DOC_SCHEME_LIST[1]:
644 classify = consts.MVC_CLASSIFY_SE 644 classify = consts.MVC_CLASSIFY_SE
...@@ -653,8 +653,8 @@ class BSWorkbook(Workbook): ...@@ -653,8 +653,8 @@ class BSWorkbook(Workbook):
653 else: 653 else:
654 ws.append((write_field, field_value)) 654 ws.append((write_field, field_value))
655 ws.append((None, )) 655 ws.append((None, ))
656 # count += 1 656 count += 1
657 # count_list.append((field_str, count)) 657 count_list.append((field_str, count))
658 658
659 def simple_license_rebuild(self, license_summary, document_scheme): 659 def simple_license_rebuild(self, license_summary, document_scheme):
660 # for ic_license_dict in license_summary.get(consts.IC_CLASSIFY, []): 660 # for ic_license_dict in license_summary.get(consts.IC_CLASSIFY, []):
...@@ -708,13 +708,13 @@ class BSWorkbook(Workbook): ...@@ -708,13 +708,13 @@ class BSWorkbook(Workbook):
708 self.remove(self.get_sheet_by_name('Sheet')) 708 self.remove(self.get_sheet_by_name('Sheet'))
709 709
710 def rebuild(self, bs_summary, license_summary, res_list, document_scheme): 710 def rebuild(self, bs_summary, license_summary, res_list, document_scheme):
711 # count_list = [(consts.MODEL_FIELD_BS, len(self.sheetnames) - 1)] 711 count_list = [(consts.MODEL_FIELD_BS, len(self.sheetnames) - 1)]
712 if document_scheme == consts.DOC_SCHEME_LIST[1]: 712 if document_scheme == consts.DOC_SCHEME_LIST[1]:
713 self.license_rebuild(license_summary, document_scheme) 713 self.license_rebuild(license_summary, document_scheme, count_list)
714 self.bs_rebuild(bs_summary) 714 self.bs_rebuild(bs_summary)
715 else: 715 else:
716 self.bs_rebuild(bs_summary) 716 self.bs_rebuild(bs_summary)
717 self.license_rebuild(license_summary, document_scheme) 717 self.license_rebuild(license_summary, document_scheme, count_list)
718 self.res_sheet(res_list) 718 self.res_sheet(res_list)
719 self.remove_base_sheet() 719 self.remove_base_sheet()
720 # return count_list 720 return count_list
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!