ftp文件下载适配开发环境

This commit is contained in:
胡尧
2024-10-10 10:47:46 +08:00
parent 94f57629e5
commit b6b92ab1da
2 changed files with 8 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
import re
import json
import json, tempfile
import logging
import base64
import urllib.parse
@@ -1527,7 +1527,8 @@ class CNCprocessing(models.Model):
# 将FTP的多面的程序单文件下载到临时目录
def download_file_tmp(self, production_no, 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)
tmp_path = tempfile.gettempdir()
serverdir = os.path.join(tmp_path, 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'],
ftp_resconfig['ftp_password'])
@@ -1891,7 +1892,7 @@ class WorkPieceDelivery(models.Model):
logging.info('delivery_item-name:%s' % delivery_item.name)
delivery_item.write({
'task_delivery_time': fields.Datetime.now(),
'status': '待配送'
'status': '已下发'
})
if delivery_item.type == "上产线":
delivery_item.workorder_id.write({'is_delivery': True})