修复返工-功能刀具
This commit is contained in:
@@ -910,7 +910,16 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
# if workorder.state not in ['cancel', 'rework']:
|
# if workorder.state not in ['cancel', 'rework']:
|
||||||
# workorder.state = 'rework'
|
# workorder.state = 'rework'
|
||||||
if workorder.routing_type == '装夹预调' and workorder.state in ['waiting', 'ready', 'pending']:
|
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.production_id.tool_state in ['1', '2']:
|
||||||
if workorder.state in ['ready']:
|
if workorder.state in ['ready']:
|
||||||
@@ -927,8 +936,8 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
workorder.state = 'waiting'
|
workorder.state = 'waiting'
|
||||||
continue
|
continue
|
||||||
elif workorder.production_id.tool_state in ['0']:
|
elif workorder.production_id.tool_state in ['0']:
|
||||||
if workorder.production_id.workorder_ids.filtered(lambda a: a.state == 'rework'):
|
if workorder_ids.filtered(lambda a: a.state == 'rework'):
|
||||||
if not workorder.production_id.workorder_ids.filtered(
|
if not workorder_ids.filtered(
|
||||||
lambda a: (a.routing_type not in ['装夹预调'] and
|
lambda a: (a.routing_type not in ['装夹预调'] and
|
||||||
a.state not in ['pending', 'done', 'rework', 'cancel'])):
|
a.state not in ['pending', 'done', 'rework', 'cancel'])):
|
||||||
# 查询工序最小的非完工、非返工的装夹预调工单
|
# 查询工序最小的非完工、非返工的装夹预调工单
|
||||||
|
|||||||
Reference in New Issue
Block a user