8a3a0bab by 周伟奇

fix bug

1 parent ef85abbe
...@@ -1091,8 +1091,8 @@ ID_TYPE_COMPARE = { ...@@ -1091,8 +1091,8 @@ ID_TYPE_COMPARE = {
1091 # 车辆登记证 1091 # 车辆登记证
1092 PCUSD_MVC = [ 1092 PCUSD_MVC = [
1093 ('vinNo', '9.车辆识别代号/车架号', 'common_compare', {}, 'vinNoResult'), 1093 ('vinNo', '9.车辆识别代号/车架号', 'common_compare', {}, 'vinNoResult'),
1094 ('manufactureDate', '32.车辆出厂日期', 'common_compare', {}, 'manufactureDateResult'), 1094 ('manufactureDate', '32.车辆出厂日期', 'date_compare', {}, 'manufactureDateResult'),
1095 ('firstRegistrationDate', '3.登记日期', 'common_compare', {}, 'firstRegistrationDateResult'), 1095 ('firstRegistrationDate', '3.登记日期', 'date_compare', {}, 'firstRegistrationDateResult'),
1096 ] 1096 ]
1097 1097
1098 # 行驶证 1098 # 行驶证
......
...@@ -77,18 +77,25 @@ class Comparison: ...@@ -77,18 +77,25 @@ class Comparison:
77 except Exception as e: 77 except Exception as e:
78 ocr_output = None 78 ocr_output = None
79 else: 79 else:
80 ocr_output = ocr_str 80 try:
81 ocr_output = datetime.strptime(ocr_str, '%Y-%m-%d').strftime('%Y-%m-%d')
82 except Exception as e:
83 ocr_output = None
81 return self.build_res(input_str == ocr_str), ocr_output 84 return self.build_res(input_str == ocr_str), ocr_output
82 85
83 def rmb_compare(self, input_str, ocr_str, idx, **kwargs): 86 def rmb_compare(self, input_str, ocr_str, idx, **kwargs):
84 if not isinstance(input_str, str) or not isinstance(ocr_str, str): 87 if not isinstance(input_str, str) or not isinstance(ocr_str, str):
85 return self.RESULT_N, None 88 return self.RESULT_N, None
86 input_rmb_upper = to_rmb_upper(float(input_str)) 89 try:
87 res = self.build_res(input_rmb_upper == ocr_str) 90 input_rmb_upper = to_rmb_upper(float(input_str))
88 if res == self.RESULT_Y: 91 res = self.build_res(input_rmb_upper == ocr_str)
89 return res, input_str 92 except Exception as e:
93 return self.RESULT_N, None
90 else: 94 else:
91 return res, None 95 if res == self.RESULT_Y:
96 return res, input_str
97 else:
98 return res, None
92 99
93 def type_compare(self, input_str, ocr_str, idx, **kwargs): 100 def type_compare(self, input_str, ocr_str, idx, **kwargs):
94 if not isinstance(input_str, str) or not isinstance(ocr_str, str): 101 if not isinstance(input_str, str) or not isinstance(ocr_str, str):
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!