修复返工(CNC加工)
This commit is contained in:
@@ -763,11 +763,7 @@ class MrpProduction(models.Model):
|
||||
'default_production_id': self.id,
|
||||
'default_reprogramming_num': cloud_programming['reprogramming_num'],
|
||||
'default_programming_state': cloud_programming['programming_state'],
|
||||
'default_is_reprogramming': False if (cloud_programming['programming_state'] in ['编程中',
|
||||
'待编程'] and self.programming_state in [
|
||||
'编程中', '已编程'])
|
||||
or (cloud_programming['programming_state'] in [
|
||||
'已编程'] and self.programming_state in ['已编程未下发']) else True
|
||||
'default_is_reprogramming': False if cloud_programming['programming_state'] not in ['已下发'] else True
|
||||
}
|
||||
}
|
||||
|
||||
@@ -802,7 +798,7 @@ class MrpProduction(models.Model):
|
||||
'pending'] and m1.processing_panel == rework_item.processing_panel and m1.routing_type == 'CNC加工')
|
||||
if not pending_workorder.cnc_ids:
|
||||
production.get_new_program(rework_item.processing_panel)
|
||||
production.write({'state': 'progress', 'programming_state': '已编程', 'is_rework': False})
|
||||
# production.write({'state': 'progress', 'programming_state': '已编程', 'is_rework': False})
|
||||
productions_not_delivered.write({'programming_state': '已编程', 'is_rework': False})
|
||||
|
||||
# 从cloud获取重新编程过的最新程序
|
||||
@@ -817,17 +813,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:
|
||||
@@ -841,8 +837,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:
|
||||
|
||||
Reference in New Issue
Block a user