修改获取编程文件根目录
This commit is contained in:
@@ -1410,10 +1410,10 @@ class MrpProduction(models.Model):
|
|||||||
for file_name in files_r:
|
for file_name in files_r:
|
||||||
file_path = os.path.join(program_path_tmp_panel, file_name)
|
file_path = os.path.join(program_path_tmp_panel, file_name)
|
||||||
os.remove(file_path)
|
os.remove(file_path)
|
||||||
# download_state = self.env['sf.cnc.processing'].download_file_tmp(result['folder_name'],
|
download_state = self.env['sf.cnc.processing'].download_file_tmp(result['folder_name'],
|
||||||
# processing_panel)
|
processing_panel)
|
||||||
# if download_state is False:
|
if download_state is False:
|
||||||
# raise UserError('编程单号为%s的CNC程序文件从FTP拉取失败' % (self.programming_no))
|
raise UserError('编程单号为%s的CNC程序文件从FTP拉取失败' % (self.programming_no))
|
||||||
productions = self.env['mrp.production'].search(
|
productions = self.env['mrp.production'].search(
|
||||||
[('programming_no', '=', self.programming_no), ('state', 'not in', ('cancel', 'done'))])
|
[('programming_no', '=', self.programming_no), ('state', 'not in', ('cancel', 'done'))])
|
||||||
if productions:
|
if productions:
|
||||||
|
|||||||
@@ -1863,7 +1863,7 @@ class CNCprocessing(models.Model):
|
|||||||
|
|
||||||
# 将FTP的多面的程序单文件下载到临时目录
|
# 将FTP的多面的程序单文件下载到临时目录
|
||||||
def download_file_tmp(self, production_no, processing_panel):
|
def download_file_tmp(self, production_no, processing_panel):
|
||||||
remotepath = os.path.join('/home/ftp/ftp_root/NC', production_no, 'return', processing_panel)
|
remotepath = os.path.join('/', production_no, 'return', processing_panel)
|
||||||
serverdir = os.path.join('/tmp', 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_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 = FtpController(str(ftp_resconfig['ftp_host']), int(ftp_resconfig['ftp_port']), ftp_resconfig['ftp_user'],
|
||||||
|
|||||||
@@ -49,13 +49,13 @@ class Sf_Mrs_Connect(http.Controller, MultiInheritController):
|
|||||||
for file_name in files_r:
|
for file_name in files_r:
|
||||||
file_path = os.path.join(program_path_tmp_r, file_name)
|
file_path = os.path.join(program_path_tmp_r, file_name)
|
||||||
os.remove(file_path)
|
os.remove(file_path)
|
||||||
# download_state = request.env['sf.cnc.processing'].with_user(
|
download_state = request.env['sf.cnc.processing'].with_user(
|
||||||
# request.env.ref("base.user_admin")).download_file_tmp(
|
request.env.ref("base.user_admin")).download_file_tmp(
|
||||||
# ret['folder_name'], r)
|
ret['folder_name'], r)
|
||||||
# if download_state is False:
|
if download_state is False:
|
||||||
# res['status'] = -2
|
res['status'] = -2
|
||||||
# res['message'] = '编程单号为%s的CNC程序文件从FTP拉取失败' % (ret['programming_no'])
|
res['message'] = '编程单号为%s的CNC程序文件从FTP拉取失败' % (ret['programming_no'])
|
||||||
# return json.JSONEncoder().encode(res)
|
return json.JSONEncoder().encode(res)
|
||||||
for production in productions:
|
for production in productions:
|
||||||
production.write({'programming_state': '已编程', 'work_state': '已编程', 'is_rework': False})
|
production.write({'programming_state': '已编程', 'work_state': '已编程', 'is_rework': False})
|
||||||
for panel in ret['processing_panel'].split(','):
|
for panel in ret['processing_panel'].split(','):
|
||||||
|
|||||||
Reference in New Issue
Block a user