f5ed232c by 周伟奇

fix bug

1 parent 939cde2e
...@@ -896,6 +896,7 @@ OTHER_CLASSIFY_SET = {OTHER_CLASSIFY} ...@@ -896,6 +896,7 @@ OTHER_CLASSIFY_SET = {OTHER_CLASSIFY}
896 LICENSE_CLASSIFY_SET_1 = {IC_CLASSIFY, VAT_CLASSIFY, MVC_CLASSIFY, MVI_CLASSIFY} 896 LICENSE_CLASSIFY_SET_1 = {IC_CLASSIFY, VAT_CLASSIFY, MVC_CLASSIFY, MVI_CLASSIFY}
897 LICENSE_CLASSIFY_SET_2 = {BL_CLASSIFY, UCI_CLASSIFY, EEP_CLASSIFY, DL_CLASSIFY, PP_CLASSIFY, BC_CLASSIFY} 897 LICENSE_CLASSIFY_SET_2 = {BL_CLASSIFY, UCI_CLASSIFY, EEP_CLASSIFY, DL_CLASSIFY, PP_CLASSIFY, BC_CLASSIFY}
898 898
899 MS_CLASSIFY = 21
899 WECHART_CLASSIFY = 12 900 WECHART_CLASSIFY = 12
900 WECHART_HEADERS_MAPPING = copy.deepcopy(HEADERS_MAPPING) 901 WECHART_HEADERS_MAPPING = copy.deepcopy(HEADERS_MAPPING)
901 WECHART_HEADERS_MAPPING.update( 902 WECHART_HEADERS_MAPPING.update(
......
...@@ -312,14 +312,16 @@ class BSWorkbook(Workbook): ...@@ -312,14 +312,16 @@ class BSWorkbook(Workbook):
312 return res_str 312 return res_str
313 313
314 @staticmethod 314 @staticmethod
315 def wechart_func(row_value): 315 def wechart_func(row_value, pre_col, next_col):
316 row_value = list(row_value) 316 row_value = list(row_value)
317 if isinstance(row_value[1], str): 317 if isinstance(row_value[pre_col], str):
318 cn_chars = re.findall(consts.CN_RE, row_value[1]) 318 cn_chars = re.findall(consts.CN_RE, row_value[pre_col])
319 cn_str = ''.join(cn_chars) 319 cn_str = ''.join(cn_chars)
320 row_value[1] = re.sub(consts.CN_RE, '', row_value[1]) 320 row_value[pre_col] = re.sub(consts.CN_RE, '', row_value[pre_col])
321 if isinstance(row_value[2], str): 321 if row_value[next_col] is None:
322 row_value[2] = '{0}\n{1}'.format(cn_str, row_value[2]) 322 row_value[next_col] = cn_str
323 elif isinstance(row_value[next_col], str):
324 row_value[next_col] = '{0}\n{1}'.format(cn_str, row_value[next_col])
323 return row_value 325 return row_value
324 326
325 def build_month_sheet(self, ms, card, month_mapping, is_reverse, statistics_header_info, max_column, classify): 327 def build_month_sheet(self, ms, card, month_mapping, is_reverse, statistics_header_info, max_column, classify):
...@@ -355,7 +357,9 @@ class BSWorkbook(Workbook): ...@@ -355,7 +357,9 @@ class BSWorkbook(Workbook):
355 for row_value in ws.iter_rows(min_row=part[1], max_row=part[2], values_only=True): 357 for row_value in ws.iter_rows(min_row=part[1], max_row=part[2], values_only=True):
356 if any(row_value): 358 if any(row_value):
357 if classify == consts.WECHART_CLASSIFY: 359 if classify == consts.WECHART_CLASSIFY:
358 row_value = self.wechart_func(row_value) 360 row_value = self.wechart_func(row_value, 1, 2)
361 elif classify == consts.MS_CLASSIFY:
362 row_value = self.wechart_func(row_value, 5, 6)
359 new_ws.append(row_value) 363 new_ws.append(row_value)
360 # 3.2.提取信息、高亮 364 # 3.2.提取信息、高亮
361 amount_mapping = {} 365 amount_mapping = {}
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!