1、制造订单点击返工按钮添加新的过滤条件;2、优化工单工序逻辑;3、返工添加校验限制条件;

This commit is contained in:
yuxianghui
2024-12-11 17:24:32 +08:00
parent ad74fd989b
commit 7c17241882
3 changed files with 39 additions and 19 deletions

View File

@@ -914,7 +914,7 @@ class MrpProduction(models.Model):
# 对工单进行逐个插入
for work_id in work_ids:
for order_id in rec.workorder_ids.filtered(lambda item: item.sequence > 0):
if work_id.name == order_id.name:
if work_id.name == order_id.name and work_id.processing_panel == order_id.processing_panel:
work_id.sequence = order_id.sequence + 1
break
# 对该工单之后的工单工序进行加一
@@ -1196,7 +1196,9 @@ class MrpProduction(models.Model):
lambda wk: (wk.name == result_id.routing_type and wk.processing_panel == result_id.processing_panel
and wk.state == 'done')).id
for result_id in result_ids]
workorder_ids = self.workorder_ids.filtered(
lambda wk: wk.technology_design_id.routing_tag == 'standard' and wk.state not in ['rework', 'cancel'])
logging.info('标准工艺工单【%s' % workorder_ids)
return {
'name': _('返工'),
'type': 'ir.actions.act_window',
@@ -1205,7 +1207,7 @@ class MrpProduction(models.Model):
'target': 'new',
'context': {
'default_production_id': self.id,
'default_workorder_ids': self.workorder_ids.ids,
'default_workorder_ids': workorder_ids.ids if workorder_ids.ids != [] else self.workorder_ids.ids,
'default_hidden_workorder_ids': ','.join(map(str, work_id_list)) if work_id_list != [] else '',
'default_reprogramming_num': cloud_programming['reprogramming_num'],
'default_programming_state': cloud_programming['programming_state'],