fix bug
Showing
2 changed files
with
10 additions
and
3 deletions
... | @@ -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,14 +77,21 @@ class Comparison: | ... | @@ -77,14 +77,21 @@ 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 |
89 | try: | ||
86 | input_rmb_upper = to_rmb_upper(float(input_str)) | 90 | input_rmb_upper = to_rmb_upper(float(input_str)) |
87 | res = self.build_res(input_rmb_upper == ocr_str) | 91 | res = self.build_res(input_rmb_upper == ocr_str) |
92 | except Exception as e: | ||
93 | return self.RESULT_N, None | ||
94 | else: | ||
88 | if res == self.RESULT_Y: | 95 | if res == self.RESULT_Y: |
89 | return res, input_str | 96 | return res, input_str |
90 | else: | 97 | else: | ... | ... |
-
Please register or sign in to post a comment