优化ftp路径

This commit is contained in:
jinling.yang
2024-04-18 19:09:48 +08:00
parent 59670fb3d7
commit 053fa3feb3
2 changed files with 24 additions and 5 deletions

View File

@@ -815,7 +815,7 @@ class ResMrpWorkOrder(models.Model):
production_no_ftp = reportpath.split('/')
production_no = workorder.production_id.name.replace('/', '_')
# ftp地址
remotepath = os.path.join('/', production_no_ftp[1], 'detection')
remotepath = os.path.join('/home/ftp/ftp_root/NC', production_no_ftp[1], 'detection')
logging.info('ftp地址:%s' % remotepath)
if reportpath.find(production_no) != -1:
# 服务器内临时地址
@@ -894,7 +894,7 @@ class CNCprocessing(models.Model):
'cutting_tool_handle_type': obj['cutting_tool_handle_type'],
'estimated_processing_time': obj['estimated_processing_time'],
'remark': obj['remark'],
'program_path': program_path.replace('/tmp', '')
'program_path': program_path.replace('/tmp', '/home/ftp/ftp_root/NC')
})
cnc_processing.get_cnc_processing_file(program_path_tmp, cnc_processing, program_path)
# cnc_workorder.state = 'done'
@@ -933,7 +933,7 @@ class CNCprocessing(models.Model):
# 将FTP的nc文件下载到临时目录
def download_file_tmp(self, production_no, processing_panel):
remotepath = os.path.join('/', production_no, 'return', processing_panel)
remotepath = os.path.join('/home/ftp/ftp_root/NC', production_no, 'return', processing_panel)
serverdir = os.path.join('/tmp', production_no, 'return', processing_panel)
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'],