增加打印模块,增加工单下发后打印程序单
This commit is contained in:
@@ -5,7 +5,7 @@ from odoo.addons.sf_machine_connect.models.ftp_operate import transfer_nc_files
|
||||
|
||||
class MainController(http.Controller):
|
||||
|
||||
@http.route('/api/manual_download_program', type='json', methods=['POST'], auth='wechat_token', cors='*')
|
||||
@http.route('/api/manual_download_program', type='json', methods=['POST'], auth='public', cors='*')
|
||||
def manual_download_program(self):
|
||||
"""
|
||||
人工线下加工传输编程文件
|
||||
@@ -18,6 +18,11 @@ class MainController(http.Controller):
|
||||
maintenance_equipment = request.env['maintenance.equipment'].sudo().search([('name', '=', maintenance_equipment_name)], limit=1)
|
||||
if not maintenance_equipment:
|
||||
return {'code': 400, 'message': '机床不存在'}
|
||||
# 获取刀具组
|
||||
tool_groups_id = request.env['sf.tool.groups'].sudo().search([('equipment_ids', 'in', maintenance_equipment.id)], limit=1)
|
||||
if not tool_groups_id:
|
||||
return {'code': 400, 'message': '刀具组不存在'}
|
||||
|
||||
ftp_resconfig = request.env['res.config.settings'].sudo().get_values()
|
||||
source_ftp_info = {
|
||||
'host': ftp_resconfig['ftp_host'],
|
||||
@@ -36,7 +41,8 @@ class MainController(http.Controller):
|
||||
source_ftp_info,
|
||||
target_ftp_info,
|
||||
'/' + str(model_id),
|
||||
'/home/jikimo/testdir'):
|
||||
'/home/jikimo/testdir',
|
||||
end_with=tool_groups_id.name + '-all.nc'):
|
||||
return {'code': 200, 'message': 'success'}
|
||||
else:
|
||||
return {'code': 500, 'message': '传输失败'}
|
||||
|
||||
Reference in New Issue
Block a user