d19ca8f1 by 周伟奇

purne back

1 parent 60c6551b
......@@ -871,7 +871,7 @@ class Command(BaseCommand, LoggerMixin):
# 重构Excel文件
# src_excel_path = os.path.join(doc_data_path, 'src.xlsx')
# wb.save(src_excel_path)
wb.rebuild(merged_bs_summary, license_summary, res_list, doc.document_scheme)
count_list = wb.rebuild(merged_bs_summary, license_summary, res_list, doc.document_scheme)
wb.save(excel_path)
except Exception as e:
......@@ -918,9 +918,9 @@ class Command(BaseCommand, LoggerMixin):
try:
doc.end_time = timezone.now()
doc.duration = min((doc.end_time - doc.start_time).seconds, 32760)
# for field, count in count_list:
# if hasattr(doc, field):
# setattr(doc, field, count)
for field, count in count_list:
if hasattr(doc, field):
setattr(doc, field, count)
doc.save()
except Exception as e:
self.online_log.error('{0} [process error (db save)] [task={1}] [error={2}]'.format(
......
......@@ -633,12 +633,12 @@ class BSWorkbook(Workbook):
for sheet in sheets_list:
self.remove(self.get_sheet_by_name(sheet))
def license_rebuild(self, license_summary, document_scheme):
for classify, (_, name, field_order, side_diff, scheme_diff, _) in consts.LICENSE_ORDER:
def license_rebuild(self, license_summary, document_scheme, count_list):
for classify, (_, name, field_order, side_diff, scheme_diff, field_str) in consts.LICENSE_ORDER:
license_list = license_summary.get(classify)
if not license_list:
continue
# count = 0
count = 0
ws = self.create_sheet(name)
if scheme_diff and document_scheme == consts.DOC_SCHEME_LIST[1]:
classify = consts.MVC_CLASSIFY_SE
......@@ -653,8 +653,8 @@ class BSWorkbook(Workbook):
else:
ws.append((write_field, field_value))
ws.append((None, ))
# count += 1
# count_list.append((field_str, count))
count += 1
count_list.append((field_str, count))
def simple_license_rebuild(self, license_summary, document_scheme):
# for ic_license_dict in license_summary.get(consts.IC_CLASSIFY, []):
......@@ -708,13 +708,13 @@ class BSWorkbook(Workbook):
self.remove(self.get_sheet_by_name('Sheet'))
def rebuild(self, bs_summary, license_summary, res_list, document_scheme):
# count_list = [(consts.MODEL_FIELD_BS, len(self.sheetnames) - 1)]
count_list = [(consts.MODEL_FIELD_BS, len(self.sheetnames) - 1)]
if document_scheme == consts.DOC_SCHEME_LIST[1]:
self.license_rebuild(license_summary, document_scheme)
self.license_rebuild(license_summary, document_scheme, count_list)
self.bs_rebuild(bs_summary)
else:
self.bs_rebuild(bs_summary)
self.license_rebuild(license_summary, document_scheme)
self.license_rebuild(license_summary, document_scheme, count_list)
self.res_sheet(res_list)
self.remove_base_sheet()
# return count_list
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!