diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index df28003e..0fb462fa 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -815,17 +815,17 @@ class MrpProduction(models.Model): r = r.json() result = json.loads(r['result']) if result['status'] == 1: - # program_path_tmp_panel = os.path.join('/tmp', result['folder_name'], 'return', processing_panel) - # if os.path.exists(program_path_tmp_panel): - # files_r = os.listdir(program_path_tmp_panel) - # if files_r: - # for file_name in files_r: - # file_path = os.path.join(program_path_tmp_panel, file_name) - # os.remove(file_path) - # download_state = self.env['sf.cnc.processing'].download_file_tmp(result['folder_name'], - # processing_panel) - # if download_state is False: - # raise UserError('编程单号为%s的CNC程序文件从FTP拉取失败' % (self.programming_no)) + program_path_tmp_panel = os.path.join('/tmp', result['folder_name'], 'return', processing_panel) + if os.path.exists(program_path_tmp_panel): + files_r = os.listdir(program_path_tmp_panel) + if files_r: + for file_name in files_r: + file_path = os.path.join(program_path_tmp_panel, file_name) + os.remove(file_path) + download_state = self.env['sf.cnc.processing'].download_file_tmp(result['folder_name'], + processing_panel) + if download_state is False: + raise UserError('编程单号为%s的CNC程序文件从FTP拉取失败' % (self.programming_no)) productions = self.env['mrp.production'].search( [('programming_no', '=', self.programming_no), ('state', 'not in', ['cancel,done'])]) if productions: @@ -838,8 +838,8 @@ class MrpProduction(models.Model): panel_workorder.cnc_ids.sudo().unlink() self.env['sf.cam.work.order.program.knife.plan'].sudo().unlink_cam_plan( productions) - program_path_tmp_panel = os.path.join('C://Users//43484//Desktop//fsdownload//test', - processing_panel) + # program_path_tmp_panel = os.path.join('C://Users//43484//Desktop//fsdownload//test', + # processing_panel) logging.info('program_path_tmp_panel:%s' % program_path_tmp_panel) files_panel = os.listdir(program_path_tmp_panel) if files_panel: diff --git a/sf_manufacturing/models/product_template.py b/sf_manufacturing/models/product_template.py index f292d694..4d05de81 100644 --- a/sf_manufacturing/models/product_template.py +++ b/sf_manufacturing/models/product_template.py @@ -7,8 +7,8 @@ import os from odoo import models, fields, api, _ from odoo.exceptions import ValidationError from odoo.modules import get_resource_path -# from OCC.Extend.DataExchange import read_step_file -# from OCC.Extend.DataExchange import write_stl_file +from OCC.Extend.DataExchange import read_step_file +from OCC.Extend.DataExchange import write_stl_file class ResProductMo(models.Model): diff --git a/sf_sale/models/quick_easy_order.py b/sf_sale/models/quick_easy_order.py index 11acc06f..e3bf3002 100644 --- a/sf_sale/models/quick_easy_order.py +++ b/sf_sale/models/quick_easy_order.py @@ -8,8 +8,8 @@ from datetime import datetime import requests from odoo import http from odoo.http import request -# from OCC.Extend.DataExchange import read_step_file -# from OCC.Extend.DataExchange import write_stl_file +from OCC.Extend.DataExchange import read_step_file +from OCC.Extend.DataExchange import write_stl_file from odoo import models, fields, api from odoo.modules import get_resource_path from odoo.exceptions import ValidationError, UserError diff --git a/sf_sale/models/quick_easy_order_old.py b/sf_sale/models/quick_easy_order_old.py index 92f6cda2..3ae65db3 100644 --- a/sf_sale/models/quick_easy_order_old.py +++ b/sf_sale/models/quick_easy_order_old.py @@ -6,8 +6,8 @@ import os from datetime import datetime from stl import mesh # from OCC.Core.GProp import GProp_GProps -# from OCC.Extend.DataExchange import read_step_file -# from OCC.Extend.DataExchange import write_stl_file +from OCC.Extend.DataExchange import read_step_file +from OCC.Extend.DataExchange import write_stl_file from odoo.addons.sf_base.commons.common import Common from odoo import models, fields, api from odoo.modules import get_resource_path