调整爆出位置

This commit is contained in:
mgw
2025-01-13 13:51:07 +08:00
parent 332a44e861
commit be9846986f
2 changed files with 13 additions and 8 deletions

View File

@@ -61,8 +61,8 @@ class Sf_Mrs_Connect(http.Controller, MultiInheritController):
# 查询状态为进行中且工序类型为CNC加工的工单
cnc_workorder_has = production.workorder_ids.filtered(
lambda ach: ach.routing_type == 'CNC加工' and ach.state not in ['progress', 'done',
'rework',
'cancel'] and ach.processing_panel == panel)
'rework',
'cancel'] and ach.processing_panel == panel)
if cnc_workorder_has:
if cnc_workorder_has.cnc_ids:
cnc_workorder_has.cmm_ids.sudo().unlink()
@@ -76,7 +76,7 @@ class Sf_Mrs_Connect(http.Controller, MultiInheritController):
# 查询状态为进行中且工序类型为CNC加工的工单
cnc_workorder = productions.workorder_ids.filtered(
lambda ac: ac.routing_type == 'CNC加工' and ac.state not in ['progress', 'done', 'rework'
'cancel'] and ac.processing_panel == panel)
'cancel'] and ac.processing_panel == panel)
if cnc_workorder:
# program_path_tmp_panel = os.path.join('C://Users//43484//Desktop//fsdownload//test',
# panel)
@@ -91,7 +91,7 @@ class Sf_Mrs_Connect(http.Controller, MultiInheritController):
cnc_workorder.write({'cnc_worksheet': base64.b64encode(open(panel_file_path, 'rb').read())})
pre_workorder = productions.workorder_ids.filtered(
lambda ap: ap.routing_type == '装夹预调' and ap.state not in ['done', 'rework'
'cancel'] and ap.processing_panel == panel)
'cancel'] and ap.processing_panel == panel)
if pre_workorder:
pre_workorder.write(
{'processing_drawing': base64.b64encode(open(panel_file_path, 'rb').read())})
@@ -100,7 +100,8 @@ class Sf_Mrs_Connect(http.Controller, MultiInheritController):
# 更新编程记录
for production in productions:
record_ids_obj = production.programming_record_ids.filtered(lambda r: r.current_programming_count == ret['reprogramming_num'])
record_ids_obj = production.programming_record_ids.filtered(
lambda r: r.current_programming_count == ret['reprogramming_num'])
if record_ids_obj:
record_ids_obj.write({'send_time': ret['send_time']})
if ret['reprogramming_num'] == 0:
@@ -130,12 +131,15 @@ class Sf_Mrs_Connect(http.Controller, MultiInheritController):
'production_ids': productions.ids
})
# 对制造订单所面的cnc工单的程序用刀进行校验
# 对制造订单所面的cnc工单的程序用刀进行校验
try:
logging.info(f'已更新制造订单:{productions}')
productions.production_cnc_tool_checkout()
re_tool_chekout = False
re_tool_chekout = productions.production_cnc_tool_checkout()
if re_tool_chekout:
return json.JSONEncoder().encode({'status': -2, 'message': '对cnc工单的程序用刀进行校验失败'})
except Exception as e:
res = {'status': -2, 'message': '对cnc工单的程序用刀进行校验失败'}
# res = {'status': -2, 'message': '对cnc工单的程序用刀进行校验失败'}
logging.info(f'对cnc工单的程序用刀进行校验报错{e}')
return json.JSONEncoder().encode(res)

View File

@@ -203,6 +203,7 @@ class MrpProduction(models.Model):
self.write({'programming_state': '编程中', 'work_state': '编程中'})
self[0].workorder_ids.filtered(
lambda a: a.name == '装夹预调' and a.state not in ['rework', 'done', 'cancel'])._compute_state()
return True
if missing_tool_1:
logging.info(f'线边、机内缺刀:{missing_tool_1}')
# 修改 修改cnc程序的刀具状态 为 ‘缺刀’