diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index d4bc8542..ae3b307b 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -1206,7 +1206,9 @@ class ResMrpWorkOrder(models.Model): # 将FTP的检测报告文件下载到临时目录 def download_reportfile_tmp(self, workorder, reportpath): logging.info('reportpath/ftp地址:%s' % reportpath) - serverdir = os.path.join('/tmp', production_no_ftp[1], 'detection', workorder.processing_panel) + logging.info('processing_panel:%s' % workorder.processing_panel) + serverdir = os.path.join('/tmp', workorder.production_id.name.replace('/', '_'), 'detection', + workorder.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'], @@ -1219,13 +1221,10 @@ class ResMrpWorkOrder(models.Model): # 根据中控系统提供的检测文件地址去ftp里对应的制造订单里获取 def get_detection_file(self, workorder, reportPath): - if reportPath.startswith('/'): - reportPath = reportPath[4:] - serverdir = '/tmp' + reportPath + serverdir = os.path.join('/tmp', workorder.production_id.name.replace('/', '_'), 'detection', + workorder.processing_panel) logging.info('get_detection_file-serverdir:%s' % serverdir) - serverdir_prefix = os.path.dirname(serverdir) - logging.info('serverdir_prefix-serverdir:%s' % serverdir_prefix) - for root, dirs, files in os.walk(serverdir_prefix): + for root, dirs, files in os.walk(serverdir): for filename in files: if filename == os.path.basename(reportPath): report_file_path = os.path.join(root, filename)