init cms信息覆盖问题、nsc报错问题
Showing
2 changed files
with
25 additions
and
15 deletions
... | @@ -3939,6 +3939,8 @@ def compare_thread(application_id, application_entity, uniq_seq, ocr_res_id, is_ | ... | @@ -3939,6 +3939,8 @@ def compare_thread(application_id, application_entity, uniq_seq, ocr_res_id, is_ |
3939 | '[is_ca={5}] [is_cms]={6}'.format(log_base, application_entity, application_id, uniq_seq, | 3939 | '[is_ca={5}] [is_cms]={6}'.format(log_base, application_entity, application_id, uniq_seq, |
3940 | ocr_res_id, is_ca, is_cms)) | 3940 | ocr_res_id, is_ca, is_cms)) |
3941 | return | 3941 | return |
3942 | else: | ||
3943 | compare_log.info('{0} [comparison info 1] [entity={1}] [id={2}] [last_obj={3}]'.format(log_base, application_entity, application_id, last_obj)) | ||
3942 | 3944 | ||
3943 | # 查看此订单号下是否有未完成的文件,如果有,等?分钟 | 3945 | # 查看此订单号下是否有未完成的文件,如果有,等?分钟 |
3944 | try: | 3946 | try: |
... | @@ -3968,6 +3970,10 @@ def compare_thread(application_id, application_entity, uniq_seq, ocr_res_id, is_ | ... | @@ -3968,6 +3970,10 @@ def compare_thread(application_id, application_entity, uniq_seq, ocr_res_id, is_ |
3968 | compare_log.info('[sleep error] [error={0}]'.format(traceback.format_exc())) | 3970 | compare_log.info('[sleep error] [error={0}]'.format(traceback.format_exc())) |
3969 | compare_log.info('{0} [comparison unfinished file wait delay_time end] [entity={1}] [id={2}] [doc_id={3}]'.format(log_base, application_entity, application_id, doc_wait_file_result.id)) | 3971 | compare_log.info('{0} [comparison unfinished file wait delay_time end] [entity={1}] [id={2}] [doc_id={3}]'.format(log_base, application_entity, application_id, doc_wait_file_result.id)) |
3970 | 3972 | ||
3973 | # 等待结束后,重新查询cms最新信息 | ||
3974 | last_obj = comparison_class.objects.filter(application_id=application_id).last() | ||
3975 | compare_log.info('{0} [comparison info 2] [entity={1}] [id={2}] [last_obj={3}]'.format(log_base, application_entity, application_id, last_obj)) | ||
3976 | |||
3971 | # 根据application_id查找OCR累计结果指定license字段,如果没有,结束 | 3977 | # 根据application_id查找OCR累计结果指定license字段,如果没有,结束 |
3972 | if is_ca: | 3978 | if is_ca: |
3973 | result_class = HILOCRResult if application_entity == consts.HIL_PREFIX else AFCOCRResult | 3979 | result_class = HILOCRResult if application_entity == consts.HIL_PREFIX else AFCOCRResult | ... | ... |
... | @@ -11,6 +11,7 @@ from apps.account.authentication import OAuth2AuthenticationWithUser | ... | @@ -11,6 +11,7 @@ from apps.account.authentication import OAuth2AuthenticationWithUser |
11 | from apps.doc.models import NscInvoice | 11 | from apps.doc.models import NscInvoice |
12 | import json | 12 | import json |
13 | from datetime import datetime | 13 | from datetime import datetime |
14 | import traceback | ||
14 | 15 | ||
15 | params = { | 16 | params = { |
16 | 'invoiceCode': fields.Str(required=True, validate=validate.Length(max=128)), | 17 | 'invoiceCode': fields.Str(required=True, validate=validate.Length(max=128)), |
... | @@ -39,21 +40,24 @@ class NSCInvoiceView(GenericView): | ... | @@ -39,21 +40,24 @@ class NSCInvoiceView(GenericView): |
39 | 40 | ||
40 | @use_args(input_args, location='data') | 41 | @use_args(input_args, location='data') |
41 | def post(self, request, args): # interface_report mpos to ocr | 42 | def post(self, request, args): # interface_report mpos to ocr |
42 | content = args.get('content', {}) | 43 | try: |
43 | invoice_code = content.get('invoiceCode', '') | 44 | content = args.get('content', {}) |
44 | invoice_number = content.get('invoiceNumber', '') | 45 | invoice_code = content.get('invoiceCode', '') |
45 | issue_date = content.get('issueDate', None) | 46 | invoice_number = content.get('invoiceNumber', '') |
46 | buyer_name = content.get('buyerName', '') | 47 | issue_date = content.get('issueDate', None) |
47 | buyer_id = content.get('buyerId', 0) | 48 | buyer_name = content.get('buyerName', '') |
48 | vin = content.get('vin', '') | 49 | buyer_id = content.get('buyerId', 0) |
49 | dealer = content.get('dealer', '') | 50 | vin = content.get('vin', '') |
50 | price_with_vat = content.get('priceWithVat', 0.0) | 51 | dealer = content.get('dealer', '') |
51 | price_no_vat = content.get('priceNoVat', 0.0) | 52 | price_with_vat = content.get('priceWithVat', 0.0) |
52 | price_in_capitals = content.get('priceInCapitals', '') | 53 | price_no_vat = content.get('priceNoVat', 0.0) |
53 | vat = content.get('vat', 0.0) | 54 | price_in_capitals = content.get('priceInCapitals', '') |
54 | vat_rate = content.get('vatRate', 0.0) | 55 | vat = content.get('vat', 0.0) |
55 | 56 | vat_rate = content.get('vatRate', 0.0) | |
56 | NscInvoice.objects.create(vin=vin, content=json.dumps(content), create_time=datetime.now()) | 57 | |
58 | NscInvoice.objects.create(vin=vin, content=json.dumps(content), create_time=datetime.now()) | ||
59 | except Exception as e: | ||
60 | LoggerMixin.running_log.info('[NSCInvoice save failed] [error={0}]'.format(traceback.format_exc())) | ||
57 | return response.ok() | 61 | return response.ok() |
58 | 62 | ||
59 | 63 | ... | ... |
-
Please register or sign in to post a comment