增加拉取文件之前的检查
This commit is contained in:
@@ -426,17 +426,17 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
logging.info('local_file_path:%s' % local_file_path)
|
logging.info('local_file_path:%s' % local_file_path)
|
||||||
remote_path = '/home/ftp/ftp_root/ThreeTest/XT/Before/' + local_filename
|
remote_path = '/home/ftp/ftp_root/ThreeTest/XT/Before/' + local_filename
|
||||||
logging.info('remote_path:%s' % remote_path)
|
logging.info('remote_path:%s' % remote_path)
|
||||||
# if not ftp.file_exists(remote_path):
|
if not ftp.file_exists(remote_path):
|
||||||
paload_data = {
|
paload_data = {
|
||||||
"filename": local_filename
|
"filename": local_filename
|
||||||
}
|
}
|
||||||
if not ftp_resconfig['get_check_file_path']:
|
if not ftp_resconfig['get_check_file_path']:
|
||||||
raise UserError('请先配置获取检测报告地址')
|
raise UserError('请先配置获取检测报告地址')
|
||||||
url = ftp_resconfig['get_check_file_path'] + '/get/check/report'
|
url = ftp_resconfig['get_check_file_path'] + '/get/check/report'
|
||||||
response = requests.post(url, json=paload_data)
|
response = requests.post(url, json=paload_data)
|
||||||
logging.info('response:%s' % response.json())
|
logging.info('response:%s' % response.json())
|
||||||
if response.json().get('detail'):
|
if response.json().get('detail'):
|
||||||
raise UserError(response.json().get('detail'))
|
raise UserError(response.json().get('detail'))
|
||||||
|
|
||||||
if not ftp.file_exists(remote_path):
|
if not ftp.file_exists(remote_path):
|
||||||
raise UserError(f"文件不存在: {remote_path}")
|
raise UserError(f"文件不存在: {remote_path}")
|
||||||
|
|||||||
Reference in New Issue
Block a user