优化三次元检测报告

This commit is contained in:
jinling.yang
2024-07-31 11:51:04 +08:00
parent 1980ee2a9a
commit a46cd0f515

View File

@@ -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)