From bc2c0f7fb0c4ff18b1a786bce067926513aa1c5d Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Sun, 28 Apr 2024 15:17:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=AB=99=E7=82=B9=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E6=9C=AA=E5=8F=98=EF=BC=8C=E5=8F=8A=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E7=AD=9B=E9=80=89=E6=A1=86=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/agv_setting.py | 2 ++ sf_manufacturing/models/mrp_workorder.py | 12 ++---------- sf_manufacturing/views/mrp_workorder_view.xml | 11 +++++++---- sf_plan/models/custom_plan.py | 3 ++- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/sf_manufacturing/models/agv_setting.py b/sf_manufacturing/models/agv_setting.py index dad6ec4f..164d3175 100644 --- a/sf_manufacturing/models/agv_setting.py +++ b/sf_manufacturing/models/agv_setting.py @@ -32,6 +32,8 @@ class AgvSetting(models.Model): if da['DeviceId'] == item.name: if da['AtHome'] is True: item.state = '占用' + else: + item.state = '空闲' class AgvTaskRoute(models.Model): diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index dd7dbd3c..9d64361e 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -1081,9 +1081,7 @@ class WorkPieceDelivery(models.Model): delivery_num = fields.Char('工件配送编码') workorder_id = fields.Many2one('mrp.workorder', string='工单', readonly=True) production_id = fields.Many2one('mrp.production', string='制造订单号', readonly=True) - production_line_id = fields.Many2one('sf.production.line', compute='_compute_production_line_id', - string='目的生产线', readonly=True, - store=True) + production_line_id = fields.Many2one('sf.production.line', string='目的生产线') plan_start_processing_time = fields.Datetime('计划开始加工时间', readonly=True) route_id = fields.Many2one('sf.agv.task.route', '任务路线') @@ -1235,13 +1233,7 @@ class WorkPieceDelivery(models.Model): raise UserError(ret['message']) except Exception as e: logging.info('config-e:%s' % e) - raise UserError("工件配送请求agv失败") - - @api.onchange('production_id.production_line_id') - def _compute_production_line_id(self): - if self.production_id.production_line_id: - self.production_line_id = self.production_id.production_line_id.id - self.plan_start_processing_time = self.production_id.plan_start_processing_time + raise UserError("工件配送请求agv失败:%s" % e) @api.depends('task_delivery_time', 'task_completion_time') def _compute_delivery_duration(self): diff --git a/sf_manufacturing/views/mrp_workorder_view.xml b/sf_manufacturing/views/mrp_workorder_view.xml index 0611e1e3..841b51ed 100644 --- a/sf_manufacturing/views/mrp_workorder_view.xml +++ b/sf_manufacturing/views/mrp_workorder_view.xml @@ -608,9 +608,12 @@ sf.workpiece.delivery - - - + + + + @@ -631,7 +634,7 @@ 工件配送 sf.workpiece.delivery - {'search_default_on_down':1} + {'search_default_on_up':1} tree,search [('type','in',['上产线','下产线'])] diff --git a/sf_plan/models/custom_plan.py b/sf_plan/models/custom_plan.py index fc38bc11..bcb15d69 100644 --- a/sf_plan/models/custom_plan.py +++ b/sf_plan/models/custom_plan.py @@ -84,7 +84,8 @@ class sf_production_plan(models.Model): item.sudo().production_id.production_line_id = item.production_line_id.id item.sudo().production_id.workorder_ids.filtered( lambda b: b.routing_type == "装夹预调").workpiece_delivery_ids.write( - {'production_line_id': item.production_line_id.id}) + {'production_line_id': item.production_line_id.id, + 'plan_start_processing_time': item.plan_start_processing_time}) # item.sudo().production_id.plan_start_processing_time = item.date_planned_start # @api.onchange('state')