8a3a0bab by 周伟奇

fix bug

1 parent ef85abbe
......@@ -1091,8 +1091,8 @@ ID_TYPE_COMPARE = {
# 车辆登记证
PCUSD_MVC = [
('vinNo', '9.车辆识别代号/车架号', 'common_compare', {}, 'vinNoResult'),
('manufactureDate', '32.车辆出厂日期', 'common_compare', {}, 'manufactureDateResult'),
('firstRegistrationDate', '3.登记日期', 'common_compare', {}, 'firstRegistrationDateResult'),
('manufactureDate', '32.车辆出厂日期', 'date_compare', {}, 'manufactureDateResult'),
('firstRegistrationDate', '3.登记日期', 'date_compare', {}, 'firstRegistrationDateResult'),
]
# 行驶证
......
......@@ -77,18 +77,25 @@ class Comparison:
except Exception as e:
ocr_output = None
else:
ocr_output = ocr_str
try:
ocr_output = datetime.strptime(ocr_str, '%Y-%m-%d').strftime('%Y-%m-%d')
except Exception as e:
ocr_output = None
return self.build_res(input_str == ocr_str), ocr_output
def rmb_compare(self, input_str, ocr_str, idx, **kwargs):
if not isinstance(input_str, str) or not isinstance(ocr_str, str):
return self.RESULT_N, None
input_rmb_upper = to_rmb_upper(float(input_str))
res = self.build_res(input_rmb_upper == ocr_str)
if res == self.RESULT_Y:
return res, input_str
try:
input_rmb_upper = to_rmb_upper(float(input_str))
res = self.build_res(input_rmb_upper == ocr_str)
except Exception as e:
return self.RESULT_N, None
else:
return res, None
if res == self.RESULT_Y:
return res, input_str
else:
return res, None
def type_compare(self, input_str, ocr_str, idx, **kwargs):
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!