修复返工-功能刀具

This commit is contained in:
jinling.yang
2024-07-30 17:45:41 +08:00
parent 50dcc9f7ba
commit c01dfddfb4

View File

@@ -910,7 +910,16 @@ class ResMrpWorkOrder(models.Model):
# if workorder.state not in ['cancel', 'rework']:
# workorder.state = 'rework'
if workorder.routing_type == '装夹预调' and workorder.state in ['waiting', 'ready', 'pending']:
if workorder.production_id.programming_state == '已编程':
workorder_ids = workorder.production_id.workorder_ids
work_bo = True
for wo in workorder_ids.filtered(lambda a: a.routing_type == '装夹预调' and a.state == 'rework'):
if not workorder_ids.filtered(
lambda a: (a.routing_type == '装夹预调' and a.state not in ['rework', 'cancel']
and a.processing_panel == wo.processing_panel)):
work_bo = False
break
if (workorder.production_id.programming_state == '已编程' and work_bo
and not workorder_ids.filtered(lambda a: a.sequence == 0)):
# 当工单对应制造订单的功能刀具状态为 【无效刀】时,先对的第一个装夹预调工单状态设置为 【等待组件】
if workorder.production_id.tool_state in ['1', '2']:
if workorder.state in ['ready']:
@@ -927,8 +936,8 @@ class ResMrpWorkOrder(models.Model):
workorder.state = 'waiting'
continue
elif workorder.production_id.tool_state in ['0']:
if workorder.production_id.workorder_ids.filtered(lambda a: a.state == 'rework'):
if not workorder.production_id.workorder_ids.filtered(
if workorder_ids.filtered(lambda a: a.state == 'rework'):
if not workorder_ids.filtered(
lambda a: (a.routing_type not in ['装夹预调'] and
a.state not in ['pending', 'done', 'rework', 'cancel'])):
# 查询工序最小的非完工、非返工的装夹预调工单