diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index ff977f7c..2331cea9 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -426,17 +426,17 @@ class ResMrpWorkOrder(models.Model): logging.info('local_file_path:%s' % local_file_path) remote_path = '/home/ftp/ftp_root/ThreeTest/XT/Before/' + local_filename logging.info('remote_path:%s' % remote_path) - # if not ftp.file_exists(remote_path): - paload_data = { - "filename": local_filename - } - if not ftp_resconfig['get_check_file_path']: - raise UserError('请先配置获取检测报告地址') - url = ftp_resconfig['get_check_file_path'] + '/get/check/report' - response = requests.post(url, json=paload_data) - logging.info('response:%s' % response.json()) - if response.json().get('detail'): - raise UserError(response.json().get('detail')) + if not ftp.file_exists(remote_path): + paload_data = { + "filename": local_filename + } + if not ftp_resconfig['get_check_file_path']: + raise UserError('请先配置获取检测报告地址') + url = ftp_resconfig['get_check_file_path'] + '/get/check/report' + response = requests.post(url, json=paload_data) + logging.info('response:%s' % response.json()) + if response.json().get('detail'): + raise UserError(response.json().get('detail')) if not ftp.file_exists(remote_path): raise UserError(f"文件不存在: {remote_path}")