修复调用更新程序

This commit is contained in:
jinling.yang
2024-07-17 10:15:05 +08:00
parent ec0b5e88b6
commit 6eaf92b841
2 changed files with 17 additions and 17 deletions

View File

@@ -831,17 +831,17 @@ class MrpProduction(models.Model):
r = r.json() r = r.json()
result = json.loads(r['result']) result = json.loads(r['result'])
if result['status'] == 1: if result['status'] == 1:
# program_path_tmp_panel = os.path.join('/tmp', result['folder_name'], 'return', processing_panel) program_path_tmp_panel = os.path.join('/tmp', result['folder_name'], 'return', processing_panel)
# if os.path.exists(program_path_tmp_panel): if os.path.exists(program_path_tmp_panel):
# files_r = os.listdir(program_path_tmp_panel) files_r = os.listdir(program_path_tmp_panel)
# if files_r: if files_r:
# 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:
@@ -854,8 +854,8 @@ class MrpProduction(models.Model):
panel_workorder.cnc_ids.sudo().unlink() panel_workorder.cnc_ids.sudo().unlink()
self.env['sf.cam.work.order.program.knife.plan'].sudo().unlink_cam_plan( self.env['sf.cam.work.order.program.knife.plan'].sudo().unlink_cam_plan(
productions) productions)
program_path_tmp_panel = os.path.join('C://Users//43484//Desktop//fsdownload//test', # program_path_tmp_panel = os.path.join('C://Users//43484//Desktop//fsdownload//test',
processing_panel) # processing_panel)
logging.info('program_path_tmp_panel:%s' % program_path_tmp_panel) logging.info('program_path_tmp_panel:%s' % program_path_tmp_panel)
files_panel = os.listdir(program_path_tmp_panel) files_panel = os.listdir(program_path_tmp_panel)
if files_panel: if files_panel:

View File

@@ -66,12 +66,12 @@ class ReworkWizard(models.TransientModel):
self.production_id.detection_result_ids.filtered( self.production_id.detection_result_ids.filtered(
lambda ap1: ap1.processing_panel == panel.name and ap1.handle_result == '待处理').write( lambda ap1: ap1.processing_panel == panel.name and ap1.handle_result == '待处理').write(
{'handle_result': '已处理'}) {'handle_result': '已处理'})
if self.is_reprogramming is False:
self.production_id.get_new_program(panel)
if self.is_reprogramming is True: if self.is_reprogramming is True:
self.production_id.update_programming_state() self.production_id.update_programming_state()
else: if self.production_id.state == 'progress':
self.production_id.do_update_program() self.production_id.write({'programming_state': '已编程'})
if self.production_id.state == 'progress':
self.production_id.write({'programming_state': '已编程'})
@api.onchange('production_id') @api.onchange('production_id')
def onchange_processing_panel_id(self): def onchange_processing_panel_id(self):