解除装夹起点从下产线agv调度任务关联带出

This commit is contained in:
胡尧
2024-09-06 15:34:30 +08:00
parent 096542c8ff
commit 2d5ef0aae4
3 changed files with 29 additions and 2 deletions

View File

@@ -1340,7 +1340,7 @@ class ResMrpWorkOrder(models.Model):
'name': 'button_delivery',
'type': 'object',
'string': '解除装夹',
'class': 'btn-primary',
'class': 'btn-primary jikimo_button_confirm',
# 'className': 'btn-primary',
'modifiers': '{"force_show": 1}'
})
@@ -1355,6 +1355,7 @@ class ResMrpWorkOrder(models.Model):
workorder_ids = []
delivery_type = '运送空料架'
max_num = 4 # 最大配送数量
feeder_station_start_id = False
if len(self) > max_num:
raise UserError('仅限于拆卸1-4个制造订单请重新选择')
for item in self:
@@ -1363,6 +1364,10 @@ class ResMrpWorkOrder(models.Model):
production_ids.append(item.production_id.id)
workorder_ids.append(item.id)
if not feeder_station_start_id:
down_product_agv_scheduling = self.get_down_product_agv_scheduling()
if down_product_agv_scheduling:
feeder_station_start_id = down_product_agv_scheduling.end_site_id.id
return {
'name': _('确认'),
'type': 'ir.actions.act_window',
@@ -1375,7 +1380,8 @@ class ResMrpWorkOrder(models.Model):
'default_delivery_type': delivery_type,
'default_workorder_ids': [(6, 0, workorder_ids)],
'default_workcenter_id': self.env.context.get('default_workcenter_id'),
'default_confirm_button': '确认解除'
'default_confirm_button': '确认解除',
'default_feeder_station_start_id': feeder_station_start_id,
}}