获取数据按钮增加调用服务功能
This commit is contained in:
@@ -414,12 +414,10 @@ class ResMrpWorkOrder(models.Model):
|
||||
|
||||
# 获取三次元检测点数据
|
||||
def get_three_check_datas(self):
|
||||
factory_nick_name = 'XT'
|
||||
ftp_resconfig = self.env['res.config.settings'].get_values()
|
||||
ftp = FtpController(str(ftp_resconfig['ftp_host']), int(ftp_resconfig['ftp_port']),
|
||||
ftp_resconfig['ftp_user'],
|
||||
ftp_resconfig['ftp_password'])
|
||||
# ftp.connect()
|
||||
|
||||
local_dir_path = '/ftp/before'
|
||||
os.makedirs(local_dir_path, exist_ok=True)
|
||||
@@ -428,6 +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):
|
||||
raise UserError(f"文件不存在: {remote_path}")
|
||||
@@ -540,6 +549,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
raise UserError('PT10点未测或数据错误')
|
||||
|
||||
self.data_state = True
|
||||
self.getcenter()
|
||||
|
||||
return True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user